eth0 doesn't get a valid MAC address on startup

Bug #817315 reported by Eric Miao
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Linaro Android
Fix Released
High
Zach Pfeffer
Linaro U-Boot
Fix Released
High
John Rigby

Bug Description

This happens on imx51 EVK. eth0 was not automatically up unless a valid MAC address was configured. It started up with an invalid MAC address of 00:00:00:00:00:00. u-boot gave some relevant warnings as below:

U-Boot 2011.06 (Jul 27 2011 - 00:12:51)

CPU: Freescale i.MX51 family rev3.0 at 800 MHz
Reset cause: WDOG
Board: MX51EVK
DRAM: 512 MiB
MMC: FSL_ESDHC: 0, FSL_ESDHC: 1
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: got MAC address from fuse: 00:04:9f:01:2c:31
FECWarning: failed to set MAC address

MAC address was obtained from the FUSE setting but was unable to program to the FEC registers due to unknown reason.

Tags: imx51evk imx53

Related branches

Revision history for this message
Eric Miao (eric.y.miao) wrote :

This happens on mx53 QuickStart as well.

summary: - [mx51evk] eth0 doesn't get a valid MAC address on startup
+ eth0 doesn't get a valid MAC address on startup
tags: added: mx51evk mx53loco
Eric Miao (eric.y.miao)
visibility: private → public
Eric Miao (eric.y.miao)
Changed in linaro-landing-team-freescale:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Eric Miao (eric.y.miao)
Revision history for this message
Jason Liu (r64343) wrote :

see: https://bugs.launchpad.net/lava-lab/+bug/812555

And comments from Jason Liu (r64343).

Revision history for this message
Eric Miao (eric.y.miao) wrote :

The bug is caused by behavior changed in commit:

commit 48506a2cde2458fa1f8c5993afc98e5a4617e1d3
Author: Simon Glass <email address hidden>
Date: Thu May 5 09:52:07 2011 -0700

    Add Ethernet hardware MAC address framework to usbnet

    Built-in Ethernet adapters support setting the mac address by means of a
    ethaddr environment variable for each interface (ethaddr, eth1addr, eth2addr).

    This adds similar support to the USB network side, using the names
    usbethaddr, usbeth1addr, etc. They are kept separate since we don't want
    a USB device taking the MAC address of a built-in device or vice versa.

    TEST=build, test on harmony, with setenv usbethaddr c0:c1:c0:13:0b:b8, bootp,
    tftp ...

    Signed-off-by: Simon Glass <email address hidden>

And can be fixed simply by ignoring the return value of eth_getenv_enetaddr_by_index() which should be the right fix, as it allows use of dev->enetaddr as fall-back, fec_mxc.c will fill this field up with the correct MAC address obtained from fuse. The attached patch fixed this issue and has been submitted to upstream.

Revision history for this message
Eric Miao (eric.y.miao) wrote :

John, could you please help merge this patch in 11.08 release before it's merged by upstream. It's currently blocking startup of many imx5 boards.

Changed in u-boot-linaro:
assignee: nobody → John Rigby (jcrigby)
importance: Undecided → High
milestone: none → 11.08
status: New → Triaged
Revision history for this message
Eric Miao (eric.y.miao) wrote :

This is a two fold problem:

1. u-boot should configure MAC address correctly for its own use
2. kernel should not have any assumption that the bootloader will help get its MAC address configured correctly through registers, as the IP could be reset and register values could be uncertain.

There should be another patch to fix this incorrect assumption within the kernel.

Revision history for this message
Jason Liu (r64343) wrote :

Then we need fix kernel to avoid such assumption and also get MAC address from FUSE and configure it agin.

Eric Miao (eric.y.miao)
Changed in linaro-landing-team-freescale:
milestone: none → update
Revision history for this message
Hong-Xing.Zhu (richard-zhuhongxing) wrote :

The FUSE should had been done before release the boards out of fsl.
I can boot up the the linus v3.1-rc1 with the latest Linaro-u-boot-2011.08 linaro uboot.

Revision history for this message
Hong-Xing.Zhu (richard-zhuhongxing) wrote :
Download full text (7.1 KiB)

without that patch"0001-net-eth.c-fix-eth_write_hwaddr-to-use-dev-enetaddr-a.patch ", I can boot the mx53 loco board.
here is the log:
-----------------------------------------------------------
Environment size: 1201/8188 bytes
MX53LOCO U-Boot > reset
resetting ...

U-Boot 2011.06-dirty (Aug 16 2011 - 16:02:05)

CPU: Freescale i.MX53 family rev2.0 at 800 MHz
Reset cause: WDOG
Board: MX53 LOCO
I2C: ready
DRAM: 1 GiB
CPU: Switch CPU clock to 1GHZ OK
DDR: Switch DDR clock to 400MHz OK
MMC: FSL_ESDHC: 0, FSL_ESDHC: 1
In: serial
Out: serial
Err: serial
Net: got MAC address from fuse: 00:04:9f:01:57:0a
FECRZ_DEBUG base_name is NULL
Warning: failed to set MAC address <-------------- This is just a warning msg, the uboot mac addr program is not mandatory required.

Hit any key to stop autoboot: 0
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 44
*** Unhandled DHCP Option in OFFER/ACK: 46
*** Unhandled DHCP Option in OFFER/ACK: 44
*** Unhandled DHCP Option in OFFER/ACK: 46
DHCP client bound to address 10.192.242.172
Using FEC device
TFTP from server 10.192.225.216; our IP address is 10.192.242.172; sending through gateway 10.192.242.254
Filename 'r65037/uImage.mx53.30'.
Load address: 0x70800000
Loading: #################################################################
         #################################################################
         #######
done
Bytes transferred = 2005912 (1e9b98 hex)
## Error: "bootargs_base" not defined
## Booting kernel from Legacy Image at 70800000 ...
   Image Name: Linux-3.0.0+
   Image Type: ARM Linux Kernel Image (uncompressed)
   Data Size: 2005848 Bytes = 1.9 MiB
   Load Address: 70008000
   Entry Point: 70008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 3.0.0+ (x@x-VirtualBox) (gcc version 4.5.1 (Ubuntu/Linaro 4.5.1-7ubuntu1) ) #4 Wed Aug 17 17:23:12 CST 2011
CPU: ARMv7 Processor [412fc085] revision 5 (ARMv7), cr=10c53c7f
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: Freescale MX53 LOCO Board
Ignoring RAM at b0000000-cfffffff (vmalloc region overlap).
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
Kernel command line: console=ttymxc0,115200 root=/dev/nfs ip=dhcp nfsroot=10.192.225.216:/home/r65037/nfs/rootfs_mx5x_10.11 rw, v3, tcp
PID hash table entries: 2048 (order: 1, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 512MB = 512MB total
Memory: 515512k/515512k available, 8776k reserved, 0K highmem
Virtual kernel memory layout:
    vector : 0xffff0000 - 0xffff1000 ( 4 kB)
    fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
    DMA : 0xffc00000 - 0xffe00000 ( 2 MB)
    vmalloc : 0xe0800000 - 0xf4000000 ( 312 MB)
    lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
    modules : 0xbf000000 - 0xc0000000 ( 16 MB)
      .init : 0xc0008000 - 0xc0024000 ( 112 kB)
      .text : 0xc0024000 - 0xc03b4000 (3648 kB)
      .data : 0xc03b4000 - 0xc03d6...

Read more...

Revision history for this message
John Rigby (jcrigby) wrote :

So do comments 7 & 8 mean that this is bug can be marked fixed?

Revision history for this message
John Rigby (jcrigby) wrote :
Changed in u-boot-linaro:
status: Triaged → Fix Committed
status: Fix Committed → Fix Released
Revision history for this message
Eric Miao (eric.y.miao) wrote :

As the issue has been fixed in u-boot, lower the priority of a fix in kernel.

Changed in linaro-landing-team-freescale:
importance: High → Low
Revision history for this message
Zach Pfeffer (pfefferz) wrote :

Okay, so this is fixed in uboot? I see:
U-Boot 2011.06 (Sep 27 2011 - 16:41:29)

CPU: Freescale i.MX53 family rev2.1 at 800 MHz
Reset cause: POR
Board: MX53 LOCO
I2C: ready
DRAM: 1 GiB
CPU: Switch CPU clock to 1GHZ OK
DDR: Switch DDR clock to 400MHz OK
MMC: FSL_ESDHC: 0, FSL_ESDHC: 1
*** Warning - bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: got MAC address from fuse: 00:04:9f:01:b3:79
FECWarning: failed to set MAC address

Hit any key to stop autoboot: 0

...it looks like its not fixed because of the FECWarning.

Changed in linaro-android:
importance: Undecided → High
assignee: nobody → Zach Pfeffer (pfefferz)
Revision history for this message
Zach Pfeffer (pfefferz) wrote :
Revision history for this message
John Rigby (jcrigby) wrote :

2011.09 u-boot moved to new upstream base. However, I attempted to bring all mx patches along:

 net/eth.c: fix eth_write_hwaddr() to use dev->enetaddr as fall back
 mx53loco: workaround VPU TO2 Errata by increasing peripheral voltage
 mx53loco: Add power init support
 mx53loco: PMIC: Add dialog pmic support
 mx5: Add clock config interface

Eric, can you tell me what is missing?

Revision history for this message
Zach Pfeffer (pfefferz) wrote :

With U-Boot 2011.09-rc2 (Sep 27 2011 - 22:48:00) I see Ethernet (and networking) work okay on Android.

Changed in linaro-android:
status: New → In Progress
milestone: none → 11.10
Fathi Boudra (fboudra)
tags: added: imx51evk imx53
removed: mx51evk mx53loco
Eric Miao (eric.y.miao)
tags: added: mx51evk mx53
removed: imx51evk imx53
Fathi Boudra (fboudra)
tags: added: imx51evk imx53
removed: mx51evk mx53
Revision history for this message
Zach Pfeffer (pfefferz) wrote :
Changed in linaro-android:
status: In Progress → Fix Released
Changed in linaro-landing-team-freescale:
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.