diff options
Diffstat (limited to 'drivers')
44 files changed, 0 insertions, 3710 deletions
diff --git a/drivers/ali512x.c b/drivers/ali512x.c index 7b7edc09af..c0e42e925a 100644 --- a/drivers/ali512x.c +++ b/drivers/ali512x.c @@ -64,13 +64,6 @@ static void ali_write(u8 index, u8 value) outb(value, ALI_DATA); } -#if 0 -static int ali_read(u8 index) -{ - outb(index, ALI_INDEX); - return inb(ALI_DATA); -} -#endif #define ALI_OPEN() \ outb(0x51, ALI_INDEX); \ diff --git a/drivers/bcm570x.c b/drivers/bcm570x.c index 5f632a6469..74f57565ff 100644 --- a/drivers/bcm570x.c +++ b/drivers/bcm570x.c @@ -620,10 +620,6 @@ eth_send(volatile void *packet, int length) /* Link down, return */ while(pDevice->LinkStatus == LM_STATUS_LINK_DOWN) { -#if 0 - printf("eth%d: link down - check cable or link partner.\n", - pUmDevice->index); -#endif eth_isr(); /* Wait to see link for one-half a second before sending ... */ @@ -1218,9 +1214,6 @@ MM_IndicateStatus(PLM_DEVICE_BLOCK pDevice, LM_STATUS Status) strcat(buf,"\n"); printf("%s",buf); } -#if 0 - sysLedDsply(lcd[0],lcd[1],lcd[2],lcd[3]); -#endif return LM_STATUS_SUCCESS; } diff --git a/drivers/bcm570x_autoneg.c b/drivers/bcm570x_autoneg.c index 9023796aa0..cec741c620 100644 --- a/drivers/bcm570x_autoneg.c +++ b/drivers/bcm570x_autoneg.c @@ -397,19 +397,7 @@ Autoneg8023z( Delta_us = pAnInfo->CurrentTime_us - pAnInfo->LinkTime_us; if(Delta_us > AN_LINK_TIMER_INTERVAL_US) { -#if 0 -/* if(pAnInfo->IdleMatch == AN_TRUE) */ -/* { */ -#endif pAnInfo->State = AN_STATE_LINK_OK; -#if 0 -/* } */ -/* else */ -/* { */ -/* AnRet = AUTONEG_STATUS_FAILED; */ -/* break; */ -/* } */ -#endif } break; diff --git a/drivers/bcm570x_mm.h b/drivers/bcm570x_mm.h index b7cbf8abd4..cb6b2779fb 100644 --- a/drivers/bcm570x_mm.h +++ b/drivers/bcm570x_mm.h @@ -154,7 +154,4 @@ extern void sysSerialPrintString (char *s); /* Define memory barrier function here if needed */ #define wmb() -#if 0 -#define cpu_to_le32(val) LONGSWAP(val) -#endif #endif /* MM_H */ diff --git a/drivers/dc2114x.c b/drivers/dc2114x.c index c43cd5ec2f..6bb6e0e565 100644 --- a/drivers/dc2114x.c +++ b/drivers/dc2114x.c @@ -416,10 +416,6 @@ static int dc21x4x_send(struct eth_device* dev, volatile void *packet, int lengt } if (le32_to_cpu(tx_ring[tx_new].status) & TD_ES) { -#if 0 /* test-only */ - printf("TX error status = 0x%08X\n", - le32_to_cpu(tx_ring[tx_new].status)); -#endif tx_ring[tx_new].status = 0x0; goto Done; } diff --git a/drivers/e1000.c b/drivers/e1000.c index 927acbb267..821406ce43 100644 --- a/drivers/e1000.c +++ b/drivers/e1000.c @@ -356,95 +356,6 @@ e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset, uint16_t * data) return 0; } -#if 0 -static void -e1000_eeprom_cleanup(struct e1000_hw *hw) -{ - uint32_t eecd; - - eecd = E1000_READ_REG(hw, EECD); - eecd &= ~(E1000_EECD_CS | E1000_EECD_DI); - E1000_WRITE_REG(hw, EECD, eecd); - e1000_raise_ee_clk(hw, &eecd); - e1000_lower_ee_clk(hw, &eecd); -} - -static uint16_t -e1000_wait_eeprom_done(struct e1000_hw *hw) -{ - uint32_t eecd; - uint32_t i; - - e1000_standby_eeprom(hw); - for (i = 0; i < 200; i++) { - eecd = E1000_READ_REG(hw, EECD); - if (eecd & E1000_EECD_DO) - return (TRUE); - udelay(5); - } - return (FALSE); -} - -static int -e1000_write_eeprom(struct e1000_hw *hw, uint16_t Reg, uint16_t Data) -{ - uint32_t eecd; - int large_eeprom = FALSE; - int i = 0; - - /* Request EEPROM Access */ - if (hw->mac_type > e1000_82544) { - eecd = E1000_READ_REG(hw, EECD); - if (eecd & E1000_EECD_SIZE) - large_eeprom = TRUE; - eecd |= E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - eecd = E1000_READ_REG(hw, EECD); - while ((!(eecd & E1000_EECD_GNT)) && (i < 100)) { - i++; - udelay(5); - eecd = E1000_READ_REG(hw, EECD); - } - if (!(eecd & E1000_EECD_GNT)) { - eecd &= ~E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - DEBUGOUT("Could not acquire EEPROM grant\n"); - return FALSE; - } - } - e1000_setup_eeprom(hw); - e1000_shift_out_ee_bits(hw, EEPROM_EWEN_OPCODE, 5); - e1000_shift_out_ee_bits(hw, Reg, (large_eeprom) ? 6 : 4); - e1000_standby_eeprom(hw); - e1000_shift_out_ee_bits(hw, EEPROM_WRITE_OPCODE, 3); - e1000_shift_out_ee_bits(hw, Reg, (large_eeprom) ? 8 : 6); - e1000_shift_out_ee_bits(hw, Data, 16); - if (!e1000_wait_eeprom_done(hw)) { - return FALSE; - } - e1000_shift_out_ee_bits(hw, EEPROM_EWDS_OPCODE, 5); - e1000_shift_out_ee_bits(hw, Reg, (large_eeprom) ? 6 : 4); - e1000_eeprom_cleanup(hw); - - /* Stop requesting EEPROM access */ - if (hw->mac_type > e1000_82544) { - eecd = E1000_READ_REG(hw, EECD); - eecd &= ~E1000_EECD_REQ; - E1000_WRITE_REG(hw, EECD, eecd); - } - i = 0; - eecd = E1000_READ_REG(hw, EECD); - while (((eecd & E1000_EECD_GNT)) && (i < 500)) { - i++; - udelay(10); - eecd = E1000_READ_REG(hw, EECD); - } - if ((eecd & E1000_EECD_GNT)) { - DEBUGOUT("Could not release EEPROM grant\n"); - } - return TRUE; -} -#endif /****************************************************************************** * Verifies that the EEPROM has a valid checksum @@ -697,11 +608,6 @@ e1000_reset_hw(struct e1000_hw *hw) DEBUGOUT("Issuing a global reset to MAC\n"); ctrl = E1000_READ_REG(hw, CTRL); -#if 0 - if (hw->mac_type > e1000_82543) - E1000_WRITE_REG_IO(hw, CTRL, (ctrl | E1000_CTRL_RST)); - else -#endif E1000_WRITE_REG(hw, CTRL, (ctrl | E1000_CTRL_RST)); /* Force a reload from the EEPROM if necessary */ @@ -761,14 +667,6 @@ e1000_init_hw(struct eth_device *nic) e1000_bus_type bus_type = e1000_bus_type_unknown; DEBUGFUNC(); -#if 0 - /* Initialize Identification LED */ - ret_val = e1000_id_led_init(hw); - if (ret_val < 0) { - DEBUGOUT("Error Initializing Identification LED\n"); - return ret_val; - } -#endif /* Set the Media Type and exit with error if it is not valid. */ if (hw->mac_type != e1000_82543) { /* tbi_compatibility is only valid on 82543 */ @@ -824,16 +722,6 @@ e1000_init_hw(struct eth_device *nic) for (i = 0; i < E1000_MC_TBL_SIZE; i++) E1000_WRITE_REG_ARRAY(hw, MTA, i, 0); -#if 0 - /* Set the PCI priority bit correctly in the CTRL register. This - * determines if the adapter gives priority to receives, or if it - * gives equal priority to transmits and receives. - */ - if (hw->dma_fairness) { - ctrl = E1000_READ_REG(hw, CTRL); - E1000_WRITE_REG(hw, CTRL, ctrl | E1000_CTRL_PRIOR); - } -#endif if (hw->mac_type >= e1000_82543) { status = E1000_READ_REG(hw, STATUS); bus_type = (status & E1000_STATUS_PCIX_MODE) ? @@ -872,14 +760,6 @@ e1000_init_hw(struct eth_device *nic) E1000_TXDCTL_FULL_TX_DESC_WB; E1000_WRITE_REG(hw, TXDCTL, ctrl); } -#if 0 - /* Clear all of the statistics registers (clear on read). It is - * important that we do this after we have tried to establish link - * because the symbol error count will increment wildly if there - * is no link. - */ - e1000_clear_hw_cntrs(hw); -#endif return ret_val; } @@ -1189,47 +1069,9 @@ e1000_setup_copper_link(struct eth_device *nic) } phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX; -#if 0 - /* Options: - * MDI/MDI-X = 0 (default) - * 0 - Auto for all speeds - * 1 - MDI mode - * 2 - MDI-X mode - * 3 - Auto for 1000Base-T only (MDI-X for 10/100Base-T modes) - */ - phy_data &= ~M88E1000_PSCR_AUTO_X_MODE; - switch (hw->mdix) { - case 1: - phy_data |= M88E1000_PSCR_MDI_MANUAL_MODE; - break; - case 2: - phy_data |= M88E1000_PSCR_MDIX_MANUAL_MODE; - break; - case 3: - phy_data |= M88E1000_PSCR_AUTO_X_1000T; - break; - case 0: - default: - phy_data |= M88E1000_PSCR_AUTO_X_MODE; - break; - } -#else phy_data |= M88E1000_PSCR_AUTO_X_MODE; -#endif -#if 0 - /* Options: - * disable_polarity_correction = 0 (default) - * Automatic Correction for Reversed Cable Polarity - * 0 - Disabled - * 1 - Enabled - */ - phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; - if (hw->disable_polarity_correction == 1) - phy_data |= M88E1000_PSCR_POLARITY_REVERSAL; -#else phy_data &= ~M88E1000_PSCR_POLARITY_REVERSAL; -#endif if (e1000_write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data) < 0) { DEBUGOUT("PHY Write Error\n"); return -E1000_ERR_PHY; @@ -1306,19 +1148,6 @@ e1000_setup_copper_link(struct eth_device *nic) DEBUGOUT("PHY Write Error\n"); return -E1000_ERR_PHY; } -#if 0 - /* Does the user want to wait for Auto-Neg to complete here, or - * check at a later time (for example, callback routine). - */ - if (hw->wait_autoneg_complete) { - ret_val = e1000_wait_autoneg(hw); - if (ret_val < 0) { - DEBUGOUT - ("Error while waiting for autoneg to complete\n"); - return ret_val; - } - } -#else /* If we do not wait for autonegtation to complete I * do not see a valid link status. */ @@ -1327,7 +1156,6 @@ e1000_setup_copper_link(struct eth_device *nic) DEBUGOUT("Error while waiting for autoneg to complete\n"); return ret_val; } -#endif /* Check link status. Wait up to 100 microseconds for link to become * valid. @@ -2605,16 +2433,6 @@ e1000_sw_init(struct eth_device *nic, int cardnum) hw->report_tx_early = 1; hw->tbi_compatibility_en = TRUE; -#if 0 - hw->wait_autoneg_complete = FALSE; - hw->adaptive_ifs = TRUE; - - /* Copper options */ - if (hw->media_type == e1000_media_type_copper) { - hw->mdix = AUTO_ALL_MODES; - hw->disable_polarity_correction = FALSE; - } -#endif return E1000_SUCCESS; } @@ -2678,12 +2496,6 @@ e1000_configure_tx(struct e1000_hw *hw) tipg |= DEFAULT_82543_TIPG_IPGR2 << E1000_TIPG_IPGR2_SHIFT; } E1000_WRITE_REG(hw, TIPG, tipg); -#if 0 - /* Set the Tx Interrupt Delay register */ - E1000_WRITE_REG(hw, TIDV, adapter->tx_int_delay); - if (hw->mac_type >= e1000_82540) - E1000_WRITE_REG(hw, TADV, adapter->tx_abs_int_delay); -#endif /* Program the Transmit Control Register */ tctl = E1000_READ_REG(hw, TCTL); tctl &= ~E1000_TCTL_CT; @@ -2692,15 +2504,6 @@ e1000_configure_tx(struct e1000_hw *hw) E1000_WRITE_REG(hw, TCTL, tctl); e1000_config_collision_dist(hw); -#if 0 - /* Setup Transmit Descriptor Settings for this adapter */ - adapter->txd_cmd = E1000_TXD_CMD_IFCS | E1000_TXD_CMD_IDE; - - if (adapter->hw.report_tx_early == 1) - adapter->txd_cmd |= E1000_TXD_CMD_RS; - else - adapter->txd_cmd |= E1000_TXD_CMD_RPS; -#endif } /** @@ -2725,26 +2528,8 @@ e1000_setup_rctl(struct e1000_hw *hw) rctl &= ~E1000_RCTL_SBP; rctl &= ~(E1000_RCTL_SZ_4096); -#if 0 - switch (adapter->rx_buffer_len) { - case E1000_RXBUFFER_2048: - default: -#endif rctl |= E1000_RCTL_SZ_2048; rctl &= ~(E1000_RCTL_BSEX | E1000_RCTL_LPE); -#if 0 - break; - case E1000_RXBUFFER_4096: - rctl |= E1000_RCTL_SZ_4096 | E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - case E1000_RXBUFFER_8192: - rctl |= E1000_RCTL_SZ_8192 | E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - case E1000_RXBUFFER_16384: - rctl |= E1000_RCTL_SZ_16384 | E1000_RCTL_BSEX | E1000_RCTL_LPE; - break; - } -#endif E1000_WRITE_REG(hw, RCTL, rctl); } @@ -2759,22 +2544,11 @@ e1000_configure_rx(struct e1000_hw *hw) { unsigned long ptr; unsigned long rctl; -#if 0 - unsigned long rxcsum; -#endif rx_tail = 0; /* make sure receives are disabled while setting up the descriptors */ rctl = E1000_READ_REG(hw, RCTL); E1000_WRITE_REG(hw, RCTL, rctl & ~E1000_RCTL_EN); -#if 0 - /* set the Receive Delay Timer Register */ - - E1000_WRITE_REG(hw, RDTR, adapter->rx_int_delay); -#endif if (hw->mac_type >= e1000_82540) { -#if 0 - E1000_WRITE_REG(hw, RADV, adapter->rx_abs_int_delay); -#endif /* Set the interrupt throttling rate. Value is calculated * as DEFAULT_ITR = 1/(MAX_INTS_PER_SEC * 256ns) */ #define MAX_INTS_PER_SEC 8000 @@ -2795,14 +2569,6 @@ e1000_configure_rx(struct e1000_hw *hw) /* Setup the HW Rx Head and Tail Descriptor Pointers */ E1000_WRITE_REG(hw, RDH, 0); E1000_WRITE_REG(hw, RDT, 0); -#if 0 - /* Enable 82543 Receive Checksum Offload for TCP and UDP */ - if ((adapter->hw.mac_type >= e1000_82543) && (adapter->rx_csum == TRUE)) { - rxcsum = E1000_READ_REG(hw, RXCSUM); - rxcsum |= E1000_RXCSUM_TUOFL; - E1000_WRITE_REG(hw, RXCSUM, rxcsum); - } -#endif /* Enable Receives */ E1000_WRITE_REG(hw, RCTL, rctl); @@ -2890,9 +2656,6 @@ e1000_disable(struct eth_device *nic) E1000_WRITE_REG(hw, RDT, 0); /* put the card in its initial state */ -#if 0 - E1000_WRITE_REG(hw, CTRL, E1000_CTRL_RST); -#endif mdelay(10); } @@ -2967,13 +2730,8 @@ e1000_initialize(bd_t * bis) sprintf(nic->name, "e1000#%d", card_number); /* Are these variables needed? */ -#if 0 - hw->fc = e1000_fc_none; - hw->original_fc = e1000_fc_none; -#else hw->fc = e1000_fc_default; hw->original_fc = e1000_fc_default; -#endif hw->autoneg_failed = 0; hw->get_link_status = TRUE; hw->hw_addr = (typeof(hw->hw_addr)) iobase; diff --git a/drivers/e1000.h b/drivers/e1000.h index 0fbdc90b1f..274c8d7476 100644 --- a/drivers/e1000.h +++ b/drivers/e1000.h @@ -802,66 +802,26 @@ struct e1000_hw { e1000_media_type media_type; e1000_lan_loc lan_loc; e1000_fc_type fc; -#if 0 - e1000_bus_speed bus_speed; - e1000_bus_width bus_width; - e1000_bus_type bus_type; - uint32_t io_base; -#endif uint32_t phy_id; uint32_t phy_addr; uint32_t original_fc; uint32_t txcw; uint32_t autoneg_failed; -#if 0 - uint32_t max_frame_size; - uint32_t min_frame_size; - uint32_t mc_filter_type; - uint32_t num_mc_addrs; - uint32_t collision_delta; - uint32_t tx_packet_delta; - uint32_t ledctl_default; - uint32_t ledctl_mode1; - uint32_t ledctl_mode2; -#endif uint16_t autoneg_advertised; uint16_t pci_cmd_word; uint16_t fc_high_water; uint16_t fc_low_water; uint16_t fc_pause_time; -#if 0 - uint16_t current_ifs_val; - uint16_t ifs_min_val; - uint16_t ifs_max_val; - uint16_t ifs_step_size; - uint16_t ifs_ratio; -#endif uint16_t device_id; uint16_t vendor_id; uint16_t subsystem_id; uint16_t subsystem_vendor_id; uint8_t revision_id; -#if 0 - uint8_t autoneg; - uint8_t mdix; - uint8_t forced_speed_duplex; - uint8_t wait_autoneg_complete; - uint8_t dma_fairness; -#endif -#if 0 - uint8_t perm_mac_addr[NODE_ADDRESS_SIZE]; - boolean_t disable_polarity_correction; -#endif boolean_t get_link_status; boolean_t tbi_compatibility_en; boolean_t tbi_compatibility_on; boolean_t fc_send_xon; boolean_t report_tx_early; -#if 0 - boolean_t adaptive_ifs; - boolean_t ifs_params_forced; - boolean_t in_ifs_mode; -#endif }; #define E1000_EEPROM_SWDPIN0 0x0001 /* SWDPIN 0 EEPROM Value */ diff --git a/drivers/i82365.c b/drivers/i82365.c index a40fcf41c9..a24160a772 100644 --- a/drivers/i82365.c +++ b/drivers/i82365.c @@ -209,19 +209,6 @@ static void i365_bclr (socket_info_t * s, u_short reg, u_char mask) i365_set (s, reg, i365_get (s, reg) & ~mask); } -#if 0 /* not used */ -static void i365_bflip (socket_info_t * s, u_short reg, u_char mask, int b) -{ - u_char d = i365_get (s, reg); - - i365_set (s, reg, (b) ? (d | mask) : (d & ~mask)); -} - -static u_short i365_get_pair (socket_info_t * s, u_short reg) -{ - return (i365_get (s, reg) + (i365_get (s, reg + 1) << 8)); -} -#endif /* not used */ static void i365_set_pair (socket_info_t * s, u_short reg, u_short data) { @@ -684,25 +671,6 @@ static int i365_set_socket (socket_info_t * s, socket_state_t * state) #ifdef CONFIG_CPC45 cb_set_power (s, state); -#if 0 - /* Card status change interrupt mask */ - reg = s->cs_irq << 4; - if (state->csc_mask & SS_DETECT) - reg |= I365_CSC_DETECT; - if (state->flags & SS_IOCARD) { - if (state->csc_mask & SS_STSCHG) - reg |= I365_CSC_STSCHG; - } else { - if (state->csc_mask & SS_BATDEAD) - reg |= I365_CSC_BVD1; - if (state->csc_mask & SS_BATWARN) - reg |= I365_CSC_BVD2; - if (state->csc_mask & SS_READY) - reg |= I365_CSC_READY; - } - i365_set (s, I365_CSCINT, reg); - i365_get (s, I365_CSC); -#endif /* 0 */ #else /* !CONFIG_CPC45 */ diff --git a/drivers/inca-ip_sw.c b/drivers/inca-ip_sw.c index ab22b4d538..8fa3b41092 100644 --- a/drivers/inca-ip_sw.c +++ b/drivers/inca-ip_sw.c @@ -172,9 +172,6 @@ int inca_switch_initialize(bd_t * bis) { struct eth_device *dev; -#if 0 - printf("Entered inca_switch_initialize()\n"); -#endif if (!(dev = (struct eth_device *) malloc (sizeof *dev))) { printf("Failed to allocate memory\n"); @@ -198,9 +195,6 @@ int inca_switch_initialize(bd_t * bis) eth_register(dev); -#if 0 - printf("Leaving inca_switch_initialize()\n"); -#endif return 1; } @@ -212,9 +206,6 @@ static int inca_switch_init(struct eth_device *dev, bd_t * bis) u32 v, regValue; u16 wTmp; -#if 0 - printf("Entering inca_switch_init()\n"); -#endif /* Set MAC address. */ @@ -262,10 +253,6 @@ static int inca_switch_init(struct eth_device *dev, bd_t * bis) rx_desc->RxDataPtr = (u32)KSEG1ADDR(NetRxPackets[i]); } -#if 0 - printf("rx_ring = 0x%08X 0x%08X\n", (u32)rx_ring, (u32)&rx_ring[0]); - printf("tx_ring = 0x%08X 0x%08X\n", (u32)tx_ring, (u32)&tx_ring[0]); -#endif for (i = 0; i < NUM_TX_DESC; i++) { inca_tx_descriptor_t * tx_desc = KSEG1ADDR(&tx_ring[i]); @@ -293,9 +280,6 @@ static int inca_switch_init(struct eth_device *dev, bd_t * bis) /* Initialize RxDMA. */ DMA_READ_REG(INCA_IP_DMA_DMA_RXISR, v); -#if 0 - printf("RX status = 0x%08X\n", v); -#endif /* Writing to the FRDA of CHANNEL. */ @@ -308,9 +292,6 @@ static int inca_switch_init(struct eth_device *dev, bd_t * bis) /* Initialize TxDMA. */ DMA_READ_REG(INCA_IP_DMA_DMA_TXISR, v); -#if 0 - printf("TX status = 0x%08X\n", v); -#endif /* Writing to the FRDA of CHANNEL. */ @@ -321,9 +302,6 @@ static int inca_switch_init(struct eth_device *dev, bd_t * bis) tx_hold = NUM_TX_DESC - 1; rx_hold = NUM_RX_DESC - 1; -#if 0 - rx_ring[rx_hold].params.field.HOLD = 1; -#endif /* enable spanning tree forwarding, enable the CPU port */ /* ST_PT: * CPS (CPU port status) 0x3 (forwarding) @@ -332,9 +310,6 @@ static int inca_switch_init(struct eth_device *dev, bd_t * bis) */ SW_WRITE_REG(INCA_IP_Switch_ST_PT,0x3f); -#if 0 - printf("Leaving inca_switch_init()\n"); -#endif return 0; } @@ -348,9 +323,6 @@ static int inca_switch_send(struct eth_device *dev, volatile void *packet, int l u32 regValue; inca_tx_descriptor_t * tx_desc = KSEG1ADDR(&tx_ring[tx_new]); -#if 0 - printf("Entered inca_switch_send()\n"); -#endif if (length <= 0) { printf ("%s: bad packet size: %d\n", dev->name, length); @@ -391,24 +363,16 @@ static int inca_switch_send(struct eth_device *dev, volatile void *packet, int l DMA_READ_REG(INCA_IP_DMA_DMA_TXCCR0, regValue); regValue |= command; -#if 0 - printf("regValue = 0x%x\n", regValue); -#endif DMA_WRITE_REG(INCA_IP_DMA_DMA_TXCCR0, regValue); -#if 1 for(i = 0; KSEG1ADDR(&tx_ring[tx_hold])->C == 0; i++) { if (i >= TOUT_LOOP) { printf("%s: tx buffer not ready\n", dev->name); goto Done; } } -#endif res = length; Done: -#if 0 - printf("Leaving inca_switch_send()\n"); -#endif return res; } @@ -418,9 +382,6 @@ static int inca_switch_recv(struct eth_device *dev) int length = 0; inca_rx_descriptor_t * rx_desc; -#if 0 - printf("Entered inca_switch_recv()\n"); -#endif for (;;) { rx_desc = KSEG1ADDR(&rx_ring[rx_new]); @@ -429,9 +390,6 @@ static int inca_switch_recv(struct eth_device *dev) break; } -#if 0 - rx_ring[rx_new].params.field.HOLD = 1; -#endif if (! rx_desc->status.field.Eop) { printf("Partly received packet!!!\n"); @@ -441,26 +399,11 @@ static int inca_switch_recv(struct eth_device *dev) length = rx_desc->status.field.NBT; rx_desc->status.word &= ~(INCA_DMA_RX_EOP | INCA_DMA_RX_SOP | INCA_DMA_RX_C); -#if 0 -{ - int i; - for (i=0;i<length - 4;i++) { - if (i % 16 == 0) printf("\n%04x: ", i); - printf("%02X ", NetRxPackets[rx_new][i]); - } - printf("\n"); -} -#endif if (length) { -#if 0 - printf("Received %d bytes\n", length); -#endif NetReceive((void*)KSEG1ADDR(NetRxPackets[rx_new]), length - 4); } else { -#if 1 printf("Zero length!!!\n"); -#endif } @@ -471,9 +414,6 @@ static int inca_switch_recv(struct eth_device *dev) rx_new = (rx_new + 1) % NUM_RX_DESC; } -#if 0 - printf("Leaving inca_switch_recv()\n"); -#endif return length; } @@ -481,14 +421,8 @@ static int inca_switch_recv(struct eth_device *dev) static void inca_switch_halt(struct eth_device *dev) { -#if 0 - printf("Entered inca_switch_halt()\n"); -#endif -#if 1 initialized = 0; -#endif -#if 1 /* Disable forwarding to the CPU port. */ SW_WRITE_REG(INCA_IP_Switch_ST_PT,0xf); @@ -502,10 +436,6 @@ static void inca_switch_halt(struct eth_device *dev) DMA_WRITE_REG(INCA_IP_DMA_DMA_TXCCR0, INCA_IP_DMA_DMA_TXCCR0_OFF); -#endif -#if 0 - printf("Leaving inca_switch_halt()\n"); -#endif } @@ -519,7 +449,6 @@ static void inca_init_switch_chip(void) SW_WRITE_REG(INCA_IP_Switch_PC_TX_CTL, 0x00000001); SW_WRITE_REG(INCA_IP_Switch_LAN_TX_CTL, 0x00000001); -#if 1 /* init MDIO configuration: * MDS (Poll speed): 0x01 (4ms) * PHY_LAN_ADDR: 0x06 @@ -579,7 +508,6 @@ static void inca_init_switch_chip(void) */ SW_WRITE_REG(INCA_IP_Switch_MDIO_ACC, 0xc0c09000); -#endif /* Make sure the CPU port is disabled for now. We * don't want packets to get stacked for us until @@ -650,29 +578,6 @@ static int inca_amdix(void) *INCA_IP_AUTO_MDIX_LAN_PORTS_DIR |= (1 << INCA_IP_AUTO_MDIX_LAN_GPIO_PIN_RXTX); *INCA_IP_AUTO_MDIX_LAN_PORTS_ALTSEL |= (1 << INCA_IP_AUTO_MDIX_LAN_GPIO_PIN_RXTX); -#if 0 - /* Wait for signal. - */ - retries = WAIT_SIGNAL_RETRIES; - while (--retries) { - SW_WRITE_REG(INCA_IP_Switch_MDIO_ACC, - (0x1 << 31) | /* RA */ - (0x0 << 30) | /* Read */ - (0x6 << 21) | /* LAN */ - (17 << 16)); /* PHY_MCSR */ - do { - SW_READ_REG(INCA_IP_Switch_MDIO_ACC, phyReg1); - } while (phyReg1 & (1 << 31)); - - if (phyReg1 & (1 << 1)) { - /* Signal detected */ - break; - } - } - - if (!retries) - goto Fail; -#endif /* Set MDI mode. */ diff --git a/drivers/keyboard.c b/drivers/keyboard.c index 9975202d7a..e9b8959c8b 100644 --- a/drivers/keyboard.c +++ b/drivers/keyboard.c @@ -207,14 +207,8 @@ void handle_scancode(unsigned char scancode) case 0xBA: /* caps lock released */ return; /* just swallow */ } -#if 1 if((scancode&0x80)==0x80) /* key released */ return; -#else - if((scancode&0x80)==0x00) /* key pressed */ - return; - scancode &= ~0x80; -#endif /* now, decide which table we need */ if(scancode > (sizeof(kbd_plain_xlate)/sizeof(kbd_plain_xlate[0]))) { /* scancode not in list */ PRINTF("unkown scancode %X\n",scancode); diff --git a/drivers/lan91c96.c b/drivers/lan91c96.c index a50c5f0abe..a89c959cee 100644 --- a/drivers/lan91c96.c +++ b/drivers/lan91c96.c @@ -139,9 +139,6 @@ extern int eth_init (bd_t * bd); extern void eth_halt (void); extern int eth_rx (void); extern int eth_send (volatile void *packet, int length); -#if 0 -static int smc_hw_init (void); -#endif /* * This is called by register_netdev(). It is responsible for @@ -213,24 +210,6 @@ void smc_set_mac_addr (const unsigned char *addr) * mac address, call smc_get_mac_addr as a part of the board initialisation. */ -#if 0 -void smc_get_macaddr (byte * addr) -{ - /* MAC ADDRESS AT FLASHBLOCK 1 / OFFSET 0x10 */ - unsigned char *dnp1110_mac = (unsigned char *) (0xE8000000 + 0x20010); - int i; - - - for (i = 0; i < 6; i++) { - addr[0] = *(dnp1110_mac + 0); - addr[1] = *(dnp1110_mac + 1); - addr[2] = *(dnp1110_mac + 2); - addr[3] = *(dnp1110_mac + 3); - addr[4] = *(dnp1110_mac + 4); - addr[5] = *(dnp1110_mac + 5); - } -} -#endif /* 0 */ /*********************************************** * Show available memory * @@ -764,37 +743,6 @@ static int smc_close () #if SMC_DEBUG > 2 static void print_packet (byte * buf, int length) { -#if 0 - int i; - int remainder; - int lines; - - printf ("Packet of length %d \n", length); - - lines = length / 16; - remainder = length % 16; - - for (i = 0; i < lines; i++) { - int cur; - - for (cur = 0; cur < 8; cur++) { - byte a, b; - - a = *(buf++); - b = *(buf++); - printf ("%02x%02x ", a, b); - } - printf ("\n"); - } - for (i = 0; i < remainder / 2; i++) { - byte a, b; - - a = *(buf++); - b = *(buf++); - printf ("%02x%02x ", a, b); - } - printf ("\n"); -#endif /* 0 */ } #endif /* SMC_DEBUG > 2 */ @@ -819,51 +767,6 @@ int eth_send (volatile void *packet, int length) } -#if 0 -/*------------------------------------------------------------------------- - * smc_hw_init() - * - * Function: - * Reset and enable the device, check if the I/O space location - * is correct - * - * Input parameters: - * None - * - * Output: - * 0 --> success - * 1 --> error - *-------------------------------------------------------------------------- - */ -static int smc_hw_init () -{ - unsigned short status_test; - - /* The attribute register of the LAN91C96 is located at address - 0x0e000000 on the lubbock platform */ - volatile unsigned *attaddr = (unsigned *) (0x0e000000); - - /* first reset, then enable the device. Sequence is critical */ - attaddr[LAN91C96_ECOR] |= LAN91C96_ECOR_SRESET; - udelay (100); - attaddr[LAN91C96_ECOR] &= ~LAN91C96_ECOR_SRESET; - attaddr[LAN91C96_ECOR] |= LAN91C96_ECOR_ENABLE; - - /* force 16-bit mode */ - attaddr[LAN91C96_ECSR] &= ~LAN91C96_ECSR_IOIS8; - udelay (100); - - /* check if the I/O address is correct, the upper byte of the - bank select register should read 0x33 */ - - status_test = SMC_inw (LAN91C96_BANK_SELECT); - if ((status_test & 0xFF00) != 0x3300) { - printf ("Failed to initialize ethernetchip\n"); - return 1; - } - return 0; -} -#endif /* 0 */ #endif /* COMMANDS & CFG_NET */ diff --git a/drivers/lan91c96.h b/drivers/lan91c96.h index 7d33a821f3..519c0c8389 100644 --- a/drivers/lan91c96.h +++ b/drivers/lan91c96.h @@ -165,9 +165,6 @@ typedef unsigned long int dword; __w |= ((r)&1) ? __d<<8 : __d; \ SMC_outw(__w,(r)&~1); \ }) -#if 0 -#define SMC_outsw(r,b,l) outsw(SMC_BASE_ADDRESS+(r), (b), (l)) -#else #define SMC_outsw(r,b,l) ({ int __i; \ word *__b2; \ __b2 = (word *) b; \ @@ -175,11 +172,7 @@ typedef unsigned long int dword; SMC_outw( *(__b2 + __i), r); \ } \ }) -#endif -#if 0 -#define SMC_insw(r,b,l) insw(SMC_BASE_ADDRESS+(r), (b), (l)) -#else #define SMC_insw(r,b,l) ({ int __i ; \ word *__b2; \ __b2 = (word *) b; \ @@ -188,7 +181,6 @@ typedef unsigned long int dword; SMC_inw(0); \ }; \ }) -#endif #endif diff --git a/drivers/mpc8xx_pcmcia.c b/drivers/mpc8xx_pcmcia.c index 399a719e56..02b77b991b 100644 --- a/drivers/mpc8xx_pcmcia.c +++ b/drivers/mpc8xx_pcmcia.c @@ -28,9 +28,6 @@ extern int pcmcia_hardware_disable(int slot); #endif static u_int m8xx_get_graycode(u_int size); -#if 0 /* Disabled */ -static u_int m8xx_get_speed(u_int ns, u_int is_io); -#endif /* look up table for pgcrx registers */ u_int *pcmcia_pgcrx[2] = { @@ -239,66 +236,5 @@ static u_int m8xx_get_graycode(u_int size) return k; } -#if 0 - -#if defined(CONFIG_RPXCLASSIC) || defined(CONFIG_RPXLITE) - -/* The RPX boards seems to have it's bus monitor timeout set to 6*8 clocks. - * SYPCR is write once only, therefore must the slowest memory be faster - * than the bus monitor or we will get a machine check due to the bus timeout. - */ -#undef PCMCIA_BMT_LIMIT -#define PCMCIA_BMT_LIMIT (6*8) -#endif - -static u_int m8xx_get_speed(u_int ns, u_int is_io) -{ - u_int reg, clocks, psst, psl, psht; - - if(!ns) { - - /* - * We get called with IO maps setup to 0ns - * if not specified by the user. - * They should be 255ns. - */ - - if(is_io) - ns = 255; - else - ns = 100; /* fast memory if 0 */ - } - - /* - * In PSST, PSL, PSHT fields we tell the controller - * timing parameters in CLKOUT clock cycles. - * CLKOUT is the same as GCLK2_50. - */ - - /* how we want to adjust the timing - in percent */ - -#define ADJ 180 /* 80 % longer accesstime - to be sure */ - - clocks = ((M8XX_BUSFREQ / 1000) * ns) / 1000; - clocks = (clocks * ADJ) / (100*1000); - - if(clocks >= PCMCIA_BMT_LIMIT) { - DEBUG(0, "Max access time limit reached\n"); - clocks = PCMCIA_BMT_LIMIT-1; - } - - psst = clocks / 7; /* setup time */ - psht = clocks / 7; /* hold time */ - psl = (clocks * 5) / 7; /* strobe length */ - - psst += clocks - (psst + psht + psl); - - reg = psst << 12; - reg |= psl << 7; - reg |= psht << 16; - - return reg; -} -#endif /* 0 */ #endif /* CONFIG_8xx && CONFIG_PCMCIA */ diff --git a/drivers/nand/diskonchip.c b/drivers/nand/diskonchip.c index e17af70d07..bac70faa15 100644 --- a/drivers/nand/diskonchip.c +++ b/drivers/nand/diskonchip.c @@ -955,23 +955,6 @@ static int doc200x_calculate_ecc(struct mtd_info *mtd, const u_char *dat, WriteDOC(DOC_ECC_DIS, docptr, Mplus_ECCConf); else WriteDOC(DOC_ECC_DIS, docptr, ECCConf); -#if 0 - /* If emptymatch=1, we might have an all-0xff data buffer. Check. */ - if (emptymatch) { - /* Note: this somewhat expensive test should not be triggered - often. It could be optimized away by examining the data in - the writebuf routine, and remembering the result. */ - for (i = 0; i < 512; i++) { - if (dat[i] == 0xff) continue; - emptymatch = 0; - break; - } - } - /* If emptymatch still =1, we do have an all-0xff data buffer. - Return all-0xff ecc value instead of the computed one, so - it'll look just like a freshly-erased page. */ - if (emptymatch) memset(ecc_code, 0xff, 6); -#endif return 0; } diff --git a/drivers/nand/nand_base.c b/drivers/nand/nand_base.c index 8495829900..05f3f60d6c 100644 --- a/drivers/nand/nand_base.c +++ b/drivers/nand/nand_base.c @@ -50,25 +50,6 @@ */ /* XXX U-BOOT XXX */ -#if 0 -#include <linux/delay.h> -#include <linux/errno.h> -#include <linux/sched.h> -#include <linux/slab.h> -#include <linux/types.h> -#include <linux/mtd/mtd.h> -#include <linux/mtd/nand.h> -#include <linux/mtd/nand_ecc.h> -#include <linux/mtd/compatmac.h> -#include <linux/interrupt.h> -#include <linux/bitops.h> -#include <asm/io.h> - -#ifdef CONFIG_MTD_PARTITIONS -#include <linux/mtd/partitions.h> -#endif - -#endif #include <common.h> @@ -141,12 +122,6 @@ static int nand_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char * buf, u_char * eccbuf, struct nand_oobinfo *oobsel); static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t * retlen, const u_char *buf); /* XXX U-BOOT XXX */ -#if 0 -static int nand_writev (struct mtd_info *mtd, const struct kvec *vecs, - unsigned long count, loff_t to, size_t * retlen); -static int nand_writev_ecc (struct mtd_info *mtd, const struct kvec *vecs, - unsigned long count, loff_t to, size_t * retlen, u_char *eccbuf, struct nand_oobinfo *oobsel); -#endif static int nand_erase (struct mtd_info *mtd, struct erase_info *instr); static void nand_sync (struct mtd_info *mtd); @@ -169,32 +144,11 @@ static void nand_get_device (struct nand_chip *this, struct mtd_info *mtd, int n * Deselect, release chip lock and wake up anyone waiting on the device */ /* XXX U-BOOT XXX */ -#if 0 -static void nand_release_device (struct mtd_info *mtd) -{ - struct nand_chip *this = mtd->priv; - - /* De-select the NAND device */ - this->select_chip(mtd, -1); - /* Do we have a hardware controller ? */ - if (this->controller) { - spin_lock(&this->controller->lock); - this->controller->active = NULL; - spin_unlock(&this->controller->lock); - } - /* Release the chip */ - spin_lock (&this->chip_lock); - this->state = FL_READY; - wake_up (&this->wq); - spin_unlock (&this->chip_lock); -} -#else static void nand_release_device (struct mtd_info *mtd) { struct nand_chip *this = mtd->priv; this->select_chip(mtd, -1); /* De-select the NAND device */ } -#endif /** * nand_read_byte - [DEFAULT] read one byte from the chip @@ -741,45 +695,7 @@ static void nand_command_lp (struct mtd_info *mtd, unsigned command, int column, * Get the device and lock it for exclusive access */ /* XXX U-BOOT XXX */ -#if 0 -static void nand_get_device (struct nand_chip *this, struct mtd_info *mtd, int new_state) -{ - struct nand_chip *active = this; - - DECLARE_WAITQUEUE (wait, current); - - /* - * Grab the lock and see if the device is available - */ -retry: - /* Hardware controller shared among independend devices */ - if (this->controller) { - spin_lock (&this->controller->lock); - if (this->controller->active) - active = this->controller->active; - else - this->controller->active = this; - spin_unlock (&this->controller->lock); - } - - if (active == this) { - spin_lock (&this->chip_lock); - if (this->state == FL_READY) { - this->state = new_state; - spin_unlock (&this->chip_lock); - return; - } - } - set_current_state (TASK_UNINTERRUPTIBLE); - add_wait_queue (&active->wq, &wait); - spin_unlock (&active->chip_lock); - schedule (); - remove_wait_queue (&active->wq, &wait); - goto retry; -} -#else static void nand_get_device (struct nand_chip *this, struct mtd_info *mtd, int new_state) {} -#endif /** * nand_wait - [DEFAULT] wait until the command is done @@ -793,46 +709,6 @@ static void nand_get_device (struct nand_chip *this, struct mtd_info *mtd, int n * */ /* XXX U-BOOT XXX */ -#if 0 -static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state) -{ - unsigned long timeo = jiffies; - int status; - - if (state == FL_ERASING) - timeo += (HZ * 400) / 1000; - else - timeo += (HZ * 20) / 1000; - - /* Apply this short delay always to ensure that we do wait tWB in - * any case on any machine. */ - ndelay (100); - - if ((state == FL_ERASING) && (this->options & NAND_IS_AND)) - this->cmdfunc (mtd, NAND_CMD_STATUS_MULTI, -1, -1); - else - this->cmdfunc (mtd, NAND_CMD_STATUS, -1, -1); - - while (time_before(jiffies, timeo)) { - /* Check, if we were interrupted */ - if (this->state != state) - return 0; - - if (this->dev_ready) { - if (this->dev_ready(mtd)) - break; - } else { - if (this->read_byte(mtd) & NAND_STATUS_READY) - break; - } - yield (); - } - status = (int) this->read_byte(mtd); - return status; - - return 0; -} -#else static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state) { unsigned long timeo; @@ -870,7 +746,6 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state) return this->read_byte(mtd); } -#endif /** * nand_write_page - [GENERIC] write one page @@ -1209,15 +1084,7 @@ static int nand_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, switch (eccmode) { case NAND_ECC_NONE: { /* No ECC, Read in a page */ /* XXX U-BOOT XXX */ -#if 0 - static unsigned long lastwhinge = 0; - if ((lastwhinge / HZ) != (jiffies / HZ)) { - printk (KERN_WARNING "Reading data from NAND FLASH without ECC is not recommended\n"); - lastwhinge = jiffies; - } -#else puts("Reading data from NAND FLASH without ECC is not recommended\n"); -#endif this->read_buf(mtd, data_poi, end); break; } @@ -1854,190 +1721,6 @@ out: } /* XXX U-BOOT XXX */ -#if 0 -/** - * nand_writev - [MTD Interface] compabilty function for nand_writev_ecc - * @mtd: MTD device structure - * @vecs: the iovectors to write - * @count: number of vectors - * @to: offset to write to - * @retlen: pointer to variable to store the number of written bytes - * - * NAND write with kvec. This just calls the ecc function - */ -static int nand_writev (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, - loff_t to, size_t * retlen) -{ - return (nand_writev_ecc (mtd, vecs, count, to, retlen, NULL, NULL)); -} - -/** - * nand_writev_ecc - [MTD Interface] write with iovec with ecc - * @mtd: MTD device structure - * @vecs: the iovectors to write - * @count: number of vectors - * @to: offset to write to - * @retlen: pointer to variable to store the number of written bytes - * @eccbuf: filesystem supplied oob data buffer - * @oobsel: oob selection structure - * - * NAND write with iovec with ecc - */ -static int nand_writev_ecc (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, - loff_t to, size_t * retlen, u_char *eccbuf, struct nand_oobinfo *oobsel) -{ - int i, page, len, total_len, ret = -EIO, written = 0, chipnr; - int oob, numpages, autoplace = 0, startpage; - struct nand_chip *this = mtd->priv; - int ppblock = (1 << (this->phys_erase_shift - this->page_shift)); - u_char *oobbuf, *bufstart; - - /* Preset written len for early exit */ - *retlen = 0; - - /* Calculate total length of data */ - total_len = 0; - for (i = 0; i < count; i++) - total_len += (int) vecs[i].iov_len; - - DEBUG (MTD_DEBUG_LEVEL3, - "nand_writev: to = 0x%08x, len = %i, count = %ld\n", (unsigned int) to, (unsigned int) total_len, count); - - /* Do not allow write past end of page */ - if ((to + total_len) > mtd->size) { - DEBUG (MTD_DEBUG_LEVEL0, "nand_writev: Attempted write past end of device\n"); - return -EINVAL; - } - - /* reject writes, which are not page aligned */ - if (NOTALIGNED (to) || NOTALIGNED(total_len)) { - printk (KERN_NOTICE "nand_write_ecc: Attempt to write not page aligned data\n"); - return -EINVAL; - } - - /* Grab the lock and see if the device is available */ - nand_get_device (this, mtd, FL_WRITING); - - /* Get the current chip-nr */ - chipnr = (int) (to >> this->chip_shift); - /* Select the NAND device */ - this->select_chip(mtd, chipnr); - - /* Check, if it is write protected */ - if (nand_check_wp(mtd)) - goto out; - - /* if oobsel is NULL, use chip defaults */ - if (oobsel == NULL) - oobsel = &mtd->oobinfo; - - /* Autoplace of oob data ? Use the default placement scheme */ - if (oobsel->useecc == MTD_NANDECC_AUTOPLACE) { - oobsel = this->autooob; - autoplace = 1; - } - if (oobsel->useecc == MTD_NANDECC_AUTOPL_USR) - autoplace = 1; - - /* Setup start page */ - page = (int) (to >> this->page_shift); - /* Invalidate the page cache, if we write to the cached page */ - if (page <= this->pagebuf && this->pagebuf < ((to + total_len) >> this->page_shift)) - this->pagebuf = -1; - - startpage = page & this->pagemask; - - /* Loop until all kvec' data has been written */ - len = 0; - while (count) { - /* If the given tuple is >= pagesize then - * write it out from the iov - */ - if ((vecs->iov_len - len) >= mtd->oobblock) { - /* Calc number of pages we can write - * out of this iov in one go */ - numpages = (vecs->iov_len - len) >> this->page_shift; - /* Do not cross block boundaries */ - numpages = min (ppblock - (startpage & (ppblock - 1)), numpages); - oobbuf = nand_prepare_oobbuf (mtd, NULL, oobsel, autoplace, numpages); - bufstart = (u_char *)vecs->iov_base; - bufstart += len; - this->data_poi = bufstart; - oob = 0; - for (i = 1; i <= numpages; i++) { - /* Write one page. If this is the last page to write - * then use the real pageprogram command, else select - * cached programming if supported by the chip. - */ - ret = nand_write_page (mtd, this, page & this->pagemask, - &oobbuf[oob], oobsel, i != numpages); - if (ret) - goto out; - this->data_poi += mtd->oobblock; - len += mtd->oobblock; - oob += mtd->oobsize; - page++; - } - /* Check, if we have to switch to the next tuple */ - if (len >= (int) vecs->iov_len) { - vecs++; - len = 0; - count--; - } - } else { - /* We must use the internal buffer, read data out of each - * tuple until we have a full page to write - */ - int cnt = 0; - while (cnt < mtd->oobblock) { - if (vecs->iov_base != NULL && vecs->iov_len) - this->data_buf[cnt++] = ((u_char *) vecs->iov_base)[len++]; - /* Check, if we have to switch to the next tuple */ - if (len >= (int) vecs->iov_len) { - vecs++; - len = 0; - count--; - } - } - this->pagebuf = page; - this->data_poi = this->data_buf; - bufstart = this->data_poi; - numpages = 1; - oobbuf = nand_prepare_oobbuf (mtd, NULL, oobsel, autoplace, numpages); - ret = nand_write_page (mtd, this, page & this->pagemask, - oobbuf, oobsel, 0); - if (ret) - goto out; - page++; - } - - this->data_poi = bufstart; - ret = nand_verify_pages (mtd, this, startpage, numpages, oobbuf, oobsel, chipnr, 0); - if (ret) - goto out; - - written += mtd->oobblock * numpages; - /* All done ? */ - if (!count) - break; - - startpage = page & this->pagemask; - /* Check, if we cross a chip boundary */ - if (!startpage) { - chipnr++; - this->select_chip(mtd, -1); - this->select_chip(mtd, chipnr); - } - } - ret = 0; -out: - /* Deselect and wake up anyone waiting on the device */ - nand_release_device(mtd); - - *retlen = written; - return ret; -} -#endif /** * single_erease_cmd - [GENERIC] NAND standard block erase command function @@ -2584,12 +2267,6 @@ int nand_scan (struct mtd_info *mtd, int maxchips) } /* XXX U-BOOT XXX */ -#if 0 - /* Initialize state, waitqueue and spinlock */ - this->state = FL_READY; - init_waitqueue_head (&this->wq); - spin_lock_init (&this->chip_lock); -#endif /* De-select the device */ this->select_chip(mtd, -1); @@ -2611,28 +2288,14 @@ int nand_scan (struct mtd_info *mtd, int maxchips) mtd->read_oob = nand_read_oob; mtd->write_oob = nand_write_oob; /* XXX U-BOOT XXX */ -#if 0 - mtd->readv = NULL; - mtd->writev = nand_writev; - mtd->writev_ecc = nand_writev_ecc; -#endif mtd->sync = nand_sync; /* XXX U-BOOT XXX */ -#if 0 - mtd->lock = NULL; - mtd->unlock = NULL; - mtd->suspend = NULL; - mtd->resume = NULL; -#endif mtd->block_isbad = nand_block_isbad; mtd->block_markbad = nand_block_markbad; /* and make the autooob the default one */ memcpy(&mtd->oobinfo, this->autooob, sizeof(mtd->oobinfo)); /* XXX U-BOOT XXX */ -#if 0 - mtd->owner = THIS_MODULE; -#endif /* Build bad block table */ return this->scan_bbt (mtd); } @@ -2651,9 +2314,6 @@ void nand_release (struct mtd_info *mtd) #endif /* Deregister the device */ /* XXX U-BOOT XXX */ -#if 0 - del_mtd_device (mtd); -#endif /* Free bad block table memory, if allocated */ if (this->bbt) kfree (this->bbt); diff --git a/drivers/natsemi.c b/drivers/natsemi.c index b009db63eb..f314d6771d 100644 --- a/drivers/natsemi.c +++ b/drivers/natsemi.c @@ -226,10 +226,6 @@ static unsigned char rxb[NUM_RX_DESC * RX_BUF_SIZE] __attribute__ ((aligned(4))); /* Function Prototypes */ -#if 0 -static void write_eeprom(struct eth_device *dev, long addr, int location, - short value); -#endif static int read_eeprom(struct eth_device *dev, long addr, int location); static int mdio_read(struct eth_device *dev, int phy_id, int location); static int natsemi_init(struct eth_device *dev, bd_t * bis); @@ -430,65 +426,6 @@ enum EEPROM_Cmds { EE_ReadCmd = (6 << 6), EE_EraseCmd = (7 << 6), }; -#if 0 -static void -write_eeprom(struct eth_device *dev, long addr, int location, short value) -{ - int i; - int ee_addr = (typeof(ee_addr))addr; - short wren_cmd = EE_WrEnCmd | 0x30; /*wren is 100 + 11XXXX*/ - short write_cmd = location | EE_WriteCmd; - -#ifdef NATSEMI_DEBUG - printf("write_eeprom: %08x, %04hx, %04hx\n", - dev->iobase + ee_addr, write_cmd, value); -#endif - /* Shift the write enable command bits out. */ - for (i = 9; i >= 0; i--) { - short cmdval = (wren_cmd & (1 << i)) ? EE_Write1 : EE_Write0; - OUTL(dev, cmdval, ee_addr); - eeprom_delay(ee_addr); - OUTL(dev, cmdval | EE_ShiftClk, ee_addr); - eeprom_delay(ee_addr); - } - - OUTL(dev, 0, ee_addr); /*bring chip select low*/ - OUTL(dev, EE_ShiftClk, ee_addr); - eeprom_delay(ee_addr); - - /* Shift the write command bits out. */ - for (i = 9; i >= 0; i--) { - short cmdval = (write_cmd & (1 << i)) ? EE_Write1 : EE_Write0; - OUTL(dev, cmdval, ee_addr); - eeprom_delay(ee_addr); - OUTL(dev, cmdval | EE_ShiftClk, ee_addr); - eeprom_delay(ee_addr); - } - - for (i = 0; i < 16; i++) { - short cmdval = (value & (1 << i)) ? EE_Write1 : EE_Write0; - OUTL(dev, cmdval, ee_addr); - eeprom_delay(ee_addr); - OUTL(dev, cmdval | EE_ShiftClk, ee_addr); - eeprom_delay(ee_addr); - } - - OUTL(dev, 0, ee_addr); /*bring chip select low*/ - OUTL(dev, EE_ShiftClk, ee_addr); - for (i = 0; i < 200000; i++) { - OUTL(dev, EE_Write0, ee_addr); /*poll for done*/ - if (INL(dev, ee_addr) & EE_DataOut) { - break; /*finished*/ - } - } - eeprom_delay(ee_addr); - - /* Terminate the EEPROM access. */ - OUTL(dev, EE_Write0, ee_addr); - OUTL(dev, 0, ee_addr); - return; -} -#endif static int read_eeprom(struct eth_device *dev, long addr, int location) diff --git a/drivers/ne2000.c b/drivers/ne2000.c index b7ed876165..b92c7864b5 100644 --- a/drivers/ne2000.c +++ b/drivers/ne2000.c @@ -745,14 +745,12 @@ static void pcnet_reset_8390(void) PRINTK("nic base is %lx\n", nic_base); -#if 1 n2k_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD); PRINTK("cmd (at %lx) is %x\n", nic_base+ E8390_CMD, n2k_inb(E8390_CMD)); n2k_outb(E8390_NODMA+E8390_PAGE1+E8390_STOP, E8390_CMD); PRINTK("cmd (at %lx) is %x\n", nic_base+ E8390_CMD, n2k_inb(E8390_CMD)); n2k_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD); PRINTK("cmd (at %lx) is %x\n", nic_base+ E8390_CMD, n2k_inb(E8390_CMD)); -#endif n2k_outb(E8390_NODMA+E8390_PAGE0+E8390_STOP, E8390_CMD); n2k_outb(n2k_inb(nic_base + PCNET_RESET), PCNET_RESET); diff --git a/drivers/ns7520_eth.c b/drivers/ns7520_eth.c index a5a20dfd72..d4defce74e 100644 --- a/drivers/ns7520_eth.c +++ b/drivers/ns7520_eth.c @@ -42,9 +42,7 @@ do { \ #define KERN_ERR "Error:" #define KERN_INFO "Info:" -#if 1 # define DEBUG -#endif #ifdef DEBUG # define printk printf diff --git a/drivers/ns9750_eth.c b/drivers/ns9750_eth.c index 067ff8efab..b77dec3ce8 100644 --- a/drivers/ns9750_eth.c +++ b/drivers/ns9750_eth.c @@ -46,9 +46,6 @@ #define KERN_ERR "Error:" #define KERN_INFO "Info:" -#if 0 -# define DEBUG -#endif #ifdef DEBUG # define printk printf diff --git a/drivers/pcnet.c b/drivers/pcnet.c index da9ac7f99a..5c11ecbeee 100644 --- a/drivers/pcnet.c +++ b/drivers/pcnet.c @@ -29,9 +29,6 @@ #include <asm/io.h> #include <pci.h> -#if 0 -#define PCNET_DEBUG_LEVEL 0 /* 0=off, 1=init, 2=rx/tx */ -#endif #if PCNET_DEBUG_LEVEL > 0 #define PCNET_DEBUG1(fmt,args...) printf (fmt ,##args) diff --git a/drivers/plb2800_eth.c b/drivers/plb2800_eth.c index 4c683d7a5c..8168f870a1 100644 --- a/drivers/plb2800_eth.c +++ b/drivers/plb2800_eth.c @@ -285,9 +285,7 @@ static int plb2800_eth_recv(struct eth_device *dev) } else { -#if 1 printf("Zero length!!!\n"); -#endif } rx_new = (rx_new + 1) % NUM_RX_DESC; diff --git a/drivers/ps2mult.c b/drivers/ps2mult.c index 9515a0fbf5..ac6f7ef369 100644 --- a/drivers/ps2mult.c +++ b/drivers/ps2mult.c @@ -104,9 +104,7 @@ static void ps2mult_receive_byte(u_char byte, u_char sel) { u_char status = KBD_STAT_DEFAULT; -#if 1 /* Ignore mouse in U-Boot */ if (sel == PS2MULT_MS_SELECTOR) return; -#endif if (sel == PS2MULT_KB_SELECTOR) { if (kbd_command_active) { @@ -395,7 +393,6 @@ int ps2mult_init (void) } } -#if 1 /* detect mouse */ ps2ser_putc(PS2MULT_MS_SELECTOR); ps2ser_putc(AUX_RESET); @@ -419,7 +416,6 @@ int ps2mult_init (void) byte = ps2mult_getc_w(); } } -#endif if (mouse_found || kbd_found) { if (!received_selector) { @@ -437,21 +433,6 @@ int ps2mult_init (void) puts("\n"); -#if 0 /* for testing */ - { - int i; - u_char key[] = { - 0x1f, 0x12, 0x14, 0x12, 0x31, 0x2f, 0x39, /* setenv */ - 0x1f, 0x14, 0x20, 0x17, 0x31, 0x39, /* stdin */ - 0x1f, 0x12, 0x13, 0x17, 0x1e, 0x26, 0x1c, /* serial */ - }; - - for (i = 0; i < sizeof (key); i++) { - ps2mult_receive_byte (key[i], PS2MULT_KB_SELECTOR); - ps2mult_receive_byte (key[i] | 0x80, PS2MULT_KB_SELECTOR); - } - } -#endif return init_done ? 0 : -1; } diff --git a/drivers/rtl8169.c b/drivers/rtl8169.c index 3393ba890a..f9dcf9dc7c 100644 --- a/drivers/rtl8169.c +++ b/drivers/rtl8169.c @@ -532,18 +532,6 @@ static void rtl8169_hw_start(struct eth_device *dev) printf ("%s\n", __FUNCTION__); #endif -#if 0 - /* Soft reset the chip. */ - RTL_W8(ChipCmd, CmdReset); - - /* Check that the chip has finished the reset. */ - for (i = 1000; i > 0; i--) { - if ((RTL_R8(ChipCmd) & CmdReset) == 0) - break; - else - udelay(10); - } -#endif RTL_W8(Cfg9346, Cfg9346_Unlock); RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); diff --git a/drivers/sk98lin/h/skaddr.h b/drivers/sk98lin/h/skaddr.h index 711f873e7f..39264b4939 100644 --- a/drivers/sk98lin/h/skaddr.h +++ b/drivers/sk98lin/h/skaddr.h @@ -206,27 +206,6 @@ extern "C" { /* Macros */ -#if 0 -#ifndef SK_ADDR_EQUAL -/* - * "&" instead of "&&" allows better optimization on IA-64. - * The replacement is safe here, as all bytes exist. - */ -#ifndef SK_ADDR_DWORD_COMPARE -#define SK_ADDR_EQUAL(A1,A2) ( \ - (((SK_U8 *)(A1))[5] == ((SK_U8 *)(A2))[5]) & \ - (((SK_U8 *)(A1))[4] == ((SK_U8 *)(A2))[4]) & \ - (((SK_U8 *)(A1))[3] == ((SK_U8 *)(A2))[3]) & \ - (((SK_U8 *)(A1))[2] == ((SK_U8 *)(A2))[2]) & \ - (((SK_U8 *)(A1))[1] == ((SK_U8 *)(A2))[1]) & \ - (((SK_U8 *)(A1))[0] == ((SK_U8 *)(A2))[0])) -#else /* SK_ADDR_DWORD_COMPARE */ -#define SK_ADDR_EQUAL(A1,A2) ( \ - (*(SK_U32 *)&(((SK_U8 *)(A1))[2]) == *(SK_U32 *)&(((SK_U8 *)(A2))[2])) & \ - (*(SK_U32 *)&(((SK_U8 *)(A1))[0]) == *(SK_U32 *)&(((SK_U8 *)(A2))[0]))) -#endif /* SK_ADDR_DWORD_COMPARE */ -#endif /* SK_ADDR_EQUAL */ -#endif /* 0 */ #ifndef SK_ADDR_EQUAL #ifndef SK_ADDR_DWORD_COMPARE diff --git a/drivers/sk98lin/h/skdrv1st.h b/drivers/sk98lin/h/skdrv1st.h index af34d7b96f..cd2c322051 100644 --- a/drivers/sk98lin/h/skdrv1st.h +++ b/drivers/sk98lin/h/skdrv1st.h @@ -92,12 +92,6 @@ #ifndef __INC_SKDRV1ST_H #define __INC_SKDRV1ST_H -#if 0 -/* Check kernel version */ -#include <linux/version.h> -#if (LINUX_VERSION_CODE > 0x020300) -#endif -#endif typedef struct s_AC SK_AC; @@ -121,33 +115,11 @@ typedef struct s_AC SK_AC; #error You must compile this driver with "-O". #endif -#if 0 -#include <linux/version.h> -#endif #include <linux/types.h> -#if 0 -#include <linux/kernel.h> -#endif #include <linux/string.h> -#if 0 -#include <linux/errno.h> -#include <linux/ioport.h> -#include <linux/slab.h> -#include <linux/interrupt.h> -#include <linux/pci.h> -#endif #include <asm/byteorder.h> #include <asm/bitops.h> #include <asm/io.h> -#if 0 -#include <linux/netdevice.h> -#include <linux/etherdevice.h> -#include <linux/skbuff.h> - -#include <linux/init.h> -#include <asm/uaccess.h> -#include <net/checksum.h> -#endif #include "h/sktypes.h" #include "h/skerror.h" @@ -163,19 +135,11 @@ typedef struct s_AC SK_AC; #define SK_BIG_ENDIAN #endif -#if 0 -#define SK_NET_DEVICE net_device -#else #define SK_NET_DEVICE eth_device -#endif /* we use gethrtime(), return unit: nanoseconds */ -#if 0 -#define SK_TICKS_PER_SEC HZ -#else #define SK_TICKS_PER_SEC CFG_HZ -#endif #define SK_MEM_MAPPED_IO diff --git a/drivers/sk98lin/h/skdrv2nd.h b/drivers/sk98lin/h/skdrv2nd.h index a311827aa7..b072413ba4 100644 --- a/drivers/sk98lin/h/skdrv2nd.h +++ b/drivers/sk98lin/h/skdrv2nd.h @@ -208,13 +208,8 @@ struct s_IOCTL { * define sizes of descriptor rings in bytes */ -#if 0 -#define TX_RING_SIZE (8*1024) -#define RX_RING_SIZE (24*1024) -#else #define TX_RING_SIZE (10 * 40) #define RX_RING_SIZE (10 * 40) -#endif /* * Buffer size for ethernet packets @@ -451,9 +446,6 @@ struct s_TxPort { TXD *pTxdRingTail; /* Tail of Tx rings */ TXD *pTxdRingPrev; /* descriptor sent previously */ int TxdRingFree; /* # of free entrys */ -#if 0 - spinlock_t TxDesRingLock; /* serialize descriptor accesses */ -#endif caddr_t HwAddr; /* bmu registers address */ int PortIndex; /* index number of port (0 or 1) */ }; @@ -468,9 +460,6 @@ struct s_RxPort { RXD *pRxdRingTail; /* Tail of Rx rings */ RXD *pRxdRingPrev; /* descriptor given to BMU previously */ int RxdRingFree; /* # of free entrys */ -#if 0 - spinlock_t RxDesRingLock; /* serialize descriptor accesses */ -#endif int RxFillLimit; /* limit for buffers in ring */ caddr_t HwAddr; /* bmu registers address */ int PortIndex; /* index number of port (0 or 1) */ @@ -496,9 +485,6 @@ struct s_AC { SK_ADDR Addr; /* for Address module */ SK_CSUM Csum; /* for checksum module */ SK_RLMT Rlmt; /* for rlmt module */ -#if 0 - spinlock_t SlowPathLock; /* Normal IRQ lock */ -#endif SK_PNMI_STRUCT_DATA PnmiStruct; /* structure to get all Pnmi-Data */ int RlmtMode; /* link check mode to set */ int RlmtNets; /* Number of nets */ @@ -507,19 +493,11 @@ struct s_AC { int BoardLevel; /* level of active hw init (0-2) */ char DeviceStr[80]; /* adapter string from vpd */ SK_U32 AllocFlag; /* flag allocation of resources */ -#if 0 - struct pci_dev *PciDev; /* for access to pci config space */ - SK_U32 PciDevId; /* pci device id */ -#else int PciDev; -#endif struct SK_NET_DEVICE *dev[2]; /* pointer to device struct */ char Name[30]; /* driver name */ struct SK_NET_DEVICE *Next; /* link all devices (for clearing) */ int RxBufSize; /* length of receive buffers */ -#if 0 - struct net_device_stats stats; /* linux 'netstat -i' statistics */ -#endif int Index; /* internal board index number */ /* adapter RAM sizes for queues of active port */ diff --git a/drivers/sk98lin/h/skgehw.h b/drivers/sk98lin/h/skgehw.h index 2c98427675..027c5612cb 100644 --- a/drivers/sk98lin/h/skgehw.h +++ b/drivers/sk98lin/h/skgehw.h @@ -327,9 +327,6 @@ extern "C" { #define PCI_COMMAND 0x04 /* 16 bit Command */ #define PCI_STATUS 0x06 /* 16 bit Status */ #define PCI_REV_ID 0x08 /* 8 bit Revision ID */ -#if 0 -#define PCI_CLASS_CODE 0x09 /* 24 bit Class Code */ -#endif #define PCI_CACHE_LSZ 0x0c /* 8 bit Cache Line Size */ #define PCI_LAT_TIM 0x0d /* 8 bit Latency Timer */ #define PCI_HEADER_T 0x0e /* 8 bit Header Type */ diff --git a/drivers/sk98lin/h/skrlmt.h b/drivers/sk98lin/h/skrlmt.h index 04d025b009..e4b0c89293 100644 --- a/drivers/sk98lin/h/skrlmt.h +++ b/drivers/sk98lin/h/skrlmt.h @@ -276,14 +276,6 @@ extern "C" { /* Macros */ -#if 0 -SK_AC *pAC /* adapter context */ -SK_U32 PortNum /* receiving port */ -unsigned PktLen /* received packet's length */ -SK_BOOL IsBc /* Flag: packet is broadcast */ -unsigned *pOffset /* offs. of bytes to present to SK_RLMT_LOOKAHEAD */ -unsigned *pNumBytes /* #Bytes to present to SK_RLMT_LOOKAHEAD */ -#endif /* 0 */ #define SK_RLMT_PRE_LOOKAHEAD(pAC,PortNum,PktLen,IsBc,pOffset,pNumBytes) { \ SK_AC *_pAC; \ @@ -321,20 +313,6 @@ unsigned *pNumBytes /* #Bytes to present to SK_RLMT_LOOKAHEAD */ } \ } -#if 0 -SK_AC *pAC /* adapter context */ -SK_U32 PortNum /* receiving port */ -SK_U8 *pLaPacket, /* received packet's data (points to pOffset) */ -SK_BOOL IsBc /* Flag: packet is broadcast */ -SK_BOOL IsMc /* Flag: packet is multicast */ -unsigned *pForRlmt /* Result: bits SK_RLMT_RX_RLMT, SK_RLMT_RX_PROTOCOL */ -SK_RLMT_LOOKAHEAD() expects *pNumBytes from -packet offset *pOffset (s.a.) at *pLaPacket. - -If you use SK_RLMT_LOOKAHEAD in a path where you already know if the packet is -BC, MC, or UC, you should use constants for IsBc and IsMc, so that your compiler -can trash unneeded parts of the if construction. -#endif /* 0 */ #define SK_RLMT_LOOKAHEAD(pAC,PortNum,pLaPacket,IsBc,IsMc,pForRlmt) { \ SK_AC *_pAC; \ diff --git a/drivers/sk98lin/skcsum.c b/drivers/sk98lin/skcsum.c index a5dc572587..60d7e30136 100644 --- a/drivers/sk98lin/skcsum.c +++ b/drivers/sk98lin/skcsum.c @@ -261,489 +261,6 @@ static const char SysKonnectFileId[] = "@(#)" * has been specified in the 'ProtocolFlags', the 16-bit Internet Checksum * of the TCP or UDP pseudo header is returned here. */ -#if 0 -void SkCsGetSendInfo( -SK_AC *pAc, /* Adapter context struct. */ -void *pIpHeader, /* IP header. */ -SKCS_PACKET_INFO *pPacketInfo, /* Packet information struct. */ -int NetNumber) /* Net number */ -{ - /* Internet Header Version found in IP header. */ - unsigned InternetHeaderVersion; - - /* Length of the IP header as found in IP header. */ - unsigned IpHeaderLength; - - /* Bit field specifiying the desired/found protocols. */ - unsigned ProtocolFlags; - - /* Next level protocol identifier found in IP header. */ - unsigned NextLevelProtocol; - - /* Length of IP data portion. */ - unsigned IpDataLength; - - /* TCP/UDP pseudo header checksum. */ - unsigned long PseudoHeaderChecksum; - - /* Pointer to next level protocol statistics structure. */ - SKCS_PROTO_STATS *NextLevelProtoStats; - - /* Temporary variable. */ - unsigned Tmp; - - Tmp = *(SK_U8 *) - SKCS_IDX(pIpHeader, SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH); - - /* Get the Internet Header Version (IHV). */ - /* Note: The IHV is stored in the upper four bits. */ - - InternetHeaderVersion = Tmp >> 4; - - /* Check the Internet Header Version. */ - /* Note: We currently only support IP version 4. */ - - if (InternetHeaderVersion != 4) { /* IPv4? */ - SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_TX, - ("Tx: Unknown Internet Header Version %u.\n", - InternetHeaderVersion)); - pPacketInfo->ProtocolFlags = 0; - pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxUnableCts++; - return; - } - - /* Get the IP header length (IHL). */ - /* - * Note: The IHL is stored in the lower four bits as the number of - * 4-byte words. - */ - - IpHeaderLength = (Tmp & 0xf) * 4; - pPacketInfo->IpHeaderLength = IpHeaderLength; - - /* Check the IP header length. */ - - /* 04-Aug-1998 sw - Really check the IHL? Necessary? */ - - if (IpHeaderLength < 5*4) { - SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_TX, - ("Tx: Invalid IP Header Length %u.\n", IpHeaderLength)); - pPacketInfo->ProtocolFlags = 0; - pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxUnableCts++; - return; - } - - /* This is an IPv4 frame with a header of valid length. */ - - pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].TxOkCts++; - - /* Check if we should calculate the IP header checksum. */ - - ProtocolFlags = pPacketInfo->ProtocolFlags; - - if (ProtocolFlags & SKCS_PROTO_IP) { - pPacketInfo->IpHeaderChecksum = - SkCsCalculateChecksum(pIpHeader, IpHeaderLength); - } - - /* Get the next level protocol identifier. */ - - NextLevelProtocol = - *(SK_U8 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL); - - /* - * Check if this is a TCP or UDP frame and if we should calculate the - * TCP/UDP pseudo header checksum. - * - * Also clear all protocol bit flags of protocols not present in the - * frame. - */ - - if ((ProtocolFlags & SKCS_PROTO_TCP) != 0 && - NextLevelProtocol == SKCS_PROTO_ID_TCP) { - /* TCP/IP frame. */ - ProtocolFlags &= SKCS_PROTO_TCP | SKCS_PROTO_IP; - NextLevelProtoStats = - &pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_TCP]; - } - else if ((ProtocolFlags & SKCS_PROTO_UDP) != 0 && - NextLevelProtocol == SKCS_PROTO_ID_UDP) { - /* UDP/IP frame. */ - ProtocolFlags &= SKCS_PROTO_UDP | SKCS_PROTO_IP; - NextLevelProtoStats = - &pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_UDP]; - } - else { - /* - * Either not a TCP or UDP frame and/or TCP/UDP processing not - * specified. - */ - pPacketInfo->ProtocolFlags = ProtocolFlags & SKCS_PROTO_IP; - return; - } - - /* Check if this is an IP fragment. */ - - /* - * Note: An IP fragment has a non-zero "Fragment Offset" field and/or - * the "More Fragments" bit set. Thus, if both the "Fragment Offset" - * and the "More Fragments" are zero, it is *not* a fragment. We can - * easily check both at the same time since they are in the same 16-bit - * word. - */ - - if ((*(SK_U16 *) - SKCS_IDX(pIpHeader, SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET) & - ~SKCS_IP_DONT_FRAGMENT) != 0) { - /* IP fragment; ignore all other protocols. */ - pPacketInfo->ProtocolFlags = ProtocolFlags & SKCS_PROTO_IP; - NextLevelProtoStats->TxUnableCts++; - return; - } - - /* - * Calculate the TCP/UDP pseudo header checksum. - */ - - /* Get total length of IP header and data. */ - - IpDataLength = - *(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_TOTAL_LENGTH); - - /* Get length of IP data portion. */ - - IpDataLength = SKCS_NTOH16(IpDataLength) - IpHeaderLength; - - /* Calculate the sum of all pseudo header fields (16-bit). */ - - PseudoHeaderChecksum = - (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, - SKCS_OFS_IP_SOURCE_ADDRESS + 0) + - (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, - SKCS_OFS_IP_SOURCE_ADDRESS + 2) + - (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, - SKCS_OFS_IP_DESTINATION_ADDRESS + 0) + - (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, - SKCS_OFS_IP_DESTINATION_ADDRESS + 2) + - (unsigned long) SKCS_HTON16(NextLevelProtocol) + - (unsigned long) SKCS_HTON16(IpDataLength); - - /* Add-in any carries. */ - - SKCS_OC_ADD(PseudoHeaderChecksum, PseudoHeaderChecksum, 0); - - /* Add-in any new carry. */ - - SKCS_OC_ADD(pPacketInfo->PseudoHeaderChecksum, PseudoHeaderChecksum, 0); - - pPacketInfo->ProtocolFlags = ProtocolFlags; - NextLevelProtoStats->TxOkCts++; /* Success. */ -} /* SkCsGetSendInfo */ - - -/****************************************************************************** - * - * SkCsGetReceiveInfo - verify checksum information for a received packet - * - * Description: - * Verify a received frame's checksum. The function returns a status code - * reflecting the result of the verification. - * - * Note: - * Before calling this function you have to verify that the frame is - * not padded and Checksum1 and Checksum2 are bigger than 1. - * - * Arguments: - * pAc - Pointer to adapter context struct. - * - * pIpHeader - Pointer to IP header. Must be at least the length in bytes - * of the received IP header including any option fields. For UDP packets, - * 8 additional bytes are needed to access the UDP checksum. - * - * Note: The actual length of the IP header is stored in the lower four - * bits of the first octet of the IP header as the number of 4-byte words, - * so it must be multiplied by four to get the length in bytes. Thus, the - * maximum IP header length is 15 * 4 = 60 bytes. - * - * Checksum1 - The first 16-bit Internet Checksum calculated by the - * hardware starting at the offset returned by SkCsSetReceiveFlags(). - * - * Checksum2 - The second 16-bit Internet Checksum calculated by the - * hardware starting at the offset returned by SkCsSetReceiveFlags(). - * - * Returns: - * SKCS_STATUS_UNKNOWN_IP_VERSION - Not an IP v4 frame. - * SKCS_STATUS_IP_CSUM_ERROR - IP checksum error. - * SKCS_STATUS_IP_CSUM_ERROR_TCP - IP checksum error in TCP frame. - * SKCS_STATUS_IP_CSUM_ERROR_UDP - IP checksum error in UDP frame - * SKCS_STATUS_IP_FRAGMENT - IP fragment (IP checksum ok). - * SKCS_STATUS_IP_CSUM_OK - IP checksum ok (not a TCP or UDP frame). - * SKCS_STATUS_TCP_CSUM_ERROR - TCP checksum error (IP checksum ok). - * SKCS_STATUS_UDP_CSUM_ERROR - UDP checksum error (IP checksum ok). - * SKCS_STATUS_TCP_CSUM_OK - IP and TCP checksum ok. - * SKCS_STATUS_UDP_CSUM_OK - IP and UDP checksum ok. - * SKCS_STATUS_IP_CSUM_OK_NO_UDP - IP checksum OK and no UDP checksum. - * - * Note: If SKCS_OVERWRITE_STATUS is defined, the SKCS_STATUS_XXX values - * returned here can be defined in some header file by the module using CSUM. - * In this way, the calling module can assign return values for its own needs, - * e.g. by assigning bit flags to the individual protocols. - */ -SKCS_STATUS SkCsGetReceiveInfo( -SK_AC *pAc, /* Adapter context struct. */ -void *pIpHeader, /* IP header. */ -unsigned Checksum1, /* Hardware checksum 1. */ -unsigned Checksum2, /* Hardware checksum 2. */ -int NetNumber) /* Net number */ -{ - /* Internet Header Version found in IP header. */ - unsigned InternetHeaderVersion; - - /* Length of the IP header as found in IP header. */ - unsigned IpHeaderLength; - - /* Length of IP data portion. */ - unsigned IpDataLength; - - /* IP header checksum. */ - unsigned IpHeaderChecksum; - - /* IP header options checksum, if any. */ - unsigned IpOptionsChecksum; - - /* IP data checksum, i.e. TCP/UDP checksum. */ - unsigned IpDataChecksum; - - /* Next level protocol identifier found in IP header. */ - unsigned NextLevelProtocol; - - /* The checksum of the "next level protocol", i.e. TCP or UDP. */ - unsigned long NextLevelProtocolChecksum; - - /* Pointer to next level protocol statistics structure. */ - SKCS_PROTO_STATS *NextLevelProtoStats; - - /* Temporary variable. */ - unsigned Tmp; - - Tmp = *(SK_U8 *) - SKCS_IDX(pIpHeader, SKCS_OFS_IP_HEADER_VERSION_AND_LENGTH); - - /* Get the Internet Header Version (IHV). */ - /* Note: The IHV is stored in the upper four bits. */ - - InternetHeaderVersion = Tmp >> 4; - - /* Check the Internet Header Version. */ - /* Note: We currently only support IP version 4. */ - - if (InternetHeaderVersion != 4) { /* IPv4? */ - SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_RX, - ("Rx: Unknown Internet Header Version %u.\n", - InternetHeaderVersion)); - pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].RxUnableCts++; - return (SKCS_STATUS_UNKNOWN_IP_VERSION); - } - - /* Get the IP header length (IHL). */ - /* - * Note: The IHL is stored in the lower four bits as the number of - * 4-byte words. - */ - - IpHeaderLength = (Tmp & 0xf) * 4; - - /* Check the IP header length. */ - - /* 04-Aug-1998 sw - Really check the IHL? Necessary? */ - - if (IpHeaderLength < 5*4) { - SK_DBG_MSG(pAc, SK_DBGMOD_CSUM, SK_DBGCAT_ERR | SK_DBGCAT_RX, - ("Rx: Invalid IP Header Length %u.\n", IpHeaderLength)); - pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].RxErrCts++; - return (SKCS_STATUS_IP_CSUM_ERROR); - } - - /* This is an IPv4 frame with a header of valid length. */ - - /* Get the IP header and data checksum. */ - - IpDataChecksum = Checksum2; - - /* - * The IP header checksum is calculated as follows: - * - * IpHeaderChecksum = Checksum1 - Checksum2 - */ - - SKCS_OC_SUB(IpHeaderChecksum, Checksum1, Checksum2); - - /* Check if any IP header options. */ - - if (IpHeaderLength > SKCS_IP_HEADER_SIZE) { - - /* Get the IP options checksum. */ - - IpOptionsChecksum = SkCsCalculateChecksum( - SKCS_IDX(pIpHeader, SKCS_IP_HEADER_SIZE), - IpHeaderLength - SKCS_IP_HEADER_SIZE); - - /* Adjust the IP header and IP data checksums. */ - - SKCS_OC_ADD(IpHeaderChecksum, IpHeaderChecksum, IpOptionsChecksum); - - SKCS_OC_SUB(IpDataChecksum, IpDataChecksum, IpOptionsChecksum); - } - - /* - * Check if the IP header checksum is ok. - * - * NOTE: We must check the IP header checksum even if the caller just wants - * us to check upper-layer checksums, because we cannot do any further - * processing of the packet without a valid IP checksum. - */ - - /* Get the next level protocol identifier. */ - - NextLevelProtocol = *(SK_U8 *) - SKCS_IDX(pIpHeader, SKCS_OFS_IP_NEXT_LEVEL_PROTOCOL); - - if (IpHeaderChecksum != 0xFFFF) { - pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_IP].RxErrCts++; - /* the NDIS tester wants to know the upper level protocol too */ - if (NextLevelProtocol == SKCS_PROTO_ID_TCP) { - return(SKCS_STATUS_IP_CSUM_ERROR_TCP); - } - else if (NextLevelProtocol == SKCS_PROTO_ID_UDP) { - return(SKCS_STATUS_IP_CSUM_ERROR_UDP); - } - return (SKCS_STATUS_IP_CSUM_ERROR); - } - - /* - * Check if this is a TCP or UDP frame and if we should calculate the - * TCP/UDP pseudo header checksum. - * - * Also clear all protocol bit flags of protocols not present in the - * frame. - */ - - if ((pAc->Csum.ReceiveFlags[NetNumber] & SKCS_PROTO_TCP) != 0 && - NextLevelProtocol == SKCS_PROTO_ID_TCP) { - /* TCP/IP frame. */ - NextLevelProtoStats = - &pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_TCP]; - } - else if ((pAc->Csum.ReceiveFlags[NetNumber] & SKCS_PROTO_UDP) != 0 && - NextLevelProtocol == SKCS_PROTO_ID_UDP) { - /* UDP/IP frame. */ - NextLevelProtoStats = - &pAc->Csum.ProtoStats[NetNumber][SKCS_PROTO_STATS_UDP]; - } - else { - /* - * Either not a TCP or UDP frame and/or TCP/UDP processing not - * specified. - */ - return (SKCS_STATUS_IP_CSUM_OK); - } - - /* Check if this is an IP fragment. */ - - /* - * Note: An IP fragment has a non-zero "Fragment Offset" field and/or - * the "More Fragments" bit set. Thus, if both the "Fragment Offset" - * and the "More Fragments" are zero, it is *not* a fragment. We can - * easily check both at the same time since they are in the same 16-bit - * word. - */ - - if ((*(SK_U16 *) - SKCS_IDX(pIpHeader, SKCS_OFS_IP_FLAGS_AND_FRAGMENT_OFFSET) & - ~SKCS_IP_DONT_FRAGMENT) != 0) { - /* IP fragment; ignore all other protocols. */ - NextLevelProtoStats->RxUnableCts++; - return (SKCS_STATUS_IP_FRAGMENT); - } - - /* - * 08-May-2000 ra - * - * From RFC 768 (UDP) - * If the computed checksum is zero, it is transmitted as all ones (the - * equivalent in one's complement arithmetic). An all zero transmitted - * checksum value means that the transmitter generated no checksum (for - * debugging or for higher level protocols that don't care). - */ - - if (NextLevelProtocol == SKCS_PROTO_ID_UDP && - *(SK_U16*)SKCS_IDX(pIpHeader, IpHeaderLength + 6) == 0x0000) { - - NextLevelProtoStats->RxOkCts++; - - return (SKCS_STATUS_IP_CSUM_OK_NO_UDP); - } - - /* - * Calculate the TCP/UDP checksum. - */ - - /* Get total length of IP header and data. */ - - IpDataLength = - *(SK_U16 *) SKCS_IDX(pIpHeader, SKCS_OFS_IP_TOTAL_LENGTH); - - /* Get length of IP data portion. */ - - IpDataLength = SKCS_NTOH16(IpDataLength) - IpHeaderLength; - - NextLevelProtocolChecksum = - - /* Calculate the pseudo header checksum. */ - - (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, - SKCS_OFS_IP_SOURCE_ADDRESS + 0) + - (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, - SKCS_OFS_IP_SOURCE_ADDRESS + 2) + - (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, - SKCS_OFS_IP_DESTINATION_ADDRESS + 0) + - (unsigned long) *(SK_U16 *) SKCS_IDX(pIpHeader, - SKCS_OFS_IP_DESTINATION_ADDRESS + 2) + - (unsigned long) SKCS_HTON16(NextLevelProtocol) + - (unsigned long) SKCS_HTON16(IpDataLength) + - - /* Add the TCP/UDP header checksum. */ - - (unsigned long) IpDataChecksum; - - /* Add-in any carries. */ - - SKCS_OC_ADD(NextLevelProtocolChecksum, NextLevelProtocolChecksum, 0); - - /* Add-in any new carry. */ - - SKCS_OC_ADD(NextLevelProtocolChecksum, NextLevelProtocolChecksum, 0); - - /* Check if the TCP/UDP checksum is ok. */ - - if ((unsigned) NextLevelProtocolChecksum == 0xFFFF) { - - /* TCP/UDP checksum ok. */ - - NextLevelProtoStats->RxOkCts++; - - return (NextLevelProtocol == SKCS_PROTO_ID_TCP ? - SKCS_STATUS_TCP_CSUM_OK : SKCS_STATUS_UDP_CSUM_OK); - } - - /* TCP/UDP checksum error. */ - - NextLevelProtoStats->RxErrCts++; - - return (NextLevelProtocol == SKCS_PROTO_ID_TCP ? - SKCS_STATUS_TCP_CSUM_ERROR : SKCS_STATUS_UDP_CSUM_ERROR); -} /* SkCsGetReceiveInfo */ -#endif /****************************************************************************** diff --git a/drivers/sk98lin/skge.c b/drivers/sk98lin/skge.c index 61a6094230..8fab9c9485 100644 --- a/drivers/sk98lin/skge.c +++ b/drivers/sk98lin/skge.c @@ -345,11 +345,6 @@ #ifdef CONFIG_SK98 #include "h/skversion.h" -#if 0 -#include <linux/module.h> -#include <linux/init.h> -#include <linux/proc_fs.h> -#endif #include "h/skdrv1st.h" #include "h/skdrv2nd.h" @@ -359,9 +354,6 @@ /* #define BREAKPOINT() asm(" int $3"); */ /* use the scatter-gather functionality with sendfile() */ -#if 0 -#define SK_ZEROCOPY -#endif /* use of a transmit complete interrupt */ #define USE_TX_COMPLETE @@ -410,48 +402,23 @@ static void BoardInitMem(SK_AC *pAC); static void SetupRing(SK_AC*, void*, uintptr_t, RXD**, RXD**, RXD**, int*, SK_BOOL); -#if 0 -static void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs); -static void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs); -static int SkGeOpen(struct SK_NET_DEVICE *dev); -static int SkGeClose(struct SK_NET_DEVICE *dev); -static int SkGeXmit(struct sk_buff *skb, struct SK_NET_DEVICE *dev); -static int SkGeSetMacAddr(struct SK_NET_DEVICE *dev, void *p); -static void SkGeSetRxMode(struct SK_NET_DEVICE *dev); -static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev); -static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd); -#else void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs); void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs); int SkGeOpen(struct SK_NET_DEVICE *dev); int SkGeClose(struct SK_NET_DEVICE *dev); int SkGeXmit(struct sk_buff *skb, struct SK_NET_DEVICE *dev); -#endif static void GetConfiguration(SK_AC*); static void ProductStr(SK_AC*); static int XmitFrame(SK_AC*, TX_PORT*, struct sk_buff*); static void FreeTxDescriptors(SK_AC*pAC, TX_PORT*); static void FillRxRing(SK_AC*, RX_PORT*); static SK_BOOL FillRxDescriptor(SK_AC*, RX_PORT*); -#if 0 -static void ReceiveIrq(SK_AC*, RX_PORT*, SK_BOOL); -#else void ReceiveIrq(SK_AC*, RX_PORT*, SK_BOOL); -#endif static void ClearAndStartRx(SK_AC*, int); static void ClearTxIrq(SK_AC*, int, int); static void ClearRxRing(SK_AC*, RX_PORT*); static void ClearTxRing(SK_AC*, TX_PORT*); -#if 0 -static void SetQueueSizes(SK_AC *pAC); - -static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int new_mtu); -#endif static void PortReInitBmu(SK_AC*, int); -#if 0 -static int SkGeIocMib(DEV_NET*, unsigned int, int); -static int XmitFrameSG(SK_AC*, TX_PORT*, struct sk_buff*); -#endif /*Extern */ @@ -472,9 +439,6 @@ static void DumpLong(char*, int); void dump_frag( SK_U8 *data, int length); /* global variables *********************************************************/ -#if 0 -static const char *BootString = BOOT_STRING; -#endif struct SK_NET_DEVICE *SkGeRootDev = NULL; static int probed __initdata = 0; @@ -486,9 +450,6 @@ static uintptr_t RxQueueAddr[SK_MAX_MACS] = {0x400, 0x480}; /* local variables **********************************************************/ const char SK_Root_Dir_entry[8]; -#if 0 -static struct proc_dir_entry *pSkRootDir; -#endif static struct pci_device_id supported[] = { @@ -512,36 +473,15 @@ static struct pci_device_id supported[] = { * 0, if everything is ok * !=0, on error */ -#if 0 -static int __init skge_probe (void) -#else int skge_probe (struct eth_device ** ret_dev) -#endif { -#if 0 - int proc_root_initialized = 0; -#endif int boards_found = 0; -#if 0 - int vendor_flag = SK_FALSE; -#endif SK_AC *pAC; DEV_NET *pNet = NULL; -#if 0 - struct proc_dir_entry *pProcFile; - struct pci_dev *pdev = NULL; - unsigned long base_address; -#else u32 base_address; -#endif struct SK_NET_DEVICE *dev = NULL; -#if 0 - SK_BOOL DeviceFound = SK_FALSE; -#endif SK_BOOL BootStringCount = SK_FALSE; -#if 1 pci_dev_t devno; -#endif if (probed) return -ENODEV; @@ -550,22 +490,13 @@ int skge_probe (struct eth_device ** ret_dev) if (!pci_present()) /* is PCI support present? */ return -ENODEV; -#if 0 - while((pdev = pci_find_class(PCI_CLASS_NETWORK_ETHERNET << 8, pdev))) -#else while((devno = pci_find_devices (supported, boards_found)) >= 0) -#endif { dev = NULL; pNet = NULL; -#if 0 - SK_PCI_ISCOMPLIANT(vendor_flag, pdev); - if (!vendor_flag) - continue; -#endif /* if ((pdev->vendor != PCI_VENDOR_ID_SYSKONNECT) && ((pdev->device != PCI_DEVICE_ID_SYSKONNECT_GE) || @@ -573,25 +504,11 @@ int skge_probe (struct eth_device ** ret_dev) continue; } */ -#if 0 - /* Configure DMA attributes. */ - if (pci_set_dma_mask(pdev, (u64) 0xffffffffffffffff) && - pci_set_dma_mask(pdev, (u64) 0xffffffff)) - continue; -#endif -#if 0 - if ((dev = init_etherdev(dev, sizeof(DEV_NET))) == NULL) { - printk(KERN_ERR "Unable to allocate etherdev " - "structure!\n"); - break; - } -#else dev = malloc (sizeof *dev); memset(dev, 0, sizeof(*dev)); dev->priv = malloc(sizeof(DEV_NET)); -#endif if (dev->priv == NULL) { printk(KERN_ERR "Unable to allocate adapter " @@ -620,34 +537,14 @@ int skge_probe (struct eth_device ** ret_dev) memset(pNet->pAC, 0, sizeof(SK_AC)); pAC = pNet->pAC; -#if 0 - pAC->PciDev = pdev; - pAC->PciDevId = pdev->device; - pAC->dev[0] = dev; - pAC->dev[1] = dev; -#else pAC->PciDev = devno; ret_dev[0] = pAC->dev[0] = dev; ret_dev[1] = pAC->dev[1] = dev; -#endif sprintf(pAC->Name, "SysKonnect SK-98xx"); pAC->CheckQueue = SK_FALSE; pNet->Mtu = 1500; pNet->Up = 0; -#if 0 - dev->irq = pdev->irq; - - dev->open = &SkGeOpen; - dev->stop = &SkGeClose; - dev->hard_start_xmit = &SkGeXmit; - dev->get_stats = &SkGeStats; - dev->set_multicast_list = &SkGeSetRxMode; - dev->set_mac_address = &SkGeSetMacAddr; - dev->do_ioctl = &SkGeIoctl; - dev->change_mtu = &SkGeChangeMtu; - dev->flags &= ~IFF_RUNNING; -#endif #ifdef SK_ZEROCOPY if (pAC->GIni.GIChipId == CHIP_ID_YUKON) { @@ -657,22 +554,11 @@ int skge_probe (struct eth_device ** ret_dev) } #endif -#if 0 - /* - * Dummy value. - */ - dev->base_addr = 42; - pci_set_master(pdev); - - pci_set_master(pdev); - base_address = pci_resource_start (pdev, 0); -#else pci_write_config_dword(devno, PCI_COMMAND, PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER); pci_read_config_dword (devno, PCI_BASE_ADDRESS_0, &base_address); -#endif #ifdef SK_BIG_ENDIAN /* @@ -690,11 +576,7 @@ int skge_probe (struct eth_device ** ret_dev) /* * Remap the regs into kernel space. */ -#if 0 - pAC->IoBase = (char*)ioremap(base_address, 0x4000); -#else pAC->IoBase = (char*)pci_mem_to_phys(devno, base_address); -#endif if (!pAC->IoBase){ printk(KERN_ERR "%s: Unable to map I/O register, " @@ -711,44 +593,9 @@ int skge_probe (struct eth_device ** ret_dev) continue; } -#if 0 - memcpy((caddr_t) &dev->dev_addr, - (caddr_t) &pAC->Addr.Net[0].CurrentMacAddress, 6); -#else memcpy((caddr_t) &dev->enetaddr, (caddr_t) &pAC->Addr.Net[0].CurrentMacAddress, 6); -#endif -#if 0 - /* First adapter... Create proc and print message */ - if (!DeviceFound) { - DeviceFound = SK_TRUE; - SK_MEMCPY(&SK_Root_Dir_entry, BootString, - sizeof(SK_Root_Dir_entry) - 1); - - /*Create proc (directory)*/ - if(!proc_root_initialized) { - pSkRootDir = create_proc_entry(SK_Root_Dir_entry, - S_IFDIR | S_IWUSR | S_IRUGO | S_IXUGO, proc_net); - proc_root_initialized = 1; - } - - pSkRootDir->owner = THIS_MODULE; - } - - - /* Create proc file */ - pProcFile = create_proc_entry(dev->name, - S_IFREG | S_IXUSR | S_IWGRP | S_IROTH, - pSkRootDir); - - - pProcFile->read_proc = proc_read; - pProcFile->write_proc = NULL; - pProcFile->nlink = 1; - pProcFile->size = sizeof(dev->name + 1); - pProcFile->data = (void *)pProcFile; -#endif pNet->PortNr = 0; pNet->NetNr = 0; @@ -764,17 +611,9 @@ int skge_probe (struct eth_device ** ret_dev) /* More then one port found */ if ((pAC->GIni.GIMacsFound == 2 ) && (pAC->RlmtNets == 2)) { -#if 0 - if ((dev = init_etherdev(NULL, sizeof(DEV_NET))) == 0) { - printk(KERN_ERR "Unable to allocate etherdev " - "structure!\n"); - break; - } -#else dev = malloc (sizeof *dev); memset(dev, 0, sizeof(*dev)); dev->priv = malloc(sizeof(DEV_NET)); -#endif pAC->dev[1] = dev; pNet = dev->priv; @@ -784,17 +623,6 @@ int skge_probe (struct eth_device ** ret_dev) pNet->Mtu = 1500; pNet->Up = 0; -#if 0 - dev->open = &SkGeOpen; - dev->stop = &SkGeClose; - dev->hard_start_xmit = &SkGeXmit; - dev->get_stats = &SkGeStats; - dev->set_multicast_list = &SkGeSetRxMode; - dev->set_mac_address = &SkGeSetMacAddr; - dev->do_ioctl = &SkGeIoctl; - dev->change_mtu = &SkGeChangeMtu; - dev->flags &= ~IFF_RUNNING; -#endif #ifdef SK_ZEROCOPY if (pAC->GIni.GIChipId == CHIP_ID_YUKON) { @@ -803,26 +631,9 @@ int skge_probe (struct eth_device ** ret_dev) } #endif -#if 0 - pProcFile = create_proc_entry(dev->name, - S_IFREG | S_IXUSR | S_IWGRP | S_IROTH, - pSkRootDir); - - pProcFile->read_proc = proc_read; - pProcFile->write_proc = NULL; - pProcFile->nlink = 1; - pProcFile->size = sizeof(dev->name + 1); - pProcFile->data = (void *)pProcFile; -#endif - -#if 0 - memcpy((caddr_t) &dev->dev_addr, - (caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6); -#else memcpy((caddr_t) &dev->enetaddr, (caddr_t) &pAC->Addr.Net[1].CurrentMacAddress, 6); -#endif printk("%s: %s\n", dev->name, pAC->DeviceStr); printk(" PrefPort:B RlmtMode:Dual Check Link State\n"); @@ -838,11 +649,6 @@ int skge_probe (struct eth_device ** ret_dev) * This is bollocks, but we need to tell the net-init * code that it shall go for the next device. */ -#if 0 -#ifndef MODULE - dev->base_addr = 0; -#endif -#endif } /* @@ -876,14 +682,6 @@ SK_AC *pAC; pNet = (DEV_NET*) dev->priv; pAC = pNet->pAC; AllocFlag = pAC->AllocFlag; -#if 0 - if (AllocFlag & SK_ALLOC_IRQ) { - free_irq(dev->irq, dev); - } - if (pAC->IoBase) { - iounmap(pAC->IoBase); - } -#endif if (pAC->pDescrMem) { BoardFreeMem(pAC); } @@ -891,26 +689,6 @@ SK_AC *pAC; } /* FreeResources */ -#if 0 -MODULE_AUTHOR("Mirko Lindner <mlindner@syskonnect.de>"); -MODULE_DESCRIPTION("SysKonnect SK-NET Gigabit Ethernet SK-98xx driver"); -MODULE_LICENSE("GPL"); -MODULE_PARM(Speed_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(Speed_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(AutoNeg_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(AutoNeg_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(DupCap_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(DupCap_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(FlowCtrl_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(FlowCtrl_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(Role_A, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(Role_B, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(PrefPort, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -MODULE_PARM(RlmtMode, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "s"); -/* not used, just there because every driver should have them: */ -MODULE_PARM(options, "1-" __MODULE_STRING(SK_MAX_CARD_PARAM) "i"); -MODULE_PARM(debug, "i"); -#endif #ifdef LINK_SPEED_A @@ -985,115 +763,6 @@ static char *RlmtMode[SK_MAX_CARD_PARAM] = RLMT_MODE; static char *RlmtMode[SK_MAX_CARD_PARAM] = {"", }; #endif -#if 0 -static int debug = 0; /* not used */ -static int options[SK_MAX_CARD_PARAM] = {0, }; /* not used */ - - -/***************************************************************************** - * - * skge_init_module - module initialization function - * - * Description: - * Very simple, only call skge_probe and return approriate result. - * - * Returns: - * 0, if everything is ok - * !=0, on error - */ -static int __init skge_init_module(void) -{ - int cards; - SkGeRootDev = NULL; - - /* just to avoid warnings ... */ - debug = 0; - options[0] = 0; - - cards = skge_probe(); - if (cards == 0) { - printk("sk98lin: No adapter found.\n"); - } - return cards ? 0 : -ENODEV; -} /* skge_init_module */ - - -/***************************************************************************** - * - * skge_cleanup_module - module unload function - * - * Description: - * Disable adapter if it is still running, free resources, - * free device struct. - * - * Returns: N/A - */ -static void __exit skge_cleanup_module(void) -{ -DEV_NET *pNet; -SK_AC *pAC; -struct SK_NET_DEVICE *next; -unsigned long Flags; -SK_EVPARA EvPara; - - while (SkGeRootDev) { - pNet = (DEV_NET*) SkGeRootDev->priv; - pAC = pNet->pAC; - next = pAC->Next; - - netif_stop_queue(SkGeRootDev); - SkGeYellowLED(pAC, pAC->IoBase, 0); - - if(pAC->BoardLevel == 2) { - /* board is still alive */ - spin_lock_irqsave(&pAC->SlowPathLock, Flags); - EvPara.Para32[0] = 0; - EvPara.Para32[1] = -1; - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); - EvPara.Para32[0] = 1; - EvPara.Para32[1] = -1; - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); - SkEventDispatcher(pAC, pAC->IoBase); - /* disable interrupts */ - SK_OUT32(pAC->IoBase, B0_IMSK, 0); - SkGeDeInit(pAC, pAC->IoBase); - spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - pAC->BoardLevel = 0; - /* We do NOT check here, if IRQ was pending, of course*/ - } - - if(pAC->BoardLevel == 1) { - /* board is still alive */ - SkGeDeInit(pAC, pAC->IoBase); - pAC->BoardLevel = 0; - } - - if ((pAC->GIni.GIMacsFound == 2) && pAC->RlmtNets == 2){ - unregister_netdev(pAC->dev[1]); - kfree(pAC->dev[1]); - } - - FreeResources(SkGeRootDev); - - SkGeRootDev->get_stats = NULL; - /* - * otherwise unregister_netdev calls get_stats with - * invalid IO ... :-( - */ - unregister_netdev(SkGeRootDev); - kfree(SkGeRootDev); - kfree(pAC); - SkGeRootDev = next; - } - - /* clear proc-dir */ - remove_proc_entry(pSkRootDir->name, proc_net); - -} /* skge_cleanup_module */ - -module_init(skge_init_module); -module_exit(skge_cleanup_module); -#endif /***************************************************************************** @@ -1115,9 +784,6 @@ short i; unsigned long Flags; char *DescrString = "sk98lin: Driver for Linux"; /* this is given to PNMI */ char *VerStr = VER_STRING; -#if 0 -int Ret; /* return code of request_irq */ -#endif SK_BOOL DualNet; SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, @@ -1182,24 +848,6 @@ SK_BOOL DualNet; pAC->BoardLevel = 1; spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); -#if 0 - if (pAC->GIni.GIMacsFound == 2) { - Ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); - } else if (pAC->GIni.GIMacsFound == 1) { - Ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, - pAC->Name, dev); - } else { - printk(KERN_WARNING "%s: Illegal number of ports: %d\n", - dev->name, pAC->GIni.GIMacsFound); - return -EAGAIN; - } - - if (Ret) { - printk(KERN_WARNING "%s: Requested IRQ %d is busy.\n", - dev->name, dev->irq); - return -EAGAIN; - } -#endif pAC->AllocFlag |= SK_ALLOC_IRQ; /* Alloc memory for this board (Mem for RxD/TxD) : */ @@ -1214,9 +862,6 @@ SK_BOOL DualNet; pAC->CsOfs = (pAC->CsOfs2 << 16) | pAC->CsOfs1; BoardInitMem(pAC); -#if 0 - SetQueueSizes(pAC); -#else /* tschilling: New common function with minimum size check. */ DualNet = SK_FALSE; if (pAC->RlmtNets == 2) { @@ -1231,7 +876,6 @@ SK_BOOL DualNet; printk("SkGeInitAssignRamToQueues failed.\n"); return(-EAGAIN); } -#endif /* Print adapter specific string from vpd */ ProductStr(pAC); @@ -1531,11 +1175,7 @@ int PortIndex) /* index of the port for which to re-init */ * Returns: N/A * */ -#if 0 -static void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs) -#else void SkGeIsr(int irq, void *dev_id, struct pt_regs *ptregs) -#endif { struct SK_NET_DEVICE *dev = (struct SK_NET_DEVICE *)dev_id; DEV_NET *pNet; @@ -1554,13 +1194,6 @@ SK_U32 IntSrc; /* interrupts source register contents */ } while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { -#if 0 /* software irq currently not used */ - if (IntSrc & IRQ_SW) { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, - SK_DBGCAT_DRV_INT_SRC, - ("Software IRQ\n")); - } -#endif if (IntSrc & IRQ_EOF_RX1) { SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC, @@ -1594,28 +1227,6 @@ SK_U32 IntSrc; /* interrupts source register contents */ FreeTxDescriptors(pAC, &pAC->TxPort[1][TX_PRIO_LOW]); spin_unlock(&pAC->TxPort[1][TX_PRIO_LOW].TxDesRingLock); } -#if 0 /* only if sync. queues used */ - if (IntSrc & IRQ_EOF_SY_TX1) { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, - SK_DBGCAT_DRV_INT_SRC, - ("EOF SY TX1 IRQ\n")); - SK_PNMI_CNT_TX_INTR(pAC, 1); - spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); - FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); - spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); - ClearTxIrq(pAC, 0, TX_PRIO_HIGH); - } - if (IntSrc & IRQ_EOF_SY_TX2) { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, - SK_DBGCAT_DRV_INT_SRC, - ("EOF SY TX2 IRQ\n")); - SK_PNMI_CNT_TX_INTR(pAC, 1); - spin_lock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); - FreeTxDescriptors(pAC, 1, TX_PRIO_HIGH); - spin_unlock(&pAC->TxPort[1][TX_PRIO_HIGH].TxDesRingLock); - ClearTxIrq(pAC, 1, TX_PRIO_HIGH); - } -#endif #endif /* do all IO at once */ @@ -1680,11 +1291,7 @@ SK_U32 IntSrc; /* interrupts source register contents */ * Returns: N/A * */ -#if 0 -static void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs) -#else void SkGeIsrOnePort(int irq, void *dev_id, struct pt_regs *ptregs) -#endif { struct SK_NET_DEVICE *dev = (struct SK_NET_DEVICE *)dev_id; DEV_NET *pNet; @@ -1703,13 +1310,6 @@ SK_U32 IntSrc; /* interrupts source register contents */ } while (((IntSrc & IRQ_MASK) & ~SPECIAL_IRQS) != 0) { -#if 0 /* software irq currently not used */ - if (IntSrc & IRQ_SW) { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, - SK_DBGCAT_DRV_INT_SRC, - ("Software IRQ\n")); - } -#endif if (IntSrc & IRQ_EOF_RX1) { SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_INT_SRC, @@ -1727,18 +1327,6 @@ SK_U32 IntSrc; /* interrupts source register contents */ FreeTxDescriptors(pAC, &pAC->TxPort[0][TX_PRIO_LOW]); spin_unlock(&pAC->TxPort[0][TX_PRIO_LOW].TxDesRingLock); } -#if 0 /* only if sync. queues used */ - if (IntSrc & IRQ_EOF_SY_TX1) { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, - SK_DBGCAT_DRV_INT_SRC, - ("EOF SY TX1 IRQ\n")); - SK_PNMI_CNT_TX_INTR(pAC, 0); - spin_lock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); - FreeTxDescriptors(pAC, 0, TX_PRIO_HIGH); - spin_unlock(&pAC->TxPort[0][TX_PRIO_HIGH].TxDesRingLock); - ClearTxIrq(pAC, 0, TX_PRIO_HIGH); - } -#endif #endif /* do all IO at once */ @@ -1792,11 +1380,7 @@ SK_U32 IntSrc; /* interrupts source register contents */ * 0 on success * != 0 on error */ -#if 0 -static int SkGeOpen( -#else int SkGeOpen( -#endif struct SK_NET_DEVICE *dev) { DEV_NET *pNet; @@ -1906,11 +1490,7 @@ struct SK_NET_DEVICE *dev) * 0 - on success * error code - on error */ -#if 0 -static int SkGeClose( -#else int SkGeClose( -#endif struct SK_NET_DEVICE *dev) { DEV_NET *pNet; @@ -2011,11 +1591,7 @@ struct SK_NET_DEVICE *dev) * WARNING: returning 1 in 'tbusy' case caused system crashes (double * allocated skb's) !!! */ -#if 0 -static int SkGeXmit(struct sk_buff *skb, struct SK_NET_DEVICE *dev) -#else int SkGeXmit(struct sk_buff *skb, struct SK_NET_DEVICE *dev) -#endif { DEV_NET *pNet; SK_AC *pAC; @@ -2024,11 +1600,7 @@ int Rc; /* return code of XmitFrame */ pNet = (DEV_NET*) dev->priv; pAC = pNet->pAC; -#if 0 - if ((!skb_shinfo(skb)->nr_frags) || -#else if (1 || -#endif (pAC->GIni.GIChipId == CHIP_ID_GENESIS)) { /* Don't activate scatter-gather and hardware checksum */ @@ -2043,19 +1615,6 @@ int Rc; /* return code of XmitFrame */ &pAC->TxPort[pAC->ActivePort][TX_PRIO_LOW], skb); } else { -#if 0 - /* scatter-gather and hardware TCP checksumming anabled*/ - if (pAC->RlmtNets == 2) - Rc = XmitFrameSG( - pAC, - &pAC->TxPort[pNet->PortNr][TX_PRIO_LOW], - skb); - else - Rc = XmitFrameSG( - pAC, - &pAC->TxPort[pAC->ActivePort][TX_PRIO_LOW], - skb); -#endif } /* Transmitter out of resources? */ @@ -2069,9 +1628,6 @@ int Rc; /* return code of XmitFrame */ if (Rc < 0) return (1); -#if 0 - dev->trans_start = jiffies; -#endif return (0); } /* SkGeXmit */ @@ -2145,16 +1701,7 @@ int BytesSend; #endif /* set up descriptor and CONTROL dword */ -#if 0 - PhysAddr = (SK_U64) pci_map_page(pAC->PciDev, - virt_to_page(pMessage->data), - ((unsigned long) pMessage->data & - ~PAGE_MASK), - pMessage->len, - PCI_DMA_TODEVICE); -#else PhysAddr = (SK_U64) pci_phys_to_mem(pAC->PciDev, (u32) pMessage->data); -#endif pTxd->VDataLow = (SK_U32) (PhysAddr & 0xffffffff); pTxd->VDataHigh = (SK_U32) (PhysAddr >> 32); pTxd->pMBuf = pMessage; @@ -2199,162 +1746,6 @@ int BytesSend; * the ring is full ( -> set tbusy) * < 0 - on failure: other problems ( -> return failure to upper layers) */ -#if 0 -static int XmitFrameSG( -SK_AC *pAC, /* pointer to adapter context */ -TX_PORT *pTxPort, /* pointer to struct of port to send to */ -struct sk_buff *pMessage) /* pointer to send-message */ -{ - - int i; - int BytesSend; - int hlength; - int protocol; - skb_frag_t *sk_frag; - TXD *pTxd; - TXD *pTxdFst; - TXD *pTxdLst; - SK_U64 PhysAddr; - unsigned long Flags; - - spin_lock_irqsave(&pTxPort->TxDesRingLock, Flags); -#ifndef USE_TX_COMPLETE - FreeTxDescriptors(pAC, pTxPort); -#endif - if ((skb_shinfo(pMessage)->nr_frags +1) > pTxPort->TxdRingFree) { - FreeTxDescriptors(pAC, pTxPort); - if ((skb_shinfo(pMessage)->nr_frags + 1) > pTxPort->TxdRingFree) { - spin_unlock_irqrestore(&pTxPort->TxDesRingLock, Flags); - SK_PNMI_CNT_NO_TX_BUF(pAC, pTxPort->PortIndex); - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, - SK_DBGCAT_DRV_TX_PROGRESS, - ("XmitFrameSG failed - Ring full\n")); - /* this message can not be sent now */ - return(-1); - } - } - - - pTxd = pTxPort->pTxdRingHead; - pTxdFst = pTxd; - pTxdLst = pTxd; - BytesSend = 0; - protocol = 0; - - /* map first fragment (header) */ - PhysAddr = (SK_U64) pci_map_page(pAC->PciDev, - virt_to_page(pMessage->data), - ((unsigned long) pMessage->data & ~PAGE_MASK), - skb_headlen(pMessage), - PCI_DMA_TODEVICE); - - pTxd->VDataLow = (SK_U32) (PhysAddr & 0xffffffff); - pTxd->VDataHigh = (SK_U32) (PhysAddr >> 32); - - /* HW checksum? */ - if (pMessage->ip_summed == CHECKSUM_HW) { - pTxd->TBControl = TX_CTRL_STF | - TX_CTRL_ST_FWD | - skb_headlen(pMessage); - - /* We have to use the opcode for tcp here because the opcode for - udp is not working in the hardware yet (revision 2.0)*/ - protocol = ((SK_U8)pMessage->data[23] & 0xf); - if ((protocol == 17) && (pAC->GIni.GIChipRev != 0)) - pTxd->TBControl |= BMU_UDP_CHECK; - else - pTxd->TBControl |= BMU_TCP_CHECK ; - - hlength = ((SK_U8)pMessage->data[14] & 0xf) * 4; - pTxd->TcpSumOfs = 0; /* PH-Checksum already claculated */ - pTxd->TcpSumSt = 14+hlength+16; - pTxd->TcpSumWr = 14+hlength; - - } else { - pTxd->TBControl = TX_CTRL_CHECK_DEFAULT | - TX_CTRL_SOFTWARE | - TX_CTRL_STF | - skb_headlen(pMessage); - } - - pTxd = pTxd->pNextTxd; - pTxPort->TxdRingFree--; - BytesSend += skb_headlen(pMessage); - - - /* Map SG fragments */ - for (i = 0; i < skb_shinfo(pMessage)->nr_frags; i++) { - sk_frag = &skb_shinfo(pMessage)->frags[i]; - - /* we already have the proper value in entry */ - PhysAddr = (SK_U64) pci_map_page(pAC->PciDev, - sk_frag->page, - sk_frag->page_offset, - sk_frag->size, - PCI_DMA_TODEVICE); - - pTxd->VDataLow = (SK_U32) (PhysAddr & 0xffffffff); - pTxd->VDataHigh = (SK_U32) (PhysAddr >> 32); - pTxd->pMBuf = pMessage; - - /* HW checksum */ - if (pMessage->ip_summed == CHECKSUM_HW) { - pTxd->TBControl = TX_CTRL_OWN_BMU | - TX_CTRL_SOFTWARE | - TX_CTRL_ST_FWD; - - /* We have to use the opcode for tcp here because the opcode for - udp is not working in the hardware yet (revision 2.0)*/ - if ((protocol == 17) && (pAC->GIni.GIChipRev != 0)) - pTxd->TBControl |= BMU_UDP_CHECK ; - else - pTxd->TBControl |= BMU_TCP_CHECK ; - - } else { - pTxd->TBControl = TX_CTRL_CHECK_DEFAULT | - TX_CTRL_SOFTWARE | - TX_CTRL_OWN_BMU; - } - - /* Last fragment */ - if( (i+1) == skb_shinfo(pMessage)->nr_frags ) { -#ifdef USE_TX_COMPLETE - pTxd->TBControl |= TX_CTRL_EOF | - TX_CTRL_EOF_IRQ | - sk_frag->size; -#else - pTxd->TBControl |= TX_CTRL_EOF | - sk_frag->size; -#endif - pTxdFst->TBControl |= TX_CTRL_OWN_BMU | - TX_CTRL_SOFTWARE; - - } else { - pTxd->TBControl |= sk_frag->size; - } - pTxdLst = pTxd; - pTxd = pTxd->pNextTxd; - pTxPort->TxdRingFree--; - BytesSend += sk_frag->size; - } - - if ((pTxPort->pTxdRingPrev->TBControl & TX_CTRL_OWN_BMU) == 0) { - /* previous descriptor already done, so give tx start cmd */ - /* StartTx(pAC, pTxPort->HwAddr); */ - SK_OUT8(pTxPort->HwAddr, TX_Q_CTRL, TX_Q_CTRL_START); - } - - pTxPort->pTxdRingPrev = pTxdLst; - pTxPort->pTxdRingHead = pTxd; - - spin_unlock_irqrestore(&pTxPort->TxDesRingLock, Flags); - - if (pTxPort->TxdRingFree > 0) - return (BytesSend); - else - return (0); -} -#endif void dump_frag( SK_U8 *data, int length) @@ -2510,16 +1901,7 @@ SK_U64 PhysAddr; /* physical address of a rx buffer */ pRxPort->pRxdRingTail = pRxd->pNextRxd; pRxPort->RxdRingFree--; Length = pAC->RxBufSize; -#if 0 - PhysAddr = (SK_U64) pci_map_page(pAC->PciDev, - virt_to_page(pMsgBlock->data), - ((unsigned long) pMsgBlock->data & - ~PAGE_MASK), - pAC->RxBufSize - 2, - PCI_DMA_FROMDEVICE); -#else PhysAddr = (SK_U64) pci_phys_to_mem(pAC->PciDev, (u32)pMsgBlock->data); -#endif pRxd->VDataLow = (SK_U32) (PhysAddr & 0xffffffff); pRxd->VDataHigh = (SK_U32) (PhysAddr >> 32); pRxd->pMBuf = pMsgBlock; @@ -2575,11 +1957,7 @@ SK_U16 Length; /* data fragment length */ * * Returns: N/A */ -#if 0 -static void ReceiveIrq( -#else void ReceiveIrq( -#endif SK_AC *pAC, /* pointer to adapter context */ RX_PORT *pRxPort, /* pointer to receive port struct */ SK_BOOL SlowPathLock) /* indicates if SlowPathLock is needed */ @@ -2604,9 +1982,6 @@ SK_U32 FrameStat; unsigned short Csum1; unsigned short Csum2; unsigned short Type; -#if 0 -int Result; -#endif SK_U64 PhysAddr; rx_start: @@ -2702,9 +2077,6 @@ rx_start: if ((Control & RX_CTRL_STAT_VALID) != RX_CTRL_STAT_VALID || (IsBadFrame)) { -#if 0 - (FrameStat & (XMR_FS_ANY_ERR | XMR_FS_2L_VLAN)) != 0) { -#endif /* there is a receive error in this frame */ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_RX_PROGRESS, @@ -2771,45 +2143,14 @@ rx_start: if (Type == 0x800) { Csum1=le16_to_cpu(pRxd->TcpSums & 0xffff); Csum2=le16_to_cpu((pRxd->TcpSums >> 16) & 0xffff); -#if 0 - if ((((Csum1 & 0xfffe) && (Csum2 & 0xfffe)) && - (pAC->GIni.GIChipId == CHIP_ID_GENESIS)) || - (pAC->GIni.GIChipId == CHIP_ID_YUKON)) { - Result = SkCsGetReceiveInfo(pAC, - &pMsg->data[14], - Csum1, Csum2, pRxPort->PortIndex); - if (Result == - SKCS_STATUS_IP_FRAGMENT || - Result == - SKCS_STATUS_IP_CSUM_OK || - Result == - SKCS_STATUS_TCP_CSUM_OK || - Result == - SKCS_STATUS_UDP_CSUM_OK) { - pMsg->ip_summed = - CHECKSUM_UNNECESSARY; - } else { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, - SK_DBGCAT_DRV_RX_PROGRESS, - ("skge: CRC error. Frame dropped!\n")); - goto rx_failed; - } - }/* checksumControl calculation valid */ -#endif } /* IP frame */ } /* frame > SK_COPY_TRESHOLD */ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, 1,("V")); ForRlmt = SK_RLMT_RX_PROTOCOL; -#if 0 - IsBc = (FrameStat & XMR_FS_BC)==XMR_FS_BC; -#endif SK_RLMT_PRE_LOOKAHEAD(pAC, PortIndex, FrameLength, IsBc, &Offset, &NumBytes); if (NumBytes != 0) { -#if 0 - IsMc = (FrameStat & XMR_FS_MC)==XMR_FS_MC; -#endif SK_RLMT_LOOKAHEAD(pAC, PortIndex, &pMsg->data[Offset], IsBc, IsMc, &ForRlmt); @@ -2827,16 +2168,8 @@ rx_start: SK_PNMI_CNT_RX_OCTETS_DELIVERED(pAC, FrameLength, pRxPort->PortIndex); -#if 0 - pMsg->dev = pAC->dev[pRxPort->PortIndex]; - pMsg->protocol = eth_type_trans(pMsg, - pAC->dev[pRxPort->PortIndex]); - netif_rx(pMsg); - pAC->dev[pRxPort->PortIndex]->last_rx = jiffies; -#else NetReceive(pMsg->data, pMsg->len); dev_kfree_skb_any(pMsg); -#endif } else { /* drop frame */ @@ -2881,21 +2214,8 @@ rx_start: SK_DBGCAT_DRV_RX_PROGRESS, ("Q")); } -#if 0 - if ((pAC->dev[pRxPort->PortIndex]->flags & - (IFF_PROMISC | IFF_ALLMULTI)) != 0 || - (ForRlmt & SK_RLMT_RX_PROTOCOL) == - SK_RLMT_RX_PROTOCOL) { - pMsg->dev = pAC->dev[pRxPort->PortIndex]; - pMsg->protocol = eth_type_trans(pMsg, - pAC->dev[pRxPort->PortIndex]); - netif_rx(pMsg); - pAC->dev[pRxPort->PortIndex]->last_rx = jiffies; - } -#else if (0) { } -#endif else { DEV_KFREE_SKB(pMsg); } @@ -3049,141 +2369,6 @@ unsigned long Flags; } /* ClearTxRing */ -#if 0 -/***************************************************************************** - * - * SetQueueSizes - configure the sizes of rx and tx queues - * - * Description: - * This function assigns the sizes for active and passive port - * to the appropriate HWinit structure variables. - * The passive port(s) get standard values, all remaining RAM - * is given to the active port. - * The queue sizes are in kbyte and must be multiple of 8. - * The limits for the number of buffers filled into the rx rings - * is also set in this routine. - * - * Returns: - * none - */ -static void SetQueueSizes( -SK_AC *pAC) /* pointer to the adapter context */ -{ -int StandbyRam; /* adapter RAM used for a standby port */ -int RemainingRam; /* adapter RAM available for the active port */ -int RxRam; /* RAM used for the active port receive queue */ -int i; /* loop counter */ - -if (pAC->RlmtNets == 1) { - StandbyRam = SK_RLMT_STANDBY_QRXSIZE + SK_RLMT_STANDBY_QXASIZE + - SK_RLMT_STANDBY_QXSSIZE; - RemainingRam = pAC->GIni.GIRamSize - - (pAC->GIni.GIMacsFound-1) * StandbyRam; - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - pAC->GIni.GP[i].PRxQSize = SK_RLMT_STANDBY_QRXSIZE; - pAC->GIni.GP[i].PXSQSize = SK_RLMT_STANDBY_QXSSIZE; - pAC->GIni.GP[i].PXAQSize = SK_RLMT_STANDBY_QXASIZE; - } - RxRam = (RemainingRam * 8 / 10) & ~7; - pAC->GIni.GP[pAC->ActivePort].PRxQSize = RxRam; - pAC->GIni.GP[pAC->ActivePort].PXSQSize = 0; - pAC->GIni.GP[pAC->ActivePort].PXAQSize = - (RemainingRam - RxRam) & ~7; - pAC->RxQueueSize = RxRam; - pAC->TxSQueueSize = 0; - pAC->TxAQueueSize = (RemainingRam - RxRam) & ~7; - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("queue sizes settings - rx:%d txA:%d txS:%d\n", - pAC->RxQueueSize,pAC->TxAQueueSize, pAC->TxSQueueSize)); -} else { - RemainingRam = pAC->GIni.GIRamSize/pAC->GIni.GIMacsFound; - RxRam = (RemainingRam * 8 / 10) & ~7; - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - pAC->GIni.GP[i].PRxQSize = RxRam; - pAC->GIni.GP[i].PXSQSize = 0; - pAC->GIni.GP[i].PXAQSize = (RemainingRam - RxRam) & ~7; - } - - pAC->RxQueueSize = RxRam; - pAC->TxSQueueSize = 0; - pAC->TxAQueueSize = (RemainingRam - RxRam) & ~7; -} - for (i=0; i<SK_MAX_MACS; i++) { - pAC->RxPort[i].RxFillLimit = pAC->RxDescrPerRing; - } - - if (pAC->RlmtNets == 2) { - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - pAC->RxPort[i].RxFillLimit = pAC->RxDescrPerRing - 100; - } - } else { - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - pAC->RxPort[i].RxFillLimit = pAC->RxDescrPerRing - 100; - } - /* - * Do not set the Limit to 0, because this could cause - * wrap around with ReQueue'ed buffers (a buffer could - * be requeued in the same position, made accessable to - * the hardware, and the hardware could change its - * contents! - */ - pAC->RxPort[pAC->ActivePort].RxFillLimit = 1; - } - -#ifdef DEBUG - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_TX_PROGRESS, - ("i: %d, RxQSize: %d, PXSQsize: %d, PXAQSize: %d\n", - i, - pAC->GIni.GP[i].PRxQSize, - pAC->GIni.GP[i].PXSQSize, - pAC->GIni.GP[i].PXAQSize)); - } -#endif -} /* SetQueueSizes */ - - -/***************************************************************************** - * - * SkGeSetMacAddr - Set the hardware MAC address - * - * Description: - * This function sets the MAC address used by the adapter. - * - * Returns: - * 0, if everything is ok - * !=0, on error - */ -static int SkGeSetMacAddr(struct SK_NET_DEVICE *dev, void *p) -{ - -DEV_NET *pNet = (DEV_NET*) dev->priv; -SK_AC *pAC = pNet->pAC; - -struct sockaddr *addr = p; -unsigned long Flags; - - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("SkGeSetMacAddr starts now...\n")); - if(netif_running(dev)) - return -EBUSY; - - memcpy(dev->dev_addr, addr->sa_data,dev->addr_len); - - spin_lock_irqsave(&pAC->SlowPathLock, Flags); - - if (pAC->RlmtNets == 2) - SkAddrOverride(pAC, pAC->IoBase, pNet->NetNr, - (SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS); - else - SkAddrOverride(pAC, pAC->IoBase, pAC->ActivePort, - (SK_MAC_ADDR*)dev->dev_addr, SK_ADDR_VIRTUAL_ADDRESS); - - - spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - return 0; -} /* SkGeSetMacAddr */ -#endif /***************************************************************************** @@ -3200,475 +2385,6 @@ unsigned long Flags; * 0, if everything is ok * !=0, on error */ -#if 0 -static void SkGeSetRxMode(struct SK_NET_DEVICE *dev) -{ - -DEV_NET *pNet; -SK_AC *pAC; - -struct dev_mc_list *pMcList; -int i; -int PortIdx; -unsigned long Flags; - - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("SkGeSetRxMode starts now... ")); - - pNet = (DEV_NET*) dev->priv; - pAC = pNet->pAC; - if (pAC->RlmtNets == 1) - PortIdx = pAC->ActivePort; - else - PortIdx = pNet->NetNr; - - spin_lock_irqsave(&pAC->SlowPathLock, Flags); - if (dev->flags & IFF_PROMISC) { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("PROMISCUOUS mode\n")); - SkAddrPromiscuousChange(pAC, pAC->IoBase, PortIdx, - SK_PROM_MODE_LLC); - } else if (dev->flags & IFF_ALLMULTI) { - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("ALLMULTI mode\n")); - SkAddrPromiscuousChange(pAC, pAC->IoBase, PortIdx, - SK_PROM_MODE_ALL_MC); - } else { - SkAddrPromiscuousChange(pAC, pAC->IoBase, PortIdx, - SK_PROM_MODE_NONE); - SkAddrMcClear(pAC, pAC->IoBase, PortIdx, 0); - - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("Number of MC entries: %d ", dev->mc_count)); - - pMcList = dev->mc_list; - for (i=0; i<dev->mc_count; i++, pMcList = pMcList->next) { - SkAddrMcAdd(pAC, pAC->IoBase, PortIdx, - (SK_MAC_ADDR*)pMcList->dmi_addr, 0); - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_MCA, - ("%02x:%02x:%02x:%02x:%02x:%02x\n", - pMcList->dmi_addr[0], - pMcList->dmi_addr[1], - pMcList->dmi_addr[2], - pMcList->dmi_addr[3], - pMcList->dmi_addr[4], - pMcList->dmi_addr[5])); - } - SkAddrMcUpdate(pAC, pAC->IoBase, PortIdx); - } - spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - - return; -} /* SkGeSetRxMode */ - - -/***************************************************************************** - * - * SkGeChangeMtu - set the MTU to another value - * - * Description: - * This function sets is called whenever the MTU size is changed - * (ifconfig mtu xxx dev ethX). If the MTU is bigger than standard - * ethernet MTU size, long frame support is activated. - * - * Returns: - * 0, if everything is ok - * !=0, on error - */ -static int SkGeChangeMtu(struct SK_NET_DEVICE *dev, int NewMtu) -{ -DEV_NET *pNet; -DEV_NET *pOtherNet; -SK_AC *pAC; -unsigned long Flags; -int i; -SK_EVPARA EvPara; - - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("SkGeChangeMtu starts now...\n")); - - pNet = (DEV_NET*) dev->priv; - pAC = pNet->pAC; - - if ((NewMtu < 68) || (NewMtu > SK_JUMBO_MTU)) { - return -EINVAL; - } - - if(pAC->BoardLevel != 2) { - return -EINVAL; - } - - pNet->Mtu = NewMtu; - pOtherNet = (DEV_NET*)pAC->dev[1 - pNet->NetNr]->priv; - if ((pOtherNet->Mtu > 1500) && (NewMtu <= 1500) && (pOtherNet->Up==1)) { - return(0); - } - - EvPara.Para32[0] = pNet->NetNr; - EvPara.Para32[1] = -1; - - pAC->RxBufSize = NewMtu + 32; - dev->mtu = NewMtu; - - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("New MTU: %d\n", NewMtu)); - - /* prevent reconfiguration while changing the MTU */ - - /* disable interrupts */ - SK_OUT32(pAC->IoBase, B0_IMSK, 0); - spin_lock_irqsave(&pAC->SlowPathLock, Flags); - - /* Found more than one port */ - if ((pAC->GIni.GIMacsFound == 2 ) && - (pAC->RlmtNets == 2)) { - /* Stop both ports */ - EvPara.Para32[0] = 0; - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); - EvPara.Para32[0] = 1; - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); - } else { - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_STOP, EvPara); - } - - SkEventDispatcher(pAC, pAC->IoBase); - - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - spin_lock_irqsave( - &pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock, Flags); - netif_stop_queue(pAC->dev[i]); - - } - - /* - * adjust number of rx buffers allocated - */ - if (NewMtu > 1500) { - /* use less rx buffers */ - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - /* Found more than one port */ - if ((pAC->GIni.GIMacsFound == 2 ) && - (pAC->RlmtNets == 2)) { - pAC->RxPort[i].RxFillLimit = - pAC->RxDescrPerRing - 100; - } else { - if (i == pAC->ActivePort) - pAC->RxPort[i].RxFillLimit = - pAC->RxDescrPerRing - 100; - else - pAC->RxPort[i].RxFillLimit = - pAC->RxDescrPerRing - 10; - } - } - } - else { - /* use normal amount of rx buffers */ - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - /* Found more than one port */ - if ((pAC->GIni.GIMacsFound == 2 ) && - (pAC->RlmtNets == 2)) { - pAC->RxPort[i].RxFillLimit = 1; - } else { - if (i == pAC->ActivePort) - pAC->RxPort[i].RxFillLimit = 1; - else - pAC->RxPort[i].RxFillLimit = - pAC->RxDescrPerRing - 100; - } - } - } - - SkGeDeInit(pAC, pAC->IoBase); - - /* - * enable/disable hardware support for long frames - */ - if (NewMtu > 1500) { -/* pAC->JumboActivated = SK_TRUE; /#* is never set back !!! */ - pAC->GIni.GIPortUsage = SK_JUMBO_LINK; - } - else { - if ((pAC->GIni.GIMacsFound == 2 ) && - (pAC->RlmtNets == 2)) { - pAC->GIni.GIPortUsage = SK_MUL_LINK; - } else { - pAC->GIni.GIPortUsage = SK_RED_LINK; - } - } - - SkGeInit( pAC, pAC->IoBase, 1); - SkI2cInit( pAC, pAC->IoBase, 1); - SkEventInit(pAC, pAC->IoBase, 1); - SkPnmiInit( pAC, pAC->IoBase, 1); - SkAddrInit( pAC, pAC->IoBase, 1); - SkRlmtInit( pAC, pAC->IoBase, 1); - SkTimerInit(pAC, pAC->IoBase, 1); - - /* - * tschilling: - * Speed and others are set back to default in level 1 init! - */ - GetConfiguration(pAC); - - SkGeInit( pAC, pAC->IoBase, 2); - SkI2cInit( pAC, pAC->IoBase, 2); - SkEventInit(pAC, pAC->IoBase, 2); - SkPnmiInit( pAC, pAC->IoBase, 2); - SkAddrInit( pAC, pAC->IoBase, 2); - SkRlmtInit( pAC, pAC->IoBase, 2); - SkTimerInit(pAC, pAC->IoBase, 2); - - /* - * clear and reinit the rx rings here - */ - for (i=0; i<pAC->GIni.GIMacsFound; i++) { - ReceiveIrq(pAC, &pAC->RxPort[i], SK_TRUE); - ClearRxRing(pAC, &pAC->RxPort[i]); - FillRxRing(pAC, &pAC->RxPort[i]); - - /* Enable transmit descriptor polling. */ - SkGePollTxD(pAC, pAC->IoBase, i, SK_TRUE); - FillRxRing(pAC, &pAC->RxPort[i]); - }; - - SkGeYellowLED(pAC, pAC->IoBase, 1); - -#ifdef USE_INT_MOD - { - unsigned long ModBase; - ModBase = 53125000 / INTS_PER_SEC; - SK_OUT32(pAC->IoBase, B2_IRQM_INI, ModBase); - SK_OUT32(pAC->IoBase, B2_IRQM_MSK, IRQ_MOD_MASK); - SK_OUT32(pAC->IoBase, B2_IRQM_CTRL, TIM_START); - } -#endif - - netif_start_queue(pAC->dev[pNet->PortNr]); - for (i=pAC->GIni.GIMacsFound-1; i>=0; i--) { - spin_unlock(&pAC->TxPort[i][TX_PRIO_LOW].TxDesRingLock); - } - - /* enable Interrupts */ - SK_OUT32(pAC->IoBase, B0_IMSK, IRQ_MASK); - SK_OUT32(pAC->IoBase, B0_HWE_IMSK, IRQ_HWE_MASK); - - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); - SkEventDispatcher(pAC, pAC->IoBase); - - /* Found more than one port */ - if ((pAC->GIni.GIMacsFound == 2 ) && - (pAC->RlmtNets == 2)) { - /* Start both ports */ - EvPara.Para32[0] = pAC->RlmtNets; - EvPara.Para32[1] = -1; - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_SET_NETS, - EvPara); - - - EvPara.Para32[1] = -1; - EvPara.Para32[0] = pNet->PortNr; - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); - - if (pOtherNet->Up) { - EvPara.Para32[0] = pOtherNet->PortNr; - SkEventQueue(pAC, SKGE_RLMT, - SK_RLMT_START, EvPara); - } - } else { - SkEventQueue(pAC, SKGE_RLMT, SK_RLMT_START, EvPara); - } - - SkEventDispatcher(pAC, pAC->IoBase); - spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - - return 0; -} /* SkGeChangeMtu */ - - -/***************************************************************************** - * - * SkGeStats - return ethernet device statistics - * - * Description: - * This function return statistic data about the ethernet device - * to the operating system. - * - * Returns: - * pointer to the statistic structure. - */ -static struct net_device_stats *SkGeStats(struct SK_NET_DEVICE *dev) -{ -DEV_NET *pNet = (DEV_NET*) dev->priv; -SK_AC *pAC = pNet->pAC; -SK_PNMI_STRUCT_DATA *pPnmiStruct; /* structure for all Pnmi-Data */ -SK_PNMI_STAT *pPnmiStat; /* pointer to virtual XMAC stat. data */ -SK_PNMI_CONF *pPnmiConf; /* pointer to virtual link config. */ -unsigned int Size; /* size of pnmi struct */ -unsigned long Flags; /* for spin lock */ - - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("SkGeStats starts now...\n")); - pPnmiStruct = &pAC->PnmiStruct; - memset(pPnmiStruct, 0, sizeof(SK_PNMI_STRUCT_DATA)); - spin_lock_irqsave(&pAC->SlowPathLock, Flags); - Size = SK_PNMI_STRUCT_SIZE; - SkPnmiGetStruct(pAC, pAC->IoBase, pPnmiStruct, &Size, pNet->NetNr); - spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - pPnmiStat = &pPnmiStruct->Stat[0]; - pPnmiConf = &pPnmiStruct->Conf[0]; - - pAC->stats.rx_packets = (SK_U32) pPnmiStruct->RxDeliveredCts & 0xFFFFFFFF; - pAC->stats.tx_packets = (SK_U32) pPnmiStat->StatTxOkCts & 0xFFFFFFFF; - pAC->stats.rx_bytes = (SK_U32) pPnmiStruct->RxOctetsDeliveredCts; - pAC->stats.tx_bytes = (SK_U32) pPnmiStat->StatTxOctetsOkCts; - - if (pNet->Mtu <= 1500) { - pAC->stats.rx_errors = (SK_U32) pPnmiStruct->InErrorsCts & 0xFFFFFFFF; - } else { - pAC->stats.rx_errors = (SK_U32) ((pPnmiStruct->InErrorsCts - - pPnmiStat->StatRxTooLongCts) & 0xFFFFFFFF); - } - - - if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && pAC->HWRevision < 12) - pAC->stats.rx_errors = pAC->stats.rx_errors - pPnmiStat->StatRxShortsCts; - - pAC->stats.tx_errors = (SK_U32) pPnmiStat->StatTxSingleCollisionCts & 0xFFFFFFFF; - pAC->stats.rx_dropped = (SK_U32) pPnmiStruct->RxNoBufCts & 0xFFFFFFFF; - pAC->stats.tx_dropped = (SK_U32) pPnmiStruct->TxNoBufCts & 0xFFFFFFFF; - pAC->stats.multicast = (SK_U32) pPnmiStat->StatRxMulticastOkCts & 0xFFFFFFFF; - pAC->stats.collisions = (SK_U32) pPnmiStat->StatTxSingleCollisionCts & 0xFFFFFFFF; - - /* detailed rx_errors: */ - pAC->stats.rx_length_errors = (SK_U32) pPnmiStat->StatRxRuntCts & 0xFFFFFFFF; - pAC->stats.rx_over_errors = (SK_U32) pPnmiStat->StatRxFifoOverflowCts & 0xFFFFFFFF; - pAC->stats.rx_crc_errors = (SK_U32) pPnmiStat->StatRxFcsCts & 0xFFFFFFFF; - pAC->stats.rx_frame_errors = (SK_U32) pPnmiStat->StatRxFramingCts & 0xFFFFFFFF; - pAC->stats.rx_fifo_errors = (SK_U32) pPnmiStat->StatRxFifoOverflowCts & 0xFFFFFFFF; - pAC->stats.rx_missed_errors = (SK_U32) pPnmiStat->StatRxMissedCts & 0xFFFFFFFF; - - /* detailed tx_errors */ - pAC->stats.tx_aborted_errors = (SK_U32) 0; - pAC->stats.tx_carrier_errors = (SK_U32) pPnmiStat->StatTxCarrierCts & 0xFFFFFFFF; - pAC->stats.tx_fifo_errors = (SK_U32) pPnmiStat->StatTxFifoUnderrunCts & 0xFFFFFFFF; - pAC->stats.tx_heartbeat_errors = (SK_U32) pPnmiStat->StatTxCarrierCts & 0xFFFFFFFF; - pAC->stats.tx_window_errors = (SK_U32) 0; - - return(&pAC->stats); -} /* SkGeStats */ - - -/***************************************************************************** - * - * SkGeIoctl - IO-control function - * - * Description: - * This function is called if an ioctl is issued on the device. - * There are three subfunction for reading, writing and test-writing - * the private MIB data structure (usefull for SysKonnect-internal tools). - * - * Returns: - * 0, if everything is ok - * !=0, on error - */ -static int SkGeIoctl(struct SK_NET_DEVICE *dev, struct ifreq *rq, int cmd) -{ -DEV_NET *pNet; -SK_AC *pAC; - -SK_GE_IOCTL Ioctl; -unsigned int Err = 0; -int Size; - - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("SkGeIoctl starts now...\n")); - - pNet = (DEV_NET*) dev->priv; - pAC = pNet->pAC; - - if(copy_from_user(&Ioctl, rq->ifr_data, sizeof(SK_GE_IOCTL))) { - return -EFAULT; - } - - switch(cmd) { - case SK_IOCTL_SETMIB: - case SK_IOCTL_PRESETMIB: - if (!capable(CAP_NET_ADMIN)) return -EPERM; - case SK_IOCTL_GETMIB: - if(copy_from_user(&pAC->PnmiStruct, Ioctl.pData, - Ioctl.Len<sizeof(pAC->PnmiStruct)? - Ioctl.Len : sizeof(pAC->PnmiStruct))) { - return -EFAULT; - } - Size = SkGeIocMib(pNet, Ioctl.Len, cmd); - if(copy_to_user(Ioctl.pData, &pAC->PnmiStruct, - Ioctl.Len<Size? Ioctl.Len : Size)) { - return -EFAULT; - } - Ioctl.Len = Size; - if(copy_to_user(rq->ifr_data, &Ioctl, sizeof(SK_GE_IOCTL))) { - return -EFAULT; - } - break; - default: - Err = -EOPNOTSUPP; - } - return(Err); -} /* SkGeIoctl */ - - -/***************************************************************************** - * - * SkGeIocMib - handle a GetMib, SetMib- or PresetMib-ioctl message - * - * Description: - * This function reads/writes the MIB data using PNMI (Private Network - * Management Interface). - * The destination for the data must be provided with the - * ioctl call and is given to the driver in the form of - * a user space address. - * Copying from the user-provided data area into kernel messages - * and back is done by copy_from_user and copy_to_user calls in - * SkGeIoctl. - * - * Returns: - * returned size from PNMI call - */ -static int SkGeIocMib( -DEV_NET *pNet, /* pointer to the adapter context */ -unsigned int Size, /* length of ioctl data */ -int mode) /* flag for set/preset */ -{ -unsigned long Flags; /* for spin lock */ -SK_AC *pAC; - - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("SkGeIocMib starts now...\n")); - pAC = pNet->pAC; - /* access MIB */ - spin_lock_irqsave(&pAC->SlowPathLock, Flags); - switch(mode) { - case SK_IOCTL_GETMIB: - SkPnmiGetStruct(pAC, pAC->IoBase, &pAC->PnmiStruct, &Size, - pNet->NetNr); - break; - case SK_IOCTL_PRESETMIB: - SkPnmiPreSetStruct(pAC, pAC->IoBase, &pAC->PnmiStruct, &Size, - pNet->NetNr); - break; - case SK_IOCTL_SETMIB: - SkPnmiSetStruct(pAC, pAC->IoBase, &pAC->PnmiStruct, &Size, - pNet->NetNr); - break; - default: - break; - } - spin_unlock_irqrestore(&pAC->SlowPathLock, Flags); - SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_ENTRY, - ("MIB data access succeeded\n")); - return (Size); -} /* SkGeIocMib */ -#endif /***************************************************************************** @@ -4217,11 +2933,7 @@ SK_MBUF *pNextMbuf; */ SK_U64 SkOsGetTime(SK_AC *pAC) { -#if 0 - return jiffies; -#else return get_timer(0); -#endif } /* SkOsGetTime */ @@ -4385,9 +3097,6 @@ struct sk_buff *pMsg; /* pointer to a message block */ int FromPort; /* the port from which we switch away */ int ToPort; /* the port we switch to */ SK_EVPARA NewPara; /* parameter for further events */ -#if 0 -int Stat; -#endif unsigned long Flags; SK_BOOL DualNet; @@ -4422,9 +3131,6 @@ SK_BOOL DualNet; &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, Flags); SkGeStopPort(pAC, IoC, FromPort, SK_STOP_ALL, SK_HARD_RST); -#if 0 - pAC->dev[Param.Para32[0]]->flags &= ~IFF_RUNNING; -#endif spin_unlock_irqrestore( &pAC->TxPort[FromPort][TX_PRIO_LOW].TxDesRingLock, Flags); @@ -4539,9 +3245,6 @@ SK_BOOL DualNet; } /* Inform the world that link protocol is up. */ -#if 0 - pAC->dev[Param.Para32[0]]->flags |= IFF_RUNNING; -#endif break; case SK_DRV_NET_DOWN: /* SK_U32 Reason */ @@ -4551,9 +3254,6 @@ SK_BOOL DualNet; #ifdef SK98_INFO printk("%s: network connection down\n", pAC->dev[Param.Para32[1]]->name); #endif -#if 0 - pAC->dev[Param.Para32[1]]->flags &= ~IFF_RUNNING; -#endif break; case SK_DRV_SWITCH_HARD: /* SK_U32 FromPortIdx SK_U32 ToPortIdx */ SK_DBG_MSG(NULL, SK_DBGMOD_DRV, SK_DBGCAT_DRV_EVENT, @@ -4596,9 +3296,6 @@ SK_BOOL DualNet; spin_lock_irqsave( &pAC->TxPort[ToPort][TX_PRIO_LOW].TxDesRingLock, Flags); pAC->ActivePort = ToPort; -#if 0 - SetQueueSizes(pAC); -#else /* tschilling: New common function with minimum size check. */ DualNet = SK_FALSE; if (pAC->RlmtNets == 2) { @@ -4617,7 +3314,6 @@ SK_BOOL DualNet; printk("SkGeInitAssignRamToQueues failed.\n"); break; } -#endif /* tschilling: Handling of return values inserted. */ if (SkGeInitPort(pAC, IoC, FromPort) || SkGeInitPort(pAC, IoC, ToPort)) { diff --git a/drivers/sk98lin/ski2c.c b/drivers/sk98lin/ski2c.c index 2ab635a229..2186226fce 100644 --- a/drivers/sk98lin/ski2c.c +++ b/drivers/sk98lin/ski2c.c @@ -1321,44 +1321,6 @@ SK_SENSOR *pSen) } } -#if 0 - /* Dynamic thresholds also for VAUX of LM80 sensor */ - if (pSen->SenInit == SK_SEN_DYN_INIT_VAUX) { - - pSen->SenInit = SK_SEN_DYN_INIT_NONE; - - /* 3.3V VAUX Voltage */ - if (pSen->SenValue > SK_SEN_VAUX_RANGE_LIMITER) { - pSen->SenThreWarnLow = SK_SEN_VAUX_3V3_LOW_WARN; - pSen->SenThreErrLow = SK_SEN_VAUX_3V3_LOW_ERR; - } - /* 0V VAUX Voltage */ - else { - pSen->SenThreWarnHigh = SK_SEN_VAUX_0V_WARN_ERR; - pSen->SenThreErrHigh = SK_SEN_VAUX_0V_WARN_ERR; - } - } - - /* - * Check initialization state: - * The VIO Thresholds need adaption - */ - if (!pSen->SenInit && pSen->SenReg == LM80_VT1_IN && - pSen->SenValue > SK_SEN_WARNLOW2C && - pSen->SenValue < SK_SEN_WARNHIGH2) { - pSen->SenThreErrLow = SK_SEN_ERRLOW2C; - pSen->SenThreWarnLow = SK_SEN_WARNLOW2C; - pSen->SenInit = SK_TRUE; - } - - if (!pSen->SenInit && pSen->SenReg == LM80_VT1_IN && - pSen->SenValue > SK_SEN_WARNLOW2 && - pSen->SenValue < SK_SEN_WARNHIGH2C) { - pSen->SenThreErrHigh = SK_SEN_ERRHIGH2C; - pSen->SenThreWarnHigh = SK_SEN_WARNHIGH2C; - pSen->SenInit = SK_TRUE; - } -#endif if (pSen->SenInit != SK_SEN_DYN_INIT_NONE) { SK_ERR_LOG(pAC, SK_ERRCL_HW, SKERR_I2C_E013, SKERR_I2C_E013MSG); diff --git a/drivers/sk98lin/skproc.c b/drivers/sk98lin/skproc.c index 4e340730e5..49402e2d84 100644 --- a/drivers/sk98lin/skproc.c +++ b/drivers/sk98lin/skproc.c @@ -239,14 +239,6 @@ void *data) "Received packets %s\n", SkNumber(test_buf, pPnmiStat->StatRxOkCts, 10,0,-1,0)); -#if 0 - if (pAC->GIni.GP[0].PhyType == SK_PHY_XMAC && - pAC->HWRevision < 12) { - pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - - pPnmiStat->StatRxShortsCts; - pPnmiStat->StatRxShortsCts = 0; - } -#endif if (pNet->Mtu > 1500) pPnmiStruct->InErrorsCts = pPnmiStruct->InErrorsCts - pPnmiStat->StatRxTooLongCts; @@ -421,14 +413,6 @@ static long SkDoDiv (long long Dividend, int Divisor, long long *pErg) } -#if 0 -#define do_div(n,base) ({ \ -long long __res; \ -__res = ((unsigned long long) n) % (unsigned) base; \ -n = ((unsigned long long) n) / (unsigned) base; \ -__res; }) - -#endif /***************************************************************************** diff --git a/drivers/sk98lin/skrlmt.c b/drivers/sk98lin/skrlmt.c index f8a3b41f0f..5fb5d79504 100644 --- a/drivers/sk98lin/skrlmt.c +++ b/drivers/sk98lin/skrlmt.c @@ -1249,10 +1249,6 @@ SK_MBUF *pMb) /* Received packet */ switch (PacketType) { case SK_PACKET_ANNOUNCE: /* Not yet used. */ -#if 0 - /* Build the check chain. */ - SkRlmtBuildCheckChain(pAC); -#endif /* 0 */ SK_DBG_MSG(pAC, SK_DBGMOD_RLMT, SK_DBGCAT_RX, ("SkRlmtPacketReceive: Announce.\n")) @@ -1876,12 +1872,6 @@ SK_U32 NetIdx) /* Net index */ PortFound = SK_FALSE; pAC->Rlmt.CheckSwitch = SK_FALSE; -#if 0 /* RW 2001/10/18 - active port becomes always prefered one */ - if (pAC->Rlmt.Net[NetIdx].Preference == 0xFFFFFFFF) { /* Automatic */ - /* disable auto-fail back */ - PrefPort = Active; - } -#endif if (pAC->Rlmt.Net[NetIdx].LinksUp == 0) { /* Last link went down - shut down the net. */ @@ -2823,12 +2813,6 @@ SK_EVPARA Para) /* SK_U32 NetNumber; SK_U32 -1 */ return; } -#if 0 - pAC->Rlmt.SwitchCheckCounter--; - if (pAC->Rlmt.SwitchCheckCounter == 0) { - pAC->Rlmt.SwitchCheckCounter; - } -#endif /* 0 */ NewTimeout = SK_RLMT_DEF_TO_VAL; for (i = 0; i < pAC->Rlmt.Net[Para.Para32[0]].NumPorts; i++) { diff --git a/drivers/sk98lin/skvpd.c b/drivers/sk98lin/skvpd.c index 3b81e67df8..7ae62e3b41 100644 --- a/drivers/sk98lin/skvpd.c +++ b/drivers/sk98lin/skvpd.c @@ -275,64 +275,6 @@ int addr) /* VPD address */ #endif /* SKDIAG */ -#if 0 - -/* - Write the dword 'data' at address 'addr' into the VPD EEPROM, and - verify that the data is written. - - Needed Time: - -. MIN MAX -. ------------------------------------------------------------------- -. write 1.8 ms 3.6 ms -. internal write cyles 0.7 ms 7.0 ms -. ------------------------------------------------------------------- -. over all program time 2.5 ms 10.6 ms -. read 1.3 ms 2.6 ms -. ------------------------------------------------------------------- -. over all 3.8 ms 13.2 ms -. - - - Returns 0: success - 1: error, I2C transfer does not terminate - 2: error, data verify error - - */ -static int VpdWriteDWord( -SK_AC *pAC, /* pAC pointer */ -SK_IOC IoC, /* IO Context */ -int addr, /* VPD address */ -SK_U32 data) /* VPD data to write */ -{ - /* start VPD write */ - /* Don't swap here, it's a data stream of bytes */ - SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_CTRL, - ("VPD write dword at addr 0x%x, data = 0x%x\n",addr,data)); - VPD_OUT32(pAC, IoC, PCI_VPD_DAT_REG, (SK_U32)data); - /* But do it here */ - addr |= VPD_WRITE; - - VPD_OUT16(pAC, IoC, PCI_VPD_ADR_REG, (SK_U16)(addr | VPD_WRITE)); - - /* this may take up to 10,6 ms */ - if (VpdWait(pAC, IoC, VPD_WRITE)) { - SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR, - ("Write Timed Out\n")); - return(1); - }; - - /* verify data */ - if (VpdReadDWord(pAC, IoC, addr) != data) { - SK_DBG_MSG(pAC, SK_DBGMOD_VPD, SK_DBGCAT_ERR | SK_DBGCAT_FATAL, - ("Data Verify Error\n")); - return(2); - } - return(0); -} /* VpdWriteDWord */ - -#endif /* 0 */ /* * Read one Stream of 'len' bytes of VPD data, starting at 'addr' from diff --git a/drivers/sk98lin/skxmac2.c b/drivers/sk98lin/skxmac2.c index e6b5a95d4a..57601d5d52 100644 --- a/drivers/sk98lin/skxmac2.c +++ b/drivers/sk98lin/skxmac2.c @@ -1564,11 +1564,6 @@ int Port) /* Port Index (MAC_1 + n) */ */ SkMacInitPhy(pAC, IoC, Port, SK_FALSE); -#if 0 - /* temp. code: enable signal detect */ - /* WARNING: do not override GMII setting above */ - XM_OUT16(pAC, Port, XM_HW_CFG, XM_HW_COM4SIG); -#endif } /* @@ -2525,18 +2520,6 @@ SK_BOOL DoLoop) /* Should a Phy LoopBack be set-up? */ /* Program PHY register 16 as 16'h0400 to force link good */ SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, PHY_M_PC_FL_GOOD); -#if 0 - if (pPrt->PLinkSpeed != SK_LSPEED_AUTO) { - /* Write Ext. PHY Specific Control */ - SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_EXT_CTRL, - (SK_U16)((pPrt->PLinkSpeed + 2) << 4)); - } - } - else if (pPrt->PLinkSpeed == SK_LSPEED_10MBPS) { - /* Write PHY Specific Control */ - SkGmPhyWrite(pAC, IoC, Port, PHY_MARV_PHY_CTRL, PHY_M_PC_EN_DET_MSK); - } -#endif /* 0 */ } /* Write to the PHY Control register */ @@ -2974,10 +2957,6 @@ int Port) /* Port Index (MAC_1 + n) */ SK_U16 LPAb; /* Link Partner Ability */ SK_U16 AuxStat; /* Auxiliary Status */ -#if 0 -01-Sep-2000 RA;:;: - SK_U16 ResAb; /* Resolved Ability */ -#endif /* 0 */ SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, ("AutoNegDoneBcom, Port %d\n", Port)); @@ -2985,10 +2964,6 @@ int Port) /* Port Index (MAC_1 + n) */ /* Get PHY parameters */ SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUNE_LP, &LPAb); -#if 0 -01-Sep-2000 RA;:;: - SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_1000T_STAT, &ResAb); -#endif /* 0 */ SkXmPhyRead(pAC, IoC, Port, PHY_BCOM_AUX_STAT, &AuxStat); @@ -3015,20 +2990,6 @@ int Port) /* Port Index (MAC_1 + n) */ return(SK_AND_DUP_CAP); } -#if 0 -01-Sep-2000 RA;:;: - /* Check Master/Slave resolution */ - if ((ResAb & PHY_B_1000S_MSF) != 0) { - SK_DBG_MSG(pAC, SK_DBGMOD_HWM, SK_DBGCAT_CTRL, - ("Master/Slave Fault Port %d\n", Port)); - pPrt->PAutoNegFail = SK_TRUE; - pPrt->PMSStatus = SK_MS_STAT_FAULT; - return(SK_AND_OTHER); - } - - pPrt->PMSStatus = ((ResAb & PHY_B_1000S_MSR) != 0) ? - SK_MS_STAT_MASTER : SK_MS_STAT_SLAVE; -#endif /* 0 */ /* Check PAUSE mismatch */ /* We are using IEEE 802.3z/D5.0 Table 37-4 */ diff --git a/drivers/smc91111.c b/drivers/smc91111.c index f91e4b9843..d47588c4fa 100644 --- a/drivers/smc91111.c +++ b/drivers/smc91111.c @@ -320,23 +320,6 @@ void smc_set_mac_addr(const unsigned char *addr) { * mac address, call smc_get_mac_addr as a part of the board initialization. */ -#if 0 -void smc_get_macaddr( byte *addr ) { - /* MAC ADDRESS AT FLASHBLOCK 1 / OFFSET 0x10 */ - unsigned char *dnp1110_mac = (unsigned char *) (0xE8000000 + 0x20010); - int i; - - - for (i=0; i<6; i++) { - addr[0] = *(dnp1110_mac+0); - addr[1] = *(dnp1110_mac+1); - addr[2] = *(dnp1110_mac+2); - addr[3] = *(dnp1110_mac+3); - addr[4] = *(dnp1110_mac+4); - addr[5] = *(dnp1110_mac+5); - } -} -#endif /* 0 */ /*********************************************** * Show available memory * @@ -1005,61 +988,6 @@ static int smc_close() } -#if 0 -/*------------------------------------------------------------ - . Modify a bit in the LAN91C111 register set - .-------------------------------------------------------------*/ -static word smc_modify_regbit(int bank, int ioaddr, int reg, - unsigned int bit, int val) -{ - word regval; - - SMC_SELECT_BANK( bank ); - - regval = SMC_inw( reg ); - if (val) - regval |= bit; - else - regval &= ~bit; - - SMC_outw( regval, 0 ); - return(regval); -} - - -/*------------------------------------------------------------ - . Retrieve a bit in the LAN91C111 register set - .-------------------------------------------------------------*/ -static int smc_get_regbit(int bank, int ioaddr, int reg, unsigned int bit) -{ - SMC_SELECT_BANK( bank ); - if ( SMC_inw( reg ) & bit) - return(1); - else - return(0); -} - - -/*------------------------------------------------------------ - . Modify a LAN91C111 register (word access only) - .-------------------------------------------------------------*/ -static void smc_modify_reg(int bank, int ioaddr, int reg, word val) -{ - SMC_SELECT_BANK( bank ); - SMC_outw( val, reg ); -} - - -/*------------------------------------------------------------ - . Retrieve a LAN91C111 register (word access only) - .-------------------------------------------------------------*/ -static int smc_get_reg(int bank, int ioaddr, int reg) -{ - SMC_SELECT_BANK( bank ); - return(SMC_inw( reg )); -} - -#endif /* 0 */ /*---PHY CONTROL AND CONFIGURATION----------------------------------------- */ diff --git a/drivers/smc91111.h b/drivers/smc91111.h index d03cbc320b..e31a2a5458 100644 --- a/drivers/smc91111.h +++ b/drivers/smc91111.h @@ -205,9 +205,6 @@ typedef unsigned long int dword; __w |= ((r)&1) ? __d<<8 : __d; \ SMC_outw(__w,(r)&~1); \ }) -#if 0 -#define SMC_outsw(r,b,l) outsw(SMC_BASE_ADDRESS+(r), (b), (l)) -#else #define SMC_outsw(r,b,l) ({ int __i; \ word *__b2; \ __b2 = (word *) b; \ @@ -215,11 +212,7 @@ typedef unsigned long int dword; SMC_outw( *(__b2 + __i), r); \ } \ }) -#endif -#if 0 -#define SMC_insw(r,b,l) insw(SMC_BASE_ADDRESS+(r), (b), (l)) -#else #define SMC_insw(r,b,l) ({ int __i ; \ word *__b2; \ __b2 = (word *) b; \ @@ -228,7 +221,6 @@ typedef unsigned long int dword; SMC_inw(0); \ }; \ }) -#endif #endif /* CONFIG_SMC_USE_IOFUNCS */ @@ -545,19 +537,6 @@ typedef unsigned long int dword; #define CHIP_91100FD 8 #define CHIP_91111FD 9 -#if 0 -static const char * chip_ids[ 15 ] = { - NULL, NULL, NULL, - /* 3 */ "SMC91C90/91C92", - /* 4 */ "SMC91C94", - /* 5 */ "SMC91C95", - /* 6 */ "SMC91C96", - /* 7 */ "SMC91C100", - /* 8 */ "SMC91C100FD", - /* 9 */ "SMC91C111", - NULL, NULL, - NULL, NULL, NULL}; -#endif /* . Transmit status bits diff --git a/drivers/ti_pci1410a.c b/drivers/ti_pci1410a.c index d5297b5721..f6ab6c27d3 100644 --- a/drivers/ti_pci1410a.c +++ b/drivers/ti_pci1410a.c @@ -381,12 +381,6 @@ static int check_ide_device(int slot, int ide_base_bus) /* select config index 1 */ writeb(1, pcmcia_cis_ptr + config_base); -#if 0 - printf("Confiuration Option Register: %02x\n", readb(pcmcia_cis_ptr + config_base)); - printf("Card Confiuration and Status Register: %02x\n", readb(pcmcia_cis_ptr + config_base + 2)); - printf("Pin Replacement Register Register: %02x\n", readb(pcmcia_cis_ptr + config_base + 4)); - printf("Socket and Copy Register: %02x\n", readb(pcmcia_cis_ptr + config_base + 6)); -#endif ide_devices_found |= (1 << (slot+ide_base_bus)); return 0; @@ -481,11 +475,6 @@ static int hardware_enable(int slot) writeb(is_82365sl?0x90:0x98, socket_base+0x802); writeb(0x67, socket_base+0x803); udelay(100000); -#if 0 - printf("ExCA Id %02x, Card Status %02x, Power config %02x, Interrupt Config %02x, bridge control %04x %d\n", - readb(socket_base+0x800), readb(socket_base+0x801), - readb(socket_base+0x802), readb(socket_base+0x803), brg_ctrl, is_82365sl); -#endif return ((readb(socket_base+0x801)&0x6c)==0x6c)?0:1; } diff --git a/drivers/tigon3.c b/drivers/tigon3.c index ec2cd2ac36..400fbb9d9f 100644 --- a/drivers/tigon3.c +++ b/drivers/tigon3.c @@ -190,10 +190,6 @@ PLM_DEVICE_BLOCK pDevice) { pRcvBd->Len = (LM_UINT16) pDevice->RxJumboBufferSize; /* Initialize the receive buffer pointer */ -#if 0 /* Jimmy, deleted in new */ - pRcvBd->HostAddr.Low = pPacket->u.Rx.RxBufferPhy.Low; - pRcvBd->HostAddr.High = pPacket->u.Rx.RxBufferPhy.High; -#endif MM_MapRxDma(pDevice, pPacket, &pRcvBd->HostAddr); /* The opaque field may point to an offset from a fix addr. */ @@ -215,10 +211,6 @@ PLM_DEVICE_BLOCK pDevice) { pRcvBd->Len = MAX_STD_RCV_BUFFER_SIZE; /* Initialize the receive buffer pointer */ -#if 0 /* Jimmy, deleted in new replaced with MM_MapRxDma */ - pRcvBd->HostAddr.Low = pPacket->u.Rx.RxBufferPhy.Low; - pRcvBd->HostAddr.High = pPacket->u.Rx.RxBufferPhy.High; -#endif MM_MapRxDma(pDevice, pPacket, &pRcvBd->HostAddr); /* The opaque field may point to an offset from a fix addr. */ @@ -908,14 +900,12 @@ PLM_DEVICE_BLOCK pDevice) } } #endif -#if 1 /* * This code was at the beginning of else block below, but that's * a bug if node address in shared memory. */ MM_Wait(50); LM_NvramInit(pDevice); -#endif /* Get the node address. First try to get in from the shared memory. */ /* If the signature is not present, then get it from the NVRAM. */ Value32 = MEM_RD_OFFSET(pDevice, T3_MAC_ADDR_HIGH_MAILBOX); @@ -3026,137 +3016,6 @@ LM_EnableInterrupt( /* Return: */ /* LM_STATUS_SUCCESS */ /******************************************************************************/ -#if 0 -LM_STATUS -LM_SendPacket(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket) -{ - LM_UINT32 FragCount; - PT3_SND_BD pSendBd; - PT3_SND_BD pShadowSendBd; - LM_UINT32 Value32, Len; - LM_UINT32 Idx; - - if (T3_ASIC_REV(pDevice->ChipRevId) == T3_ASIC_REV_5700) { - return LM_5700SendPacket(pDevice, pPacket); - } - - /* Update the SendBdLeft count. */ - atomic_sub(pPacket->u.Tx.FragCount, &pDevice->SendBdLeft); - - /* Initalize the send buffer descriptors. */ - Idx = pDevice->SendProdIdx; - - pSendBd = &pDevice->pSendBdVirt[Idx]; - - /* Next producer index. */ - if (pDevice->NicSendBd == TRUE) - { - T3_64BIT_HOST_ADDR paddr; - - pShadowSendBd = &pDevice->ShadowSendBd[Idx]; - for(FragCount = 0; ; ) - { - MM_MapTxDma(pDevice, pPacket, &paddr, &Len, FragCount); - /* Initialize the pointer to the send buffer fragment. */ - if (paddr.High != pShadowSendBd->HostAddr.High) - { - __raw_writel(paddr.High, &(pSendBd->HostAddr.High)); - pShadowSendBd->HostAddr.High = paddr.High; - } - __raw_writel(paddr.Low, &(pSendBd->HostAddr.Low)); - - /* Setup the control flags and send buffer size. */ - Value32 = (Len << 16) | pPacket->Flags; - - Idx = (Idx + 1) & T3_SEND_RCB_ENTRY_COUNT_MASK; - - FragCount++; - if (FragCount >= pPacket->u.Tx.FragCount) - { - Value32 |= SND_BD_FLAG_END; - if (Value32 != pShadowSendBd->u1.Len_Flags) - { - __raw_writel(Value32, &(pSendBd->u1.Len_Flags)); - pShadowSendBd->u1.Len_Flags = Value32; - } - if (pPacket->Flags & SND_BD_FLAG_VLAN_TAG) { - __raw_writel(pPacket->VlanTag, &(pSendBd->u2.VlanTag)); - } - break; - } - else - { - if (Value32 != pShadowSendBd->u1.Len_Flags) - { - __raw_writel(Value32, &(pSendBd->u1.Len_Flags)); - pShadowSendBd->u1.Len_Flags = Value32; - } - if (pPacket->Flags & SND_BD_FLAG_VLAN_TAG) { - __raw_writel(pPacket->VlanTag, &(pSendBd->u2.VlanTag)); - } - } - - pSendBd++; - pShadowSendBd++; - if (Idx == 0) - { - pSendBd = &pDevice->pSendBdVirt[0]; - pShadowSendBd = &pDevice->ShadowSendBd[0]; - } - } /* for */ - - /* Put the packet descriptor in the ActiveQ. */ - QQ_PushTail(&pDevice->TxPacketActiveQ.Container, pPacket); - - wmb(); - MB_REG_WR(pDevice, Mailbox.SendNicProdIdx[0].Low, Idx); - - } - else - { - for(FragCount = 0; ; ) - { - /* Initialize the pointer to the send buffer fragment. */ - MM_MapTxDma(pDevice, pPacket, &pSendBd->HostAddr, &Len, FragCount); - - pSendBd->u2.VlanTag = pPacket->VlanTag; - - /* Setup the control flags and send buffer size. */ - Value32 = (Len << 16) | pPacket->Flags; - - Idx = (Idx + 1) & T3_SEND_RCB_ENTRY_COUNT_MASK; - - FragCount++; - if (FragCount >= pPacket->u.Tx.FragCount) - { - pSendBd->u1.Len_Flags = Value32 | SND_BD_FLAG_END; - break; - } - else - { - pSendBd->u1.Len_Flags = Value32; - } - pSendBd++; - if (Idx == 0) - { - pSendBd = &pDevice->pSendBdVirt[0]; - } - } /* for */ - - /* Put the packet descriptor in the ActiveQ. */ - QQ_PushTail(&pDevice->TxPacketActiveQ.Container, pPacket); - - wmb(); - MB_REG_WR(pDevice, Mailbox.SendHostProdIdx[0].Low, Idx); - - } - - /* Update the producer index. */ - pDevice->SendProdIdx = Idx; - - return LM_STATUS_SUCCESS; -} -#endif LM_STATUS LM_SendPacket(PLM_DEVICE_BLOCK pDevice, PLM_PACKET pPacket) @@ -4287,9 +4146,7 @@ PLM_DEVICE_BLOCK pDevice) LM_UINT32 Value32; LM_UINT32 j; -#if 1 /* jmb: bugfix -- moved here, out of code that sets initial pwr state */ LM_WritePhy(pDevice, BCM5401_AUX_CTRL, 0x2); -#endif if((pDevice->PhyId & PHY_ID_MASK) == PHY_BCM5401_PHY_ID) { LM_ReadPhy(pDevice, PHY_STATUS_REG, &Value32); @@ -5362,9 +5219,6 @@ LM_POWER_STATE PowerLevel) { REG_WR(pDevice, Grc.LocalCtrl, pDevice->GrcLocalCtrl); MM_Wait (40); -#if 0 /* Bugfix by jmb...can't call WritePhy here because pDevice not fully initialized */ - LM_WritePhy(pDevice, BCM5401_AUX_CTRL, 0x02); -#endif return LM_STATUS_SUCCESS; } diff --git a/drivers/tigon3.h b/drivers/tigon3.h index ea4367d61d..3beb538bcd 100644 --- a/drivers/tigon3.h +++ b/drivers/tigon3.h @@ -29,30 +29,8 @@ #define writel(b,addr) \ ((*(volatile unsigned int *)(addr)) = (LONGSWAP(b))) #else -#if 0 /* !defined(PPC603) */ -#define readl(addr) (*(volatile unsigned int*)(0xa0000000 + (unsigned long)(addr))) -#define writel(b,addr) ((*(volatile unsigned int *) ((unsigned long)(addr) + 0xa0000000)) = (b)) -#else -#if 1 #define readl(addr) (*(volatile unsigned int*)(addr)) #define writel(b,addr) ((*(volatile unsigned int *) (addr)) = (b)) -#else -extern int sprintf(char* buf, const char* f, ...); -static __inline unsigned int readl(void* addr){ - char buf[128]; - unsigned int tmp = (*(volatile unsigned int*)(addr)); - sprintf(buf,"%s:%s: read 0x%x from 0x%x\n",__FILE__,__LINE__,tmp,addr,0,0); - sysSerialPrintString(buf); - return tmp; -} -static __inline void writel(unsigned int b, unsigned int addr){ - char buf[128]; - ((*(volatile unsigned int *) (addr)) = (b)); - sprintf(buf,"%s:%s: write 0x%x to 0x%x\n",__FILE__,__LINE__,b,addr,0,0); - sysSerialPrintString(buf); -} -#endif -#endif /* PPC603 */ #endif @@ -2964,11 +2942,6 @@ typedef struct _LM_DEVICE_BLOCK { LM_UINT32 ChipRevId; LM_UINT16 SubsystemVendorId; LM_UINT16 SubsystemId; -#if 0 /* Jimmy, deleted in new driver */ - LM_UINT32 MemBaseLow; - LM_UINT32 MemBaseHigh; - LM_UINT32 MemBaseSize; -#endif PLM_UINT8 pMappedMemBase; /* Saved PCI configuration registers for restoring after a reset. */ @@ -3292,85 +3265,6 @@ LM_STATUS LM_LoadFirmware(PLM_DEVICE_BLOCK pDevice, /* NIC register read/write macros. */ /******************************************************************************/ -#if 0 /* Jimmy */ -/* MAC register access. */ -LM_UINT32 LM_RegRdInd(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Register); -LM_VOID LM_RegWrInd(PLM_DEVICE_BLOCK pDevice, LM_UINT32 Register, - LM_UINT32 Value32); - -/* MAC memory access. */ -LM_UINT32 LM_MemRdInd(PLM_DEVICE_BLOCK pDevice, LM_UINT32 MemAddr); -LM_VOID LM_MemWrInd(PLM_DEVICE_BLOCK pDevice, LM_UINT32 MemAddr, - LM_UINT32 Value32); - -#if PCIX_TARGET_WORKAROUND - -/* use memory-mapped accesses for mailboxes and reads, UNDI accesses - for writes to all other registers */ -#define REG_RD(pDevice, OffsetName) \ - readl(&((pDevice)->pMemView->OffsetName)) - -#define REG_WR(pDevice, OffsetName, Value32) \ - (((OFFSETOF(T3_STD_MEM_MAP, OffsetName) >=0x200 ) && \ - (OFFSETOF(T3_STD_MEM_MAP, OffsetName) <0x400)) || \ - ((pDevice)->EnablePciXFix == FALSE)) ? \ - (void) writel(Value32, &((pDevice)->pMemView->OffsetName)) : \ - LM_RegWrInd(pDevice, OFFSETOF(T3_STD_MEM_MAP, OffsetName), Value32) - -#define MB_REG_RD(pDevice, OffsetName) \ - readl(&((pDevice)->pMemView->OffsetName)) - -#define MB_REG_WR(pDevice, OffsetName, Value32) \ - writel(Value32, &((pDevice)->pMemView->OffsetName)) - -#define REG_RD_OFFSET(pDevice, Offset) \ - readl(&((LM_UINT8 *) (pDevice)->pMemView + Offset)) - -#define REG_WR_OFFSET(pDevice, Offset, Value32) \ - (((Offset >=0x200 ) && (Offset < 0x400)) || \ - ((pDevice)->EnablePciXFix == FALSE)) ? \ - (void) writel(Value32, ((LM_UINT8 *) (pDevice)->pMemView + Offset)) : \ - LM_RegWrInd(pDevice, Offset, Value32) - -#define MEM_RD(pDevice, AddrName) \ - LM_MemRdInd(pDevice, OFFSETOF(T3_FIRST_32K_SRAM, AddrName)) -#define MEM_WR(pDevice, AddrName, Value32) \ - LM_MemWrInd(pDevice, OFFSETOF(T3_FIRST_32K_SRAM, AddrName), Value32) - -#define MEM_RD_OFFSET(pDevice, Offset) \ - LM_MemRdInd(pDevice, Offset) -#define MEM_WR_OFFSET(pDevice, Offset, Value32) \ - LM_MemWrInd(pDevice, Offset, Value32) - -#else /* normal target access path below */ - -/* Register access. */ -#define REG_RD(pDevice, OffsetName) \ - readl(&((pDevice)->pMemView->OffsetName)) -#define REG_WR(pDevice, OffsetName, Value32) \ - writel(Value32, &((pDevice)->pMemView->OffsetName)) - -#define REG_RD_OFFSET(pDevice, Offset) \ - readl(((LM_UINT8 *) (pDevice)->pMemView + Offset)) -#define REG_WR_OFFSET(pDevice, Offset, Value32) \ - writel(Value32, ((LM_UINT8 *) (pDevice)->pMemView + Offset)) - - -/* There could be problem access the memory window directly. For now, */ -/* we have to go through the PCI configuration register. */ -#define MEM_RD(pDevice, AddrName) \ - LM_MemRdInd(pDevice, OFFSETOF(T3_FIRST_32K_SRAM, AddrName)) -#define MEM_WR(pDevice, AddrName, Value32) \ - LM_MemWrInd(pDevice, OFFSETOF(T3_FIRST_32K_SRAM, AddrName), Value32) - -#define MEM_RD_OFFSET(pDevice, Offset) \ - LM_MemRdInd(pDevice, Offset) -#define MEM_WR_OFFSET(pDevice, Offset, Value32) \ - LM_MemWrInd(pDevice, Offset, Value32) - -#endif /* PCIX_TARGET_WORKAROUND */ - -#endif /* Jimmy, merging */ /* Jimmy...rest of file is new stuff! */ /******************************************************************************/ diff --git a/drivers/tqm8xx_pcmcia.c b/drivers/tqm8xx_pcmcia.c index a0f53cd684..561f31b742 100644 --- a/drivers/tqm8xx_pcmcia.c +++ b/drivers/tqm8xx_pcmcia.c @@ -217,12 +217,6 @@ int pcmcia_hardware_enable(int slot) puts (" 3.3V card found: "); } -#if 0 - /* VCC switch error flag, PCMCIA slot INPACK_ pin */ - cp->cp_pbdir &= ~(0x0020 | 0x0010); - cp->cp_pbpar &= ~(0x0020 | 0x0010); - udelay(500000); -#endif udelay(1000); debug ("Enable PCMCIA buffers and stop RESET\n"); diff --git a/drivers/usbdcore_ep0.c b/drivers/usbdcore_ep0.c index 260befe978..8899b71308 100644 --- a/drivers/usbdcore_ep0.c +++ b/drivers/usbdcore_ep0.c @@ -46,11 +46,7 @@ #if defined(CONFIG_OMAP1510) && defined(CONFIG_USB_DEVICE) #include "usbdcore.h" -#if 0 -#define dbg_ep0(lvl,fmt,args...) serial_printf("[%s] %s:%d: "fmt"\n",__FILE__,__FUNCTION__,__LINE__,##args) -#else #define dbg_ep0(lvl,fmt,args...) -#endif /* EP0 Configuration Set ********************************************************************* */ @@ -309,24 +305,6 @@ static int ep0_get_descriptor (struct usb_device_instance *device, /* alternate_instance->classes, alternate_instance->endpoints); */ /* iterate across classes for this alternate interface */ -#if 0 - for (class = 0; - class < alternate_instance->classes; - class++) { - struct usb_class_descriptor *class_descriptor; - /*dbg_ep0(3, "[%d:%d:%d] classes: %d", bNumInterface, bAlternateSetting, */ - /* class, alternate_instance->classes); */ - if (!(class_descriptor = usbd_device_class_descriptor_index (device, port, index, bNumInterface, bAlternateSetting, class))) { - dbg_ep0 (3, "[%d] class NULL", - class); - return -1; - } - /* copy descriptor for this class */ - copy_config (urb, class_descriptor, - sizeof (struct usb_class_descriptor), - max); - } -#endif /* iterate across endpoints for this alternate interface */ interface_descriptor = alternate_instance->interface_descriptor; @@ -376,62 +354,11 @@ static int ep0_get_descriptor (struct usb_device_instance *device, case USB_DESCRIPTOR_TYPE_HID: { return -1; /* unsupported at this time */ -#if 0 - int bNumInterface = - le16_to_cpu (urb->device_request.wIndex); - int bAlternateSetting = 0; - int class = 0; - struct usb_class_descriptor *class_descriptor; - - if (!(class_descriptor = - usbd_device_class_descriptor_index (device, - port, 0, - bNumInterface, - bAlternateSetting, - class)) - || class_descriptor->descriptor.hid.bDescriptorType != USB_DT_HID) { - dbg_ep0 (3, "[%d] interface is not HID", - bNumInterface); - return -1; - } - /* copy descriptor for this class */ - copy_config (urb, class_descriptor, - class_descriptor->descriptor.hid.bLength, - max); -#endif } break; case USB_DESCRIPTOR_TYPE_REPORT: { return -1; /* unsupported at this time */ -#if 0 - int bNumInterface = - le16_to_cpu (urb->device_request.wIndex); - int bAlternateSetting = 0; - int class = 0; - struct usb_class_report_descriptor *report_descriptor; - - if (!(report_descriptor = - usbd_device_class_report_descriptor_index - (device, port, 0, bNumInterface, - bAlternateSetting, class)) - || report_descriptor->bDescriptorType != - USB_DT_REPORT) { - dbg_ep0 (3, "[%d] descriptor is not REPORT", - bNumInterface); - return -1; - } - /* copy report descriptor for this class */ - /*copy_config(urb, &report_descriptor->bData[0], report_descriptor->wLength, max); */ - if (max - urb->actual_length > 0) { - int length = - MIN (report_descriptor->wLength, - max - urb->actual_length); - memcpy (urb->buffer + urb->actual_length, - &report_descriptor->bData[0], length); - urb->actual_length += length; - } -#endif } break; default: diff --git a/drivers/usbdcore_omap1510.c b/drivers/usbdcore_omap1510.c index 1d54a63575..fba9f34fab 100644 --- a/drivers/usbdcore_omap1510.c +++ b/drivers/usbdcore_omap1510.c @@ -44,21 +44,11 @@ #define UDC_MAX_ENDPOINTS 31 /* Number of endpoints on this UDC */ /* Some kind of debugging output... */ -#if 1 #define UDCDBG(str) #define UDCDBGA(fmt,args...) -#else /* The bugs still exists... */ -#define UDCDBG(str) serial_printf("[%s] %s:%d: " str "\n", __FILE__,__FUNCTION__,__LINE__) -#define UDCDBGA(fmt,args...) serial_printf("[%s] %s:%d: " fmt "\n", __FILE__,__FUNCTION__,__LINE__, ##args) -#endif -#if 1 #define UDCREG(name) #define UDCREGL(name) -#else /* The bugs still exists... */ -#define UDCREG(name) serial_printf("%s():%d: %s[%08x]=%.4x\n",__FUNCTION__,__LINE__, (#name), name, inw(name)) /* For 16-bit regs */ -#define UDCREGL(name) serial_printf("%s():%d: %s[%08x]=%.8x\n",__FUNCTION__,__LINE__, (#name), name, inl(name)) /* For 32-bit regs */ -#endif static struct urb *ep0_urb = NULL; @@ -689,20 +679,10 @@ static void omap1510_udc_setup (struct usb_endpoint_instance *endpoint) * so we'll just stall it. It seems like the API isn't * quite right here. */ -#if 0 - /* Here is what we would do if we did support control - * write data stages. - */ - ep0_urb->actual_length = 0; - outw (0, UDC_EP_NUM); - /* enable the EP0 rx FIFO */ - outw (UDC_Set_FIFO_En, UDC_CTRL); -#else /* Stall this request */ UDCDBG ("Stalling unsupported EP0 control write data " "stage."); udc_stall_ep (0); -#endif } else { omap1510_prepare_for_control_write_status (ep0_urb); } @@ -1215,46 +1195,6 @@ static void udc_stall_ep (unsigned int ep_addr) } /* Reset endpoint */ -#if 0 -static void udc_reset_ep (unsigned int ep_addr) -{ - /*int ep_addr = PHYS_EP_TO_EP_ADDR(ep); */ - int ep_num = ep_addr & USB_ENDPOINT_NUMBER_MASK; - - UDCDBGA ("reset ep_addr %d", ep_addr); - - if (!ep_num) { - /* control endpoint 0 can't be reset */ - } else if ((ep_addr & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { - UDCDBGA ("UDC_EP_RX(%d) = 0x%04x", ep_num, - inw (UDC_EP_RX (ep_num))); - if (inw (UDC_EP_RX (ep_num)) & UDC_EPn_RX_Valid) { - /* we have a valid rx endpoint, so reset it */ - outw (ep_num | UDC_EP_Sel, UDC_EP_NUM); - outw (UDC_Reset_EP, UDC_CTRL); - outw (ep_num, UDC_EP_NUM); - UDCDBGA ("OUT endpoint %d reset", ep_num); - } - } else { - UDCDBGA ("UDC_EP_TX(%d) = 0x%04x", ep_num, - inw (UDC_EP_TX (ep_num))); - /* Resetting of tx endpoints seems to be causing the USB function - * module to fail, which causes problems when the driver is - * uninstalled. We'll skip resetting tx endpoints for now until - * we figure out what the problem is. - */ -#if 0 - if (inw (UDC_EP_TX (ep_num)) & UDC_EPn_TX_Valid) { - /* we have a valid tx endpoint, so reset it */ - outw (ep_num | UDC_EP_Dir | UDC_EP_Sel, UDC_EP_NUM); - outw (UDC_Reset_EP, UDC_CTRL); - outw (ep_num | UDC_EP_Dir, UDC_EP_NUM); - UDCDBGA ("IN endpoint %d reset", ep_num); - } -#endif - } -} -#endif /* ************************************************************************** */ @@ -1263,30 +1203,6 @@ static void udc_reset_ep (unsigned int ep_addr) * * Return physical endpoint number to use for this logical endpoint or zero if not valid. */ -#if 0 -int udc_check_ep (int logical_endpoint, int packetsize) -{ - if ((logical_endpoint == 0x80) || - ((logical_endpoint & 0x8f) != logical_endpoint)) { - return 0; - } - - switch (packetsize) { - case 8: - case 16: - case 32: - case 64: - case 128: - case 256: - case 512: - break; - default: - return 0; - } - - return EP_ADDR_TO_PHYS_EP (logical_endpoint); -} -#endif /* * udc_setup_ep - setup endpoint @@ -1343,32 +1259,6 @@ void udc_setup_ep (struct usb_device_instance *device, * * Disable specified endpoint */ -#if 0 -void udc_disable_ep (unsigned int ep_addr) -{ - /*int ep_addr = PHYS_EP_TO_EP_ADDR(ep); */ - int ep_num = ep_addr & USB_ENDPOINT_NUMBER_MASK; - struct usb_endpoint_instance *endpoint = omap1510_find_ep (ep_addr); /*udc_device->bus->endpoint_array + ep; */ - - UDCDBGA ("disable ep_addr %d", ep_addr); - - if (!ep_num) { - /* nothing to do for endpoint 0 */ ; - } else if ((ep_addr & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) { - if (endpoint->tx_packetSize) { - /* we have a valid tx endpoint */ - /*usbd_flush_tx(endpoint); */ - endpoint->tx_urb = NULL; - } - } else { - if (endpoint->rcv_packetSize) { - /* we have a valid rx endpoint */ - /*usbd_flush_rcv(endpoint); */ - endpoint->rcv_urb = NULL; - } - } -} -#endif /* ************************************************************************** */ @@ -1377,12 +1267,6 @@ void udc_disable_ep (unsigned int ep_addr) * * Return non-zero if cable is connected. */ -#if 0 -int udc_connected (void) -{ - return ((inw (UDC_DEVSTAT) & UDC_ATT) == UDC_ATT); -} -#endif /* Turn on the USB connection by enabling the pullup resistor */ void udc_connect (void) @@ -1405,25 +1289,12 @@ void udc_disconnect (void) * udc_disable_interrupts - disable interrupts * switch off interrupts */ -#if 0 -void udc_disable_interrupts (struct usb_device_instance *device) -{ - UDCDBG ("disabling all interrupts"); - outw (0, UDC_IRQ_EN); -} -#endif /* ************************************************************************** */ /** * udc_ep0_packetsize - return ep0 packetsize */ -#if 0 -int udc_ep0_packetsize (void) -{ - return EP0_PACKETSIZE; -} -#endif /* Switch on the UDC */ void udc_enable (struct usb_device_instance *device) diff --git a/drivers/usbtty.c b/drivers/usbtty.c index ce4a12e16e..5dad20a470 100644 --- a/drivers/usbtty.c +++ b/drivers/usbtty.c @@ -26,17 +26,9 @@ #include <devices.h> #include "usbtty.h" -#if 0 -#define TTYDBG(fmt,args...) serial_printf("[%s] %s %d: "fmt, __FILE__,__FUNCTION__,__LINE__,##args) -#else #define TTYDBG(fmt,args...) do{}while(0) -#endif -#if 0 -#define TTYERR(fmt,args...) serial_printf("ERROR![%s] %s %d: "fmt, __FILE__,__FUNCTION__,__LINE__,##args) -#else #define TTYERR(fmt,args...) do{}while(0) -#endif /* * Buffers to hold input and output data |