Luigi 'Comio' Mantellini | 466827e | 2009-10-10 12:42:20 +0200 | [diff] [blame] | 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 | |
| 6 | The driver requires that the following macros should be defined into the board |
| 7 | configuration file: |
| 8 | |
Wolfgang Denk | d61fbcc | 2009-10-28 00:49:47 +0100 | [diff] [blame] | 9 | CONFIG_BITBANGMII - Enable the miiphybb driver |
Luigi 'Comio' Mantellini | 466827e | 2009-10-10 12:42:20 +0200 | [diff] [blame] | 10 | |
Marek Vasut | b50f9f2 | 2025-01-18 07:14:35 +0100 | [diff] [blame^] | 11 | The board code needs to fill the bb_miiphy_buses[] array with a record for |
| 12 | each required bus and declare the bb_miiphy_buses_num variable with the |
| 13 | number of mii buses. The record (struct bb_miiphy_bus) has the following |
| 14 | fields/callbacks (see miiphy.h for details): |
Luigi 'Comio' Mantellini | 466827e | 2009-10-10 12:42:20 +0200 | [diff] [blame] | 15 | |
Wolfgang Denk | d61fbcc | 2009-10-28 00:49:47 +0100 | [diff] [blame] | 16 | char name[] - The symbolic name that must be equal to the MII bus |
| 17 | registered name |
| 18 | int (*init)() - Initialization function called at startup time (just |
| 19 | before the Ethernet initialization) |
Luigi 'Comio' Mantellini | 466827e | 2009-10-10 12:42:20 +0200 | [diff] [blame] | 20 | int (*mdio_active)() - Activate the MDIO pin as output |
| 21 | int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin |
| 22 | int (*set_mdio)() - Write the MDIO pin |
| 23 | int (*get_mdio)() - Read the MDIO pin |
| 24 | int (*set_mdc)() - Write the MDC pin |
Wolfgang Denk | d61fbcc | 2009-10-28 00:49:47 +0100 | [diff] [blame] | 25 | int (*delay)() - Delay function |
| 26 | void *priv - Private data used by board specific code |
Luigi 'Comio' Mantellini | 466827e | 2009-10-10 12:42:20 +0200 | [diff] [blame] | 27 | |
| 28 | The board code will look like: |
| 29 | |
| 30 | struct bb_miiphy_bus bb_miiphy_buses[] = { |
| 31 | { .name = "miibus#1", .init = b1_init, .mdio_active = b1_mdio_active, ... }, |
| 32 | { .name = "miibus#2", .init = b2_init, .mdio_active = b2_mdio_active, ... }, |
| 33 | ... |
| 34 | }; |
| 35 | int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) / |
Wolfgang Denk | d61fbcc | 2009-10-28 00:49:47 +0100 | [diff] [blame] | 36 | sizeof(bb_miiphy_buses[0]); |
Luigi 'Comio' Mantellini | 466827e | 2009-10-10 12:42:20 +0200 | [diff] [blame] | 37 | |
| 38 | 2009 Industrie Dial Face S.p.A. |
| 39 | Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com> |