aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/forcedeth.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-11-29 02:41:52 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-29 14:44:51 -0500
commit344d0dce5164d0bf2d73cf10510fe08ed8cf8248 (patch)
tree1ed253486884d53ab9180a5b366a2dc1fe9f50f4 /drivers/net/forcedeth.c
parent77148625e10d0fda50d05e92d199c0df17b66e9a (diff)
forcedeth: Change reg_delay arguments and use
Move the printk out of reg_delay and make the callers emit a message on error. Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r--drivers/net/forcedeth.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 2fd1ae9e13b5..e5f9d4b5ee05 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -948,7 +948,7 @@ static bool nv_optimized(struct fe_priv *np)
948} 948}
949 949
950static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target, 950static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target,
951 int delay, int delaymax, const char *msg) 951 int delay, int delaymax)
952{ 952{
953 u8 __iomem *base = get_hwbase(dev); 953 u8 __iomem *base = get_hwbase(dev);
954 954
@@ -956,11 +956,8 @@ static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target,
956 do { 956 do {
957 udelay(delay); 957 udelay(delay);
958 delaymax -= delay; 958 delaymax -= delay;
959 if (delaymax < 0) { 959 if (delaymax < 0)
960 if (msg)
961 printk("%s", msg);
962 return 1; 960 return 1;
963 }
964 } while ((readl(base + offset) & mask) != target); 961 } while ((readl(base + offset) & mask) != target);
965 return 0; 962 return 0;
966} 963}
@@ -1141,9 +1138,9 @@ static int mii_rw(struct net_device *dev, int addr, int miireg, int value)
1141 writel(reg, base + NvRegMIIControl); 1138 writel(reg, base + NvRegMIIControl);
1142 1139
1143 if (reg_delay(dev, NvRegMIIControl, NVREG_MIICTL_INUSE, 0, 1140 if (reg_delay(dev, NvRegMIIControl, NVREG_MIICTL_INUSE, 0,
1144 NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) { 1141 NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX)) {
1145 dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d timed out.\n", 1142 dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d timed out.\n",
1146 dev->name, miireg, addr); 1143 dev->name, miireg, addr);
1147 retval = -1; 1144 retval = -1;
1148 } else if (value != MII_READ) { 1145 } else if (value != MII_READ) {
1149 /* it was a write operation - fewer failures are detectable */ 1146 /* it was a write operation - fewer failures are detectable */
@@ -1539,9 +1536,9 @@ static void nv_stop_rx(struct net_device *dev)
1539 else 1536 else
1540 rx_ctrl |= NVREG_RCVCTL_RX_PATH_EN; 1537 rx_ctrl |= NVREG_RCVCTL_RX_PATH_EN;
1541 writel(rx_ctrl, base + NvRegReceiverControl); 1538 writel(rx_ctrl, base + NvRegReceiverControl);
1542 reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0, 1539 if (reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0,
1543 NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX, 1540 NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX))
1544 KERN_INFO "nv_stop_rx: ReceiverStatus remained busy"); 1541 printk(KERN_INFO "nv_stop_rx: ReceiverStatus remained busy");
1545 1542
1546 udelay(NV_RXSTOP_DELAY2); 1543 udelay(NV_RXSTOP_DELAY2);
1547 if (!np->mac_in_use) 1544 if (!np->mac_in_use)
@@ -1574,9 +1571,9 @@ static void nv_stop_tx(struct net_device *dev)
1574 else 1571 else
1575 tx_ctrl |= NVREG_XMITCTL_TX_PATH_EN; 1572 tx_ctrl |= NVREG_XMITCTL_TX_PATH_EN;
1576 writel(tx_ctrl, base + NvRegTransmitterControl); 1573 writel(tx_ctrl, base + NvRegTransmitterControl);
1577 reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0, 1574 if (reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0,
1578 NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX, 1575 NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX))
1579 KERN_INFO "nv_stop_tx: TransmitterStatus remained busy"); 1576 printk(KERN_INFO "nv_stop_tx: TransmitterStatus remained busy");
1580 1577
1581 udelay(NV_TXSTOP_DELAY2); 1578 udelay(NV_TXSTOP_DELAY2);
1582 if (!np->mac_in_use) 1579 if (!np->mac_in_use)
@@ -5190,9 +5187,10 @@ static int nv_open(struct net_device *dev)
5190 writel(np->vlanctl_bits, base + NvRegVlanControl); 5187 writel(np->vlanctl_bits, base + NvRegVlanControl);
5191 pci_push(base); 5188 pci_push(base);
5192 writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl); 5189 writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl);
5193 reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, 5190 if (reg_delay(dev, NvRegUnknownSetupReg5,
5194 NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX, 5191 NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31,
5195 KERN_INFO "open: SetupReg5, Bit 31 remained off\n"); 5192 NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX))
5193 printk(KERN_INFO "open: SetupReg5, Bit 31 remained off\n");
5196 5194
5197 writel(0, base + NvRegMIIMask); 5195 writel(0, base + NvRegMIIMask);
5198 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); 5196 writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);