[net-next PATCH v10 6/9] net: mdio: Add Airoha AN8855 Switch MDIO Passtrough
Christophe JAILLET
christophe.jaillet at wanadoo.fr
Sun Dec 8 07:13:50 PST 2024
Le 08/12/2024 à 01:20, Christian Marangi a écrit :
> Add Airoha AN8855 Switch driver to register a MDIO passtrough as switch
> address is shared with the internal PHYs and require additional page
> handling.
>
> This requires the upper Switch MFD to be probed and init to actually
> work.
>
> Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
> ---
> MAINTAINERS | 1 +
> drivers/net/mdio/Kconfig | 9 +++
> drivers/net/mdio/Makefile | 1 +
> drivers/net/mdio/mdio-an8855.c | 113 +++++++++++++++++++++++++++++++++
> 4 files changed, 124 insertions(+)
> create mode 100644 drivers/net/mdio/mdio-an8855.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 7f4d7c48b6e1..38c7b2362c92 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -722,6 +722,7 @@ F: Documentation/devicetree/bindings/net/airoha,an8855-mdio.yaml
> F: Documentation/devicetree/bindings/net/dsa/airoha,an8855-switch.yaml
> F: Documentation/devicetree/bindings/nvmem/airoha,an8855-efuse.yaml
> F: drivers/mfd/airoha-an8855.c
> +F: drivers/net/mdio/mdio-an8855.c
>
> AIROHA ETHERNET DRIVER
> M: Lorenzo Bianconi <lorenzo at kernel.org>
> diff --git a/drivers/net/mdio/Kconfig b/drivers/net/mdio/Kconfig
> index 4a7a303be2f7..64fc5c3ef38b 100644
> --- a/drivers/net/mdio/Kconfig
> +++ b/drivers/net/mdio/Kconfig
> @@ -61,6 +61,15 @@ config MDIO_XGENE
> This module provides a driver for the MDIO busses found in the
> APM X-Gene SoC's.
>
> +config MDIO_AN8855
> + tristate "Airoha AN8855 Switch MDIO bus controller"
> + depends on MFD_AIROHA_AN8855
> + depends on OF_MDIO
> + help
> + This module provides a driver for the Airoha AN8855 Switch
> + that require a MDIO passtrough as switch address is shared
requires?
> + with the internal PHYs and require additional page handling.
requires?
> +
> config MDIO_ASPEED
> tristate "ASPEED MDIO bus controller"
> depends on ARCH_ASPEED || COMPILE_TEST
...
> +static int an8855_mdio_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct an8855_mfd_priv *priv;
> + struct mii_bus *bus;
> + int ret;
> +
> + /* Get priv of MFD */
> + priv = dev_get_drvdata(dev->parent);
Ok, forget the related comment made on patch 5/9.
> +
> + bus = devm_mdiobus_alloc(dev);
> + if (!bus)
> + return -ENOMEM;
> +
> + bus->priv = priv;
> + bus->name = KBUILD_MODNAME "-mii";
> + snprintf(bus->id, MII_BUS_ID_SIZE, KBUILD_MODNAME "-%d",
> + priv->switch_addr);
> + bus->parent = dev;
> + bus->read = an8855_phy_read;
> + bus->write = an8855_phy_write;
> +
> + ret = devm_of_mdiobus_register(dev, bus, dev->of_node);
> + if (ret)
> + dev_err(dev, "failed to register MDIO bus: %d", ret);
Nitpick: Missing ending \n.
dev_err_probe() could be used.
> +
> + return ret;
> +}
...
CJ
More information about the linux-arm-kernel
mailing list