Blame view

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