1 From b36f694256f41bc71571f467646d015dda128d14 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sat, 9 Nov 2013 17:03:59 +0100
4 Subject: [PATCH 210/210] b44: register adm switch
7 drivers/net/ethernet/broadcom/b44.c | 57 +++++++++++++++++++++++++++++++++++
8 drivers/net/ethernet/broadcom/b44.h | 3 ++
9 2 files changed, 60 insertions(+)
11 --- a/drivers/net/ethernet/broadcom/b44.c
12 +++ b/drivers/net/ethernet/broadcom/b44.c
14 #include <linux/ssb/ssb.h>
15 #include <linux/slab.h>
16 #include <linux/phy.h>
17 +#include <linux/platform_device.h>
18 +#include <linux/platform_data/adm6996-gpio.h>
20 #include <asm/uaccess.h>
22 @@ -2240,6 +2242,70 @@ static void b44_adjust_link(struct net_d
26 +#ifdef CONFIG_BCM47XX
27 +static int b44_register_adm_switch(struct b44 *bp)
30 + struct platform_device *pdev;
31 + struct adm6996_gpio_platform_data adm_data = {0};
32 + struct platform_device_info info = {0};
34 + adm_data.model = ADM6996L;
35 + gpio = bcm47xx_nvram_gpio_pin("adm_eecs");
37 + adm_data.eecs = gpio;
41 + gpio = bcm47xx_nvram_gpio_pin("adm_eesk");
43 + adm_data.eesk = gpio;
47 + gpio = bcm47xx_nvram_gpio_pin("adm_eedi");
49 + adm_data.eedi = gpio;
53 + gpio = bcm47xx_nvram_gpio_pin("adm_rc");
55 + adm_data.eerc = gpio;
59 + info.parent = bp->sdev->dev;
60 + info.name = "adm6996_gpio";
62 + info.data = &adm_data;
63 + info.size_data = sizeof(adm_data);
65 + if (!bp->adm_switch) {
66 + pdev = platform_device_register_full(&info);
68 + return PTR_ERR(pdev);
70 + bp->adm_switch = pdev;
74 +static void b44_unregister_adm_switch(struct b44 *bp)
77 + platform_device_unregister(bp->adm_switch);
80 +static int b44_register_adm_switch(struct b44 *bp)
84 +static void b44_unregister_adm_switch(struct b44 *bp)
88 +#endif /* CONFIG_BCM47XX */
90 static int b44_register_phy_one(struct b44 *bp)
92 struct mii_bus *mii_bus;
93 @@ -2283,6 +2349,9 @@ static int b44_register_phy_one(struct b
94 if (!bp->mii_bus->phy_map[bp->phy_addr] &&
95 (sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) {
97 + if (sprom->boardflags_lo & B44_BOARDFLAG_ADM)
98 + b44_register_adm_switch(bp);
101 "could not find PHY at %i, use fixed one\n",
103 @@ -2479,6 +2548,7 @@ static void b44_remove_one(struct ssb_de
104 unregister_netdev(dev);
105 if (bp->flags & B44_FLAG_EXTERNAL_PHY)
106 b44_unregister_phy_one(bp);
107 + b44_unregister_adm_switch(bp);
108 ssb_device_disable(sdev, 0);
109 ssb_bus_may_powerdown(sdev->bus);
110 netif_napi_del(&bp->napi);
111 --- a/drivers/net/ethernet/broadcom/b44.h
112 +++ b/drivers/net/ethernet/broadcom/b44.h
113 @@ -404,6 +404,9 @@ struct b44 {
114 struct mii_bus *mii_bus;
116 struct mii_if_info mii_if;
118 + /* platform device for associated switch */
119 + struct platform_device *adm_switch;