[PATCH v2] net: designware: Add bitbang feature for designware driver
Paul Barker
paul.barker.ct at bp.renesas.com
Fri Nov 17 09:35:01 CET 2023
On Fri, Nov 17, 2023 at 10:04:53AM +0800, Jim Liu wrote:
> Add bb_miiphy_bus function for designware bitbang feature.
>
> Signed-off-by: Jim Liu <JJLIU0 at nuvoton.com>
> ---
> Changes for v2:
> - add bitbang delay dts read
> - modify printf to debug
> ---
> drivers/net/designware.c | 105 +++++++++++++++++++++++++++++++++++++++
> drivers/net/designware.h | 5 ++
> 2 files changed, 110 insertions(+)
>
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c
> index a174344b3e..e86f96fc1a 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -767,6 +767,31 @@ int designware_eth_probe(struct udevice *dev)
> priv->bus = miiphy_get_dev_by_name(dev->name);
> priv->dev = dev;
>
> +#if defined(CONFIG_BITBANGMII) && CONFIG_IS_ENABLED(DM_GPIO)
> + if (dev_read_bool(dev, "snps,bitbang-mii")) {
> + debug("\n%s: use bitbang mii..\n", dev->name);
> + ret = gpio_request_by_name(dev, "snps,mdc-gpio", 0,
> + &priv->mdc_gpio, GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
> + if (ret) {
> + printf("no mdc-gpio\n");
> + return ret;
> + }
> + ret = gpio_request_by_name(dev, "snps,mdio-gpio", 0,
> + &priv->mdio_gpio, GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
> + if (ret) {
> + printf("no mdio-gpio\n");
> + return ret;
> + }
> +
> + priv->bb_delay = dev_read_u32_default(dev, "snps,bitbang-delay", 1);
> +
> + bb_miiphy_buses[0].priv = priv;
> + sprintf(bb_miiphy_buses[0].name, dev->name);
If designware_eth_probe() is called for multiple Ethernet interfaces
then only the last interface to be probed will have a working MDIO bus.
We should either support multiple buses here or raise an error if there
is an attempt to probe a second interface.
(I spotted the same issue in the ravb driver while extending it to
support a board with two Ethernet interfaces)
Thanks,
Paul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20231117/d76ae7fc/attachment.sig>
More information about the U-Boot
mailing list