[U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-10 Thread Jean-Christophe PLAGNIOL-VILLARD
init it at the eth_initialize

this will allow to add later a hook to update the enetadd hw storage
when it's updated in env or when the env is saved

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 
Cc: Ben Warren 
---
 include/net.h |2 ++
 net/eth.c |4 
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/net.h b/include/net.h
index 5a1d36e..2ed6263 100644
--- a/include/net.h
+++ b/include/net.h
@@ -93,6 +93,7 @@ enum eth_state_t {
 };
 
 struct eth_device {
+   int num;
char name[NAMESIZE];
unsigned char enetaddr[6];
int iobase;
@@ -105,6 +106,7 @@ struct eth_device {
 #ifdef CONFIG_MCAST_TFTP
int (*mcast) (struct eth_device*, u32 ip, u8 set);
 #endif
+   int  (*set_hw_enetaddr) (struct eth_device*, bd_t*);
struct eth_device *next;
void *priv;
 };
diff --git a/net/eth.c b/net/eth.c
index c6fa5b9..99bb6c2 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -217,6 +217,8 @@ int eth_initialize(bd_t *bis)
if (eth_number)
puts (", ");
 
+   dev->num = eth_number;
+
printf("%s", dev->name);
 
if (ethprime && strcmp (dev->name, ethprime) == 0) {
@@ -240,6 +242,8 @@ int eth_initialize(bd_t *bis)
}
 
memcpy(dev->enetaddr, env_enetaddr, 6);
+   if(dev->set_hw_enetaddr)
+   dev->set_hw_enetaddr(dev, bis);
}
 
eth_number++;
-- 
1.6.1.3

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Mike Frysinger
On Monday 11 May 2009 02:39:26 Jean-Christophe PLAGNIOL-VILLARD wrote:
> this will allow to add later a hook to update the enetadd hw storage
> when it's updated in env or when the env is saved

there is no need for that on purpose.  the network layer will recheck the 
environment every time it gets initialized, and it gets initialized with every 
network step.  this is already documented in doc/README.enetaddr.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Jean-Christophe PLAGNIOL-VILLARD
On 03:48 Mon 11 May , Mike Frysinger wrote:
> On Monday 11 May 2009 02:39:26 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > this will allow to add later a hook to update the enetadd hw storage
> > when it's updated in env or when the env is saved
> 
> there is no need for that on purpose.  the network layer will recheck the 
> environment every time it gets initialized, and it gets initialized with 
> every 
> network step.  this is already documented in doc/README.enetaddr.
Unfortunatly we need it to set the enetaddr in the register of the soc evenif
there is no ethernet transfer as for the macb on at91 or the dm9000.
This how the kernel pass the mac address for the bootloader.

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20090511120809.ga1...@game.jcrosoft.org> you wrote:
>
> > there is no need for that on purpose.  the network layer will recheck the 
> > environment every time it gets initialized, and it gets initialized with 
> > every 
> > network step.  this is already documented in doc/README.enetaddr.
> Unfortunatly we need it to set the enetaddr in the register of the soc evenif
> there is no ethernet transfer as for the macb on at91 or the dm9000.
> This how the kernel pass the mac address for the bootloader.

You mean, this is how U-Boot is supposed to pass the MAC address to
the Kernel, right?

Well, strictly speaking this is (1) in direct violation of U-Boot's
design principles which say NOT to initialize things it does not use
itself, and (2) a bug in the Linux kernel that should be fixed there.

In this case it may be just writing to  a  register  without  further
initialization  of the hardware, but if we allow for that you can bet
that tomorrow someone will  try  and  add  code  that  requires  more
extensive initialization of the hardware for the same purpose, and he
will argue that his code must go in because there is preexisting code
that does the same.

That's why I have to NAK this.

The problem should be fixed in the Linux kernel. I know that RMK does
not alow for things like a MAC ATAG or similar, so the best you can
do is hope for quick approach of device tree based drivers. Until
then, you probably have to resort to out-of-tree (Linux) solutions
like everybody else who hit this problem before.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Nobody trips over mountains. It is the small pebble that  causes  you
to  stumble.  Pass all the pebbles in your path and you will find you
have crossed the mountain.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Jean-Christophe PLAGNIOL-VILLARD
On 15:26 Mon 11 May , Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <20090511120809.ga1...@game.jcrosoft.org> you wrote:
> >
> > > there is no need for that on purpose.  the network layer will recheck the 
> > > environment every time it gets initialized, and it gets initialized with 
> > > every 
> > > network step.  this is already documented in doc/README.enetaddr.
> > Unfortunatly we need it to set the enetaddr in the register of the soc 
> > evenif
> > there is no ethernet transfer as for the macb on at91 or the dm9000.
> > This how the kernel pass the mac address for the bootloader.
> 
> You mean, this is how U-Boot is supposed to pass the MAC address to
> the Kernel, right?
> 
> Well, strictly speaking this is (1) in direct violation of U-Boot's
> design principles which say NOT to initialize things it does not use
> itself, and (2) a bug in the Linux kernel that should be fixed there.
> 
> In this case it may be just writing to  a  register  without  further
> initialization  of the hardware, but if we allow for that you can bet
> that tomorrow someone will  try  and  add  code  that  requires  more
> extensive initialization of the hardware for the same purpose, and he
> will argue that his code must go in because there is preexisting code
> that does the same.
this exactly what is done only write mac hw register
without init the eth stack

before we do need to init the mac and detect the phy if we want to store
now we have to call the set_hw_enetaddr

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20090511142454.gb1...@game.jcrosoft.org> you wrote:
>
> > > Unfortunatly we need it to set the enetaddr in the register of the soc 
> > > evenif
> > > there is no ethernet transfer as for the macb on at91 or the dm9000.
> > > This how the kernel pass the mac address for the bootloader.
> > 
> > You mean, this is how U-Boot is supposed to pass the MAC address to
> > the Kernel, right?
> > 
> > Well, strictly speaking this is (1) in direct violation of U-Boot's
> > design principles which say NOT to initialize things it does not use
> > itself, and (2) a bug in the Linux kernel that should be fixed there.
> > 
> > In this case it may be just writing to  a  register  without  further
> > initialization  of the hardware, but if we allow for that you can bet
> > that tomorrow someone will  try  and  add  code  that  requires  more
> > extensive initialization of the hardware for the same purpose, and he
> > will argue that his code must go in because there is preexisting code
> > that does the same.
> this exactly what is done only write mac hw register
> without init the eth stack
> 
> before we do need to init the mac and detect the phy if we want to store
> now we have to call the set_hw_enetaddr

Yes, I perfectly understood this. You did not have to explain it
again.

Did you understand what I wrote, too?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Minds are like parachutes - they only function when open.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Mike Frysinger
On Monday 11 May 2009 10:24:54 Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 15:26 Mon 11 May , Wolfgang Denk wrote:
> > Dear Jean-Christophe PLAGNIOL-VILLARD,
> >
> > In message <20090511120809.ga1...@game.jcrosoft.org> you wrote:
> > > > there is no need for that on purpose.  the network layer will recheck
> > > > the environment every time it gets initialized, and it gets
> > > > initialized with every network step.  this is already documented in
> > > > doc/README.enetaddr.
> > >
> > > Unfortunatly we need it to set the enetaddr in the register of the soc
> > > evenif there is no ethernet transfer as for the macb on at91 or the
> > > dm9000. This how the kernel pass the mac address for the bootloader.
> >
> > You mean, this is how U-Boot is supposed to pass the MAC address to
> > the Kernel, right?
> >
> > Well, strictly speaking this is (1) in direct violation of U-Boot's
> > design principles which say NOT to initialize things it does not use
> > itself, and (2) a bug in the Linux kernel that should be fixed there.
> >
> > In this case it may be just writing to  a  register  without  further
> > initialization  of the hardware, but if we allow for that you can bet
> > that tomorrow someone will  try  and  add  code  that  requires  more
> > extensive initialization of the hardware for the same purpose, and he
> > will argue that his code must go in because there is preexisting code
> > that does the same.
>
> this exactly what is done only write mac hw register
> without init the eth stack
>
> before we do need to init the mac and detect the phy if we want to store
> now we have to call the set_hw_enetaddr

then we agree you're doing it wrong and this patch is not needed/wanted

there is this FAQ, but i think we can add more info to it:
http://www.denx.de/wiki/view/DULG/EthernetDoesNotWorkInLinux
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Jean-Christophe PLAGNIOL-VILLARD
On 18:01 Mon 11 May , Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <20090511142454.gb1...@game.jcrosoft.org> you wrote:
> >
> > > > Unfortunatly we need it to set the enetaddr in the register of the soc 
> > > > evenif
> > > > there is no ethernet transfer as for the macb on at91 or the dm9000.
> > > > This how the kernel pass the mac address for the bootloader.
> > > 
> > > You mean, this is how U-Boot is supposed to pass the MAC address to
> > > the Kernel, right?
> > > 
> > > Well, strictly speaking this is (1) in direct violation of U-Boot's
> > > design principles which say NOT to initialize things it does not use
> > > itself, and (2) a bug in the Linux kernel that should be fixed there.
> > > 
> > > In this case it may be just writing to  a  register  without  further
> > > initialization  of the hardware, but if we allow for that you can bet
> > > that tomorrow someone will  try  and  add  code  that  requires  more
> > > extensive initialization of the hardware for the same purpose, and he
> > > will argue that his code must go in because there is preexisting code
> > > that does the same.
> > this exactly what is done only write mac hw register
> > without init the eth stack
> > 
> > before we do need to init the mac and detect the phy if we want to store
> > now we have to call the set_hw_enetaddr
> 
> Yes, I perfectly understood this. You did not have to explain it
> again.
So no I do not understand why you nack it

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Jean-Christophe PLAGNIOL-VILLARD
On 12:24 Mon 11 May , Mike Frysinger wrote:
> On Monday 11 May 2009 10:24:54 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 15:26 Mon 11 May , Wolfgang Denk wrote:
> > > Dear Jean-Christophe PLAGNIOL-VILLARD,
> > >
> > > In message <20090511120809.ga1...@game.jcrosoft.org> you wrote:
> > > > > there is no need for that on purpose.  the network layer will recheck
> > > > > the environment every time it gets initialized, and it gets
> > > > > initialized with every network step.  this is already documented in
> > > > > doc/README.enetaddr.
> > > >
> > > > Unfortunatly we need it to set the enetaddr in the register of the soc
> > > > evenif there is no ethernet transfer as for the macb on at91 or the
> > > > dm9000. This how the kernel pass the mac address for the bootloader.
> > >
> > > You mean, this is how U-Boot is supposed to pass the MAC address to
> > > the Kernel, right?
> > >
> > > Well, strictly speaking this is (1) in direct violation of U-Boot's
> > > design principles which say NOT to initialize things it does not use
> > > itself, and (2) a bug in the Linux kernel that should be fixed there.
> > >
> > > In this case it may be just writing to  a  register  without  further
> > > initialization  of the hardware, but if we allow for that you can bet
> > > that tomorrow someone will  try  and  add  code  that  requires  more
> > > extensive initialization of the hardware for the same purpose, and he
> > > will argue that his code must go in because there is preexisting code
> > > that does the same.
> >
> > this exactly what is done only write mac hw register
> > without init the eth stack
> >
> > before we do need to init the mac and detect the phy if we want to store
> > now we have to call the set_hw_enetaddr
> 
> then we agree you're doing it wrong and this patch is not needed/wanted
> 
> there is this FAQ, but i think we can add more info to it:
> http://www.denx.de/wiki/view/DULG/EthernetDoesNotWorkInLinux
It does not work ether
how do you deal with multiple nic?
how do set a mac for NFS Rootfs?
how do you boot a *mainline* kernel?

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Mike Frysinger
On Monday 11 May 2009 12:37:28 Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 12:24 Mon 11 May , Mike Frysinger wrote:
> > On Monday 11 May 2009 10:24:54 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > On 15:26 Mon 11 May , Wolfgang Denk wrote:
> > > > In message Jean-Christophe wrote:
> > > > > > there is no need for that on purpose.  the network layer will
> > > > > > recheck the environment every time it gets initialized, and it
> > > > > > gets initialized with every network step.  this is already
> > > > > > documented in doc/README.enetaddr.
> > > > >
> > > > > Unfortunatly we need it to set the enetaddr in the register of the
> > > > > soc evenif there is no ethernet transfer as for the macb on at91 or
> > > > > the dm9000. This how the kernel pass the mac address for the
> > > > > bootloader.
> > > >
> > > > You mean, this is how U-Boot is supposed to pass the MAC address to
> > > > the Kernel, right?
> > > >
> > > > Well, strictly speaking this is (1) in direct violation of U-Boot's
> > > > design principles which say NOT to initialize things it does not use
> > > > itself, and (2) a bug in the Linux kernel that should be fixed there.
> > > >
> > > > In this case it may be just writing to  a  register  without  further
> > > > initialization  of the hardware, but if we allow for that you can bet
> > > > that tomorrow someone will  try  and  add  code  that  requires  more
> > > > extensive initialization of the hardware for the same purpose, and he
> > > > will argue that his code must go in because there is preexisting code
> > > > that does the same.
> > >
> > > this exactly what is done only write mac hw register
> > > without init the eth stack
> > >
> > > before we do need to init the mac and detect the phy if we want to
> > > store now we have to call the set_hw_enetaddr
> >
> > then we agree you're doing it wrong and this patch is not needed/wanted
> >
> > there is this FAQ, but i think we can add more info to it:
> > http://www.denx.de/wiki/view/DULG/EthernetDoesNotWorkInLinux
>
> It does not work ether

your solution blatantly ignores the issues raised in the FAQ.  you cant push a 
change without clearing addressing those.

> how do you deal with multiple nic?

the ATAG/FDT tree handles most arches.

for the rest you have two major issues to address:
 - how do i pass it to the next OS ?
* have the OS read the u-boot environment
* have the OS read the command line
 - how does the OS set it ?
* add a board hook to set it
* set it via user space and normal methods (`ifconfig hw`)

> how do set a mac for NFS Rootfs?

use initramfs

> how do you boot a *mainline* kernel?

i dont know why you're emphasizing mainline.  if it's your board and if you 
implement the change correctly, submit it to mainline.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <20090511163728.gb32...@game.jcrosoft.org> you wrote:
>
> > then we agree you're doing it wrong and this patch is not needed/wanted
> > 
> > there is this FAQ, but i think we can add more info to it:
> > http://www.denx.de/wiki/view/DULG/EthernetDoesNotWorkInLinux
> It does not work ether

What is "it" in this sentence?

You start a discussion here which is off topic on the U-Boot list. It
deals with a problem that is caused by the  ARM  Linuxkernel  design.
It's  a  very old problem, that has been discussed many times before,
and it's unlikely that we willsolve it here. If you want to solve it,
then please explain it to RMK.

> how do you deal with multiple nic?

Other (more reasonable architectures) use a device tree (current
PowerPC), a binary data structure (old PowerPC), or command line
arguments.

> how do set a mac for NFS Rootfs?

Other (more reasonable architectures) use a device tree (current
PowerPC), a binary data structure (old PowerPC), or command line
arguments.

> how do you boot a *mainline* kernel?

Other (more reasonable architectures) use a device tree (current
PowerPC), a binary data structure (old PowerPC), or command line
arguments.

The fact that mainline ARM has serious deficiencies is another story.
Or can you explain why the ARM kernel cannot load  and  uncompress  a
ramdisk  image  from NOR flash, why we instead have to load it to RAM
first, adding a completely unnecessary copy operation? It's just  one
of  the  issues  with  the  ARM  Linux  kernel  that need to be fixed
*there*.

But, as mentioned, this is off topic here.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
"The whole problem with the world is  that  fools  and  fanatics  are
always so certain of themselves, but wiser people so full of doubts."
- Bertrand Russell
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Wolfgang Denk
Dear Mike,

in message <200905111324.58673.vap...@gentoo.org> you wrote:
>
> ive filled it out some more ... i'm assuming this is the best place for such 
> information

Thanks.

> also, i dont really know this wiki, so i cheated with the FDT wiki link and
> used the full path since i was unable to guess at how to make it work 
> relatively.

See http://www.denx.de/wiki/TWiki/TextFormattingRules next time you
have such an issue. I fixed it.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Everyting looks interesting until you do it. Then you find it's  just
another job. - Terry Pratchett, _Moving Pictures_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Mike Frysinger
On Monday 11 May 2009 12:24:31 Mike Frysinger wrote:
> there is this FAQ, but i think we can add more info to it:
> http://www.denx.de/wiki/view/DULG/EthernetDoesNotWorkInLinux

ive filled it out some more ... i'm assuming this is the best place for such 
information

also, i dont really know this wiki, so i cheated with the FDT wiki link and 
used the full path since i was unable to guess at how to make it work 
relatively.
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Jean-Christophe PLAGNIOL-VILLARD
> > > >
> > > > this exactly what is done only write mac hw register
> > > > without init the eth stack
> > > >
> > > > before we do need to init the mac and detect the phy if we want to
> > > > store now we have to call the set_hw_enetaddr
> > >
> > > then we agree you're doing it wrong and this patch is not needed/wanted
> > >
> > > there is this FAQ, but i think we can add more info to it:
> > > http://www.denx.de/wiki/view/DULG/EthernetDoesNotWorkInLinux
> >
> > It does not work ether
> 
> your solution blatantly ignores the issues raised in the FAQ.  you cant push 
> a 
> change without clearing addressing those.
> 
> > how do you deal with multiple nic?
> 
> the ATAG/FDT tree handles most arches.
both not possible
> 
> for the rest you have two major issues to address:
>  - how do i pass it to the next OS ?
> * have the OS read the u-boot environment
> * have the OS read the command line
>  - how does the OS set it ?
> * add a board hook to set it
> * set it via user space and normal methods (`ifconfig hw`)
> 
> > how do set a mac for NFS Rootfs?
> 
> use initramfs
don't you think it's overkill to use a initramfs just for set a mac address??
> 
> > how do you boot a *mainline* kernel?
> 
> i dont know why you're emphasizing mainline.  if it's your board and if you 
> implement the change correctly, submit it to mainline.
because I already known RMK answer
NACK

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Ben Warren
Jean-Christophe PLAGNIOL-VILLARD wrote:
> init it at the eth_initialize
>
> this will allow to add later a hook to update the enetadd hw storage
> when it's updated in env or when the env is saved
>
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 
> Cc: Ben Warren 
> ---
>  include/net.h |2 ++
>  net/eth.c |4 
>  2 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/include/net.h b/include/net.h
> index 5a1d36e..2ed6263 100644
> --- a/include/net.h
> +++ b/include/net.h
> @@ -93,6 +93,7 @@ enum eth_state_t {
>  };
>  
>  struct eth_device {
> + int num;
>   char name[NAMESIZE];
>   unsigned char enetaddr[6];
>   int iobase;
> @@ -105,6 +106,7 @@ struct eth_device {
>  #ifdef CONFIG_MCAST_TFTP
>   int (*mcast) (struct eth_device*, u32 ip, u8 set);
>  #endif
> + int  (*set_hw_enetaddr) (struct eth_device*, bd_t*);
>   struct eth_device *next;
>   void *priv;
>  };
> diff --git a/net/eth.c b/net/eth.c
> index c6fa5b9..99bb6c2 100644
> --- a/net/eth.c
> +++ b/net/eth.c
> @@ -217,6 +217,8 @@ int eth_initialize(bd_t *bis)
>   if (eth_number)
>   puts (", ");
>  
> + dev->num = eth_number;
> +
>   printf("%s", dev->name);
>  
>   if (ethprime && strcmp (dev->name, ethprime) == 0) {
> @@ -240,6 +242,8 @@ int eth_initialize(bd_t *bis)
>   }
>  
>   memcpy(dev->enetaddr, env_enetaddr, 6);
> + if(dev->set_hw_enetaddr)
> + dev->set_hw_enetaddr(dev, bis);
>   }
>  
>   eth_number++;
>   
NAK, as convincingly explained by others.

regards,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-11 Thread Mike Frysinger
On Monday 11 May 2009 20:04:46 Jean-Christophe PLAGNIOL-VILLARD wrote:
> > > > > this exactly what is done only write mac hw register
> > > > > without init the eth stack
> > > > >
> > > > > before we do need to init the mac and detect the phy if we want to
> > > > > store now we have to call the set_hw_enetaddr
> > > >
> > > > then we agree you're doing it wrong and this patch is not
> > > > needed/wanted
> > > >
> > > > there is this FAQ, but i think we can add more info to it:
> > > > http://www.denx.de/wiki/view/DULG/EthernetDoesNotWorkInLinux
> > >
> > > It does not work ether
> >
> > your solution blatantly ignores the issues raised in the FAQ.  you cant
> > push a change without clearing addressing those.
> >
> > > how do you deal with multiple nic?
> >
> > the ATAG/FDT tree handles most arches.
>
> both not possible
>
> > for the rest you have two major issues to address:
> >  - how do i pass it to the next OS ?
> > * have the OS read the u-boot environment
> > * have the OS read the command line
> >  - how does the OS set it ?
> > * add a board hook to set it
> > * set it via user space and normal methods (`ifconfig hw`)
> >
> > > how do set a mac for NFS Rootfs?
> >
> > use initramfs
>
> don't you think it's overkill to use a initramfs just for set a mac
> address??

no, i think it's perfectly reasonable.  and considering you have no other 
option here that'll get merged ...
-mike
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-12 Thread Detlev Zundel
Hi,

>> > > how do set a mac for NFS Rootfs?
>> >
>> > use initramfs
>>
>> don't you think it's overkill to use a initramfs just for set a mac
>> address??
>
> no, i think it's perfectly reasonable.  and considering you have no other 
> option here that'll get merged ...

Can you please explain to me, why you think it to be reasonable to
demand providing an initramfs in the order of 100s of k to set an
attribute of a hardware device which has its own driver?

Apart from being constantly repeated, I do not understand this reasoning
at all.  My (old-school) belief was that an operating system deals with
abstracting the hardware thus userspace does not need to (nor should)
know too many hw details.

Knowing that there is not a clear distinction line, I still fail to see
why a mac address of a network interface should be handled by
userspace.  Can someone enlighten me here?

Thanks
  Detlev

-- 
Ftpd never switches uid and euid, it uses setfsuid(2) instead. The
main reason is that uid switching has been exploited in several
breakins, but the sheer ugliness of uid switching counts too.
 -- pure-ftpd(8)
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-12 Thread Mike Frysinger
On Tuesday 12 May 2009 04:48:28 Detlev Zundel wrote:
> >> > > how do set a mac for NFS Rootfs?
> >> >
> >> > use initramfs
> >>
> >> don't you think it's overkill to use a initramfs just for set a mac
> >> address??
> >
> > no, i think it's perfectly reasonable.  and considering you have no other
> > option here that'll get merged ...
>
> Can you please explain to me, why you think it to be reasonable to
> demand providing an initramfs in the order of 100s of k to set an
> attribute of a hardware device which has its own driver?
>
> Apart from being constantly repeated, I do not understand this reasoning
> at all.  My (old-school) belief was that an operating system deals with
> abstracting the hardware thus userspace does not need to (nor should)
> know too many hw details.
>
> Knowing that there is not a clear distinction line, I still fail to see
> why a mac address of a network interface should be handled by
> userspace.  Can someone enlighten me here?

no one said it must be done in userspace, that was just one method for doing 
it.  read the FAQ for other possibilities.
-mike
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-12 Thread Detlev Zundel
Hi Mike,

> On Tuesday 12 May 2009 04:48:28 Detlev Zundel wrote:
>> >> > > how do set a mac for NFS Rootfs?
>> >> >
>> >> > use initramfs
>> >>
>> >> don't you think it's overkill to use a initramfs just for set a mac
>> >> address??
>> >
>> > no, i think it's perfectly reasonable.  and considering you have no other
>> > option here that'll get merged ...
>>
>> Can you please explain to me, why you think it to be reasonable to
>> demand providing an initramfs in the order of 100s of k to set an
>> attribute of a hardware device which has its own driver?
>>
>> Apart from being constantly repeated, I do not understand this reasoning
>> at all.  My (old-school) belief was that an operating system deals with
>> abstracting the hardware thus userspace does not need to (nor should)
>> know too many hw details.
>>
>> Knowing that there is not a clear distinction line, I still fail to see
>> why a mac address of a network interface should be handled by
>> userspace.  Can someone enlighten me here?
>
> no one said it must be done in userspace, that was just one method for doing 
> it.  read the FAQ for other possibilities.

No you lost me completely.  The question cited above was whether you
find it plausible to use initramfs - and thus userspace - to set a mac
address.  You answered that you find this plausible.  This is what I do
not understand.  

I never ran across this outside of linux arm where people seriously
repeat the statement over and over that a whole initramfs with an
initial userspace and a pivot_root is plausible for nfs root whilst
patches of a few lines float around doing the same in the kernel.

Now proof by repetition is not my preferred form of understanding a
problem, so I was asking for an explanation from someone arguing along
the same lines.

Cheers
  Detlev

-- 
We can forgive a man for making a useful thing as long as he does not
admire it.  The only excuse  for making  a useless  thing is that one
admires it intensely.
--- Oscar Wilde
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-12 Thread Daniel Stenberg
On Tue, 12 May 2009, Detlev Zundel wrote:

> I never ran across this outside of linux arm where people seriously repeat 
> the statement over and over that a whole initramfs with an initial userspace 
> and a pivot_root is plausible for nfs root whilst patches of a few lines 
> float around doing the same in the kernel.
>
> Now proof by repetition is not my preferred form of understanding a problem, 
> so I was asking for an explanation from someone arguing along the same 
> lines.

The wiki page that explains the problem and provides the suggested solutions 
does not repeat that same mantra. It mentions the initramfs method as one way 
out of several - I don't think it mentions that solution as particularly 
better in any way. Wolfgang also repeated (most of) them here just a few mails 
ago in this thread.

-- 

  / daniel.haxx.se
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-12 Thread Scott Wood
On Tue, May 12, 2009 at 10:48:28AM +0200, Detlev Zundel wrote:
> Can you please explain to me, why you think it to be reasonable to
> demand providing an initramfs in the order of 100s of k to set an
> attribute of a hardware device which has its own driver?

Kind of defeats any space-usage argument against putting device trees in
ARM instead...

> Apart from being constantly repeated, I do not understand this reasoning
> at all.  My (old-school) belief was that an operating system deals with
> abstracting the hardware thus userspace does not need to (nor should)
> know too many hw details.

There's more to the operating system than the kernel.

-Scott
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-12 Thread Scott Wood
On Tue, May 12, 2009 at 02:04:46AM +0200, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
> > i dont know why you're emphasizing mainline.  if it's your board and if you 
> > implement the change correctly, submit it to mainline.
> because I already known RMK answer
> NACK

So go to RMK and say you need device trees because you got NACKed in
u-boot. :-)

-Scott
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-12 Thread Mike Frysinger
On Tuesday 12 May 2009 10:18:25 Detlev Zundel wrote:
> Hi Mike,
>
> > On Tuesday 12 May 2009 04:48:28 Detlev Zundel wrote:
> >> >> > > how do set a mac for NFS Rootfs?
> >> >> >
> >> >> > use initramfs
> >> >>
> >> >> don't you think it's overkill to use a initramfs just for set a mac
> >> >> address??
> >> >
> >> > no, i think it's perfectly reasonable.  and considering you have no
> >> > other option here that'll get merged ...
> >>
> >> Can you please explain to me, why you think it to be reasonable to
> >> demand providing an initramfs in the order of 100s of k to set an
> >> attribute of a hardware device which has its own driver?
> >>
> >> Apart from being constantly repeated, I do not understand this reasoning
> >> at all.  My (old-school) belief was that an operating system deals with
> >> abstracting the hardware thus userspace does not need to (nor should)
> >> know too many hw details.
> >>
> >> Knowing that there is not a clear distinction line, I still fail to see
> >> why a mac address of a network interface should be handled by
> >> userspace.  Can someone enlighten me here?
> >
> > no one said it must be done in userspace, that was just one method for
> > doing it.  read the FAQ for other possibilities.
>
> No you lost me completely.  The question cited above was whether you
> find it plausible to use initramfs - and thus userspace - to set a mac
> address.  You answered that you find this plausible.  This is what I do
> not understand.
>
> I never ran across this outside of linux arm where people seriously
> repeat the statement over and over that a whole initramfs with an
> initial userspace and a pivot_root is plausible for nfs root whilst
> patches of a few lines float around doing the same in the kernel.

i never said that a completely populated initramfs was needed.  it can be 
accomplished pretty easily with very little code.  
-mike
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-13 Thread Detlev Zundel
Hi Scott,

> On Tue, May 12, 2009 at 10:48:28AM +0200, Detlev Zundel wrote:
>> Can you please explain to me, why you think it to be reasonable to
>> demand providing an initramfs in the order of 100s of k to set an
>> attribute of a hardware device which has its own driver?
>
> Kind of defeats any space-usage argument against putting device trees in
> ARM instead...

Good point.

>> Apart from being constantly repeated, I do not understand this reasoning
>> at all.  My (old-school) belief was that an operating system deals with
>> abstracting the hardware thus userspace does not need to (nor should)
>> know too many hw details.
>
> There's more to the operating system than the kernel.

Sure - but how does this affect the question at hand?

Cheers
  Detlev

-- 
Practice random senselessness and act kind of beautiful.
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-13 Thread Detlev Zundel
Hi Mike,

>> I never ran across this outside of linux arm where people seriously
>> repeat the statement over and over that a whole initramfs with an
>> initial userspace and a pivot_root is plausible for nfs root whilst
>> patches of a few lines float around doing the same in the kernel.
>
> i never said that a completely populated initramfs was needed.  it can be 
> accomplished pretty easily with very little code.  

Sure, but still, how big is such an initramfs, do you have any numbers
here?

And how many lines of C code does it take to set the MAC in the kernel?
Is this really worth it?

Cheers
  Detlev

-- 
Basically,  Barnes & Noble separates things by how old they are  -- current
stuff is "Fiction", stuff from 20 years ago is "Literature", stuff from 100
years ago is "Classics", stuff from 400 years ago is "Shakespeare" [..] and
stuff from 2000 years ago is "History".
 -- James "Kibo" Parry in 
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-13 Thread Mike Frysinger
On Wednesday 13 May 2009 04:41:29 Detlev Zundel wrote:
> >> I never ran across this outside of linux arm where people seriously
> >> repeat the statement over and over that a whole initramfs with an
> >> initial userspace and a pivot_root is plausible for nfs root whilst
> >> patches of a few lines float around doing the same in the kernel.
> >
> > i never said that a completely populated initramfs was needed.  it can be
> > accomplished pretty easily with very little code.
>
> Sure, but still, how big is such an initramfs, do you have any numbers
> here?
>
> And how many lines of C code does it take to set the MAC in the kernel?
> Is this really worth it?

that is the problem of whoever needs this functionality.
-mike
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/4] net: extend the netdev to have a common way to set the hw mac address

2009-05-15 Thread Detlev Zundel
Hi Mike,

> On Wednesday 13 May 2009 04:41:29 Detlev Zundel wrote:
>> >> I never ran across this outside of linux arm where people seriously
>> >> repeat the statement over and over that a whole initramfs with an
>> >> initial userspace and a pivot_root is plausible for nfs root whilst
>> >> patches of a few lines float around doing the same in the kernel.
>> >
>> > i never said that a completely populated initramfs was needed.  it can be
>> > accomplished pretty easily with very little code.
>>
>> Sure, but still, how big is such an initramfs, do you have any numbers
>> here?
>>
>> And how many lines of C code does it take to set the MAC in the kernel?
>> Is this really worth it?
>
> that is the problem of whoever needs this functionality.

Ah.  Now this is exactly what reminded me of the ARM Linux ML in the
first place :(

Seeing that I do not learn anything new here, I'll stop.

Cheers
  Detlev

-- 
We can forgive a man for making a useful thing as long as he does not
admire it.  The only excuse  for making  a useless  thing is that one
admires it intensely.
--- Oscar Wilde
--
DENX Software Engineering GmbH,  MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: d...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot