Hello,
I'm about to write a software implementation of MDIO interface, it will be based on two GPIO pins, one is for clock and the other is for data. The utlimate purpose will be to have a control interface between CPU and Ethernet switch.
I see two ways:
1) implement simple functions, say 'mdio_read' and 'mdio_write', in a driver and export them. Write a character driver with 'ioctl' support and provide read/write ioctls for the user level. Applications will then use these I/O controls to set up VLAN functionality, configure ports and so on.This approach is quite simple, but I'm afraid the performance might be too bad (each user's open/close/read/write is a context switching and expensive)
2) implement 'mdio_read' and 'mdio_write' in the driver and export them. Also implement all the necessary functions (VLAN, IGMP and so on) in the kernel and expose some configuration interface to the user, for example /proc. This will also require mutexes, I beleive. This way things will work probably faster, but harder to debug.Am I missing something else? What would you say? Thanks.