firmware/build_patches/openwrt/0050-Disable-ipq40xx-lan-wa...

133 lines
5.3 KiB
Diff

From: =?UTF-8?q?Fabian=20Bl=C3=A4se?= <fabian@blaese.de>
Date: Sat, 7 Aug 2021 00:40:34 +0200
Subject: [PATCH] Disable ipq40xx lan/wan separation
While the ipq40xx only has a single MDIO connection to the switch chip,
the ipq40xx essedma ethernet driver configures two gmac interfaces,
which are seperated into WAN and LAN ports using vlan cid at driver
level. Linux is not aware of these vlan tags.
However, this configuration does interfere with the vlan ids we use in
our firmware. Therefore, this feature is disabled by setting the default
vlan id for all gmacs to 0, changing the port mask so all physical ports
are connected to the first gmac, and reducing the amount of configured
gmacs to one. The definition of the second gmac is kept, because it is
referenced by some devices. The default configuration of the switch chip
is removed accordingly.
These changes are currently only done with the FritzBox 4040 in mind.
---
.../linux/ipq40xx/base-files/etc/board.d/01_leds | 2 +-
.../ipq40xx/base-files/etc/board.d/02_network | 3 +--
.../drivers/net/ethernet/qualcomm/essedma/edma.h | 16 ++++++++--------
.../linux/ipq40xx/files/drivers/net/phy/ar40xx.c | 2 ++
...1-dts-ipq4019-add-ethernet-essedma-node.patch | 6 +++---
5 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/01_leds b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
index ac11655904..147e159ea1 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq40xx/base-files/etc/board.d/01_leds
@@ -19,7 +19,7 @@ asus,rt-ac58u)
;;
avm,fritzbox-4040)
ucidef_set_led_wlan "wlan" "WLAN" "green:wlan" "phy0tpt" "phy1tpt"
- ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
+ ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x20"
ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x1e"
;;
avm,fritzbox-7530 |\
diff --git a/target/linux/ipq40xx/base-files/etc/board.d/02_network b/target/linux/ipq40xx/base-files/etc/board.d/02_network
index 87c79db5e1..666be0d145 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -58,9 +58,8 @@ ipq40xx_setup_interfaces()
avm,fritzbox-4040|\
linksys,ea6350v3|\
linksys,ea8300)
- ucidef_set_interfaces_lan_wan "eth0" "eth1"
ucidef_add_switch "switch0" \
- "0u@eth0" "1:lan" "2:lan" "3:lan" "4:lan"
+ "0@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
;;
linksys,mr8300)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
diff --git a/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma.h b/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma.h
index 015e5f5026..daa60639d1 100644
--- a/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma.h
+++ b/target/linux/ipq40xx/files/drivers/net/ethernet/qualcomm/essedma/edma.h
@@ -57,14 +57,14 @@
#define EDMA_LAN 1
/* VLAN tag */
-#define EDMA_LAN_DEFAULT_VLAN 1
-#define EDMA_WAN_DEFAULT_VLAN 2
-
-#define EDMA_DEFAULT_GROUP1_VLAN 1
-#define EDMA_DEFAULT_GROUP2_VLAN 2
-#define EDMA_DEFAULT_GROUP3_VLAN 3
-#define EDMA_DEFAULT_GROUP4_VLAN 4
-#define EDMA_DEFAULT_GROUP5_VLAN 5
+#define EDMA_LAN_DEFAULT_VLAN 0
+#define EDMA_WAN_DEFAULT_VLAN 0
+
+#define EDMA_DEFAULT_GROUP1_VLAN 0
+#define EDMA_DEFAULT_GROUP2_VLAN 0
+#define EDMA_DEFAULT_GROUP3_VLAN 0
+#define EDMA_DEFAULT_GROUP4_VLAN 0
+#define EDMA_DEFAULT_GROUP5_VLAN 0
/* Queues exposed to linux kernel */
#define EDMA_NETDEV_TX_QUEUE 4
diff --git a/target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c b/target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c
index 545e3985ae..28453c2363 100644
--- a/target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c
+++ b/target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c
@@ -1483,6 +1483,7 @@ ar40xx_vlan_init(struct ar40xx_priv *priv)
unsigned long bmp;
/* By default Enable VLAN */
+ /*
priv->vlan = 1;
priv->vlan_table[AR40XX_LAN_VLAN] = priv->cpu_bmp | priv->lan_bmp;
priv->vlan_table[AR40XX_WAN_VLAN] = priv->cpu_bmp | priv->wan_bmp;
@@ -1494,6 +1495,7 @@ ar40xx_vlan_init(struct ar40xx_priv *priv)
bmp = priv->wan_bmp;
for_each_set_bit(port, &bmp, AR40XX_NUM_PORTS)
priv->pvid[port] = AR40XX_WAN_VLAN;
+ */
return 0;
}
diff --git a/target/linux/ipq40xx/patches-5.4/711-dts-ipq4019-add-ethernet-essedma-node.patch b/target/linux/ipq40xx/patches-5.4/711-dts-ipq4019-add-ethernet-essedma-node.patch
index 3567eb7810..b13b312a91 100644
--- a/target/linux/ipq40xx/patches-5.4/711-dts-ipq4019-add-ethernet-essedma-node.patch
+++ b/target/linux/ipq40xx/patches-5.4/711-dts-ipq4019-add-ethernet-essedma-node.patch
@@ -36,7 +36,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
+ qcom,rx_head_buf_size = <1540>;
+ qcom,mdio_supported;
+ qcom,poll_required = <1>;
-+ qcom,num_gmac = <2>;
++ qcom,num_gmac = <1>;
+ interrupts = <0 65 IRQ_TYPE_EDGE_RISING
+ 0 66 IRQ_TYPE_EDGE_RISING
+ 0 67 IRQ_TYPE_EDGE_RISING
@@ -74,7 +74,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
+
+ gmac0: gmac0 {
+ local-mac-address = [00 00 00 00 00 00];
-+ vlan_tag = <1 0x1f>;
++ vlan_tag = <0 0x3f>;
+ };
+
+ gmac1: gmac1 {
@@ -83,7 +83,7 @@ Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
+ qcom,poll_required = <1>;
+ qcom,forced_speed = <1000>;
+ qcom,forced_duplex = <1>;
-+ vlan_tag = <2 0x20>;
++ vlan_tag = <0 0x00>;
+ };
+ };
+