Amit Singh Tomar
Amit Singh Tomar

Reputation: 8610

About U-boot driver model

I have a simple question regarding U-boot driver model. I wanted to know when and how function ops of a driver is triggered.

For example for Ethernet driver these are the ops defined:

static const struct eth_ops designware_eth_ops = {
    .start                  = designware_eth_start,
    .send                   = designware_eth_send,
    .recv                   = designware_eth_recv,
    .free_pkt               = designware_eth_free_pkt,
    .stop                   = designware_eth_stop,
    .write_hwaddr           = designware_eth_write_hwaddr,
};

Now , are these eth_ops are called at initialization stage after probe function or these are called only when some commands are run from u-boot prompt like ping , tftp etc?

Initialization stage would only probe the device and move it next subsystem ?

Upvotes: 2

Views: 1683

Answers (1)

Liran Ben Haim
Liran Ben Haim

Reputation: 456

It depends on u-boot settings. If the bootcmd and bootargs environment variables define something related to the network like loading the kernel from tftp server it will first call the start callback and on sending and receiving the send/rec callbacks. If the kernel is loaded from flash u-boot networking is not required and if you're not using network commands on uboot shell no callback is called Uboot drivers model is very similar to Linux model and actually there are a lot of common code between them. The only "big" difference is that uboot uses physical addressing and Linux uses MMU to convert physical to virtual address space

Upvotes: 1

Related Questions