aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm47xx/patches-3.14/209-b44-register-adm-switch.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2014-07-05 21:35:15 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2014-07-05 21:35:15 +0000
commit8e4efd42d98bbb5b5c4d891db3b889cb02dced01 (patch)
tree40a1bcfc175d2c85eb0c8a03773c22333bc7ab4f /target/linux/brcm47xx/patches-3.14/209-b44-register-adm-switch.patch
parent03e2310a38a5b337f7a48f33b2106873bfdb7747 (diff)
downloadupstream-8e4efd42d98bbb5b5c4d891db3b889cb02dced01.tar.gz
upstream-8e4efd42d98bbb5b5c4d891db3b889cb02dced01.tar.bz2
upstream-8e4efd42d98bbb5b5c4d891db3b889cb02dced01.zip
brcm47xx: make it possible to unregister the adm switch
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 41517
Diffstat (limited to 'target/linux/brcm47xx/patches-3.14/209-b44-register-adm-switch.patch')
-rw-r--r--target/linux/brcm47xx/patches-3.14/209-b44-register-adm-switch.patch74
1 files changed, 47 insertions, 27 deletions
diff --git a/target/linux/brcm47xx/patches-3.14/209-b44-register-adm-switch.patch b/target/linux/brcm47xx/patches-3.14/209-b44-register-adm-switch.patch
index cd1072b684..108d79c0b8 100644
--- a/target/linux/brcm47xx/patches-3.14/209-b44-register-adm-switch.patch
+++ b/target/linux/brcm47xx/patches-3.14/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>
-@@ -2239,6 +2241,58 @@ static void b44_adjust_link(struct net_d
+@@ -2239,6 +2241,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;
-@@ -2282,6 +2336,9 @@ static int b44_register_phy_one(struct b
+@@ -2282,6 +2348,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);
+@@ -2476,6 +2545,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 {