* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 20:33 ` [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver Sean Anderson
@ 2025-05-23 21:33 ` Heiner Kallweit
2025-05-23 21:39 ` Sean Anderson
2025-05-24 8:21 ` kernel test robot
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Heiner Kallweit @ 2025-05-23 21:33 UTC (permalink / raw)
To: Sean Anderson, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King
Cc: Lei Wei, Christian Marangi, Kory Maincent, Simon Horman,
Daniel Golle, Vineeth Karumanchi, linux-kernel, Ioana Ciornei,
Vladimir Oltean, imx, linux-stm32
On 23.05.2025 22:33, Sean Anderson wrote:
> This converts the lynx PCS driver to a proper MDIO driver.
> This allows using a more conventional driver lifecycle (e.g. with a
> probe and remove). It will also make it easier to add interrupt support.
>
> The existing helpers are converted to bind the MDIO driver instead of
> creating the PCS directly. As lynx_pcs_create_mdiodev creates the PCS
> device, we can just set the modalias. For lynx_pcs_create_fwnode, we try
> to get the PCS the usual way, and if that fails we edit the devicetree
> to add a compatible and reprobe the device.
>
> To ensure my contributions remain free software, remove the BSD option
> from the license. This is permitted because the SPDX uses "OR".
>
> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> ---
>
> Changes in v5:
> - Use MDIO_BUS instead of MDIO_DEVICE
>
> Changes in v4:
> - Add a note about the license
> - Convert to dev-less pcs_put
>
> Changes in v3:
> - Call devm_pcs_register instead of devm_pcs_register_provider
>
> Changes in v2:
> - Add support for #pcs-cells
> - Remove unused variable lynx_properties
>
> drivers/net/dsa/ocelot/Kconfig | 4 +
> drivers/net/dsa/ocelot/felix_vsc9959.c | 11 +-
> drivers/net/dsa/ocelot/seville_vsc9953.c | 11 +-
> drivers/net/ethernet/altera/Kconfig | 2 +
> drivers/net/ethernet/altera/altera_tse_main.c | 7 +-
> drivers/net/ethernet/freescale/dpaa/Kconfig | 2 +-
> drivers/net/ethernet/freescale/dpaa2/Kconfig | 3 +
> .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 11 +-
> drivers/net/ethernet/freescale/enetc/Kconfig | 2 +
> .../net/ethernet/freescale/enetc/enetc_pf.c | 8 +-
> .../net/ethernet/freescale/enetc/enetc_pf.h | 1 -
> .../freescale/enetc/enetc_pf_common.c | 4 +-
> drivers/net/ethernet/freescale/fman/Kconfig | 4 +-
> .../net/ethernet/freescale/fman/fman_memac.c | 25 ++--
> drivers/net/ethernet/stmicro/stmmac/Kconfig | 3 +
> .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 +-
> drivers/net/pcs/Kconfig | 11 +-
> drivers/net/pcs/pcs-lynx.c | 110 ++++++++++--------
> include/linux/pcs-lynx.h | 13 ++-
> 19 files changed, 128 insertions(+), 110 deletions(-)
>
> diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig
> index 081e7a88ea02..907c29d61c14 100644
> --- a/drivers/net/dsa/ocelot/Kconfig
> +++ b/drivers/net/dsa/ocelot/Kconfig
> @@ -42,7 +42,9 @@ config NET_DSA_MSCC_FELIX
> select NET_DSA_TAG_OCELOT_8021Q
> select NET_DSA_TAG_OCELOT
> select FSL_ENETC_MDIO
> + select PCS
> select PCS_LYNX
> + select MDIO_BUS
This shouldn't be needed. NET_DSA selects PHYLINK, which selects PHYLIB,
which selects MDIO_BUS. There are more places in this series where the
same comment applies.
> help
> This driver supports the VSC9959 (Felix) switch, which is embedded as
> a PCIe function of the NXP LS1028A ENETC RCiEP.
> @@ -58,7 +60,9 @@ config NET_DSA_MSCC_SEVILLE
> select NET_DSA_MSCC_FELIX_DSA_LIB
> select NET_DSA_TAG_OCELOT_8021Q
> select NET_DSA_TAG_OCELOT
> + select PCS
> select PCS_LYNX
> + select MDIO_BUS
> help
> This driver supports the VSC9953 (Seville) switch, which is embedded
> as a platform device on the NXP T1040 SoC.
> diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c
> index 087d368a59e0..6feae845af10 100644
> --- a/drivers/net/dsa/ocelot/felix_vsc9959.c
> +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c
> @@ -12,6 +12,7 @@
> #include <net/tc_act/tc_gate.h>
> #include <soc/mscc/ocelot.h>
> #include <linux/dsa/ocelot.h>
> +#include <linux/pcs.h>
> #include <linux/pcs-lynx.h>
> #include <net/pkt_sched.h>
> #include <linux/iopoll.h>
> @@ -1033,7 +1034,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocelot)
> if (ocelot_port->phy_mode == PHY_INTERFACE_MODE_INTERNAL)
> continue;
>
> - phylink_pcs = lynx_pcs_create_mdiodev(felix->imdio, port);
> + phylink_pcs = lynx_pcs_create_mdiodev(dev, felix->imdio, port);
> if (IS_ERR(phylink_pcs))
> continue;
>
> @@ -1050,12 +1051,8 @@ static void vsc9959_mdio_bus_free(struct ocelot *ocelot)
> struct felix *felix = ocelot_to_felix(ocelot);
> int port;
>
> - for (port = 0; port < ocelot->num_phys_ports; port++) {
> - struct phylink_pcs *phylink_pcs = felix->pcs[port];
> -
> - if (phylink_pcs)
> - lynx_pcs_destroy(phylink_pcs);
> - }
> + for (port = 0; port < ocelot->num_phys_ports; port++)
> + pcs_put(felix->pcs[port]);
> mdiobus_unregister(felix->imdio);
> mdiobus_free(felix->imdio);
> }
> diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c
> index 28bcdef34a6c..627c0bd7a777 100644
> --- a/drivers/net/dsa/ocelot/seville_vsc9953.c
> +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c
> @@ -10,6 +10,7 @@
> #include <linux/mdio/mdio-mscc-miim.h>
> #include <linux/mod_devicetable.h>
> #include <linux/of_mdio.h>
> +#include <linux/pcs.h>
> #include <linux/pcs-lynx.h>
> #include <linux/dsa/ocelot.h>
> #include <linux/iopoll.h>
> @@ -926,7 +927,7 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)
> if (ocelot_port->phy_mode == PHY_INTERFACE_MODE_INTERNAL)
> continue;
>
> - phylink_pcs = lynx_pcs_create_mdiodev(felix->imdio, addr);
> + phylink_pcs = lynx_pcs_create_mdiodev(dev, felix->imdio, addr);
> if (IS_ERR(phylink_pcs))
> continue;
>
> @@ -943,12 +944,8 @@ static void vsc9953_mdio_bus_free(struct ocelot *ocelot)
> struct felix *felix = ocelot_to_felix(ocelot);
> int port;
>
> - for (port = 0; port < ocelot->num_phys_ports; port++) {
> - struct phylink_pcs *phylink_pcs = felix->pcs[port];
> -
> - if (phylink_pcs)
> - lynx_pcs_destroy(phylink_pcs);
> - }
> + for (port = 0; port < ocelot->num_phys_ports; port++)
> + pcs_put(felix->pcs[port]);
>
> /* mdiobus_unregister and mdiobus_free handled by devres */
> }
> diff --git a/drivers/net/ethernet/altera/Kconfig b/drivers/net/ethernet/altera/Kconfig
> index 4ef819a9a1ad..9b68321e8b86 100644
> --- a/drivers/net/ethernet/altera/Kconfig
> +++ b/drivers/net/ethernet/altera/Kconfig
> @@ -5,7 +5,9 @@ config ALTERA_TSE
> depends on HAS_IOMEM
> select PHYLIB
> select PHYLINK
> + select PCS
> select PCS_LYNX
> + select MDIO_BUS
> select MDIO_REGMAP
> select REGMAP_MMIO
> help
> diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
> index 3f6204de9e6b..8bd4753a04bc 100644
> --- a/drivers/net/ethernet/altera/altera_tse_main.c
> +++ b/drivers/net/ethernet/altera/altera_tse_main.c
> @@ -32,6 +32,7 @@
> #include <linux/of.h>
> #include <linux/of_mdio.h>
> #include <linux/of_net.h>
> +#include <linux/pcs.h>
> #include <linux/pcs-lynx.h>
> #include <linux/phy.h>
> #include <linux/platform_device.h>
> @@ -1412,7 +1413,7 @@ static int altera_tse_probe(struct platform_device *pdev)
> goto err_init_pcs;
> }
>
> - priv->pcs = lynx_pcs_create_mdiodev(pcs_bus, 0);
> + priv->pcs = lynx_pcs_create_mdiodev(&pdev->dev, pcs_bus, 0);
> if (IS_ERR(priv->pcs)) {
> ret = PTR_ERR(priv->pcs);
> goto err_init_pcs;
> @@ -1444,7 +1445,7 @@ static int altera_tse_probe(struct platform_device *pdev)
>
> return 0;
> err_init_phylink:
> - lynx_pcs_destroy(priv->pcs);
> + pcs_put(priv->pcs);
> err_init_pcs:
> unregister_netdev(ndev);
> err_register_netdev:
> @@ -1466,7 +1467,7 @@ static void altera_tse_remove(struct platform_device *pdev)
> altera_tse_mdio_destroy(ndev);
> unregister_netdev(ndev);
> phylink_destroy(priv->phylink);
> - lynx_pcs_destroy(priv->pcs);
> + pcs_put(priv->pcs);
>
> free_netdev(ndev);
> }
> diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig
> index 2b560661c82a..bb658f1db129 100644
> --- a/drivers/net/ethernet/freescale/dpaa/Kconfig
> +++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
> @@ -3,7 +3,7 @@ menuconfig FSL_DPAA_ETH
> tristate "DPAA Ethernet"
> depends on FSL_DPAA && FSL_FMAN
> select PHYLINK
> - select PCS_LYNX
> + select MDIO_BUS
> help
> Data Path Acceleration Architecture Ethernet driver,
> supporting the Freescale QorIQ chips.
> diff --git a/drivers/net/ethernet/freescale/dpaa2/Kconfig b/drivers/net/ethernet/freescale/dpaa2/Kconfig
> index d029b69c3f18..806931b2b9fa 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/Kconfig
> +++ b/drivers/net/ethernet/freescale/dpaa2/Kconfig
> @@ -2,8 +2,11 @@
> config FSL_DPAA2_ETH
> tristate "Freescale DPAA2 Ethernet"
> depends on FSL_MC_BUS && FSL_MC_DPIO
> + select OF_DYNAMIC
> select PHYLINK
> + select PCS
> select PCS_LYNX
> + select MDIO_BUS
> select FSL_XGMAC_MDIO
> select NET_DEVLINK
> help
> diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
> index 422ce13a7c94..0dc0a265db51 100644
> --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
> +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
> @@ -2,6 +2,7 @@
> /* Copyright 2019 NXP */
>
> #include <linux/acpi.h>
> +#include <linux/pcs.h>
> #include <linux/pcs-lynx.h>
> #include <linux/phy/phy.h>
> #include <linux/property.h>
> @@ -262,7 +263,7 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
> return 0;
> }
>
> - pcs = lynx_pcs_create_fwnode(node);
> + pcs = lynx_pcs_create_fwnode(&mac->mc_dev->dev, node);
> fwnode_handle_put(node);
>
> if (pcs == ERR_PTR(-EPROBE_DEFER)) {
> @@ -288,12 +289,8 @@ static int dpaa2_pcs_create(struct dpaa2_mac *mac,
>
> static void dpaa2_pcs_destroy(struct dpaa2_mac *mac)
> {
> - struct phylink_pcs *phylink_pcs = mac->pcs;
> -
> - if (phylink_pcs) {
> - lynx_pcs_destroy(phylink_pcs);
> - mac->pcs = NULL;
> - }
> + pcs_put(mac->pcs);
> + mac->pcs = NULL;
> }
>
> static void dpaa2_mac_set_supported_interfaces(struct dpaa2_mac *mac)
> diff --git a/drivers/net/ethernet/freescale/enetc/Kconfig b/drivers/net/ethernet/freescale/enetc/Kconfig
> index e917132d3714..f3ac430c9d4f 100644
> --- a/drivers/net/ethernet/freescale/enetc/Kconfig
> +++ b/drivers/net/ethernet/freescale/enetc/Kconfig
> @@ -30,7 +30,9 @@ config FSL_ENETC
> select FSL_ENETC_MDIO
> select NXP_ENETC_PF_COMMON
> select PHYLINK
> + select PCS
> select PCS_LYNX
> + select MDIO_BUS
> select DIMLIB
> help
> This driver supports NXP ENETC gigabit ethernet controller PCIe
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.c b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
> index f63a29e2e031..8d0950c28190 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.c
> @@ -34,12 +34,7 @@ static void enetc_pf_set_primary_mac_addr(struct enetc_hw *hw, int si,
> static struct phylink_pcs *enetc_pf_create_pcs(struct enetc_pf *pf,
> struct mii_bus *bus)
> {
> - return lynx_pcs_create_mdiodev(bus, 0);
> -}
> -
> -static void enetc_pf_destroy_pcs(struct phylink_pcs *pcs)
> -{
> - lynx_pcs_destroy(pcs);
> + return lynx_pcs_create_mdiodev(&pf->si->pdev->dev, bus, 0);
> }
>
> static void enetc_set_vlan_promisc(struct enetc_hw *hw, char si_map)
> @@ -914,7 +909,6 @@ static const struct enetc_pf_ops enetc_pf_ops = {
> .set_si_primary_mac = enetc_pf_set_primary_mac_addr,
> .get_si_primary_mac = enetc_pf_get_primary_mac_addr,
> .create_pcs = enetc_pf_create_pcs,
> - .destroy_pcs = enetc_pf_destroy_pcs,
> .enable_psfp = enetc_psfp_enable,
> };
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf.h b/drivers/net/ethernet/freescale/enetc/enetc_pf.h
> index ae407e9e9ee7..be22b036df42 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_pf.h
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf.h
> @@ -32,7 +32,6 @@ struct enetc_pf_ops {
> void (*set_si_primary_mac)(struct enetc_hw *hw, int si, const u8 *addr);
> void (*get_si_primary_mac)(struct enetc_hw *hw, int si, u8 *addr);
> struct phylink_pcs *(*create_pcs)(struct enetc_pf *pf, struct mii_bus *bus);
> - void (*destroy_pcs)(struct phylink_pcs *pcs);
> int (*enable_psfp)(struct enetc_ndev_priv *priv);
> };
>
> diff --git a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
> index edf14a95cab7..1c53036d17df 100644
> --- a/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
> +++ b/drivers/net/ethernet/freescale/enetc/enetc_pf_common.c
> @@ -4,6 +4,7 @@
> #include <linux/fsl/enetc_mdio.h>
> #include <linux/of_mdio.h>
> #include <linux/of_net.h>
> +#include <linux/pcs.h>
>
> #include "enetc_pf_common.h"
>
> @@ -248,8 +249,7 @@ static int enetc_imdio_create(struct enetc_pf *pf)
>
> static void enetc_imdio_remove(struct enetc_pf *pf)
> {
> - if (pf->pcs && pf->ops->destroy_pcs)
> - pf->ops->destroy_pcs(pf->pcs);
> + pcs_put(pf->pcs);
>
> if (pf->imdio) {
> mdiobus_unregister(pf->imdio);
> diff --git a/drivers/net/ethernet/freescale/fman/Kconfig b/drivers/net/ethernet/freescale/fman/Kconfig
> index a55542c1ad65..2b51b223716b 100644
> --- a/drivers/net/ethernet/freescale/fman/Kconfig
> +++ b/drivers/net/ethernet/freescale/fman/Kconfig
> @@ -3,10 +3,12 @@ config FSL_FMAN
> tristate "FMan support"
> depends on FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST
> select GENERIC_ALLOCATOR
> + select OF_DYNAMIC
> + select MDIO_BUS
> select PHYLINK
> + select PCS
> select PCS_LYNX
> select CRC32
> - default n
> help
> Freescale Data-Path Acceleration Architecture Frame Manager
> (FMan) support
> diff --git a/drivers/net/ethernet/freescale/fman/fman_memac.c b/drivers/net/ethernet/freescale/fman/fman_memac.c
> index 3925441143fa..a6064bc80ce7 100644
> --- a/drivers/net/ethernet/freescale/fman/fman_memac.c
> +++ b/drivers/net/ethernet/freescale/fman/fman_memac.c
> @@ -11,6 +11,7 @@
>
> #include <linux/slab.h>
> #include <linux/io.h>
> +#include <linux/pcs.h>
> #include <linux/pcs-lynx.h>
> #include <linux/phy.h>
> #include <linux/phy_fixed.h>
> @@ -972,21 +973,21 @@ static int memac_init(struct fman_mac *memac)
> return 0;
> }
>
> -static void pcs_put(struct phylink_pcs *pcs)
> +static void memac_pcs_put(struct phylink_pcs *pcs)
> {
> if (IS_ERR_OR_NULL(pcs))
> return;
>
> - lynx_pcs_destroy(pcs);
> + pcs_put(pcs);
> }
>
> static int memac_free(struct fman_mac *memac)
> {
> free_init_resources(memac);
>
> - pcs_put(memac->sgmii_pcs);
> - pcs_put(memac->qsgmii_pcs);
> - pcs_put(memac->xfi_pcs);
> + memac_pcs_put(memac->sgmii_pcs);
> + memac_pcs_put(memac->qsgmii_pcs);
> + memac_pcs_put(memac->xfi_pcs);
> kfree(memac->memac_drv_param);
> kfree(memac);
>
> @@ -1033,7 +1034,8 @@ static struct fman_mac *memac_config(struct mac_device *mac_dev,
> return memac;
> }
>
> -static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node,
> +static struct phylink_pcs *memac_pcs_create(struct device *dev,
> + struct device_node *mac_node,
> int index)
> {
> struct device_node *node;
> @@ -1043,7 +1045,7 @@ static struct phylink_pcs *memac_pcs_create(struct device_node *mac_node,
> if (!node)
> return ERR_PTR(-ENODEV);
>
> - pcs = lynx_pcs_create_fwnode(of_fwnode_handle(node));
> + pcs = lynx_pcs_create_fwnode(dev, of_fwnode_handle(node));
> of_node_put(node);
>
> return pcs;
> @@ -1100,7 +1102,7 @@ int memac_initialization(struct mac_device *mac_dev,
>
> err = of_property_match_string(mac_node, "pcs-handle-names", "xfi");
> if (err >= 0) {
> - memac->xfi_pcs = memac_pcs_create(mac_node, err);
> + memac->xfi_pcs = memac_pcs_create(mac_dev->dev, mac_node, err);
> if (IS_ERR(memac->xfi_pcs)) {
> err = PTR_ERR(memac->xfi_pcs);
> dev_err_probe(mac_dev->dev, err, "missing xfi pcs\n");
> @@ -1112,7 +1114,8 @@ int memac_initialization(struct mac_device *mac_dev,
>
> err = of_property_match_string(mac_node, "pcs-handle-names", "qsgmii");
> if (err >= 0) {
> - memac->qsgmii_pcs = memac_pcs_create(mac_node, err);
> + memac->qsgmii_pcs = memac_pcs_create(mac_dev->dev, mac_node,
> + err);
> if (IS_ERR(memac->qsgmii_pcs)) {
> err = PTR_ERR(memac->qsgmii_pcs);
> dev_err_probe(mac_dev->dev, err,
> @@ -1128,11 +1131,11 @@ int memac_initialization(struct mac_device *mac_dev,
> */
> err = of_property_match_string(mac_node, "pcs-handle-names", "sgmii");
> if (err == -EINVAL || err == -ENODATA)
> - pcs = memac_pcs_create(mac_node, 0);
> + pcs = memac_pcs_create(mac_dev->dev, mac_node, 0);
> else if (err < 0)
> goto _return_fm_mac_free;
> else
> - pcs = memac_pcs_create(mac_node, err);
> + pcs = memac_pcs_create(mac_dev->dev, mac_node, err);
>
> if (IS_ERR(pcs)) {
> err = PTR_ERR(pcs);
> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index 67fa879b1e52..170ec691d090 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -182,9 +182,12 @@ config DWMAC_SOCFPGA
> tristate "SOCFPGA dwmac support"
> default ARCH_INTEL_SOCFPGA
> depends on OF && (ARCH_INTEL_SOCFPGA || COMPILE_TEST)
> + select OF_DYNAMIC
> select MFD_SYSCON
> + select MDIO_BUS
> select MDIO_REGMAP
> select REGMAP_MMIO
> + select PCS
> select PCS_LYNX
> help
> Support for ethernet controller on Altera SOCFPGA
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> index 72b50f6d72f4..325486c06511 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
> @@ -8,6 +8,7 @@
> #include <linux/of.h>
> #include <linux/of_address.h>
> #include <linux/of_net.h>
> +#include <linux/pcs.h>
> #include <linux/phy.h>
> #include <linux/regmap.h>
> #include <linux/mdio/mdio-regmap.h>
> @@ -414,7 +415,7 @@ static int socfpga_dwmac_pcs_init(struct stmmac_priv *priv)
> if (IS_ERR(pcs_bus))
> return PTR_ERR(pcs_bus);
>
> - pcs = lynx_pcs_create_mdiodev(pcs_bus, 0);
> + pcs = lynx_pcs_create_mdiodev(priv->device, pcs_bus, 0);
> if (IS_ERR(pcs))
> return PTR_ERR(pcs);
>
> @@ -424,8 +425,7 @@ static int socfpga_dwmac_pcs_init(struct stmmac_priv *priv)
>
> static void socfpga_dwmac_pcs_exit(struct stmmac_priv *priv)
> {
> - if (priv->hw->phylink_pcs)
> - lynx_pcs_destroy(priv->hw->phylink_pcs);
> + pcs_put(priv->hw->phylink_pcs);
> }
>
> static struct phylink_pcs *socfpga_dwmac_select_pcs(struct stmmac_priv *priv,
> diff --git a/drivers/net/pcs/Kconfig b/drivers/net/pcs/Kconfig
> index 6d19625b696d..f274ebffaae3 100644
> --- a/drivers/net/pcs/Kconfig
> +++ b/drivers/net/pcs/Kconfig
> @@ -26,10 +26,15 @@ config PCS_XPCS
> DesignWare XPCS controllers.
>
> config PCS_LYNX
> - tristate
> + tristate "NXP Lynx PCS driver"
> + depends on PCS && MDIO_BUS
> help
> - This module provides helpers to phylink for managing the Lynx PCS
> - which is part of the Layerscape and QorIQ Ethernet SERDES.
> + This module provides driver support for the PCSs in Lynx 10g and 28g
> + SerDes devices. These devices are present in NXP QorIQ SoCs,
> + including the Layerscape series.
> +
> + If you want to use Ethernet on a QorIQ SoC, say "Y". If compiled as a
> + module, it will be called "pcs-lynx".
>
> config PCS_MTK_LYNXI
> tristate
> diff --git a/drivers/net/pcs/pcs-lynx.c b/drivers/net/pcs/pcs-lynx.c
> index 23b40e9eacbb..bacba1dd52e2 100644
> --- a/drivers/net/pcs/pcs-lynx.c
> +++ b/drivers/net/pcs/pcs-lynx.c
> @@ -1,11 +1,15 @@
> -// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
> -/* Copyright 2020 NXP
> +// SPDX-License-Identifier: GPL-2.0+
> +/* Copyright (C) 2022 Sean Anderson <seanga2@gmail.com>
> + * Copyright 2020 NXP
> * Lynx PCS MDIO helpers
> */
>
> #include <linux/mdio.h>
> #include <linux/phylink.h>
> +#include <linux/of.h>
> +#include <linux/pcs.h>
> #include <linux/pcs-lynx.h>
> +#include <linux/phylink.h>
> #include <linux/property.h>
>
> #define SGMII_CLOCK_PERIOD_NS 8 /* PCS is clocked at 125 MHz */
> @@ -343,16 +347,16 @@ static const phy_interface_t lynx_interfaces[] = {
> PHY_INTERFACE_MODE_USXGMII,
> };
>
> -static struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio)
> +static int lynx_pcs_probe(struct mdio_device *mdio)
> {
> + struct device *dev = &mdio->dev;
> struct lynx_pcs *lynx;
> - int i;
> + int i, ret;
>
> - lynx = kzalloc(sizeof(*lynx), GFP_KERNEL);
> + lynx = devm_kzalloc(dev, sizeof(*lynx), GFP_KERNEL);
> if (!lynx)
> - return ERR_PTR(-ENOMEM);
> + return -ENOMEM;
>
> - mdio_device_get(mdio);
> lynx->mdio = mdio;
> lynx->pcs.ops = &lynx_pcs_phylink_ops;
> lynx->pcs.poll = true;
> @@ -360,32 +364,64 @@ static struct phylink_pcs *lynx_pcs_create(struct mdio_device *mdio)
> for (i = 0; i < ARRAY_SIZE(lynx_interfaces); i++)
> __set_bit(lynx_interfaces[i], lynx->pcs.supported_interfaces);
>
> - return lynx_to_phylink_pcs(lynx);
> + ret = devm_pcs_register(dev, &lynx->pcs);
> + if (ret)
> + return dev_err_probe(dev, ret, "could not register PCS\n");
> + dev_info(dev, "probed\n");
> + return 0;
> }
>
> -struct phylink_pcs *lynx_pcs_create_mdiodev(struct mii_bus *bus, int addr)
> +static const struct of_device_id lynx_pcs_of_match[] = {
> + { .compatible = "fsl,lynx-pcs" },
> + { },
> +};
> +MODULE_DEVICE_TABLE(of, lynx_pcs_of_match);
> +
> +static struct mdio_driver lynx_pcs_driver = {
> + .probe = lynx_pcs_probe,
> + .mdiodrv.driver = {
> + .name = "lynx-pcs",
> + .of_match_table = of_match_ptr(lynx_pcs_of_match),
> + },
> +};
> +mdio_module_driver(lynx_pcs_driver);
> +
> +struct phylink_pcs *lynx_pcs_create_mdiodev(struct device *dev,
> + struct mii_bus *bus, int addr)
> {
> struct mdio_device *mdio;
> struct phylink_pcs *pcs;
> + int err;
>
> mdio = mdio_device_create(bus, addr);
> if (IS_ERR(mdio))
> return ERR_CAST(mdio);
>
> - pcs = lynx_pcs_create(mdio);
> -
> - /* lynx_create() has taken a refcount on the mdiodev if it was
> - * successful. If lynx_create() fails, this will free the mdio
> - * device here. In any case, we don't need to hold our reference
> - * anymore, and putting it here will allow mdio_device_put() in
> - * lynx_destroy() to automatically free the mdio device.
> - */
> - mdio_device_put(mdio);
> + mdio->bus_match = mdio_device_bus_match;
> + strscpy(mdio->modalias, "lynx-pcs");
> + err = mdio_device_register(mdio);
> + if (err) {
> + mdio_device_free(mdio);
> + return ERR_PTR(err);
> + }
>
> + pcs = pcs_get_by_dev(dev, &mdio->dev);
> + mdio_device_free(mdio);
> return pcs;
> }
> EXPORT_SYMBOL(lynx_pcs_create_mdiodev);
>
> +static int lynx_pcs_fixup(struct of_changeset *ocs,
> + struct device_node *np, void *data)
> +{
> +#ifdef CONFIG_OF_DYNAMIC
> + return of_changeset_add_prop_string(ocs, np, "compatible",
> + "fsl,lynx-pcs");
> +#else
> + return -ENODEV;
> +#endif
> +}
> +
> /*
> * lynx_pcs_create_fwnode() creates a lynx PCS instance from the fwnode
> * device indicated by node.
> @@ -396,40 +432,12 @@ EXPORT_SYMBOL(lynx_pcs_create_mdiodev);
> * -ENOMEM if we fail to allocate memory
> * pointer to a phylink_pcs on success
> */
> -struct phylink_pcs *lynx_pcs_create_fwnode(struct fwnode_handle *node)
> +struct phylink_pcs *lynx_pcs_create_fwnode(struct device *dev,
> + struct fwnode_handle *node)
> {
> - struct mdio_device *mdio;
> - struct phylink_pcs *pcs;
> -
> - if (!fwnode_device_is_available(node))
> - return ERR_PTR(-ENODEV);
> -
> - mdio = fwnode_mdio_find_device(node);
> - if (!mdio)
> - return ERR_PTR(-EPROBE_DEFER);
> -
> - pcs = lynx_pcs_create(mdio);
> -
> - /* lynx_create() has taken a refcount on the mdiodev if it was
> - * successful. If lynx_create() fails, this will free the mdio
> - * device here. In any case, we don't need to hold our reference
> - * anymore, and putting it here will allow mdio_device_put() in
> - * lynx_destroy() to automatically free the mdio device.
> - */
> - mdio_device_put(mdio);
> -
> - return pcs;
> + return pcs_get_by_fwnode_compat(dev, node, lynx_pcs_fixup, NULL);
> }
> EXPORT_SYMBOL_GPL(lynx_pcs_create_fwnode);
>
> -void lynx_pcs_destroy(struct phylink_pcs *pcs)
> -{
> - struct lynx_pcs *lynx = phylink_pcs_to_lynx(pcs);
> -
> - mdio_device_put(lynx->mdio);
> - kfree(lynx);
> -}
> -EXPORT_SYMBOL(lynx_pcs_destroy);
> -
> -MODULE_DESCRIPTION("NXP Lynx PCS phylink library");
> -MODULE_LICENSE("Dual BSD/GPL");
> +MODULE_DESCRIPTION("NXP Lynx PCS phylink driver");
> +MODULE_LICENSE("GPL");
> diff --git a/include/linux/pcs-lynx.h b/include/linux/pcs-lynx.h
> index 7958cccd16f2..a95801337205 100644
> --- a/include/linux/pcs-lynx.h
> +++ b/include/linux/pcs-lynx.h
> @@ -6,12 +6,13 @@
> #ifndef __LINUX_PCS_LYNX_H
> #define __LINUX_PCS_LYNX_H
>
> -#include <linux/mdio.h>
> -#include <linux/phylink.h>
> +struct device;
> +struct mii_bus;
> +struct phylink_pcs;
>
> -struct phylink_pcs *lynx_pcs_create_mdiodev(struct mii_bus *bus, int addr);
> -struct phylink_pcs *lynx_pcs_create_fwnode(struct fwnode_handle *node);
> -
> -void lynx_pcs_destroy(struct phylink_pcs *pcs);
> +struct phylink_pcs *lynx_pcs_create_mdiodev(struct device *dev,
> + struct mii_bus *bus, int addr);
> +struct phylink_pcs *lynx_pcs_create_fwnode(struct device *dev,
> + struct fwnode_handle *node);
>
> #endif /* __LINUX_PCS_LYNX_H */
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 21:33 ` Heiner Kallweit
@ 2025-05-23 21:39 ` Sean Anderson
2025-05-23 22:07 ` Sean Anderson
0 siblings, 1 reply; 11+ messages in thread
From: Sean Anderson @ 2025-05-23 21:39 UTC (permalink / raw)
To: Heiner Kallweit, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King
Cc: Lei Wei, Christian Marangi, Kory Maincent, Simon Horman,
Daniel Golle, Vineeth Karumanchi, linux-kernel, Ioana Ciornei,
Vladimir Oltean, imx, linux-stm32
On 5/23/25 17:33, Heiner Kallweit wrote:
> On 23.05.2025 22:33, Sean Anderson wrote:
>> This converts the lynx PCS driver to a proper MDIO driver.
>> This allows using a more conventional driver lifecycle (e.g. with a
>> probe and remove). It will also make it easier to add interrupt support.
>>
>> The existing helpers are converted to bind the MDIO driver instead of
>> creating the PCS directly. As lynx_pcs_create_mdiodev creates the PCS
>> device, we can just set the modalias. For lynx_pcs_create_fwnode, we try
>> to get the PCS the usual way, and if that fails we edit the devicetree
>> to add a compatible and reprobe the device.
>>
>> To ensure my contributions remain free software, remove the BSD option
>> from the license. This is permitted because the SPDX uses "OR".
>>
>> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
>> ---
>>
>> Changes in v5:
>> - Use MDIO_BUS instead of MDIO_DEVICE
>>
>> Changes in v4:
>> - Add a note about the license
>> - Convert to dev-less pcs_put
>>
>> Changes in v3:
>> - Call devm_pcs_register instead of devm_pcs_register_provider
>>
>> Changes in v2:
>> - Add support for #pcs-cells
>> - Remove unused variable lynx_properties
>>
>> drivers/net/dsa/ocelot/Kconfig | 4 +
>> drivers/net/dsa/ocelot/felix_vsc9959.c | 11 +-
>> drivers/net/dsa/ocelot/seville_vsc9953.c | 11 +-
>> drivers/net/ethernet/altera/Kconfig | 2 +
>> drivers/net/ethernet/altera/altera_tse_main.c | 7 +-
>> drivers/net/ethernet/freescale/dpaa/Kconfig | 2 +-
>> drivers/net/ethernet/freescale/dpaa2/Kconfig | 3 +
>> .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 11 +-
>> drivers/net/ethernet/freescale/enetc/Kconfig | 2 +
>> .../net/ethernet/freescale/enetc/enetc_pf.c | 8 +-
>> .../net/ethernet/freescale/enetc/enetc_pf.h | 1 -
>> .../freescale/enetc/enetc_pf_common.c | 4 +-
>> drivers/net/ethernet/freescale/fman/Kconfig | 4 +-
>> .../net/ethernet/freescale/fman/fman_memac.c | 25 ++--
>> drivers/net/ethernet/stmicro/stmmac/Kconfig | 3 +
>> .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 +-
>> drivers/net/pcs/Kconfig | 11 +-
>> drivers/net/pcs/pcs-lynx.c | 110 ++++++++++--------
>> include/linux/pcs-lynx.h | 13 ++-
>> 19 files changed, 128 insertions(+), 110 deletions(-)
>>
>> diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig
>> index 081e7a88ea02..907c29d61c14 100644
>> --- a/drivers/net/dsa/ocelot/Kconfig
>> +++ b/drivers/net/dsa/ocelot/Kconfig
>> @@ -42,7 +42,9 @@ config NET_DSA_MSCC_FELIX
>> select NET_DSA_TAG_OCELOT_8021Q
>> select NET_DSA_TAG_OCELOT
>> select FSL_ENETC_MDIO
>> + select PCS
>> select PCS_LYNX
>> + select MDIO_BUS
>
> This shouldn't be needed. NET_DSA selects PHYLINK, which selects PHYLIB,
> which selects MDIO_BUS. There are more places in this series where the
> same comment applies.
select does not transitively enable dependencies. See the note in
Documentation/kbuild/kconfig-language.rst for details. Therefore we must
select the dependencies of things we select in order to ensure we do not
trip sym_warn_unmet_dep.
--Sean
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 21:39 ` Sean Anderson
@ 2025-05-23 22:07 ` Sean Anderson
2025-05-23 22:47 ` Sean Anderson
2025-05-24 0:05 ` Russell King (Oracle)
0 siblings, 2 replies; 11+ messages in thread
From: Sean Anderson @ 2025-05-23 22:07 UTC (permalink / raw)
To: Heiner Kallweit, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King
Cc: Lei Wei, Christian Marangi, Kory Maincent, Simon Horman,
Daniel Golle, Vineeth Karumanchi, linux-kernel, Ioana Ciornei,
Vladimir Oltean, imx, linux-stm32
On 5/23/25 17:39, Sean Anderson wrote:
> On 5/23/25 17:33, Heiner Kallweit wrote:
>> On 23.05.2025 22:33, Sean Anderson wrote:
>>> This converts the lynx PCS driver to a proper MDIO driver.
>>> This allows using a more conventional driver lifecycle (e.g. with a
>>> probe and remove). It will also make it easier to add interrupt support.
>>>
>>> The existing helpers are converted to bind the MDIO driver instead of
>>> creating the PCS directly. As lynx_pcs_create_mdiodev creates the PCS
>>> device, we can just set the modalias. For lynx_pcs_create_fwnode, we try
>>> to get the PCS the usual way, and if that fails we edit the devicetree
>>> to add a compatible and reprobe the device.
>>>
>>> To ensure my contributions remain free software, remove the BSD option
>>> from the license. This is permitted because the SPDX uses "OR".
>>>
>>> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
>>> ---
>>>
>>> Changes in v5:
>>> - Use MDIO_BUS instead of MDIO_DEVICE
>>>
>>> Changes in v4:
>>> - Add a note about the license
>>> - Convert to dev-less pcs_put
>>>
>>> Changes in v3:
>>> - Call devm_pcs_register instead of devm_pcs_register_provider
>>>
>>> Changes in v2:
>>> - Add support for #pcs-cells
>>> - Remove unused variable lynx_properties
>>>
>>> drivers/net/dsa/ocelot/Kconfig | 4 +
>>> drivers/net/dsa/ocelot/felix_vsc9959.c | 11 +-
>>> drivers/net/dsa/ocelot/seville_vsc9953.c | 11 +-
>>> drivers/net/ethernet/altera/Kconfig | 2 +
>>> drivers/net/ethernet/altera/altera_tse_main.c | 7 +-
>>> drivers/net/ethernet/freescale/dpaa/Kconfig | 2 +-
>>> drivers/net/ethernet/freescale/dpaa2/Kconfig | 3 +
>>> .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 11 +-
>>> drivers/net/ethernet/freescale/enetc/Kconfig | 2 +
>>> .../net/ethernet/freescale/enetc/enetc_pf.c | 8 +-
>>> .../net/ethernet/freescale/enetc/enetc_pf.h | 1 -
>>> .../freescale/enetc/enetc_pf_common.c | 4 +-
>>> drivers/net/ethernet/freescale/fman/Kconfig | 4 +-
>>> .../net/ethernet/freescale/fman/fman_memac.c | 25 ++--
>>> drivers/net/ethernet/stmicro/stmmac/Kconfig | 3 +
>>> .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 +-
>>> drivers/net/pcs/Kconfig | 11 +-
>>> drivers/net/pcs/pcs-lynx.c | 110 ++++++++++--------
>>> include/linux/pcs-lynx.h | 13 ++-
>>> 19 files changed, 128 insertions(+), 110 deletions(-)
>>>
>>> diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig
>>> index 081e7a88ea02..907c29d61c14 100644
>>> --- a/drivers/net/dsa/ocelot/Kconfig
>>> +++ b/drivers/net/dsa/ocelot/Kconfig
>>> @@ -42,7 +42,9 @@ config NET_DSA_MSCC_FELIX
>>> select NET_DSA_TAG_OCELOT_8021Q
>>> select NET_DSA_TAG_OCELOT
>>> select FSL_ENETC_MDIO
>>> + select PCS
>>> select PCS_LYNX
>>> + select MDIO_BUS
>>
>> This shouldn't be needed. NET_DSA selects PHYLINK, which selects PHYLIB,
>> which selects MDIO_BUS. There are more places in this series where the
>> same comment applies.
>
> select does not transitively enable dependencies. See the note in
> Documentation/kbuild/kconfig-language.rst for details. Therefore we must
> select the dependencies of things we select in order to ensure we do not
> trip sym_warn_unmet_dep.
OK, I see what you mean here. But of course NET_DSA is missing selects for
PHYLIB and MDIO_BUS. And PHYLINK is also missing a select for MDIO_BUS. Actually,
this bug is really endemic. Maybe we should just get rid of PHYLIB as a config
and just make everything depend on ETHERNET instead.
--Sean
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 22:07 ` Sean Anderson
@ 2025-05-23 22:47 ` Sean Anderson
2025-05-24 0:05 ` Russell King (Oracle)
1 sibling, 0 replies; 11+ messages in thread
From: Sean Anderson @ 2025-05-23 22:47 UTC (permalink / raw)
To: Heiner Kallweit, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King
Cc: Lei Wei, Christian Marangi, Kory Maincent, Simon Horman,
Daniel Golle, Vineeth Karumanchi, linux-kernel, Ioana Ciornei,
Vladimir Oltean, imx, linux-stm32
On 5/23/25 18:07, Sean Anderson wrote:
> On 5/23/25 17:39, Sean Anderson wrote:
>> On 5/23/25 17:33, Heiner Kallweit wrote:
>>> On 23.05.2025 22:33, Sean Anderson wrote:
>>>> This converts the lynx PCS driver to a proper MDIO driver.
>>>> This allows using a more conventional driver lifecycle (e.g. with a
>>>> probe and remove). It will also make it easier to add interrupt support.
>>>>
>>>> The existing helpers are converted to bind the MDIO driver instead of
>>>> creating the PCS directly. As lynx_pcs_create_mdiodev creates the PCS
>>>> device, we can just set the modalias. For lynx_pcs_create_fwnode, we try
>>>> to get the PCS the usual way, and if that fails we edit the devicetree
>>>> to add a compatible and reprobe the device.
>>>>
>>>> To ensure my contributions remain free software, remove the BSD option
>>>> from the license. This is permitted because the SPDX uses "OR".
>>>>
>>>> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
>>>> ---
>>>>
>>>> Changes in v5:
>>>> - Use MDIO_BUS instead of MDIO_DEVICE
>>>>
>>>> Changes in v4:
>>>> - Add a note about the license
>>>> - Convert to dev-less pcs_put
>>>>
>>>> Changes in v3:
>>>> - Call devm_pcs_register instead of devm_pcs_register_provider
>>>>
>>>> Changes in v2:
>>>> - Add support for #pcs-cells
>>>> - Remove unused variable lynx_properties
>>>>
>>>> drivers/net/dsa/ocelot/Kconfig | 4 +
>>>> drivers/net/dsa/ocelot/felix_vsc9959.c | 11 +-
>>>> drivers/net/dsa/ocelot/seville_vsc9953.c | 11 +-
>>>> drivers/net/ethernet/altera/Kconfig | 2 +
>>>> drivers/net/ethernet/altera/altera_tse_main.c | 7 +-
>>>> drivers/net/ethernet/freescale/dpaa/Kconfig | 2 +-
>>>> drivers/net/ethernet/freescale/dpaa2/Kconfig | 3 +
>>>> .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 11 +-
>>>> drivers/net/ethernet/freescale/enetc/Kconfig | 2 +
>>>> .../net/ethernet/freescale/enetc/enetc_pf.c | 8 +-
>>>> .../net/ethernet/freescale/enetc/enetc_pf.h | 1 -
>>>> .../freescale/enetc/enetc_pf_common.c | 4 +-
>>>> drivers/net/ethernet/freescale/fman/Kconfig | 4 +-
>>>> .../net/ethernet/freescale/fman/fman_memac.c | 25 ++--
>>>> drivers/net/ethernet/stmicro/stmmac/Kconfig | 3 +
>>>> .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 +-
>>>> drivers/net/pcs/Kconfig | 11 +-
>>>> drivers/net/pcs/pcs-lynx.c | 110 ++++++++++--------
>>>> include/linux/pcs-lynx.h | 13 ++-
>>>> 19 files changed, 128 insertions(+), 110 deletions(-)
>>>>
>>>> diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig
>>>> index 081e7a88ea02..907c29d61c14 100644
>>>> --- a/drivers/net/dsa/ocelot/Kconfig
>>>> +++ b/drivers/net/dsa/ocelot/Kconfig
>>>> @@ -42,7 +42,9 @@ config NET_DSA_MSCC_FELIX
>>>> select NET_DSA_TAG_OCELOT_8021Q
>>>> select NET_DSA_TAG_OCELOT
>>>> select FSL_ENETC_MDIO
>>>> + select PCS
>>>> select PCS_LYNX
>>>> + select MDIO_BUS
>>>
>>> This shouldn't be needed. NET_DSA selects PHYLINK, which selects PHYLIB,
>>> which selects MDIO_BUS. There are more places in this series where the
>>> same comment applies.
>>
>> select does not transitively enable dependencies. See the note in
>> Documentation/kbuild/kconfig-language.rst for details. Therefore we must
>> select the dependencies of things we select in order to ensure we do not
>> trip sym_warn_unmet_dep.
>
> OK, I see what you mean here. But of course NET_DSA is missing selects for
> PHYLIB and MDIO_BUS. And PHYLINK is also missing a select for MDIO_BUS. Actually,
> this bug is really endemic. Maybe we should just get rid of PHYLIB as a config
> and just make everything depend on ETHERNET instead.
After some experimentation, I think what that note means is that select
is recursive for select but not for depends on. So I think I only have
to select the "forward" dependencies, which is certainly easier.
--Sean
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 22:07 ` Sean Anderson
2025-05-23 22:47 ` Sean Anderson
@ 2025-05-24 0:05 ` Russell King (Oracle)
1 sibling, 0 replies; 11+ messages in thread
From: Russell King (Oracle) @ 2025-05-24 0:05 UTC (permalink / raw)
To: Sean Anderson
Cc: Heiner Kallweit, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Lei Wei,
Christian Marangi, Kory Maincent, Simon Horman, Daniel Golle,
Vineeth Karumanchi, linux-kernel, Ioana Ciornei, Vladimir Oltean,
imx, linux-stm32
On Fri, May 23, 2025 at 06:07:16PM -0400, Sean Anderson wrote:
> On 5/23/25 17:39, Sean Anderson wrote:
> > On 5/23/25 17:33, Heiner Kallweit wrote:
> >> On 23.05.2025 22:33, Sean Anderson wrote:
> >>> This converts the lynx PCS driver to a proper MDIO driver.
> >>> This allows using a more conventional driver lifecycle (e.g. with a
> >>> probe and remove). It will also make it easier to add interrupt support.
> >>>
> >>> The existing helpers are converted to bind the MDIO driver instead of
> >>> creating the PCS directly. As lynx_pcs_create_mdiodev creates the PCS
> >>> device, we can just set the modalias. For lynx_pcs_create_fwnode, we try
> >>> to get the PCS the usual way, and if that fails we edit the devicetree
> >>> to add a compatible and reprobe the device.
> >>>
> >>> To ensure my contributions remain free software, remove the BSD option
> >>> from the license. This is permitted because the SPDX uses "OR".
> >>>
> >>> Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
> >>> ---
> >>>
> >>> Changes in v5:
> >>> - Use MDIO_BUS instead of MDIO_DEVICE
> >>>
> >>> Changes in v4:
> >>> - Add a note about the license
> >>> - Convert to dev-less pcs_put
> >>>
> >>> Changes in v3:
> >>> - Call devm_pcs_register instead of devm_pcs_register_provider
> >>>
> >>> Changes in v2:
> >>> - Add support for #pcs-cells
> >>> - Remove unused variable lynx_properties
> >>>
> >>> drivers/net/dsa/ocelot/Kconfig | 4 +
> >>> drivers/net/dsa/ocelot/felix_vsc9959.c | 11 +-
> >>> drivers/net/dsa/ocelot/seville_vsc9953.c | 11 +-
> >>> drivers/net/ethernet/altera/Kconfig | 2 +
> >>> drivers/net/ethernet/altera/altera_tse_main.c | 7 +-
> >>> drivers/net/ethernet/freescale/dpaa/Kconfig | 2 +-
> >>> drivers/net/ethernet/freescale/dpaa2/Kconfig | 3 +
> >>> .../net/ethernet/freescale/dpaa2/dpaa2-mac.c | 11 +-
> >>> drivers/net/ethernet/freescale/enetc/Kconfig | 2 +
> >>> .../net/ethernet/freescale/enetc/enetc_pf.c | 8 +-
> >>> .../net/ethernet/freescale/enetc/enetc_pf.h | 1 -
> >>> .../freescale/enetc/enetc_pf_common.c | 4 +-
> >>> drivers/net/ethernet/freescale/fman/Kconfig | 4 +-
> >>> .../net/ethernet/freescale/fman/fman_memac.c | 25 ++--
> >>> drivers/net/ethernet/stmicro/stmmac/Kconfig | 3 +
> >>> .../ethernet/stmicro/stmmac/dwmac-socfpga.c | 6 +-
> >>> drivers/net/pcs/Kconfig | 11 +-
> >>> drivers/net/pcs/pcs-lynx.c | 110 ++++++++++--------
> >>> include/linux/pcs-lynx.h | 13 ++-
> >>> 19 files changed, 128 insertions(+), 110 deletions(-)
> >>>
> >>> diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig
> >>> index 081e7a88ea02..907c29d61c14 100644
> >>> --- a/drivers/net/dsa/ocelot/Kconfig
> >>> +++ b/drivers/net/dsa/ocelot/Kconfig
> >>> @@ -42,7 +42,9 @@ config NET_DSA_MSCC_FELIX
> >>> select NET_DSA_TAG_OCELOT_8021Q
> >>> select NET_DSA_TAG_OCELOT
> >>> select FSL_ENETC_MDIO
> >>> + select PCS
> >>> select PCS_LYNX
> >>> + select MDIO_BUS
> >>
> >> This shouldn't be needed. NET_DSA selects PHYLINK, which selects PHYLIB,
> >> which selects MDIO_BUS. There are more places in this series where the
> >> same comment applies.
> >
> > select does not transitively enable dependencies. See the note in
> > Documentation/kbuild/kconfig-language.rst for details. Therefore we must
> > select the dependencies of things we select in order to ensure we do not
> > trip sym_warn_unmet_dep.
>
> OK, I see what you mean here. But of course NET_DSA is missing selects for
> PHYLIB and MDIO_BUS. And PHYLINK is also missing a select for MDIO_BUS. Actually,
> this bug is really endemic. Maybe we should just get rid of PHYLIB as a config
> and just make everything depend on ETHERNET instead.
You're reading the documentation wrongly.
Take this example:
config A
select B
config B
select C
depends on E
config C
select D
config D
config E
Enabling A leads to B, C and D all being enabled, but it does *not*
lead to E being enabled - kconfig will issue a warning if E is not
already enabled.
E is a dependency of B. There are no other dependencies, but there
are reverse dependencies, and reverse dependencies are propagated.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 20:33 ` [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver Sean Anderson
2025-05-23 21:33 ` Heiner Kallweit
@ 2025-05-24 8:21 ` kernel test robot
2025-05-24 8:42 ` kernel test robot
` (2 subsequent siblings)
4 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-05-24 8:21 UTC (permalink / raw)
To: Sean Anderson, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King
Cc: llvm, oe-kbuild-all, Lei Wei, Heiner Kallweit, Christian Marangi,
Kory Maincent, Simon Horman, Daniel Golle, Vineeth Karumanchi,
linux-kernel, Sean Anderson, Ioana Ciornei, Vladimir Oltean, imx,
linux-stm32
Hi Sean,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Sean-Anderson/dt-bindings-net-Add-Xilinx-PCS/20250524-043901
base: net-next/main
patch link: https://lore.kernel.org/r/20250523203339.1993685-6-sean.anderson%40linux.dev
patch subject: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
config: hexagon-randconfig-001-20250524 (https://download.01.org/0day-ci/archive/20250524/202505241550.xuPguGhB-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250524/202505241550.xuPguGhB-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505241550.xuPguGhB-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/i2c/i2c-core-base.c:24:
In file included from include/linux/i2c.h:21:
In file included from include/linux/irqdomain.h:36:
>> include/linux/of.h:1616:34: error: use of undeclared identifier 'OF_RECONFIG_ATTACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1616 | return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1622:34: error: use of undeclared identifier 'OF_RECONFIG_DETACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1622 | return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1628:34: error: use of undeclared identifier 'OF_RECONFIG_ADD_PROPERTY'
1628 | return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1634:34: error: use of undeclared identifier 'OF_RECONFIG_REMOVE_PROPERTY'
1634 | return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1640:34: error: use of undeclared identifier 'OF_RECONFIG_UPDATE_PROPERTY'
1640 | return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
| ^
5 errors generated.
--
In file included from drivers/i2c/i2c-core-of-prober.c:14:
In file included from include/linux/i2c.h:21:
In file included from include/linux/irqdomain.h:36:
>> include/linux/of.h:1616:34: error: use of undeclared identifier 'OF_RECONFIG_ATTACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1616 | return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1622:34: error: use of undeclared identifier 'OF_RECONFIG_DETACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1622 | return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1628:34: error: use of undeclared identifier 'OF_RECONFIG_ADD_PROPERTY'
1628 | return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1634:34: error: use of undeclared identifier 'OF_RECONFIG_REMOVE_PROPERTY'
1634 | return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1640:34: error: use of undeclared identifier 'OF_RECONFIG_UPDATE_PROPERTY'
1640 | return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
| ^
>> drivers/i2c/i2c-core-of-prober.c:146:2: error: call to undeclared function 'of_get_next_child_with_prefix'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
146 | for_each_child_of_node_with_prefix(i2c_node, node, type)
| ^
include/linux/of.h:1478:7: note: expanded from macro 'for_each_child_of_node_with_prefix'
1478 | of_get_next_child_with_prefix(parent, NULL, prefix); \
| ^
>> drivers/i2c/i2c-core-of-prober.c:146:47: error: incompatible integer to pointer conversion initializing 'struct device_node *' with an expression of type 'int' [-Wint-conversion]
146 | for_each_child_of_node_with_prefix(i2c_node, node, type)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
include/linux/of.h:1477:27: note: expanded from macro 'for_each_child_of_node_with_prefix'
1477 | for (struct device_node *child __free(device_node) = \
| ^
1478 | of_get_next_child_with_prefix(parent, NULL, prefix); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/i2c/i2c-core-of-prober.c:146:2: error: incompatible integer to pointer conversion assigning to 'struct device_node *' from 'int' [-Wint-conversion]
146 | for_each_child_of_node_with_prefix(i2c_node, node, type)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/of.h:1480:13: note: expanded from macro 'for_each_child_of_node_with_prefix'
1480 | child = of_get_next_child_with_prefix(parent, child, prefix))
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-of-prober.c:161:47: error: incompatible integer to pointer conversion initializing 'struct device_node *' with an expression of type 'int' [-Wint-conversion]
161 | for_each_child_of_node_with_prefix(i2c_node, node, type) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
include/linux/of.h:1477:27: note: expanded from macro 'for_each_child_of_node_with_prefix'
1477 | for (struct device_node *child __free(device_node) = \
| ^
1478 | of_get_next_child_with_prefix(parent, NULL, prefix); \
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/i2c/i2c-core-of-prober.c:161:2: error: incompatible integer to pointer conversion assigning to 'struct device_node *' from 'int' [-Wint-conversion]
161 | for_each_child_of_node_with_prefix(i2c_node, node, type) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/of.h:1480:13: note: expanded from macro 'for_each_child_of_node_with_prefix'
1480 | child = of_get_next_child_with_prefix(parent, child, prefix))
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 errors generated.
--
In file included from drivers/spi/spi-bcm-qspi.c:17:
>> include/linux/of.h:1616:34: error: use of undeclared identifier 'OF_RECONFIG_ATTACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1616 | return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1622:34: error: use of undeclared identifier 'OF_RECONFIG_DETACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1622 | return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1628:34: error: use of undeclared identifier 'OF_RECONFIG_ADD_PROPERTY'
1628 | return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1634:34: error: use of undeclared identifier 'OF_RECONFIG_REMOVE_PROPERTY'
1634 | return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1640:34: error: use of undeclared identifier 'OF_RECONFIG_UPDATE_PROPERTY'
1640 | return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
| ^
In file included from drivers/spi/spi-bcm-qspi.c:21:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:35:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:98:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[2]') [-Warray-bounds]
98 | return (set->sig[3] | set->sig[2] |
| ^ ~
include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
62 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from drivers/spi/spi-bcm-qspi.c:21:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:35:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:98:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[2]') [-Warray-bounds]
98 | return (set->sig[3] | set->sig[2] |
| ^ ~
include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
62 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from drivers/spi/spi-bcm-qspi.c:21:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:35:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:114:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
114 | return (set1->sig[3] == set2->sig[3]) &&
| ^ ~
include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
62 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from drivers/spi/spi-bcm-qspi.c:21:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:35:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:114:27: warning: array index 3 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
114 | return (set1->sig[3] == set2->sig[3]) &&
| ^ ~
include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
62 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from drivers/spi/spi-bcm-qspi.c:21:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:35:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:115:5: warning: array index 2 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
115 | (set1->sig[2] == set2->sig[2]) &&
| ^ ~
include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
62 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from drivers/spi/spi-bcm-qspi.c:21:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:35:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:115:21: warning: array index 2 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
115 | (set1->sig[2] == set2->sig[2]) &&
| ^ ~
include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
62 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from drivers/spi/spi-bcm-qspi.c:21:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:35:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:157:1: warning: array index 3 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
157 | _SIG_SET_BINOP(sigorsets, _sig_or)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/signal.h:138:8: note: expanded from macro '_SIG_SET_BINOP'
138 | a3 = a->sig[3]; a2 = a->sig[2]; \
| ^ ~
include/uapi/asm-generic/signal.h:62:2: note: array 'sig' declared here
62 | unsigned long sig[_NSIG_WORDS];
| ^
In file included from drivers/spi/spi-bcm-qspi.c:21:
In file included from include/linux/spi/spi.h:17:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:35:
In file included from include/linux/rcuwait.h:6:
In file included from include/linux/sched/signal.h:6:
include/linux/signal.h:157:1: warning: array index 2 is past the end of the array (that has type 'const unsigned long[2]') [-Warray-bounds]
157 | _SIG_SET_BINOP(sigorsets, _sig_or)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/signal.h:138:24: note: expanded from macro '_SIG_SET_BINOP'
138 | a3 = a->sig[3]; a2 = a->sig[2]; \
--
In file included from drivers/spi/spi.c:25:
In file included from include/linux/of_irq.h:8:
In file included from include/linux/irqdomain.h:36:
>> include/linux/of.h:1616:34: error: use of undeclared identifier 'OF_RECONFIG_ATTACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1616 | return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1622:34: error: use of undeclared identifier 'OF_RECONFIG_DETACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1622 | return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1628:34: error: use of undeclared identifier 'OF_RECONFIG_ADD_PROPERTY'
1628 | return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1634:34: error: use of undeclared identifier 'OF_RECONFIG_REMOVE_PROPERTY'
1634 | return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1640:34: error: use of undeclared identifier 'OF_RECONFIG_UPDATE_PROPERTY'
1640 | return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
| ^
>> drivers/spi/spi.c:4806:9: error: call to undeclared function 'of_register_spi_device'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
4806 | spi = of_register_spi_device(ctlr, rd->dn);
| ^
drivers/spi/spi.c:4806:9: note: did you mean 'of_register_spi_devices'?
drivers/spi/spi.c:2554:13: note: 'of_register_spi_devices' declared here
2554 | static void of_register_spi_devices(struct spi_controller *ctlr) { }
| ^
>> drivers/spi/spi.c:4806:7: error: incompatible integer to pointer conversion assigning to 'struct spi_device *' from 'int' [-Wint-conversion]
4806 | spi = of_register_spi_device(ctlr, rd->dn);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 errors generated.
--
In file included from drivers/dma/mmp_pdma.c:18:
In file included from include/linux/of_dma.h:13:
>> include/linux/of.h:1616:34: error: use of undeclared identifier 'OF_RECONFIG_ATTACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1616 | return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1622:34: error: use of undeclared identifier 'OF_RECONFIG_DETACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1622 | return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1628:34: error: use of undeclared identifier 'OF_RECONFIG_ADD_PROPERTY'
1628 | return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1634:34: error: use of undeclared identifier 'OF_RECONFIG_REMOVE_PROPERTY'
1634 | return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1640:34: error: use of undeclared identifier 'OF_RECONFIG_UPDATE_PROPERTY'
1640 | return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
| ^
drivers/dma/mmp_pdma.c:1104:27: warning: shift count >= width of type [-Wshift-count-overflow]
1104 | dma_set_mask(pdev->dev, DMA_BIT_MASK(64));
| ^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:73:54: note: expanded from macro 'DMA_BIT_MASK'
73 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
| ^ ~~~
1 warning and 5 errors generated.
--
In file included from drivers/dma/altera-msgdma.c:22:
In file included from include/linux/of_dma.h:13:
>> include/linux/of.h:1616:34: error: use of undeclared identifier 'OF_RECONFIG_ATTACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1616 | return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1622:34: error: use of undeclared identifier 'OF_RECONFIG_DETACH_NODE'; did you mean 'OF_RECONFIG_NO_CHANGE'?
1622 | return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~
| OF_RECONFIG_NO_CHANGE
include/linux/of.h:1591:2: note: 'OF_RECONFIG_NO_CHANGE' declared here
1591 | OF_RECONFIG_NO_CHANGE = 0,
| ^
>> include/linux/of.h:1628:34: error: use of undeclared identifier 'OF_RECONFIG_ADD_PROPERTY'
1628 | return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1634:34: error: use of undeclared identifier 'OF_RECONFIG_REMOVE_PROPERTY'
1634 | return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
| ^
>> include/linux/of.h:1640:34: error: use of undeclared identifier 'OF_RECONFIG_UPDATE_PROPERTY'
1640 | return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
| ^
drivers/dma/altera-msgdma.c:895:46: warning: shift count >= width of type [-Wshift-count-overflow]
895 | ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
| ^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:73:54: note: expanded from macro 'DMA_BIT_MASK'
73 | #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
| ^ ~~~
1 warning and 5 errors generated.
..
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for OF_DYNAMIC
Depends on [n]: OF [=n]
Selected by [y]:
- FSL_FMAN [=y] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_FREESCALE [=y] && (FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST [=y])
vim +1616 include/linux/of.h
201c910bd6898d Pantelis Antoniou 2014-07-04 1589
b53a2340d0d304 Pantelis Antoniou 2014-10-28 1590 enum of_reconfig_change {
b53a2340d0d304 Pantelis Antoniou 2014-10-28 @1591 OF_RECONFIG_NO_CHANGE = 0,
b53a2340d0d304 Pantelis Antoniou 2014-10-28 1592 OF_RECONFIG_CHANGE_ADD,
b53a2340d0d304 Pantelis Antoniou 2014-10-28 1593 OF_RECONFIG_CHANGE_REMOVE,
b53a2340d0d304 Pantelis Antoniou 2014-10-28 1594 };
b53a2340d0d304 Pantelis Antoniou 2014-10-28 1595
2e8fff668dc14e Rob Herring 2023-03-29 1596 struct notifier_block;
2e8fff668dc14e Rob Herring 2023-03-29 1597
201c910bd6898d Pantelis Antoniou 2014-07-04 1598 #ifdef CONFIG_OF_DYNAMIC
f6892d193fb9d6 Grant Likely 2014-11-21 1599 extern int of_reconfig_notifier_register(struct notifier_block *);
f6892d193fb9d6 Grant Likely 2014-11-21 1600 extern int of_reconfig_notifier_unregister(struct notifier_block *);
f5242e5a883bf1 Grant Likely 2014-11-24 1601 extern int of_reconfig_notify(unsigned long, struct of_reconfig_data *rd);
f5242e5a883bf1 Grant Likely 2014-11-24 1602 extern int of_reconfig_get_state_change(unsigned long action,
f5242e5a883bf1 Grant Likely 2014-11-24 1603 struct of_reconfig_data *arg);
f6892d193fb9d6 Grant Likely 2014-11-21 1604
201c910bd6898d Pantelis Antoniou 2014-07-04 1605 extern void of_changeset_init(struct of_changeset *ocs);
201c910bd6898d Pantelis Antoniou 2014-07-04 1606 extern void of_changeset_destroy(struct of_changeset *ocs);
201c910bd6898d Pantelis Antoniou 2014-07-04 1607 extern int of_changeset_apply(struct of_changeset *ocs);
201c910bd6898d Pantelis Antoniou 2014-07-04 1608 extern int of_changeset_revert(struct of_changeset *ocs);
201c910bd6898d Pantelis Antoniou 2014-07-04 1609 extern int of_changeset_action(struct of_changeset *ocs,
201c910bd6898d Pantelis Antoniou 2014-07-04 1610 unsigned long action, struct device_node *np,
201c910bd6898d Pantelis Antoniou 2014-07-04 1611 struct property *prop);
201c910bd6898d Pantelis Antoniou 2014-07-04 1612
201c910bd6898d Pantelis Antoniou 2014-07-04 1613 static inline int of_changeset_attach_node(struct of_changeset *ocs,
201c910bd6898d Pantelis Antoniou 2014-07-04 1614 struct device_node *np)
201c910bd6898d Pantelis Antoniou 2014-07-04 1615 {
201c910bd6898d Pantelis Antoniou 2014-07-04 @1616 return of_changeset_action(ocs, OF_RECONFIG_ATTACH_NODE, np, NULL);
201c910bd6898d Pantelis Antoniou 2014-07-04 1617 }
201c910bd6898d Pantelis Antoniou 2014-07-04 1618
201c910bd6898d Pantelis Antoniou 2014-07-04 1619 static inline int of_changeset_detach_node(struct of_changeset *ocs,
201c910bd6898d Pantelis Antoniou 2014-07-04 1620 struct device_node *np)
201c910bd6898d Pantelis Antoniou 2014-07-04 1621 {
201c910bd6898d Pantelis Antoniou 2014-07-04 @1622 return of_changeset_action(ocs, OF_RECONFIG_DETACH_NODE, np, NULL);
201c910bd6898d Pantelis Antoniou 2014-07-04 1623 }
201c910bd6898d Pantelis Antoniou 2014-07-04 1624
201c910bd6898d Pantelis Antoniou 2014-07-04 1625 static inline int of_changeset_add_property(struct of_changeset *ocs,
201c910bd6898d Pantelis Antoniou 2014-07-04 1626 struct device_node *np, struct property *prop)
201c910bd6898d Pantelis Antoniou 2014-07-04 1627 {
201c910bd6898d Pantelis Antoniou 2014-07-04 @1628 return of_changeset_action(ocs, OF_RECONFIG_ADD_PROPERTY, np, prop);
201c910bd6898d Pantelis Antoniou 2014-07-04 1629 }
201c910bd6898d Pantelis Antoniou 2014-07-04 1630
201c910bd6898d Pantelis Antoniou 2014-07-04 1631 static inline int of_changeset_remove_property(struct of_changeset *ocs,
201c910bd6898d Pantelis Antoniou 2014-07-04 1632 struct device_node *np, struct property *prop)
201c910bd6898d Pantelis Antoniou 2014-07-04 1633 {
201c910bd6898d Pantelis Antoniou 2014-07-04 @1634 return of_changeset_action(ocs, OF_RECONFIG_REMOVE_PROPERTY, np, prop);
201c910bd6898d Pantelis Antoniou 2014-07-04 1635 }
201c910bd6898d Pantelis Antoniou 2014-07-04 1636
201c910bd6898d Pantelis Antoniou 2014-07-04 1637 static inline int of_changeset_update_property(struct of_changeset *ocs,
201c910bd6898d Pantelis Antoniou 2014-07-04 1638 struct device_node *np, struct property *prop)
201c910bd6898d Pantelis Antoniou 2014-07-04 1639 {
201c910bd6898d Pantelis Antoniou 2014-07-04 @1640 return of_changeset_action(ocs, OF_RECONFIG_UPDATE_PROPERTY, np, prop);
201c910bd6898d Pantelis Antoniou 2014-07-04 1641 }
b544fc2b8606d7 Lizhi Hou 2023-08-15 1642
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 20:33 ` [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver Sean Anderson
2025-05-23 21:33 ` Heiner Kallweit
2025-05-24 8:21 ` kernel test robot
@ 2025-05-24 8:42 ` kernel test robot
2025-05-24 10:27 ` kernel test robot
2025-05-24 13:34 ` kernel test robot
4 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-05-24 8:42 UTC (permalink / raw)
To: Sean Anderson, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King
Cc: oe-kbuild-all, Lei Wei, Heiner Kallweit, Christian Marangi,
Kory Maincent, Simon Horman, Daniel Golle, Vineeth Karumanchi,
linux-kernel, Sean Anderson, Ioana Ciornei, Vladimir Oltean, imx,
linux-stm32
Hi Sean,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Sean-Anderson/dt-bindings-net-Add-Xilinx-PCS/20250524-043901
base: net-next/main
patch link: https://lore.kernel.org/r/20250523203339.1993685-6-sean.anderson%40linux.dev
patch subject: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
config: x86_64-randconfig-074-20250524 (https://download.01.org/0day-ci/archive/20250524/202505241618.qJrsEs8c-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250524/202505241618.qJrsEs8c-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505241618.qJrsEs8c-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/net/pcs/pcs-lynx.c:374:34: warning: 'lynx_pcs_of_match' defined but not used [-Wunused-const-variable=]
374 | static const struct of_device_id lynx_pcs_of_match[] = {
| ^~~~~~~~~~~~~~~~~
vim +/lynx_pcs_of_match +374 drivers/net/pcs/pcs-lynx.c
373
> 374 static const struct of_device_id lynx_pcs_of_match[] = {
375 { .compatible = "fsl,lynx-pcs" },
376 { },
377 };
378 MODULE_DEVICE_TABLE(of, lynx_pcs_of_match);
379
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 20:33 ` [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver Sean Anderson
` (2 preceding siblings ...)
2025-05-24 8:42 ` kernel test robot
@ 2025-05-24 10:27 ` kernel test robot
2025-05-24 13:34 ` kernel test robot
4 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-05-24 10:27 UTC (permalink / raw)
To: Sean Anderson, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King
Cc: Paul Gazzillo, Necip Fazil Yildiran, oe-kbuild-all, Lei Wei,
Heiner Kallweit, Christian Marangi, Kory Maincent, Simon Horman,
Daniel Golle, Vineeth Karumanchi, linux-kernel, Sean Anderson,
Ioana Ciornei, Vladimir Oltean, imx, linux-stm32
Hi Sean,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Sean-Anderson/dt-bindings-net-Add-Xilinx-PCS/20250524-043901
base: net-next/main
patch link: https://lore.kernel.org/r/20250523203339.1993685-6-sean.anderson%40linux.dev
patch subject: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
config: x86_64-kismet-CONFIG_OF_DYNAMIC-CONFIG_FSL_FMAN-0-0 (https://download.01.org/0day-ci/archive/20250524/202505241840.ILpzEabZ-lkp@intel.com/config)
reproduce: (https://download.01.org/0day-ci/archive/20250524/202505241840.ILpzEabZ-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505241840.ILpzEabZ-lkp@intel.com/
kismet warnings: (new ones prefixed by >>)
>> kismet: WARNING: unmet direct dependencies detected for OF_DYNAMIC when selected by FSL_FMAN
WARNING: unmet direct dependencies detected for OF_DYNAMIC
Depends on [n]: OF [=n]
Selected by [y]:
- FSL_FMAN [=y] && NETDEVICES [=y] && ETHERNET [=y] && NET_VENDOR_FREESCALE [=y] && (FSL_SOC || ARCH_LAYERSCAPE || COMPILE_TEST [=y])
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
2025-05-23 20:33 ` [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver Sean Anderson
` (3 preceding siblings ...)
2025-05-24 10:27 ` kernel test robot
@ 2025-05-24 13:34 ` kernel test robot
4 siblings, 0 replies; 11+ messages in thread
From: kernel test robot @ 2025-05-24 13:34 UTC (permalink / raw)
To: Sean Anderson, netdev, Andrew Lunn, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Russell King
Cc: oe-kbuild-all, Lei Wei, Heiner Kallweit, Christian Marangi,
Kory Maincent, Simon Horman, Daniel Golle, Vineeth Karumanchi,
linux-kernel, Sean Anderson, Ioana Ciornei, Vladimir Oltean, imx,
linux-stm32
Hi Sean,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Sean-Anderson/dt-bindings-net-Add-Xilinx-PCS/20250524-043901
base: net-next/main
patch link: https://lore.kernel.org/r/20250523203339.1993685-6-sean.anderson%40linux.dev
patch subject: [net-next PATCH v5 05/10] net: pcs: lynx: Convert to an MDIO driver
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505242145.RKJGzoHX-lkp@intel.com/
includecheck warnings: (new ones prefixed by >>)
>> drivers/net/pcs/pcs-lynx.c: linux/phylink.h is included more than once.
vim +8 drivers/net/pcs/pcs-lynx.c
> 8 #include <linux/phylink.h>
9 #include <linux/of.h>
10 #include <linux/pcs.h>
11 #include <linux/pcs-lynx.h>
> 12 #include <linux/phylink.h>
13 #include <linux/property.h>
14
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 11+ messages in thread