lantiq: fix switch init on vr9 SoC (3.10)

Signed-off-by: John Crispin <blogic@openwrt.org>

Backport of r42544
Backport of r42551
Backport of r42574

git-svn-id: svn://svn.openwrt.org/openwrt/branches/barrier_breaker@42578 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
blogic 2014-09-16 18:35:00 +00:00
parent 13237e2ea4
commit 55576d0850
4 changed files with 21 additions and 22 deletions

View File

@ -154,6 +154,9 @@ P2812HNUFX)
TDW8970) TDW8970)
lan_mac=$(mtd_get_mac_binary boardconfig 61696) lan_mac=$(mtd_get_mac_binary boardconfig 61696)
wan_mac=$(macaddr_add "$lan_mac" 1) 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) ARV7519RW22)

View File

@ -65,7 +65,6 @@
>; >;
interrupt-parent = <&icu0>; interrupt-parent = <&icu0>;
interrupts = <73 72>; interrupts = <73 72>;
lantiq,switch;
lan: interface@0 { lan: interface@0 {
compatible = "lantiq,xrx200-pdi"; compatible = "lantiq,xrx200-pdi";
@ -73,6 +72,7 @@
#size-cells = <0>; #size-cells = <0>;
reg = <0>; reg = <0>;
mtd-mac-address = <&ath9k_cal 0xf100>; mtd-mac-address = <&ath9k_cal 0xf100>;
lantiq,switch;
ethernet@0 { ethernet@0 {
compatible = "lantiq,xrx200-pdi-port"; compatible = "lantiq,xrx200-pdi-port";

View File

@ -102,6 +102,7 @@
#size-cells = <0>; #size-cells = <0>;
reg = <0>; reg = <0>;
mac-address = [ 00 11 22 33 44 55 ]; mac-address = [ 00 11 22 33 44 55 ];
lantiq,switch;
ethernet@2 { ethernet@2 {
compatible = "lantiq,xrx200-pdi-port"; compatible = "lantiq,xrx200-pdi-port";
reg = <2>; reg = <2>;

View File

@ -1,5 +1,7 @@
--- a/drivers/net/ethernet/lantiq_xrx200.c Index: linux-3.10.49/drivers/net/ethernet/lantiq_xrx200.c
+++ b/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 @@ @@ -16,6 +16,7 @@
* Copyright (C) 2012 John Crispin <blogic@openwrt.org> * Copyright (C) 2012 John Crispin <blogic@openwrt.org>
*/ */
@ -35,7 +37,7 @@
#define XRX200_DMA_DATA_LEN 0x600 #define XRX200_DMA_DATA_LEN 0x600
#define XRX200_DMA_IRQ INT_NUM_IM2_IRL0 #define XRX200_DMA_IRQ INT_NUM_IM2_IRL0
#define XRX200_DMA_RX 0 #define XRX200_DMA_RX 0
@@ -225,6 +230,8 @@ struct xrx200_hw { @@ -225,6 +230,8 @@
unsigned short wan_map; unsigned short wan_map;
spinlock_t lock; spinlock_t lock;
@ -44,7 +46,7 @@
}; };
struct xrx200_priv { struct xrx200_priv {
@@ -233,7 +240,8 @@ struct xrx200_priv { @@ -233,7 +240,8 @@
struct xrx200_port port[XRX200_MAX_PORT]; struct xrx200_port port[XRX200_MAX_PORT];
int num_port; int num_port;
@ -54,7 +56,7 @@
unsigned short port_map; unsigned short port_map;
unsigned char mac[6]; 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) \ #define ltq_pmac_w32_mask(x, y, z) \
ltq_w32_mask(x, y, xrx200_pmac_membase + (z)) ltq_w32_mask(x, y, xrx200_pmac_membase + (z))
@ -640,7 +642,7 @@
static int xrx200_open(struct net_device *dev) static int xrx200_open(struct net_device *dev)
{ {
struct xrx200_priv *priv = netdev_priv(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 xrx200_priv *priv = netdev_priv(dev);
struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc]; struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
struct sk_buff *skb = ch->skb[ch->dma.desc]; struct sk_buff *skb = ch->skb[ch->dma.desc];
@ -649,7 +651,7 @@
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->hw->lock, 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); PMAC_HD_CTL);
#endif #endif
@ -661,27 +663,18 @@
ltq_switch_w32_mask(0, 0x01, SDMA_PCTRLx(i)); ltq_switch_w32_mask(0, 0x01, SDMA_PCTRLx(i));
ltq_switch_w32_mask(0, PCE_INGRESS, PCE_PCTRL_REG(i, 0)); ltq_switch_w32_mask(0, PCE_INGRESS, PCE_PCTRL_REG(i, 0));
} }
@@ -1042,6 +1629,7 @@ static void xrx200_of_iface(struct xrx20 @@ -1065,6 +1652,10 @@
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
if (wan && (*wan == 1)) if (wan && (*wan == 1))
priv->wan = 1; priv->wan = 1;
+ /* should the switch be enabled on this interface ? */ + /* should the switch be enabled on this interface ? */
+ sw = of_get_property(iface, "lantiq,switch", NULL); + if (of_find_property(iface, "lantiq,switch", NULL))
+ if (sw && (*sw == 1))
+ priv->sw = 1; + priv->sw = 1;
+ +
/* load the ports that are part of the interface */ /* load the ports that are part of the interface */
for_each_child_of_node(iface, port) for_each_child_of_node(iface, port)
if (of_device_is_compatible(port, "lantiq,xrx200-pdi-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; return -ENOENT;
} }
@ -690,8 +683,10 @@
/* set wan port mask */ /* set wan port mask */
ltq_pmac_w32(xrx200_hw.wan_map, PMAC_EWAN); ltq_pmac_w32(xrx200_hw.wan_map, PMAC_EWAN);
--- /dev/null Index: linux-3.10.49/drivers/net/ethernet/lantiq_xrx200_sw.h
+++ b/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 @@ @@ -0,0 +1,1328 @@
+/* +/*
+ * This program is free software; you can redistribute it and/or modify it + * This program is free software; you can redistribute it and/or modify it