[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
was not actually from Christian Lamparter. His original patch
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

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
 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"
-	ucidef_set_interfaces_lan_wan "eth0" "eth1"
+	ucidef_set_interfaces_lan_wan "eth1" "eth0"
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>;
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list