2013-12-26 23:27:52 +00:00
|
|
|
From b36f694256f41bc71571f467646d015dda128d14 Mon Sep 17 00:00:00 2001
|
2013-11-09 19:29:46 +00:00
|
|
|
From: Hauke Mehrtens <hauke@hauke-m.de>
|
|
|
|
Date: Sat, 9 Nov 2013 17:03:59 +0100
|
2013-12-26 23:27:52 +00:00
|
|
|
Subject: [PATCH 210/210] b44: register adm switch
|
2013-11-09 19:29:46 +00:00
|
|
|
|
|
|
|
---
|
2013-12-26 23:27:52 +00:00
|
|
|
drivers/net/ethernet/broadcom/b44.c | 57 +++++++++++++++++++++++++++++++++++
|
2013-11-09 19:29:46 +00:00
|
|
|
drivers/net/ethernet/broadcom/b44.h | 3 ++
|
2013-12-26 23:27:52 +00:00
|
|
|
2 files changed, 60 insertions(+)
|
2013-11-09 19:29:46 +00:00
|
|
|
|
|
|
|
--- a/drivers/net/ethernet/broadcom/b44.c
|
|
|
|
+++ b/drivers/net/ethernet/broadcom/b44.c
|
|
|
|
@@ -31,6 +31,8 @@
|
|
|
|
#include <linux/ssb/ssb.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/phy.h>
|
|
|
|
+#include <linux/platform_device.h>
|
|
|
|
+#include <linux/platform_data/adm6996-gpio.h>
|
|
|
|
|
|
|
|
#include <asm/uaccess.h>
|
|
|
|
#include <asm/io.h>
|
2014-07-05 21:35:15 +00:00
|
|
|
@@ -2227,6 +2229,70 @@ static void b44_adjust_link(struct net_d
|
2013-12-26 23:27:52 +00:00
|
|
|
}
|
2013-11-09 19:29:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+#ifdef CONFIG_BCM47XX
|
|
|
|
+static int b44_register_adm_switch(struct b44 *bp)
|
|
|
|
+{
|
|
|
|
+ int gpio;
|
2014-07-05 21:35:15 +00:00
|
|
|
+ struct platform_device *pdev;
|
|
|
|
+ struct adm6996_gpio_platform_data adm_data = {0};
|
|
|
|
+ struct platform_device_info info = {0};
|
2013-11-09 19:29:46 +00:00
|
|
|
+
|
2014-07-05 21:35:15 +00:00
|
|
|
+ adm_data.model = ADM6996L;
|
2013-11-09 19:29:46 +00:00
|
|
|
+ gpio = bcm47xx_nvram_gpio_pin("adm_eecs");
|
|
|
|
+ if (gpio >= 0)
|
2014-07-05 21:35:15 +00:00
|
|
|
+ adm_data.eecs = gpio;
|
|
|
|
+ else
|
|
|
|
+ adm_data.eecs = 2;
|
2013-11-09 19:29:46 +00:00
|
|
|
+
|
|
|
|
+ gpio = bcm47xx_nvram_gpio_pin("adm_eesk");
|
|
|
|
+ if (gpio >= 0)
|
2014-07-05 21:35:15 +00:00
|
|
|
+ adm_data.eesk = gpio;
|
|
|
|
+ else
|
|
|
|
+ adm_data.eesk = 3;
|
2013-11-09 19:29:46 +00:00
|
|
|
+
|
|
|
|
+ gpio = bcm47xx_nvram_gpio_pin("adm_eedi");
|
|
|
|
+ if (gpio >= 0)
|
2014-07-05 21:35:15 +00:00
|
|
|
+ adm_data.eedi = gpio;
|
|
|
|
+ else
|
|
|
|
+ adm_data.eedi = 4;
|
2013-11-09 19:29:46 +00:00
|
|
|
+
|
|
|
|
+ gpio = bcm47xx_nvram_gpio_pin("adm_rc");
|
|
|
|
+ if (gpio >= 0)
|
2014-07-05 21:35:15 +00:00
|
|
|
+ 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);
|
2013-11-09 19:29:46 +00:00
|
|
|
+
|
|
|
|
+ if (!bp->adm_switch) {
|
2014-07-05 21:35:15 +00:00
|
|
|
+ pdev = platform_device_register_full(&info);
|
|
|
|
+ if (IS_ERR(pdev))
|
|
|
|
+ return PTR_ERR(pdev);
|
|
|
|
+
|
|
|
|
+ bp->adm_switch = pdev;
|
2013-11-09 19:29:46 +00:00
|
|
|
+ }
|
2014-07-05 21:35:15 +00:00
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+static void b44_unregister_adm_switch(struct b44 *bp)
|
|
|
|
+{
|
|
|
|
+ if (bp->adm_switch)
|
|
|
|
+ platform_device_unregister(bp->adm_switch);
|
2013-11-09 19:29:46 +00:00
|
|
|
+}
|
|
|
|
+#else
|
|
|
|
+static int b44_register_adm_switch(struct b44 *bp)
|
|
|
|
+{
|
|
|
|
+ return 0;
|
|
|
|
+}
|
2014-07-05 21:35:15 +00:00
|
|
|
+static void b44_unregister_adm_switch(struct b44 *bp)
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+}
|
2013-11-09 19:29:46 +00:00
|
|
|
+#endif /* CONFIG_BCM47XX */
|
|
|
|
+
|
|
|
|
static int b44_register_phy_one(struct b44 *bp)
|
|
|
|
{
|
|
|
|
struct mii_bus *mii_bus;
|
2014-07-05 21:35:15 +00:00
|
|
|
@@ -2270,6 +2336,9 @@ static int b44_register_phy_one(struct b
|
2013-12-26 23:27:52 +00:00
|
|
|
if (!bp->mii_bus->phy_map[bp->phy_addr] &&
|
|
|
|
(sprom->boardflags_lo & (B44_BOARDFLAG_ROBO | B44_BOARDFLAG_ADM))) {
|
2013-11-09 19:29:46 +00:00
|
|
|
|
|
|
|
+ if (sprom->boardflags_lo & B44_BOARDFLAG_ADM)
|
|
|
|
+ b44_register_adm_switch(bp);
|
|
|
|
+
|
2013-12-26 23:27:52 +00:00
|
|
|
dev_info(sdev->dev,
|
|
|
|
"could not find PHY at %i, use fixed one\n",
|
2013-11-09 19:29:46 +00:00
|
|
|
bp->phy_addr);
|
2014-07-05 21:35:15 +00:00
|
|
|
@@ -2465,6 +2534,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);
|
2013-11-09 19:29:46 +00:00
|
|
|
--- a/drivers/net/ethernet/broadcom/b44.h
|
|
|
|
+++ b/drivers/net/ethernet/broadcom/b44.h
|
2013-12-26 23:27:52 +00:00
|
|
|
@@ -404,6 +404,9 @@ struct b44 {
|
|
|
|
struct mii_bus *mii_bus;
|
2013-11-09 19:29:46 +00:00
|
|
|
int old_link;
|
|
|
|
struct mii_if_info mii_if;
|
|
|
|
+
|
|
|
|
+ /* platform device for associated switch */
|
|
|
|
+ struct platform_device *adm_switch;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _B44_H */
|