In the U-boot
source code, miiphy_init() and phy_init() functions are initialising global variables for mii_dev and phy_driver structures.
I am looking for the source who will create/initialise global structure eth_device
variable and maintain/use it during runtime.
Basically I am trying to understand who will create eth_device
structure and how it will be handled during run time.
struct eth_device is only used by deprecated drivers that don't follow the driver model. These should have been removed with release v2020.07.
The structure is filled in the driver initialization routine, e.g. lan91c96_initialize(). Just grep for 'eth_register(' to find all those functions.
The structure is retrieved like this:
struct eth_device *dev = eth_get_dev_by_name(bus->name);