[U-Boot-Users] fdt/fdt_fixup_ethernet

Marc Leeman marc.leeman at gmail.com
Mon Jun 23 16:00:28 CEST 2008


Since I moved to FDT (from the previous OF implementation), I get the
following behaviour.

Our board has a small 128 byte flash that stores a number of MAC
addresses. I use a small command (getmac) to get the data from the
devices and store them in the u-boot environment (ethaddr, eth1addr,
eth2addr, eth3addr, eth4addr and eth5addr):

# fw_printenv |grep eth
netdev=eth0
ethact=TSEC0
ethaddr=00:04:a5:01:05:a8
eth1addr=00:04:a5:01:05:a8
eth2addr=00:04:a5:01:05:a9
eth3addr=00:04:a5:01:05:aa
eth4addr=00:04:a5:01:05:ab

The hardcoded MAC addresses are local range:
#define CONFIG_ETHADDR          02:04:a5:01:05:ce
#define CONFIG_ETH1ADDR         02:04:a5:01:05:ce

There are no defines for ETH2-ETH5.

the boot command is:

getmac; setcy22150; run runsystem

with runsystem:
"runsystem=if itest $kernel -eq 0;"
	"then run scriptcmd;"
	"else if itest $kernel -eq 1;"
	"then run runupgr;"
	"else if itest $kernel -eq 2;"
	"then run runfact;"
	"else if itest $kernel -eq 3;"
	"then setenv kernel 2; saveenv; run runupgr;" 
	"else setenv kernel 2; saveenv; run runfact;" 

The first time a boards boots, it will not find a valid environment in
flash and will store its hardcoded values. It will then get the mac
addresses from a seperate device; store them in the u-boot environment
and save it in flash (else branch runsystem).

However, the MAC addresses that are passed to the kernel are a mix of
the hardcoded defaults and the ones retrieved from the mac flash:

U-Boot 1.3.3-svn28560 (Jun 23 2008 - 15:03:58) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal
Hard

CPU:   e300c1, MPC8347_PBGA_E, Rev: 1.1 at 349.999 MHz, CSB: 233.333 MHz
Board: Barco BARCO8347NGS103 Platform.
I2C:   ready
DRAM:  64 MB
FLASH: 16 MB
*** Warning - bad CRC, using default environment

PCI1: 32-bit on PMC1
PCI2: 32-bit on PMC2, PMC3
PCI:   Bus Dev VenId DevId Class Int
        00  13  1172  0005  ff00  00
In:    serial
Out:   serial
Err:   serial
Net:   TSEC0, TSEC1

Barco U-Boot Port

Hit any key to stop autoboot:  0 
MAC 0 (ethaddr): 00:04:a5:01:05:a8
MAC 1 (eth1addr): 00:04:a5:01:05:a8
MAC 2 (eth2addr): 00:04:a5:01:05:a9
MAC 3 (eth3addr): 00:04:a5:01:05:aa
MAC 4 (eth4addr): 00:04:a5:01:05:ab
Setting CY22150 Clock divider, ....  CY22150 set
Saving Environment to Flash...
Un-Protected 1 sectors
Un-Protected 1 sectors
Erasing Flash...
. done
Erased 1 sectors
Writing to Flash... done
Protected 1 sectors
Protected 1 sectors
## Booting kernel from Legacy Image at fe080000 ...
   Image Name:   Linux-2.6.24
   Created:      2008-06-23   8:55:45 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    927965 Bytes = 906.2 kB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
## Flattened Device Tree blob at fefc0000
   Booting using the fdt blob at 0xfefc0000
   Loading Device Tree to 007fd000, end 007fffff ... OK
Fixup ethernet device 0 (00:04:a5:01:05:a8). <-----
Fixup ethernet device 1 (02:04:a5:01:05:ce). <-----
Fixup ethernet device 2 (00:00:00:00:00:00). <-----
[    0.037465] PCI: Cannot allocate resource region 0 of device 0000:00:00.0
[    0.037491] PCI: Cannot allocate resource region 2 of device 0000:00:00.0
[    0.037509] PCI: Cannot allocate resource region 4 of device 0000:00:00.0
init started: BusyBox v1.10.3 (2008-06-23 10:57:01 CEST)

Please press Enter to activate this console. 

This only occurs the first time. When u-boot gets initialised with a
valid environment (containing the correct MAC addresses), the correct
MAC addresses get passed. Before the LIBFDT, this was not the case (and
the MAC addresses were set properly).

starting pid 325, tty '/dev/ttyS0': '/bin/sh --login'


BusyBox v1.10.3 (2008-06-23 10:57:01 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

# reboot
The system is going down NOW!
Sending SIGTERM to all processes
Requesting system reboot
[  500.869058] Restarting system.


U-Boot 1.3.3-svn28560 (Jun 23 2008 - 15:03:58) MPC83XX

Reset Status: Software Hard, External/Internal Soft, External/Internal
Hard

CPU:   e300c1, MPC8347_PBGA_E, Rev: 1.1 at 349.999 MHz, CSB: 233.333 MHz
Board: Barco BARCO8347NGS103 Platform.
I2C:   ready
DRAM:  64 MB
FLASH: 16 MB
PCI1: 32-bit on PMC1
PCI2: 32-bit on PMC2, PMC3
PCI:   Bus Dev VenId DevId Class Int
        00  13  1172  0005  ff00  00
In:    serial
Out:   serial
Err:   serial
Net:   TSEC0, TSEC1

Barco U-Boot Port

Hit any key to stop autoboot:  0 
MAC 0 (ethaddr): 00:04:a5:01:05:a8
MAC 1 (eth1addr): 00:04:a5:01:05:a8
MAC 2 (eth2addr): 00:04:a5:01:05:a9
MAC 3 (eth3addr): 00:04:a5:01:05:aa
MAC 4 (eth4addr): 00:04:a5:01:05:ab
Setting CY22150 Clock divider, ....  CY22150 set
## Booting kernel from Legacy Image at fe080000 ...
   Image Name:   Linux-2.6.24-barco1
   Created:      2008-06-23   8:55:45 UTC
   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
   Data Size:    927965 Bytes = 906.2 kB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
## Flattened Device Tree blob at fefc0000
   Booting using the fdt blob at 0xfefc0000
   Loading Device Tree to 007fd000, end 007fffff ... OK
Fixup ethernet device 0 (00:04:a5:01:05:a8).
Fixup ethernet device 1 (00:04:a5:01:05:a8).
Fixup ethernet device 2 (00:04:a5:01:05:a9).
[    0.037465] PCI: Cannot allocate resource region 0 of device 0000:00:00.0
[    0.037491] PCI: Cannot allocate resource region 2 of device 0000:00:00.0
[    0.037509] PCI: Cannot allocate resource region 4 of device 0000:00:00.0
init started: BusyBox v1.10.3 (2008-06-23 10:57:01 CEST)

Please press Enter to activate this console. 


-- 
  greetz, marc
Doesn't simply shooting them dead strike you as viable?
	Rygel - Self Inflicted Wounds - Could'a, Would'a, Should'a
chiana 2.6.18-4-ixp4xx #1 Tue Mar 27 18:01:56 BST 2007 GNU/Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080623/ef3f3df0/attachment.pgp 


More information about the U-Boot mailing list