* [U-Boot] what's the uboot way to pass eth*addr to linux ? @ 2010-02-19 17:50 Philippe De Muyter 2010-02-20 7:30 ` Maxim Podbereznyi 0 siblings, 1 reply; 12+ messages in thread From: Philippe De Muyter @ 2010-02-19 17:50 UTC (permalink / raw) To: u-boot Hello I have a problem : my (coldfire) linux kernel does not reuse the mac addresses known by u-boot as ethaddr and eth1addr. I have read doc/README.enetaddr, that states : struct bd_info [...] are temporary copies of the MAC address only for the purpose of passing this information to an OS kernel we are about to boot. but I see no field in bd_info that could be set before booting linux. I thought that the address of the environment zone could be given to linux, but I do not see where either. So what's the recommended/supported way to inform the kernel of the mac addresses of all the ethernet interfaces ? Philippe ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-19 17:50 [U-Boot] what's the uboot way to pass eth*addr to linux ? Philippe De Muyter @ 2010-02-20 7:30 ` Maxim Podbereznyi 2010-02-20 9:37 ` Philippe De Muyter 2010-02-20 10:38 ` Philippe De Muyter 0 siblings, 2 replies; 12+ messages in thread From: Maxim Podbereznyi @ 2010-02-20 7:30 UTC (permalink / raw) To: u-boot Hi Philippe! May be it is a little bit tricky but you can just read the u-boot environment from you Linux driver and use the "ethaddr" variable. I did the same for osk5912 2010/2/19 Philippe De Muyter <phdm@macqel.be> > Hello > > I have a problem : my (coldfire) linux kernel does not reuse the mac > addresses known by u-boot as ethaddr and eth1addr. > > I have read doc/README.enetaddr, that states : > > struct bd_info [...] > are temporary copies of the MAC address only for the > purpose of passing this information to an OS kernel we are about > to boot. > > but I see no field in bd_info that could be set before booting linux. > > I thought that the address of the environment zone could be given > to linux, but I do not see where either. > > So what's the recommended/supported way to inform the kernel of the mac > addresses of all the ethernet interfaces ? > > Philippe > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > http://lists.denx.de/mailman/listinfo/u-boot > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-20 7:30 ` Maxim Podbereznyi @ 2010-02-20 9:37 ` Philippe De Muyter 2010-02-20 15:08 ` Wolfgang Denk 2010-03-05 19:32 ` Mike Frysinger 2010-02-20 10:38 ` Philippe De Muyter 1 sibling, 2 replies; 12+ messages in thread From: Philippe De Muyter @ 2010-02-20 9:37 UTC (permalink / raw) To: u-boot Hi Maxim, On Sat, Feb 20, 2010 at 10:30:32AM +0300, Maxim Podbereznyi wrote: > Hi Philippe! > > May be it is a little bit tricky but you can just read the u-boot > environment from you Linux driver and use the "ethaddr" variable. I did the > same for osk5912 Thanks, but I need something more straightforward. The ethernet driver in linux must know the mac address at startup to be able to have root on nfs. Previously, the mac addresses were stored in the bd_info struct, but that has been removed, but alas not replaced by a common mechanism for all architectures. Philippe ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-20 9:37 ` Philippe De Muyter @ 2010-02-20 15:08 ` Wolfgang Denk 2010-02-20 23:59 ` Philippe De Muyter 2010-03-05 19:32 ` Mike Frysinger 1 sibling, 1 reply; 12+ messages in thread From: Wolfgang Denk @ 2010-02-20 15:08 UTC (permalink / raw) To: u-boot Dear Philippe De Muyter, In message <20100220093717.GA9602@frolo.macqel> you wrote: > > Previously, the mac addresses were stored in the bd_info struct, but that > has been removed, but alas not replaced by a common mechanism for all > architectures. Complain about this to the Linux architecture maintainers - there have been many and longf discussions about this before. Today we consider the device tree to be the Right Thing (TM) to pass such information to the kernel, and more and more architectures use this method. As long as it's not available for your architecture, the most straightforward way is to pass an "ethaddr=..." argument on the kernel command line. Drivers can pick it up easily there. Just don't expect that such Linux driver code will be accepted for mainline. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-20 15:08 ` Wolfgang Denk @ 2010-02-20 23:59 ` Philippe De Muyter 2010-02-21 16:29 ` Wolfgang Denk 0 siblings, 1 reply; 12+ messages in thread From: Philippe De Muyter @ 2010-02-20 23:59 UTC (permalink / raw) To: u-boot Hello Wolfgang, On Sat, Feb 20, 2010 at 04:08:45PM +0100, Wolfgang Denk wrote: > Dear Philippe De Muyter, > > In message <20100220093717.GA9602@frolo.macqel> you wrote: > > > > Previously, the mac addresses were stored in the bd_info struct, but that > > has been removed, but alas not replaced by a common mechanism for all > > architectures. > > Complain about this to the Linux architecture maintainers - there have > been many and longf discussions about this before. Do you mean lkml or some other mailing list or individual ? > > Today we consider the device tree to be the Right Thing (TM) to pass > such information to the kernel, and more and more architectures use > this method. AFAIK, device trees are powerpc-specific and my board is coldfire based. > > As long as it's not available for your architecture, the most > straightforward way is to pass an "ethaddr=..." argument on the > kernel command line. Drivers can pick it up easily there. Just don't > expect that such Linux driver code will be accepted for mainline. I don't like that method because it can easily be forgotten by someone changing bootargs for some other reason. IMO bootargs should only be used for configuration choices. I'd rather go for an additional parameter given by u-boot to linux with the address of the used u-boot environment, passed the same way that the address of bd_info is given to linux (for coldfire's, that's on the stack) Philippe ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-20 23:59 ` Philippe De Muyter @ 2010-02-21 16:29 ` Wolfgang Denk 0 siblings, 0 replies; 12+ messages in thread From: Wolfgang Denk @ 2010-02-21 16:29 UTC (permalink / raw) To: u-boot Dear Philippe De Muyter, In message <20100220235945.GA15901@frolo.macqel> you wrote: > > > Complain about this to the Linux architecture maintainers - there have > > been many and longf discussions about this before. > > Do you mean lkml or some other mailing list or individual ? I had especially the ARM list and RMK in mind. > > Today we consider the device tree to be the Right Thing (TM) to pass > > such information to the kernel, and more and more architectures use > > this method. > > AFAIK, device trees are powerpc-specific and my board is coldfire based. Several other architecture use the device tree as well, and more are following. For example, an adaption for ARM is on the way right now. > > As long as it's not available for your architecture, the most > > straightforward way is to pass an "ethaddr=..." argument on the > > kernel command line. Drivers can pick it up easily there. Just don't > > expect that such Linux driver code will be accepted for mainline. > > I don't like that method because it can easily be forgotten by someone > changing bootargs for some other reason. IMO bootargs should only be used for > configuration choices. Well, that's mostly a matter of taste. At least it's an architecutre independent, standardized way to pass information. > I'd rather go for an additional parameter given by u-boot to linux with > the address of the used u-boot environment, passed the same way that the > address of bd_info is given to linux (for coldfire's, that's on the stack) i. e. you create yet another, non-standard solution - exactly what you complained about originally. 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: wd at denx.de Humanity has the stars in its future, and that future is too important to be lost under the burden of juvenile folly and ignorant superstition. - Isaac Asimov ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-20 9:37 ` Philippe De Muyter 2010-02-20 15:08 ` Wolfgang Denk @ 2010-03-05 19:32 ` Mike Frysinger 1 sibling, 0 replies; 12+ messages in thread From: Mike Frysinger @ 2010-03-05 19:32 UTC (permalink / raw) To: u-boot On Saturday 20 February 2010 04:37:17 Philippe De Muyter wrote: > On Sat, Feb 20, 2010 at 10:30:32AM +0300, Maxim Podbereznyi wrote: > > Hi Philippe! > > > > May be it is a little bit tricky but you can just read the u-boot > > environment from you Linux driver and use the "ethaddr" variable. I did > > the same for osk5912 > > Thanks, but I need something more straightforward. The ethernet driver in > linux must know the mac address at startup to be able to have root on nfs. a small static initramfs would take care of this just fine -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/20100305/25715b0e/attachment.pgp ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-20 7:30 ` Maxim Podbereznyi 2010-02-20 9:37 ` Philippe De Muyter @ 2010-02-20 10:38 ` Philippe De Muyter 2010-02-20 14:49 ` Maxim Podbereznyi 1 sibling, 1 reply; 12+ messages in thread From: Philippe De Muyter @ 2010-02-20 10:38 UTC (permalink / raw) To: u-boot Hi Maxim, On Sat, Feb 20, 2010 at 10:30:32AM +0300, Maxim Podbereznyi wrote: > Hi Philippe! > > May be it is a little bit tricky but you can just read the u-boot > environment from you Linux driver and use the "ethaddr" variable. I did the > same for osk5912 Sorry, I replied too fast, It seems that I misunderstood your answer. How do you access the U-boot environment from the linux driver ? Is there a linux kernel library function to retrieve one element of a U-boot environment ? Does U-boot tell linux where the U-boot environment resides in memory ? Philippe ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-20 10:38 ` Philippe De Muyter @ 2010-02-20 14:49 ` Maxim Podbereznyi 2010-02-21 0:47 ` Philippe De Muyter 0 siblings, 1 reply; 12+ messages in thread From: Maxim Podbereznyi @ 2010-02-20 14:49 UTC (permalink / raw) To: u-boot Hi! Well, I know nothing about coldfire but for osk5912 it is well known where all partitions reside on the flash. You can find it the u-boot config file for coldfire. The code for MontaVista with kernel 2.4: static int nicGetMacAddress(u8* macaddr) { int ret = 0; if (check_mem_region(FLASH_PARAM_ ADDR, FLASH_PARAM_SIZE)) { printk("enc28j60: flash memory already in use\n"); return ENXIO; } else { unsigned long base = FLASH_PARAM_ADDR; unsigned long size = FLASH_PARAM_SIZE; void *vbase; unsigned char *sf = NULL; int res; int i; char *endptr; res = request_mem_region(base, size, "enc28j60-flash"); if (!res) { printk("enc28j60: flash memory mapping failed\n"); return ENXIO; } vbase = ioremap(base, size); if (!vbase) { printk("enc28j60: flash memory ioremap failed\n"); return ENOMEM; } sf = (char *)vbase; endptr = fw_getenv(sf, "ethaddr"); if (endptr) for (i=0; i<6; i++) { // IPv4 unsigned long tmp; char *str = endptr+1; tmp = enc28_strtoul(str, &endptr, 16); *macaddr++ = tmp; } else { printk("enc28j60: no ethaddr variable in u-boot environment"); ret = EINVAL; } iounmap(vbase); release_resource(res); } return ret; } Hope you can easily adapt it to your kernel! 2010/2/20 Philippe De Muyter <phdm@macqel.be> > Hi Maxim, > > On Sat, Feb 20, 2010 at 10:30:32AM +0300, Maxim Podbereznyi wrote: > > Hi Philippe! > > > > May be it is a little bit tricky but you can just read the u-boot > > environment from you Linux driver and use the "ethaddr" variable. I did > the > > same for osk5912 > > Sorry, I replied too fast, It seems that I misunderstood your answer. > How do you access the U-boot environment from the linux driver ? > Is there a linux kernel library function to retrieve one element of a > U-boot environment ? Does U-boot tell linux where the U-boot environment > resides in memory ? > > Philippe > ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-20 14:49 ` Maxim Podbereznyi @ 2010-02-21 0:47 ` Philippe De Muyter 2010-02-21 4:07 ` Ben Warren 2010-02-21 16:25 ` Wolfgang Denk 0 siblings, 2 replies; 12+ messages in thread From: Philippe De Muyter @ 2010-02-21 0:47 UTC (permalink / raw) To: u-boot Hi Maxim, On Sat, Feb 20, 2010 at 05:49:53PM +0300, Maxim Podbereznyi wrote: > > The code for MontaVista with kernel 2.4: > > static int nicGetMacAddress(u8* macaddr) > { [...] > endptr = fw_getenv(sf, "ethaddr"); [...] > } > > Hope you can easily adapt it to your kernel! So the library fucntion to retrieve the value of a u-boot environment variable is 'fw_getenv'. I do not have that function in my linux sources. Philippe ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-21 0:47 ` Philippe De Muyter @ 2010-02-21 4:07 ` Ben Warren 2010-02-21 16:25 ` Wolfgang Denk 1 sibling, 0 replies; 12+ messages in thread From: Ben Warren @ 2010-02-21 4:07 UTC (permalink / raw) To: u-boot Hi Philippe, On Sat, Feb 20, 2010 at 4:47 PM, Philippe De Muyter <phdm@macqel.be> wrote: > Hi Maxim, > > On Sat, Feb 20, 2010 at 05:49:53PM +0300, Maxim Podbereznyi wrote: > > > > The code for MontaVista with kernel 2.4: > > > > static int nicGetMacAddress(u8* macaddr) > > { > [...] > > endptr = fw_getenv(sf, "ethaddr"); > [...] > > } > > > > Hope you can easily adapt it to your kernel! > > So the library fucntion to retrieve the value of a u-boot environment > variable is 'fw_getenv'. I do not have that function in my linux sources. > > It's a tool in the U-boot source tree. > Philippe > regards, Ben ^ permalink raw reply [flat|nested] 12+ messages in thread
* [U-Boot] what's the uboot way to pass eth*addr to linux ? 2010-02-21 0:47 ` Philippe De Muyter 2010-02-21 4:07 ` Ben Warren @ 2010-02-21 16:25 ` Wolfgang Denk 1 sibling, 0 replies; 12+ messages in thread From: Wolfgang Denk @ 2010-02-21 16:25 UTC (permalink / raw) To: u-boot Dear Philippe De Muyter, In message <20100221004733.GA22011@frolo.macqel> you wrote: > > > Hope you can easily adapt it to your kernel! > > So the library fucntion to retrieve the value of a u-boot environment > variable is 'fw_getenv'. I do not have that function in my linux sources. Did I not already point you to tools/env/* ? 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: wd at denx.de Without freedom of choice there is no creativity. -- Kirk, "The return of the Archons", stardate 3157.4 ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-03-05 19:32 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-02-19 17:50 [U-Boot] what's the uboot way to pass eth*addr to linux ? Philippe De Muyter 2010-02-20 7:30 ` Maxim Podbereznyi 2010-02-20 9:37 ` Philippe De Muyter 2010-02-20 15:08 ` Wolfgang Denk 2010-02-20 23:59 ` Philippe De Muyter 2010-02-21 16:29 ` Wolfgang Denk 2010-03-05 19:32 ` Mike Frysinger 2010-02-20 10:38 ` Philippe De Muyter 2010-02-20 14:49 ` Maxim Podbereznyi 2010-02-21 0:47 ` Philippe De Muyter 2010-02-21 4:07 ` Ben Warren 2010-02-21 16:25 ` Wolfgang Denk
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox