All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/3 v2] New MIIPHYBB implementation with multi-bus support
@ 2009-09-22 15:27 Luigi 'Comio' Mantellini
  2009-09-22 15:27 ` [U-Boot] [PATCH 1/3 v2] Bit-banged MII driver " Luigi 'Comio' Mantellini
  2009-09-22 17:01 ` [U-Boot] [PATCH 0/3 v2] New MIIPHYBB implementation with multi-bus support Ben Warren
  0 siblings, 2 replies; 5+ messages in thread
From: Luigi 'Comio' Mantellini @ 2009-09-22 15:27 UTC (permalink / raw)
  To: u-boot

From: Luigi 'Comio' Mantellini <luigi.mantellini@idf-hit.com>

This patch rewrites the miiphybb ( Bit-banged MII bus driver ) in order to
support an arbitrary number of 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:

CONFIG_BITBANGMII       - Enable the miiphybb driver
CONFIG_BITBANGMII_MULTI - Enable the multi bus support

If the CONFIG_BITBANGMII_MULTI is not defined, the board's config file needs to define
the following macros:

MII_INIT      - Generic cod to enable the MII bus (like gpios setup)
MDIO_DECLARE  - Declaration needed to access to the MDIO pin
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
MDC(v)        - Write v on the MDC pin

The previous macros make the driver compatible with the previous version
(that didn't support the multi-bus).

When the CONFIG_BITBANGMII_MULTI is defined, the board code needs to fill the
bbmiibusses[] array with a record for each required bus.
The record (struct bbmiibus) has the following fields/callbacks (see miiphy.h for
details):

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)
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
int (*delay)()         - Delay function
void *priv             - Private data used by board specific code

The board code will look like:

struct bbmiibus bbmiibusses[] = {
 { .name = "miibus#1", .init = b1_init, .mdio_active = b1_mdio_active, ... },
 { .name = "miibus#2", .init = b2_init, .mdio_active = b2_mdio_active, ... },
 ...
};

Patch Changelog:

v1 -- First (broken) release
v2 -- Fix some typos and disable callbacks pointers relacation (if
      CONFIG_RELOC_FIXUP_WORKS is not defined)

Luigi 'Comio' Mantellini (3):
  Bit-banged MII driver with multi-bus support.
  Add bb_miiphy_init call before any ethernet bring-up code.
  Update all board to support new bbmiiphy driver (with multibus
    support)

 drivers/net/phy/miiphybb.c   |  322 +++++++++++++++++++++++++++++-------------
 include/configs/ISPAN.h      |    3 +
 include/configs/MPC8260ADS.h |    2 +
 include/configs/MPC8266ADS.h |    3 +
 include/configs/MPC8560ADS.h |    3 +
 include/configs/Rattler.h    |    3 +
 include/configs/SBC8540.h    |    3 +
 include/configs/TQM8272.h    |    2 +
 include/configs/VoVPN-GW.h   |    3 +
 include/configs/ZPC1900.h    |    3 +
 include/configs/ep8248.h     |    3 +
 include/configs/ep82xxm.h    |    3 +
 include/configs/gw8260.h     |    3 +
 include/configs/hymod.h      |    9 ++
 include/configs/muas3001.h   |    3 +
 include/configs/ppmc8260.h   |    3 +
 include/configs/sacsng.h     |    3 +
 include/configs/sbc8260.h    |    3 +
 include/configs/sbc8560.h    |    3 +
 include/miiphy.h             |   22 +++
 lib_arm/board.c              |    3 +
 lib_avr32/board.c            |    3 +
 lib_blackfin/board.c         |    3 +
 lib_i386/board.c             |    3 +
 lib_m68k/board.c             |    3 +
 lib_mips/board.c             |    3 +
 lib_ppc/board.c              |    4 +-
 lib_sh/board.c               |    3 +
 lib_sparc/board.c            |    3 +
 29 files changed, 333 insertions(+), 97 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-22 17:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-22 15:27 [U-Boot] [PATCH 0/3 v2] New MIIPHYBB implementation with multi-bus support Luigi 'Comio' Mantellini
2009-09-22 15:27 ` [U-Boot] [PATCH 1/3 v2] Bit-banged MII driver " Luigi 'Comio' Mantellini
2009-09-22 15:27   ` [U-Boot] [PATCH 2/3 v2] Add bb_miiphy_init call before any ethernet bring-up code Luigi 'Comio' Mantellini
2009-09-22 15:27     ` [U-Boot] [PATCH 3/3 v2] Update all board to support new bbmiiphy driver (with multibus support) Luigi 'Comio' Mantellini
2009-09-22 17:01 ` [U-Boot] [PATCH 0/3 v2] New MIIPHYBB implementation with multi-bus support Ben Warren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.