All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Set the Raspberry Pi Ethernet MAC address
@ 2016-02-03 15:02 Lubomir Rintel
  2016-02-03 15:02 ` [PATCH 1/2] net/smscx5xx: use the device tree for mac address Lubomir Rintel
  2016-02-03 15:02   ` Lubomir Rintel
  0 siblings, 2 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-03 15:02 UTC (permalink / raw)
  To: linux-rpi-kernel
  Cc: devicetree, linux-kernel, Eric Anholt, Lee Jones, Stephen Warren,
	Peter Chen, Arnd Bergmann

Hello,

Looks like Peter Chen has submitted a patch that associates the USB device with 
the device-tree node. This is nice; we could use it to propagate the MAC address
from firmware with minimal changes now, something that Arnd Bergmann suggested
back in 2011 [2].

[1] USB: core: let USB device know device node
    https://patchwork.ozlabs.org/patch/572621/

[2] Re: RFC: Platform data for onboard USB assets
    https://lkml.org/lkml/2011/3/17/416

Tested to work fine on the B+ board with Peter's patch and a trivial change to
u-boot so that the board code sets $ethaddr in addition to $usbethaddr for the
dt fixup code.

Lubo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/2] net/smscx5xx: use the device tree for mac address
  2016-02-03 15:02 [PATCH 0/2] Set the Raspberry Pi Ethernet MAC address Lubomir Rintel
@ 2016-02-03 15:02 ` Lubomir Rintel
  2016-02-03 15:23   ` Arnd Bergmann
  2016-02-03 15:02   ` Lubomir Rintel
  1 sibling, 1 reply; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-03 15:02 UTC (permalink / raw)
  To: linux-rpi-kernel
  Cc: devicetree, linux-kernel, Eric Anholt, Lee Jones, Stephen Warren,
	Peter Chen, Arnd Bergmann

From: Arnd Bergmann <arnd@arndb.de>

This takes the MAC address for smsc75xx/smsc95xx USB network devices
from a the device tree. This is required to get a usable persistent
address on the popular beagleboard, whose hardware designers
accidentally forgot that an ethernet device really requires an a
MAC address to be functional.

The smsc75xx and smsc95xx drivers are just two copies of the
same code, so better fix both.

Tested-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/usb/smsc75xx.c | 10 ++++++++++
 drivers/net/usb/smsc95xx.c | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index 30033db..b2e33e6 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -29,6 +29,7 @@
 #include <linux/crc32.h>
 #include <linux/usb/usbnet.h>
 #include <linux/slab.h>
+#include <linux/of_device.h>
 #include "smsc75xx.h"
 
 #define SMSC_CHIPNAME			"smsc75xx"
@@ -761,6 +762,8 @@ static int smsc75xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
 
 static void smsc75xx_init_mac_address(struct usbnet *dev)
 {
+	const void *address;
+
 	/* try reading mac address from EEPROM */
 	if (smsc75xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
 			dev->net->dev_addr) == 0) {
@@ -772,6 +775,13 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
 		}
 	}
 
+	address = of_get_property(dev->udev->dev.of_node,
+				  "local-mac-address", NULL);
+	if (address) {
+		memcpy(dev->net->dev_addr, address, ETH_ALEN);
+		return;
+	}
+
 	/* no eeprom, or eeprom values are invalid. generate random MAC */
 	eth_hw_addr_random(dev->net);
 	netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 66b3ab9..021b9ce 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -29,6 +29,7 @@
 #include <linux/crc32.h>
 #include <linux/usb/usbnet.h>
 #include <linux/slab.h>
+#include <linux/of_device.h>
 #include "smsc95xx.h"
 
 #define SMSC_CHIPNAME			"smsc95xx"
@@ -765,6 +766,8 @@ static int smsc95xx_ioctl(struct net_device *netdev, struct ifreq *rq, int cmd)
 
 static void smsc95xx_init_mac_address(struct usbnet *dev)
 {
+	const void *address;
+
 	/* try reading mac address from EEPROM */
 	if (smsc95xx_read_eeprom(dev, EEPROM_MAC_OFFSET, ETH_ALEN,
 			dev->net->dev_addr) == 0) {
@@ -775,6 +778,13 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
 		}
 	}
 
+	address = of_get_property(dev->udev->dev.of_node,
+				  "local-mac-address", NULL);
+	if (address) {
+		memcpy(dev->net->dev_addr, address, ETH_ALEN);
+		return;
+	}
+
 	/* no eeprom, or eeprom values are invalid. generate random MAC */
 	eth_hw_addr_random(dev->net);
 	netif_dbg(dev, ifup, dev->net, "MAC address set to eth_random_addr\n");
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-03 15:02   ` Lubomir Rintel
  0 siblings, 0 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-03 15:02 UTC (permalink / raw)
  To: linux-rpi-kernel
  Cc: devicetree, linux-kernel, Eric Anholt, Lee Jones, Stephen Warren,
	Peter Chen, Arnd Bergmann, Lubomir Rintel

The hub and the ethernet in its port 1 are hardwired on the board.

Compared to the adapters that can be plugged into the USB ports, this
one has no serial EEPROM to store its MAC. Nevertheless, the Raspberry Pi
has the MAC address for this adapter in its ROM, accessible from its
firmware.

U-Boot can read out the address and set the local-mac-address property of the
node with "ethernet" alias. Let's add the node so that U-Boot can do its
business.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 18 ++++++++++++++++++
 arch/arm/boot/dts/bcm283x.dtsi           |  4 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index ef54050..32bbd2a 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -6,6 +6,10 @@
 	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
 	model = "Raspberry Pi Model B+";
 
+	aliases {
+		ethernet = &ethernet;
+	}
+
 	leds {
 		act {
 			gpios = <&gpio 47 0>;
@@ -29,3 +33,17 @@
 		brcm,function = <BCM2835_FSEL_ALT0>;
 	};
 };
+
+&usb {
+	usb1@01 {
+		compatible = "usb1d6b,0002";
+		reg = <01>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ethernet: usbether@01 {
+			compatible = "usb0424,9514";
+			reg = <01>;
+		};
+	};
+};
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 971e741..bc5fde1 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -187,10 +187,12 @@
 			status = "disabled";
 		};
 
-		usb@7e980000 {
+		usb: usb@7e980000 {
 			compatible = "brcm,bcm2835-usb";
 			reg = <0x7e980000 0x10000>;
 			interrupts = <1 9>;
+			#address-cells = <1>;
+			#size-cells = <0>;
 		};
 	};
 
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-03 15:02   ` Lubomir Rintel
  0 siblings, 0 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-03 15:02 UTC (permalink / raw)
  To: linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Eric Anholt, Lee Jones,
	Stephen Warren, Peter Chen, Arnd Bergmann, Lubomir Rintel

The hub and the ethernet in its port 1 are hardwired on the board.

Compared to the adapters that can be plugged into the USB ports, this
one has no serial EEPROM to store its MAC. Nevertheless, the Raspberry Pi
has the MAC address for this adapter in its ROM, accessible from its
firmware.

U-Boot can read out the address and set the local-mac-address property of the
node with "ethernet" alias. Let's add the node so that U-Boot can do its
business.

Signed-off-by: Lubomir Rintel <lkundrak-NGH9Lh4a5iE@public.gmane.org>
---
 arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 18 ++++++++++++++++++
 arch/arm/boot/dts/bcm283x.dtsi           |  4 +++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
index ef54050..32bbd2a 100644
--- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
@@ -6,6 +6,10 @@
 	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
 	model = "Raspberry Pi Model B+";
 
+	aliases {
+		ethernet = &ethernet;
+	}
+
 	leds {
 		act {
 			gpios = <&gpio 47 0>;
@@ -29,3 +33,17 @@
 		brcm,function = <BCM2835_FSEL_ALT0>;
 	};
 };
+
+&usb {
+	usb1@01 {
+		compatible = "usb1d6b,0002";
+		reg = <01>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ethernet: usbether@01 {
+			compatible = "usb0424,9514";
+			reg = <01>;
+		};
+	};
+};
diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi
index 971e741..bc5fde1 100644
--- a/arch/arm/boot/dts/bcm283x.dtsi
+++ b/arch/arm/boot/dts/bcm283x.dtsi
@@ -187,10 +187,12 @@
 			status = "disabled";
 		};
 
-		usb@7e980000 {
+		usb: usb@7e980000 {
 			compatible = "brcm,bcm2835-usb";
 			reg = <0x7e980000 0x10000>;
 			interrupts = <1 9>;
+			#address-cells = <1>;
+			#size-cells = <0>;
 		};
 	};
 
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-03 15:11     ` Lubomir Rintel
  0 siblings, 0 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-03 15:11 UTC (permalink / raw)
  To: linux-rpi-kernel
  Cc: devicetree, linux-kernel, Eric Anholt, Lee Jones, Stephen Warren,
	Peter Chen, Arnd Bergmann

On Wed, 2016-02-03 at 16:02 +0100, Lubomir Rintel wrote:
> The hub and the ethernet in its port 1 are hardwired on the board.
> 
> Compared to the adapters that can be plugged into the USB ports, this
> one has no serial EEPROM to store its MAC. Nevertheless, the
> Raspberry Pi
> has the MAC address for this adapter in its ROM, accessible from its
> firmware.
> 
> U-Boot can read out the address and set the local-mac-address
> property of the
> node with "ethernet" alias. Let's add the node so that U-Boot can do
> its
> business.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---
>  arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 18 ++++++++++++++++++
>  arch/arm/boot/dts/bcm283x.dtsi           |  4 +++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> index ef54050..32bbd2a 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> @@ -6,6 +6,10 @@
>  	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
>  	model = "Raspberry Pi Model B+";
>  
> +	aliases {
> +		ethernet = &ethernet;
> +	}

I'm missing a semicolon here. I'll follow up with an updated version
once I get some feedback.

> +
>  	leds {
>  		act {
>  			gpios = <&gpio 47 0>;
> @@ -29,3 +33,17 @@
>  		brcm,function = <BCM2835_FSEL_ALT0>;
>  	};
>  };
> +
> +&usb {
> +	usb1@01 {
> +		compatible = "usb1d6b,0002";
> +		reg = <01>;
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		ethernet: usbether@01 {
> +			compatible = "usb0424,9514";
> +			reg = <01>;
> +		};
> +	};
> +};
> diff --git a/arch/arm/boot/dts/bcm283x.dtsi
> b/arch/arm/boot/dts/bcm283x.dtsi
> index 971e741..bc5fde1 100644
> --- a/arch/arm/boot/dts/bcm283x.dtsi
> +++ b/arch/arm/boot/dts/bcm283x.dtsi
> @@ -187,10 +187,12 @@
>  			status = "disabled";
>  		};
>  
> -		usb@7e980000 {
> +		usb: usb@7e980000 {
>  			compatible = "brcm,bcm2835-usb";
>  			reg = <0x7e980000 0x10000>;
>  			interrupts = <1 9>;
> +			#address-cells = <1>;
> +			#size-cells = <0>;
>  		};
>  	};
>  

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-03 15:11     ` Lubomir Rintel
  0 siblings, 0 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-03 15:11 UTC (permalink / raw)
  To: linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Eric Anholt, Lee Jones,
	Stephen Warren, Peter Chen, Arnd Bergmann

On Wed, 2016-02-03 at 16:02 +0100, Lubomir Rintel wrote:
> The hub and the ethernet in its port 1 are hardwired on the board.
> 
> Compared to the adapters that can be plugged into the USB ports, this
> one has no serial EEPROM to store its MAC. Nevertheless, the
> Raspberry Pi
> has the MAC address for this adapter in its ROM, accessible from its
> firmware.
> 
> U-Boot can read out the address and set the local-mac-address
> property of the
> node with "ethernet" alias. Let's add the node so that U-Boot can do
> its
> business.
> 
> Signed-off-by: Lubomir Rintel <lkundrak-NGH9Lh4a5iE@public.gmane.org>
> ---
>  arch/arm/boot/dts/bcm2835-rpi-b-plus.dts | 18 ++++++++++++++++++
>  arch/arm/boot/dts/bcm283x.dtsi           |  4 +++-
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> index ef54050..32bbd2a 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> @@ -6,6 +6,10 @@
>  	compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
>  	model = "Raspberry Pi Model B+";
>  
> +	aliases {
> +		ethernet = &ethernet;
> +	}

I'm missing a semicolon here. I'll follow up with an updated version
once I get some feedback.

> +
>  	leds {
>  		act {
>  			gpios = <&gpio 47 0>;
> @@ -29,3 +33,17 @@
>  		brcm,function = <BCM2835_FSEL_ALT0>;
>  	};
>  };
> +
> +&usb {
> +	usb1@01 {
> +		compatible = "usb1d6b,0002";
> +		reg = <01>;
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		ethernet: usbether@01 {
> +			compatible = "usb0424,9514";
> +			reg = <01>;
> +		};
> +	};
> +};
> diff --git a/arch/arm/boot/dts/bcm283x.dtsi
> b/arch/arm/boot/dts/bcm283x.dtsi
> index 971e741..bc5fde1 100644
> --- a/arch/arm/boot/dts/bcm283x.dtsi
> +++ b/arch/arm/boot/dts/bcm283x.dtsi
> @@ -187,10 +187,12 @@
>  			status = "disabled";
>  		};
>  
> -		usb@7e980000 {
> +		usb: usb@7e980000 {
>  			compatible = "brcm,bcm2835-usb";
>  			reg = <0x7e980000 0x10000>;
>  			interrupts = <1 9>;
> +			#address-cells = <1>;
> +			#size-cells = <0>;
>  		};
>  	};
>  
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/2] net/smscx5xx: use the device tree for mac address
  2016-02-03 15:02 ` [PATCH 1/2] net/smscx5xx: use the device tree for mac address Lubomir Rintel
@ 2016-02-03 15:23   ` Arnd Bergmann
  2016-02-03 15:42     ` Lubomir Rintel
  0 siblings, 1 reply; 18+ messages in thread
From: Arnd Bergmann @ 2016-02-03 15:23 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: linux-rpi-kernel, devicetree, linux-kernel, Eric Anholt,
	Lee Jones, Stephen Warren, Peter Chen

On Wednesday 03 February 2016 16:02:38 Lubomir Rintel wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> This takes the MAC address for smsc75xx/smsc95xx USB network devices
> from a the device tree. This is required to get a usable persistent
> address on the popular beagleboard, whose hardware designers
> accidentally forgot that an ethernet device really requires an a
> MAC address to be functional.
> 
> The smsc75xx and smsc95xx drivers are just two copies of the
> same code, so better fix both.
> 
> Tested-by: Lubomir Rintel <lkundrak@v3.sk>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 

I have no memory of writing this patch, where did you find it?

The changelog sounds like I wrote it, so I assume it was me after all.

> +       address = of_get_property(dev->udev->dev.of_node,
> +                                 "local-mac-address", NULL);
> +       if (address) {
> +               memcpy(dev->net->dev_addr, address, ETH_ALEN);
> +               return;
> +       }

This should use of_get_mac_address(), not an open-coded property
lookup. The function was probably added after I wrote the
the original patch.

	Arnd

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/2] net/smscx5xx: use the device tree for mac address
  2016-02-03 15:23   ` Arnd Bergmann
@ 2016-02-03 15:42     ` Lubomir Rintel
  0 siblings, 0 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-03 15:42 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-rpi-kernel, devicetree, linux-kernel, Eric Anholt,
	Lee Jones, Stephen Warren, Peter Chen

On Wed, 2016-02-03 at 16:23 +0100, Arnd Bergmann wrote:
> On Wednesday 03 February 2016 16:02:38 Lubomir Rintel wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> > 
> > This takes the MAC address for smsc75xx/smsc95xx USB network
> > devices
> > from a the device tree. This is required to get a usable persistent
> > address on the popular beagleboard, whose hardware designers
> > accidentally forgot that an ethernet device really requires an a
> > MAC address to be functional.
> > 
> > The smsc75xx and smsc95xx drivers are just two copies of the
> > same code, so better fix both.
> > 
> > Tested-by: Lubomir Rintel <lkundrak@v3.sk>
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> 
> I have no memory of writing this patch, where did you find it?

2011's discussion: https://lkml.org/lkml/2011/3/17/416
(Link also in the cover letter).

> The changelog sounds like I wrote it, so I assume it was me after
> all.
> 
> > +       address = of_get_property(dev->udev->dev.of_node,
> > +                                 "local-mac-address", NULL);
> > +       if (address) {
> > +               memcpy(dev->net->dev_addr, address, ETH_ALEN);
> > +               return;
> > +       }
> 
> This should use of_get_mac_address(), not an open-coded property
> lookup. The function was probably added after I wrote the
> the original patch.

Okay. Will fix that up once I get feedback for the devicetree part.

> 	Arnd

Thanks,
Lubo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
  2016-02-03 15:02   ` Lubomir Rintel
  (?)
  (?)
@ 2016-02-03 16:11   ` Stephen Warren
  2016-02-03 16:32     ` Lubomir Rintel
  -1 siblings, 1 reply; 18+ messages in thread
From: Stephen Warren @ 2016-02-03 16:11 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: linux-rpi-kernel, devicetree, linux-kernel, Eric Anholt,
	Lee Jones, Peter Chen, Arnd Bergmann

On 02/03/2016 08:02 AM, Lubomir Rintel wrote:
> The hub and the ethernet in its port 1 are hardwired on the board.
>
> Compared to the adapters that can be plugged into the USB ports, this
> one has no serial EEPROM to store its MAC. Nevertheless, the Raspberry Pi
> has the MAC address for this adapter in its ROM, accessible from its
> firmware.
>
> U-Boot can read out the address and set the local-mac-address property of the
> node with "ethernet" alias. Let's add the node so that U-Boot can do its
> business.

Good to see we're getting a standard for this.

Have you talked to the RPi Foundation about updating their binary 
bootloader to follow this protocol? I'll certainly ack changes to make 
this work for U-Boot, provided the USB core patch this relies upon is 
accepted.

> diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts

> +&usb {
> +	usb1@01 {
> +		compatible = "usb1d6b,0002";
> +		reg = <01>;
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		ethernet: usbether@01 {
> +			compatible = "usb0424,9514";
> +			reg = <01>;

Ib both unit addresses and both reg properties, I would expect "1" not 
"01" since there's usually no leading 0 fill for those.

I'm curious why the VID values for the hub and Ethernet device don't 
match since those are part of the same combo chip. Is there a typo 
there, or did SMSC really do something odd in HW?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
  2016-02-03 16:11   ` Stephen Warren
@ 2016-02-03 16:32     ` Lubomir Rintel
  0 siblings, 0 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-03 16:32 UTC (permalink / raw)
  To: Stephen Warren
  Cc: linux-rpi-kernel, devicetree, linux-kernel, Eric Anholt,
	Lee Jones, Peter Chen, Arnd Bergmann, popcornmix

On Wed, 2016-02-03 at 09:11 -0700, Stephen Warren wrote:
> On 02/03/2016 08:02 AM, Lubomir Rintel wrote:
> > The hub and the ethernet in its port 1 are hardwired on the board.
> > 
> > Compared to the adapters that can be plugged into the USB ports,
> > this
> > one has no serial EEPROM to store its MAC. Nevertheless, the
> > Raspberry Pi
> > has the MAC address for this adapter in its ROM, accessible from
> > its
> > firmware.
> > 
> > U-Boot can read out the address and set the local-mac-address
> > property of the
> > node with "ethernet" alias. Let's add the node so that U-Boot can
> > do its
> > business.
> 
> Good to see we're getting a standard for this.
> 
> Have you talked to the RPi Foundation about updating their binary 
> bootloader to follow this protocol?

Not really. Adding Dom Cobley to the Cc list now.

They seem to be passing the MAC address on command line now and even
evaluating it before attempting a read out from the EEPROM. That sounds
like it would break if someone plugged another smsc95xx adapter into
one of the USB ports.

> I'll certainly ack changes to make 
> this work for U-Boot, provided the USB core patch this relies upon
> is 
> accepted.

Dom, if the changes mentioned in [1] get merged, you may want to add
the Ethernet device to your device trees too and drop the cmdline hack.

[1] http://lists.infradead.org/pipermail/linux-rpi-kernel/2016-February/003207.html

> 
> > diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> 
> > +&usb {
> > +	usb1@01 {
> > +		compatible = "usb1d6b,0002";
> > +		reg = <01>;
> > +		#address-cells = <1>;
> > +		#size-cells = <0>;
> > +
> > +		ethernet: usbether@01 {
> > +			compatible = "usb0424,9514";
> > +			reg = <01>;
> 
> Ib both unit addresses and both reg properties, I would expect "1"
> not 
> "01" since there's usually no leading 0 fill for those.

Okay, will fix.

> I'm curious why the VID values for the hub and Ethernet device don't 
> match since those are part of the same combo chip. Is there a typo 
> there, or did SMSC really do something odd in HW?

Hm, I think I just did a sysfs walk to see how things are connected.
The ethernet USB id is certainly wrong though.

The 1d6d:2 id is of the root hub. There I either messed up the commit
message or the topology. I can't recheck now, but I'll give it another
look before I send and updated version.

Thanks,
Lubo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-03 23:41     ` Olivier Blin
  0 siblings, 0 replies; 18+ messages in thread
From: Olivier Blin @ 2016-02-03 23:41 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: linux-rpi-kernel, devicetree, Arnd Bergmann, linux-kernel, Peter Chen

Lubomir Rintel <lkundrak@v3.sk> writes:

> diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> index ef54050..32bbd2a 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts

Hi,

Shouldn't this be common to all RPi1 B and RPi2 models, instead of being
specific to just RPi B+?

> +&usb {
> +	usb1@01 {
> +		compatible = "usb1d6b,0002";
> +		reg = <01>;
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		ethernet: usbether@01 {
> +			compatible = "usb0424,9514";
> +			reg = <01>;
> +		};
> +	};
> +};

For reference, on RPi2:
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Thanks

-- 
Olivier Blin - blino

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-03 23:41     ` Olivier Blin
  0 siblings, 0 replies; 18+ messages in thread
From: Olivier Blin @ 2016-02-03 23:41 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Peter Chen,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Lubomir Rintel <lkundrak-NGH9Lh4a5iE@public.gmane.org> writes:

> diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> index ef54050..32bbd2a 100644
> --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts

Hi,

Shouldn't this be common to all RPi1 B and RPi2 models, instead of being
specific to just RPi B+?

> +&usb {
> +	usb1@01 {
> +		compatible = "usb1d6b,0002";
> +		reg = <01>;
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		ethernet: usbether@01 {
> +			compatible = "usb0424,9514";
> +			reg = <01>;
> +		};
> +	};
> +};

For reference, on RPi2:
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Thanks

-- 
Olivier Blin - blino

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-04  6:28       ` Peter Chen
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Chen @ 2016-02-04  6:28 UTC (permalink / raw)
  To: Olivier Blin, Lubomir Rintel
  Cc: linux-rpi-kernel, devicetree, Arnd Bergmann, linux-kernel, Peter Chen

 
> Lubomir Rintel <lkundrak@v3.sk> writes:
> 
> > diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > index ef54050..32bbd2a 100644
> > --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> 
> Hi,
> 
> Shouldn't this be common to all RPi1 B and RPi2 models, instead of being
> specific to just RPi B+?
> 
> > +&usb {
> > +	usb1@01 {
> > +		compatible = "usb1d6b,0002";
> > +		reg = <01>;
> > +		#address-cells = <1>;
> > +		#size-cells = <0>;
> > +
> > +		ethernet: usbether@01 {
> > +			compatible = "usb0424,9514";
> > +			reg = <01>;
> > +		};
> > +	};
> > +};
> 
> For reference, on RPi2:

Using "lsusb -t" you may get bus topology.

> Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter

It is the ethernet device, you may need to change vid/pid in dts. 

> Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub

It is the hub device, you may need to change vid/pid in dts.

> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> 
 
It is root hub, it doesn't need to be described at dts.

Best regards,
Peter

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-04  6:28       ` Peter Chen
  0 siblings, 0 replies; 18+ messages in thread
From: Peter Chen @ 2016-02-04  6:28 UTC (permalink / raw)
  To: Olivier Blin, Lubomir Rintel
  Cc: linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Chen

 
> Lubomir Rintel <lkundrak-NGH9Lh4a5iE@public.gmane.org> writes:
> 
> > diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > index ef54050..32bbd2a 100644
> > --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> 
> Hi,
> 
> Shouldn't this be common to all RPi1 B and RPi2 models, instead of being
> specific to just RPi B+?
> 
> > +&usb {
> > +	usb1@01 {
> > +		compatible = "usb1d6b,0002";
> > +		reg = <01>;
> > +		#address-cells = <1>;
> > +		#size-cells = <0>;
> > +
> > +		ethernet: usbether@01 {
> > +			compatible = "usb0424,9514";
> > +			reg = <01>;
> > +		};
> > +	};
> > +};
> 
> For reference, on RPi2:

Using "lsusb -t" you may get bus topology.

> Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter

It is the ethernet device, you may need to change vid/pid in dts. 

> Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub

It is the hub device, you may need to change vid/pid in dts.

> Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> 
 
It is root hub, it doesn't need to be described at dts.

Best regards,
Peter
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-04  7:18         ` Lubomir Rintel
  0 siblings, 0 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-04  7:18 UTC (permalink / raw)
  To: Peter Chen, Olivier Blin
  Cc: linux-rpi-kernel, devicetree, Arnd Bergmann, linux-kernel, Peter Chen

On Thu, 2016-02-04 at 06:28 +0000, Peter Chen wrote:
>  
> > Lubomir Rintel <lkundrak@v3.sk> writes:
> > 
> > > diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > > b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > > index ef54050..32bbd2a 100644
> > > --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > > +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > 
> > Hi,
> > 
> > Shouldn't this be common to all RPi1 B and RPi2 models, instead of
> > being
> > specific to just RPi B+?
> > 
> > > +&usb {
> > > +	usb1@01 {
> > > +		compatible = "usb1d6b,0002";
> > > +		reg = <01>;
> > > +		#address-cells = <1>;
> > > +		#size-cells = <0>;
> > > +
> > > +		ethernet: usbether@01 {
> > > +			compatible = "usb0424,9514";
> > > +			reg = <01>;
> > > +		};
> > > +	};
> > > +};
> > 
> > For reference, on RPi2:
> 
> Using "lsusb -t" you may get bus topology.
> 
> > Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
> > SMSC9512/9514 Fast Ethernet Adapter
> 
> It is the ethernet device, you may need to change vid/pid in dts. 
> 
> > Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
> > SMC9514 Hub
> 
> It is the hub device, you may need to change vid/pid in dts.
> 
> > Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> > 
>  
> It is root hub, it doesn't need to be described at dts.

Thank you; neither of the vid/pid pairs in the original submission is
okay. I'll follow up with an updated version.

I've also checked this on RPi B rev2; and I'll be including that one,
and the RPI2 too.

I can't find my rev1 RPi B; but maybe I can just do the same for the
same board. It would likely work, but I may get the vid/pid wrong if
it's different from rev2. 

> Best regards,
> Peter

Thanks
Lubo

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-04  7:18         ` Lubomir Rintel
  0 siblings, 0 replies; 18+ messages in thread
From: Lubomir Rintel @ 2016-02-04  7:18 UTC (permalink / raw)
  To: Peter Chen, Olivier Blin
  Cc: linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Peter Chen

On Thu, 2016-02-04 at 06:28 +0000, Peter Chen wrote:
>  
> > Lubomir Rintel <lkundrak-NGH9Lh4a5iE@public.gmane.org> writes:
> > 
> > > diff --git a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > > b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > > index ef54050..32bbd2a 100644
> > > --- a/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > > +++ b/arch/arm/boot/dts/bcm2835-rpi-b-plus.dts
> > 
> > Hi,
> > 
> > Shouldn't this be common to all RPi1 B and RPi2 models, instead of
> > being
> > specific to just RPi B+?
> > 
> > > +&usb {
> > > +	usb1@01 {
> > > +		compatible = "usb1d6b,0002";
> > > +		reg = <01>;
> > > +		#address-cells = <1>;
> > > +		#size-cells = <0>;
> > > +
> > > +		ethernet: usbether@01 {
> > > +			compatible = "usb0424,9514";
> > > +			reg = <01>;
> > > +		};
> > > +	};
> > > +};
> > 
> > For reference, on RPi2:
> 
> Using "lsusb -t" you may get bus topology.
> 
> > Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.
> > SMSC9512/9514 Fast Ethernet Adapter
> 
> It is the ethernet device, you may need to change vid/pid in dts. 
> 
> > Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp.
> > SMC9514 Hub
> 
> It is the hub device, you may need to change vid/pid in dts.
> 
> > Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
> > 
>  
> It is root hub, it doesn't need to be described at dts.

Thank you; neither of the vid/pid pairs in the original submission is
okay. I'll follow up with an updated version.

I've also checked this on RPi B rev2; and I'll be including that one,
and the RPI2 too.

I can't find my rev1 RPi B; but maybe I can just do the same for the
same board. It would likely work, but I may get the vid/pid wrong if
it's different from rev2. 

> Best regards,
> Peter

Thanks
Lubo
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-07 10:10     ` kbuild test robot
  0 siblings, 0 replies; 18+ messages in thread
From: kbuild test robot @ 2016-02-07 10:10 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: kbuild-all, linux-rpi-kernel, devicetree, linux-kernel,
	Eric Anholt, Lee Jones, Stephen Warren, Peter Chen,
	Arnd Bergmann, Lubomir Rintel

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

Hi Lubomir,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.5-rc2 next-20160205]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Lubomir-Rintel/Set-the-Raspberry-Pi-Ethernet-MAC-address/20160203-231826
config: arm-arm67 (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> Error: arch/arm/boot/dts/bcm2835-rpi-b-plus.dts:13.2-6 syntax error
   FATAL ERROR: Unable to parse input tree

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 28984 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
@ 2016-02-07 10:10     ` kbuild test robot
  0 siblings, 0 replies; 18+ messages in thread
From: kbuild test robot @ 2016-02-07 10:10 UTC (permalink / raw)
  Cc: kbuild-all-JC7UmRfGjtg,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Eric Anholt, Lee Jones,
	Stephen Warren, Peter Chen, Arnd Bergmann, Lubomir Rintel

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

Hi Lubomir,

[auto build test ERROR on net-next/master]
[also build test ERROR on v4.5-rc2 next-20160205]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Lubomir-Rintel/Set-the-Raspberry-Pi-Ethernet-MAC-address/20160203-231826
config: arm-arm67 (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=arm 

All errors (new ones prefixed by >>):

>> Error: arch/arm/boot/dts/bcm2835-rpi-b-plus.dts:13.2-6 syntax error
   FATAL ERROR: Unable to parse input tree

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 28984 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2016-02-07 10:12 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-03 15:02 [PATCH 0/2] Set the Raspberry Pi Ethernet MAC address Lubomir Rintel
2016-02-03 15:02 ` [PATCH 1/2] net/smscx5xx: use the device tree for mac address Lubomir Rintel
2016-02-03 15:23   ` Arnd Bergmann
2016-02-03 15:42     ` Lubomir Rintel
2016-02-03 15:02 ` [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree Lubomir Rintel
2016-02-03 15:02   ` Lubomir Rintel
2016-02-03 15:11   ` Lubomir Rintel
2016-02-03 15:11     ` Lubomir Rintel
2016-02-03 16:11   ` Stephen Warren
2016-02-03 16:32     ` Lubomir Rintel
2016-02-03 23:41   ` Olivier Blin
2016-02-03 23:41     ` Olivier Blin
2016-02-04  6:28     ` Peter Chen
2016-02-04  6:28       ` Peter Chen
2016-02-04  7:18       ` Lubomir Rintel
2016-02-04  7:18         ` Lubomir Rintel
2016-02-07 10:10   ` kbuild test robot
2016-02-07 10:10     ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.