Commit 7befa6ab authored by Hauke Mehrtens's avatar Hauke Mehrtens Committed by David S. Miller

b44: abort when no PHY is available at all

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: default avatarHauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5ab6329c
...@@ -2206,6 +2206,12 @@ static int b44_init_one(struct ssb_device *sdev, ...@@ -2206,6 +2206,12 @@ static int b44_init_one(struct ssb_device *sdev,
goto err_out_powerdown; 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.dev = dev;
bp->mii_if.mdio_read = b44_mii_read; bp->mii_if.mdio_read = b44_mii_read;
bp->mii_if.mdio_write = b44_mii_write; bp->mii_if.mdio_write = b44_mii_write;
......
...@@ -282,6 +282,7 @@ struct ring_info { ...@@ -282,6 +282,7 @@ struct ring_info {
#define B44_MCAST_TABLE_SIZE 32 #define B44_MCAST_TABLE_SIZE 32
#define B44_PHY_ADDR_NO_LOCAL_PHY 30 /* no local phy regs */ #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_MDC_RATIO 5000000
#define B44_STAT_REG_DECLARE \ #define B44_STAT_REG_DECLARE \
......
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