6c5f577
From patchwork Wed Jan 27 15:08:19 2016
6c5f577
Content-Type: text/plain; charset="utf-8"
6c5f577
MIME-Version: 1.0
6c5f577
Content-Transfer-Encoding: 7bit
6c5f577
Subject: [1/2] ARM: mvebu: change order of ethernet DT nodes on Armada 38x
6c5f577
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
6c5f577
X-Patchwork-Id: 8134751
6c5f577
Message-Id: <1453907300-28283-2-git-send-email-thomas.petazzoni@free-electrons.com>
6c5f577
To: Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
6c5f577
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
6c5f577
	Gregory Clement <gregory.clement@free-electrons.com>
6c5f577
Cc: Nadav Haklai <nadavh@marvell.com>, Lior Amsalem <alior@marvell.com>,
6c5f577
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
6c5f577
	linux-arm-kernel@lists.infradead.org
6c5f577
Date: Wed, 27 Jan 2016 16:08:19 +0100
6c5f577
6c5f577
On Armada 38x, the available network interfaces are:
6c5f577
6c5f577
 - port 0, at 0x70000
6c5f577
 - port 1, at 0x30000
6c5f577
 - port 2, at 0x34000
6c5f577
6c5f577
Due to the rule saying that DT nodes should be ordered by register
6c5f577
addresses, the network interfaces are probed in this order:
6c5f577
6c5f577
 - port 1, at 0x30000, which gets named eth0
6c5f577
 - port 2, at 0x34000, which gets named eth1
6c5f577
 - port 0, at 0x70000, which gets named eth2
6c5f577
6c5f577
(if all three ports are enabled at the board level)
6c5f577
6c5f577
Unfortunately, the network subsystem doesn't provide any way to rename
6c5f577
network interfaces from the kernel (it can only be done from
6c5f577
userspace). So, the default naming of the network interfaces is very
6c5f577
confusing as it doesn't match the datasheet, nor the naming of the
6c5f577
interfaces in the bootloader, nor the naming of the interfaces on
6c5f577
labels printed on the board.
6c5f577
6c5f577
For example, on the Armada 388 GP, the board has two ports, labelled
6c5f577
GE0 and GE1. One has to know that GE0 is eth1 and GE1 is eth0, which
6c5f577
isn't really obvious.
6c5f577
6c5f577
In order to solve this, this patch proposes to exceptionaly violate
6c5f577
the rule of "order DT nodes by register address", and put the 0x70000
6c5f577
node before the 0x30000 node, so that network interfaces get named in
6c5f577
a more natural way.
6c5f577
6c5f577
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
6c5f577
6c5f577
---
6c5f577
arch/arm/boot/dts/armada-38x.dtsi | 30 +++++++++++++++++++++---------
6c5f577
 1 file changed, 21 insertions(+), 9 deletions(-)
6c5f577
6c5f577
diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
6c5f577
index e8b7f67..b50784d 100644
6c5f577
--- a/arch/arm/boot/dts/armada-38x.dtsi
6c5f577
+++ b/arch/arm/boot/dts/armada-38x.dtsi
6c5f577
@@ -429,6 +429,27 @@
6c5f577
 				reg = <0x22000 0x1000>;
6c5f577
 			};
6c5f577
 
6c5f577
+			/*
6c5f577
+			 * As a special exception to the "order by
6c5f577
+			 * register address" rule, the eth0 node is
6c5f577
+			 * placed here to ensure that it gets
6c5f577
+			 * registered as the first interface, since
6c5f577
+			 * the network subsystem doesn't allow naming
6c5f577
+			 * interfaces using DT aliases. Without this,
6c5f577
+			 * the ordering of interfaces is different
6c5f577
+			 * from the one used in U-Boot and the
6c5f577
+			 * labeling of interfaces on the boards, which
6c5f577
+			 * is very confusing for users.
6c5f577
+			 */
6c5f577
+			eth0: ethernet@70000 {
6c5f577
+				compatible = "marvell,armada-370-neta";
6c5f577
+				reg = <0x70000 0x4000>;
6c5f577
+				interrupts-extended = <&mpic 8>;
6c5f577
+				clocks = <&gateclk 4>;
6c5f577
+				tx-csum-limit = <9800>;
6c5f577
+				status = "disabled";
6c5f577
+			};
6c5f577
+
6c5f577
 			eth1: ethernet@30000 {
6c5f577
 				compatible = "marvell,armada-370-neta";
6c5f577
 				reg = <0x30000 0x4000>;
6c5f577
@@ -493,15 +514,6 @@
6c5f577
 				};
6c5f577
 			};
6c5f577
 
6c5f577
-			eth0: ethernet@70000 {
6c5f577
-				compatible = "marvell,armada-370-neta";
6c5f577
-				reg = <0x70000 0x4000>;
6c5f577
-				interrupts-extended = <&mpic 8>;
6c5f577
-				clocks = <&gateclk 4>;
6c5f577
-				tx-csum-limit = <9800>;
6c5f577
-				status = "disabled";
6c5f577
-			};
6c5f577
-
6c5f577
 			mdio: mdio@72004 {
6c5f577
 				#address-cells = <1>;
6c5f577
 				#size-cells = <0>;