August 12, 2018

U-Boot and the designware driver

U-Boot uses Kconfig (or a modified version thereof), which is derived from the Linux Kernel. So, when you type "make board" a variety of things take place that result in the file .config being generated. The file configs/board_defconfig effectively makes selections from options offered in the Kconfig files that are scattered through the U-Boot source tree. There are mysteries here that I have not yet fathomed.

One thing is clear. Just putting CONFIG_ETH_DESIGNWARE into s5p6818_nanopi3_defconfig does not get things done. As it turns out you must also select CONFIG_NETDEVICES, and then you get more of what you would hope for. Some of this can be discerned by looking at other _defconfig files (and there are a lot of them) that include the designware driver. Also instructive is to look at the Kconfig files themselves. As it turns out, you cannot select an option in the _defconfig file that is not available via the Kconfig tree, which includes conditionals itself. Building this and running it yield:

Net:   Net Initialization Skipped
No ethernet found.
These messages come from ./net/eth.c It has two flavors of code on a conditional depending on whether CONFIG_DM_ETH is defined or not (it is not in our case). The first message comes from eth_common_init(). The second comes from eth_init() or eth_initialize().

So, the driver is now linked into the executable, but more needs to be done. Adding some code to u-boot/board/s5p6818/nanopi3/board.c I can print out the mac address, which is sort of comforting amidst all of the effort to get cozy with U-Boot.

MAC address:  [d2:a5:61:c9:2e:xx] (tjt)
Just as a note, the linux boot names the following driver:
nexell-dwmac c0060000.ethernet: snps,phy-addr property is deprecated
After some more work, (adding board_eth_init() to board.c) we get:
GENERIC ether read: -1
MAC address:  [d2:a5:61:c9:2e:e4] (tjt)

Net:   dwmac.c0060000
Hit any key to stop autoboot:  0
As near as I can tell, the "Net:" message comes from xx() in common/board_r.c while the rest of the line is the value of dev->name in the eth_device structure. This gets set in designware.c and is printed in xxxx


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org