Skip to content

Commit

Permalink
b44: abort when no PHY is available at all
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hauke Mehrtens authored and David S. Miller committed Dec 21, 2013
1 parent 5ab6329 commit 7befa6a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/net/ethernet/broadcom/b44.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions drivers/net/ethernet/broadcom/b44.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down

0 comments on commit 7befa6a

Please sign in to comment.