From 3040d05685c899c4a0be86667fa206b19dab0ab8 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Fri, 4 Jan 2013 22:25:45 +0000 Subject: staging: et131x: Replace rxdma csr register magic numbers with defines Several magic numbers were used to represent rxdma csr register bitmasks. Replace them with descriptive defines. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 34 +++++++++++++++++----------------- drivers/staging/et131x/et131x.h | 8 ++++++++ 2 files changed, 25 insertions(+), 17 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 84bbcd48e26..b08dff95923 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -577,7 +577,6 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) return -ETIMEDOUT; } - /** * eeprom_write - Write a byte to the ET1310's EEPROM * @adapter: pointer to our private adapter structure @@ -843,29 +842,29 @@ static int et131x_init_eeprom(struct et131x_adapter *adapter) static void et131x_rx_dma_enable(struct et131x_adapter *adapter) { /* Setup the receive dma configuration register for normal operation */ - u32 csr = 0x2000; /* FBR1 enable */ + u32 csr = ET_RXDMA_CSR_FBR1_ENABLE; if (adapter->rx_ring.fbr[1]->buffsize == 4096) - csr |= 0x0800; + csr |= ET_RXDMA_CSR_FBR1_SIZE_LO; else if (adapter->rx_ring.fbr[1]->buffsize == 8192) - csr |= 0x1000; + csr |= ET_RXDMA_CSR_FBR1_SIZE_HI; else if (adapter->rx_ring.fbr[1]->buffsize == 16384) - csr |= 0x1800; + csr |= ET_RXDMA_CSR_FBR1_SIZE_LO | ET_RXDMA_CSR_FBR1_SIZE_HI; - csr |= 0x0400; /* FBR0 enable */ + csr |= ET_RXDMA_CSR_FBR0_ENABLE; if (adapter->rx_ring.fbr[0]->buffsize == 256) - csr |= 0x0100; + csr |= ET_RXDMA_CSR_FBR0_SIZE_LO; else if (adapter->rx_ring.fbr[0]->buffsize == 512) - csr |= 0x0200; + csr |= ET_RXDMA_CSR_FBR0_SIZE_HI; else if (adapter->rx_ring.fbr[0]->buffsize == 1024) - csr |= 0x0300; + csr |= ET_RXDMA_CSR_FBR0_SIZE_LO | ET_RXDMA_CSR_FBR0_SIZE_HI; writel(csr, &adapter->regs->rxdma.csr); csr = readl(&adapter->regs->rxdma.csr); - if (csr & 0x00020000) { + if (csr & ET_RXDMA_CSR_HALT_STATUS) { udelay(5); csr = readl(&adapter->regs->rxdma.csr); - if (csr & 0x00020000) { + if (csr & ET_RXDMA_CSR_HALT_STATUS) { dev_err(&adapter->pdev->dev, "RX Dma failed to exit halt state. CSR 0x%08x\n", csr); @@ -881,15 +880,16 @@ static void et131x_rx_dma_disable(struct et131x_adapter *adapter) { u32 csr; /* Setup the receive dma configuration register */ - writel(0x00002001, &adapter->regs->rxdma.csr); + writel(ET_RXDMA_CSR_HALT | ET_RXDMA_CSR_FBR1_ENABLE, + &adapter->regs->rxdma.csr); csr = readl(&adapter->regs->rxdma.csr); - if ((csr & 0x00020000) == 0) { /* Check halt status (bit 17) */ + if (!(csr & ET_RXDMA_CSR_HALT_STATUS)) { udelay(5); csr = readl(&adapter->regs->rxdma.csr); - if ((csr & 0x00020000) == 0) + if (!(csr & ET_RXDMA_CSR_HALT_STATUS)) dev_err(&adapter->pdev->dev, - "RX Dma failed to enter halt state. CSR 0x%08x\n", - csr); + "RX Dma failed to enter halt state. CSR 0x%08x\n", + csr); } } @@ -2032,7 +2032,7 @@ static void et131x_disable_interrupts(struct et131x_adapter *adapter) static void et131x_tx_dma_disable(struct et131x_adapter *adapter) { /* Setup the tramsmit dma configuration register */ - writel(ET_TXDMA_CSR_HALT|ET_TXDMA_SNGL_EPKT, + writel(ET_TXDMA_CSR_HALT | ET_TXDMA_SNGL_EPKT, &adapter->regs->txdma.csr); } diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h index 347e63ddde1..9fa47f91a9f 100644 --- a/drivers/staging/et131x/et131x.h +++ b/drivers/staging/et131x/et131x.h @@ -317,6 +317,14 @@ struct txdma_regs { /* Location: */ * 18-31: unused */ +#define ET_RXDMA_CSR_HALT 0x0001 +#define ET_RXDMA_CSR_FBR0_SIZE_LO 0x0100 +#define ET_RXDMA_CSR_FBR0_SIZE_HI 0x0200 +#define ET_RXDMA_CSR_FBR0_ENABLE 0x0400 +#define ET_RXDMA_CSR_FBR1_SIZE_LO 0x0800 +#define ET_RXDMA_CSR_FBR1_SIZE_HI 0x1000 +#define ET_RXDMA_CSR_FBR1_ENABLE 0x2000 +#define ET_RXDMA_CSR_HALT_STATUS 0x00020000 /* * structure for dma writeback lo reg in rxdma address map -- cgit v1.2.3 From a129be84ba83b964dde784e87820b89d1a7d29c3 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Fri, 4 Jan 2013 22:25:46 +0000 Subject: staging: et131x: Use register defines instead of magic numbers Use register name defines instead of magic numbers where a bit of clarity would be useful. Also a small typo fix and some register prefixes added, for further clarity. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 132 +++++++++++++++++++++++----------------- drivers/staging/et131x/et131x.h | 88 +++++++++++++++++++-------- 2 files changed, 139 insertions(+), 81 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index b08dff95923..e2d555529c6 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -344,6 +344,10 @@ struct rx_ring { * 14: UDP checksum assist */ +#define TXDESC_FLAG_LASTPKT 0x0001 +#define TXDESC_FLAG_FIRSTPKT 0x0002 +#define TXDESC_FLAG_INTPROC 0x0004 + /* struct tx_desc represents each descriptor on the ring */ struct tx_desc { u32 addr_hi; @@ -774,13 +778,12 @@ static int et131x_init_eeprom(struct et131x_adapter *adapter) /* We first need to check the EEPROM Status code located at offset * 0xB2 of config space */ - pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, - &eestatus); + pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, &eestatus); /* THIS IS A WORKAROUND: * I need to call this function twice to get my card in a * LG M1 Express Dual running. I tried also a msleep before this - * function, because I thought there could be some time condidions + * function, because I thought there could be some time conditions * but it didn't work. Call the whole function twice also work. */ if (pci_read_config_byte(pdev, ET1310_PCI_EEPROM_STATUS, &eestatus)) { @@ -932,7 +935,10 @@ static void et1310_config_mac_regs1(struct et131x_adapter *adapter) /* First we need to reset everything. Write to MAC configuration * register 1 to perform reset. */ - writel(0xC00F0000, ¯egs->cfg1); + writel(ET_MAC_CFG1_SOFT_RESET | ET_MAC_CFG1_SIM_RESET | + ET_MAC_CFG1_RESET_RXMC | ET_MAC_CFG1_RESET_TXMC | + ET_MAC_CFG1_RESET_RXFUNC | ET_MAC_CFG1_RESET_TXFUNC, + ¯egs->cfg1); /* Next lets configure the MAC Inter-packet gap register */ ipg = 0x38005860; /* IPG1 0x38 IPG2 0x58 B2B 0x60 */ @@ -947,7 +953,7 @@ static void et1310_config_mac_regs1(struct et131x_adapter *adapter) writel(0, ¯egs->if_ctrl); /* Let's move on to setting up the mii management configuration */ - writel(0x07, ¯egs->mii_mgmt_cfg); /* Clock reset 0x7 */ + writel(ET_MAC_MIIMGMT_CLK_RST, ¯egs->mii_mgmt_cfg); /* Next lets configure the MAC Station Address register. These * values are read from the EEPROM during initialization and stored @@ -998,38 +1004,43 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) ifctrl = readl(&mac->if_ctrl); /* Set up the if mode bits */ - cfg2 &= ~0x300; + cfg2 &= ~ET_MAC_CFG2_IFMODE_MASK; if (phydev && phydev->speed == SPEED_1000) { - cfg2 |= 0x200; + cfg2 |= ET_MAC_CFG2_IFMODE_1000; /* Phy mode bit */ - ifctrl &= ~(1 << 24); + ifctrl &= ~ET_MAC_IFCTRL_PHYMODE; } else { - cfg2 |= 0x100; - ifctrl |= (1 << 24); + cfg2 |= ET_MAC_CFG2_IFMODE_100; + ifctrl |= ET_MAC_IFCTRL_PHYMODE; } /* We need to enable Rx/Tx */ - cfg1 |= CFG1_RX_ENABLE | CFG1_TX_ENABLE | CFG1_TX_FLOW; + cfg1 |= ET_MAC_CFG1_RX_ENABLE | ET_MAC_CFG1_TX_ENABLE | + ET_MAC_CFG1_TX_FLOW; /* Initialize loop back to off */ - cfg1 &= ~(CFG1_LOOPBACK | CFG1_RX_FLOW); + cfg1 &= ~(ET_MAC_CFG1_LOOPBACK | ET_MAC_CFG1_RX_FLOW); if (adapter->flowcontrol == FLOW_RXONLY || adapter->flowcontrol == FLOW_BOTH) - cfg1 |= CFG1_RX_FLOW; + cfg1 |= ET_MAC_CFG1_RX_FLOW; writel(cfg1, &mac->cfg1); /* Now we need to initialize the MAC Configuration 2 register */ /* preamble 7, check length, huge frame off, pad crc, crc enable full duplex off */ - cfg2 |= 0x7016; - cfg2 &= ~0x0021; + cfg2 |= 0x7 << ET_MAC_CFG2_PREAMBLE_SHIFT; + cfg2 |= ET_MAC_CFG2_IFMODE_LEN_CHECK; + cfg2 |= ET_MAC_CFG2_IFMODE_PAD_CRC; + cfg2 |= ET_MAC_CFG2_IFMODE_CRC_ENABLE; + cfg2 &= ~ET_MAC_CFG2_IFMODE_HUGE_FRAME; + cfg2 &= ~ET_MAC_CFG2_IFMODE_FULL_DPLX; /* Turn on duplex if needed */ if (phydev && phydev->duplex == DUPLEX_FULL) - cfg2 |= 0x01; + cfg2 |= ET_MAC_CFG2_IFMODE_FULL_DPLX; - ifctrl &= ~(1 << 26); + ifctrl &= ~ET_MAC_IFCTRL_GHDMODE; if (phydev && phydev->duplex == DUPLEX_HALF) - ifctrl |= (1<<26); /* Enable ghd */ + ifctrl |= ET_MAC_IFCTRL_GHDMODE; writel(ifctrl, &mac->if_ctrl); writel(cfg2, &mac->cfg2); @@ -1038,7 +1049,7 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) udelay(10); delay++; cfg1 = readl(&mac->cfg1); - } while ((cfg1 & CFG1_WAIT) != CFG1_WAIT && delay < 100); + } while ((cfg1 & ET_MAC_CFG1_WAIT) != ET_MAC_CFG1_WAIT && delay < 100); if (delay == 100) { dev_warn(&adapter->pdev->dev, @@ -1047,7 +1058,7 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) } /* Enable txmac */ - ctl |= 0x09; /* TX mac enable, FC disable */ + ctl |= ET_TX_CTRL_TXMAC_ENABLE | ET_TX_CTRL_FC_DISABLE; writel(ctl, &adapter->regs->txmac.ctl); /* Ready to start the RXDMA/TXDMA engine */ @@ -1139,19 +1150,19 @@ static void et1310_setup_device_for_unicast(struct et131x_adapter *adapter) * Set up unicast packet filter reg 3 to be the octets 2 - 5 of the * MAC address for first address */ - uni_pf3 = (adapter->addr[0] << ET_UNI_PF_ADDR2_1_SHIFT) | - (adapter->addr[1] << ET_UNI_PF_ADDR2_2_SHIFT) | - (adapter->addr[0] << ET_UNI_PF_ADDR1_1_SHIFT) | + uni_pf3 = (adapter->addr[0] << ET_RX_UNI_PF_ADDR2_1_SHIFT) | + (adapter->addr[1] << ET_RX_UNI_PF_ADDR2_2_SHIFT) | + (adapter->addr[0] << ET_RX_UNI_PF_ADDR1_1_SHIFT) | adapter->addr[1]; - uni_pf2 = (adapter->addr[2] << ET_UNI_PF_ADDR2_3_SHIFT) | - (adapter->addr[3] << ET_UNI_PF_ADDR2_4_SHIFT) | - (adapter->addr[4] << ET_UNI_PF_ADDR2_5_SHIFT) | + uni_pf2 = (adapter->addr[2] << ET_RX_UNI_PF_ADDR2_3_SHIFT) | + (adapter->addr[3] << ET_RX_UNI_PF_ADDR2_4_SHIFT) | + (adapter->addr[4] << ET_RX_UNI_PF_ADDR2_5_SHIFT) | adapter->addr[5]; - uni_pf1 = (adapter->addr[2] << ET_UNI_PF_ADDR1_3_SHIFT) | - (adapter->addr[3] << ET_UNI_PF_ADDR1_4_SHIFT) | - (adapter->addr[4] << ET_UNI_PF_ADDR1_5_SHIFT) | + uni_pf1 = (adapter->addr[2] << ET_RX_UNI_PF_ADDR1_3_SHIFT) | + (adapter->addr[3] << ET_RX_UNI_PF_ADDR1_4_SHIFT) | + (adapter->addr[4] << ET_RX_UNI_PF_ADDR1_5_SHIFT) | adapter->addr[5]; pm_csr = readl(&adapter->regs->global.pm_csr); @@ -1208,13 +1219,13 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter) writel(0, &rxmac->mask4_word3); /* Lets setup the WOL Source Address */ - sa_lo = (adapter->addr[2] << ET_WOL_LO_SA3_SHIFT) | - (adapter->addr[3] << ET_WOL_LO_SA4_SHIFT) | - (adapter->addr[4] << ET_WOL_LO_SA5_SHIFT) | + sa_lo = (adapter->addr[2] << ET_RX_WOL_LO_SA3_SHIFT) | + (adapter->addr[3] << ET_RX_WOL_LO_SA4_SHIFT) | + (adapter->addr[4] << ET_RX_WOL_LO_SA5_SHIFT) | adapter->addr[5]; writel(sa_lo, &rxmac->sa_lo); - sa_hi = (u32) (adapter->addr[0] << ET_WOL_HI_SA1_SHIFT) | + sa_hi = (u32) (adapter->addr[0] << ET_RX_WOL_HI_SA1_SHIFT) | adapter->addr[1]; writel(sa_hi, &rxmac->sa_hi); @@ -1224,7 +1235,7 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter) /* Let's initialize the Unicast Packet filtering address */ if (adapter->packet_filter & ET131X_PACKET_TYPE_DIRECTED) { et1310_setup_device_for_unicast(adapter); - pf_ctrl |= 4; /* Unicast filter */ + pf_ctrl |= ET_RX_PFCTRL_UNICST_FILTER_ENABLE; } else { writel(0, &rxmac->uni_pf_addr1); writel(0, &rxmac->uni_pf_addr2); @@ -1233,13 +1244,13 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter) /* Let's initialize the Multicast hash */ if (!(adapter->packet_filter & ET131X_PACKET_TYPE_ALL_MULTICAST)) { - pf_ctrl |= 2; /* Multicast filter */ + pf_ctrl |= ET_RX_PFCTRL_MLTCST_FILTER_ENABLE; et1310_setup_device_for_multicast(adapter); } /* Runt packet filtering. Didn't work in version A silicon. */ - pf_ctrl |= (NIC_MIN_PACKET_SIZE + 4) << 16; - pf_ctrl |= 8; /* Fragment filter */ + pf_ctrl |= (NIC_MIN_PACKET_SIZE + 4) << ET_RX_PFCTRL_MIN_PKT_SZ_SHIFT; + pf_ctrl |= ET_RX_PFCTRL_FRAG_FILTER_ENABLE; if (adapter->registry_jumbo_packet > 8192) /* In order to transmit jumbo packets greater than 8k, the @@ -1290,7 +1301,7 @@ static void et1310_config_rxmac_regs(struct et131x_adapter *adapter) * but we still leave the packet filter on. */ writel(pf_ctrl, &rxmac->pf_ctrl); - writel(0x9, &rxmac->ctrl); + writel(ET_RX_CTRL_RXMAC_ENABLE | ET_RX_CTRL_WOL_DISABLE, &rxmac->ctrl); } static void et1310_config_txmac_regs(struct et131x_adapter *adapter) @@ -1401,7 +1412,7 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, writel(0, &mac->mii_mgmt_cmd); /* Set up the register we need to read from on the correct PHY */ - writel(MII_ADDR(addr, reg), &mac->mii_mgmt_addr); + writel(ET_MAC_MII_ADDR(addr, reg), &mac->mii_mgmt_addr); writel(0x1, &mac->mii_mgmt_cmd); @@ -1409,7 +1420,7 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, udelay(50); delay++; mii_indicator = readl(&mac->mii_mgmt_indicator); - } while ((mii_indicator & MGMT_WAIT) && delay < 50); + } while ((mii_indicator & ET_MAC_MGMT_WAIT) && delay < 50); /* If we hit the max delay, we could not read the register */ if (delay == 50) { @@ -1423,7 +1434,7 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, /* If we hit here we were able to read the register and we need to * return the value to the caller */ - *value = readl(&mac->mii_mgmt_stat) & 0xFFFF; + *value = readl(&mac->mii_mgmt_stat) & ET_MAC_MIIMGMT_STAT_PHYCRTL_MASK; /* Stop the read operation */ writel(0, &mac->mii_mgmt_cmd); @@ -1483,7 +1494,7 @@ static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value) writel(0, &mac->mii_mgmt_cmd); /* Set up the register we need to write to on the correct PHY */ - writel(MII_ADDR(addr, reg), &mac->mii_mgmt_addr); + writel(ET_MAC_MII_ADDR(addr, reg), &mac->mii_mgmt_addr); /* Add the value to write to the registers to the mac */ writel(value, &mac->mii_mgmt_ctrl); @@ -1492,7 +1503,7 @@ static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value) udelay(50); delay++; mii_indicator = readl(&mac->mii_mgmt_indicator); - } while ((mii_indicator & MGMT_BUSY) && delay < 100); + } while ((mii_indicator & ET_MAC_MGMT_BUSY) && delay < 100); /* If we hit the max delay, we could not write the register */ if (delay == 100) { @@ -1528,7 +1539,7 @@ static void et1310_phy_access_mii_bit(struct et131x_adapter *adapter, u8 *value) { u16 reg; - u16 mask = 0x0001 << bitnum; + u16 mask = 1 << bitnum; /* Read the requested register */ et131x_mii_read(adapter, regnum, ®); @@ -1839,7 +1850,7 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) writel(rx_local->psr_num_entries - 1, &rx_dma->psr_num_des); writel(0, &rx_dma->psr_full_offset); - psr_num_des = readl(&rx_dma->psr_num_des) & 0xFFF; + psr_num_des = readl(&rx_dma->psr_num_des) & ET_RXDMA_PSR_NUM_DES_MASK; writel((psr_num_des * LO_MARK_PERCENT_FOR_PSR) / 100, &rx_dma->psr_min_des); @@ -1983,13 +1994,21 @@ static void et131x_adapter_setup(struct et131x_adapter *adapter) */ static void et131x_soft_reset(struct et131x_adapter *adapter) { - /* Disable MAC Core */ - writel(0xc00f0000, &adapter->regs->mac.cfg1); + u32 reg; - /* Set everything to a reset value */ - writel(0x7F, &adapter->regs->global.sw_reset); - writel(0x000f0000, &adapter->regs->mac.cfg1); - writel(0x00000000, &adapter->regs->mac.cfg1); + /* Disable MAC Core */ + reg = ET_MAC_CFG1_SOFT_RESET | ET_MAC_CFG1_SIM_RESET | + ET_MAC_CFG1_RESET_RXMC | ET_MAC_CFG1_RESET_TXMC | + ET_MAC_CFG1_RESET_RXFUNC | ET_MAC_CFG1_RESET_TXFUNC; + writel(reg, &adapter->regs->mac.cfg1); + + reg = ET_RESET_ALL; + writel(reg, &adapter->regs->global.sw_reset); + + reg = ET_MAC_CFG1_RESET_RXMC | ET_MAC_CFG1_RESET_TXMC | + ET_MAC_CFG1_RESET_RXFUNC | ET_MAC_CFG1_RESET_TXFUNC; + writel(reg, &adapter->regs->mac.cfg1); + writel(0, &adapter->regs->mac.cfg1); } /** @@ -3022,23 +3041,22 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb) if (phydev && phydev->speed == SPEED_1000) { if (++adapter->tx_ring.since_irq == PARM_TX_NUM_BUFS_DEF) { /* Last element & Interrupt flag */ - desc[frag - 1].flags = 0x5; + desc[frag - 1].flags = TXDESC_FLAG_INTPROC | TXDESC_FLAG_LASTPKT; adapter->tx_ring.since_irq = 0; } else { /* Last element */ - desc[frag - 1].flags = 0x1; + desc[frag - 1].flags = TXDESC_FLAG_LASTPKT; } } else - desc[frag - 1].flags = 0x5; + desc[frag - 1].flags = TXDESC_FLAG_INTPROC | TXDESC_FLAG_LASTPKT; - desc[0].flags |= 2; /* First element flag */ + desc[0].flags |= TXDESC_FLAG_FIRSTPKT; tcb->index_start = adapter->tx_ring.send_idx; tcb->stale = 0; spin_lock_irqsave(&adapter->send_hw_lock, flags); - thiscopy = NUM_DESC_PER_RING_TX - - INDEX10(adapter->tx_ring.send_idx); + thiscopy = NUM_DESC_PER_RING_TX - INDEX10(adapter->tx_ring.send_idx); if (thiscopy >= frag) { remainder = 0; diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h index 9fa47f91a9f..bbe78a703a2 100644 --- a/drivers/staging/et131x/et131x.h +++ b/drivers/staging/et131x/et131x.h @@ -145,6 +145,8 @@ *31: selfclr_disable */ +#define ET_RESET_ALL 0x007F; + /* * SLV Timer reg at address 0x002C (low 24 bits) */ @@ -392,6 +394,8 @@ struct txdma_regs { /* Location: */ * 11-0: psr ndes */ +#define ET_RXDMA_PSR_NUM_DES_MASK 0xFFF; + /* * structure for packet status ring available offset reg in rxdma address map * located at address 0x202C @@ -567,6 +571,9 @@ struct rxdma_regs { /* Location: */ * 0: txmac_en */ +#define ET_TX_CTRL_FC_DISABLE 0x0008 +#define ET_TX_CTRL_TXMAC_ENABLE 0x0001 + /* * structure for shadow pointer reg in txmac address map * located at address 0x3004 @@ -682,6 +689,9 @@ struct txmac_regs { /* Location: */ * 0: rxmac_en */ +#define ET_RX_CTRL_WOL_DISABLE 0x0008 +#define ET_RX_CTRL_RXMAC_ENABLE 0x0001 + /* * structure for Wake On Lan Control and CRC 0 reg in rxmac address map * located at address 0x4004 @@ -723,9 +733,9 @@ struct txmac_regs { /* Location: */ * 7-0: sa6 */ -#define ET_WOL_LO_SA3_SHIFT 24 -#define ET_WOL_LO_SA4_SHIFT 16 -#define ET_WOL_LO_SA5_SHIFT 8 +#define ET_RX_WOL_LO_SA3_SHIFT 24 +#define ET_RX_WOL_LO_SA4_SHIFT 16 +#define ET_RX_WOL_LO_SA5_SHIFT 8 /* * structure for Wake On Lan Source Address Hi reg in rxmac address map @@ -736,7 +746,7 @@ struct txmac_regs { /* Location: */ * 7-0: sa2 */ -#define ET_WOL_HI_SA1_SHIFT 8 +#define ET_RX_WOL_HI_SA1_SHIFT 8 /* * structure for Wake On Lan mask reg in rxmac address map @@ -754,9 +764,9 @@ struct txmac_regs { /* Location: */ * 7-0: addr1_6 */ -#define ET_UNI_PF_ADDR1_3_SHIFT 24 -#define ET_UNI_PF_ADDR1_4_SHIFT 16 -#define ET_UNI_PF_ADDR1_5_SHIFT 8 +#define ET_RX_UNI_PF_ADDR1_3_SHIFT 24 +#define ET_RX_UNI_PF_ADDR1_4_SHIFT 16 +#define ET_RX_UNI_PF_ADDR1_5_SHIFT 8 /* * structure for Unicast Paket Filter Address 2 reg in rxmac address map @@ -768,9 +778,9 @@ struct txmac_regs { /* Location: */ * 7-0: addr2_6 */ -#define ET_UNI_PF_ADDR2_3_SHIFT 24 -#define ET_UNI_PF_ADDR2_4_SHIFT 16 -#define ET_UNI_PF_ADDR2_5_SHIFT 8 +#define ET_RX_UNI_PF_ADDR2_3_SHIFT 24 +#define ET_RX_UNI_PF_ADDR2_4_SHIFT 16 +#define ET_RX_UNI_PF_ADDR2_5_SHIFT 8 /* * structure for Unicast Paket Filter Address 1 & 2 reg in rxmac address map @@ -782,10 +792,9 @@ struct txmac_regs { /* Location: */ * 7-0: addr1_2 */ -#define ET_UNI_PF_ADDR2_1_SHIFT 24 -#define ET_UNI_PF_ADDR2_2_SHIFT 16 -#define ET_UNI_PF_ADDR1_1_SHIFT 8 - +#define ET_RX_UNI_PF_ADDR2_1_SHIFT 24 +#define ET_RX_UNI_PF_ADDR2_2_SHIFT 16 +#define ET_RX_UNI_PF_ADDR1_1_SHIFT 8 /* * structure for Multicast Hash reg in rxmac address map @@ -806,6 +815,12 @@ struct txmac_regs { /* Location: */ * 0: filter_broad_en */ +#define ET_RX_PFCTRL_MIN_PKT_SZ_SHIFT 16; +#define ET_RX_PFCTRL_FRAG_FILTER_ENABLE 0x0008; +#define ET_RX_PFCTRL_UNICST_FILTER_ENABLE 0x0004; +#define ET_RX_PFCTRL_MLTCST_FILTER_ENABLE 0x0002; +#define ET_RX_PFCTRL_BRDCST_FILTER_ENABLE 0x0001; + /* * structure for Memory Controller Interface Control Max Segment reg in rxmac * address map. Located at address 0x4088 @@ -816,6 +831,10 @@ struct txmac_regs { /* Location: */ * 0: seg_en */ +#define ET_RX_MCIF_CTRL_MAX_SEG_SIZE_SHIFT 2; +#define ET_RX_MCIF_CTRL_MAX_SEG_FC_ENABLE 0x0002; +#define ET_RX_MCIF_CTRL_MAX_SEG_ENABLE 0x0001; + /* * structure for Memory Controller Interface Water Mark reg in rxmac address * map. Located at address 0x408C @@ -915,7 +934,6 @@ struct rxmac_regs { /* Location: */ /* END OF RXMAC REGISTER ADDRESS MAP */ - /* START OF MAC REGISTER ADDRESS MAP */ /* @@ -940,12 +958,18 @@ struct rxmac_regs { /* Location: */ * 0: tx enable */ -#define CFG1_LOOPBACK 0x00000100 -#define CFG1_RX_FLOW 0x00000020 -#define CFG1_TX_FLOW 0x00000010 -#define CFG1_RX_ENABLE 0x00000004 -#define CFG1_TX_ENABLE 0x00000001 -#define CFG1_WAIT 0x0000000A /* RX & TX syncd */ +#define ET_MAC_CFG1_SOFT_RESET 0x80000000 +#define ET_MAC_CFG1_SIM_RESET 0x40000000 +#define ET_MAC_CFG1_RESET_RXMC 0x00080000 +#define ET_MAC_CFG1_RESET_TXMC 0x00040000 +#define ET_MAC_CFG1_RESET_RXFUNC 0x00020000 +#define ET_MAC_CFG1_RESET_TXFUNC 0x00010000 +#define ET_MAC_CFG1_LOOPBACK 0x00000100 +#define ET_MAC_CFG1_RX_FLOW 0x00000020 +#define ET_MAC_CFG1_TX_FLOW 0x00000010 +#define ET_MAC_CFG1_RX_ENABLE 0x00000004 +#define ET_MAC_CFG1_TX_ENABLE 0x00000001 +#define ET_MAC_CFG1_WAIT 0x0000000A /* RX & TX syncd */ /* * structure for configuration #2 reg in mac address map. @@ -963,6 +987,15 @@ struct rxmac_regs { /* Location: */ * 0: full duplex */ +#define ET_MAC_CFG2_PREAMBLE_SHIFT 12; +#define ET_MAC_CFG2_IFMODE_MASK 0x0300; +#define ET_MAC_CFG2_IFMODE_1000 0x0200; +#define ET_MAC_CFG2_IFMODE_100 0x0100; +#define ET_MAC_CFG2_IFMODE_HUGE_FRAME 0x0020; +#define ET_MAC_CFG2_IFMODE_LEN_CHECK 0x0010; +#define ET_MAC_CFG2_IFMODE_PAD_CRC 0x0004; +#define ET_MAC_CFG2_IFMODE_CRC_ENABLE 0x0002; +#define ET_MAC_CFG2_IFMODE_FULL_DPLX 0x0001; /* * structure for Interpacket gap reg in mac address map. @@ -1017,6 +1050,8 @@ struct rxmac_regs { /* Location: */ * 2-0: mgmt clock reset */ +#define ET_MAC_MIIMGMT_CLK_RST 0x0007 + /* * structure for MII Management Command reg in mac address map. * located at address 0x5024 @@ -1033,7 +1068,7 @@ struct rxmac_regs { /* Location: */ * 4-0: register */ -#define MII_ADDR(phy, reg) ((phy) << 8 | (reg)) +#define ET_MAC_MII_ADDR(phy, reg) ((phy) << 8 | (reg)) /* * structure for MII Management Control reg in mac address map. @@ -1049,6 +1084,8 @@ struct rxmac_regs { /* Location: */ * 15-0: phy control */ +#define ET_MAC_MIIMGMT_STAT_PHYCRTL_MASK 0xFFFF; + /* * structure for MII Management Indicators reg in mac address map. * located at address 0x5034 @@ -1058,8 +1095,8 @@ struct rxmac_regs { /* Location: */ * 0: busy */ -#define MGMT_BUSY 0x00000001 /* busy */ -#define MGMT_WAIT 0x00000005 /* busy | not valid */ +#define ET_MAC_MGMT_BUSY 0x00000001 /* busy */ +#define ET_MAC_MGMT_WAIT 0x00000005 /* busy | not valid */ /* * structure for Interface Control reg in mac address map. @@ -1084,6 +1121,9 @@ struct rxmac_regs { /* Location: */ * 0: enable jabber protection */ +#define ET_MAC_IFCTRL_GHDMODE (1 << 26) +#define ET_MAC_IFCTRL_PHYMODE (1 << 24) + /* * structure for Interface Status reg in mac address map. * located at address 0x503C -- cgit v1.2.3 From 6903098c169026f134455f4c41dd834f085e842d Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Sun, 13 Jan 2013 20:31:16 +0000 Subject: staging: et131x: Only configure regs if link state changes Some config regs get set whenever adjust_link() is called. Change this so that these registers only get set when the link state changes to UP. Also remove unnecessary second assignment of boot_coma. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 83 +++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 45 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index e2d555529c6..82508fb0d93 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -3819,46 +3819,6 @@ static void et131x_adjust_link(struct net_device *netdev) struct et131x_adapter *adapter = netdev_priv(netdev); struct phy_device *phydev = adapter->phydev; - if (netif_carrier_ok(netdev)) { - adapter->boot_coma = 20; - - if (phydev && phydev->speed == SPEED_10) { - /* - * NOTE - Is there a way to query this without - * TruePHY? - * && TRU_QueryCoreType(adapter->hTruePhy, 0)== - * EMI_TRUEPHY_A13O) { - */ - u16 register18; - - et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, - ®ister18); - et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, - register18 | 0x4); - et131x_mii_write(adapter, PHY_INDEX_REG, - register18 | 0x8402); - et131x_mii_write(adapter, PHY_DATA_REG, - register18 | 511); - et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, - register18); - } - - et1310_config_flow_control(adapter); - - if (phydev && phydev->speed == SPEED_1000 && - adapter->registry_jumbo_packet > 2048) { - u16 reg; - - et131x_mii_read(adapter, PHY_CONFIG, ®); - reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH; - reg |= ET_PHY_CONFIG_FIFO_DEPTH_32; - et131x_mii_write(adapter, PHY_CONFIG, reg); - } - - et131x_set_rx_dma_timer(adapter); - et1310_config_mac_regs2(adapter); - } - if (phydev && phydev->link != adapter->link) { /* * Check to see if we are in coma mode and if @@ -3868,11 +3828,47 @@ static void et131x_adjust_link(struct net_device *netdev) if (et1310_in_phy_coma(adapter)) et1310_disable_phy_coma(adapter); + adapter->link = phydev->link; + phy_print_status(phydev); + if (phydev->link) { adapter->boot_coma = 20; + if (phydev && phydev->speed == SPEED_10) { + /* + * NOTE - Is there a way to query this without + * TruePHY? + * && TRU_QueryCoreType(adapter->hTruePhy, 0)== + * EMI_TRUEPHY_A13O) { + */ + u16 register18; + + et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, + ®ister18); + et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, + register18 | 0x4); + et131x_mii_write(adapter, PHY_INDEX_REG, + register18 | 0x8402); + et131x_mii_write(adapter, PHY_DATA_REG, + register18 | 511); + et131x_mii_write(adapter, PHY_MPHY_CONTROL_REG, + register18); + } + + et1310_config_flow_control(adapter); + + if (phydev && phydev->speed == SPEED_1000 && + adapter->registry_jumbo_packet > 2048) { + u16 reg; + + et131x_mii_read(adapter, PHY_CONFIG, ®); + reg &= ~ET_PHY_CONFIG_TX_FIFO_DEPTH; + reg |= ET_PHY_CONFIG_FIFO_DEPTH_32; + et131x_mii_write(adapter, PHY_CONFIG, reg); + } + + et131x_set_rx_dma_timer(adapter); + et1310_config_mac_regs2(adapter); } else { - dev_warn(&adapter->pdev->dev, - "Link down - cable problem ?\n"); adapter->boot_coma = 0; if (phydev->speed == SPEED_10) { @@ -3917,9 +3913,6 @@ static void et131x_adjust_link(struct net_device *netdev) et131x_enable_txrx(netdev); } - adapter->link = phydev->link; - - phy_print_status(phydev); } } -- cgit v1.2.3 From c8b0a484ccf408cafa9e2ec6a2fad6701c8deec4 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Tue, 22 Jan 2013 14:29:47 +0000 Subject: staging: et131x: Fix endian bugs in et131x_get_regs() et131x_get_regs() calls et131x_mii_read(), passing the address of a u32 which is cast to a (u16 *). This works fine for little endian systems, but not for big endian. Change so that the types are cast, not pointers to the types. Reported-by: Dan Carpenter Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 97 ++++++++++++++++++++++++++--------------- 1 file changed, 61 insertions(+), 36 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 82508fb0d93..d2fbe910371 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -3456,6 +3456,7 @@ static void et131x_get_regs(struct net_device *netdev, struct address_map __iomem *aregs = adapter->regs; u32 *regs_buff = regs_data; u32 num = 0; + u16 tmp; memset(regs_data, 0, et131x_get_regs_len(netdev)); @@ -3463,44 +3464,68 @@ static void et131x_get_regs(struct net_device *netdev, adapter->pdev->device; /* PHY regs */ - et131x_mii_read(adapter, MII_BMCR, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_BMSR, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_PHYSID1, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_PHYSID2, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_ADVERTISE, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_LPA, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_EXPANSION, (u16 *)®s_buff[num++]); + et131x_mii_read(adapter, MII_BMCR, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_BMSR, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_PHYSID1, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_PHYSID2, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_ADVERTISE, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_LPA, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_EXPANSION, &tmp); + regs_buff[num++] = tmp; /* Autoneg next page transmit reg */ - et131x_mii_read(adapter, 0x07, (u16 *)®s_buff[num++]); + et131x_mii_read(adapter, 0x07, &tmp); + regs_buff[num++] = tmp; /* Link partner next page reg */ - et131x_mii_read(adapter, 0x08, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_CTRL1000, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_STAT1000, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, 0x0b, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, 0x0c, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_MMD_CTRL, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_MMD_DATA, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, MII_ESTATUS, (u16 *)®s_buff[num++]); - - et131x_mii_read(adapter, PHY_INDEX_REG, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_DATA_REG, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, - (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_LOOPBACK_CONTROL, - (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_LOOPBACK_CONTROL+1, - (u16 *)®s_buff[num++]); - - et131x_mii_read(adapter, PHY_REGISTER_MGMT_CONTROL, - (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_CONFIG, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_PHY_CONTROL, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_INTERRUPT_MASK, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_INTERRUPT_STATUS, - (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_PHY_STATUS, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_LED_1, (u16 *)®s_buff[num++]); - et131x_mii_read(adapter, PHY_LED_2, (u16 *)®s_buff[num++]); + et131x_mii_read(adapter, 0x08, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_CTRL1000, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_STAT1000, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, 0x0b, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, 0x0c, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_MMD_CTRL, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_MMD_DATA, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, MII_ESTATUS, &tmp); + regs_buff[num++] = tmp; + + et131x_mii_read(adapter, PHY_INDEX_REG, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_DATA_REG, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_MPHY_CONTROL_REG, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_LOOPBACK_CONTROL, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_LOOPBACK_CONTROL + 1, &tmp); + regs_buff[num++] = tmp; + + et131x_mii_read(adapter, PHY_REGISTER_MGMT_CONTROL, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_CONFIG, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_PHY_CONTROL, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_INTERRUPT_MASK, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_INTERRUPT_STATUS, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_PHY_STATUS, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_LED_1, &tmp); + regs_buff[num++] = tmp; + et131x_mii_read(adapter, PHY_LED_2, &tmp); + regs_buff[num++] = tmp; /* Global regs */ regs_buff[num++] = readl(&aregs->global.txq_start_addr); -- cgit v1.2.3 From c655dee9298c68739de2fa6c80f258b434156d42 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Tue, 22 Jan 2013 14:29:48 +0000 Subject: staging: et131x: Trivial camel case fixes Checkpatch now highlights some camel case flag names. Fix these issues. Also fix some remaining lines > 80chars issues for completeness. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 50 +++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 24 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index d2fbe910371..7adf0af9d0d 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -139,19 +139,19 @@ MODULE_DESCRIPTION("10/100/1000 Base-T Ethernet Driver for the ET1310 by Agere S #define NIC_SEND_HANG_THRESHOLD 0 /* MP_TCB flags */ -#define fMP_DEST_MULTI 0x00000001 -#define fMP_DEST_BROAD 0x00000002 +#define FMP_DEST_MULTI 0x00000001 +#define FMP_DEST_BROAD 0x00000002 /* MP_ADAPTER flags */ -#define fMP_ADAPTER_INTERRUPT_IN_USE 0x00000008 +#define FMP_ADAPTER_INTERRUPT_IN_USE 0x00000008 /* MP_SHARED flags */ -#define fMP_ADAPTER_LOWER_POWER 0x00200000 +#define FMP_ADAPTER_LOWER_POWER 0x00200000 -#define fMP_ADAPTER_NON_RECOVER_ERROR 0x00800000 -#define fMP_ADAPTER_HARDWARE_ERROR 0x04000000 +#define FMP_ADAPTER_NON_RECOVER_ERROR 0x00800000 +#define FMP_ADAPTER_HARDWARE_ERROR 0x04000000 -#define fMP_ADAPTER_FAIL_SEND_MASK 0x3ff00000 +#define FMP_ADAPTER_FAIL_SEND_MASK 0x3ff00000 /* Some offsets in PCI config space that are actually used. */ #define ET1310_PCI_MAC_ADDRESS 0xA4 @@ -1062,7 +1062,7 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) writel(ctl, &adapter->regs->txmac.ctl); /* Ready to start the RXDMA/TXDMA engine */ - if (adapter->flags & fMP_ADAPTER_LOWER_POWER) { + if (adapter->flags & FMP_ADAPTER_LOWER_POWER) { et131x_rx_dma_enable(adapter); et131x_tx_dma_enable(adapter); } @@ -2068,7 +2068,7 @@ static void et131x_enable_txrx(struct net_device *netdev) et131x_tx_dma_enable(adapter); /* Enable device interrupts */ - if (adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE) + if (adapter->flags & FMP_ADAPTER_INTERRUPT_IN_USE) et131x_enable_interrupts(adapter); /* We're ready to move some data, so start the queue */ @@ -2167,7 +2167,7 @@ static void et1310_enable_phy_coma(struct et131x_adapter *adapter) /* Stop sending packets. */ spin_lock_irqsave(&adapter->send_hw_lock, flags); - adapter->flags |= fMP_ADAPTER_LOWER_POWER; + adapter->flags |= FMP_ADAPTER_LOWER_POWER; spin_unlock_irqrestore(&adapter->send_hw_lock, flags); /* Wait for outstanding Receive packets */ @@ -2220,7 +2220,7 @@ static void et1310_disable_phy_coma(struct et131x_adapter *adapter) et131x_adapter_setup(adapter); /* Allow Tx to restart */ - adapter->flags &= ~fMP_ADAPTER_LOWER_POWER; + adapter->flags &= ~FMP_ADAPTER_LOWER_POWER; et131x_enable_txrx(adapter->netdev); } @@ -3041,13 +3041,15 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb) if (phydev && phydev->speed == SPEED_1000) { if (++adapter->tx_ring.since_irq == PARM_TX_NUM_BUFS_DEF) { /* Last element & Interrupt flag */ - desc[frag - 1].flags = TXDESC_FLAG_INTPROC | TXDESC_FLAG_LASTPKT; + desc[frag - 1].flags = + TXDESC_FLAG_INTPROC | TXDESC_FLAG_LASTPKT; adapter->tx_ring.since_irq = 0; } else { /* Last element */ desc[frag - 1].flags = TXDESC_FLAG_LASTPKT; } } else - desc[frag - 1].flags = TXDESC_FLAG_INTPROC | TXDESC_FLAG_LASTPKT; + desc[frag - 1].flags = + TXDESC_FLAG_INTPROC | TXDESC_FLAG_LASTPKT; desc[0].flags |= TXDESC_FLAG_FIRSTPKT; @@ -3168,9 +3170,9 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *adapter) if ((shbufva[0] == 0xffff) && (shbufva[1] == 0xffff) && (shbufva[2] == 0xffff)) { - tcb->flags |= fMP_DEST_BROAD; + tcb->flags |= FMP_DEST_BROAD; } else if ((shbufva[0] & 0x3) == 0x0001) { - tcb->flags |= fMP_DEST_MULTI; + tcb->flags |= FMP_DEST_MULTI; } } @@ -3225,7 +3227,7 @@ static int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) /* We need to see if the link is up; if it's not, make the * netif layer think we're good and drop the packet */ - if ((adapter->flags & fMP_ADAPTER_FAIL_SEND_MASK) || + if ((adapter->flags & FMP_ADAPTER_FAIL_SEND_MASK) || !netif_carrier_ok(netdev)) { dev_kfree_skb_any(skb); skb = NULL; @@ -3262,9 +3264,9 @@ static inline void free_send_packet(struct et131x_adapter *adapter, struct net_device_stats *stats = &adapter->net_stats; u64 dma_addr; - if (tcb->flags & fMP_DEST_BROAD) + if (tcb->flags & FMP_DEST_BROAD) atomic_inc(&adapter->stats.broadcast_pkts_xmtd); - else if (tcb->flags & fMP_DEST_MULTI) + else if (tcb->flags & FMP_DEST_MULTI) atomic_inc(&adapter->stats.multicast_pkts_xmtd); else atomic_inc(&adapter->stats.unicast_pkts_xmtd); @@ -4351,7 +4353,7 @@ static void et131x_isr_handler(struct work_struct *work) * to do is disable the interrupts and set the flag to cause us * to reset so we can solve this issue. */ - /* MP_SET_FLAG( adapter, fMP_ADAPTER_HARDWARE_ERROR); */ + /* MP_SET_FLAG( adapter, FMP_ADAPTER_HARDWARE_ERROR); */ dev_warn(&adapter->pdev->dev, "RXMAC interrupt, error 0x%08x. Requesting reset\n", @@ -4466,7 +4468,7 @@ static int et131x_open(struct net_device *netdev) return result; } - adapter->flags |= fMP_ADAPTER_INTERRUPT_IN_USE; + adapter->flags |= FMP_ADAPTER_INTERRUPT_IN_USE; et131x_up(netdev); @@ -4485,7 +4487,7 @@ static int et131x_close(struct net_device *netdev) et131x_down(netdev); - adapter->flags &= ~fMP_ADAPTER_INTERRUPT_IN_USE; + adapter->flags &= ~FMP_ADAPTER_INTERRUPT_IN_USE; free_irq(adapter->pdev->irq, netdev); /* Stop the error timer */ @@ -4695,17 +4697,17 @@ static void et131x_tx_timeout(struct net_device *netdev) unsigned long flags; /* If the device is closed, ignore the timeout */ - if (~(adapter->flags & fMP_ADAPTER_INTERRUPT_IN_USE)) + if (~(adapter->flags & FMP_ADAPTER_INTERRUPT_IN_USE)) return; /* Any nonrecoverable hardware error? * Checks adapter->flags for any failure in phy reading */ - if (adapter->flags & fMP_ADAPTER_NON_RECOVER_ERROR) + if (adapter->flags & FMP_ADAPTER_NON_RECOVER_ERROR) return; /* Hardware failure? */ - if (adapter->flags & fMP_ADAPTER_HARDWARE_ERROR) { + if (adapter->flags & FMP_ADAPTER_HARDWARE_ERROR) { dev_err(&adapter->pdev->dev, "hardware error - reset\n"); return; } -- cgit v1.2.3 From 26ef1021c1c7ba62a2790296546945022468e17d Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Tue, 22 Jan 2013 14:29:49 +0000 Subject: staging: et131x: Modify block comments to fit with networking style In preparation for moving et131x to drivers/net, fixup the block comments to match the preferred networking style - no /* on separate line, but */ are on a seperate line. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 370 ++++++++++++++-------------------------- 1 file changed, 132 insertions(+), 238 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 7adf0af9d0d..e38d7014e6c 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -1,5 +1,4 @@ -/* - * Agere Systems Inc. +/* Agere Systems Inc. * 10/100/1000 Base-T Ethernet Driver for the ET1301 and ET131x series MACs * * Copyright © 2005 Agere Systems Inc. @@ -50,7 +49,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. - * */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt @@ -102,8 +100,7 @@ MODULE_DESCRIPTION("10/100/1000 Base-T Ethernet Driver for the ET1310 by Agere S #define INTERNAL_MEM_RX_OFFSET 0x1FF /* 50% Tx, 50% Rx */ /* ISR defines */ -/* - * For interrupts, normal running is: +/* For interrupts, normal running is: * rxdma_xfr_done, phy_interrupt, mac_stat_interrupt, * watchdog_interrupt & txdma_xfer_done * @@ -245,8 +242,7 @@ struct pkt_stat_desc { /* Typedefs for the RX DMA status word */ -/* - * rx status word 0 holds part of the status bits of the Rx DMA engine +/* rx status word 0 holds part of the status bits of the Rx DMA engine * that get copied out to memory by the ET-1310. Word 0 is a 32 bit word * which contains the Free Buffer ring 0 and 1 available offset. * @@ -256,8 +252,7 @@ struct pkt_stat_desc { * bit 26 Wrap flag for FBR0 */ -/* - * RXSTAT_WORD1_t structure holds part of the status bits of the Rx DMA engine +/* RXSTAT_WORD1_t structure holds part of the status bits of the Rx DMA engine * that get copied out to memory by the ET-1310. Word 3 is a 32 bit word * which contains the Packet Status Ring available offset. * @@ -267,8 +262,7 @@ struct pkt_stat_desc { * bit 29-31 unused */ -/* - * struct rx_status_block is a structure representing the status of the Rx +/* struct rx_status_block is a structure representing the status of the Rx * DMA engine it sits in free memory, and is pointed to by 0x101c / 0x1020 */ struct rx_status_block { @@ -276,8 +270,7 @@ struct rx_status_block { u32 word1; }; -/* - * Structure for look-up table holding free buffer ring pointers, addresses +/* Structure for look-up table holding free buffer ring pointers, addresses * and state. */ struct fbr_lookup { @@ -293,8 +286,7 @@ struct fbr_lookup { dma_addr_t buffsize; }; -/* - * struct rx_ring is the sructure representing the adaptor's local +/* struct rx_ring is the sructure representing the adaptor's local * reference(s) to the rings */ struct rx_ring { @@ -317,8 +309,7 @@ struct rx_ring { }; /* TX defines */ -/* - * word 2 of the control bits in the Tx Descriptor ring for the ET-1310 +/* word 2 of the control bits in the Tx Descriptor ring for the ET-1310 * * 0-15: length of packet * 16-27: VLAN tag @@ -356,8 +347,7 @@ struct tx_desc { u32 flags; /* data (detailed above) */ }; -/* - * The status of the Tx DMA engine it sits in free memory, and is pointed to +/* The status of the Tx DMA engine it sits in free memory, and is pointed to * by 0x101c / 0x1020. This is a DMA10 type */ @@ -406,15 +396,13 @@ struct tx_ring { int since_irq; }; -/* - * Do not change these values: if changed, then change also in respective +/* Do not change these values: if changed, then change also in respective * TXdma and Rxdma engines */ #define NUM_DESC_PER_RING_TX 512 /* TX Do not change these values */ #define NUM_TCB 64 -/* - * These values are all superseded by registry entries to facilitate tuning. +/* These values are all superseded by registry entries to facilitate tuning. * Once the desired performance has been achieved, the optimal registry values * should be re-populated to these #defines: */ @@ -559,8 +547,7 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) u32 reg; int i; - /* - * 1. Check LBCIF Status Register for bits 6 & 3:2 all equal to 0 and + /* 1. Check LBCIF Status Register for bits 6 & 3:2 all equal to 0 and * bits 7,1:0 both equal to 1, at least once after reset. * Subsequent operations need only to check that bits 1:0 are equal * to 1 prior to starting a single byte read/write @@ -581,8 +568,7 @@ static int eeprom_wait_ready(struct pci_dev *pdev, u32 *status) return -ETIMEDOUT; } -/** - * eeprom_write - Write a byte to the ET1310's EEPROM +/* eeprom_write - Write a byte to the ET1310's EEPROM * @adapter: pointer to our private adapter structure * @addr: the address to write * @data: the value to write @@ -600,8 +586,7 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) u32 status; u32 val = 0; - /* - * For an EEPROM, an I2C single byte write is defined as a START + /* For an EEPROM, an I2C single byte write is defined as a START * condition followed by the device address, EEPROM address, one byte * of data and a STOP condition. The STOP condition will trigger the * EEPROM's internally timed write cycle to the nonvolatile memory. @@ -613,12 +598,11 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) if (err) return err; - /* - * 2. Write to the LBCIF Control Register: bit 7=1, bit 6=1, bit 3=0, - * and bits 1:0 both =0. Bit 5 should be set according to the - * type of EEPROM being accessed (1=two byte addressing, 0=one - * byte addressing). - */ + /* 2. Write to the LBCIF Control Register: bit 7=1, bit 6=1, bit 3=0, + * and bits 1:0 both =0. Bit 5 should be set according to the + * type of EEPROM being accessed (1=two byte addressing, 0=one + * byte addressing). + */ if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER, LBCIF_CONTROL_LBCIF_ENABLE | LBCIF_CONTROL_I2C_WRITE)) return -EIO; @@ -631,14 +615,12 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) /* Write the address to the LBCIF Address Register */ if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER, addr)) break; - /* - * Write the data to the LBCIF Data Register (the I2C write + /* Write the data to the LBCIF Data Register (the I2C write * will begin). */ if (pci_write_config_byte(pdev, LBCIF_DATA_REGISTER, data)) break; - /* - * Monitor bit 1:0 of the LBCIF Status Register. When bits + /* Monitor bit 1:0 of the LBCIF Status Register. When bits * 1:0 are both equal to 1, the I2C write has completed and the * internal write cycle of the EEPROM is about to start. * (bits 1:0 = 01 is a legal state while waiting from both @@ -649,8 +631,7 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) if (err < 0) return 0; - /* - * Check bit 3 of the LBCIF Status Register. If equal to 1, + /* Check bit 3 of the LBCIF Status Register. If equal to 1, * an error has occurred.Don't break here if we are revision * 1, this is so we do a blind write for load bug. */ @@ -658,8 +639,7 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) && adapter->pdev->revision == 0) break; - /* - * Check bit 2 of the LBCIF Status Register. If equal to 1 an + /* Check bit 2 of the LBCIF Status Register. If equal to 1 an * ACK error has occurred on the address phase of the write. * This could be due to an actual hardware failure or the * EEPROM may still be in its internal write cycle from a @@ -667,8 +647,7 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) *repeated later. */ if (status & LBCIF_STATUS_ACK_ERROR) { - /* - * This could be due to an actual hardware failure + /* This could be due to an actual hardware failure * or the EEPROM may still be in its internal write * cycle from a previous write. This write operation * was ignored and must be repeated later. @@ -681,8 +660,7 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) break; } - /* - * Set bit 6 of the LBCIF Control Register = 0. + /* Set bit 6 of the LBCIF Control Register = 0. */ udelay(10); @@ -711,8 +689,7 @@ static int eeprom_write(struct et131x_adapter *adapter, u32 addr, u8 data) return writeok ? 0 : -EIO; } -/** - * eeprom_read - Read a byte from the ET1310's EEPROM +/* eeprom_read - Read a byte from the ET1310's EEPROM * @adapter: pointer to our private adapter structure * @addr: the address from which to read * @pdata: a pointer to a byte in which to store the value of the read @@ -727,16 +704,14 @@ static int eeprom_read(struct et131x_adapter *adapter, u32 addr, u8 *pdata) int err; u32 status; - /* - * A single byte read is similar to the single byte write, with the + /* A single byte read is similar to the single byte write, with the * exception of the data flow: */ err = eeprom_wait_ready(pdev, NULL); if (err) return err; - /* - * Write to the LBCIF Control Register: bit 7=1, bit 6=0, bit 3=0, + /* Write to the LBCIF Control Register: bit 7=1, bit 6=0, bit 3=0, * and bits 1:0 both =0. Bit 5 should be set according to the type * of EEPROM being accessed (1=two byte addressing, 0=one byte * addressing). @@ -744,27 +719,23 @@ static int eeprom_read(struct et131x_adapter *adapter, u32 addr, u8 *pdata) if (pci_write_config_byte(pdev, LBCIF_CONTROL_REGISTER, LBCIF_CONTROL_LBCIF_ENABLE)) return -EIO; - /* - * Write the address to the LBCIF Address Register (I2C read will + /* Write the address to the LBCIF Address Register (I2C read will * begin). */ if (pci_write_config_dword(pdev, LBCIF_ADDRESS_REGISTER, addr)) return -EIO; - /* - * Monitor bit 0 of the LBCIF Status Register. When = 1, I2C read + /* Monitor bit 0 of the LBCIF Status Register. When = 1, I2C read * is complete. (if bit 1 =1 and bit 0 stays = 0, a hardware failure * has occurred). */ err = eeprom_wait_ready(pdev, &status); if (err < 0) return err; - /* - * Regardless of error status, read data byte from LBCIF Data + /* Regardless of error status, read data byte from LBCIF Data * Register. */ *pdata = err; - /* - * Check bit 2 of the LBCIF Status Register. If = 1, + /* Check bit 2 of the LBCIF Status Register. If = 1, * then an error has occurred. */ return (status & LBCIF_STATUS_ACK_ERROR) ? -EIO : 0; @@ -838,8 +809,7 @@ static int et131x_init_eeprom(struct et131x_adapter *adapter) return 0; } -/** - * et131x_rx_dma_enable - re-start of Rx_DMA on the ET1310. +/* et131x_rx_dma_enable - re-start of Rx_DMA on the ET1310. * @adapter: pointer to our adapter structure */ static void et131x_rx_dma_enable(struct et131x_adapter *adapter) @@ -875,8 +845,7 @@ static void et131x_rx_dma_enable(struct et131x_adapter *adapter) } } -/** - * et131x_rx_dma_disable - Stop of Rx_DMA on the ET1310 +/* et131x_rx_dma_disable - Stop of Rx_DMA on the ET1310 * @adapter: pointer to our adapter structure */ static void et131x_rx_dma_disable(struct et131x_adapter *adapter) @@ -896,8 +865,7 @@ static void et131x_rx_dma_disable(struct et131x_adapter *adapter) } } -/** - * et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310. +/* et131x_tx_dma_enable - re-start of Tx_DMA on the ET1310. * @adapter: pointer to our adapter structure * * Mainly used after a return to the D0 (full-power) state from a lower state. @@ -921,8 +889,7 @@ static inline void add_12bit(u32 *v, int n) *v = INDEX12(*v + n) | (*v & ET_DMA12_WRAP); } -/** - * et1310_config_mac_regs1 - Initialize the first part of MAC regs +/* et1310_config_mac_regs1 - Initialize the first part of MAC regs * @adapter: pointer to our adapter structure */ static void et1310_config_mac_regs1(struct et131x_adapter *adapter) @@ -984,8 +951,7 @@ static void et1310_config_mac_regs1(struct et131x_adapter *adapter) writel(0, ¯egs->cfg1); } -/** - * et1310_config_mac_regs2 - Initialize the second part of MAC regs +/* et1310_config_mac_regs2 - Initialize the second part of MAC regs * @adapter: pointer to our adapter structure */ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) @@ -1026,7 +992,8 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) /* Now we need to initialize the MAC Configuration 2 register */ /* preamble 7, check length, huge frame off, pad crc, crc enable - full duplex off */ + * full duplex off + */ cfg2 |= 0x7 << ET_MAC_CFG2_PREAMBLE_SHIFT; cfg2 |= ET_MAC_CFG2_IFMODE_LEN_CHECK; cfg2 |= ET_MAC_CFG2_IFMODE_PAD_CRC; @@ -1068,8 +1035,7 @@ static void et1310_config_mac_regs2(struct et131x_adapter *adapter) } } -/** - * et1310_in_phy_coma - check if the device is in phy coma +/* et1310_in_phy_coma - check if the device is in phy coma * @adapter: pointer to our adapter structure * * Returns 0 if the device is not in phy coma, 1 if it is in phy coma @@ -1383,8 +1349,7 @@ static void et1310_config_macstat_regs(struct et131x_adapter *adapter) writel(0xFFFE7E8B, &macstat->carry_reg2_mask); } -/** - * et131x_phy_mii_read - Read from the PHY through the MII Interface on the MAC +/* et131x_phy_mii_read - Read from the PHY through the MII Interface on the MAC * @adapter: pointer to our private adapter structure * @addr: the address of the transceiver * @reg: the register to read @@ -1433,7 +1398,8 @@ static int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 addr, } /* If we hit here we were able to read the register and we need to - * return the value to the caller */ + * return the value to the caller + */ *value = readl(&mac->mii_mgmt_stat) & ET_MAC_MIIMGMT_STAT_PHYCRTL_MASK; /* Stop the read operation */ @@ -1458,8 +1424,7 @@ static int et131x_mii_read(struct et131x_adapter *adapter, u8 reg, u16 *value) return et131x_phy_mii_read(adapter, phydev->addr, reg, value); } -/** - * et131x_mii_write - Write to a PHY register through the MII interface of the MAC +/* et131x_mii_write - Write to a PHY reg through the MII interface of the MAC * @adapter: pointer to our private adapter structure * @reg: the register to read * @value: 16-bit value to write @@ -1523,8 +1488,7 @@ static int et131x_mii_write(struct et131x_adapter *adapter, u8 reg, u16 value) /* Stop the write operation */ writel(0, &mac->mii_mgmt_cmd); - /* - * set the registers we touched back to the state at which we entered + /* set the registers we touched back to the state at which we entered * this function */ writel(mii_addr, &mac->mii_mgmt_addr); @@ -1590,7 +1554,8 @@ static void et1310_config_flow_control(struct et131x_adapter *adapter) (remote_async_pause == TRUEPHY_BIT_CLEAR)) { adapter->flowcontrol = FLOW_NONE; } else {/* if (remote_pause == TRUEPHY_CLEAR_BIT && - remote_async_pause == TRUEPHY_SET_BIT) */ + * remote_async_pause == TRUEPHY_SET_BIT) + */ if (adapter->wanted_flow == FLOW_BOTH) adapter->flowcontrol = FLOW_RXONLY; else @@ -1599,8 +1564,7 @@ static void et1310_config_flow_control(struct et131x_adapter *adapter) } } -/** - * et1310_update_macstat_host_counters - Update the local copy of the statistics +/* et1310_update_macstat_host_counters - Update the local copy of the statistics * @adapter: pointer to the adapter structure */ static void et1310_update_macstat_host_counters(struct et131x_adapter *adapter) @@ -1627,8 +1591,7 @@ static void et1310_update_macstat_host_counters(struct et131x_adapter *adapter) stats->rx_other_errs += readl(&macstat->rx_fragment_packets); } -/** - * et1310_handle_macstat_interrupt +/* et1310_handle_macstat_interrupt * @adapter: pointer to the adapter structure * * One of the MACSTAT counters has wrapped. Update the local copy of @@ -1719,8 +1682,7 @@ static int et131x_mdio_reset(struct mii_bus *bus) return 0; } -/** - * et1310_phy_power_down - PHY power control +/* et1310_phy_power_down - PHY power control * @adapter: device to control * @down: true for off/false for back on * @@ -1740,8 +1702,7 @@ static void et1310_phy_power_down(struct et131x_adapter *adapter, bool down) et131x_mii_write(adapter, MII_BMCR, data); } -/** - * et131x_xcvr_init - Init the phy if we are setting it into force mode +/* et131x_xcvr_init - Init the phy if we are setting it into force mode * @adapter: pointer to our private adapter structure * */ @@ -1772,8 +1733,7 @@ static void et131x_xcvr_init(struct et131x_adapter *adapter) } } -/** - * et131x_configure_global_regs - configure JAGCore global regs +/* et131x_configure_global_regs - configure JAGCore global regs * @adapter: pointer to our adapter structure * * Used to configure the global registers on the JAGCore @@ -1819,8 +1779,7 @@ static void et131x_configure_global_regs(struct et131x_adapter *adapter) writel(0, ®s->watchdog_timer); } -/** - * et131x_config_rx_dma_regs - Start of Rx_DMA init sequence +/* et131x_config_rx_dma_regs - Start of Rx_DMA init sequence * @adapter: pointer to our adapter structure */ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) @@ -1927,8 +1886,7 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) spin_unlock_irqrestore(&adapter->rcv_lock, flags); } -/** - * et131x_config_tx_dma_regs - Set up the tx dma section of the JAGCore. +/* et131x_config_tx_dma_regs - Set up the tx dma section of the JAGCore. * @adapter: pointer to our private adapter structure * * Configure the transmit engine with the ring buffers we have created @@ -1959,8 +1917,7 @@ static void et131x_config_tx_dma_regs(struct et131x_adapter *adapter) adapter->tx_ring.send_idx = 0; } -/** - * et131x_adapter_setup - Set the adapter up as per cassini+ documentation +/* et131x_adapter_setup - Set the adapter up as per cassini+ documentation * @adapter: pointer to our private adapter structure * * Returns 0 on success, errno on failure (as defined in errno.h) @@ -1988,8 +1945,7 @@ static void et131x_adapter_setup(struct et131x_adapter *adapter) et131x_xcvr_init(adapter); } -/** - * et131x_soft_reset - Issue a soft reset to the hardware, complete for ET1310 +/* et131x_soft_reset - Issue a soft reset to the hardware, complete for ET1310 * @adapter: pointer to our private adapter structure */ static void et131x_soft_reset(struct et131x_adapter *adapter) @@ -2011,8 +1967,7 @@ static void et131x_soft_reset(struct et131x_adapter *adapter) writel(0, &adapter->regs->mac.cfg1); } -/** - * et131x_enable_interrupts - enable interrupt +/* et131x_enable_interrupts - enable interrupt * @adapter: et131x device * * Enable the appropriate interrupts on the ET131x according to our @@ -2032,8 +1987,7 @@ static void et131x_enable_interrupts(struct et131x_adapter *adapter) writel(mask, &adapter->regs->global.int_mask); } -/** - * et131x_disable_interrupts - interrupt disable +/* et131x_disable_interrupts - interrupt disable * @adapter: et131x device * * Block all interrupts from the et131x device at the device itself @@ -2044,8 +1998,7 @@ static void et131x_disable_interrupts(struct et131x_adapter *adapter) writel(INT_MASK_DISABLE, &adapter->regs->global.int_mask); } -/** - * et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310 +/* et131x_tx_dma_disable - Stop of Tx_DMA on the ET1310 * @adapter: pointer to our adapter structure */ static void et131x_tx_dma_disable(struct et131x_adapter *adapter) @@ -2055,8 +2008,7 @@ static void et131x_tx_dma_disable(struct et131x_adapter *adapter) &adapter->regs->txdma.csr); } -/** - * et131x_enable_txrx - Enable tx/rx queues +/* et131x_enable_txrx - Enable tx/rx queues * @netdev: device to be enabled */ static void et131x_enable_txrx(struct net_device *netdev) @@ -2075,8 +2027,7 @@ static void et131x_enable_txrx(struct net_device *netdev) netif_start_queue(netdev); } -/** - * et131x_disable_txrx - Disable tx/rx queues +/* et131x_disable_txrx - Disable tx/rx queues * @netdev: device to be disabled */ static void et131x_disable_txrx(struct net_device *netdev) @@ -2094,8 +2045,7 @@ static void et131x_disable_txrx(struct net_device *netdev) et131x_disable_interrupts(adapter); } -/** - * et131x_init_send - Initialize send data structures +/* et131x_init_send - Initialize send data structures * @adapter: pointer to our private adapter structure */ static void et131x_init_send(struct et131x_adapter *adapter) @@ -2128,8 +2078,7 @@ static void et131x_init_send(struct et131x_adapter *adapter) tx_ring->send_tail = NULL; } -/** - * et1310_enable_phy_coma - called when network cable is unplugged +/* et1310_enable_phy_coma - called when network cable is unplugged * @adapter: pointer to our adapter structure * * driver receive an phy status change interrupt while in D0 and check that @@ -2158,8 +2107,7 @@ static void et1310_enable_phy_coma(struct et131x_adapter *adapter) /* Save the GbE PHY speed and duplex modes. Need to restore this * when cable is plugged back in */ - /* - * TODO - when PM is re-enabled, check if we need to + /* TODO - when PM is re-enabled, check if we need to * perform a similar task as this - * adapter->pdown_speed = adapter->ai_force_speed; * adapter->pdown_duplex = adapter->ai_force_duplex; @@ -2183,8 +2131,7 @@ static void et1310_enable_phy_coma(struct et131x_adapter *adapter) writel(pmcsr, &adapter->regs->global.pm_csr); } -/** - * et1310_disable_phy_coma - Disable the Phy Coma Mode +/* et1310_disable_phy_coma - Disable the Phy Coma Mode * @adapter: pointer to our adapter structure */ static void et1310_disable_phy_coma(struct et131x_adapter *adapter) @@ -2230,9 +2177,10 @@ static inline u32 bump_free_buff_ring(u32 *free_buff_ring, u32 limit) u32 tmp_free_buff_ring = *free_buff_ring; tmp_free_buff_ring++; /* This works for all cases where limit < 1024. The 1023 case - works because 1023++ is 1024 which means the if condition is not - taken but the carry of the bit into the wrap bit toggles the wrap - value correctly */ + * works because 1023++ is 1024 which means the if condition is not + * taken but the carry of the bit into the wrap bit toggles the wrap + * value correctly + */ if ((tmp_free_buff_ring & ET_DMA10_MASK) > limit) { tmp_free_buff_ring &= ~ET_DMA10_MASK; tmp_free_buff_ring ^= ET_DMA10_WRAP; @@ -2243,8 +2191,7 @@ static inline u32 bump_free_buff_ring(u32 *free_buff_ring, u32 limit) return tmp_free_buff_ring; } -/** - * et131x_rx_dma_memory_alloc +/* et131x_rx_dma_memory_alloc * @adapter: pointer to our private adapter structure * * Returns 0 on success and errno on failure (as defined in errno.h) @@ -2384,8 +2331,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) pr_info("Packet Status Ring %llx\n", (unsigned long long) rx_ring->ps_ring_physaddr); - /* - * NOTE : dma_alloc_coherent(), used above to alloc DMA regions, + /* NOTE : dma_alloc_coherent(), used above to alloc DMA regions, * ALWAYS returns SAC (32-bit) addresses. If DAC (64-bit) addresses * are ever returned, make sure the high part is retrieved here before * storing the adjusted address. @@ -2411,8 +2357,7 @@ static int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) return 0; } -/** - * et131x_rx_dma_memory_free - Free all memory allocated within this module. +/* et131x_rx_dma_memory_free - Free all memory allocated within this module. * @adapter: pointer to our private adapter structure */ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) @@ -2499,8 +2444,7 @@ static void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) rx_ring->num_ready_recv = 0; } -/** - * et131x_init_recv - Initialize receive data structures. +/* et131x_init_recv - Initialize receive data structures. * @adapter: pointer to our private adapter structure * * Returns 0 on success and errno on failure (as defined in errno.h) @@ -2537,8 +2481,7 @@ static int et131x_init_recv(struct et131x_adapter *adapter) return 0; } -/** - * et131x_set_rx_dma_timer - Set the heartbeat timer according to line rate. +/* et131x_set_rx_dma_timer - Set the heartbeat timer according to line rate. * @adapter: pointer to our adapter structure */ static void et131x_set_rx_dma_timer(struct et131x_adapter *adapter) @@ -2557,8 +2500,7 @@ static void et131x_set_rx_dma_timer(struct et131x_adapter *adapter) } } -/** - * NICReturnRFD - Recycle a RFD and put it back onto the receive list +/* NICReturnRFD - Recycle a RFD and put it back onto the receive list * @adapter: pointer to our adapter * @rfd: pointer to the RFD */ @@ -2618,8 +2560,7 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) WARN_ON(rx_local->num_ready_recv > rx_local->num_rfd); } -/** - * nic_rx_pkts - Checks the hardware for available packets +/* nic_rx_pkts - Checks the hardware for available packets * @adapter: pointer to our adapter * * Returns rfd, a pointer to our MPRFD. @@ -2802,8 +2743,7 @@ out: return rfd; } -/** - * et131x_handle_recv_interrupt - Interrupt handler for receive processing +/* et131x_handle_recv_interrupt - Interrupt handler for receive processing * @adapter: pointer to our adapter * * Assumption, Rcv spinlock has been acquired. @@ -2857,8 +2797,7 @@ static void et131x_handle_recv_interrupt(struct et131x_adapter *adapter) adapter->rx_ring.unfinished_receives = false; } -/** - * et131x_tx_dma_memory_alloc +/* et131x_tx_dma_memory_alloc * @adapter: pointer to our private adapter structure * * Returns 0 on success and errno on failure (as defined in errno.h). @@ -2914,8 +2853,7 @@ static int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) return 0; } -/** - * et131x_tx_dma_memory_free - Free all memory allocated within this module +/* et131x_tx_dma_memory_free - Free all memory allocated within this module * @adapter: pointer to our private adapter structure * * Returns 0 on success and errno on failure (as defined in errno.h). @@ -2947,8 +2885,7 @@ static void et131x_tx_dma_memory_free(struct et131x_adapter *adapter) kfree(adapter->tx_ring.tcb_ring); } -/** - * nic_send_packet - NIC specific send handler for version B silicon. +/* nic_send_packet - NIC specific send handler for version B silicon. * @adapter: pointer to our adapter * @tcb: pointer to struct tcb * @@ -2996,7 +2933,8 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb) */ if (skb_headlen(skb) <= 1514) { /* Low 16bits are length, high is vlan and - unused currently so zero */ + * unused currently so zero + */ desc[frag].len_vlan = skb_headlen(skb); dma_addr = dma_map_single(&adapter->pdev->dev, skb->data, @@ -3126,8 +3064,7 @@ static int nic_send_packet(struct et131x_adapter *adapter, struct tcb *tcb) return 0; } -/** - * send_packet - Do the work to send a packet +/* send_packet - Do the work to send a packet * @skb: the packet(s) to send * @adapter: a pointer to the device's private adapter structure * @@ -3198,8 +3135,7 @@ static int send_packet(struct sk_buff *skb, struct et131x_adapter *adapter) return 0; } -/** - * et131x_send_packets - This function is called by the OS to send packets +/* et131x_send_packets - This function is called by the OS to send packets * @skb: the packet(s) to send * @netdev:device on which to TX the above packet(s) * @@ -3248,8 +3184,7 @@ static int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev) return status; } -/** - * free_send_packet - Recycle a struct tcb +/* free_send_packet - Recycle a struct tcb * @adapter: pointer to our adapter * @tcb: pointer to struct tcb * @@ -3321,8 +3256,7 @@ static inline void free_send_packet(struct et131x_adapter *adapter, WARN_ON(adapter->tx_ring.used < 0); } -/** - * et131x_free_busy_send_packets - Free and complete the stopped active sends +/* et131x_free_busy_send_packets - Free and complete the stopped active sends * @adapter: pointer to our adapter * * Assumption - Send spinlock has been acquired @@ -3365,8 +3299,7 @@ static void et131x_free_busy_send_packets(struct et131x_adapter *adapter) adapter->tx_ring.used = 0; } -/** - * et131x_handle_send_interrupt - Interrupt handler for sending processing +/* et131x_handle_send_interrupt - Interrupt handler for sending processing * @adapter: pointer to our adapter * * Re-claim the send resources, complete sends and get more to send from @@ -3624,8 +3557,8 @@ static struct ethtool_ops et131x_ethtool_ops = { .get_regs = et131x_get_regs, .get_link = ethtool_op_get_link, }; -/** - * et131x_hwaddr_init - set up the MAC Address on the ET1310 + +/* et131x_hwaddr_init - set up the MAC Address on the ET1310 * @adapter: pointer to our private adapter structure */ static void et131x_hwaddr_init(struct et131x_adapter *adapter) @@ -3635,14 +3568,12 @@ static void et131x_hwaddr_init(struct et131x_adapter *adapter) * device */ if (is_zero_ether_addr(adapter->rom_addr)) { - /* - * We need to randomly generate the last octet so we + /* We need to randomly generate the last octet so we * decrease our chances of setting the mac address to * same as another one of our cards in the system */ get_random_bytes(&adapter->addr[5], 1); - /* - * We have the default value in the register we are + /* We have the default value in the register we are * working with so we need to copy the current * address into the permanent address */ @@ -3658,8 +3589,7 @@ static void et131x_hwaddr_init(struct et131x_adapter *adapter) } } -/** - * et131x_pci_init - initial PCI setup +/* et131x_pci_init - initial PCI setup * @adapter: pointer to our private adapter structure * @pdev: our PCI device * @@ -3751,8 +3681,7 @@ err_out: goto out; } -/** - * et131x_error_timer_handler +/* et131x_error_timer_handler * @data: timer-specific variable; here a pointer to our adapter structure * * The routine called when the error timer expires, to track the number of @@ -3766,7 +3695,8 @@ static void et131x_error_timer_handler(unsigned long data) if (et1310_in_phy_coma(adapter)) { /* Bring the device immediately out of coma, to * prevent it from sleeping indefinitely, this - * mechanism could be improved! */ + * mechanism could be improved! + */ et1310_disable_phy_coma(adapter); adapter->boot_coma = 20; } else { @@ -3792,8 +3722,7 @@ static void et131x_error_timer_handler(unsigned long data) mod_timer(&adapter->error_timer, jiffies + TX_ERROR_PERIOD * HZ / 1000); } -/** - * et131x_adapter_memory_free - Free all memory allocated for use by Tx & Rx +/* et131x_adapter_memory_free - Free all memory allocated for use by Tx & Rx * @adapter: pointer to our private adapter structure */ static void et131x_adapter_memory_free(struct et131x_adapter *adapter) @@ -3803,8 +3732,7 @@ static void et131x_adapter_memory_free(struct et131x_adapter *adapter) et131x_rx_dma_memory_free(adapter); } -/** - * et131x_adapter_memory_alloc +/* et131x_adapter_memory_alloc * @adapter: pointer to our private adapter structure * * Returns 0 on success, errno on failure (as defined in errno.h). @@ -3847,8 +3775,7 @@ static void et131x_adjust_link(struct net_device *netdev) struct phy_device *phydev = adapter->phydev; if (phydev && phydev->link != adapter->link) { - /* - * Check to see if we are in coma mode and if + /* Check to see if we are in coma mode and if * so, disable it because we will not be able * to read PHY values until we are out. */ @@ -3861,8 +3788,7 @@ static void et131x_adjust_link(struct net_device *netdev) if (phydev->link) { adapter->boot_coma = 20; if (phydev && phydev->speed == SPEED_10) { - /* - * NOTE - Is there a way to query this without + /* NOTE - Is there a way to query this without * TruePHY? * && TRU_QueryCoreType(adapter->hTruePhy, 0)== * EMI_TRUEPHY_A13O) { @@ -3924,8 +3850,7 @@ static void et131x_adjust_link(struct net_device *netdev) /* Re-initialize the send structures */ et131x_init_send(adapter); - /* - * Bring the device back to the state it was during + /* Bring the device back to the state it was during * init prior to autonegotiation being complete. This * way, when we get the auto-neg complete interrupt, * we can complete init by calling config_mac_regs2. @@ -3955,7 +3880,7 @@ static int et131x_mii_probe(struct net_device *netdev) } phydev = phy_connect(netdev, dev_name(&phydev->dev), - &et131x_adjust_link, 0, PHY_INTERFACE_MODE_MII); + &et131x_adjust_link, 0, PHY_INTERFACE_MODE_MII); if (IS_ERR(phydev)) { dev_err(&adapter->pdev->dev, "Could not attach to PHY\n"); @@ -3982,8 +3907,7 @@ static int et131x_mii_probe(struct net_device *netdev) return 0; } -/** - * et131x_adapter_init +/* et131x_adapter_init * @adapter: pointer to the private adapter struct * @pdev: pointer to the PCI device * @@ -4020,8 +3944,7 @@ static struct et131x_adapter *et131x_adapter_init(struct net_device *netdev, return adapter; } -/** - * et131x_pci_remove +/* et131x_pci_remove * @pdev: a pointer to the device's pci_dev structure * * Registered in the pci_driver structure, this function is called when the @@ -4048,8 +3971,7 @@ static void et131x_pci_remove(struct pci_dev *pdev) pci_disable_device(pdev); } -/** - * et131x_up - Bring up a device for use. +/* et131x_up - Bring up a device for use. * @netdev: device to be opened */ static void et131x_up(struct net_device *netdev) @@ -4060,8 +3982,7 @@ static void et131x_up(struct net_device *netdev) phy_start(adapter->phydev); } -/** - * et131x_down - Bring down the device +/* et131x_down - Bring down the device * @netdev: device to be brought down */ static void et131x_down(struct net_device *netdev) @@ -4110,8 +4031,7 @@ static SIMPLE_DEV_PM_OPS(et131x_pm_ops, et131x_suspend, et131x_resume); #define ET131X_PM_OPS NULL #endif -/** - * et131x_isr - The Interrupt Service Routine for the driver. +/* et131x_isr - The Interrupt Service Routine for the driver. * @irq: the IRQ on which the interrupt was received. * @dev_id: device-specific info (here a pointer to a net_device struct) * @@ -4199,8 +4119,7 @@ out: return IRQ_RETVAL(handled); } -/** - * et131x_isr_handler - The ISR handler +/* et131x_isr_handler - The ISR handler * @p_adapter, a pointer to the device's private adapter structure * * scheduled to run in a deferred context by the ISR. This is where the ISR's @@ -4213,8 +4132,7 @@ static void et131x_isr_handler(struct work_struct *work) u32 status = adapter->stats.interrupt_status; struct address_map __iomem *iomem = adapter->regs; - /* - * These first two are by far the most common. Once handled, we clear + /* These first two are by far the most common. Once handled, we clear * their two bits in the status word. If the word is now zero, we * exit. */ @@ -4245,8 +4163,7 @@ static void et131x_isr_handler(struct work_struct *work) /* Handle Free Buffer Ring 0 and 1 Low interrupt */ if (status & (ET_INTR_RXDMA_FB_R0_LOW | ET_INTR_RXDMA_FB_R1_LOW)) { - /* - * This indicates the number of unused buffers in RXDMA free + /* This indicates the number of unused buffers in RXDMA free * buffer ring 0 is <= the limit you programmed. Free buffer * resources need to be returned. Free buffers are consumed as * packets are passed from the network to the host. The host @@ -4258,16 +4175,14 @@ static void et131x_isr_handler(struct work_struct *work) * method of returning resources. */ - /* - * If the user has flow control on, then we will + /* If the user has flow control on, then we will * send a pause packet, otherwise just exit */ if (adapter->flowcontrol == FLOW_TXONLY || adapter->flowcontrol == FLOW_BOTH) { u32 pm_csr; - /* - * Tell the device to send a pause packet via the back + /* Tell the device to send a pause packet via the back * pressure register (bp req and bp xon/xoff) */ pm_csr = readl(&iomem->global.pm_csr); @@ -4278,8 +4193,7 @@ static void et131x_isr_handler(struct work_struct *work) /* Handle Packet Status Ring Low Interrupt */ if (status & ET_INTR_RXDMA_STAT_LOW) { - /* - * Same idea as with the two Free Buffer Rings. Packets going + /* Same idea as with the two Free Buffer Rings. Packets going * from the network to the host each consume a free buffer * resource and a packet status resource. These resoures are * passed to the OS. When the OS is done with the resources, @@ -4290,8 +4204,7 @@ static void et131x_isr_handler(struct work_struct *work) /* Handle RXDMA Error Interrupt */ if (status & ET_INTR_RXDMA_ERR) { - /* - * The rxdma_error interrupt is sent when a time-out on a + /* The rxdma_error interrupt is sent when a time-out on a * request issued by the JAGCore has occurred or a completion is * returned with an un-successful status. In both cases the * request is considered complete. The JAGCore will @@ -4314,8 +4227,7 @@ static void et131x_isr_handler(struct work_struct *work) /* Handle the Wake on LAN Event */ if (status & ET_INTR_WOL) { - /* - * This is a secondary interrupt for wake on LAN. The driver + /* This is a secondary interrupt for wake on LAN. The driver * should never see this, if it does, something serious is * wrong. We will TRAP the message when we are in DBG mode, * otherwise we will ignore it. @@ -4327,8 +4239,7 @@ static void et131x_isr_handler(struct work_struct *work) if (status & ET_INTR_TXMAC) { u32 err = readl(&iomem->txmac.err); - /* - * When any of the errors occur and TXMAC generates an + /* When any of the errors occur and TXMAC generates an * interrupt to report these errors, it usually means that * TXMAC has detected an error in the data stream retrieved * from the on-chip Tx Q. All of these errors are catastrophic @@ -4340,16 +4251,14 @@ static void et131x_isr_handler(struct work_struct *work) "TXMAC interrupt, error 0x%08x\n", err); - /* - * If we are debugging, we want to see this error, otherwise we + /* If we are debugging, we want to see this error, otherwise we * just want the device to be reset and continue */ } /* Handle RXMAC Interrupt */ if (status & ET_INTR_RXMAC) { - /* - * These interrupts are catastrophic to the device, what we need + /* These interrupts are catastrophic to the device, what we need * to do is disable the interrupts and set the flag to cause us * to reset so we can solve this issue. */ @@ -4364,16 +4273,14 @@ static void et131x_isr_handler(struct work_struct *work) readl(&iomem->rxmac.ctrl), readl(&iomem->rxmac.rxq_diag)); - /* - * If we are debugging, we want to see this error, otherwise we + /* If we are debugging, we want to see this error, otherwise we * just want the device to be reset and continue */ } /* Handle MAC_STAT Interrupt */ if (status & ET_INTR_MAC_STAT) { - /* - * This means at least one of the un-masked counters in the + /* This means at least one of the un-masked counters in the * MAC_STAT block has rolled over. Use this to maintain the top, * software managed bits of the counter(s). */ @@ -4382,8 +4289,7 @@ static void et131x_isr_handler(struct work_struct *work) /* Handle SLV Timeout Interrupt */ if (status & ET_INTR_SLV_TIMEOUT) { - /* - * This means a timeout has occurred on a read or write request + /* This means a timeout has occurred on a read or write request * to one of the JAGCore registers. The Global Resources block * has terminated the request and on a read request, returned a * "fake" value. The most likely reasons are: Bad Address or the @@ -4394,8 +4300,7 @@ out: et131x_enable_interrupts(adapter); } -/** - * et131x_stats - Return the current device statistics. +/* et131x_stats - Return the current device statistics. * @netdev: device whose stats are being queried * * Returns 0 on success, errno on failure (as defined in errno.h) @@ -4441,8 +4346,7 @@ static struct net_device_stats *et131x_stats(struct net_device *netdev) return stats; } -/** - * et131x_open - Open the device for use. +/* et131x_open - Open the device for use. * @netdev: device to be opened * * Returns 0 on success, errno on failure (as defined in errno.h) @@ -4475,8 +4379,7 @@ static int et131x_open(struct net_device *netdev) return result; } -/** - * et131x_close - Close the device +/* et131x_close - Close the device * @netdev: device to be closed * * Returns 0 on success, errno on failure (as defined in errno.h) @@ -4494,8 +4397,7 @@ static int et131x_close(struct net_device *netdev) return del_timer_sync(&adapter->error_timer); } -/** - * et131x_ioctl - The I/O Control handler for the driver +/* et131x_ioctl - The I/O Control handler for the driver * @netdev: device on which the control request is being made * @reqbuf: a pointer to the IOCTL request buffer * @cmd: the IOCTL command code @@ -4513,8 +4415,7 @@ static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, return phy_mii_ioctl(adapter->phydev, reqbuf, cmd); } -/** - * et131x_set_packet_filter - Configures the Rx Packet filtering on the device +/* et131x_set_packet_filter - Configures the Rx Packet filtering on the device * @adapter: pointer to our private adapter structure * * FIXME: lot of dups with MAC code @@ -4542,8 +4443,7 @@ static int et131x_set_packet_filter(struct et131x_adapter *adapter) if ((filter & ET131X_PACKET_TYPE_PROMISCUOUS) || filter == 0) pf_ctrl &= ~7; /* Clear filter bits */ else { - /* - * Set us up with Multicast packet filtering. Three cases are + /* Set us up with Multicast packet filtering. Three cases are * possible - (1) we have a multi-cast list, (2) we receive ALL * multicast entries or (3) we receive none. */ @@ -4579,8 +4479,7 @@ static int et131x_set_packet_filter(struct et131x_adapter *adapter) return status; } -/** - * et131x_multicast - The handler to configure multicasting on the interface +/* et131x_multicast - The handler to configure multicasting on the interface * @netdev: a pointer to a net_device struct representing the device */ static void et131x_multicast(struct net_device *netdev) @@ -4649,8 +4548,7 @@ static void et131x_multicast(struct net_device *netdev) spin_unlock_irqrestore(&adapter->lock, flags); } -/** - * et131x_tx - The handler to tx a packet on the device +/* et131x_tx - The handler to tx a packet on the device * @skb: data to be Tx'd * @netdev: device on which data is to be Tx'd * @@ -4682,8 +4580,7 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) return status; } -/** - * et131x_tx_timeout - Timeout handler +/* et131x_tx_timeout - Timeout handler * @netdev: a pointer to a net_device struct representing the device * * The handler called when a Tx request times out. The timeout period is @@ -4741,8 +4638,7 @@ static void et131x_tx_timeout(struct net_device *netdev) spin_unlock_irqrestore(&adapter->tcb_send_qlock, flags); } -/** - * et131x_change_mtu - The handler called to change the MTU for the device +/* et131x_change_mtu - The handler called to change the MTU for the device * @netdev: device whose MTU is to be changed * @new_mtu: the desired MTU * @@ -4792,8 +4688,7 @@ static int et131x_change_mtu(struct net_device *netdev, int new_mtu) return result; } -/** - * et131x_set_mac_addr - handler to change the MAC address for the device +/* et131x_set_mac_addr - handler to change the MAC address for the device * @netdev: device whose MAC is to be changed * @new_mac: the desired MAC address * @@ -4866,8 +4761,7 @@ static const struct net_device_ops et131x_netdev_ops = { .ndo_do_ioctl = et131x_ioctl, }; -/** - * et131x_pci_setup - Perform device initialization +/* et131x_pci_setup - Perform device initialization * @pdev: a pointer to the device's pci_dev structure * @ent: this device's entry in the pci_device_id table * -- cgit v1.2.3 From c0594ee9ea20388310d2669a7c6122c5305dcf80 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Tue, 22 Jan 2013 17:10:10 +0000 Subject: staging: et131x: Fix all sparse warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dan Carpenter has pointed out that there are several sparse warnings from et131x.c, listed below. This patch fixes all these errors. drivers/staging/et131x/et131x.c:1870:33: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1870:33:    expected unsigned int [usertype] *num_des drivers/staging/et131x/et131x.c:1870:33:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1871:37: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1871:37:    expected unsigned int [usertype] *full_offset drivers/staging/et131x/et131x.c:1871:37:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1872:33: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1872:33:    expected unsigned int [usertype] *min_des drivers/staging/et131x/et131x.c:1872:33:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1873:33: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1873:33:    expected unsigned int [usertype] *base_hi drivers/staging/et131x/et131x.c:1873:33:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1874:33: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1874:33:    expected unsigned int [usertype] *base_lo drivers/staging/et131x/et131x.c:1874:33:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1876:33: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1876:33:    expected unsigned int [usertype] *num_des drivers/staging/et131x/et131x.c:1876:33:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1877:37: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1877:37:    expected unsigned int [usertype] *full_offset drivers/staging/et131x/et131x.c:1877:37:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1878:33: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1878:33:    expected unsigned int [usertype] *min_des drivers/staging/et131x/et131x.c:1878:33:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1879:33: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1879:33:    expected unsigned int [usertype] *base_hi drivers/staging/et131x/et131x.c:1879:33:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1880:33: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:1880:33:    expected unsigned int [usertype] *base_lo drivers/staging/et131x/et131x.c:1880:33:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:1898:24: warning: incorrect type in argument 2 (different address spaces) drivers/staging/et131x/et131x.c:1898:24:    expected void volatile [noderef] *addr drivers/staging/et131x/et131x.c:1898:24:    got unsigned int [usertype] *base_hi drivers/staging/et131x/et131x.c:1900:24: warning: incorrect type in argument 2 (different address spaces) drivers/staging/et131x/et131x.c:1900:24:    expected void volatile [noderef] *addr drivers/staging/et131x/et131x.c:1900:24:    got unsigned int [usertype] *base_lo drivers/staging/et131x/et131x.c:1901:60: warning: incorrect type in argument 2 (different address spaces) drivers/staging/et131x/et131x.c:1901:60:    expected void volatile [noderef] *addr drivers/staging/et131x/et131x.c:1901:60:    got unsigned int [usertype] *num_des drivers/staging/et131x/et131x.c:1902:39: warning: incorrect type in argument 2 (different address spaces) drivers/staging/et131x/et131x.c:1902:39:    expected void volatile [noderef] *addr drivers/staging/et131x/et131x.c:1902:39:    got unsigned int [usertype] *full_offset drivers/staging/et131x/et131x.c:1910:24: warning: incorrect type in argument 2 (different address spaces) drivers/staging/et131x/et131x.c:1910:24:    expected void volatile [noderef] *addr drivers/staging/et131x/et131x.c:1910:24:    got unsigned int [usertype] *min_des drivers/staging/et131x/et131x.c:2583:32: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:2583:32:    expected unsigned int [usertype] *offset drivers/staging/et131x/et131x.c:2583:32:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:2585:32: warning: incorrect type in assignment (different address spaces) drivers/staging/et131x/et131x.c:2585:32:    expected unsigned int [usertype] *offset drivers/staging/et131x/et131x.c:2585:32:    got unsigned int [noderef] * drivers/staging/et131x/et131x.c:2602:24: warning: incorrect type in argument 2 (different address spaces) drivers/staging/et131x/et131x.c:2602:24:    expected void volatile [noderef] *addr drivers/staging/et131x/et131x.c:2602:24:    got unsigned int [usertype] *offset drivers/staging/et131x/et131x.c:4093:13: warning: symbol 'et131x_isr' was not declared. Should it be static? Reported-by: Dan Carpenter Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index e38d7014e6c..4a7c302666c 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -1819,11 +1819,11 @@ static void et131x_config_rx_dma_regs(struct et131x_adapter *adapter) rx_local->local_psr_full = 0; for (id = 0; id < NUM_FBRS; id++) { - u32 *num_des; - u32 *full_offset; - u32 *min_des; - u32 *base_hi; - u32 *base_lo; + u32 __iomem *num_des; + u32 __iomem *full_offset; + u32 __iomem *min_des; + u32 __iomem *base_hi; + u32 __iomem *base_lo; if (id == 0) { num_des = &rx_dma->fbr0_num_des; @@ -2516,7 +2516,7 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) * need to clean up OOB data */ if (buff_index < rx_local->fbr[ring_index]->num_entries) { - u32 *offset; + u32 __iomem *offset; struct fbr_desc *next; spin_lock_irqsave(&adapter->fbr_lock, flags); @@ -4037,7 +4037,7 @@ static SIMPLE_DEV_PM_OPS(et131x_pm_ops, et131x_suspend, et131x_resume); * * Returns a value indicating if the interrupt was handled. */ -irqreturn_t et131x_isr(int irq, void *dev_id) +static irqreturn_t et131x_isr(int irq, void *dev_id) { bool handled = true; struct net_device *netdev = (struct net_device *)dev_id; -- cgit v1.2.3 From 78110bb8dc4a7ff331bfa3cfe7d4e287cfb3f22b Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 11 Feb 2013 09:41:29 -0800 Subject: staging: Remove unnecessary OOM messages alloc failures already get standardized OOM messages and a dump_stack. For the affected mallocs around these OOM messages: Converted kzallocs with multiplies to kcalloc. Converted kmallocs with multiplies to kmalloc_array. Converted a kmalloc/strlen/strncpy to kstrdup. Moved a spin_lock below a removed OOM message and removed a now unnecessary spin_unlock. Neatened alignment and whitespace. Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index 4a7c302666c..ebf5e496287 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -2462,11 +2462,8 @@ static int et131x_init_recv(struct et131x_adapter *adapter) /* Setup each RFD */ for (rfdct = 0; rfdct < rx_ring->num_rfd; rfdct++) { rfd = kzalloc(sizeof(struct rfd), GFP_ATOMIC | GFP_DMA); - - if (!rfd) { - dev_err(&adapter->pdev->dev, "Couldn't alloc RFD\n"); + if (!rfd) return -ENOMEM; - } rfd->skb = NULL; @@ -2814,12 +2811,10 @@ static int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) struct tx_ring *tx_ring = &adapter->tx_ring; /* Allocate memory for the TCB's (Transmit Control Block) */ - adapter->tx_ring.tcb_ring = - kcalloc(NUM_TCB, sizeof(struct tcb), GFP_ATOMIC | GFP_DMA); - if (!adapter->tx_ring.tcb_ring) { - dev_err(&adapter->pdev->dev, "Cannot alloc memory for TCBs\n"); + adapter->tx_ring.tcb_ring = kcalloc(NUM_TCB, sizeof(struct tcb), + GFP_ATOMIC | GFP_DMA); + if (!adapter->tx_ring.tcb_ring) return -ENOMEM; - } desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX); tx_ring->tx_desc_ring = @@ -4895,11 +4890,10 @@ static int et131x_pci_setup(struct pci_dev *pdev, adapter->mii_bus->read = et131x_mdio_read; adapter->mii_bus->write = et131x_mdio_write; adapter->mii_bus->reset = et131x_mdio_reset; - adapter->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); - if (!adapter->mii_bus->irq) { - dev_err(&pdev->dev, "mii_bus irq allocation failed\n"); + adapter->mii_bus->irq = kmalloc_array(PHY_MAX_ADDR, sizeof(int), + GFP_KERNEL); + if (!adapter->mii_bus->irq) goto err_mdio_free; - } for (ii = 0; ii < PHY_MAX_ADDR; ii++) adapter->mii_bus->irq[ii] = PHY_POLL; -- cgit v1.2.3 From bf7edd87f1c9618ac0bae712aa7a8047058a2731 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Sat, 16 Feb 2013 19:12:00 +0000 Subject: staging: et131x: Remove assignment of skb->dev The call eth_type_trans() sets skb->dev to netdev, so there's no needto set it before the call. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et131x.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c index ebf5e496287..3a733f7a023 100644 --- a/drivers/staging/et131x/et131x.c +++ b/drivers/staging/et131x/et131x.c @@ -2730,7 +2730,6 @@ static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter) rx_local->fbr[ring_index]->virt[buff_index], rfd->len); - skb->dev = adapter->netdev; skb->protocol = eth_type_trans(skb, adapter->netdev); skb->ip_summed = CHECKSUM_NONE; netif_rx_ni(skb); -- cgit v1.2.3 From deb95fac28b6678f014c95909fc1bee21c1bace5 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Sat, 16 Feb 2013 19:12:01 +0000 Subject: staging: et131x: Update TODO list David Miller had provided some review comments for this driver. Update the TODO list with some action points from his review. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/README | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/staging/et131x') diff --git a/drivers/staging/et131x/README b/drivers/staging/et131x/README index 38537d4c4e1..05ad0850166 100644 --- a/drivers/staging/et131x/README +++ b/drivers/staging/et131x/README @@ -9,6 +9,10 @@ driver as they did not build properly at the time. TODO: - some rx packets have CRC/code/frame errors + - Look at reducing the number of spinlocks + - Simplify code in nic_rx_pkts(), when determining multicast_pkts_rcvd + - Implement NAPI support + - in et131x_tx(), don't return NETDEV_TX_BUSY, just drop the packet with kfree_skb(). Please send patches to: Greg Kroah-Hartman -- cgit v1.2.3