
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