Skip to contentSkip to conversation

ARM: at91: fix network interface ordering for sama5d36

PATCH In review Nicolas Ferre 4 participants 5 messages Mar 10, 2014 – Mar 12, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: at91: fix network interface ordering for sama5d36

From: Boris BREZILLON <[email protected]>

On the newly introduced sama5d36, Gigabit and 10/100 Ethernet network interfaces are probed in a different order than for the sama5d35. Moreover, users are accustomed to this order in bootloaders and backports for older kernel revisions.
So this patch switches DT node order as it is done for the other dual-Ethernet sama5d3 SoC.
Better interface numbering which does not depend on DT node order is being developed for stronger interface identification.

---
Olof, Arnd and Kevin,

I would like to include this fix in 3.14-final.
I do not have anymore patch for an at91-3.14-fixes branch so I only send this single patch to you. Can you still take it?

Thanks, best regards,

 arch/arm/boot/dts/sama5d36.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d36.dtsi +1 -1
index 6c31c26e6cc0..db58cad6acd3 100644
@@ -8,8 +8,8 @@
  */
 #include "sama5d3.dtsi"
 #include "sama5d3_can.dtsi"
-#include "sama5d3_emac.dtsi"
 #include "sama5d3_gmac.dtsi"
+#include "sama5d3_emac.dtsi"
 #include "sama5d3_lcd.dtsi"
 #include "sama5d3_mci2.dtsi"
 #include "sama5d3_tcb1.dtsi"
Signature · 1 line
1.8.2.2
#1 lore raw
Quoted 11 lines · Nicolas Ferre

From: Boris BREZILLON <[email protected]>

On the newly introduced sama5d36, Gigabit and 10/100 Ethernet network interfaces are probed in a different order than for the sama5d35. Moreover, users are accustomed to this order in bootloaders and backports for older kernel revisions.
So this patch switches DT node order as it is done for the other dual-Ethernet sama5d3 SoC.
Better interface numbering which does not depend on DT node order is being developed for stronger interface identification.

Quoted 8 lines

---
Olof, Arnd and Kevin,

I would like to include this fix in 3.14-final.
I do not have anymore patch for an at91-3.14-fixes branch so I only send this single patch to you. Can you still take it?

Sure, applied now.

-Olof

#2 lore raw
In reply to Nicolas Ferre
Quoted 10 lines · Nicolas Ferre

From: Boris BREZILLON <[email protected]>

On the newly introduced sama5d36, Gigabit and 10/100 Ethernet network interfaces are probed in a different order than for the sama5d35. Moreover, users are accustomed to this order in bootloaders and backports for older kernel revisions.
So this patch switches DT node order as it is done for the other dual-Ethernet sama5d3 SoC.
Better interface numbering which does not depend on DT node order is being developed for stronger interface identification.

twick ethernet enumerating by playing on the DT order is week

It?s better to introduce a new property

linux,ethernet-id or something like or simply rely on other information on the userspace to identify the proper interface

Nicolas for AT91 keep me in Cc

Best Regards,
J.

Quoted 37 lines

---
Olof, Arnd and Kevin,

I would like to include this fix in 3.14-final.
I do not have anymore patch for an at91-3.14-fixes branch so I only send this single patch to you. Can you still take it?

Thanks, best regards,

arch/arm/boot/dts/sama5d36.dtsi | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d36.dtsi +1 -1
index 6c31c26e6cc0..db58cad6acd3 100644
@@ -8,8 +8,8 @@
 */
 #include "sama5d3.dtsi"
 #include "sama5d3_can.dtsi"
-#include "sama5d3_emac.dtsi"
 #include "sama5d3_gmac.dtsi"
+#include "sama5d3_emac.dtsi"
 #include "sama5d3_lcd.dtsi"
 #include "sama5d3_mci2.dtsi"
 #include "sama5d3_tcb1.dtsi"
Signature · 7 lines
1.8.2.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw

On 11/03/2014 21:56, Jean-Christophe PLAGNIOL-VILLARD :

Quoted 14 lines · Nicolas Ferre
Quoted 11 lines

From: Boris BREZILLON <[email protected]>

On the newly introduced sama5d36, Gigabit and 10/100 Ethernet network interfaces are probed in a different order than for the sama5d35. Moreover, users are accustomed to this order in bootloaders and backports for older kernel revisions.
So this patch switches DT node order as it is done for the other dual-Ethernet sama5d3 SoC.
Better interface numbering which does not depend on DT node order is being developed for stronger interface identification.

Quoted 1 line

twick ethernet enumerating by playing on the DT order is week

Absolutely, that is what I said in the commit message.

Quoted 4 lines

It?s better to introduce a new property

linux,ethernet-id or something like or simply rely on other information on the userspace to identify the proper interface

We will rely on the alias number ; It's its purpose, after all. I think that Boris already have a preliminary patch for the macb driver.

Bye,

Quoted 43 lines

Nicolas for AT91 keep me in Cc

Best Regards,
J.

Quoted 37 lines

---
Olof, Arnd and Kevin,

I would like to include this fix in 3.14-final.
I do not have anymore patch for an at91-3.14-fixes branch so I only send this single patch to you. Can you still take it?

Thanks, best regards,

arch/arm/boot/dts/sama5d36.dtsi | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sama5d36.dtsi +1 -1
index 6c31c26e6cc0..db58cad6acd3 100644
@@ -8,8 +8,8 @@
 */
 #include "sama5d3.dtsi"
 #include "sama5d3_can.dtsi"
-#include "sama5d3_emac.dtsi"
 #include "sama5d3_gmac.dtsi"
+#include "sama5d3_emac.dtsi"
 #include "sama5d3_lcd.dtsi"
 #include "sama5d3_mci2.dtsi"
 #include "sama5d3_tcb1.dtsi"
Signature · 7 lines
1.8.2.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 1 line
Nicolas Ferre
#4 lore raw

PATCH 1/1 net: macb: set interface name based on DT aliases

Use aliases to set the interface name (ethX) instead of automatic assignement.

---

Hello Nicolas, Jean-Christophe,

This is an example on how we could set the ethernet interface id based on DT aliases.
As you can see this patch is not properly separated.

I'm still not happy with this approach for several reasons:
1) If another ethernet iface has already been registered with the same id the net dev registration will fail.
2) We bypass the ethernet macros/functions and directly use the net device functions which IMHO is not future proof.

Best Regards,

Boris

 arch/arm/boot/dts/sama5d36.dtsi     |    2 +-
 arch/arm/boot/dts/sama5d3_emac.dtsi |    4 ++++
 arch/arm/boot/dts/sama5d3_gmac.dtsi |    4 ++++
 drivers/net/ethernet/cadence/macb.c |   15 +++++++++++++--
 4 files changed, 22 insertions(+), 3 deletions(-)
arch/arm/boot/dts/sama5d36.dtsi +1 -1
index 6c31c26..db58cad 100644
@@ -8,8 +8,8 @@
  */
 #include "sama5d3.dtsi"
 #include "sama5d3_can.dtsi"
-#include "sama5d3_emac.dtsi"
 #include "sama5d3_gmac.dtsi"
+#include "sama5d3_emac.dtsi"
 #include "sama5d3_lcd.dtsi"
 #include "sama5d3_mci2.dtsi"
 #include "sama5d3_tcb1.dtsi"
arch/arm/boot/dts/sama5d3_emac.dtsi +4 -0
index fe2af92..f2c5da0 100644
@@ -11,6 +11,10 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 
 / {
+	aliases {
+		eth1 = &macb1;
+	};
+
 	ahb {
 		apb {
 			pinctrl at fffff200 {
arch/arm/boot/dts/sama5d3_gmac.dtsi +4 -0
index a6cb050..05164de 100644
@@ -11,6 +11,10 @@
 #include <dt-bindings/interrupt-controller/irq.h>
 
 / {
+	aliases {
+		eth0 = &macb0;
+	};
+
 	ahb {
 		apb {
 			pinctrl at fffff200 {
drivers/net/ethernet/cadence/macb.c +13 -2
index 3190d38..b6f1f7c 100644
@@ -1795,7 +1795,7 @@ static int __init macb_probe(struct platform_device *pdev)
 {
 	struct macb_platform_data *pdata;
 	struct resource *regs;
-	struct net_device *dev;
+	struct net_device *dev = NULL;
 	struct macb *bp;
 	struct phy_device *phydev;
 	u32 config;
@@ -1819,7 +1819,18 @@ static int __init macb_probe(struct platform_device *pdev)
 	}
 
 	err = -ENOMEM;
-	dev = alloc_etherdev(sizeof(*bp));
+	if (pdev->dev.of_node) {
+		int id = of_alias_get_id(pdev->dev.of_node, "eth");
+		if (id >= 0) {
+			char name[IFNAMSIZ];
+			snprintf(name, sizeof(name), "eth%d", id);
+			dev = alloc_netdev(sizeof(*bp), name, ether_setup);
+		}
+	}
+
+	if (!dev)
+		dev = alloc_etherdev(sizeof(*bp));
+
 	if (!dev)
 		goto err_out;
 
Signature · 1 line
1.7.9.5