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: 38502master
parent
5d4cc68b66
commit
6d2136c3f2
@ -0,0 +1,97 @@ |
||||
From 3fc36ba561bd9a9bdc097d6ace32f1303364268c Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Tue, 22 Oct 2013 21:05:25 +0200
|
||||
Subject: [PATCH 2/9] b44: use B44_FLAG_EXTERNAL_PHY
|
||||
|
||||
---
|
||||
drivers/net/ethernet/broadcom/b44.c | 18 +++++++++---------
|
||||
drivers/net/ethernet/broadcom/b44.h | 2 +-
|
||||
2 files changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/b44.c
|
||||
+++ b/drivers/net/ethernet/broadcom/b44.c
|
||||
@@ -284,7 +284,7 @@ static int __b44_writephy(struct b44 *bp
|
||||
|
||||
static inline int b44_readphy(struct b44 *bp, int reg, u32 *val)
|
||||
{
|
||||
- if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
|
||||
+ if (bp->flags & B44_FLAG_EXTERNAL_PHY)
|
||||
return 0;
|
||||
|
||||
return __b44_readphy(bp, bp->phy_addr, reg, val);
|
||||
@@ -292,7 +292,7 @@ static inline int b44_readphy(struct b44
|
||||
|
||||
static inline int b44_writephy(struct b44 *bp, int reg, u32 val)
|
||||
{
|
||||
- if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
|
||||
+ if (bp->flags & B44_FLAG_EXTERNAL_PHY)
|
||||
return 0;
|
||||
|
||||
return __b44_writephy(bp, bp->phy_addr, reg, val);
|
||||
@@ -321,7 +321,7 @@ static int b44_phy_reset(struct b44 *bp)
|
||||
u32 val;
|
||||
int err;
|
||||
|
||||
- if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
|
||||
+ if (bp->flags & B44_FLAG_EXTERNAL_PHY)
|
||||
return 0;
|
||||
err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
|
||||
if (err)
|
||||
@@ -423,7 +423,7 @@ static int b44_setup_phy(struct b44 *bp)
|
||||
|
||||
b44_wap54g10_workaround(bp);
|
||||
|
||||
- if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
|
||||
+ if (bp->flags & B44_FLAG_EXTERNAL_PHY)
|
||||
return 0;
|
||||
if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
|
||||
goto out;
|
||||
@@ -521,7 +521,7 @@ static void b44_check_phy(struct b44 *bp
|
||||
{
|
||||
u32 bmsr, aux;
|
||||
|
||||
- if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
|
||||
+ if (bp->flags & B44_FLAG_EXTERNAL_PHY) {
|
||||
bp->flags |= B44_FLAG_100_BASE_T;
|
||||
bp->flags |= B44_FLAG_FULL_DUPLEX;
|
||||
if (!netif_carrier_ok(bp->dev)) {
|
||||
@@ -1315,7 +1315,7 @@ static void b44_chip_reset(struct b44 *b
|
||||
if (!(br32(bp, B44_DEVCTRL) & DEVCTRL_IPP)) {
|
||||
bw32(bp, B44_ENET_CTRL, ENET_CTRL_EPSEL);
|
||||
br32(bp, B44_ENET_CTRL);
|
||||
- bp->flags &= ~B44_FLAG_INTERNAL_PHY;
|
||||
+ bp->flags |= B44_FLAG_EXTERNAL_PHY;
|
||||
} else {
|
||||
u32 val = br32(bp, B44_DEVCTRL);
|
||||
|
||||
@@ -1324,7 +1324,7 @@ static void b44_chip_reset(struct b44 *b
|
||||
br32(bp, B44_DEVCTRL);
|
||||
udelay(100);
|
||||
}
|
||||
- bp->flags |= B44_FLAG_INTERNAL_PHY;
|
||||
+ bp->flags &= ~B44_FLAG_EXTERNAL_PHY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1828,8 +1828,8 @@ static int b44_get_settings(struct net_d
|
||||
DUPLEX_FULL : DUPLEX_HALF;
|
||||
cmd->port = 0;
|
||||
cmd->phy_address = bp->phy_addr;
|
||||
- cmd->transceiver = (bp->flags & B44_FLAG_INTERNAL_PHY) ?
|
||||
- XCVR_INTERNAL : XCVR_EXTERNAL;
|
||||
+ cmd->transceiver = (bp->flags & B44_FLAG_EXTERNAL_PHY) ?
|
||||
+ XCVR_EXTERNAL : XCVR_INTERNAL;
|
||||
cmd->autoneg = (bp->flags & B44_FLAG_FORCE_LINK) ?
|
||||
AUTONEG_DISABLE : AUTONEG_ENABLE;
|
||||
if (cmd->autoneg == AUTONEG_ENABLE)
|
||||
--- a/drivers/net/ethernet/broadcom/b44.h
|
||||
+++ b/drivers/net/ethernet/broadcom/b44.h
|
||||
@@ -376,7 +376,7 @@ struct b44 {
|
||||
#define B44_FLAG_ADV_10FULL 0x02000000
|
||||
#define B44_FLAG_ADV_100HALF 0x04000000
|
||||
#define B44_FLAG_ADV_100FULL 0x08000000
|
||||
-#define B44_FLAG_INTERNAL_PHY 0x10000000
|
||||
+#define B44_FLAG_EXTERNAL_PHY 0x10000000
|
||||
#define B44_FLAG_RX_RING_HACK 0x20000000
|
||||
#define B44_FLAG_TX_RING_HACK 0x40000000
|
||||
#define B44_FLAG_WOL_ENABLE 0x80000000
|
@ -0,0 +1,25 @@ |
||||
From c2ecc401a08f0bda3b2483b93989d9792cadf6b2 Mon Sep 17 00:00:00 2001
|
||||
From: Hauke Mehrtens <hauke@hauke-m.de>
|
||||
Date: Mon, 21 Oct 2013 20:30:04 +0200
|
||||
Subject: [PATCH 8/9] b44: do not set phy addr to 30 for every ext phy
|
||||
|
||||
---
|
||||
drivers/net/ethernet/broadcom/b44.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/ethernet/broadcom/b44.c
|
||||
+++ b/drivers/net/ethernet/broadcom/b44.c
|
||||
@@ -2408,8 +2408,11 @@ static int b44_init_one(struct ssb_devic
|
||||
b44_chip_reset(bp, B44_CHIP_RESET_FULL);
|
||||
|
||||
/* do a phy reset to test if there is an active phy */
|
||||
- if (b44_phy_reset(bp) < 0)
|
||||
- bp->phy_addr = B44_PHY_ADDR_NO_LOACL_PHY;
|
||||
+ err = b44_phy_reset(bp);
|
||||
+ if (err < 0) {
|
||||
+ dev_err(sdev->dev, "phy reset failed\n");
|
||||
+ goto err_out_unregister_netdev;
|
||||
+ }
|
||||
|
||||
if (bp->flags & B44_FLAG_EXTERNAL_PHY) {
|
||||
err = b44_register_phy_one(bp);
|
Loading…
Reference in new issue