summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-12-17 22:14:11 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-12-17 22:14:11 +0000
commitc72313fd9801143029e7381d3df92e49fe45c56b (patch)
treeb06e303f40c7c6b6f1c90b6a1f6828e2fb96eb61 /target/linux/ar71xx
parent8b712436f37cea6b25e5a717042ab10b85fab3be (diff)
downloadmtk-20170518-c72313fd9801143029e7381d3df92e49fe45c56b.zip
mtk-20170518-c72313fd9801143029e7381d3df92e49fe45c56b.tar.gz
mtk-20170518-c72313fd9801143029e7381d3df92e49fe45c56b.tar.bz2
ar71xx: implement switch fix for WD My Net N750
The bootloader on the WD My Net N750 disables the ports on it's internal AR8327N switch by powering them down. The stock firmware then brings the ports back up again by starting the auto negotiation process on each port. This fix implements just that. Signed-off-by: Felix Kaechele <heffer@fedoraproject.org> Patchwork: http://patchwork.openwrt.org/patch/4615/ Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 39128
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n750.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n750.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n750.c
index 60f68cd..29201fe 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n750.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-mynet-n750.c
@@ -12,6 +12,7 @@
#include <linux/pci.h>
#include <linux/phy.h>
#include <linux/gpio.h>
+#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/ath9k_platform.h>
#include <linux/ar8216_platform.h>
@@ -144,6 +145,23 @@ static void mynet_n750_get_mac(const char *name, char *mac)
pr_err("no MAC address found for %s\n", name);
}
+/*
+ * The bootloader on this board powers down all PHYs on the switch
+ * before booting the kernel. We bring all PHYs back up so that they are
+ * discoverable by the mdio bus scan and the switch is detected
+ * correctly.
+ */
+static void mynet_n750_mdio_fixup(struct mii_bus *bus)
+{
+ int i;
+
+ for (i = 0; i < 5; i++)
+ bus->write(bus, i, MII_BMCR,
+ (BMCR_RESET | BMCR_ANENABLE | BMCR_SPEED1000));
+
+ mdelay(1000);
+}
+
static void __init mynet_n750_setup(void)
{
u8 *art = (u8 *) KSEG1ADDR(0x1fff0000);
@@ -178,6 +196,7 @@ static void __init mynet_n750_setup(void)
mdiobus_register_board_info(mynet_n750_mdio0_info,
ARRAY_SIZE(mynet_n750_mdio0_info));
+ ath79_mdio0_data.reset = mynet_n750_mdio_fixup;
ath79_register_mdio(0, 0x0);
mynet_n750_get_mac("lanmac=", ath79_eth0_data.mac_addr);