From 1de137839bea5b185730b03d5a94da95d9054ce6 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Sun, 10 Jul 2011 16:35:26 +0100 Subject: staging: et131x: Converting et1310_mac.c function and local names from CamelCase Tested on an ET-131x device. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_mac.c | 222 ++++++++++++++++---------------- drivers/staging/et131x/et1310_phy.c | 4 +- drivers/staging/et131x/et131x.h | 20 +-- drivers/staging/et131x/et131x_initpci.c | 12 +- drivers/staging/et131x/et131x_isr.c | 2 +- drivers/staging/et131x/et131x_netdev.c | 4 +- 6 files changed, 132 insertions(+), 132 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index 656be4b99cf..db34c7951fc 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -99,12 +99,12 @@ #define COUNTER_MASK_12_BIT (COUNTER_WRAP_12_BIT - 1) /** - * ConfigMacRegs1 - Initialize the first part of MAC regs - * @pAdpater: pointer to our adapter structure + * config_mac_regs1 - Initialize the first part of MAC regs + * @etdev: pointer to our adapter structure */ -void ConfigMACRegs1(struct et131x_adapter *etdev) +void config_mac_regs1(struct et131x_adapter *etdev) { - struct mac_regs __iomem *pMac = &etdev->regs->mac; + struct mac_regs __iomem *macregs = &etdev->regs->mac; u32 station1; u32 station2; u32 ipg; @@ -112,22 +112,22 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) /* First we need to reset everything. Write to MAC configuration * register 1 to perform reset. */ - writel(0xC00F0000, &pMac->cfg1); + writel(0xC00F0000, ¯egs->cfg1); /* Next lets configure the MAC Inter-packet gap register */ ipg = 0x38005860; /* IPG1 0x38 IPG2 0x58 B2B 0x60 */ ipg |= 0x50 << 8; /* ifg enforce 0x50 */ - writel(ipg, &pMac->ipg); + writel(ipg, ¯egs->ipg); /* Next lets configure the MAC Half Duplex register */ /* BEB trunc 0xA, Ex Defer, Rexmit 0xF Coll 0x37 */ - writel(0x00A1F037, &pMac->hfdp); + writel(0x00A1F037, ¯egs->hfdp); /* Next lets configure the MAC Interface Control register */ - writel(0, &pMac->if_ctrl); + writel(0, ¯egs->if_ctrl); /* Let's move on to setting up the mii management configuration */ - writel(0x07, &pMac->mii_mgmt_cfg); /* Clock reset 0x7 */ + writel(0x07, ¯egs->mii_mgmt_cfg); /* Clock reset 0x7 */ /* Next lets configure the MAC Station Address register. These * values are read from the EEPROM during initialization and stored @@ -142,8 +142,8 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) (etdev->addr[4] << ET_MAC_STATION_ADDR1_OC5_SHIFT) | (etdev->addr[3] << ET_MAC_STATION_ADDR1_OC4_SHIFT) | etdev->addr[2]; - writel(station1, &pMac->station_addr_1); - writel(station2, &pMac->station_addr_2); + writel(station1, ¯egs->station_addr_1); + writel(station2, ¯egs->station_addr_2); /* Max ethernet packet in bytes that will passed by the mac without * being truncated. Allow the MAC to pass 4 more than our max packet @@ -152,29 +152,29 @@ void ConfigMACRegs1(struct et131x_adapter *etdev) * Packets larger than (RegistryJumboPacket) that do not contain a * VLAN ID will be dropped by the Rx function. */ - writel(etdev->RegistryJumboPacket + 4, &pMac->max_fm_len); + writel(etdev->RegistryJumboPacket + 4, ¯egs->max_fm_len); /* clear out MAC config reset */ - writel(0, &pMac->cfg1); + writel(0, ¯egs->cfg1); } /** - * ConfigMacRegs2 - Initialize the second part of MAC regs - * @pAdpater: pointer to our adapter structure + * config_mac_regs2 - Initialize the second part of MAC regs + * @etdev: pointer to our adapter structure */ -void ConfigMACRegs2(struct et131x_adapter *etdev) +void config_mac_regs2(struct et131x_adapter *etdev) { int32_t delay = 0; - struct mac_regs __iomem *pMac = &etdev->regs->mac; + struct mac_regs __iomem *mac = &etdev->regs->mac; u32 cfg1; u32 cfg2; u32 ifctrl; u32 ctl; ctl = readl(&etdev->regs->txmac.ctl); - cfg1 = readl(&pMac->cfg1); - cfg2 = readl(&pMac->cfg2); - ifctrl = readl(&pMac->if_ctrl); + cfg1 = readl(&mac->cfg1); + cfg2 = readl(&mac->cfg2); + ifctrl = readl(&mac->if_ctrl); /* Set up the if mode bits */ cfg2 &= ~0x300; @@ -188,12 +188,12 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) } /* We need to enable Rx/Tx */ - cfg1 |= CFG1_RX_ENABLE|CFG1_TX_ENABLE|CFG1_TX_FLOW; + cfg1 |= CFG1_RX_ENABLE | CFG1_TX_ENABLE | CFG1_TX_FLOW; /* Initialize loop back to off */ - cfg1 &= ~(CFG1_LOOPBACK|CFG1_RX_FLOW); + cfg1 &= ~(CFG1_LOOPBACK | CFG1_RX_FLOW); if (etdev->flowcontrol == FLOW_RXONLY || etdev->flowcontrol == FLOW_BOTH) cfg1 |= CFG1_RX_FLOW; - writel(cfg1, &pMac->cfg1); + 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 @@ -209,13 +209,13 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) if (!etdev->duplex_mode) ifctrl |= (1<<26); /* Enable ghd */ - writel(ifctrl, &pMac->if_ctrl); - writel(cfg2, &pMac->cfg2); + writel(ifctrl, &mac->if_ctrl); + writel(cfg2, &mac->cfg2); do { udelay(10); delay++; - cfg1 = readl(&pMac->cfg1); + cfg1 = readl(&mac->cfg1); } while ((cfg1 & CFG1_WAIT) != CFG1_WAIT && delay < 100); if (delay == 100) { @@ -224,7 +224,7 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) cfg1); } - /* Enable TXMAC */ + /* Enable txmac */ ctl |= 0x09; /* TX mac enable, FC disable */ writel(ctl, &etdev->regs->txmac.ctl); @@ -235,78 +235,78 @@ void ConfigMACRegs2(struct et131x_adapter *etdev) } } -void ConfigRxMacRegs(struct et131x_adapter *etdev) +void config_rxmac_regs(struct et131x_adapter *etdev) { - struct rxmac_regs __iomem *pRxMac = &etdev->regs->rxmac; + struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac; u32 sa_lo; u32 sa_hi = 0; u32 pf_ctrl = 0; /* Disable the MAC while it is being configured (also disable WOL) */ - writel(0x8, &pRxMac->ctrl); + writel(0x8, &rxmac->ctrl); /* Initialize WOL to disabled. */ - writel(0, &pRxMac->crc0); - writel(0, &pRxMac->crc12); - writel(0, &pRxMac->crc34); + writel(0, &rxmac->crc0); + writel(0, &rxmac->crc12); + writel(0, &rxmac->crc34); /* We need to set the WOL mask0 - mask4 next. We initialize it to * its default Values of 0x00000000 because there are not WOL masks * as of this time. */ - writel(0, &pRxMac->mask0_word0); - writel(0, &pRxMac->mask0_word1); - writel(0, &pRxMac->mask0_word2); - writel(0, &pRxMac->mask0_word3); - - writel(0, &pRxMac->mask1_word0); - writel(0, &pRxMac->mask1_word1); - writel(0, &pRxMac->mask1_word2); - writel(0, &pRxMac->mask1_word3); - - writel(0, &pRxMac->mask2_word0); - writel(0, &pRxMac->mask2_word1); - writel(0, &pRxMac->mask2_word2); - writel(0, &pRxMac->mask2_word3); - - writel(0, &pRxMac->mask3_word0); - writel(0, &pRxMac->mask3_word1); - writel(0, &pRxMac->mask3_word2); - writel(0, &pRxMac->mask3_word3); - - writel(0, &pRxMac->mask4_word0); - writel(0, &pRxMac->mask4_word1); - writel(0, &pRxMac->mask4_word2); - writel(0, &pRxMac->mask4_word3); + writel(0, &rxmac->mask0_word0); + writel(0, &rxmac->mask0_word1); + writel(0, &rxmac->mask0_word2); + writel(0, &rxmac->mask0_word3); + + writel(0, &rxmac->mask1_word0); + writel(0, &rxmac->mask1_word1); + writel(0, &rxmac->mask1_word2); + writel(0, &rxmac->mask1_word3); + + writel(0, &rxmac->mask2_word0); + writel(0, &rxmac->mask2_word1); + writel(0, &rxmac->mask2_word2); + writel(0, &rxmac->mask2_word3); + + writel(0, &rxmac->mask3_word0); + writel(0, &rxmac->mask3_word1); + writel(0, &rxmac->mask3_word2); + writel(0, &rxmac->mask3_word3); + + writel(0, &rxmac->mask4_word0); + writel(0, &rxmac->mask4_word1); + writel(0, &rxmac->mask4_word2); + writel(0, &rxmac->mask4_word3); /* Lets setup the WOL Source Address */ sa_lo = (etdev->addr[2] << ET_WOL_LO_SA3_SHIFT) | (etdev->addr[3] << ET_WOL_LO_SA4_SHIFT) | (etdev->addr[4] << ET_WOL_LO_SA5_SHIFT) | etdev->addr[5]; - writel(sa_lo, &pRxMac->sa_lo); + writel(sa_lo, &rxmac->sa_lo); sa_hi = (u32) (etdev->addr[0] << ET_WOL_HI_SA1_SHIFT) | etdev->addr[1]; - writel(sa_hi, &pRxMac->sa_hi); + writel(sa_hi, &rxmac->sa_hi); /* Disable all Packet Filtering */ - writel(0, &pRxMac->pf_ctrl); + writel(0, &rxmac->pf_ctrl); /* Let's initialize the Unicast Packet filtering address */ if (etdev->PacketFilter & ET131X_PACKET_TYPE_DIRECTED) { - SetupDeviceForUnicast(etdev); + setup_device_for_unicast(etdev); pf_ctrl |= 4; /* Unicast filter */ } else { - writel(0, &pRxMac->uni_pf_addr1); - writel(0, &pRxMac->uni_pf_addr2); - writel(0, &pRxMac->uni_pf_addr3); + writel(0, &rxmac->uni_pf_addr1); + writel(0, &rxmac->uni_pf_addr2); + writel(0, &rxmac->uni_pf_addr3); } /* Let's initialize the Multicast hash */ if (!(etdev->PacketFilter & ET131X_PACKET_TYPE_ALL_MULTICAST)) { pf_ctrl |= 2; /* Multicast filter */ - SetupDeviceForMulticast(etdev); + setup_device_for_multicast(etdev); } /* Runt packet filtering. Didn't work in version A silicon. */ @@ -324,18 +324,18 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev) * * seg_en on, fc_en off, size 0x10 */ - writel(0x41, &pRxMac->mcif_ctrl_max_seg); + writel(0x41, &rxmac->mcif_ctrl_max_seg); else - writel(0, &pRxMac->mcif_ctrl_max_seg); + writel(0, &rxmac->mcif_ctrl_max_seg); /* Initialize the MCIF water marks */ - writel(0, &pRxMac->mcif_water_mark); + writel(0, &rxmac->mcif_water_mark); /* Initialize the MIF control */ - writel(0, &pRxMac->mif_ctrl); + writel(0, &rxmac->mif_ctrl); /* Initialize the Space Available Register */ - writel(0, &pRxMac->space_avail); + writel(0, &rxmac->space_avail); /* Initialize the the mif_ctrl register * bit 3: Receive code error. One or more nibbles were signaled as @@ -351,9 +351,9 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev) * bit 17: Drop packet enable */ if (etdev->linkspeed == TRUEPHY_SPEED_100MBPS) - writel(0x30038, &pRxMac->mif_ctrl); + writel(0x30038, &rxmac->mif_ctrl); else - writel(0x30030, &pRxMac->mif_ctrl); + writel(0x30030, &rxmac->mif_ctrl); /* Finally we initialize RxMac to be enabled & WOL disabled. Packet * filter is always enabled since it is where the runt packets are @@ -361,11 +361,11 @@ void ConfigRxMacRegs(struct et131x_adapter *etdev) * dropping doesn't work, so it is disabled in the pf_ctrl register, * but we still leave the packet filter on. */ - writel(pf_ctrl, &pRxMac->pf_ctrl); - writel(0x9, &pRxMac->ctrl); + writel(pf_ctrl, &rxmac->pf_ctrl); + writel(0x9, &rxmac->ctrl); } -void ConfigTxMacRegs(struct et131x_adapter *etdev) +void config_txmac_regs(struct et131x_adapter *etdev) { struct txmac_regs *txmac = &etdev->regs->txmac; @@ -379,7 +379,7 @@ void ConfigTxMacRegs(struct et131x_adapter *etdev) writel(0x40, &txmac->cf_param); } -void ConfigMacStatRegs(struct et131x_adapter *etdev) +void config_macstat_regs(struct et131x_adapter *etdev) { struct macstat_regs __iomem *macstat = &etdev->regs->macstat; @@ -444,7 +444,7 @@ void ConfigMacStatRegs(struct et131x_adapter *etdev) writel(0xFFFE7E8B, &macstat->carry_reg2_mask); } -void ConfigFlowControl(struct et131x_adapter *etdev) +void config_flow_control(struct et131x_adapter *etdev) { if (etdev->duplex_mode == 0) { etdev->flowcontrol = FLOW_NONE; @@ -480,42 +480,42 @@ void ConfigFlowControl(struct et131x_adapter *etdev) } /** - * UpdateMacStatHostCounters - Update the local copy of the statistics + * update_macstat_host_counters - Update the local copy of the statistics * @etdev: pointer to the adapter structure */ -void UpdateMacStatHostCounters(struct et131x_adapter *etdev) +void update_macstat_host_counters(struct et131x_adapter *etdev) { struct ce_stats *stats = &etdev->stats; struct macstat_regs __iomem *macstat = &etdev->regs->macstat; - stats->collisions += readl(&macstat->tx_total_collisions); - stats->first_collision += readl(&macstat->tx_single_collisions); - stats->tx_deferred += readl(&macstat->tx_deferred); + stats->collisions += readl(&macstat->tx_total_collisions); + stats->first_collision += readl(&macstat->tx_single_collisions); + stats->tx_deferred += readl(&macstat->tx_deferred); stats->excessive_collisions += readl(&macstat->tx_multiple_collisions); - stats->late_collisions += readl(&macstat->tx_late_collisions); - stats->tx_uflo += readl(&macstat->tx_undersize_frames); - stats->max_pkt_error += readl(&macstat->tx_oversize_frames); - - stats->alignment_err += readl(&macstat->rx_align_errs); - stats->crc_err += readl(&macstat->rx_code_errs); - stats->norcvbuf += readl(&macstat->rx_drops); - stats->rx_ov_flow += readl(&macstat->rx_oversize_packets); - stats->code_violations += readl(&macstat->rx_fcs_errs); - stats->length_err += readl(&macstat->rx_frame_len_errs); - - stats->other_errors += readl(&macstat->rx_fragment_packets); + stats->late_collisions += readl(&macstat->tx_late_collisions); + stats->tx_uflo += readl(&macstat->tx_undersize_frames); + stats->max_pkt_error += readl(&macstat->tx_oversize_frames); + + stats->alignment_err += readl(&macstat->rx_align_errs); + stats->crc_err += readl(&macstat->rx_code_errs); + stats->norcvbuf += readl(&macstat->rx_drops); + stats->rx_ov_flow += readl(&macstat->rx_oversize_packets); + stats->code_violations += readl(&macstat->rx_fcs_errs); + stats->length_err += readl(&macstat->rx_frame_len_errs); + + stats->other_errors += readl(&macstat->rx_fragment_packets); } /** - * HandleMacStatInterrupt + * handle_macstat_interrupt * @etdev: pointer to the adapter structure * * One of the MACSTAT counters has wrapped. Update the local copy of * the statistics held in the adapter structure, checking the "wrap" * bit for each counter. */ -void HandleMacStatInterrupt(struct et131x_adapter *etdev) +void handle_macstat_interrupt(struct et131x_adapter *etdev) { u32 carry_reg1; u32 carry_reg2; @@ -536,36 +536,36 @@ void HandleMacStatInterrupt(struct et131x_adapter *etdev) * block indicates that one of the counters has wrapped. */ if (carry_reg1 & (1 << 14)) - etdev->stats.code_violations += COUNTER_WRAP_16_BIT; + etdev->stats.code_violations += COUNTER_WRAP_16_BIT; if (carry_reg1 & (1 << 8)) - etdev->stats.alignment_err += COUNTER_WRAP_12_BIT; + etdev->stats.alignment_err += COUNTER_WRAP_12_BIT; if (carry_reg1 & (1 << 7)) - etdev->stats.length_err += COUNTER_WRAP_16_BIT; + etdev->stats.length_err += COUNTER_WRAP_16_BIT; if (carry_reg1 & (1 << 2)) - etdev->stats.other_errors += COUNTER_WRAP_16_BIT; + etdev->stats.other_errors += COUNTER_WRAP_16_BIT; if (carry_reg1 & (1 << 6)) - etdev->stats.crc_err += COUNTER_WRAP_16_BIT; + etdev->stats.crc_err += COUNTER_WRAP_16_BIT; if (carry_reg1 & (1 << 3)) - etdev->stats.rx_ov_flow += COUNTER_WRAP_16_BIT; + etdev->stats.rx_ov_flow += COUNTER_WRAP_16_BIT; if (carry_reg1 & (1 << 0)) - etdev->stats.norcvbuf += COUNTER_WRAP_16_BIT; + etdev->stats.norcvbuf += COUNTER_WRAP_16_BIT; if (carry_reg2 & (1 << 16)) - etdev->stats.max_pkt_error += COUNTER_WRAP_12_BIT; + etdev->stats.max_pkt_error += COUNTER_WRAP_12_BIT; if (carry_reg2 & (1 << 15)) - etdev->stats.tx_uflo += COUNTER_WRAP_12_BIT; + etdev->stats.tx_uflo += COUNTER_WRAP_12_BIT; if (carry_reg2 & (1 << 6)) - etdev->stats.first_collision += COUNTER_WRAP_12_BIT; + etdev->stats.first_collision += COUNTER_WRAP_12_BIT; if (carry_reg2 & (1 << 8)) - etdev->stats.tx_deferred += COUNTER_WRAP_12_BIT; + etdev->stats.tx_deferred += COUNTER_WRAP_12_BIT; if (carry_reg2 & (1 << 5)) etdev->stats.excessive_collisions += COUNTER_WRAP_12_BIT; if (carry_reg2 & (1 << 4)) - etdev->stats.late_collisions += COUNTER_WRAP_12_BIT; + etdev->stats.late_collisions += COUNTER_WRAP_12_BIT; if (carry_reg2 & (1 << 2)) - etdev->stats.collisions += COUNTER_WRAP_12_BIT; + etdev->stats.collisions += COUNTER_WRAP_12_BIT; } -void SetupDeviceForMulticast(struct et131x_adapter *etdev) +void setup_device_for_multicast(struct et131x_adapter *etdev) { struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac; uint32_t nIndex; @@ -613,7 +613,7 @@ void SetupDeviceForMulticast(struct et131x_adapter *etdev) } } -void SetupDeviceForUnicast(struct et131x_adapter *etdev) +void setup_device_for_unicast(struct et131x_adapter *etdev) { struct rxmac_regs __iomem *rxmac = &etdev->regs->rxmac; u32 uni_pf1; diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index 0bcb7fb6e2c..d5b02a8e2b1 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -850,7 +850,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, MiWrite(etdev, 0x12, Register18); } - ConfigFlowControl(etdev); + config_flow_control(etdev); if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS && etdev->RegistryJumboPacket > 2048) @@ -858,7 +858,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, 0x2000); SetRxDmaTimer(etdev); - ConfigMACRegs2(etdev); + config_mac_regs2(etdev); } } } diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h index 48ebac0e55c..289d511f64d 100644 --- a/drivers/staging/et131x/et131x.h +++ b/drivers/staging/et131x/et131x.h @@ -71,16 +71,16 @@ irqreturn_t et131x_isr(int irq, void *dev_id); void et131x_isr_handler(struct work_struct *work); /* et1310_mac.c */ -void ConfigMACRegs1(struct et131x_adapter *adapter); -void ConfigMACRegs2(struct et131x_adapter *adapter); -void ConfigRxMacRegs(struct et131x_adapter *adapter); -void ConfigTxMacRegs(struct et131x_adapter *adapter); -void ConfigMacStatRegs(struct et131x_adapter *adapter); -void ConfigFlowControl(struct et131x_adapter *adapter); -void UpdateMacStatHostCounters(struct et131x_adapter *adapter); -void HandleMacStatInterrupt(struct et131x_adapter *adapter); -void SetupDeviceForMulticast(struct et131x_adapter *adapter); -void SetupDeviceForUnicast(struct et131x_adapter *adapter); +void config_mac_regs1(struct et131x_adapter *adapter); +void config_mac_regs2(struct et131x_adapter *adapter); +void config_rxmac_regs(struct et131x_adapter *adapter); +void config_txmac_regs(struct et131x_adapter *adapter); +void config_macstat_regs(struct et131x_adapter *adapter); +void config_flow_control(struct et131x_adapter *adapter); +void update_macstat_host_counters(struct et131x_adapter *adapter); +void handle_macstat_interrupt(struct et131x_adapter *adapter); +void setup_device_for_multicast(struct et131x_adapter *adapter); +void setup_device_for_unicast(struct et131x_adapter *adapter); /* et131x_netdev.c */ struct net_device *et131x_device_alloc(void); diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index 8c8d6b87a25..d98db859f7c 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -269,7 +269,7 @@ void et131x_error_timer_handler(unsigned long data) pm_csr = readl(&etdev->regs->global.pm_csr); if ((pm_csr & ET_PM_PHY_SW_COMA) == 0) - UpdateMacStatHostCounters(etdev); + update_macstat_host_counters(etdev); else dev_err(&etdev->pdev->dev, "No interrupts, in PHY coma, pm_csr = 0x%x\n", pm_csr); @@ -369,7 +369,7 @@ void ConfigGlobalRegs(struct et131x_adapter *etdev) /** * et131x_adapter_setup - Set the adapter up as per cassini+ documentation - * @adapter: pointer to our private adapter structure + * @etdev: pointer to our private adapter structure * * Returns 0 on success, errno on failure (as defined in errno.h) */ @@ -380,19 +380,19 @@ int et131x_adapter_setup(struct et131x_adapter *etdev) /* Configure the JAGCore */ ConfigGlobalRegs(etdev); - ConfigMACRegs1(etdev); + config_mac_regs1(etdev); /* Configure the MMC registers */ /* All we need to do is initialize the Memory Control Register */ writel(ET_MMC_ENABLE, &etdev->regs->mmc.mmc_ctrl); - ConfigRxMacRegs(etdev); - ConfigTxMacRegs(etdev); + config_rxmac_regs(etdev); + config_txmac_regs(etdev); ConfigRxDmaRegs(etdev); ConfigTxDmaRegs(etdev); - ConfigMacStatRegs(etdev); + config_macstat_regs(etdev); /* Move the following code to Timer function?? */ status = et131x_xcvr_find(etdev); diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index 9c33209c840..48b4d785e11 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -460,7 +460,7 @@ void et131x_isr_handler(struct work_struct *work) * to maintain the top, software managed bits of the * counter(s). */ - HandleMacStatInterrupt(etdev); + handle_macstat_interrupt(etdev); } /* Handle SLV Timeout Interrupt */ diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 5f25bbad36b..4e9e1766ba6 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -301,14 +301,14 @@ int et131x_set_packet_filter(struct et131x_adapter *adapter) if (filter & ET131X_PACKET_TYPE_ALL_MULTICAST) pf_ctrl &= ~2; /* Multicast filter bit */ else { - SetupDeviceForMulticast(adapter); + setup_device_for_multicast(adapter); pf_ctrl |= 2; ctrl &= ~0x04; } /* Set us up with Unicast packet filtering */ if (filter & ET131X_PACKET_TYPE_DIRECTED) { - SetupDeviceForUnicast(adapter); + setup_device_for_unicast(adapter); pf_ctrl |= 4; ctrl &= ~0x04; } -- cgit v1.2.3-18-g5258 From 99fa7e1492cb328f72ac8e231cec61b5e60666dc Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Sun, 10 Jul 2011 16:35:27 +0100 Subject: staging: et131x: Converting et1310_phy.c function and local names from CamelCase Tested on an ET-131x device. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_mac.c | 10 +- drivers/staging/et131x/et1310_phy.c | 402 ++++++++++++++++---------------- drivers/staging/et131x/et131x.h | 35 ++- drivers/staging/et131x/et131x_initpci.c | 14 +- drivers/staging/et131x/et131x_isr.c | 9 +- drivers/staging/et131x/et131x_netdev.c | 4 +- 6 files changed, 234 insertions(+), 240 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/et131x/et1310_mac.c b/drivers/staging/et131x/et1310_mac.c index db34c7951fc..21b615381bd 100644 --- a/drivers/staging/et131x/et1310_mac.c +++ b/drivers/staging/et131x/et1310_mac.c @@ -451,11 +451,11 @@ void config_flow_control(struct et131x_adapter *etdev) } else { char remote_pause, remote_async_pause; - ET1310_PhyAccessMiBit(etdev, - TRUEPHY_BIT_READ, 5, 10, &remote_pause); - ET1310_PhyAccessMiBit(etdev, - TRUEPHY_BIT_READ, 5, 11, - &remote_async_pause); + et1310_phy_access_mii_bit(etdev, + TRUEPHY_BIT_READ, 5, 10, &remote_pause); + et1310_phy_access_mii_bit(etdev, + TRUEPHY_BIT_READ, 5, 11, + &remote_async_pause); if ((remote_pause == TRUEPHY_BIT_SET) && (remote_async_pause == TRUEPHY_BIT_SET)) { diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index d5b02a8e2b1..d53656bae84 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -93,39 +93,36 @@ #include "et131x.h" -/* Prototypes for functions with local scope */ -static void et131x_xcvr_init(struct et131x_adapter *etdev); - /** - * PhyMiRead - 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 * @etdev: pointer to our private adapter structure - * @xcvrAddr: the address of the transceiver - * @xcvrReg: the register to read + * @xcvr_addr: the address of the transceiver + * @xcvr_reg: the register to read * @value: pointer to a 16-bit value in which the value will be stored * * Returns 0 on success, errno on failure (as defined in errno.h) */ -int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr, - u8 xcvrReg, u16 *value) +int et131x_phy_mii_read(struct et131x_adapter *etdev, u8 xcvr_addr, + u8 xcvr_reg, u16 *value) { struct mac_regs __iomem *mac = &etdev->regs->mac; int status = 0; u32 delay; - u32 miiAddr; - u32 miiCmd; - u32 miiIndicator; + u32 mii_addr; + u32 mii_cmd; + u32 mii_indicator; /* Save a local copy of the registers we are dealing with so we can * set them back */ - miiAddr = readl(&mac->mii_mgmt_addr); - miiCmd = readl(&mac->mii_mgmt_cmd); + mii_addr = readl(&mac->mii_mgmt_addr); + mii_cmd = readl(&mac->mii_mgmt_cmd); /* Stop the current operation */ writel(0, &mac->mii_mgmt_cmd); /* Set up the register we need to read from on the correct PHY */ - writel(MII_ADDR(xcvrAddr, xcvrReg), &mac->mii_mgmt_addr); + writel(MII_ADDR(xcvr_addr, xcvr_reg), &mac->mii_mgmt_addr); /* Kick the read cycle off */ delay = 0; @@ -135,15 +132,15 @@ int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr, do { udelay(50); delay++; - miiIndicator = readl(&mac->mii_mgmt_indicator); - } while ((miiIndicator & MGMT_WAIT) && delay < 50); + mii_indicator = readl(&mac->mii_mgmt_indicator); + } while ((mii_indicator & MGMT_WAIT) && delay < 50); /* If we hit the max delay, we could not read the register */ if (delay == 50) { dev_warn(&etdev->pdev->dev, - "xcvrReg 0x%08x could not be read\n", xcvrReg); + "xcvrReg 0x%08x could not be read\n", xcvr_reg); dev_warn(&etdev->pdev->dev, "status is 0x%08x\n", - miiIndicator); + mii_indicator); status = -EIO; } @@ -158,43 +155,43 @@ int PhyMiRead(struct et131x_adapter *etdev, u8 xcvrAddr, /* set the registers we touched back to the state at which we entered * this function */ - writel(miiAddr, &mac->mii_mgmt_addr); - writel(miiCmd, &mac->mii_mgmt_cmd); + writel(mii_addr, &mac->mii_mgmt_addr); + writel(mii_cmd, &mac->mii_mgmt_cmd); return status; } /** - * MiWrite - Write to a PHY register through the MII interface of the MAC + * et131x_mii_write - Write to a PHY register through the MII interface of the MAC * @etdev: pointer to our private adapter structure - * @xcvrReg: the register to read + * @xcvr_reg: the register to read * @value: 16-bit value to write * * FIXME: one caller in netdev still * * Return 0 on success, errno on failure (as defined in errno.h) */ -int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value) +int et131x_mii_write(struct et131x_adapter *etdev, u8 xcvr_reg, u16 value) { struct mac_regs __iomem *mac = &etdev->regs->mac; int status = 0; - u8 xcvrAddr = etdev->stats.xcvr_addr; + u8 xcvr_addr = etdev->stats.xcvr_addr; u32 delay; - u32 miiAddr; - u32 miiCmd; - u32 miiIndicator; + u32 mii_addr; + u32 mii_cmd; + u32 mii_indicator; /* Save a local copy of the registers we are dealing with so we can * set them back */ - miiAddr = readl(&mac->mii_mgmt_addr); - miiCmd = readl(&mac->mii_mgmt_cmd); + mii_addr = readl(&mac->mii_mgmt_addr); + mii_cmd = readl(&mac->mii_mgmt_cmd); /* Stop the current operation */ writel(0, &mac->mii_mgmt_cmd); /* Set up the register we need to write to on the correct PHY */ - writel(MII_ADDR(xcvrAddr, xcvrReg), &mac->mii_mgmt_addr); + writel(MII_ADDR(xcvr_addr, xcvr_reg), &mac->mii_mgmt_addr); /* Add the value to write to the registers to the mac */ writel(value, &mac->mii_mgmt_ctrl); @@ -203,32 +200,33 @@ int MiWrite(struct et131x_adapter *etdev, u8 xcvrReg, u16 value) do { udelay(50); delay++; - miiIndicator = readl(&mac->mii_mgmt_indicator); - } while ((miiIndicator & MGMT_BUSY) && delay < 100); + mii_indicator = readl(&mac->mii_mgmt_indicator); + } while ((mii_indicator & MGMT_BUSY) && delay < 100); /* If we hit the max delay, we could not write the register */ if (delay == 100) { - u16 TempValue; + u16 tmp; dev_warn(&etdev->pdev->dev, - "xcvrReg 0x%08x could not be written", xcvrReg); + "xcvrReg 0x%08x could not be written", xcvr_reg); dev_warn(&etdev->pdev->dev, "status is 0x%08x\n", - miiIndicator); + mii_indicator); dev_warn(&etdev->pdev->dev, "command is 0x%08x\n", readl(&mac->mii_mgmt_cmd)); - MiRead(etdev, xcvrReg, &TempValue); + et131x_mii_read(etdev, xcvr_reg, &tmp); status = -EIO; } /* 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(miiAddr, &mac->mii_mgmt_addr); - writel(miiCmd, &mac->mii_mgmt_cmd); + writel(mii_addr, &mac->mii_mgmt_addr); + writel(mii_cmd, &mac->mii_mgmt_cmd); return status; } @@ -249,12 +247,12 @@ int et131x_xcvr_find(struct et131x_adapter *etdev) /* We need to get xcvr id and address we just get the first one */ for (xcvr_addr = 0; xcvr_addr < 32; xcvr_addr++) { /* Read the ID from the PHY */ - PhyMiRead(etdev, xcvr_addr, - (u8) offsetof(struct mi_regs, idr1), - &idr1); - PhyMiRead(etdev, xcvr_addr, - (u8) offsetof(struct mi_regs, idr2), - &idr2); + et131x_phy_mii_read(etdev, xcvr_addr, + (u8) offsetof(struct mi_regs, idr1), + &idr1); + et131x_phy_mii_read(etdev, xcvr_addr, + (u8) offsetof(struct mi_regs, idr2), + &idr2); xcvr_id = (u32) ((idr1 << 16) | idr2); @@ -267,13 +265,13 @@ int et131x_xcvr_find(struct et131x_adapter *etdev) return -ENODEV; } -void ET1310_PhyReset(struct et131x_adapter *etdev) +void et1310_phy_reset(struct et131x_adapter *etdev) { - MiWrite(etdev, PHY_CONTROL, 0x8000); + et131x_mii_write(etdev, PHY_CONTROL, 0x8000); } /** - * ET1310_PhyPowerDown - PHY power control + * et1310_phy_power_down - PHY power control * @etdev: device to control * @down: true for off/false for back on * @@ -282,80 +280,76 @@ void ET1310_PhyReset(struct et131x_adapter *etdev) * Can't you see that this code processed * Phy power, phy power.. */ - -void ET1310_PhyPowerDown(struct et131x_adapter *etdev, bool down) +void et1310_phy_power_down(struct et131x_adapter *etdev, bool down) { u16 data; - MiRead(etdev, PHY_CONTROL, &data); + et131x_mii_read(etdev, PHY_CONTROL, &data); data &= ~0x0800; /* Power UP */ if (down) /* Power DOWN */ data |= 0x0800; - MiWrite(etdev, PHY_CONTROL, data); + et131x_mii_write(etdev, PHY_CONTROL, data); } /** - * ET130_PhyAutoNEg - autonegotiate control + * et1310_phy_auto_neg - autonegotiate control * @etdev: device to control * @enabe: autoneg on/off * * Set up the autonegotiation state according to whether we will be * negotiating the state or forcing a speed. */ - -static void ET1310_PhyAutoNeg(struct et131x_adapter *etdev, bool enable) +static void et1310_phy_auto_neg(struct et131x_adapter *etdev, bool enable) { u16 data; - MiRead(etdev, PHY_CONTROL, &data); + et131x_mii_read(etdev, PHY_CONTROL, &data); data &= ~0x1000; /* Autonegotiation OFF */ if (enable) data |= 0x1000; /* Autonegotiation ON */ - MiWrite(etdev, PHY_CONTROL, data); + et131x_mii_write(etdev, PHY_CONTROL, data); } /** - * ET130_PhyDuplexMode - duplex control + * et1310_phy_duplex_mode - duplex control * @etdev: device to control * @duplex: duplex on/off * * Set up the duplex state on the PHY */ - -static void ET1310_PhyDuplexMode(struct et131x_adapter *etdev, u16 duplex) +static void et1310_phy_duplex_mode(struct et131x_adapter *etdev, u16 duplex) { u16 data; - MiRead(etdev, PHY_CONTROL, &data); + et131x_mii_read(etdev, PHY_CONTROL, &data); data &= ~0x100; /* Set Half Duplex */ if (duplex == TRUEPHY_DUPLEX_FULL) data |= 0x100; /* Set Full Duplex */ - MiWrite(etdev, PHY_CONTROL, data); + et131x_mii_write(etdev, PHY_CONTROL, data); } /** - * ET130_PhySpeedSelect - speed control + * et1310_phy_speed_select - speed control * @etdev: device to control * @duplex: duplex on/off * * Set the speed of our PHY. */ - -static void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, u16 speed) +static void et1310_phy_speed_select(struct et131x_adapter *etdev, u16 speed) { u16 data; static const u16 bits[3] = {0x0000, 0x2000, 0x0040}; /* Read the PHY control register */ - MiRead(etdev, PHY_CONTROL, &data); + et131x_mii_read(etdev, PHY_CONTROL, &data); /* Clear all Speed settings (Bits 6, 13) */ data &= ~0x2040; /* Write back the new speed */ - MiWrite(etdev, PHY_CONTROL, data | bits[speed]); + et131x_mii_write(etdev, PHY_CONTROL, data | bits[speed]); } /** - * ET1310_PhyLinkStatus - read link state + * et1310_phy_link_status - read link state * @etdev: device to read * @link_status: reported link state * @autoneg: reported autonegotiation state (complete/incomplete/disabled) @@ -370,8 +364,7 @@ static void ET1310_PhySpeedSelect(struct et131x_adapter *etdev, u16 speed) * I know your link speed * I see all the setting that you'd rather keep */ - -static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, +static void et1310_phy_link_status(struct et131x_adapter *etdev, u8 *link_status, u32 *autoneg, u32 *linkspeed, @@ -384,10 +377,10 @@ static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, u16 vmi_phystatus = 0; u16 control = 0; - MiRead(etdev, PHY_STATUS, &mistatus); - MiRead(etdev, PHY_1000_STATUS, &is1000BaseT); - MiRead(etdev, PHY_PHY_STATUS, &vmi_phystatus); - MiRead(etdev, PHY_CONTROL, &control); + et131x_mii_read(etdev, PHY_STATUS, &mistatus); + et131x_mii_read(etdev, PHY_1000_STATUS, &is1000BaseT); + et131x_mii_read(etdev, PHY_PHY_STATUS, &vmi_phystatus); + et131x_mii_read(etdev, PHY_CONTROL, &control); *link_status = (vmi_phystatus & 0x0040) ? 1 : 0; *autoneg = (control & 0x1000) ? ((vmi_phystatus & 0x0020) ? @@ -405,26 +398,26 @@ static void ET1310_PhyLinkStatus(struct et131x_adapter *etdev, TRUEPHY_POLARITY_INVERTED : TRUEPHY_POLARITY_NORMAL; } -static void ET1310_PhyAndOrReg(struct et131x_adapter *etdev, - u16 regnum, u16 andMask, u16 orMask) +static void et1310_phy_and_or_reg(struct et131x_adapter *etdev, + u16 regnum, u16 and_mask, u16 or_mask) { u16 reg; - MiRead(etdev, regnum, ®); - reg &= andMask; - reg |= orMask; - MiWrite(etdev, regnum, reg); + et131x_mii_read(etdev, regnum, ®); + reg &= and_mask; + reg |= or_mask; + et131x_mii_write(etdev, regnum, reg); } -/* Still used from _mac for BIT_READ */ -void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, u16 action, - u16 regnum, u16 bitnum, u8 *value) +/* Still used from _mac for BIT_READ */ +void et1310_phy_access_mii_bit(struct et131x_adapter *etdev, u16 action, + u16 regnum, u16 bitnum, u8 *value) { u16 reg; u16 mask = 0x0001 << bitnum; /* Read the requested register */ - MiRead(etdev, regnum, ®); + et131x_mii_read(etdev, regnum, ®); switch (action) { case TRUEPHY_BIT_READ: @@ -432,11 +425,11 @@ void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, u16 action, break; case TRUEPHY_BIT_SET: - MiWrite(etdev, regnum, reg | mask); + et131x_mii_write(etdev, regnum, reg | mask); break; case TRUEPHY_BIT_CLEAR: - MiWrite(etdev, regnum, reg & ~mask); + et131x_mii_write(etdev, regnum, reg & ~mask); break; default: @@ -444,13 +437,13 @@ void ET1310_PhyAccessMiBit(struct et131x_adapter *etdev, u16 action, } } -void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev, +void et1310_phy_advertise_1000BaseT(struct et131x_adapter *etdev, u16 duplex) { u16 data; /* Read the PHY 1000 Base-T Control Register */ - MiRead(etdev, PHY_1000_CONTROL, &data); + et131x_mii_read(etdev, PHY_1000_CONTROL, &data); /* Clear Bits 8,9 */ data &= ~0x0300; @@ -477,16 +470,16 @@ void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *etdev, } /* Write back advertisement */ - MiWrite(etdev, PHY_1000_CONTROL, data); + et131x_mii_write(etdev, PHY_1000_CONTROL, data); } -static void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev, - u16 duplex) +static void et1310_phy_advertise_100BaseT(struct et131x_adapter *etdev, + u16 duplex) { u16 data; /* Read the Autonegotiation Register (10/100) */ - MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data); + et131x_mii_read(etdev, PHY_AUTO_ADVERTISEMENT, &data); /* Clear bits 7,8 */ data &= ~0x0180; @@ -514,16 +507,16 @@ static void ET1310_PhyAdvertise100BaseT(struct et131x_adapter *etdev, } /* Write back advertisement */ - MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); + et131x_mii_write(etdev, PHY_AUTO_ADVERTISEMENT, data); } -static void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev, +static void et1310_phy_advertise_10BaseT(struct et131x_adapter *etdev, u16 duplex) { u16 data; /* Read the Autonegotiation Register (10/100) */ - MiRead(etdev, PHY_AUTO_ADVERTISEMENT, &data); + et131x_mii_read(etdev, PHY_AUTO_ADVERTISEMENT, &data); /* Clear bits 5,6 */ data &= ~0x0060; @@ -551,25 +544,9 @@ static void ET1310_PhyAdvertise10BaseT(struct et131x_adapter *etdev, } /* Write back advertisement */ - MiWrite(etdev, PHY_AUTO_ADVERTISEMENT, data); -} - -/** - * et131x_setphy_normal - Set PHY for normal operation. - * @etdev: pointer to our private adapter structure - * - * Used by Power Management to force the PHY into 10 Base T half-duplex mode, - * when going to D3 in WOL mode. Also used during initialization to set the - * PHY for normal operation. - */ -void et131x_setphy_normal(struct et131x_adapter *etdev) -{ - /* Make sure the PHY is powered up */ - ET1310_PhyPowerDown(etdev, 0); - et131x_xcvr_init(etdev); + et131x_mii_write(etdev, PHY_AUTO_ADVERTISEMENT, data); } - /** * et131x_xcvr_init - Init the phy if we are setting it into force mode * @etdev: pointer to our private adapter structure @@ -584,15 +561,15 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev) /* Zero out the adapter structure variable representing BMSR */ etdev->bmsr = 0; - MiRead(etdev, (u8) offsetof(struct mi_regs, isr), &isr); - MiRead(etdev, (u8) offsetof(struct mi_regs, imr), &imr); + et131x_mii_read(etdev, (u8) offsetof(struct mi_regs, isr), &isr); + et131x_mii_read(etdev, (u8) offsetof(struct mi_regs, imr), &imr); /* Set the link status interrupt only. Bad behavior when link status * and auto neg are set, we run into a nested interrupt problem */ imr |= 0x0105; - MiWrite(etdev, (u8) offsetof(struct mi_regs, imr), imr); + et131x_mii_write(etdev, (u8) offsetof(struct mi_regs, imr), imr); /* Set the LED behavior such that LED 1 indicates speed (off = * 10Mbits, blink = 100Mbits, on = 1000Mbits) and LED 2 indicates @@ -603,7 +580,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev) * EEPROM. However, the above description is the default. */ if ((etdev->eeprom_data[1] & 0x4) == 0) { - MiRead(etdev, (u8) offsetof(struct mi_regs, lcr2), + et131x_mii_read(etdev, (u8) offsetof(struct mi_regs, lcr2), &lcr2); lcr2 &= 0x00FF; @@ -614,7 +591,7 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev) else lcr2 |= 0x0400; - MiWrite(etdev, (u8) offsetof(struct mi_regs, lcr2), + et131x_mii_write(etdev, (u8) offsetof(struct mi_regs, lcr2), lcr2); } @@ -622,113 +599,130 @@ static void et131x_xcvr_init(struct et131x_adapter *etdev) if (etdev->AiForceSpeed == 0 && etdev->AiForceDpx == 0) { if (etdev->wanted_flow == FLOW_TXONLY || etdev->wanted_flow == FLOW_BOTH) - ET1310_PhyAccessMiBit(etdev, + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_SET, 4, 11, NULL); else - ET1310_PhyAccessMiBit(etdev, + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_CLEAR, 4, 11, NULL); if (etdev->wanted_flow == FLOW_BOTH) - ET1310_PhyAccessMiBit(etdev, + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_SET, 4, 10, NULL); else - ET1310_PhyAccessMiBit(etdev, + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_CLEAR, 4, 10, NULL); /* Set the phy to autonegotiation */ - ET1310_PhyAutoNeg(etdev, true); + et1310_phy_auto_neg(etdev, true); /* NOTE - Do we need this? */ - ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_SET, 0, 9, NULL); + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_SET, 0, 9, NULL); return; } - ET1310_PhyAutoNeg(etdev, false); + et1310_phy_auto_neg(etdev, false); /* Set to the correct force mode. */ if (etdev->AiForceDpx != 1) { if (etdev->wanted_flow == FLOW_TXONLY || etdev->wanted_flow == FLOW_BOTH) - ET1310_PhyAccessMiBit(etdev, + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_SET, 4, 11, NULL); else - ET1310_PhyAccessMiBit(etdev, + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_CLEAR, 4, 11, NULL); if (etdev->wanted_flow == FLOW_BOTH) - ET1310_PhyAccessMiBit(etdev, + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_SET, 4, 10, NULL); else - ET1310_PhyAccessMiBit(etdev, + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_CLEAR, 4, 10, NULL); } else { - ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_CLEAR, 4, 10, NULL); - ET1310_PhyAccessMiBit(etdev, TRUEPHY_BIT_CLEAR, 4, 11, NULL); + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_CLEAR, + 4, 10, NULL); + et1310_phy_access_mii_bit(etdev, TRUEPHY_BIT_CLEAR, + 4, 11, NULL); } - ET1310_PhyPowerDown(etdev, 1); + et1310_phy_power_down(etdev, 1); switch (etdev->AiForceSpeed) { case 10: /* First we need to turn off all other advertisement */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + et1310_phy_advertise_100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); if (etdev->AiForceDpx == 1) { /* Set our advertise values accordingly */ - ET1310_PhyAdvertise10BaseT(etdev, + et1310_phy_advertise_10BaseT(etdev, TRUEPHY_ADV_DUPLEX_HALF); } else if (etdev->AiForceDpx == 2) { /* Set our advertise values accordingly */ - ET1310_PhyAdvertise10BaseT(etdev, + et1310_phy_advertise_10BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); } else { /* Disable autoneg */ - ET1310_PhyAutoNeg(etdev, false); + et1310_phy_auto_neg(etdev, false); /* Disable rest of the advertisements */ - ET1310_PhyAdvertise10BaseT(etdev, + et1310_phy_advertise_10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); /* Force 10 Mbps */ - ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_10MBPS); + et1310_phy_speed_select(etdev, TRUEPHY_SPEED_10MBPS); /* Force Full duplex */ - ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL); + et1310_phy_duplex_mode(etdev, TRUEPHY_DUPLEX_FULL); } break; case 100: /* first we need to turn off all other advertisement */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + et1310_phy_advertise_10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); if (etdev->AiForceDpx == 1) { /* Set our advertise values accordingly */ - ET1310_PhyAdvertise100BaseT(etdev, + et1310_phy_advertise_100BaseT(etdev, TRUEPHY_ADV_DUPLEX_HALF); /* Set speed */ - ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS); + et1310_phy_speed_select(etdev, TRUEPHY_SPEED_100MBPS); } else if (etdev->AiForceDpx == 2) { /* Set our advertise values accordingly */ - ET1310_PhyAdvertise100BaseT(etdev, + et1310_phy_advertise_100BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); } else { /* Disable autoneg */ - ET1310_PhyAutoNeg(etdev, false); + et1310_phy_auto_neg(etdev, false); /* Disable other advertisement */ - ET1310_PhyAdvertise100BaseT(etdev, + et1310_phy_advertise_100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); /* Force 100 Mbps */ - ET1310_PhySpeedSelect(etdev, TRUEPHY_SPEED_100MBPS); + et1310_phy_speed_select(etdev, TRUEPHY_SPEED_100MBPS); /* Force Full duplex */ - ET1310_PhyDuplexMode(etdev, TRUEPHY_DUPLEX_FULL); + et1310_phy_duplex_mode(etdev, TRUEPHY_DUPLEX_FULL); } break; case 1000: /* first we need to turn off all other advertisement */ - ET1310_PhyAdvertise100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); - ET1310_PhyAdvertise10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + et1310_phy_advertise_100BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + et1310_phy_advertise_10BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); /* set our advertise values accordingly */ - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); + et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); break; } - ET1310_PhyPowerDown(etdev, 0); + et1310_phy_power_down(etdev, 0); +} + +/** + * et131x_setphy_normal - Set PHY for normal operation. + * @etdev: pointer to our private adapter structure + * + * Used by Power Management to force the PHY into 10 Base T half-duplex mode, + * when going to D3 in WOL mode. Also used during initialization to set the + * PHY for normal operation. + */ +void et131x_setphy_normal(struct et131x_adapter *etdev) +{ + /* Make sure the PHY is powered up */ + et1310_phy_power_down(etdev, 0); + et131x_xcvr_init(etdev); } -void et131x_Mii_check(struct et131x_adapter *etdev, +void et131x_mii_check(struct et131x_adapter *etdev, u16 bmsr, u16 bmsr_ints) { u8 link_status; @@ -764,13 +758,14 @@ void et131x_Mii_check(struct et131x_adapter *etdev, * && TRU_QueryCoreType(etdev->hTruePhy, 0) == * EMI_TRUEPHY_A13O) { */ - u16 Register18; - - MiRead(etdev, 0x12, &Register18); - MiWrite(etdev, 0x12, Register18 | 0x4); - MiWrite(etdev, 0x10, Register18 | 0x8402); - MiWrite(etdev, 0x11, Register18 | 511); - MiWrite(etdev, 0x12, Register18); + u16 register18; + + et131x_mii_read(etdev, 0x12, ®ister18); + et131x_mii_write(etdev, 0x12, register18 | 0x4); + et131x_mii_write(etdev, 0x10, + register18 | 0x8402); + et131x_mii_write(etdev, 0x11, register18 | 511); + et131x_mii_write(etdev, 0x12, register18); } /* For the first N seconds of life, we are in "link @@ -805,7 +800,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, * 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 ConfigMacREGS2. + * we can complete init by calling config_mac_regs2. */ et131x_soft_reset(etdev); @@ -824,7 +819,7 @@ void et131x_Mii_check(struct et131x_adapter *etdev, (etdev->AiForceDpx == 3 && (bmsr_ints & MI_BMSR_LINK_STATUS))) { if ((bmsr & MI_BMSR_AUTO_NEG_COMPLETE) || etdev->AiForceDpx == 3) { - ET1310_PhyLinkStatus(etdev, + et1310_phy_link_status(etdev, &link_status, &autoneg_status, &speed, &duplex, &mdi_mdix, &masterslave, &polarity); @@ -841,20 +836,21 @@ void et131x_Mii_check(struct et131x_adapter *etdev, * && TRU_QueryCoreType(etdev->hTruePhy, 0)== * EMI_TRUEPHY_A13O) { */ - u16 Register18; - - MiRead(etdev, 0x12, &Register18); - MiWrite(etdev, 0x12, Register18 | 0x4); - MiWrite(etdev, 0x10, Register18 | 0x8402); - MiWrite(etdev, 0x11, Register18 | 511); - MiWrite(etdev, 0x12, Register18); + u16 register18; + + et131x_mii_read(etdev, 0x12, ®ister18); + et131x_mii_write(etdev, 0x12, register18 | 0x4); + et131x_mii_write(etdev, 0x10, + register18 | 0x8402); + et131x_mii_write(etdev, 0x11, register18 | 511); + et131x_mii_write(etdev, 0x12, register18); } config_flow_control(etdev); if (etdev->linkspeed == TRUEPHY_SPEED_1000MBPS && etdev->RegistryJumboPacket > 2048) - ET1310_PhyAndOrReg(etdev, 0x16, 0xcfff, + et1310_phy_and_or_reg(etdev, 0x16, 0xcfff, 0x2000); SetRxDmaTimer(etdev); @@ -868,9 +864,8 @@ void et131x_Mii_check(struct et131x_adapter *etdev, * primarily by the routines above (although there are a few places elsewhere * in the driver where this level of access is required). */ - -static const u16 ConfigPhy[25][2] = { - /* Reg Value Register */ +static const u16 config_phy[25][2] = { + /* Reg Value Register */ /* Addr */ {0x880B, 0x0926}, /* AfeIfCreg4B1000Msbs */ {0x880C, 0x0926}, /* AfeIfCreg4B100Msbs */ @@ -906,11 +901,10 @@ static const u16 ConfigPhy[25][2] = { {0x8010, 46}, /* IdlguardTime */ {0, 0} - }; /* condensed version of the phy initialization routine */ -void ET1310_PhyInit(struct et131x_adapter *etdev) +void et1310_phy_init(struct et131x_adapter *etdev) { u16 data, index; @@ -918,62 +912,66 @@ void ET1310_PhyInit(struct et131x_adapter *etdev) return; /* get the identity (again ?) */ - MiRead(etdev, PHY_ID_1, &data); - MiRead(etdev, PHY_ID_2, &data); + et131x_mii_read(etdev, PHY_ID_1, &data); + et131x_mii_read(etdev, PHY_ID_2, &data); /* what does this do/achieve ? */ - MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); + /* should read 0002 */ + et131x_mii_read(etdev, PHY_MPHY_CONTROL_REG, &data); + et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0006); /* read modem register 0402, should I do something with the return data ? */ - MiWrite(etdev, PHY_INDEX_REG, 0x0402); - MiRead(etdev, PHY_DATA_REG, &data); + et131x_mii_write(etdev, PHY_INDEX_REG, 0x0402); + et131x_mii_read(etdev, PHY_DATA_REG, &data); /* what does this do/achieve ? */ - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); + et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0002); /* get the identity (again ?) */ - MiRead(etdev, PHY_ID_1, &data); - MiRead(etdev, PHY_ID_2, &data); + et131x_mii_read(etdev, PHY_ID_1, &data); + et131x_mii_read(etdev, PHY_ID_2, &data); /* what does this achieve ? */ - MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0006); + /* should read 0002 */ + et131x_mii_read(etdev, PHY_MPHY_CONTROL_REG, &data); + et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0006); /* read modem register 0402, should I do something with the return data? */ - MiWrite(etdev, PHY_INDEX_REG, 0x0402); - MiRead(etdev, PHY_DATA_REG, &data); + et131x_mii_write(etdev, PHY_INDEX_REG, 0x0402); + et131x_mii_read(etdev, PHY_DATA_REG, &data); - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); + et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0002); /* what does this achieve (should return 0x1040) */ - MiRead(etdev, PHY_CONTROL, &data); - MiRead(etdev, PHY_MPHY_CONTROL_REG, &data); /* should read 0002 */ - MiWrite(etdev, PHY_CONTROL, 0x1840); + et131x_mii_read(etdev, PHY_CONTROL, &data); + /* should read 0002 */ + et131x_mii_read(etdev, PHY_MPHY_CONTROL_REG, &data); + et131x_mii_write(etdev, PHY_CONTROL, 0x1840); - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0007); + et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0007); /* here the writing of the array starts.... */ index = 0; - while (ConfigPhy[index][0] != 0x0000) { + while (config_phy[index][0] != 0x0000) { /* write value */ - MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]); - MiWrite(etdev, PHY_DATA_REG, ConfigPhy[index][1]); + et131x_mii_write(etdev, PHY_INDEX_REG, config_phy[index][0]); + et131x_mii_write(etdev, PHY_DATA_REG, config_phy[index][1]); /* read it back */ - MiWrite(etdev, PHY_INDEX_REG, ConfigPhy[index][0]); - MiRead(etdev, PHY_DATA_REG, &data); + et131x_mii_write(etdev, PHY_INDEX_REG, config_phy[index][0]); + et131x_mii_read(etdev, PHY_DATA_REG, &data); /* do a check on the value read back ? */ index++; } /* here the writing of the array ends... */ - MiRead(etdev, PHY_CONTROL, &data); /* 0x1840 */ - MiRead(etdev, PHY_MPHY_CONTROL_REG, &data);/* should read 0007 */ - MiWrite(etdev, PHY_CONTROL, 0x1040); - MiWrite(etdev, PHY_MPHY_CONTROL_REG, 0x0002); + et131x_mii_read(etdev, PHY_CONTROL, &data); /* 0x1840 */ + /* should read 0007 */ + et131x_mii_read(etdev, PHY_MPHY_CONTROL_REG, &data); + et131x_mii_write(etdev, PHY_CONTROL, 0x1040); + et131x_mii_write(etdev, PHY_MPHY_CONTROL_REG, 0x0002); } diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h index 289d511f64d..c4f9032d6a1 100644 --- a/drivers/staging/et131x/et131x.h +++ b/drivers/staging/et131x/et131x.h @@ -90,14 +90,14 @@ void EnablePhyComa(struct et131x_adapter *adapter); void DisablePhyComa(struct et131x_adapter *adapter); /* et131x_phy.c */ -void ET1310_PhyInit(struct et131x_adapter *adapter); -void ET1310_PhyReset(struct et131x_adapter *adapter); -void ET1310_PhyPowerDown(struct et131x_adapter *adapter, bool down); -void ET1310_PhyAdvertise1000BaseT(struct et131x_adapter *adapter, - u16 duplex); -void ET1310_PhyAccessMiBit(struct et131x_adapter *adapter, - u16 action, - u16 regnum, u16 bitnum, u8 *value); +void et1310_phy_init(struct et131x_adapter *adapter); +void et1310_phy_reset(struct et131x_adapter *adapter); +void et1310_phy_power_down(struct et131x_adapter *adapter, bool down); +void et1310_phy_advertise_1000BaseT(struct et131x_adapter *adapter, + u16 duplex); +void et1310_phy_access_mii_bit(struct et131x_adapter *adapter, + u16 action, + u16 regnum, u16 bitnum, u8 *value); int et131x_xcvr_find(struct et131x_adapter *adapter); void et131x_setphy_normal(struct et131x_adapter *adapter); @@ -105,23 +105,18 @@ void et131x_setphy_normal(struct et131x_adapter *adapter); /* static inline function does not work because et131x_adapter is not always * defined */ -int PhyMiRead(struct et131x_adapter *adapter, u8 xcvrAddr, +int et131x_phy_mii_read(struct et131x_adapter *adapter, u8 xcvrAddr, u8 xcvrReg, u16 *value); -#define MiRead(adapter, xcvrReg, value) \ - PhyMiRead((adapter), (adapter)->stats.xcvr_addr, (xcvrReg), (value)) +#define et131x_mii_read(adapter, xcvrReg, value) \ + et131x_phy_mii_read((adapter), \ + (adapter)->stats.xcvr_addr, \ + (xcvrReg), (value)) -int32_t MiWrite(struct et131x_adapter *adapter, +int32_t et131x_mii_write(struct et131x_adapter *adapter, u8 xcvReg, u16 value); -void et131x_Mii_check(struct et131x_adapter *pAdapter, +void et131x_mii_check(struct et131x_adapter *pAdapter, u16 bmsr, u16 bmsr_ints); -/* This last is not strictly required (the driver could call the TPAL - * version instead), but this sets the adapter up correctly, and calls the - * access routine indirectly. This protects the driver from changes in TPAL. - */ -void SetPhy_10BaseTHalfDuplex(struct et131x_adapter *adapter); - - /* et1310_rx.c */ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter); void et131x_rx_dma_memory_free(struct et131x_adapter *adapter); diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index d98db859f7c..9b01f22c18b 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -401,28 +401,28 @@ int et131x_adapter_setup(struct et131x_adapter *etdev) dev_warn(&etdev->pdev->dev, "Could not find the xcvr\n"); /* Prepare the TRUEPHY library. */ - ET1310_PhyInit(etdev); + et1310_phy_init(etdev); /* Reset the phy now so changes take place */ - ET1310_PhyReset(etdev); + et1310_phy_reset(etdev); /* Power down PHY */ - ET1310_PhyPowerDown(etdev, 1); + et1310_phy_power_down(etdev, 1); /* * We need to turn off 1000 base half dulplex, the mac does not * support it. For the 10/100 part, turn off all gig advertisement */ if (etdev->pdev->device != ET131X_PCI_DEVICE_ID_FAST) - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); + et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_FULL); else - ET1310_PhyAdvertise1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); + et1310_phy_advertise_1000BaseT(etdev, TRUEPHY_ADV_DUPLEX_NONE); /* Power up PHY */ - ET1310_PhyPowerDown(etdev, 0); + et1310_phy_power_down(etdev, 0); et131x_setphy_normal(etdev); -; return status; + return status; } /** diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index 48b4d785e11..0a810cce631 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -385,11 +385,12 @@ void et131x_isr_handler(struct work_struct *work) /* Read the PHY ISR to clear the reason for the * interrupt. */ - MiRead(etdev, (uint8_t) offsetof(struct mi_regs, isr), - &myisr); + et131x_mii_read(etdev, + (uint8_t) offsetof(struct mi_regs, isr), + &myisr); if (!etdev->ReplicaPhyLoopbk) { - MiRead(etdev, + et131x_mii_read(etdev, (uint8_t) offsetof(struct mi_regs, bmsr), &bmsr_data); @@ -397,7 +398,7 @@ void et131x_isr_handler(struct work_struct *work) etdev->bmsr = bmsr_data; /* Do all the cable in / cable out stuff */ - et131x_Mii_check(etdev, bmsr_data, bmsr_ints); + et131x_mii_check(etdev, bmsr_data, bmsr_ints); } } diff --git a/drivers/staging/et131x/et131x_netdev.c b/drivers/staging/et131x/et131x_netdev.c index 4e9e1766ba6..0f12b584c44 100644 --- a/drivers/staging/et131x/et131x_netdev.c +++ b/drivers/staging/et131x/et131x_netdev.c @@ -221,7 +221,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd) if (!capable(CAP_NET_ADMIN)) status = -EPERM; else - status = MiRead(etdev, + status = et131x_mii_read(etdev, data->reg_num, &data->val_out); break; @@ -229,7 +229,7 @@ int et131x_ioctl_mii(struct net_device *netdev, struct ifreq *reqbuf, int cmd) if (!capable(CAP_NET_ADMIN)) status = -EPERM; else - status = MiWrite(etdev, data->reg_num, + status = et131x_mii_write(etdev, data->reg_num, data->val_in); break; -- cgit v1.2.3-18-g5258 From c2329af4b9abe91218c07c3ed4897d48eca4b918 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Sun, 10 Jul 2011 16:35:28 +0100 Subject: staging: et131x: Converting et1310_pm.c function and local names from CamelCase Tested on an ET-131x device. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_phy.c | 2 +- drivers/staging/et131x/et1310_pm.c | 8 ++++---- drivers/staging/et131x/et131x.h | 8 ++++---- drivers/staging/et131x/et131x_initpci.c | 2 +- drivers/staging/et131x/et131x_isr.c | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index d53656bae84..72892e06199 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -811,7 +811,7 @@ void et131x_mii_check(struct et131x_adapter *etdev, * plugged back in */ if (etdev->RegistryPhyComa == 1) - EnablePhyComa(etdev); + et1310_enable_phy_coma(etdev); } } diff --git a/drivers/staging/et131x/et1310_pm.c b/drivers/staging/et131x/et1310_pm.c index 29d4d66d345..1bfcc670501 100644 --- a/drivers/staging/et131x/et1310_pm.c +++ b/drivers/staging/et131x/et1310_pm.c @@ -87,7 +87,7 @@ #include "et131x.h" /** - * EnablePhyComa - called when network cable is unplugged + * et1310_enable_phy_coma - called when network cable is unplugged * @etdev: pointer to our adapter structure * * driver receive an phy status change interrupt while in D0 and check that @@ -106,7 +106,7 @@ * indicating linkup status, call the MPDisablePhyComa routine to * restore JAGCore and gigE PHY */ -void EnablePhyComa(struct et131x_adapter *etdev) +void et1310_enable_phy_coma(struct et131x_adapter *etdev) { unsigned long flags; u32 pmcsr; @@ -136,10 +136,10 @@ void EnablePhyComa(struct et131x_adapter *etdev) } /** - * DisablePhyComa - Disable the Phy Coma Mode + * et1310_disable_phy_coma - Disable the Phy Coma Mode * @etdev: pointer to our adapter structure */ -void DisablePhyComa(struct et131x_adapter *etdev) +void et1310_disable_phy_coma(struct et131x_adapter *etdev) { u32 pmcsr; diff --git a/drivers/staging/et131x/et131x.h b/drivers/staging/et131x/et131x.h index c4f9032d6a1..240305e74c4 100644 --- a/drivers/staging/et131x/et131x.h +++ b/drivers/staging/et131x/et131x.h @@ -85,11 +85,11 @@ void setup_device_for_unicast(struct et131x_adapter *adapter); /* et131x_netdev.c */ struct net_device *et131x_device_alloc(void); -/* et131x_pm.c */ -void EnablePhyComa(struct et131x_adapter *adapter); -void DisablePhyComa(struct et131x_adapter *adapter); +/* et1310_pm.c */ +void et1310_enable_phy_coma(struct et131x_adapter *adapter); +void et1310_disable_phy_coma(struct et131x_adapter *adapter); -/* et131x_phy.c */ +/* et1310_phy.c */ void et1310_phy_init(struct et131x_adapter *adapter); void et1310_phy_reset(struct et131x_adapter *adapter); void et1310_phy_power_down(struct et131x_adapter *adapter, bool down); diff --git a/drivers/staging/et131x/et131x_initpci.c b/drivers/staging/et131x/et131x_initpci.c index 9b01f22c18b..c39f5f046a0 100644 --- a/drivers/staging/et131x/et131x_initpci.c +++ b/drivers/staging/et131x/et131x_initpci.c @@ -288,7 +288,7 @@ void et131x_error_timer_handler(unsigned long data) * interrupt'. How to do that under Linux? */ et131x_enable_interrupts(etdev); - EnablePhyComa(etdev); + et1310_enable_phy_coma(etdev); } } } diff --git a/drivers/staging/et131x/et131x_isr.c b/drivers/staging/et131x/et131x_isr.c index 0a810cce631..dd952f07e5e 100644 --- a/drivers/staging/et131x/et131x_isr.c +++ b/drivers/staging/et131x/et131x_isr.c @@ -379,7 +379,7 @@ void et131x_isr_handler(struct work_struct *work) * so, disable it because we will not be able * to read PHY values until we are out. */ - DisablePhyComa(etdev); + et1310_disable_phy_coma(etdev); } /* Read the PHY ISR to clear the reason for the -- cgit v1.2.3-18-g5258 From 9590e93c79073fc1e36e18fd79ca870fc710c129 Mon Sep 17 00:00:00 2001 From: Mark Einon Date: Sun, 10 Jul 2011 16:35:30 +0100 Subject: staging: et131x: Converting et1310_rx.c function and local names from CamelCase Also renamed some items to improve readability, and other minor tidy-ups. Tested on an ET-131x device. Signed-off-by: Mark Einon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/et131x/et1310_phy.c | 2 +- drivers/staging/et131x/et1310_rx.c | 191 ++++++++++++++++---------------- drivers/staging/et131x/et131x.h | 4 +- drivers/staging/et131x/et131x_initpci.c | 2 +- 4 files changed, 97 insertions(+), 102 deletions(-) (limited to 'drivers') diff --git a/drivers/staging/et131x/et1310_phy.c b/drivers/staging/et131x/et1310_phy.c index 72892e06199..d3d3b463742 100644 --- a/drivers/staging/et131x/et1310_phy.c +++ b/drivers/staging/et131x/et1310_phy.c @@ -853,7 +853,7 @@ void et131x_mii_check(struct et131x_adapter *etdev, et1310_phy_and_or_reg(etdev, 0x16, 0xcfff, 0x2000); - SetRxDmaTimer(etdev); + et131x_set_rx_dma_timer(etdev); config_mac_regs2(etdev); } } diff --git a/drivers/staging/et131x/et1310_rx.c b/drivers/staging/et131x/et1310_rx.c index 7e386e07ff9..e5bafc8f570 100644 --- a/drivers/staging/et131x/et1310_rx.c +++ b/drivers/staging/et131x/et1310_rx.c @@ -88,22 +88,22 @@ #include "et1310_rx.h" #include "et131x.h" -static inline u32 bump_fbr(u32 *fbr, u32 limit) +static inline u32 bump_free_buff_ring(u32 *free_buff_ring, u32 limit) { - u32 v = *fbr; - v++; + 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 */ - if ((v & ET_DMA10_MASK) > limit) { - v &= ~ET_DMA10_MASK; - v ^= ET_DMA10_WRAP; + if ((tmp_free_buff_ring & ET_DMA10_MASK) > limit) { + tmp_free_buff_ring &= ~ET_DMA10_MASK; + tmp_free_buff_ring ^= ET_DMA10_WRAP; } /* For the 1023 case */ - v &= (ET_DMA10_MASK|ET_DMA10_WRAP); - *fbr = v; - return v; + tmp_free_buff_ring &= (ET_DMA10_MASK|ET_DMA10_WRAP); + *free_buff_ring = tmp_free_buff_ring; + return tmp_free_buff_ring; } /** @@ -119,7 +119,7 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) { u32 i, j; u32 bufsize; - u32 pktStatRingSize, FBRChunkSize; + u32 pktstat_ringsize, fbr_chunksize; struct rx_ring *rx_ring; /* Setup some convenience pointers */ @@ -239,9 +239,9 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) for (i = 0; i < (rx_ring->Fbr1NumEntries / FBR_CHUNKS); i++) { - u64 Fbr1Offset; - u64 Fbr1T