[OpenWrt-Devel] [PATCH ipq 2/2] ipq40xx: Fix A42 eth port aliases/mac addresses

Sven Eckelmann sven.eckelmann at openmesh.com
Tue Mar 13 10:50:17 EDT 2018


The OpenMesh A42 uses labels next to the ethernet ports to identify the
first and second ethernet port. The first ethernet port's MAC address is
also printed prominently on the label in the center of the housing.

The board can also be powered up only using POE. It is therefore likely
that the ethernet cable to the internet is attached to the first ethernet
port which is also the active POE port. For a firmware without automatic
internet detection (like OpenWrt), it is therefore logical to use this port
as the default WAN port.

The configuration for each port are:

first ethernet port:

* phy_mdio_addr: 4
* QCA8072 port bit: BIT(5)
* u-boot mac address entry: ethaddr
* active POE

second ethernet port:

* phy_mdio_addr: 3
* QCA8072 port bit: BIT(4)
* u-boot mac address entry: eth1addr

As Mark Rutland pointed out [1], user-accessible ports with well defined
labels should be mapped accordingly with the aliases. This is mostly done
already by qcom-ipq4019.dtsi which maps ethernet0 to &gmac0 and &gmac1.
Only the gmac0 and gmac1 entries have to be adjusted accordingly to use the
correct configurations for the ports.

Not configuring the gmac entries as shown above, doesn't only affect the
names of the virtual interface names but also swaps the mac addresses of
the ports. The first ethernet port will then no longer use the mac address
which is printed on the device.

[1] https://patchwork.kernel.org/patch/9133903/

Signed-off-by: Sven Eckelmann <sven.eckelmann at openmesh.com>
---
I was informed that the patch
<https://git.openwrt.org/?p=openwrt/staging/mkresin.git;a=commit;h=9a6d5bd049568e175d45415f51b3cf569ebd7479>
was not actually from Christian Lamparter. His original patch
<https://github.com/chunkeey/LEDE-IPQ40XX/commit/847c09d2b53684180297bdb056bda08f1c3333f8>
didn't contain the gmac0 <-> gmac1 swap. So I have to apologize to him for
wasting his time while trying to discuss changes which he actually didn't
do.

Btw. I don't have a good picture at the moment but you can check some photo
from heise to see some of the labels
<https://www.heise.de/ct/zcontent/18/03-hocmsmeta/1517536820829720/contentimages/image-1516109563177267.jpg>
---
 target/linux/ipq40xx/base-files/etc/board.d/02_network            | 2 +-
 .../ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts     | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

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 8e9a1889d1..d25a039f2d 100755
--- a/target/linux/ipq40xx/base-files/etc/board.d/02_network
+++ b/target/linux/ipq40xx/base-files/etc/board.d/02_network
@@ -33,7 +33,7 @@ glinet,gl-b1300)
 		"0u at eth0" "3:lan" "4:lan"
 	;;
 openmesh,a42)
-	ucidef_set_interfaces_lan_wan "eth0" "eth1"
+	ucidef_set_interfaces_lan_wan "eth1" "eth0"
 	;;
 
 meraki,mr33)
diff --git a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts
index 3d56a6ef52..fcc22276ba 100644
--- a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts
+++ b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4018-a42.dts
@@ -210,6 +210,14 @@
 };
 
 &gmac0 {
+	qcom,phy_mdio_addr = <4>;
+	qcom,poll_required = <1>;
+	qcom,forced_speed = <1000>;
+	qcom,forced_duplex = <1>;
+	vlan_tag = <2 0x20>;
+};
+
+&gmac1 {
 	qcom,phy_mdio_addr = <3>;
 	qcom,poll_required = <1>;
 	qcom,forced_speed = <1000>;
-- 
2.11.0
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list