1 bgmac: add supprot for BCM4707
4 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
6 drivers/net/ethernet/broadcom/bgmac.c | 56 +++++++++++++++++++++++----------
7 drivers/net/ethernet/broadcom/bgmac.h | 2 ++
8 2 files changed, 42 insertions(+), 16 deletions(-)
10 --- a/drivers/net/ethernet/broadcom/bgmac.c
11 +++ b/drivers/net/ethernet/broadcom/bgmac.c
12 @@ -868,6 +868,8 @@ static void bgmac_speed(struct bgmac *bg
13 set |= BGMAC_CMDCFG_ES_100;
14 if (speed & BGMAC_SPEED_1000)
15 set |= BGMAC_CMDCFG_ES_1000;
16 + if (speed & BGMAC_SPEED_2500)
17 + set |= BGMAC_CMDCFG_ES_2500;
18 if (!bgmac->full_duplex)
19 set |= BGMAC_CMDCFG_HD;
20 bgmac_cmdcfg_maskset(bgmac, mask, set, true);
21 @@ -875,13 +877,28 @@ static void bgmac_speed(struct bgmac *bg
23 static void bgmac_miiconfig(struct bgmac *bgmac)
25 - u8 imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
27 - if (imode == 0 || imode == 1) {
29 - bgmac_speed(bgmac, BGMAC_SPEED_100);
31 + struct bcma_device *core = bgmac->core;
32 + struct bcma_chipinfo *ci = &core->bus->chipinfo;
34 + if (ci->id != BCMA_CHIP_ID_BCM4707 &&
35 + ci->id != BCMA_CHIP_ID_BCM53018) {
36 + if (bgmac->autoneg) {
37 + bcma_awrite32(core, BCMA_IOCTL,
38 + bcma_aread32(core, BCMA_IOCTL) | 0x44);
40 + bgmac_speed(bgmac, BGMAC_SPEED_2500);
42 bgmac_speed(bgmac, bgmac->speed);
45 + u8 imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) &
46 + BGMAC_DS_MM_MASK) >> BGMAC_DS_MM_SHIFT;
47 + if (imode == 0 || imode == 1) {
49 + bgmac_speed(bgmac, BGMAC_SPEED_100);
51 + bgmac_speed(bgmac, bgmac->speed);
56 @@ -927,7 +944,8 @@ static void bgmac_chip_reset(struct bgma
58 bcma_core_enable(core, flags);
60 - if (core->id.rev > 2) {
61 + if (core->id.rev > 2 && ci->id != BCMA_CHIP_ID_BCM4707 &&
62 + ci->id != BCMA_CHIP_ID_BCM53018) {
63 bgmac_set(bgmac, BCMA_CLKCTLST, 1 << 8);
64 bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, 1 << 24, 1 << 24,
66 @@ -948,10 +966,13 @@ static void bgmac_chip_reset(struct bgma
70 - } else if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == 9) {
71 + } else if (ci->id == BCMA_CHIP_ID_BCM5357 &&
72 + ci->pkg == BCMA_PKG_ID_BCM5358) {
73 sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
74 - } else if ((ci->id != BCMA_CHIP_ID_BCM53572 && ci->pkg == 10) ||
75 - (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == 9)) {
76 + } else if ((ci->id != BCMA_CHIP_ID_BCM53572 &&
77 + ci->pkg == BCMA_PKG_ID_BCM47186) ||
78 + (ci->id == BCMA_CHIP_ID_BCM53572 &&
79 + ci->pkg == BCMA_PKG_ID_BCM47188)) {
80 sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
81 BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
83 @@ -1058,12 +1079,15 @@ static void bgmac_enable(struct bgmac *b
87 - rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
88 - rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
89 - bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / 1000000;
90 - mdp = (bp_clk * 128 / 1000) - 3;
91 - rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT);
92 - bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl);
93 + if (ci->id != BCMA_CHIP_ID_BCM4707 &&
94 + ci->id != BCMA_CHIP_ID_BCM53018) {
95 + rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
96 + rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
97 + bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / 1000000;
98 + mdp = (bp_clk * 128 / 1000) - 3;
99 + rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT);
100 + bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl);
104 /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */
105 --- a/drivers/net/ethernet/broadcom/bgmac.h
106 +++ b/drivers/net/ethernet/broadcom/bgmac.h
108 #define BGMAC_CMDCFG_ES_10 0x00000000
109 #define BGMAC_CMDCFG_ES_100 0x00000004
110 #define BGMAC_CMDCFG_ES_1000 0x00000008
111 +#define BGMAC_CMDCFG_ES_2500 0x0000000C
112 #define BGMAC_CMDCFG_PROM 0x00000010 /* Set to activate promiscuous mode */
113 #define BGMAC_CMDCFG_PAD_EN 0x00000020
114 #define BGMAC_CMDCFG_CF 0x00000040
116 #define BGMAC_SPEED_10 0x0001
117 #define BGMAC_SPEED_100 0x0002
118 #define BGMAC_SPEED_1000 0x0004
119 +#define BGMAC_SPEED_2500 0x0008
121 #define BGMAC_WEIGHT 64