imx6: fix device-tree mac address assignment for ventana sky2/eth1

Some Ventana boards have a Marvell sky2 GigE controller as eth1 however
assigning the mac address through device-tree is difficult because the
PCI slot can move around depending on board configuration and slot population.

To work around this we add a patch to the sky2 driver to allow accessing its
mac address via a device-tree alias.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Signed-off-by: Pushpal Sidhu <psidhu@gateworks.com>

SVN-Revision: 48013
This commit is contained in:
Luka Perkov 2015-12-28 04:56:27 +00:00
parent 2578f0183c
commit 3d11f8ae36
2 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,30 @@
Index: linux-4.3/drivers/net/ethernet/marvell/sky2.c
===================================================================
--- linux-4.3.orig/drivers/net/ethernet/marvell/sky2.c 2015-11-01 16:05:25.000000000 -0800
+++ linux-4.3/drivers/net/ethernet/marvell/sky2.c 2015-12-18 10:39:44.983158318 -0800
@@ -4812,7 +4812,24 @@
* 1) from device tree data
* 2) from internal registers set by bootloader
*/
- iap = of_get_mac_address(hw->pdev->dev.of_node);
+
+ iap = NULL;
+ if (IS_ENABLED(CONFIG_OF)) {
+ struct device_node *np;
+ np = of_find_node_by_path("/aliases");
+ if (np) {
+ const char *path = of_get_property(np, "sky2", NULL);
+ if (path)
+ np = of_find_node_by_path(path);
+ if (np)
+ path = of_get_mac_address(np);
+ if (path)
+ iap = (unsigned char *) path;
+ }
+ }
+
+ if (!iap)
+ iap = of_get_mac_address(hw->pdev->dev.of_node);
if (iap)
memcpy(dev->dev_addr, iap, ETH_ALEN);
else

View File

@ -0,0 +1,24 @@
Index: linux-4.3/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi
===================================================================
--- linux-4.3.orig/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi 2015-12-18 10:39:44.959158318 -0800
+++ linux-4.3/arch/arm/boot/dts/imx6qdl-gw53xx.dtsi 2015-12-18 10:43:21.000000000 -0800
@@ -15,6 +15,7 @@
/* these are used by bootloader for disabling nodes */
aliases {
ethernet1 = &eth1;
+ sky2 = &eth1;
led0 = &led0;
led1 = &led1;
led2 = &led2;
Index: linux-4.3/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi
===================================================================
--- linux-4.3.orig/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi 2015-12-18 10:39:44.959158318 -0800
+++ linux-4.3/arch/arm/boot/dts/imx6qdl-gw54xx.dtsi 2015-12-18 10:43:21.000000000 -0800
@@ -15,6 +15,7 @@
/* these are used by bootloader for disabling nodes */
aliases {
ethernet1 = &eth1;
+ sky2 = &eth1;
led0 = &led0;
led1 = &led1;
led2 = &led2;