Hello everyone.

I have been tinkering around net drivers lately. I set my goal to implement
a mdio bus to add a bit of modularity to the monolithic netdevs approach
(the full ones, not the lowerhalfs).

Currently my prototype is working although I cannot wrap my head around the
"logic" or "architecture" of the existing buses implementation, spi and i2c
to be specific. I understand both approaches, but I do not know why they
are used differently and what approach should mdio follow.

So, to be short. Aside from the device struct specification (i2c_master_s
located in i2c_master.h and spi_dev_s in spi.h) both buses also offers
wrappers around data exchange (i2c_read, i2c_write, spi_transfer, etc)
which handles the common bus transaction logic. There is a description for
spi_transfer function which states that it is a helper function. I also see
that the spi also offers multiple dev types which may be another reason why
these two buses are used differently.

My questions are:

Why is the i2c bus used mainly through the "wrapper" functions (i2c_read,
i2c_write, i2c_writeread) while the spi bus prefers using the device ops
functions directly (using the provided #defines).

Which of these two approaches would you recommend for a mdio bus, or which
should be the prefered approach in general?

Any other feedback or ideas are also welcomed. What would you like to see
in a mdio bus implementation for NuttX?

Cheers,
Mihai

Reply via email to