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 @@ -2239,6 +2241,58 @@ static void b44_adjust_link(struct net_d
26 +#ifdef CONFIG_BCM47XX
27 +static struct adm6996_gpio_platform_data b44_adm_data = {
35 +static struct platform_device b44_adm_dev = {
36 + .name = "adm6996_gpio",
39 + .platform_data = &b44_adm_data,
43 +static int b44_register_adm_switch(struct b44 *bp)
48 + gpio = bcm47xx_nvram_gpio_pin("adm_eecs");
50 + b44_adm_data.eecs = gpio;
52 + gpio = bcm47xx_nvram_gpio_pin("adm_eesk");
54 + b44_adm_data.eesk = gpio;
56 + gpio = bcm47xx_nvram_gpio_pin("adm_eedi");
58 + b44_adm_data.eedi = gpio;
60 + gpio = bcm47xx_nvram_gpio_pin("adm_rc");
62 + b44_adm_data.eerc = gpio;
64 + if (!bp->adm_switch) {
65 + err = platform_device_register(&b44_adm_dev);
67 + bp->adm_switch = &b44_adm_dev;
72 +static int b44_register_adm_switch(struct b44 *bp)
76 +#endif /* CONFIG_BCM47XX */
78 static int b44_register_phy_one(struct b44 *bp)
80 struct mii_bus *mii_bus;
81 @@ -2282,6 +2336,9 @@ static int b44_register_phy_one(struct b
82 if (!bp->mii_bus->phy_map[bp->phy_addr] &&
83 (sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) {
85 + if (sprom->boardflags_lo & B44_BOARDFLAG_ADM)
86 + b44_register_adm_switch(bp);
89 "could not find PHY at %i, use fixed one\n",
91 --- a/drivers/net/ethernet/broadcom/b44.h
92 +++ b/drivers/net/ethernet/broadcom/b44.h
93 @@ -404,6 +404,9 @@ struct b44 {
94 struct mii_bus *mii_bus;
96 struct mii_if_info mii_if;
98 + /* platform device for associated switch */
99 + struct platform_device *adm_switch;