brcm47xx: b44: fix some problems with the phy
[openwrt/svn-archive/archive.git] / target / linux / brcm47xx / patches-3.10 / 202-b44-rename-B44_PHY_ADDR_NO_PHY-to-B44_PHY_ADDR_NO_LO.patch
1 From 991b6722fb727b6e2a98e7e8b57176ac68626110 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Thu, 3 Oct 2013 20:41:29 +0200
4 Subject: [PATCH 2/5] b44: rename B44_PHY_ADDR_NO_PHY to
5 B44_PHY_ADDR_NO_LOCAL_PHY
6
7 The PHY address 30 means there is no local PHY, but there could be an
8 external PHY like a switch connected via MII. This is the case on most
9 embedded home routers where this driver is used.
10
11 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
12 ---
13 drivers/net/ethernet/broadcom/b44.c | 12 ++++++------
14 drivers/net/ethernet/broadcom/b44.h | 6 +++---
15 2 files changed, 9 insertions(+), 9 deletions(-)
16
17 --- a/drivers/net/ethernet/broadcom/b44.c
18 +++ b/drivers/net/ethernet/broadcom/b44.c
19 @@ -284,7 +284,7 @@ static int __b44_writephy(struct b44 *bp
20
21 static inline int b44_readphy(struct b44 *bp, int reg, u32 *val)
22 {
23 - if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
24 + if (bp->phy_addr == B44_PHY_ADDR_NO_LOACL_PHY)
25 return 0;
26
27 return __b44_readphy(bp, bp->phy_addr, reg, val);
28 @@ -292,7 +292,7 @@ static inline int b44_readphy(struct b44
29
30 static inline int b44_writephy(struct b44 *bp, int reg, u32 val)
31 {
32 - if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
33 + if (bp->phy_addr == B44_PHY_ADDR_NO_LOACL_PHY)
34 return 0;
35
36 return __b44_writephy(bp, bp->phy_addr, reg, val);
37 @@ -321,7 +321,7 @@ static int b44_phy_reset(struct b44 *bp)
38 u32 val;
39 int err;
40
41 - if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
42 + if (bp->phy_addr == B44_PHY_ADDR_NO_LOACL_PHY)
43 return 0;
44 err = b44_writephy(bp, MII_BMCR, BMCR_RESET);
45 if (err)
46 @@ -423,7 +423,7 @@ static int b44_setup_phy(struct b44 *bp)
47
48 b44_wap54g10_workaround(bp);
49
50 - if (bp->phy_addr == B44_PHY_ADDR_NO_PHY)
51 + if (bp->phy_addr == B44_PHY_ADDR_NO_LOACL_PHY)
52 return 0;
53 if ((err = b44_readphy(bp, B44_MII_ALEDCTRL, &val)) != 0)
54 goto out;
55 @@ -521,7 +521,7 @@ static void b44_check_phy(struct b44 *bp
56 {
57 u32 bmsr, aux;
58
59 - if (bp->phy_addr == B44_PHY_ADDR_NO_PHY) {
60 + if (bp->phy_addr == B44_PHY_ADDR_NO_LOACL_PHY) {
61 bp->flags |= B44_FLAG_100_BASE_T;
62 bp->flags |= B44_FLAG_FULL_DUPLEX;
63 if (!netif_carrier_ok(bp->dev)) {
64 @@ -2238,7 +2238,7 @@ static int b44_init_one(struct ssb_devic
65
66 /* do a phy reset to test if there is an active phy */
67 if (b44_phy_reset(bp) < 0)
68 - bp->phy_addr = B44_PHY_ADDR_NO_PHY;
69 + bp->phy_addr = B44_PHY_ADDR_NO_LOACL_PHY;
70
71 netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
72
73 --- a/drivers/net/ethernet/broadcom/b44.h
74 +++ b/drivers/net/ethernet/broadcom/b44.h
75 @@ -280,9 +280,9 @@ struct ring_info {
76 dma_addr_t mapping;
77 };
78
79 -#define B44_MCAST_TABLE_SIZE 32
80 -#define B44_PHY_ADDR_NO_PHY 30
81 -#define B44_MDC_RATIO 5000000
82 +#define B44_MCAST_TABLE_SIZE 32
83 +#define B44_PHY_ADDR_NO_LOACL_PHY 30 /* no local phy regs */
84 +#define B44_MDC_RATIO 5000000
85
86 #define B44_STAT_REG_DECLARE \
87 _B44(tx_good_octets) \