bc3d934148
This updates the bgmac backport patch to the current upstream version and adds some more patches mostly for BCM4707. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 39165
114 lines
3.7 KiB
Diff
114 lines
3.7 KiB
Diff
bgmac: add supprot for BCM4707
|
|
|
|
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
--- a/drivers/net/ethernet/broadcom/bgmac.c
|
|
+++ b/drivers/net/ethernet/broadcom/bgmac.c
|
|
@@ -825,6 +825,9 @@ static void bgmac_mac_speed(struct bgmac
|
|
case SPEED_1000:
|
|
set |= BGMAC_CMDCFG_ES_1000;
|
|
break;
|
|
+ case SPEED_2500:
|
|
+ set |= BGMAC_CMDCFG_ES_2500;
|
|
+ break;
|
|
default:
|
|
bgmac_err(bgmac, "Unsupported speed: %d\n", bgmac->mac_speed);
|
|
}
|
|
@@ -837,12 +840,25 @@ static void bgmac_mac_speed(struct bgmac
|
|
|
|
static void bgmac_miiconfig(struct bgmac *bgmac)
|
|
{
|
|
- u8 imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
|
|
- BGMAC_DS_MM_SHIFT;
|
|
- if (imode == 0 || imode == 1) {
|
|
- bgmac->mac_speed = SPEED_100;
|
|
+ struct bcma_device *core = bgmac->core;
|
|
+ struct bcma_chipinfo *ci = &core->bus->chipinfo;
|
|
+ u8 imode;
|
|
+
|
|
+ if (ci->id == BCMA_CHIP_ID_BCM4707 ||
|
|
+ ci->id == BCMA_CHIP_ID_BCM53018) {
|
|
+ bcma_awrite32(core, BCMA_IOCTL,
|
|
+ bcma_aread32(core, BCMA_IOCTL) | 0x44);
|
|
+ bgmac->mac_speed = SPEED_2500;
|
|
bgmac->mac_duplex = DUPLEX_FULL;
|
|
bgmac_mac_speed(bgmac);
|
|
+ } else {
|
|
+ imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
|
|
+ BGMAC_DS_MM_SHIFT;
|
|
+ if (imode == 0 || imode == 1) {
|
|
+ bgmac->mac_speed = SPEED_100;
|
|
+ bgmac->mac_duplex = DUPLEX_FULL;
|
|
+ bgmac_mac_speed(bgmac);
|
|
+ }
|
|
}
|
|
}
|
|
|
|
@@ -888,7 +904,8 @@ static void bgmac_chip_reset(struct bgma
|
|
|
|
bcma_core_enable(core, flags);
|
|
|
|
- if (core->id.rev > 2) {
|
|
+ if (core->id.rev > 2 && ci->id != BCMA_CHIP_ID_BCM4707 &&
|
|
+ ci->id != BCMA_CHIP_ID_BCM53018) {
|
|
bgmac_set(bgmac, BCMA_CLKCTLST,
|
|
BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ);
|
|
bgmac_wait_value(bgmac->core, BCMA_CLKCTLST,
|
|
@@ -1026,12 +1043,15 @@ static void bgmac_enable(struct bgmac *b
|
|
break;
|
|
}
|
|
|
|
- rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
|
|
- rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
|
|
- bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / 1000000;
|
|
- mdp = (bp_clk * 128 / 1000) - 3;
|
|
- rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT);
|
|
- bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl);
|
|
+ if (ci->id != BCMA_CHIP_ID_BCM4707 &&
|
|
+ ci->id != BCMA_CHIP_ID_BCM53018) {
|
|
+ rxq_ctl = bgmac_read(bgmac, BGMAC_RXQ_CTL);
|
|
+ rxq_ctl &= ~BGMAC_RXQ_CTL_MDP_MASK;
|
|
+ bp_clk = bcma_pmu_get_bus_clock(&bgmac->core->bus->drv_cc) / 1000000;
|
|
+ mdp = (bp_clk * 128 / 1000) - 3;
|
|
+ rxq_ctl |= (mdp << BGMAC_RXQ_CTL_MDP_SHIFT);
|
|
+ bgmac_write(bgmac, BGMAC_RXQ_CTL, rxq_ctl);
|
|
+ }
|
|
}
|
|
|
|
/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */
|
|
@@ -1421,6 +1441,25 @@ static int bgmac_probe(struct bcma_devic
|
|
goto err_netdev_free;
|
|
}
|
|
|
|
+ /* Northstar, take all GMAC cores out of reset */
|
|
+ if (core->id.id == BCMA_CHIP_ID_BCM4707 ||
|
|
+ core->id.id == BCMA_CHIP_ID_BCM53018) {
|
|
+ struct bcma_device *ns_core;
|
|
+ int ns_gmac;
|
|
+
|
|
+ for (ns_gmac = 0; ns_gmac < 4; ns_gmac++) {
|
|
+ /* As northstar requirement, we have to reset all GAMCs before
|
|
+ * accessing them. et_probe() call pci_enable_device() for etx
|
|
+ * and do si_core_reset for GAMCx only. Then the other three
|
|
+ * GAMCs didn't reset. We do it here.
|
|
+ */
|
|
+ ns_core = bcma_find_core_unit(core->bus, BCMA_CORE_MAC_GBIT, ns_gmac);
|
|
+ if (!bcma_core_is_enabled(ns_core)) {
|
|
+ bcma_core_enable(ns_core, 0);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
bgmac_chip_reset(bgmac);
|
|
|
|
err = bgmac_dma_alloc(bgmac);
|
|
--- a/drivers/net/ethernet/broadcom/bgmac.h
|
|
+++ b/drivers/net/ethernet/broadcom/bgmac.h
|
|
@@ -189,6 +189,7 @@
|
|
#define BGMAC_CMDCFG_ES_10 0x00000000
|
|
#define BGMAC_CMDCFG_ES_100 0x00000004
|
|
#define BGMAC_CMDCFG_ES_1000 0x00000008
|
|
+#define BGMAC_CMDCFG_ES_2500 0x0000000C
|
|
#define BGMAC_CMDCFG_PROM 0x00000010 /* Set to activate promiscuous mode */
|
|
#define BGMAC_CMDCFG_PAD_EN 0x00000020
|
|
#define BGMAC_CMDCFG_CF 0x00000040
|