README.bitbangMII 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
  2. support an arbitrary number of mii buses. This feature is useful when your
  3. board uses different mii buses for different phys and all (or a part) of these
  4. buses are implemented via bit-banging mode.
  5. The driver requires that the following macros should be defined into the board
  6. configuration file:
  7. CONFIG_BITBANGMII - Enable the miiphybb driver
  8. CONFIG_BITBANGMII_MULTI - Enable the multi bus support
  9. If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs
  10. to define at least the following macros:
  11. MII_INIT - Generic code to enable the MII bus (optional)
  12. MDIO_DECLARE - Declaration needed to access to the MDIO pin (optional)
  13. MDIO_ACTIVE - Activate the MDIO pin as out pin
  14. MDIO_TRISTATE - Activate the MDIO pin as input/tristate pin
  15. MDIO_READ - Read the MDIO pin
  16. MDIO(v) - Write v on the MDIO pin
  17. MDC_DECLARE - Declaration needed to access to the MDC pin (optional)
  18. MDC(v) - Write v on the MDC pin
  19. The previous macros make the driver compatible with the previous version
  20. (that didn't support the multi-bus).
  21. When the CONFIG_BITBANGMII_MULTI is also defined, the board code needs to fill
  22. the bb_miiphy_buses[] array with a record for each required bus and declare
  23. the bb_miiphy_buses_num variable with the number of mii buses.
  24. The record (struct bb_miiphy_bus) has the following fields/callbacks (see
  25. miiphy.h for details):
  26. char name[] - The symbolic name that must be equal to the MII bus
  27. registered name
  28. int (*init)() - Initialization function called at startup time (just
  29. before the Ethernet initialization)
  30. int (*mdio_active)() - Activate the MDIO pin as output
  31. int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
  32. int (*set_mdio)() - Write the MDIO pin
  33. int (*get_mdio)() - Read the MDIO pin
  34. int (*set_mdc)() - Write the MDC pin
  35. int (*delay)() - Delay function
  36. void *priv - Private data used by board specific code
  37. The board code will look like:
  38. struct bb_miiphy_bus bb_miiphy_buses[] = {
  39. { .name = "miibus#1", .init = b1_init, .mdio_active = b1_mdio_active, ... },
  40. { .name = "miibus#2", .init = b2_init, .mdio_active = b2_mdio_active, ... },
  41. ...
  42. };
  43. int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
  44. sizeof(bb_miiphy_buses[0]);
  45. 2009 Industrie Dial Face S.p.A.
  46. Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com>