diff mbox

ARM: omap3: beagleboard-xm: dt: Add ethernet to the device tree

Message ID 1480528685-26259-1-git-send-email-laurent.pinchart@ideasonboard.com (mailing list archive)
State New, archived
Headers show

Commit Message

Laurent Pinchart Nov. 30, 2016, 5:58 p.m. UTC
The Beagleboard-xM has a LAN9514 USB hub and ethernet controller,
connected to port 2 of the OMAP EHCI controller. The board however has
no EEPROM to store the ethernet MAC address, which is programmed by the
boot loader.

To allow Linux to use the same MAC address as the boot loader (or for
that matter any fixed MAC address), we need a node in the device tree
for the ethernet controller that the boot loader can update at runtime
with a local-mac-address property. Add it, along with an alias for the
ethernet controller to let the boot loader locate it easily.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 arch/arm/boot/dts/omap3-beagle-xm.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Tony Lindgren Dec. 1, 2016, 9:12 p.m. UTC | #1
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
> The Beagleboard-xM has a LAN9514 USB hub and ethernet controller,
> connected to port 2 of the OMAP EHCI controller. The board however has
> no EEPROM to store the ethernet MAC address, which is programmed by the
> boot loader.
> 
> To allow Linux to use the same MAC address as the boot loader (or for
> that matter any fixed MAC address), we need a node in the device tree
> for the ethernet controller that the boot loader can update at runtime
> with a local-mac-address property. Add it, along with an alias for the
> ethernet controller to let the boot loader locate it easily.

Does not seem to work here.. Do I need to set something in u-boot?
I'm using U-Boot 2016.09-00004-g26bb688.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tom Rini Dec. 1, 2016, 9:33 p.m. UTC | #2
On Thu, Dec 01, 2016 at 01:12:34PM -0800, Tony Lindgren wrote:
> * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
> > The Beagleboard-xM has a LAN9514 USB hub and ethernet controller,
> > connected to port 2 of the OMAP EHCI controller. The board however has
> > no EEPROM to store the ethernet MAC address, which is programmed by the
> > boot loader.
> > 
> > To allow Linux to use the same MAC address as the boot loader (or for
> > that matter any fixed MAC address), we need a node in the device tree
> > for the ethernet controller that the boot loader can update at runtime
> > with a local-mac-address property. Add it, along with an alias for the
> > ethernet controller to let the boot loader locate it easily.
> 
> Does not seem to work here.. Do I need to set something in u-boot?
> I'm using U-Boot 2016.09-00004-g26bb688.

Yes, it seems like something else must be going on as well as
"usbethaddr" which U-Boot will populate with a MAC based on the OMAP DIE
ID doesn't get populated into the DT only ethaddr.  And the follow-up is
that it would be nice if someone would go and patch the last driver in
U-Boot that uses usbethaddr to use ethaddr like all of the rest do.
Tony Lindgren Dec. 1, 2016, 9:35 p.m. UTC | #3
* Tony Lindgren <tony@atomide.com> [161201 13:14]:
> * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
> > The Beagleboard-xM has a LAN9514 USB hub and ethernet controller,
> > connected to port 2 of the OMAP EHCI controller. The board however has
> > no EEPROM to store the ethernet MAC address, which is programmed by the
> > boot loader.
> > 
> > To allow Linux to use the same MAC address as the boot loader (or for
> > that matter any fixed MAC address), we need a node in the device tree
> > for the ethernet controller that the boot loader can update at runtime
> > with a local-mac-address property. Add it, along with an alias for the
> > ethernet controller to let the boot loader locate it easily.
> 
> Does not seem to work here.. Do I need to set something in u-boot?
> I'm using U-Boot 2016.09-00004-g26bb688.

Looks like my u-boot only has usbethaddr in the environment. After doing
setenv ethaddr it's now working :)

Regards,

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Laurent Pinchart Dec. 1, 2016, 9:37 p.m. UTC | #4
Hi Tony,

On Thursday 01 Dec 2016 13:12:34 Tony Lindgren wrote:
> * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
> > The Beagleboard-xM has a LAN9514 USB hub and ethernet controller,
> > connected to port 2 of the OMAP EHCI controller. The board however has
> > no EEPROM to store the ethernet MAC address, which is programmed by the
> > boot loader.
> > 
> > To allow Linux to use the same MAC address as the boot loader (or for
> > that matter any fixed MAC address), we need a node in the device tree
> > for the ethernet controller that the boot loader can update at runtime
> > with a local-mac-address property. Add it, along with an alias for the
> > ethernet controller to let the boot loader locate it easily.
> 
> Does not seem to work here.. Do I need to set something in u-boot?
> I'm using U-Boot 2016.09-00004-g26bb688.

Some versions (possibly forked by vendors) might set the MAC address
automatically in DT, but in my case I have the following in my boot script:

tftp 0x80800000 beagle/omap3-beagle-xm.dtb
fdt addr ${fileaddr} ${filesize}
fdt resize
fdt set /ocp@68000000/usbhshost@48064000/ehci@48064800/usb2@2/usbether@1 local-mac-address "[7a d2 a0 00 d1 f0]"
Laurent Pinchart Dec. 1, 2016, 9:37 p.m. UTC | #5
On Thursday 01 Dec 2016 13:35:16 Tony Lindgren wrote:
> * Tony Lindgren <tony@atomide.com> [161201 13:14]:
> > * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
> > > The Beagleboard-xM has a LAN9514 USB hub and ethernet controller,
> > > connected to port 2 of the OMAP EHCI controller. The board however has
> > > no EEPROM to store the ethernet MAC address, which is programmed by the
> > > boot loader.
> > > 
> > > To allow Linux to use the same MAC address as the boot loader (or for
> > > that matter any fixed MAC address), we need a node in the device tree
> > > for the ethernet controller that the boot loader can update at runtime
> > > with a local-mac-address property. Add it, along with an alias for the
> > > ethernet controller to let the boot loader locate it easily.
> > 
> > Does not seem to work here.. Do I need to set something in u-boot?
> > I'm using U-Boot 2016.09-00004-g26bb688.
> 
> Looks like my u-boot only has usbethaddr in the environment. After doing
> setenv ethaddr it's now working :)

Nice to know, thanks for the tip :-)
Tom Rini Dec. 1, 2016, 9:41 p.m. UTC | #6
On Thu, Dec 01, 2016 at 11:37:53PM +0200, Laurent Pinchart wrote:
> On Thursday 01 Dec 2016 13:35:16 Tony Lindgren wrote:
> > * Tony Lindgren <tony@atomide.com> [161201 13:14]:
> > > * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
> > > > The Beagleboard-xM has a LAN9514 USB hub and ethernet controller,
> > > > connected to port 2 of the OMAP EHCI controller. The board however has
> > > > no EEPROM to store the ethernet MAC address, which is programmed by the
> > > > boot loader.
> > > > 
> > > > To allow Linux to use the same MAC address as the boot loader (or for
> > > > that matter any fixed MAC address), we need a node in the device tree
> > > > for the ethernet controller that the boot loader can update at runtime
> > > > with a local-mac-address property. Add it, along with an alias for the
> > > > ethernet controller to let the boot loader locate it easily.
> > > 
> > > Does not seem to work here.. Do I need to set something in u-boot?
> > > I'm using U-Boot 2016.09-00004-g26bb688.
> > 
> > Looks like my u-boot only has usbethaddr in the environment. After doing
> > setenv ethaddr it's now working :)
> 
> Nice to know, thanks for the tip :-)

To tag onto my other email, it should be just a little work to get this
to work for everyone out of the box :)
Tony Lindgren Dec. 1, 2016, 9:44 p.m. UTC | #7
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161201 13:37]:
> Hi Tony,
> 
> On Thursday 01 Dec 2016 13:12:34 Tony Lindgren wrote:
> > * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
> > > The Beagleboard-xM has a LAN9514 USB hub and ethernet controller,
> > > connected to port 2 of the OMAP EHCI controller. The board however has
> > > no EEPROM to store the ethernet MAC address, which is programmed by the
> > > boot loader.
> > > 
> > > To allow Linux to use the same MAC address as the boot loader (or for
> > > that matter any fixed MAC address), we need a node in the device tree
> > > for the ethernet controller that the boot loader can update at runtime
> > > with a local-mac-address property. Add it, along with an alias for the
> > > ethernet controller to let the boot loader locate it easily.
> > 
> > Does not seem to work here.. Do I need to set something in u-boot?
> > I'm using U-Boot 2016.09-00004-g26bb688.
> 
> Some versions (possibly forked by vendors) might set the MAC address
> automatically in DT, but in my case I have the following in my boot script:
> 
> tftp 0x80800000 beagle/omap3-beagle-xm.dtb
> fdt addr ${fileaddr} ${filesize}
> fdt resize
> fdt set /ocp@68000000/usbhshost@48064000/ehci@48064800/usb2@2/usbether@1 local-mac-address "[7a d2 a0 00 d1 f0]"

OK. I just added setenv ethaddr ${usbethaddr} to my bootcmd..

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Dec. 2, 2016, 1:18 a.m. UTC | #8
* Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
>  &usbhsehci {
>  	phys = <0 &hsusb2_phy>;
> +
> +	#address-cells = <1>;
> +	#size-cells = <0>;
> +
> +	usb2@2 {

I think this should be usb1@2 instead of usb2@2? That's because it's
at /sys/bus/usb/devices/1-2 and not at /sys/bus/usb/devices/2-2?

Or what's the naming standard here?

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Laurent Pinchart Dec. 2, 2016, 1:38 p.m. UTC | #9
Hi Tony,

On Thursday 01 Dec 2016 17:18:08 Tony Lindgren wrote:
> * Laurent Pinchart <laurent.pinchart@ideasonboard.com> [161130 09:58]:
> >  &usbhsehci {
> >  
> >  	phys = <0 &hsusb2_phy>;
> > 
> > +
> > +	#address-cells = <1>;
> > +	#size-cells = <0>;
> > +
> > +	usb2@2 {
> 
> I think this should be usb1@2 instead of usb2@2? That's because it's
> at /sys/bus/usb/devices/1-2 and not at /sys/bus/usb/devices/2-2?
> 
> Or what's the naming standard here?

Good question. As far as I know, the node name is irrelevant, only the reg 
value is important. Maybe we should call it hub@2 ?
diff mbox

Patch

diff --git a/arch/arm/boot/dts/omap3-beagle-xm.dts b/arch/arm/boot/dts/omap3-beagle-xm.dts
index 85e297ed0ea1..75ac56cdf954 100644
--- a/arch/arm/boot/dts/omap3-beagle-xm.dts
+++ b/arch/arm/boot/dts/omap3-beagle-xm.dts
@@ -27,6 +27,7 @@ 
 	aliases {
 		display0 = &dvi0;
 		display1 = &tv0;
+		ethernet = &ethernet;
 	};
 
 	leds {
@@ -348,6 +349,21 @@ 
 
 &usbhsehci {
 	phys = <0 &hsusb2_phy>;
+
+	#address-cells = <1>;
+	#size-cells = <0>;
+
+	usb2@2 {
+		compatible = "usb424,9514";
+		reg = <2>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		ethernet: usbether@1 {
+			compatible = "usb424,ec00";
+			reg = <1>;
+		};
+	};
 };
 
 &vaux2 {