Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1325522 > unrolled thread

[PATCH 0/2] Set the Raspberry Pi Ethernet MAC address

Started byLubomir Rintel <lkundrak@v3.sk>
First post2016-02-03 16:10 +0100
Last post2016-02-04 09:10 +0100
Articles 8 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] Set the Raspberry Pi Ethernet MAC address Lubomir Rintel <lkundrak@v3.sk> - 2016-02-03 16:10 +0100
    [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree Lubomir Rintel <lkundrak@v3.sk> - 2016-02-03 16:10 +0100
      Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device  tree Lubomir Rintel <lkundrak@v3.sk> - 2016-02-03 16:20 +0100
      Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree Stephen Warren <swarren@wwwdotorg.org> - 2016-02-03 17:20 +0100
        Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device  tree Lubomir Rintel <lkundrak@v3.sk> - 2016-02-03 17:40 +0100
      Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree Olivier Blin <dev@blino.org> - 2016-02-04 00:50 +0100
        Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device  tree Lubomir Rintel <lkundrak@v3.sk> - 2016-02-04 08:20 +0100
        RE: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree Peter Chen <peter.chen@nxp.com> - 2016-02-04 09:10 +0100

#1325522 — [PATCH 0/2] Set the Raspberry Pi Ethernet MAC address

FromLubomir Rintel <lkundrak@v3.sk>
Date2016-02-03 16:10 +0100
Subject[PATCH 0/2] Set the Raspberry Pi Ethernet MAC address
Message-ID<qY7ea-3y7-19@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1325523 — [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree

FromLubomir Rintel <lkundrak@v3.sk>
Date2016-02-03 16:10 +0100
Subject[PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
Message-ID<qY7ea-3y7-27@gated-at.bofh.it>
In reply to#1325522
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

[toc] | [prev] | [next] | [standalone]


#1325528 — Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree

FromLubomir Rintel <lkundrak@v3.sk>
Date2016-02-03 16:20 +0100
SubjectRe: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
Message-ID<qY7nR-3C1-17@gated-at.bofh.it>
In reply to#1325523
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>;
>  		};
>  	};
>  

[toc] | [prev] | [next] | [standalone]


#1325604 — Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree

FromStephen Warren <swarren@wwwdotorg.org>
Date2016-02-03 17:20 +0100
SubjectRe: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
Message-ID<qY8jU-4ft-27@gated-at.bofh.it>
In reply to#1325523
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?

[toc] | [prev] | [next] | [standalone]


#1325630 — Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree

FromLubomir Rintel <lkundrak@v3.sk>
Date2016-02-03 17:40 +0100
SubjectRe: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
Message-ID<qY8Dg-4ol-15@gated-at.bofh.it>
In reply to#1325604
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

[toc] | [prev] | [next] | [standalone]


#1326244 — Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree

FromOlivier Blin <dev@blino.org>
Date2016-02-04 00:50 +0100
SubjectRe: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
Message-ID<qYflo-yl-23@gated-at.bofh.it>
In reply to#1325523
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

[toc] | [prev] | [next] | [standalone]


#1326453 — Re: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree

FromLubomir Rintel <lkundrak@v3.sk>
Date2016-02-04 08:20 +0100
SubjectRe: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
Message-ID<qYmmS-5oa-13@gated-at.bofh.it>
In reply to#1326244
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

[toc] | [prev] | [next] | [standalone]


#1326473 — RE: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree

FromPeter Chen <peter.chen@nxp.com>
Date2016-02-04 09:10 +0100
SubjectRE: [PATCH 2/2] ARM: bcm2835: dt: Add the ethernet to the device tree
Message-ID<qYmmS-5oa-15@gated-at.bofh.it>
In reply to#1326244
 
> 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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web