I am bringing up a product based around the LS1021A. When I use an image built from Layerscape SDK 17.12 (I use the LS1021A-TWR config with some changes), Ethernet works correctly. This is eTSEC1, using SGMII to a Marvell PHY.
But, when I use my own OpenWRT version (using the exact same kernel and U-Boot trees from LSDK 17.12), I can't get the Ethernet interface to work:
# ifconfig eth0 up
root@OpenWrt:/# [ 23.528112] fsl-gianfar soc:ethernet@2d10000 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
root@OpenWrt:/# ifconfig eth0
eth0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:1
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Base address:0x9000
root@OpenWrt:/# udhcpc -i eth0
udhcpc (v1.19.4) started
Sending discover...
Sending discover...
Sending discover...
[ 40.087707] ------------[ cut here ]------------
[ 40.092339] WARNING: CPU: 1 PID: 0 at net/sched/sch_generic.c:323 dev_watchdog+0x278/0x290
[ 40.100580] NETDEV WATCHDOG: eth0 (fsl-gianfar): transmit queue 0 timed out
[ 40.107506] Modules linked in: iptable_mangle iptable_filter ipt_REJECT ipt_ECN ip_tables xt_time xt_tcpudp xt_tcpmss xt_statistic xt_multiport xt_mark xt_mac xt_limit xt_length xt_hl xt_ecn xt_dscp xt_comment xt_TCPMSS xt_LOG xt_HL xt_DSCP xt_CLASSIFY x_tables usbhid nf_reject_ipv4 at24 i2c_gpio usb_storage xhci_plat_hcd xhci_pci xhci_hcd dwc3 usbcore usb_common
[ 40.139759] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.9.62 #14
[ 40.145734] Hardware name: Freescale LS1021A
[ 40.150006] [<c0222c18>] (unwind_backtrace) from [<c021ecb0>] (show_stack+0x10/0x14)
[ 40.157725] [<c021ecb0>] (show_stack) from [<c045f300>] (dump_stack+0x7c/0x9c)
[ 40.164925] [<c045f300>] (dump_stack) from [<c022e7e8>] (__warn+0xcc/0xf4)
[ 40.171775] [<c022e7e8>] (__warn) from [<c022e8b8>] (warn_slowpath_fmt+0x38/0x48)
[ 40.179232] [<c022e8b8>] (warn_slowpath_fmt) from [<c07c0c80>] (dev_watchdog+0x278/0x290)
[ 40.187382] [<c07c0c80>] (dev_watchdog) from [<c02806a0>] (call_timer_fn+0x24/0x98)
[ 40.195010] [<c02806a0>] (call_timer_fn) from [<c02807a8>] (expire_timers+0x94/0xa0)
[ 40.202724] [<c02807a8>] (expire_timers) from [<c028083c>] (run_timer_softirq+0x88/0x19c)
[ 40.210870] [<c028083c>] (run_timer_softirq) from [<c0232c88>] (__do_softirq+0xe4/0x234)
[ 40.218928] [<c0232c88>] (__do_softirq) from [<c02330c4>] (irq_exit+0xcc/0x13c)
[ 40.226212] [<c02330c4>] (irq_exit) from [<c0270900>] (__handle_domain_irq+0x58/0xac)
[ 40.234014] [<c0270900>] (__handle_domain_irq) from [<c0201460>] (gic_handle_irq+0x44/0x94)
[ 40.242331] [<c0201460>] (gic_handle_irq) from [<c021f678>] (__irq_svc+0x58/0x74)
[ 40.249776] Exception stack(0xee87bf88 to 0xee87bfd0)
[ 40.254807] bf80: 00000001 00000000 ee87bfe0 c0229500 00000000 00000002
[ 40.262949] bfa0: c0e03058 c0e02ff4 00000000 00000000 c0e03060 00000001 c0c5e3a0 ee87bfd8
[ 40.271089] bfc0: c021ce20 c021ce24 60000013 ffffffff
[ 40.276124] [<c021f678>] (__irq_svc) from [<c021ce24>] (arch_cpu_idle+0x30/0x3c)
[ 40.283497] [<c021ce24>] (arch_cpu_idle) from [<c026521c>] (cpu_startup_entry+0x178/0x260)
[ 40.291729] [<c026521c>] (cpu_startup_entry) from [<8020166c>] (0x8020166c)
[ 40.298716] ---[ end trace 7670d9d6cdd6797c ]---
[ 40.315025] fsl-gianfar soc:ethernet@2d10000 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 46.579346] fsl-gianfar soc:ethernet@2d10000 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 52.339244] fsl-gianfar soc:ethernet@2d10000 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 68.099262] fsl-gianfar soc:ethernet@2d10000 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[ 78.099439] fsl-gianfar soc:ethernet@2d10000 eth0: Link is Up - 1Gbps/Full - flow control rx/tx
The "Link is Up" message continues to print out every 10 seconds.
Other people have gotten this error in the past: LS1021A Ethernet driver crash
I tried the patch linked there to disable TX snooping, but still got the same error.
What causes this, and how can it be resolved? I've tried to match the kernel/U-Boot configs between LSDK and my OpenWRT tree, it's possible I missed something.
Here is the U-Boot log also:
U-Boot SPL 2017.07 (Feb 09 2018 - 16:58:14)
Trying to boot from MMC1
U-Boot 2017.07 (Feb 09 2018 - 16:58:14 -0800)
CPU: Freescale LayerScape LS1021, Version: 2.0, (0x87001120)
Clock Configuration:
CPU0(ARMV7):1200 MHz,
Bus:300 MHz, DDR:800 MHz (1600 MT/s data rate),
Reset Configuration Word (RCW):
00000000: 0608000c 00000000 00000000 00000000
00000010: 20000000 00407900 60040a00 21046000
00000020: 00000000 00000000 00000000 20000000
00000030: 00000000 241b1340 00000000 00000000
Model:
Board: LS1021ATWR
I2C: ready
DRAM: 1 GiB
Using SERDES1 Protocol: 32 (0x20)
MMC: FSL_SDHC: 0
In: serial
Out: serial
Err: serial
SATA link 0 timeout.
AHCI 0001.0300 1 slots 1 ports ? Gbps 0x1 impl SATA mode
flags: 64bit ncq pm clo only pmp fbss pio slum part ccc
Found 0 device(s).
SCSI: Net: eTSEC1 is in sgmii mode.
eTSEC2 is in sgmii mode.
Could not get PHY for FSL_MDIO: addr 2
Could not get PHY for FSL_MDIO: addr 1
PCIe0: pcie@3400000 Root Complex: no link
PCIe1: pcie@3500000 Root Complex: no link
eTSEC1
Error: eTSEC1 address not set.
, eTSEC2
Error: eTSEC2 address not set.
, eTSEC3
Error: eTSEC3 address not set.
Hit any key to stop autoboot: 0
Device: FSL_SDHC
Manufacturer ID: 3
OEM: 5344
Name: AFICD
Tran Speed: 50000000
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 29.7 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
reading uImage
4866312 bytes read in 227 ms (20.4 MiB/s)
reading ls1021a.dtb
15246 bytes read in 17 ms (875 KiB/s)
## Booting kernel from Legacy Image at 82000000 ...
Image Name: OpenWrt Linux-4.9.62
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4866248 Bytes = 4.6 MiB
Load Address: 80080000
Entry Point: 80080000
Verifying Checksum ... OK
## Flattened Device Tree blob at 8f000000
Booting using the fdt blob at 0x8f000000
Loading Kernel Image ... OK
Using Device Tree in place at 8f000000, end 8f006b8d
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0xf00
[ 0.000000] Linux version 4.9.62 () (gcc version 4.6.4 (OpenWrt/Linaro GCC 4.6-2013.05 1.3.4g57e94c3M) ) #15 SMP Fri Feb 9 17:30:54 PST 2018
[ 0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=30c5387d
[ 0.000000] CPU: div instructions available: patching division code
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
解決済! 解決策の投稿を見る。
I found the problem--my board's U-Boot config did not select BOARD_EARLY_INIT_F, so board_early_init_f() was not being run. With that selected, Ethernet works properly.
I found the problem--my board's U-Boot config did not select BOARD_EARLY_INIT_F, so board_early_init_f() was not being run. With that selected, Ethernet works properly.