1 bgmac: add supprot for BCM4707
3 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
5 --- a/drivers/net/ethernet/broadcom/bgmac.c
6 +++ b/drivers/net/ethernet/broadcom/bgmac.c
7 @@ -825,6 +825,9 @@ static void bgmac_mac_speed(struct bgmac
9 set |= BGMAC_CMDCFG_ES_1000;
12 + set |= BGMAC_CMDCFG_ES_2500;
15 bgmac_err(bgmac, "Unsupported speed: %d\n", bgmac->mac_speed);
17 @@ -837,12 +840,25 @@ static void bgmac_mac_speed(struct bgmac
19 static void bgmac_miiconfig(struct bgmac *bgmac)
21 - u8 imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
23 - if (imode == 0 || imode == 1) {
24 - bgmac->mac_speed = SPEED_100;
25 + struct bcma_device *core = bgmac->core;
26 + struct bcma_chipinfo *ci = &core->bus->chipinfo;
29 + if (ci->id == BCMA_CHIP_ID_BCM4707 ||
30 + ci->id == BCMA_CHIP_ID_BCM53018) {
31 + bcma_awrite32(core, BCMA_IOCTL,
32 + bcma_aread32(core, BCMA_IOCTL) | 0x44);
33 + bgmac->mac_speed = SPEED_2500;
34 bgmac->mac_duplex = DUPLEX_FULL;
35 bgmac_mac_speed(bgmac);
37 + imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
39 + if (imode == 0 || imode == 1) {
40 + bgmac->mac_speed = SPEED_100;
41 + bgmac->mac_duplex = DUPLEX_FULL;
42 + bgmac_mac_speed(bgmac);
47 @@ -888,7 +904,8 @@ static void bgmac_chip_reset(struct bgma
49 bcma_core_enable(core, flags);
51 - if (core->id.rev > 2) {
52 + if (core->id.rev > 2 && ci->id != BCMA_CHIP_ID_BCM4707 &&
53 + ci->id != BCMA_CHIP_ID_BCM53018) {
54 bgmac_set(bgmac, BCMA_CLKCTLST,
55 BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
56 bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
57 @@ -1026,12 +1043,15 @@ static void bgmac_enable(struct bgmac *b
61 - rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
62 - rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
63 - bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / 1000000;
64 - mdp = (bp_clk * 128 / 1000) - 3;
65 - rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT);
66 - bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl);
67 + if (ci->id != BCMA_CHIP_ID_BCM4707 &&
68 + ci->id != BCMA_CHIP_ID_BCM53018) {
69 + rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
70 + rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
71 + bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / 1000000;
72 + mdp = (bp_clk * 128 / 1000) - 3;
73 + rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT);
74 + bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl);
78 /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */
79 @@ -1421,6 +1441,25 @@ static int bgmac_probe(struct bcma_devic
83 + /* Northstar, take all GMAC cores out of reset */
84 + if (core->id.id == BCMA_CHIP_ID_BCM4707 ||
85 + core->id.id == BCMA_CHIP_ID_BCM53018) {
86 + struct bcma_device *ns_core;
89 + for (ns_gmac = 0; ns_gmac < 4; ns_gmac++) {
90 + /* As northstar requirement, we have to reset all GAMCs before
91 + * accessing them. et_probe() call pci_enable_device() for etx
92 + * and do si_core_reset for GAMCx only. Then the other three
93 + * GAMCs didn't reset. We do it here.
95 + ns_core = bcma_find_core_unit(core->bus, BCMA_CORE_MAC_GBIT, ns_gmac);
96 + if (!bcma_core_is_enabled(ns_core)) {
97 + bcma_core_enable(ns_core, 0);
102 bgmac_chip_reset(bgmac);
104 err = bgmac_dma_alloc(bgmac);
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