diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2016-01-30 13:35:31 +0000 |
---|---|---|
committer | Rafał Miłecki <zajec5@gmail.com> | 2016-01-30 13:35:31 +0000 |
commit | ddc8437f08649ac276ce0879742c7631a3078e1e (patch) | |
tree | 2c97cf841b26ababf4de5696a31c3680f90faf8e /target/linux | |
parent | 2530640f07cd2b3b14fe9ec03fa63a586452cc5f (diff) | |
download | upstream-ddc8437f08649ac276ce0879742c7631a3078e1e.tar.gz upstream-ddc8437f08649ac276ce0879742c7631a3078e1e.tar.bz2 upstream-ddc8437f08649ac276ce0879742c7631a3078e1e.zip |
kernel: support bgmac on BCM47094
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
SVN-Revision: 48564
Diffstat (limited to 'target/linux')
3 files changed, 133 insertions, 6 deletions
diff --git a/target/linux/generic/patches-4.4/770-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch b/target/linux/generic/patches-4.4/770-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch new file mode 100644 index 0000000000..e5d439e123 --- /dev/null +++ b/target/linux/generic/patches-4.4/770-bgmac-add-helper-checking-for-BCM4707-BCM53018-chip-.patch @@ -0,0 +1,99 @@ +From 1b49522dc7154751401512977d07ad01e5182c47 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Sat, 30 Jan 2016 00:35:37 +0100 +Subject: [PATCH] bgmac: add helper checking for BCM4707 / BCM53018 chip id +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Chipsets with BCM4707 / BCM53018 ID require special handling at a few +places in the code. It's likely there will be more IDs to check in the +future. To simplify it add this trivial helper. + +Signed-off-by: Rafał Miłecki <zajec5@gmail.com> +--- + drivers/net/ethernet/broadcom/bgmac.c | 29 ++++++++++++++++------------- + 1 file changed, 16 insertions(+), 13 deletions(-) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -26,6 +26,17 @@ static const struct bcma_device_id bgmac + }; + MODULE_DEVICE_TABLE(bcma, bgmac_bcma_tbl); + ++static inline bool bgmac_is_bcm4707_family(struct bgmac *bgmac) ++{ ++ switch (bgmac->core->bus->chipinfo.id) { ++ case BCMA_CHIP_ID_BCM4707: ++ case BCMA_CHIP_ID_BCM53018: ++ return true; ++ default: ++ return false; ++ } ++} ++ + static bool bgmac_wait_value(struct bcma_device *core, u16 reg, u32 mask, + u32 value, int timeout) + { +@@ -982,11 +993,9 @@ static void bgmac_mac_speed(struct bgmac + static void bgmac_miiconfig(struct bgmac *bgmac) + { + 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_is_bcm4707_family(bgmac)) { + bcma_awrite32(core, BCMA_IOCTL, + bcma_aread32(core, BCMA_IOCTL) | 0x40 | + BGMAC_BCMA_IOCTL_SW_CLKEN); +@@ -1050,9 +1059,7 @@ static void bgmac_chip_reset(struct bgma + } + + /* Request Misc PLL for corerev > 2 */ +- if (core->id.rev > 2 && +- ci->id != BCMA_CHIP_ID_BCM4707 && +- ci->id != BCMA_CHIP_ID_BCM53018) { ++ if (core->id.rev > 2 && !bgmac_is_bcm4707_family(bgmac)) { + bgmac_set(bgmac, BCMA_CLKCTLST, + BGMAC_BCMA_CLKCTLST_MISC_PLL_REQ); + bgmac_wait_value(bgmac->core, BCMA_CLKCTLST, +@@ -1188,8 +1195,7 @@ static void bgmac_enable(struct bgmac *b + break; + } + +- if (ci->id != BCMA_CHIP_ID_BCM4707 && +- ci->id != BCMA_CHIP_ID_BCM53018) { ++ if (!bgmac_is_bcm4707_family(bgmac)) { + 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) / +@@ -1473,8 +1479,7 @@ static int bgmac_mii_register(struct bgm + char bus_id[MII_BUS_ID_SIZE + 3]; + int i, err = 0; + +- if (ci->id == BCMA_CHIP_ID_BCM4707 || +- ci->id == BCMA_CHIP_ID_BCM53018) ++ if (bgmac_is_bcm4707_family(bgmac)) + return bgmac_fixed_phy_register(bgmac); + + mii_bus = mdiobus_alloc(); +@@ -1545,7 +1550,6 @@ static void bgmac_mii_unregister(struct + /* http://bcm-v4.sipsolutions.net/mac-gbit/gmac/chipattach */ + static int bgmac_probe(struct bcma_device *core) + { +- struct bcma_chipinfo *ci = &core->bus->chipinfo; + struct net_device *net_dev; + struct bgmac *bgmac; + struct ssb_sprom *sprom = &core->bus->sprom; +@@ -1626,8 +1630,7 @@ static int bgmac_probe(struct bcma_devic + bgmac_chip_reset(bgmac); + + /* For Northstar, we have to take all GMAC core out of reset */ +- if (ci->id == BCMA_CHIP_ID_BCM4707 || +- ci->id == BCMA_CHIP_ID_BCM53018) { ++ if (bgmac_is_bcm4707_family(bgmac)) { + struct bcma_device *ns_core; + int ns_gmac; + diff --git a/target/linux/generic/patches-4.4/771-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch b/target/linux/generic/patches-4.4/771-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch new file mode 100644 index 0000000000..f3592204c2 --- /dev/null +++ b/target/linux/generic/patches-4.4/771-bgmac-support-Ethernet-device-on-BCM47094-SoC.patch @@ -0,0 +1,30 @@ +From 64a1905f49391e41e660dd5d079e2c61d5344920 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com> +Date: Sat, 30 Jan 2016 14:05:37 +0100 +Subject: [PATCH] bgmac: support Ethernet device on BCM47094 SoC + +It needs very similar workarounds to the one on BCM4707. +--- + drivers/net/ethernet/broadcom/bgmac.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/net/ethernet/broadcom/bgmac.c ++++ b/drivers/net/ethernet/broadcom/bgmac.c +@@ -30,6 +30,7 @@ static inline bool bgmac_is_bcm4707_fami + { + switch (bgmac->core->bus->chipinfo.id) { + case BCMA_CHIP_ID_BCM4707: ++ case BCMA_CHIP_ID_BCM47094: + case BCMA_CHIP_ID_BCM53018: + return true; + default: +@@ -1048,7 +1049,8 @@ static void bgmac_chip_reset(struct bgma + iost &= ~BGMAC_BCMA_IOST_ATTACHED; + + /* 3GMAC: for BCM4707, only do core reset at bgmac_probe() */ +- if (ci->id != BCMA_CHIP_ID_BCM4707) { ++ if (ci->id != BCMA_CHIP_ID_BCM4707 && ++ ci->id != BCMA_CHIP_ID_BCM47094) { + flags = 0; + if (iost & BGMAC_BCMA_IOST_ATTACHED) { + flags = BGMAC_BCMA_IOCTL_SW_CLKEN; diff --git a/target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch b/target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch index f5bd743bba..29bbf1ae7b 100644 --- a/target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch +++ b/target/linux/generic/patches-4.4/773-bgmac-add-srab-switch.patch @@ -12,7 +12,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> #include <linux/bcm47xx_nvram.h> static const struct bcma_device_id bgmac_bcma_tbl[] = { -@@ -1538,6 +1539,17 @@ static void bgmac_mii_unregister(struct +@@ -1545,6 +1546,17 @@ static void bgmac_mii_unregister(struct mdiobus_free(mii_bus); } @@ -30,13 +30,11 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> /************************************************** * BCMA bus ops **************************************************/ -@@ -1682,6 +1694,16 @@ static int bgmac_probe(struct bcma_devic +@@ -1687,6 +1699,14 @@ static int bgmac_probe(struct bcma_devic net_dev->hw_features = net_dev->features; net_dev->vlan_features = net_dev->features; -+ if ((ci->id == BCMA_CHIP_ID_BCM4707 || -+ ci->id == BCMA_CHIP_ID_BCM53018) && -+ !bgmac_b53_pdata.regs) { ++ if (bgmac_is_bcm4707_family(bgmac) && !bgmac_b53_pdata.regs) { + bgmac_b53_pdata.regs = ioremap_nocache(0x18007000, 0x1000); + + err = platform_device_register(&bgmac_b53_dev); @@ -47,7 +45,7 @@ Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> err = register_netdev(bgmac->net_dev); if (err) { bgmac_err(bgmac, "Cannot register net device\n"); -@@ -1708,6 +1730,10 @@ static void bgmac_remove(struct bcma_dev +@@ -1713,6 +1733,10 @@ static void bgmac_remove(struct bcma_dev { struct bgmac *bgmac = bcma_get_drvdata(core); |