summaryrefslogtreecommitdiff
path: root/target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch')
-rw-r--r--target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch85
1 files changed, 28 insertions, 57 deletions
diff --git a/target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch b/target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch
index a4e51774d5..0e0b246eef 100644
--- a/target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch
+++ b/target/linux/generic/patches-3.10/772-bgmac-add-supprot-for-BCM4707.patch
@@ -4,78 +4,57 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
-@@ -887,6 +887,8 @@ static void bgmac_speed(struct bgmac *bg
- set |= BGMAC_CMDCFG_ES_100;
- if (speed & BGMAC_SPEED_1000)
+@@ -825,6 +825,9 @@ static void bgmac_mac_speed(struct bgmac
+ case SPEED_1000:
set |= BGMAC_CMDCFG_ES_1000;
-+ if (speed & BGMAC_SPEED_2500)
+ break;
++ case SPEED_2500:
+ set |= BGMAC_CMDCFG_ES_2500;
- if (!bgmac->full_duplex)
- set |= BGMAC_CMDCFG_HD;
- bgmac_cmdcfg_maskset(bgmac, mask, set, true);
-@@ -894,13 +896,28 @@ static void bgmac_speed(struct bgmac *bg
++ 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) {
-- if (bgmac->autoneg)
-- bgmac_speed(bgmac, BGMAC_SPEED_100);
-- else
+- 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) {
-+ if (bgmac->autoneg) {
-+ bcma_awrite32(core, BCMA_IOCTL,
-+ bcma_aread32(core, BCMA_IOCTL) | 0x44);
-+
-+ bgmac_speed(bgmac, BGMAC_SPEED_2500);
-+ } else {
- bgmac_speed(bgmac, bgmac->speed);
-+ }
++ 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 {
-+ u8 imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) &
-+ BGMAC_DS_MM_MASK) >> BGMAC_DS_MM_SHIFT;
++ imode = (bgmac_read(bgmac, BGMAC_DEV_STATUS) & BGMAC_DS_MM_MASK) >>
++ BGMAC_DS_MM_SHIFT;
+ if (imode == 0 || imode == 1) {
-+ if (bgmac->autoneg)
-+ bgmac_speed(bgmac, BGMAC_SPEED_100);
-+ else
-+ bgmac_speed(bgmac, bgmac->speed);
++ bgmac->mac_speed = SPEED_100;
++ bgmac->mac_duplex = DUPLEX_FULL;
++ bgmac_mac_speed(bgmac);
+ }
}
}
-@@ -946,7 +963,8 @@ static void bgmac_chip_reset(struct bgma
+@@ -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, 1 << 8);
- bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, 1 << 24, 1 << 24,
- 1000);
-@@ -967,10 +985,13 @@ static void bgmac_chip_reset(struct bgma
- et_swtype &= 0x0f;
- et_swtype <<= 4;
- sw_type = et_swtype;
-- } else if (ci->id == BCMA_CHIP_ID_BCM5357 && ci->pkg == 9) {
-+ } else if (ci->id == BCMA_CHIP_ID_BCM5357 &&
-+ ci->pkg == BCMA_PKG_ID_BCM5358) {
- sw_type = BGMAC_CHIPCTL_1_SW_TYPE_EPHYRMII;
-- } else if ((ci->id != BCMA_CHIP_ID_BCM53572 && ci->pkg == 10) ||
-- (ci->id == BCMA_CHIP_ID_BCM53572 && ci->pkg == 9)) {
-+ } else if ((ci->id != BCMA_CHIP_ID_BCM53572 &&
-+ ci->pkg == BCMA_PKG_ID_BCM47186) ||
-+ (ci->id == BCMA_CHIP_ID_BCM53572 &&
-+ ci->pkg == BCMA_PKG_ID_BCM47188)) {
- sw_type = BGMAC_CHIPCTL_1_IF_TYPE_RGMII |
- BGMAC_CHIPCTL_1_SW_TYPE_RGMII;
- }
-@@ -1077,12 +1098,15 @@ static void bgmac_enable(struct bgmac *b
+ 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;
}
@@ -97,7 +76,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
}
/* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipinit */
-@@ -1488,6 +1512,25 @@ static int bgmac_probe(struct bcma_devic
+@@ -1421,6 +1441,25 @@ static int bgmac_probe(struct bcma_devic
goto err_netdev_free;
}
@@ -125,7 +104,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
err = bgmac_dma_alloc(bgmac);
--- a/drivers/net/ethernet/broadcom/bgmac.h
+++ b/drivers/net/ethernet/broadcom/bgmac.h
-@@ -185,6 +185,7 @@
+@@ -189,6 +189,7 @@
#define BGMAC_CMDCFG_ES_10 0x00000000
#define BGMAC_CMDCFG_ES_100 0x00000004
#define BGMAC_CMDCFG_ES_1000 0x00000008
@@ -133,11 +112,3 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
#define BGMAC_CMDCFG_PROM 0x00000010 /* Set to activate promiscuous mode */
#define BGMAC_CMDCFG_PAD_EN 0x00000020
#define BGMAC_CMDCFG_CF 0x00000040
-@@ -345,6 +346,7 @@
- #define BGMAC_SPEED_10 0x0001
- #define BGMAC_SPEED_100 0x0002
- #define BGMAC_SPEED_1000 0x0004
-+#define BGMAC_SPEED_2500 0x0008
-
- #define BGMAC_WEIGHT 64
-