1 From b52546f8af54b78050f84ab031ad1aaf6507ed95 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 10/10] b44: register adm switch
7 drivers/net/ethernet/broadcom/b44.c | 64 ++++++++++++++++++++++++++++++++++-
8 drivers/net/ethernet/broadcom/b44.h | 3 ++
9 2 files changed, 66 insertions(+), 1 deletion(-)
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 @@ -2216,6 +2218,58 @@ static void b44_adjust_link(struct net_d
23 phy_print_status(phydev);
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 @@ -2223,6 +2277,7 @@ static int b44_register_phy_one(struct b
82 struct phy_device *phydev;
84 struct phy_c45_device_ids c45_ids = {0};
85 + struct ssb_sprom *sprom = &sdev->bus->sprom;
87 mii_bus = mdiobus_alloc();
89 @@ -2256,7 +2311,11 @@ static int b44_register_phy_one(struct b
92 phydev = bp->mii_bus->phy_map[bp->phy_addr];
95 + (sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) {
96 + if (sprom->boardflags_lo & B44_BOARDFLAG_ADM)
97 + b44_register_adm_switch(bp);
99 dev_info(sdev->dev, "could not find PHY at %i, create dummy one\n",
102 --- a/drivers/net/ethernet/broadcom/b44.h
103 +++ b/drivers/net/ethernet/broadcom/b44.h
104 @@ -345,6 +345,9 @@ B44_STAT_REG_DECLARE
105 struct u64_stats_sync syncp;
108 +#define B44_BOARDFLAG_ROBO 0x0010 /* Board has robo switch or core */
109 +#define B44_BOARDFLAG_ADM 0x0080 /* Board has ADMtek switch */
114 @@ -402,6 +405,9 @@ struct b44 {
117 struct mii_if_info mii_if;
119 + /* platform device for associated switch */
120 + struct platform_device *adm_switch;