summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2014-10-29 18:49:46 +0000
committerJohn Crispin <john@openwrt.org>2014-10-29 18:49:46 +0000
commit8223e7812183daf3180988525529dbc4eed7741c (patch)
treef1ea9c0e5df13f9dcdbc319f94d87559135f31c6
parentfd5873eb33d931b41fa39c50a11512dcd4402f60 (diff)
downloadmtk-20170518-8223e7812183daf3180988525529dbc4eed7741c.zip
mtk-20170518-8223e7812183daf3180988525529dbc4eed7741c.tar.gz
mtk-20170518-8223e7812183daf3180988525529dbc4eed7741c.tar.bz2
ralink: fix a off by 4 bug in mt7530
0x8100000c vs 0x810000c0 int he pvc register this caused the cascade with an external mt7530 to fail. Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 43104
-rw-r--r--target/linux/ramips/patches-3.14/0035-NET-MIPS-add-ralink-SoC-ethernet-driver.patch175
1 files changed, 112 insertions, 63 deletions
diff --git a/target/linux/ramips/patches-3.14/0035-NET-MIPS-add-ralink-SoC-ethernet-driver.patch b/target/linux/ramips/patches-3.14/0035-NET-MIPS-add-ralink-SoC-ethernet-driver.patch
index 59e97c7..c4829af 100644
--- a/target/linux/ramips/patches-3.14/0035-NET-MIPS-add-ralink-SoC-ethernet-driver.patch
+++ b/target/linux/ramips/patches-3.14/0035-NET-MIPS-add-ralink-SoC-ethernet-driver.patch
@@ -50,8 +50,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
create mode 100644 drivers/net/ethernet/ralink/soc_rt305x.c
create mode 100644 drivers/net/ethernet/ralink/soc_rt3883.c
---- /dev/null
-+++ b/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h
+Index: linux-3.14.18/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/arch/mips/include/asm/mach-ralink/rt305x_esw_platform.h 2014-10-28 10:43:11.882131200 +0100
@@ -0,0 +1,27 @@
+/*
+ * Ralink RT305x SoC platform device registration
@@ -80,9 +82,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+#endif /* _RT305X_ESW_PLATFORM_H */
---- a/arch/mips/ralink/rt305x.c
-+++ b/arch/mips/ralink/rt305x.c
-@@ -199,6 +199,7 @@ void __init ralink_clk_init(void)
+Index: linux-3.14.18/arch/mips/ralink/rt305x.c
+===================================================================
+--- linux-3.14.18.orig/arch/mips/ralink/rt305x.c 2014-10-28 10:43:11.766130990 +0100
++++ linux-3.14.18/arch/mips/ralink/rt305x.c 2014-10-28 10:43:11.882131200 +0100
+@@ -199,6 +199,7 @@
}
ralink_clk_add("cpu", cpu_rate);
@@ -90,9 +94,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
ralink_clk_add("10000b00.spi", sys_rate);
ralink_clk_add("10000100.timer", wdt_rate);
ralink_clk_add("10000120.watchdog", wdt_rate);
---- a/drivers/net/ethernet/Kconfig
-+++ b/drivers/net/ethernet/Kconfig
-@@ -134,6 +134,7 @@ config ETHOC
+Index: linux-3.14.18/drivers/net/ethernet/Kconfig
+===================================================================
+--- linux-3.14.18.orig/drivers/net/ethernet/Kconfig 2014-09-06 01:34:59.000000000 +0200
++++ linux-3.14.18/drivers/net/ethernet/Kconfig 2014-10-29 14:59:06.927617708 +0100
+@@ -134,6 +134,7 @@
source "drivers/net/ethernet/packetengines/Kconfig"
source "drivers/net/ethernet/pasemi/Kconfig"
source "drivers/net/ethernet/qlogic/Kconfig"
@@ -100,9 +106,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
source "drivers/net/ethernet/realtek/Kconfig"
source "drivers/net/ethernet/renesas/Kconfig"
source "drivers/net/ethernet/rdc/Kconfig"
---- a/drivers/net/ethernet/Makefile
-+++ b/drivers/net/ethernet/Makefile
-@@ -56,6 +56,7 @@ obj-$(CONFIG_ETHOC) += ethoc.o
+Index: linux-3.14.18/drivers/net/ethernet/Makefile
+===================================================================
+--- linux-3.14.18.orig/drivers/net/ethernet/Makefile 2014-09-06 01:34:59.000000000 +0200
++++ linux-3.14.18/drivers/net/ethernet/Makefile 2014-10-29 14:59:06.927617708 +0100
+@@ -56,6 +56,7 @@
obj-$(CONFIG_NET_PACKET_ENGINE) += packetengines/
obj-$(CONFIG_NET_VENDOR_PASEMI) += pasemi/
obj-$(CONFIG_NET_VENDOR_QLOGIC) += qlogic/
@@ -110,8 +118,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
obj-$(CONFIG_NET_VENDOR_REALTEK) += realtek/
obj-$(CONFIG_SH_ETH) += renesas/
obj-$(CONFIG_NET_VENDOR_RDC) += rdc/
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/Kconfig
+Index: linux-3.14.18/drivers/net/ethernet/ralink/Kconfig
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/Kconfig 2014-10-28 10:43:11.886131208 +0100
@@ -0,0 +1,32 @@
+config NET_RALINK
+ tristate "Ralink RT288X/RT3X5X/RT3662/RT3883/MT7620 ethernet driver"
@@ -145,8 +155,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ select PHYLIB
+ select SWCONFIG
+endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/Makefile
+Index: linux-3.14.18/drivers/net/ethernet/ralink/Makefile
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/Makefile 2014-10-28 10:43:11.886131208 +0100
@@ -0,0 +1,18 @@
+#
+# Makefile for the Ralink SoCs built-in ethernet macs
@@ -166,8 +178,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ralink-eth-$(CONFIG_SOC_MT7620) += soc_mt7620.o
+
+obj-$(CONFIG_NET_RALINK) += ralink-eth.o
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/esw_rt3052.c
+Index: linux-3.14.18/drivers/net/ethernet/ralink/esw_rt3052.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/esw_rt3052.c 2014-10-28 10:43:11.886131208 +0100
@@ -0,0 +1,1463 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -1632,8 +1646,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+{
+ platform_driver_unregister(&esw_driver);
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/esw_rt3052.h
+Index: linux-3.14.18/drivers/net/ethernet/ralink/esw_rt3052.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/esw_rt3052.h 2014-10-28 10:43:11.886131208 +0100
@@ -0,0 +1,32 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -1667,9 +1683,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+#endif
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/gsw_mt7620a.c
-@@ -0,0 +1,566 @@
+Index: linux-3.14.18/drivers/net/ethernet/ralink/gsw_mt7620a.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/gsw_mt7620a.c 2014-10-29 14:58:32.303564882 +0100
+@@ -0,0 +1,568 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
@@ -2179,10 +2197,12 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ struct mt7620_gsw *gsw = (struct mt7620_gsw *) priv->soc->swpriv;
+
+ /* is the mt7530 internal or external */
-+ if ((_mt7620_mii_read(gsw, 0x1f, 2) == 1) && (_mt7620_mii_read(gsw, 0x1f, 3) == 0xbeef))
-+ mt7530_probe(priv->device, NULL, priv->mii_bus);
-+ else
-+ mt7530_probe(priv->device, gsw->base, NULL);
++ if ((_mt7620_mii_read(gsw, 0x1f, 2) == 1) && (_mt7620_mii_read(gsw, 0x1f, 3) == 0xbeef)) {
++ mt7530_probe(priv->device, gsw->base, NULL, 0);
++ mt7530_probe(priv->device, NULL, priv->mii_bus, 1);
++ } else {
++ mt7530_probe(priv->device, gsw->base, NULL, 1);
++ }
+
+ return 0;
+}
@@ -2236,8 +2256,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ return 0;
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/gsw_mt7620a.h
+Index: linux-3.14.18/drivers/net/ethernet/ralink/gsw_mt7620a.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/gsw_mt7620a.h 2014-10-28 10:43:11.890131215 +0100
@@ -0,0 +1,30 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2269,8 +2291,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+extern int mt7620a_has_carrier(struct fe_priv *priv);
+
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mdio.c
+Index: linux-3.14.18/drivers/net/ethernet/ralink/mdio.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/mdio.c 2014-10-28 10:43:11.890131215 +0100
@@ -0,0 +1,244 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2516,8 +2540,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ of_node_put(priv->mii_bus->dev.of_node);
+ kfree(priv->mii_bus);
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mdio.h
+Index: linux-3.14.18/drivers/net/ethernet/ralink/mdio.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/mdio.h 2014-10-28 10:43:11.890131215 +0100
@@ -0,0 +1,29 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2548,8 +2574,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+static inline void fe_mdio_cleanup(struct fe_priv *priv) {}
+#endif
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mdio_rt2880.c
+Index: linux-3.14.18/drivers/net/ethernet/ralink/mdio_rt2880.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/mdio_rt2880.c 2014-10-28 10:43:11.890131215 +0100
@@ -0,0 +1,232 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2783,8 +2811,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ return;
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mdio_rt2880.h
+Index: linux-3.14.18/drivers/net/ethernet/ralink/mdio_rt2880.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/mdio_rt2880.h 2014-10-28 10:43:11.890131215 +0100
@@ -0,0 +1,26 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -2812,9 +2842,11 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+void rt2880_port_init(struct fe_priv *priv, struct device_node *np);
+
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mt7530.c
-@@ -0,0 +1,579 @@
+Index: linux-3.14.18/drivers/net/ethernet/ralink/mt7530.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/mt7530.c 2014-10-29 14:58:52.303587070 +0100
+@@ -0,0 +1,582 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
@@ -2945,8 +2977,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+{
+ int i = 0;
+
-+ mt7530->global_vlan_enable = 1;
-+
+ for (i = 0; i < MT7530_NUM_PORTS; i++)
+ mt7530->port_entries[i].pvid = map->pvids[i];
+
@@ -3205,9 +3235,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ mt7530_w32(priv, REG_ESW_PORT_PCR(i), 0x00ff0000);
+
+ for (i = 0; i < MT7530_NUM_PORTS; i++)
-+ mt7530_w32(priv, REG_ESW_PORT_PVC(i), 0x8100000c);
++ mt7530_w32(priv, REG_ESW_PORT_PVC(i), 0x810000c0);
+
-+ return 0;
++ return 0;
+ }
+
+ /* set all ports as security mode */
@@ -3353,7 +3383,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+int
-+mt7530_probe(struct device *dev, void __iomem *base, struct mii_bus *bus)
++mt7530_probe(struct device *dev, void __iomem *base, struct mii_bus *bus, int vlan)
+{
+ struct switch_dev *swdev;
+ struct mt7530_priv *mt7530;
@@ -3369,11 +3399,16 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ mt7530->base = base;
+ mt7530->bus = bus;
-+ mt7530->global_vlan_enable = 1;
++ mt7530->global_vlan_enable = vlan;
+
+ swdev = &mt7530->swdev;
-+ swdev->name = "mt7530";
-+ swdev->alias = "mt7530";
++ if (bus) {
++ swdev->alias = "mt7530";
++ swdev->name = "mt7530";
++ } else {
++ swdev->alias = "mt7620";
++ swdev->name = "mt7620";
++ }
+ swdev->cpu_port = MT7530_CPU_PORT;
+ swdev->ports = MT7530_NUM_PORTS;
+ swdev->vlans = MT7530_NUM_VLANS;
@@ -3385,7 +3420,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ return ret;
+ }
+
-+ dev_info(dev, "loaded mt7530 driver\n");
++ dev_info(dev, "loaded %s driver\n", swdev->name);
+
+ map = mt7530_find_mapping(dev->of_node);
+ if (map)
@@ -3394,8 +3429,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+
+ return 0;
+}
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/mt7530.h
+Index: linux-3.14.18/drivers/net/ethernet/ralink/mt7530.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/mt7530.h 2014-10-28 12:34:25.187728544 +0100
@@ -0,0 +1,20 @@
+/*
+ * This program is free software; you can redistribute it and/or
@@ -3414,11 +3451,13 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+#ifndef _MT7530_H__
+#define _MT7530_H__
+
-+int mt7530_probe(struct device *dev, void __iomem *base, struct mii_bus *bus);
++int mt7530_probe(struct device *dev, void __iomem *base, struct mii_bus *bus, int vlan);
+
+#endif
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/ralink_soc_eth.c
+Index: linux-3.14.18/drivers/net/ethernet/ralink/ralink_soc_eth.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/ralink_soc_eth.c 2014-10-28 10:43:11.890131215 +0100
@@ -0,0 +1,844 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -4264,8 +4303,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
+MODULE_DESCRIPTION("Ethernet driver for Ralink SoC");
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/ralink_soc_eth.h
+Index: linux-3.14.18/drivers/net/ethernet/ralink/ralink_soc_eth.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/ralink_soc_eth.h 2014-10-28 10:43:11.894131220 +0100
@@ -0,0 +1,384 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -4651,8 +4692,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+u32 fe_r32(unsigned reg);
+
+#endif /* FE_ETH_H */
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/soc_mt7620.c
+Index: linux-3.14.18/drivers/net/ethernet/ralink/soc_mt7620.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/soc_mt7620.c 2014-10-28 10:43:11.894131220 +0100
@@ -0,0 +1,172 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -4826,8 +4869,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+MODULE_DEVICE_TABLE(of, of_fe_match);
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/soc_rt2880.c
+Index: linux-3.14.18/drivers/net/ethernet/ralink/soc_rt2880.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/soc_rt2880.c 2014-10-28 10:43:11.894131220 +0100
@@ -0,0 +1,52 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -4881,8 +4926,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+MODULE_DEVICE_TABLE(of, of_fe_match);
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/soc_rt305x.c
+Index: linux-3.14.18/drivers/net/ethernet/ralink/soc_rt305x.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/soc_rt305x.c 2014-10-28 10:43:11.894131220 +0100
@@ -0,0 +1,113 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
@@ -4997,8 +5044,10 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+};
+
+MODULE_DEVICE_TABLE(of, of_fe_match);
---- /dev/null
-+++ b/drivers/net/ethernet/ralink/soc_rt3883.c
+Index: linux-3.14.18/drivers/net/ethernet/ralink/soc_rt3883.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-3.14.18/drivers/net/ethernet/ralink/soc_rt3883.c 2014-10-28 10:43:11.894131220 +0100
@@ -0,0 +1,60 @@
+/*
+ * This program is free software; you can redistribute it and/or modify