* configure the mac address of an eth device
@ 2020-05-24 11:57 Giorgio
2020-05-24 18:27 ` Ladislav Michl
2020-05-25 6:01 ` Sascha Hauer
0 siblings, 2 replies; 5+ messages in thread
From: Giorgio @ 2020-05-24 11:57 UTC (permalink / raw)
To: Barebox List
Hi,
I'm working with an arm som with an imx7d soc on it.
The som also has an eeprom with some module specific manufacturer parameters
like two MAC address, for eth0 and eth1, a module description string or a module
serial number.
I've now added some code to my board.c to extract the strings from the eeprom and now
I need to actually configure the MAC addresses from them, to avoid barebox choose
random ones when it needs the eth's.
What is the proper way to do this ?
giorgio
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: configure the mac address of an eth device
2020-05-24 11:57 configure the mac address of an eth device Giorgio
@ 2020-05-24 18:27 ` Ladislav Michl
2020-05-25 6:01 ` Sascha Hauer
1 sibling, 0 replies; 5+ messages in thread
From: Ladislav Michl @ 2020-05-24 18:27 UTC (permalink / raw)
To: Giorgio; +Cc: Barebox List
On Sun, May 24, 2020 at 01:57:08PM +0200, Giorgio wrote:
> Hi,
>
> I'm working with an arm som with an imx7d soc on it.
> The som also has an eeprom with some module specific manufacturer parameters
> like two MAC address, for eth0 and eth1, a module description string or a module
> serial number.
> I've now added some code to my board.c to extract the strings from the eeprom and now
> I need to actually configure the MAC addresses from them, to avoid barebox choose
> random ones when it needs the eth's.
>
> What is the proper way to do this ?
Device tree... See nvmem-cells property of ethernet-controller node.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: configure the mac address of an eth device
2020-05-24 11:57 configure the mac address of an eth device Giorgio
2020-05-24 18:27 ` Ladislav Michl
@ 2020-05-25 6:01 ` Sascha Hauer
2020-05-26 15:54 ` Giorgio Dal Molin
1 sibling, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2020-05-25 6:01 UTC (permalink / raw)
To: Giorgio; +Cc: Barebox List
Hi Giorgio,
On Sun, May 24, 2020 at 01:57:08PM +0200, Giorgio wrote:
> Hi,
>
> I'm working with an arm som with an imx7d soc on it.
> The som also has an eeprom with some module specific manufacturer parameters
> like two MAC address, for eth0 and eth1, a module description string or a module
> serial number.
> I've now added some code to my board.c to extract the strings from the eeprom and now
> I need to actually configure the MAC addresses from them, to avoid barebox choose
> random ones when it needs the eth's.
Use of_eth_register_ethaddr(). It will do two things for you. First it
will let the ethernet device come up with the right MAC address under
barebox. Also it will add the "mac-address" property to the device tree
passed to Linux.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: configure the mac address of an eth device
2020-05-25 6:01 ` Sascha Hauer
@ 2020-05-26 15:54 ` Giorgio Dal Molin
2020-06-02 6:20 ` Sascha Hauer
0 siblings, 1 reply; 5+ messages in thread
From: Giorgio Dal Molin @ 2020-05-26 15:54 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
Hi Sascha,
thank you for your suggestion about the MAC, the code works now as expected.
Just another quick question: is there a function like of_eth_register_ethaddr()
also for a 'serial-number' value ?
I also have a 'serial number' value from the eeprom and I would like to pass to the kernel.
Just calling something like:
of_set_property(of_get_root_node(), "serial-number", s, strlen(s) + 1, 1);
does not work because it changes only the device tree for barebox but not that
for the kernel. So I registered an of fixup:
of_register_fixup(samx7_board_fixup, s);
for it and it works then but it is a bit more complex.
giorgio
> On May 25, 2020 at 8:01 AM Sascha Hauer <s.hauer@pengutronix.de> wrote:
>
>
> Hi Giorgio,
>
> On Sun, May 24, 2020 at 01:57:08PM +0200, Giorgio wrote:
> > Hi,
> >
> > I'm working with an arm som with an imx7d soc on it.
> > The som also has an eeprom with some module specific manufacturer parameters
> > like two MAC address, for eth0 and eth1, a module description string or a module
> > serial number.
> > I've now added some code to my board.c to extract the strings from the eeprom and now
> > I need to actually configure the MAC addresses from them, to avoid barebox choose
> > random ones when it needs the eth's.
>
> Use of_eth_register_ethaddr(). It will do two things for you. First it
> will let the ethernet device come up with the right MAC address under
> barebox. Also it will add the "mac-address" property to the device tree
> passed to Linux.
>
> Sascha
>
>
> --
> Pengutronix e.K. | |
> Steuerwalder Str. 21 | http://www.pengutronix.de/ |
> 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: configure the mac address of an eth device
2020-05-26 15:54 ` Giorgio Dal Molin
@ 2020-06-02 6:20 ` Sascha Hauer
0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2020-06-02 6:20 UTC (permalink / raw)
To: Giorgio Dal Molin; +Cc: Barebox List
On Tue, May 26, 2020 at 05:54:53PM +0200, Giorgio Dal Molin wrote:
> Hi Sascha,
>
> thank you for your suggestion about the MAC, the code works now as expected.
>
> Just another quick question: is there a function like of_eth_register_ethaddr()
> also for a 'serial-number' value ?
>
> I also have a 'serial number' value from the eeprom and I would like to pass to the kernel.
> Just calling something like:
>
> of_set_property(of_get_root_node(), "serial-number", s, strlen(s) + 1, 1);
>
> does not work because it changes only the device tree for barebox but not that
> for the kernel. So I registered an of fixup:
>
> of_register_fixup(samx7_board_fixup, s);
>
> for it and it works then but it is a bit more complex.
Yes, you have to do it like that, there is no shortcut for it.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-02 6:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-24 11:57 configure the mac address of an eth device Giorgio
2020-05-24 18:27 ` Ladislav Michl
2020-05-25 6:01 ` Sascha Hauer
2020-05-26 15:54 ` Giorgio Dal Molin
2020-06-02 6:20 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox