aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.10/209-b44-register-adm-switch.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@openwrt.org>2014-07-05 21:35:15 +0000
committerHauke Mehrtens <hauke@openwrt.org>2014-07-05 21:35:15 +0000
commit736bb2f1a567359b332faf2ac57d8b3fa8644d35 (patch)
tree7c5e3eef3b644a66acd0f5ee316cc719f7e5c5e5 /target/linux/brcm47xx/patches-3.10/209-b44-register-adm-switch.patch
parent776ae1250f72173b209dfadf582be6ba2c02184f (diff)
downloadupstream-736bb2f1a567359b332faf2ac57d8b3fa8644d35.tar.gz
upstream-736bb2f1a567359b332faf2ac57d8b3fa8644d35.tar.bz2
upstream-736bb2f1a567359b332faf2ac57d8b3fa8644d35.zip
brcm47xx: make it possible to unregister the adm switch
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@41517 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/brcm47xx/patches-3.10/209-b44-register-adm-switch.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.10/209-b44-register-adm-switch.patch74
1 files changed, 47 insertions, 27 deletions
diff --git a/target/linux/brcm47xx/patches-3.10/209-b44-register-adm-switch.patch b/target/linux/brcm47xx/patches-3.10/209-b44-register-adm-switch.patch
index d44432cafb..62bb89ce20 100644
--- a/target/linux/brcm47xx/patches-3.10/209-b44-register-adm-switch.patch
+++ b/target/linux/brcm47xx/patches-3.10/209-b44-register-adm-switch.patch
@@ -19,66 +19,78 @@ Subject: [PATCH 210/210] b44: register adm switch
#include <asm/uaccess.h>
#include <asm/io.h>
-@@ -2227,6 +2229,58 @@ static void b44_adjust_link(struct net_d
+@@ -2227,6 +2229,70 @@ static void b44_adjust_link(struct net_d
}
}
+#ifdef CONFIG_BCM47XX
-+static struct adm6996_gpio_platform_data b44_adm_data = {
-+ .eecs = 2,
-+ .eesk = 3,
-+ .eedi = 4,
-+ .eerc = 5,
-+ .model = ADM6996L,
-+};
-+
-+static struct platform_device b44_adm_dev = {
-+ .name = "adm6996_gpio",
-+ .id = -1,
-+ .dev = {
-+ .platform_data = &b44_adm_data,
-+ },
-+};
-+
+static int b44_register_adm_switch(struct b44 *bp)
+{
+ int gpio;
-+ int err;
++ struct platform_device *pdev;
++ struct adm6996_gpio_platform_data adm_data = {0};
++ struct platform_device_info info = {0};
+
++ adm_data.model = ADM6996L;
+ gpio = bcm47xx_nvram_gpio_pin("adm_eecs");
+ if (gpio >= 0)
-+ b44_adm_data.eecs = gpio;
++ adm_data.eecs = gpio;
++ else
++ adm_data.eecs = 2;
+
+ gpio = bcm47xx_nvram_gpio_pin("adm_eesk");
+ if (gpio >= 0)
-+ b44_adm_data.eesk = gpio;
++ adm_data.eesk = gpio;
++ else
++ adm_data.eesk = 3;
+
+ gpio = bcm47xx_nvram_gpio_pin("adm_eedi");
+ if (gpio >= 0)
-+ b44_adm_data.eedi = gpio;
++ adm_data.eedi = gpio;
++ else
++ adm_data.eedi = 4;
+
+ gpio = bcm47xx_nvram_gpio_pin("adm_rc");
+ if (gpio >= 0)
-+ b44_adm_data.eerc = gpio;
++ adm_data.eerc = gpio;
++ else
++ adm_data.eerc = 5;
++
++ info.parent = bp->sdev->dev;
++ info.name = "adm6996_gpio";
++ info.id = -1;
++ info.data = &adm_data;
++ info.size_data = sizeof(adm_data);
+
+ if (!bp->adm_switch) {
-+ err = platform_device_register(&b44_adm_dev);
-+ if (!err)
-+ bp->adm_switch = &b44_adm_dev;
++ pdev = platform_device_register_full(&info);
++ if (IS_ERR(pdev))
++ return PTR_ERR(pdev);
++
++ bp->adm_switch = pdev;
+ }
-+ return err;
++ return 0;
++}
++static void b44_unregister_adm_switch(struct b44 *bp)
++{
++ if (bp->adm_switch)
++ platform_device_unregister(bp->adm_switch);
+}
+#else
+static int b44_register_adm_switch(struct b44 *bp)
+{
+ return 0;
+}
++static void b44_unregister_adm_switch(struct b44 *bp)
++{
++
++}
+#endif /* CONFIG_BCM47XX */
+
static int b44_register_phy_one(struct b44 *bp)
{
struct mii_bus *mii_bus;
-@@ -2270,6 +2324,9 @@ static int b44_register_phy_one(struct b
+@@ -2270,6 +2336,9 @@ static int b44_register_phy_one(struct b
if (!bp->mii_bus->phy_map[bp->phy_addr] &&
(sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) {
@@ -88,6 +100,14 @@ Subject: [PATCH 210/210] b44: register adm switch
dev_info(sdev->dev,
"could not find PHY at %i, use fixed one\n",
bp->phy_addr);
+@@ -2465,6 +2534,7 @@ static void b44_remove_one(struct ssb_de
+ unregister_netdev(dev);
+ if (bp->flags & B44_FLAG_EXTERNAL_PHY)
+ b44_unregister_phy_one(bp);
++ b44_unregister_adm_switch(bp);
+ ssb_device_disable(sdev, 0);
+ ssb_bus_may_powerdown(sdev->bus);
+ free_netdev(dev);
--- a/drivers/net/ethernet/broadcom/b44.h
+++ b/drivers/net/ethernet/broadcom/b44.h
@@ -404,6 +404,9 @@ struct b44 {