From ebccb007ba1bd6b0ff772da54c41fc9924267141 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 16 Sep 2014 18:35:00 +0000 Subject: [PATCH] lantiq: fix switch init on vr9 SoC (3.10) Signed-off-by: John Crispin Backport of r42544 Backport of r42551 Backport of r42574 SVN-Revision: 42578 --- .../base-files/etc/uci-defaults/02_network | 3 ++ target/linux/lantiq/dts/TDW8970.dts | 2 +- target/linux/lantiq/dts/VG3503J.dtsi | 1 + .../0205-lantiq-xrx200-switch.patch | 37 ++++++++----------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/02_network b/target/linux/lantiq/base-files/etc/uci-defaults/02_network index 2dee0c174f..8d9ae4f57f 100644 --- a/target/linux/lantiq/base-files/etc/uci-defaults/02_network +++ b/target/linux/lantiq/base-files/etc/uci-defaults/02_network @@ -154,6 +154,9 @@ P2812HNUFX) TDW8970) lan_mac=$(mtd_get_mac_binary boardconfig 61696) wan_mac=$(macaddr_add "$lan_mac" 1) + ucidef_set_interface_lan 'eth0.1' + ucidef_add_switch "switch0" "1" "1" + ucidef_add_switch_vlan "switch0" "1" "0 2 4 5 6t" ;; ARV7519RW22) diff --git a/target/linux/lantiq/dts/TDW8970.dts b/target/linux/lantiq/dts/TDW8970.dts index a312a9fbb4..51972a07c8 100644 --- a/target/linux/lantiq/dts/TDW8970.dts +++ b/target/linux/lantiq/dts/TDW8970.dts @@ -65,7 +65,6 @@ >; interrupt-parent = <&icu0>; interrupts = <73 72>; - lantiq,switch; lan: interface@0 { compatible = "lantiq,xrx200-pdi"; @@ -73,6 +72,7 @@ #size-cells = <0>; reg = <0>; mtd-mac-address = <&ath9k_cal 0xf100>; + lantiq,switch; ethernet@0 { compatible = "lantiq,xrx200-pdi-port"; diff --git a/target/linux/lantiq/dts/VG3503J.dtsi b/target/linux/lantiq/dts/VG3503J.dtsi index b228a0f9c0..3e6bab5dd3 100644 --- a/target/linux/lantiq/dts/VG3503J.dtsi +++ b/target/linux/lantiq/dts/VG3503J.dtsi @@ -102,6 +102,7 @@ #size-cells = <0>; reg = <0>; mac-address = [ 00 11 22 33 44 55 ]; + lantiq,switch; ethernet@2 { compatible = "lantiq,xrx200-pdi-port"; reg = <2>; diff --git a/target/linux/lantiq/patches-3.10/0205-lantiq-xrx200-switch.patch b/target/linux/lantiq/patches-3.10/0205-lantiq-xrx200-switch.patch index 11becfcd1e..6c91563fc5 100644 --- a/target/linux/lantiq/patches-3.10/0205-lantiq-xrx200-switch.patch +++ b/target/linux/lantiq/patches-3.10/0205-lantiq-xrx200-switch.patch @@ -1,5 +1,7 @@ ---- a/drivers/net/ethernet/lantiq_xrx200.c -+++ b/drivers/net/ethernet/lantiq_xrx200.c +Index: linux-3.10.49/drivers/net/ethernet/lantiq_xrx200.c +=================================================================== +--- linux-3.10.49.orig/drivers/net/ethernet/lantiq_xrx200.c 2014-09-13 05:05:35.449070854 +0200 ++++ linux-3.10.49/drivers/net/ethernet/lantiq_xrx200.c 2014-09-13 05:17:26.065088335 +0200 @@ -16,6 +16,7 @@ * Copyright (C) 2012 John Crispin */ @@ -35,7 +37,7 @@ #define XRX200_DMA_DATA_LEN 0x600 #define XRX200_DMA_IRQ INT_NUM_IM2_IRL0 #define XRX200_DMA_RX 0 -@@ -225,6 +230,8 @@ struct xrx200_hw { +@@ -225,6 +230,8 @@ unsigned short wan_map; spinlock_t lock; @@ -44,7 +46,7 @@ }; struct xrx200_priv { -@@ -233,7 +240,8 @@ struct xrx200_priv { +@@ -233,7 +240,8 @@ struct xrx200_port port[XRX200_MAX_PORT]; int num_port; @@ -54,7 +56,7 @@ unsigned short port_map; unsigned char mac[6]; -@@ -265,6 +273,585 @@ static __iomem void *xrx200_pmac_membase +@@ -265,6 +273,585 @@ #define ltq_pmac_w32_mask(x, y, z) \ ltq_w32_mask(x, y, xrx200_pmac_membase + (z)) @@ -640,7 +642,7 @@ static int xrx200_open(struct net_device *dev) { struct xrx200_priv *priv = netdev_priv(dev); -@@ -346,7 +933,7 @@ static void xrx200_hw_receive(struct xrx +@@ -346,7 +933,7 @@ struct xrx200_priv *priv = netdev_priv(dev); struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; struct sk_buff *skb = ch->skb[ch->dma.desc]; @@ -649,7 +651,7 @@ unsigned long flags; spin_lock_irqsave(&priv->hw->lock, flags); -@@ -924,9 +1511,9 @@ static void xrx200_hw_init(struct xrx200 +@@ -924,9 +1511,9 @@ PMAC_HD_CTL); #endif @@ -661,27 +663,18 @@ ltq_switch_w32_mask(0, 0x01, SDMA_PCTRLx(i)); ltq_switch_w32_mask(0, PCE_INGRESS, PCE_PCTRL_REG(i, 0)); } -@@ -1042,6 +1629,7 @@ static void xrx200_of_iface(struct xrx20 - struct xrx200_priv *priv; - struct device_node *port; - const __be32 *wan; -+ const __be32 *sw; - - /* alloc the network device */ - hw->devs[hw->num_devs] = alloc_etherdev(sizeof(struct xrx200_priv)); -@@ -1065,6 +1653,11 @@ static void xrx200_of_iface(struct xrx20 +@@ -1065,6 +1652,10 @@ if (wan && (*wan == 1)) priv->wan = 1; + /* should the switch be enabled on this interface ? */ -+ sw = of_get_property(iface, "lantiq,switch", NULL); -+ if (sw && (*sw == 1)) ++ if (of_find_property(iface, "lantiq,switch", NULL)) + priv->sw = 1; + /* load the ports that are part of the interface */ for_each_child_of_node(iface, port) if (of_device_is_compatible(port, "lantiq,xrx200-pdi-port")) -@@ -1138,6 +1731,8 @@ static int xrx200_probe(struct platform_ +@@ -1138,6 +1729,8 @@ return -ENOENT; } @@ -690,8 +683,10 @@ /* set wan port mask */ ltq_pmac_w32(xrx200_hw.wan_map, PMAC_EWAN); ---- /dev/null -+++ b/drivers/net/ethernet/lantiq_xrx200_sw.h +Index: linux-3.10.49/drivers/net/ethernet/lantiq_xrx200_sw.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-3.10.49/drivers/net/ethernet/lantiq_xrx200_sw.h 2014-09-13 05:05:35.469070854 +0200 @@ -0,0 +1,1328 @@ +/* + * This program is free software; you can redistribute it and/or modify it -- 2.30.2