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 <linux/uaccess.h>
22 @@ -2248,6 +2250,69 @@ 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;
54 + * We ignore the "adm_rc" GPIO here. The driver does not use it,
55 + * and it conflicts with the Reset button GPIO on the Linksys WRT54GSv1.
58 + info.parent = bp->sdev->dev;
59 + info.name = "adm6996_gpio";
61 + info.data = &adm_data;
62 + info.size_data = sizeof(adm_data);
64 + if (!bp->adm_switch) {
65 + pdev = platform_device_register_full(&info);
67 + return PTR_ERR(pdev);
69 + bp->adm_switch = pdev;
73 +static void b44_unregister_adm_switch(struct b44 *bp)
76 + platform_device_unregister(bp->adm_switch);
79 +static int b44_register_adm_switch(struct b44 *bp)
83 +static void b44_unregister_adm_switch(struct b44 *bp)
87 +#endif /* CONFIG_BCM47XX */
89 static int b44_register_phy_one(struct b44 *bp)
91 struct mii_bus *mii_bus;
92 @@ -2283,6 +2348,9 @@ static int b44_register_phy_one(struct b
93 if (!mdiobus_is_registered_device(bp->mii_bus, bp->phy_addr) &&
94 (sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) {
96 + if (sprom->boardflags_lo & B44_BOARDFLAG_ADM)
97 + b44_register_adm_switch(bp);
100 "could not find PHY at %i, use fixed one\n",
102 @@ -2477,6 +2545,7 @@ static void b44_remove_one(struct ssb_de
103 unregister_netdev(dev);
104 if (bp->flags & B44_FLAG_EXTERNAL_PHY)
105 b44_unregister_phy_one(bp);
106 + b44_unregister_adm_switch(bp);
107 ssb_device_disable(sdev, 0);
108 ssb_bus_may_powerdown(sdev->bus);
109 netif_napi_del(&bp->napi);
110 --- a/drivers/net/ethernet/broadcom/b44.h
111 +++ b/drivers/net/ethernet/broadcom/b44.h
112 @@ -408,6 +408,9 @@ struct b44 {
113 struct mii_bus *mii_bus;
115 struct mii_if_info mii_if;
117 + /* platform device for associated switch */
118 + struct platform_device *adm_switch;