Openwrt/target/linux/brcm47xx/patches-3.10/203-b44-abort-when-no-PHY-is-available-at-all.patch
Hauke Mehrtens 6d2136c3f2 brcm47xx: b44: detect external phy by bit set in DevControl register
Without this patch we treated only phy addr 30 as an external phy, but
there is a register to check that. Now we do not have to try to reset
the switch to check for an external switch.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>

SVN-Revision: 38502
2013-10-22 21:01:35 +00:00

41 lines
1.4 KiB
Diff

From d6668993d793d39e2c9d7699e8079462cae67f7e Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Thu, 3 Oct 2013 20:49:10 +0200
Subject: [PATCH 4/9] 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: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/net/ethernet/broadcom/b44.c | 6 ++++++
drivers/net/ethernet/broadcom/b44.h | 1 +
2 files changed, 7 insertions(+)
--- a/drivers/net/ethernet/broadcom/b44.c
+++ b/drivers/net/ethernet/broadcom/b44.c
@@ -2207,6 +2207,12 @@ static int b44_init_one(struct ssb_devic
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;
--- a/drivers/net/ethernet/broadcom/b44.h
+++ b/drivers/net/ethernet/broadcom/b44.h
@@ -282,6 +282,7 @@ struct ring_info {
#define B44_MCAST_TABLE_SIZE 32
#define B44_PHY_ADDR_NO_LOACL_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 \