* [U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init
@ 2010-09-07 22:50 John Rigby
2010-09-08 4:23 ` Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: John Rigby @ 2010-09-07 22:50 UTC (permalink / raw)
To: u-boot
When eth_init updates dev->enetaddr it does not
call dev->write_hwaddr. Fix that so when ethaddr
is set after eth_initialize the change will propagate
to the hw.
Signed-off-by: John Rigby <john.rigby@linaro.org>
---
net/eth.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/net/eth.c b/net/eth.c
index 993306f..5216c2b 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -341,8 +341,14 @@ int eth_init(bd_t *bis)
do {
uchar env_enetaddr[6];
- if (eth_getenv_enetaddr_by_index(eth_number, env_enetaddr))
+ if (eth_getenv_enetaddr_by_index(eth_number, env_enetaddr)) {
memcpy(dev->enetaddr, env_enetaddr, 6);
+ if (dev->write_hwaddr &&
+ !eth_mac_skip(eth_number) &&
+ is_valid_ether_addr(dev->enetaddr)) {
+ dev->write_hwaddr(dev);
+ }
+ }
++eth_number;
dev = dev->next;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init
2010-09-07 22:50 [U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init John Rigby
@ 2010-09-08 4:23 ` Mike Frysinger
2010-09-08 15:06 ` John Rigby
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2010-09-08 4:23 UTC (permalink / raw)
To: u-boot
On Tuesday, September 07, 2010 18:50:26 John Rigby wrote:
> When eth_init updates dev->enetaddr it does not
> call dev->write_hwaddr. Fix that so when ethaddr
> is set after eth_initialize the change will propagate
> to the hw.
current policy is that the driver init() is supposed to be taking care of
this. if you're going to change that, you'll have to update the documentation
and actual drivers.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100908/18884116/attachment.pgp
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init
2010-09-08 4:23 ` Mike Frysinger
@ 2010-09-08 15:06 ` John Rigby
2010-09-08 16:07 ` Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: John Rigby @ 2010-09-08 15:06 UTC (permalink / raw)
To: u-boot
The case I am personally dealing with is one where there is no
persistent storage
for ethaddr. Booting from and SD card and a script is run that sets
the ethaddr.
Currently eth_init updates dev->enetaddr for each device but does not call
dev-write_hwaddr. This seems like a bug not a policy change.
On Tue, Sep 7, 2010 at 10:23 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> On Tuesday, September 07, 2010 18:50:26 John Rigby wrote:
>> When eth_init updates dev->enetaddr it does not
>> call dev->write_hwaddr. ?Fix that so when ethaddr
>> is set after eth_initialize the change will propagate
>> to the hw.
>
> current policy is that the driver init() is supposed to be taking care of
> this. ?if you're going to change that, you'll have to update the documentation
> and actual drivers.
> -mike
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init
2010-09-08 15:06 ` John Rigby
@ 2010-09-08 16:07 ` Mike Frysinger
2010-09-08 17:11 ` John Rigby
0 siblings, 1 reply; 6+ messages in thread
From: Mike Frysinger @ 2010-09-08 16:07 UTC (permalink / raw)
To: u-boot
On Wednesday, September 08, 2010 11:06:54 John Rigby wrote:
please do not top post
> The case I am personally dealing with is one where there is no
> persistent storage
> for ethaddr. Booting from and SD card and a script is run that sets
> the ethaddr.
>
> Currently eth_init updates dev->enetaddr for each device but does not call
> dev-write_hwaddr. This seems like a bug not a policy change.
and if you read the doumentation, you'll see that you're mistaken. whatever
device you're dealing with (today) is missing a call to its own write_hwaaddr
function inside of its own init function.
if you want to fix your immediate issue, then fix that driver as implied by
the policy. if you want to improve the policy, then you need to update all
the drivers and the common code.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100908/f1e94a46/attachment.pgp
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init
2010-09-08 16:07 ` Mike Frysinger
@ 2010-09-08 17:11 ` John Rigby
2010-09-08 17:27 ` Mike Frysinger
0 siblings, 1 reply; 6+ messages in thread
From: John Rigby @ 2010-09-08 17:11 UTC (permalink / raw)
To: u-boot
On Wed, Sep 8, 2010 at 10:07 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>
> and if you read the doumentation, you'll see that you're mistaken. ?whatever
> device you're dealing with (today) is missing a call to its own write_hwaaddr
> function inside of its own init function.
>
> if you want to fix your immediate issue, then fix that driver as implied by
> the policy. ?if you want to improve the policy, then you need to update all
> the drivers and the common code.
> -mike
>
Apologies, I get it now. I will send a new patch that fixes the
driver's init routine.
One more question however, why does eth_initialize call dev->write_hwaddr?
Thanks
John
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init
2010-09-08 17:11 ` John Rigby
@ 2010-09-08 17:27 ` Mike Frysinger
0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2010-09-08 17:27 UTC (permalink / raw)
To: u-boot
On Wednesday, September 08, 2010 13:11:14 John Rigby wrote:
> One more question however, why does eth_initialize call dev->write_hwaddr?
as part of the debate "program the MAC without actually using the network"
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100908/814ae97f/attachment.pgp
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-08 17:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-07 22:50 [U-Boot] [PATCH] net/eth.c call dev->write_hwaddr in eth_init John Rigby
2010-09-08 4:23 ` Mike Frysinger
2010-09-08 15:06 ` John Rigby
2010-09-08 16:07 ` Mike Frysinger
2010-09-08 17:11 ` John Rigby
2010-09-08 17:27 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox