b44: abort when no PHY is available at all
authorHauke Mehrtens <hauke@hauke-m.de>
Fri, 20 Dec 2013 01:16:08 +0000 (02:16 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Dec 2013 01:48:48 +0000 (20:48 -0500)
When the phy address is 31, this means that there is no PHY connected
to this MAC at all, no internal and no external PHY. Reading these PHY
registers causes a system reset on some routers.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/b44.c
drivers/net/ethernet/broadcom/b44.h

index 5c05d150f67b7b86601c7ddc17b8fa9523439196..09e9e97558b8c53d8f32fe7634a5b801f1ade680 100644 (file)
@@ -2206,6 +2206,12 @@ static int b44_init_one(struct ssb_device *sdev,
                goto err_out_powerdown;
        }
 
+       if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
+               dev_err(sdev->dev, "No PHY present on this MAC, aborting\n");
+               err = -ENODEV;
+               goto err_out_powerdown;
+       }
+
        bp->mii_if.dev = dev;
        bp->mii_if.mdio_read = b44_mii_read;
        bp->mii_if.mdio_write = b44_mii_write;
index 57e535768d25145180874c9504943ef0eb5a5454..4b0c5d2fa59816e1d1e2289bcc855ac31b4a2e40 100644 (file)
@@ -282,6 +282,7 @@ struct ring_info {
 
 #define B44_MCAST_TABLE_SIZE           32
 #define B44_PHY_ADDR_NO_LOCAL_PHY      30 /* no local phy regs */
+#define B44_PHY_ADDR_NO_PHY            31 /* no phy present at all */
 #define B44_MDC_RATIO                  5000000
 
 #define        B44_STAT_REG_DECLARE            \