aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/r6040.c
diff options
context:
space:
mode:
authorMark Kelly <mark@bifferos.com>2009-08-19 21:26:20 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-23 22:16:28 -0400
commite03f614af7811f9d089862a8700e683dcc6963c6 (patch)
treefe3601dd84d13d2d4d99b03390caae588ba83bc5 /drivers/net/r6040.c
parentd516478ff67b2abb2f3ecc998a598576d92b0b5e (diff)
r6040: move down second PHY detection to r6040_init_one
Instead of fully initializing an unusable second r6040 device, perform the PHY detection earlier and bail out in r6040_init_one when we could not read the PHY identifier. Signed-off-by: Mark Kelly <mark@bifferos.com> Signed-off-by: Florian Fainelli <florian@openwrt.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/r6040.c')
-rw-r--r--drivers/net/r6040.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 60bd010e8e42..7238a6fae140 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -750,14 +750,6 @@ static int r6040_up(struct net_device *dev)
750 struct r6040_private *lp = netdev_priv(dev); 750 struct r6040_private *lp = netdev_priv(dev);
751 void __iomem *ioaddr = lp->base; 751 void __iomem *ioaddr = lp->base;
752 int ret; 752 int ret;
753 u16 val;
754
755 /* Check presence of a second PHY */
756 val = r6040_phy_read(ioaddr, lp->phy_addr, 2);
757 if (val == 0xFFFF) {
758 printk(KERN_ERR DRV_NAME " no second PHY attached\n");
759 return -EIO;
760 }
761 753
762 /* Initialise and alloc RX/TX buffers */ 754 /* Initialise and alloc RX/TX buffers */
763 r6040_init_txbufs(dev); 755 r6040_init_txbufs(dev);
@@ -1194,6 +1186,13 @@ static int __devinit r6040_init_one(struct pci_dev *pdev,
1194 lp->mii_if.phy_id_mask = 0x1f; 1186 lp->mii_if.phy_id_mask = 0x1f;
1195 lp->mii_if.reg_num_mask = 0x1f; 1187 lp->mii_if.reg_num_mask = 0x1f;
1196 1188
1189 /* Check the vendor ID on the PHY, if 0xffff assume none attached */
1190 if (r6040_phy_read(ioaddr, lp->phy_addr, 2) == 0xffff) {
1191 printk(KERN_ERR DRV_NAME ": Failed to detect an attached PHY\n");
1192 err = -ENODEV;
1193 goto err_out_unmap;
1194 }
1195
1197 /* Register net device. After this dev->name assign */ 1196 /* Register net device. After this dev->name assign */
1198 err = register_netdev(dev); 1197 err = register_netdev(dev);
1199 if (err) { 1198 if (err) {