———-
Register
———-
When U-Boot initializes, it will call the common function eth_initialize().
This will in turn call the board-specific board_eth_init() (or if that fails,
the cpu-specific cpu_eth_init()). These board-specific functions can do random
system handling, but ultimately they will call the driver-specific register
function which in turn takes care of initializing that particular instance.
Keep in mind that you should code the driver to avoid storing state in global
data as someone might want to hook up two of the same devices to one board.
Any such information that is specific to an interface should be stored in a
private, driver-defined data structure and pointed to by eth->priv (see below).
So the call graph at this stage would look something like:
board_init()
eth_initialize()
board_eth_init() / cpu_eth_init()
driver_register()
initialize eth_device
eth_register()
board_eth_init()中执行setup_net_chip(); aml_eth_init()
aml_eth_init() 在drivers/net/aml_ethernet.c中定义
网卡启动顺序:
board_eth_init()->setup_net_chip() -> aml_eth_init()->aml_ethernet_init -> … eth_reset() -> “Error: Fail to reset mac!”