Commit 344d0dce authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 77148625
...@@ -948,7 +948,7 @@ static bool nv_optimized(struct fe_priv *np) ...@@ -948,7 +948,7 @@ static bool nv_optimized(struct fe_priv *np)
} }
static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target, static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target,
int delay, int delaymax, const char *msg) int delay, int delaymax)
{ {
u8 __iomem *base = get_hwbase(dev); u8 __iomem *base = get_hwbase(dev);
...@@ -956,11 +956,8 @@ static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target, ...@@ -956,11 +956,8 @@ static int reg_delay(struct net_device *dev, int offset, u32 mask, u32 target,
do { do {
udelay(delay); udelay(delay);
delaymax -= delay; delaymax -= delay;
if (delaymax < 0) { if (delaymax < 0)
if (msg)
printk("%s", msg);
return 1; return 1;
}
} while ((readl(base + offset) & mask) != target); } while ((readl(base + offset) & mask) != target);
return 0; return 0;
} }
...@@ -1141,7 +1138,7 @@ static int mii_rw(struct net_device *dev, int addr, int miireg, int value) ...@@ -1141,7 +1138,7 @@ static int mii_rw(struct net_device *dev, int addr, int miireg, int value)
writel(reg, base + NvRegMIIControl); writel(reg, base + NvRegMIIControl);
if (reg_delay(dev, NvRegMIIControl, NVREG_MIICTL_INUSE, 0, if (reg_delay(dev, NvRegMIIControl, NVREG_MIICTL_INUSE, 0,
NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX, NULL)) { NV_MIIPHY_DELAY, NV_MIIPHY_DELAYMAX)) {
dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d timed out.\n", dprintk(KERN_DEBUG "%s: mii_rw of reg %d at PHY %d timed out.\n",
dev->name, miireg, addr); dev->name, miireg, addr);
retval = -1; retval = -1;
...@@ -1539,9 +1536,9 @@ static void nv_stop_rx(struct net_device *dev) ...@@ -1539,9 +1536,9 @@ static void nv_stop_rx(struct net_device *dev)
else else
rx_ctrl |= NVREG_RCVCTL_RX_PATH_EN; rx_ctrl |= NVREG_RCVCTL_RX_PATH_EN;
writel(rx_ctrl, base + NvRegReceiverControl); writel(rx_ctrl, base + NvRegReceiverControl);
reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0, if (reg_delay(dev, NvRegReceiverStatus, NVREG_RCVSTAT_BUSY, 0,
NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX, NV_RXSTOP_DELAY1, NV_RXSTOP_DELAY1MAX))
KERN_INFO "nv_stop_rx: ReceiverStatus remained busy"); printk(KERN_INFO "nv_stop_rx: ReceiverStatus remained busy");
udelay(NV_RXSTOP_DELAY2); udelay(NV_RXSTOP_DELAY2);
if (!np->mac_in_use) if (!np->mac_in_use)
...@@ -1574,9 +1571,9 @@ static void nv_stop_tx(struct net_device *dev) ...@@ -1574,9 +1571,9 @@ static void nv_stop_tx(struct net_device *dev)
else else
tx_ctrl |= NVREG_XMITCTL_TX_PATH_EN; tx_ctrl |= NVREG_XMITCTL_TX_PATH_EN;
writel(tx_ctrl, base + NvRegTransmitterControl); writel(tx_ctrl, base + NvRegTransmitterControl);
reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0, if (reg_delay(dev, NvRegTransmitterStatus, NVREG_XMITSTAT_BUSY, 0,
NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX, NV_TXSTOP_DELAY1, NV_TXSTOP_DELAY1MAX))
KERN_INFO "nv_stop_tx: TransmitterStatus remained busy"); printk(KERN_INFO "nv_stop_tx: TransmitterStatus remained busy");
udelay(NV_TXSTOP_DELAY2); udelay(NV_TXSTOP_DELAY2);
if (!np->mac_in_use) if (!np->mac_in_use)
...@@ -5190,9 +5187,10 @@ static int nv_open(struct net_device *dev) ...@@ -5190,9 +5187,10 @@ static int nv_open(struct net_device *dev)
writel(np->vlanctl_bits, base + NvRegVlanControl); writel(np->vlanctl_bits, base + NvRegVlanControl);
pci_push(base); pci_push(base);
writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl); writel(NVREG_TXRXCTL_BIT1|np->txrxctl_bits, base + NvRegTxRxControl);
reg_delay(dev, NvRegUnknownSetupReg5, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31, if (reg_delay(dev, NvRegUnknownSetupReg5,
NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX, NVREG_UNKSETUP5_BIT31, NVREG_UNKSETUP5_BIT31,
KERN_INFO "open: SetupReg5, Bit 31 remained off\n"); NV_SETUP5_DELAY, NV_SETUP5_DELAYMAX))
printk(KERN_INFO "open: SetupReg5, Bit 31 remained off\n");
writel(0, base + NvRegMIIMask); writel(0, base + NvRegMIIMask);
writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus); writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment