Convert the current miiphybb documentation to rst. Rename the README.bitbangMII to bitbangmii.rst in the process.
Signed-off-by: Marek Vasut <marek.vasut+rene...@mailbox.org> --- Cc: Jim Liu <jim.t90...@gmail.com> Cc: Joe Hershberger <joe.hershber...@ni.com> Cc: Mario Six <mario....@gdsys.cc> Cc: Michael Chang <zhang971090...@gmail.com> Cc: Nobuhiro Iwamatsu <iwama...@nigauri.org> Cc: Parvathi Bhogaraju <pbhogar...@microsoft.com> Cc: Paul Barker <paul.barker...@bp.renesas.com> Cc: Ramon Fried <rfried....@gmail.com> Cc: Tom Rini <tr...@konsulko.com> Cc: u-boot@lists.denx.de --- doc/README.bitbangMII | 67 --------------------------------------- doc/bitbangmii.rst | 73 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 67 deletions(-) delete mode 100644 doc/README.bitbangMII create mode 100644 doc/bitbangmii.rst diff --git a/doc/README.bitbangMII b/doc/README.bitbangMII deleted file mode 100644 index 78b4ef880cb..00000000000 --- a/doc/README.bitbangMII +++ /dev/null @@ -1,67 +0,0 @@ -The miiphybb ( Bit-banged MII bus driver ) supports an arbitrary number of -MII buses. This feature is useful when a driver 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 - -The driver code needs to allocate a regular MDIO device using mdio_alloc() -and assign .read and .write accessors which wrap bb_miiphy_read() and -bb_miiphy_write() functions respectively. The bb_miiphy_read() and -bb_miiphy_write() functions take a pointer to a callback structure, -struct bb_miiphy_bus_ops. The struct bb_miiphy_bus_ops has the following -fields/callbacks (see miiphy.h for details): - -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 - -The driver code will look like: - -static const struct bb_miiphy_bus_ops ravb_bb_miiphy_bus_ops = { - .mdio_active = ravb_bb_mdio_active, - .mdio_tristate = ravb_bb_mdio_tristate, - .set_mdio = ravb_bb_set_mdio, - .get_mdio = ravb_bb_get_mdio, - .set_mdc = ravb_bb_set_mdc, - .delay = ravb_bb_delay, -}; - -static int ravb_bb_miiphy_read(struct mii_dev *miidev, int addr, - int devad, int reg) -{ - return bb_miiphy_read(miidev, &ravb_bb_miiphy_bus_ops, - addr, devad, reg); -} - -static int ravb_bb_miiphy_write(struct mii_dev *miidev, int addr, - int devad, int reg, u16 value) -{ - return bb_miiphy_write(miidev, &ravb_bb_miiphy_bus_ops, - addr, devad, reg, value); -} - -static int ravb_probe(struct udevice *dev) -{ - struct mii_dev *mdiodev; -... - mdiodev = mdio_alloc(); - if (!mdiodev) - return -ENOMEM; - - mdiodev->read = ravb_bb_miiphy_read; - mdiodev->write = ravb_bb_miiphy_write; - mdiodev->priv = eth; - snprintf(mdiodev->name, sizeof(mdiodev->name), dev->name); - - ret = mdio_register(mdiodev); -... - -2009 Industrie Dial Face S.p.A. - Luigi 'Comio' Mantellini <luigi.mantell...@idf-hit.com> diff --git a/doc/bitbangmii.rst b/doc/bitbangmii.rst new file mode 100644 index 00000000000..95707e8f57f --- /dev/null +++ b/doc/bitbangmii.rst @@ -0,0 +1,73 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Bit-banged MII bus support +========================== + +The miiphybb ( Bit-banged MII bus driver ) supports an arbitrary number of +MII buses. This feature is useful when a driver 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 + +The driver code needs to allocate a regular MDIO device using mdio_alloc() +and assign .read and .write accessors which wrap bb_miiphy_read() and +bb_miiphy_write() functions respectively. The bb_miiphy_read() and +bb_miiphy_write() functions take a pointer to a callback structure, +struct bb_miiphy_bus_ops. The struct bb_miiphy_bus_ops has the following +fields/callbacks (see miiphy.h for details): + + 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 + +The driver code will look like: + + static const struct bb_miiphy_bus_ops ravb_bb_miiphy_bus_ops = { + .mdio_active = ravb_bb_mdio_active, + .mdio_tristate = ravb_bb_mdio_tristate, + .set_mdio = ravb_bb_set_mdio, + .get_mdio = ravb_bb_get_mdio, + .set_mdc = ravb_bb_set_mdc, + .delay = ravb_bb_delay, + }; + + static int ravb_bb_miiphy_read(struct mii_dev *miidev, int addr, + int devad, int reg) + { + return bb_miiphy_read(miidev, &ravb_bb_miiphy_bus_ops, + addr, devad, reg); + } + + static int ravb_bb_miiphy_write(struct mii_dev *miidev, int addr, + int devad, int reg, u16 value) + { + return bb_miiphy_write(miidev, &ravb_bb_miiphy_bus_ops, + addr, devad, reg, value); + } + + static int ravb_probe(struct udevice *dev) + { + struct mii_dev *mdiodev; + ... + mdiodev = mdio_alloc(); + if (!mdiodev) + return -ENOMEM; + + mdiodev->read = ravb_bb_miiphy_read; + mdiodev->write = ravb_bb_miiphy_write; + mdiodev->priv = eth; + snprintf(mdiodev->name, sizeof(mdiodev->name), dev->name); + + ret = mdio_register(mdiodev); + ... + } + +2009 Industrie Dial Face S.p.A. + Luigi 'Comio' Mantellini <luigi.mantell...@idf-hit.com> -- 2.47.2