blob: 05ab20376f3ee774ddfe741fe471f488a9b3c0ad [file] [log] [blame]
Luigi 'Comio' Mantellini466827e2009-10-10 12:42:20 +02001This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
2support an arbitrary number of mii buses. This feature is useful when your
3board uses different mii buses for different phys and all (or a part) of these
4buses are implemented via bit-banging mode.
5
6The driver requires that the following macros should be defined into the board
7configuration file:
8
Wolfgang Denkd61fbcc2009-10-28 00:49:47 +01009CONFIG_BITBANGMII - Enable the miiphybb driver
Luigi 'Comio' Mantellini466827e2009-10-10 12:42:20 +020010
Marek Vasutb50f9f22025-01-18 07:14:35 +010011The board code needs to fill the bb_miiphy_buses[] array with a record for
12each required bus and declare the bb_miiphy_buses_num variable with the
13number of mii buses. The record (struct bb_miiphy_bus) has the following
14fields/callbacks (see miiphy.h for details):
Luigi 'Comio' Mantellini466827e2009-10-10 12:42:20 +020015
Wolfgang Denkd61fbcc2009-10-28 00:49:47 +010016char name[] - The symbolic name that must be equal to the MII bus
17 registered name
18int (*init)() - Initialization function called at startup time (just
19 before the Ethernet initialization)
Luigi 'Comio' Mantellini466827e2009-10-10 12:42:20 +020020int (*mdio_active)() - Activate the MDIO pin as output
21int (*mdio_tristate)() - Activate the MDIO pin as input/tristate pin
22int (*set_mdio)() - Write the MDIO pin
23int (*get_mdio)() - Read the MDIO pin
24int (*set_mdc)() - Write the MDC pin
Wolfgang Denkd61fbcc2009-10-28 00:49:47 +010025int (*delay)() - Delay function
26void *priv - Private data used by board specific code
Luigi 'Comio' Mantellini466827e2009-10-10 12:42:20 +020027
28The board code will look like:
29
30struct 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};
35int bb_miiphy_buses_num = sizeof(bb_miiphy_buses) /
Wolfgang Denkd61fbcc2009-10-28 00:49:47 +010036 sizeof(bb_miiphy_buses[0]);
Luigi 'Comio' Mantellini466827e2009-10-10 12:42:20 +020037
382009 Industrie Dial Face S.p.A.
39 Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com>