All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback
@ 2016-09-02 12:48 Hannes Schmelzer
  2016-09-02 13:00 ` Joe Hershberger
  2016-10-13 17:38 ` [U-Boot] " Joe Hershberger
  0 siblings, 2 replies; 9+ messages in thread
From: Hannes Schmelzer @ 2016-09-02 12:48 UTC (permalink / raw)
  To: u-boot

If mac-address is changed using "setenv ethaddr ...." command the new
mac-adress also must be written into the responsible ethernet driver.

Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>

---

 net/eth-uclass.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index c15cc4d..a32961e 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -227,6 +227,7 @@ static int on_ethaddr(const char *name, const char *value, enum env_op op,
 		case env_op_create:
 		case env_op_overwrite:
 			eth_parse_enetaddr(value, pdata->enetaddr);
+			eth_write_hwaddr(dev);
 			break;
 		case env_op_delete:
 			memset(pdata->enetaddr, 0, 6);
-- 
1.9.1

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

* [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback
  2016-09-02 12:48 [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback Hannes Schmelzer
@ 2016-09-02 13:00 ` Joe Hershberger
  2016-09-06  1:54   ` Bin Meng
  2016-10-13 17:38 ` [U-Boot] " Joe Hershberger
  1 sibling, 1 reply; 9+ messages in thread
From: Joe Hershberger @ 2016-09-02 13:00 UTC (permalink / raw)
  To: u-boot

On Fri, Sep 2, 2016 at 7:48 AM, Hannes Schmelzer <oe5hpm@oevsv.at> wrote:
> If mac-address is changed using "setenv ethaddr ...." command the new
> mac-adress also must be written into the responsible ethernet driver.
>
> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback
  2016-09-02 13:00 ` Joe Hershberger
@ 2016-09-06  1:54   ` Bin Meng
  2016-09-06  4:33     ` Hannes Schmelzer
  0 siblings, 1 reply; 9+ messages in thread
From: Bin Meng @ 2016-09-06  1:54 UTC (permalink / raw)
  To: u-boot

Hi,

On Fri, Sep 2, 2016 at 9:00 PM, Joe Hershberger
<joe.hershberger@gmail.com> wrote:
> On Fri, Sep 2, 2016 at 7:48 AM, Hannes Schmelzer <oe5hpm@oevsv.at> wrote:
>> If mac-address is changed using "setenv ethaddr ...." command the new
>> mac-adress also must be written into the responsible ethernet driver.
>>
>> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
>
> Acked-by: Joe Hershberger <joe.hershberger@ni.com>

Why is this needed? The MAC address is supposed to be programmed in
the driver's probe routine.

Regards,
Bin

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

* [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback
  2016-09-06  1:54   ` Bin Meng
@ 2016-09-06  4:33     ` Hannes Schmelzer
  2016-09-06  7:07       ` Bin Meng
  0 siblings, 1 reply; 9+ messages in thread
From: Hannes Schmelzer @ 2016-09-06  4:33 UTC (permalink / raw)
  To: u-boot

"U-Boot" <u-boot-bounces@lists.denx.de> schrieb am 06.09.2016 03:54:52:

> Von: Bin Meng <bmeng.cn@gmail.com>
> An: Joe Hershberger <joe.hershberger@gmail.com>, 
> Kopie: u-boot <u-boot@lists.denx.de>, Hannes Schmelzer 
<oe5hpm@oevsv.at>, Joe 
> Hershberger <joe.hershberger@ni.com>
> Datum: 06.09.2016 03:57
> Betreff: Re: [U-Boot] [PATCH] net: write enetaddr down to hardware on 
env_callback
> Gesendet von: "U-Boot" <u-boot-bounces@lists.denx.de>
> 
> Hi,
Hi Bin,

> 
> On Fri, Sep 2, 2016 at 9:00 PM, Joe Hershberger
> <joe.hershberger@gmail.com> wrote:
> > On Fri, Sep 2, 2016 at 7:48 AM, Hannes Schmelzer <oe5hpm@oevsv.at> 
wrote:
> >> If mac-address is changed using "setenv ethaddr ...." command the new
> >> mac-adress also must be written into the responsible ethernet driver.
> >>
> >> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
> >
> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
> 
> Why is this needed? The MAC address is supposed to be programmed in
> the driver's probe routine.

For example on my custom ZYNQ board.
The Ethernetcontroller within the ZYNQ has no ROM to store his own 
MAC-Address, further no MAC is stored within environment.
So Ethernet gets probed with a "random MAC-Address" if configured.

Later somebody (like me) oder something (my bootscript) runs "setenv 
ethaddr ...." on the console.
Result is (was before this patch), that all networking infrastructre is 
running this new mac, but hardware is running the old (random) one and 
networking is simple not functional.

ok?

> 
> Regards,
> Bin
cheers,
Hannes

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

* [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback
  2016-09-06  4:33     ` Hannes Schmelzer
@ 2016-09-06  7:07       ` Bin Meng
  2016-09-06  7:23         ` Hannes Schmelzer
  0 siblings, 1 reply; 9+ messages in thread
From: Bin Meng @ 2016-09-06  7:07 UTC (permalink / raw)
  To: u-boot

Hi Hannes,

On Tue, Sep 6, 2016 at 12:33 PM, Hannes Schmelzer
<Hannes.Schmelzer@br-automation.com> wrote:
> "U-Boot" <u-boot-bounces@lists.denx.de> schrieb am 06.09.2016 03:54:52:
>
>> Von: Bin Meng <bmeng.cn@gmail.com>
>> An: Joe Hershberger <joe.hershberger@gmail.com>,
>> Kopie: u-boot <u-boot@lists.denx.de>, Hannes Schmelzer
> <oe5hpm@oevsv.at>, Joe
>> Hershberger <joe.hershberger@ni.com>
>> Datum: 06.09.2016 03:57
>> Betreff: Re: [U-Boot] [PATCH] net: write enetaddr down to hardware on
> env_callback
>> Gesendet von: "U-Boot" <u-boot-bounces@lists.denx.de>
>>
>> Hi,
> Hi Bin,
>
>>
>> On Fri, Sep 2, 2016 at 9:00 PM, Joe Hershberger
>> <joe.hershberger@gmail.com> wrote:
>> > On Fri, Sep 2, 2016 at 7:48 AM, Hannes Schmelzer <oe5hpm@oevsv.at>
> wrote:
>> >> If mac-address is changed using "setenv ethaddr ...." command the new
>> >> mac-adress also must be written into the responsible ethernet driver.
>> >>
>> >> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at>
>> >
>> > Acked-by: Joe Hershberger <joe.hershberger@ni.com>
>>
>> Why is this needed? The MAC address is supposed to be programmed in
>> the driver's probe routine.
>
> For example on my custom ZYNQ board.
> The Ethernetcontroller within the ZYNQ has no ROM to store his own
> MAC-Address, further no MAC is stored within environment.
> So Ethernet gets probed with a "random MAC-Address" if configured.
>
> Later somebody (like me) oder something (my bootscript) runs "setenv
> ethaddr ...." on the console.
> Result is (was before this patch), that all networking infrastructre is
> running this new mac, but hardware is running the old (random) one and
> networking is simple not functional.
>

This indicates that your ethernet driver does not program the latest
MAC address everyone when it gets probed. The driver should be fixed.

> ok?
>

Regards,
Bin

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

* [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback
  2016-09-06  7:07       ` Bin Meng
@ 2016-09-06  7:23         ` Hannes Schmelzer
  2016-09-06  7:28           ` Bin Meng
  0 siblings, 1 reply; 9+ messages in thread
From: Hannes Schmelzer @ 2016-09-06  7:23 UTC (permalink / raw)
  To: u-boot

Bin Meng <bmeng.cn@gmail.com> schrieb am 06.09.2016 09:07:39:

[...]
> >>
> >> Why is this needed? The MAC address is supposed to be programmed in
> >> the driver's probe routine.
> >
> > For example on my custom ZYNQ board.
> > The Ethernetcontroller within the ZYNQ has no ROM to store his own
> > MAC-Address, further no MAC is stored within environment.
> > So Ethernet gets probed with a "random MAC-Address" if configured.
> >
> > Later somebody (like me) oder something (my bootscript) runs "setenv
> > ethaddr ...." on the console.
> > Result is (was before this patch), that all networking infrastructre 
is
> > running this new mac, but hardware is running the old (random) one and
> > networking is simple not functional.
> >
> 
> This indicates that your ethernet driver does not program the latest
> MAC address everyone when it gets probed. The driver should be fixed.

The driver doesn't get probed again if mac-address is changed using 
"setenv ethaddr",
so it has no chance to program anything.

For program i understand, in this case with zynq, overtaking mac-address 
into his registers.
There is per default no ROM to store some mac.

> 
> Regards,
> Bin
cheers,
Hannes

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

* [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback
  2016-09-06  7:23         ` Hannes Schmelzer
@ 2016-09-06  7:28           ` Bin Meng
  2016-09-06  7:56             ` [U-Boot] Antwort: Re: Re: " Hannes Schmelzer
  0 siblings, 1 reply; 9+ messages in thread
From: Bin Meng @ 2016-09-06  7:28 UTC (permalink / raw)
  To: u-boot

Hi Hannes,

On Tue, Sep 6, 2016 at 3:23 PM, Hannes Schmelzer
<Hannes.Schmelzer@br-automation.com> wrote:
> Bin Meng <bmeng.cn@gmail.com> schrieb am 06.09.2016 09:07:39:
>
> [...]
>> >>
>> >> Why is this needed? The MAC address is supposed to be programmed in
>> >> the driver's probe routine.
>> >
>> > For example on my custom ZYNQ board.
>> > The Ethernetcontroller within the ZYNQ has no ROM to store his own
>> > MAC-Address, further no MAC is stored within environment.
>> > So Ethernet gets probed with a "random MAC-Address" if configured.
>> >
>> > Later somebody (like me) oder something (my bootscript) runs "setenv
>> > ethaddr ...." on the console.
>> > Result is (was before this patch), that all networking infrastructre
> is
>> > running this new mac, but hardware is running the old (random) one and
>> > networking is simple not functional.
>> >
>>
>> This indicates that your ethernet driver does not program the latest
>> MAC address everyone when it gets probed. The driver should be fixed.
>
> The driver doesn't get probed again if mac-address is changed using
> "setenv ethaddr",
> so it has no chance to program anything.
>

Yes, driver is not probed when "setenv ethaddr", but next time when
you type any ethernet related command (like tftpboot), the driver will
be probed.

> For program i understand, in this case with zynq, overtaking mac-address
> into his registers.
> There is per default no ROM to store some mac.
>

I have feeling that for some ethernet controllers, simply calling
eth_write_hwaddr() may not change its MAC address correctly. It may
need some special programming sequence like firstly turn off, reset,
then program the MAC.

Regards,
Bin

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

* [U-Boot] Antwort: Re: Re: Re: [PATCH] net: write enetaddr down to hardware on env_callback
  2016-09-06  7:28           ` Bin Meng
@ 2016-09-06  7:56             ` Hannes Schmelzer
  0 siblings, 0 replies; 9+ messages in thread
From: Hannes Schmelzer @ 2016-09-06  7:56 UTC (permalink / raw)
  To: u-boot

Bin Meng <bmeng.cn@gmail.com> schrieb am 06.09.2016 09:28:13:

> Von: Bin Meng <bmeng.cn@gmail.com>
> An: Hannes Schmelzer <Hannes.Schmelzer@br-automation.com>, 
> Kopie: Joe Hershberger <joe.hershberger@gmail.com>, Joe Hershberger 
> <joe.hershberger@ni.com>, Hannes Schmelzer <oe5hpm@oevsv.at>, u-boot <u-
> boot at lists.denx.de>, U-Boot <u-boot-bounces@lists.denx.de>
> Datum: 06.09.2016 09:28
> Betreff: Re: Re: Re: [U-Boot] [PATCH] net: write enetaddr down to 
hardware on 
> env_callback
> 
> Hi Hannes,
> 
> On Tue, Sep 6, 2016 at 3:23 PM, Hannes Schmelzer
> <Hannes.Schmelzer@br-automation.com> wrote:
> > Bin Meng <bmeng.cn@gmail.com> schrieb am 06.09.2016 09:07:39:
> >
> > [...]
> >> >>
> >> >> Why is this needed? The MAC address is supposed to be programmed 
in
> >> >> the driver's probe routine.
> >> >
> >> > For example on my custom ZYNQ board.
> >> > The Ethernetcontroller within the ZYNQ has no ROM to store his own
> >> > MAC-Address, further no MAC is stored within environment.
> >> > So Ethernet gets probed with a "random MAC-Address" if configured.
> >> >
> >> > Later somebody (like me) oder something (my bootscript) runs 
"setenv
> >> > ethaddr ...." on the console.
> >> > Result is (was before this patch), that all networking 
infrastructre
> > is
> >> > running this new mac, but hardware is running the old (random) one 
and
> >> > networking is simple not functional.
> >> >
> >>
> >> This indicates that your ethernet driver does not program the latest
> >> MAC address everyone when it gets probed. The driver should be fixed.
> >
> > The driver doesn't get probed again if mac-address is changed using
> > "setenv ethaddr",
> > so it has no chance to program anything.
> >
> 
> Yes, driver is not probed when "setenv ethaddr", but next time when
> you type any ethernet related command (like tftpboot), the driver will
> be probed.
No. The ethernet driver isn't probed everytime a network transaction is 
coming.
What i can see, the probe is done one time.

> 
> > For program i understand, in this case with zynq, overtaking 
mac-address
> > into his registers.
> > There is per default no ROM to store some mac.
> >
> 
> I have feeling that for some ethernet controllers, simply calling
> eth_write_hwaddr() may not change its MAC address correctly. It may
> need some special programming sequence like firstly turn off, reset,
> then program the MAC.
That might be possible. Maybe this is the reason why not all drivers 
provide this function.

> 
> Regards,
> Bin

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

* [U-Boot] net: write enetaddr down to hardware on env_callback
  2016-09-02 12:48 [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback Hannes Schmelzer
  2016-09-02 13:00 ` Joe Hershberger
@ 2016-10-13 17:38 ` Joe Hershberger
  1 sibling, 0 replies; 9+ messages in thread
From: Joe Hershberger @ 2016-10-13 17:38 UTC (permalink / raw)
  To: u-boot

Hi Hannes,

https://patchwork.ozlabs.org/patch/665202/ was applied to u-boot-net.git.

Thanks!
-Joe

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

end of thread, other threads:[~2016-10-13 17:38 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-02 12:48 [U-Boot] [PATCH] net: write enetaddr down to hardware on env_callback Hannes Schmelzer
2016-09-02 13:00 ` Joe Hershberger
2016-09-06  1:54   ` Bin Meng
2016-09-06  4:33     ` Hannes Schmelzer
2016-09-06  7:07       ` Bin Meng
2016-09-06  7:23         ` Hannes Schmelzer
2016-09-06  7:28           ` Bin Meng
2016-09-06  7:56             ` [U-Boot] Antwort: Re: Re: " Hannes Schmelzer
2016-10-13 17:38 ` [U-Boot] " Joe Hershberger

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.