From 081ffe9b3fc7ec1ec8eb7ced39d218f525f741e9 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Thu, 7 May 2026 12:37:08 +0200 Subject: ls1028a: only include drivers/net/fsl_enetc.h when driver is compiled As hinted by its path, it's not really meant to be included outside of the driver itself. This header uses CONFIG_SYS_RX_ETH_BUFFER which we are trying to move under CONFIG_NET dependency. This file here can be compiled without network support so make sure this only gets included when needed. The function from that header (fdt_fixup_enetc_mac) is already guarded by CONFIG_FSL_ENETC so simply guard the inclusion of the header the same way. This was tested by building ls1028aqds_tfa_defconfig with CONFIG_MSCC_FELIX_SWITCH and CONFIG_FSL_ENETC disabled. Reviewed-by: Simon Glass Signed-off-by: Quentin Schulz --- board/nxp/ls1028a/ls1028a.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/nxp/ls1028a/ls1028a.c b/board/nxp/ls1028a/ls1028a.c index 007125358bd..196e25931f3 100644 --- a/board/nxp/ls1028a/ls1028a.c +++ b/board/nxp/ls1028a/ls1028a.c @@ -26,7 +26,9 @@ #include #include #include "../common/qixis.h" +#ifdef CONFIG_FSL_ENETC #include "../drivers/net/fsl_enetc.h" +#endif DECLARE_GLOBAL_DATA_PTR; -- cgit v1.3.1 From 4cbd0faab82cf6477236205b5e0894be2110f723 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Thu, 7 May 2026 12:37:09 +0200 Subject: arm: ls102xa: use platform data to check Ethernet interface is not SGMII tsec_private should, as its name suggests, be private. In the next commit, it'll be moved from a publicly available header file to the C file that requires it. ls102xa currently does not allow us to do that because it uses the structure. The flag is actually set if the Ethernet PHY interface is SGMII in drivers/net/tsec.c, so simply replace the current check with the same check made in drivers/net/tsec.c to set the flag. Reviewed-by: Simon Glass Signed-off-by: Quentin Schulz --- arch/arm/cpu/armv7/ls102xa/fdt.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c index 34eea22eb92..09092ea7b7f 100644 --- a/arch/arm/cpu/armv7/ls102xa/fdt.c +++ b/arch/arm/cpu/armv7/ls102xa/fdt.c @@ -16,7 +16,6 @@ #ifdef CONFIG_FSL_ESDHC #include #endif -#include #include #include #include @@ -26,7 +25,7 @@ DECLARE_GLOBAL_DATA_PTR; void ft_fixup_enet_phy_connect_type(void *fdt) { struct udevice *dev; - struct tsec_private *priv; + struct eth_pdata *pdata; const char *enet_path, *phy_path; char enet[16]; char phy[16]; @@ -45,8 +44,8 @@ void ft_fixup_enet_phy_connect_type(void *fdt) continue; } - priv = dev_get_priv(dev); - if (priv->flags & TSEC_SGMII) + pdata = dev_get_plat(dev); + if (pdata->phy_interface == PHY_INTERFACE_MODE_SGMII) continue; enet_path = fdt_get_alias(fdt, enet); -- cgit v1.3.1 From 987b5eabc35f3924fd10c66bb1be64a60c6feb23 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Thu, 7 May 2026 12:37:10 +0200 Subject: net: tsec: make tsec_private a private structure Move the definition of tsec_private within the only file that makes use of it. This adds the benefit of include/tsec.h not referencing PKTBUFSRX (which is set to CONFIG_SYS_RX_ETH_BUFFER, which we're trying to move to be under CONFIG_NET dependency) anymore. Considering drivers/net/tsec.c is only built if CONFIG_NET=y, this is fine. Reviewed-by: Simon Glass Signed-off-by: Quentin Schulz --- drivers/net/tsec.c | 17 +++++++++++++++++ include/tsec.h | 17 ----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index bd4ebdd745a..d03368b9408 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -37,6 +37,23 @@ ) #endif /* CFG_TSEC_TBICR_SETTINGS */ +struct tsec_private { + struct txbd8 __iomem txbd[TX_BUF_CNT]; + struct rxbd8 __iomem rxbd[PKTBUFSRX]; + struct tsec __iomem *regs; + struct tsec_mii_mng __iomem *phyregs_sgmii; + struct phy_device *phydev; + phy_interface_t interface; + struct mii_dev *bus; + uint phyaddr; + uint tbiaddr; + char mii_devname[16]; + u32 flags; + uint rx_idx; /* index of the current RX buffer */ + uint tx_idx; /* index of the current TX buffer */ + struct udevice *dev; +}; + /* Configure the TBI for SGMII operation */ static void tsec_configure_serdes(struct tsec_private *priv) { diff --git a/include/tsec.h b/include/tsec.h index 153337837a9..f5ced38f3fc 100644 --- a/include/tsec.h +++ b/include/tsec.h @@ -350,23 +350,6 @@ struct tsec_data { u32 mdio_regs_off; }; -struct tsec_private { - struct txbd8 __iomem txbd[TX_BUF_CNT]; - struct rxbd8 __iomem rxbd[PKTBUFSRX]; - struct tsec __iomem *regs; - struct tsec_mii_mng __iomem *phyregs_sgmii; - struct phy_device *phydev; - phy_interface_t interface; - struct mii_dev *bus; - uint phyaddr; - uint tbiaddr; - char mii_devname[16]; - u32 flags; - uint rx_idx; /* index of the current RX buffer */ - uint tx_idx; /* index of the current TX buffer */ - struct udevice *dev; -}; - struct tsec_info_struct { struct tsec __iomem *regs; struct tsec_mii_mng __iomem *miiregs_sgmii; -- cgit v1.3.1 From 77cc22b8095cee92e5bd63b57b13fa7cf8ac8190 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Thu, 7 May 2026 12:37:11 +0200 Subject: net: guard SYS_RX_ETH_BUFFER with NET SYS_RX_ETH_BUFFER represents the number of Ethernet receive packet buffers. It therefore doesn't make sense it's reachable if NET isn't enabled. Direct users of SYS_RX_ETH_BUFFER are: - drivers/net/rtl8169.c, only compiled if CONFIG_RTL8169=y, depends on CONFIG_NETDEVICES=y, depends on CONFIG_NET=y, - drivers/net/fsl_enetc.h, via ENETC_BD_CNT, included in drivers/net/{fsl_enetc.c,fsl_enetc_mdio.c,mscc_eswitch/felix_switch.c} First two only compiled if CONFIG_FSL_ENETC=y, latter with CONFIG_MSCC_FELIX_SWITCH=y. Both symbols depends on CONFIG_NETDEVICES=y, depends on CONFIG_NET=y. - include/net-common.h via PKTBUFSRX, Indirect users via PKTBUFSRX: - arch/sandbox/include/asm/eth.h - according to ./tools/qconfig.py -l -f CONFIG_SANDBOX CONFIG_NO_NET, all sandbox defconfigs have network enabled so ignore this for now, - drivers/dma/ti/k3-udma.c - sets UDMA_RX_DESC_NUM to that if defined, else 4. PKTBUFSRX is CONFIG_SYS_RX_ETH_BUFFER which defaults to 4. According to ./tools/qconfig.py -l -f CONFIG_TI_K3_NAVSS_UDMA '~CONFIG_SYS_RX_ETH_BUFFER=4' no defconfig enabling this DMA driver sets CONFIG_SYS_RX_ETH_BUFFER to anything but the default of 4, so regardless of NET being built UDMA_RX_DESC_NUM will always be 4 with current defconfigs. - drivers/net/{airoha_eth.c,bcm6348-eth.c,bcm6368-eth.c,cortina_ni.c, dc2114x.c,eepro100.c,essedma.c,ethoc.c,ftgmac100.c,ftmac100.c, hifemac.c,mcffec.c,mpc8xx_fec.c,pic32_eth.c,sandbox.c,sni_ave.c, sni_netsec.c,ti/am65-cpsw-nuss.c,ti/cpsw.c,ti/icssg_prueth.c, tsec.c} all depends on CONFIG_NETDEVICES=y, depends on CONFIG_NET=y, - net/lwip/net-lwip.c, only compiled if CONFIG_NET_LWIP=y, depends on CONFIG_NET=y, - net/{net.c,tcp.c}, only compiled if CONFIG_NET_LEGACY=y, depends on CONFIG_NET=y, - net/net-common.c, only compiled if CONFIG_NET=y, - test/cmd/wget.c, only compiled if CONFIG_NET_LEGACY=y, depends on CONFIG_NET=y, - test/image/spl_load_net.c, only compiled if CONFIG_SPL_UT_LOAD_NET=y, depends on CONFIG_SPL_ETH=y, depends on CONFIG_SPL_NET=y, depends on CONFIG_NET_LEGACY=y, depends on CONFIG_NET=y, Indirect users via net_rx_packets[PKTBUFSRX]. This array is only externally defined in net/net-common.c which is only compiled if CONFIG_NET=y. Users of net_rx_packets are: - drivers/net/{airoha_eth.c,bcm6348-eth.c,bcm6368-eth.c,cortina_ni.c, dc2114x.c,dm9000x.c,essedma.c,ethoc.c,fsl_enetc.c,ftgmac100.c, ftmac100.c,hifemac.c,ks8851_mll.c,macb.c,mcffec.c,mpc8xx_fec.c, mscc_eswitch/jr2_switch.c,mscc_eswitch/luton_switch.c, mscc_eswitch/ocelot_switch.c,mscc_eswitch/serval_switch.c, mscc_eswitch/servalt_switch.c,pic32_eth.c,sandbox-raw.c, sandbox.c,smc911x.c,sni_ave.c,sni_netsec.c,ti/am65-cpsw-nuss.c, ti/cpsw.c,ti/icssg_prueth.c,tsec.c,xilinx_axi_mrmac.c} all depends on CONFIG_NETDEVICES=y, depends on CONFIG_NET=y, - drivers/usb/gadget/ether.c only built if CONFIG_$(PHASE_)USB_ETHER=y, depends on CONFIG_NET=y/CONFIG_SPL_NET=y, - net/lwip/net-lwip.c only compiled if CONFIG_NET_LWIP=y, depends on CONFIG_NET=y, - net/net.c, only compiled if CONFIG_NET_LEGACY=y, depends on CONFIG_NET=y, - net/net-common.c, only compiled if CONFIG_NET=y, Reviewed-by: Simon Glass Signed-off-by: Quentin Schulz --- include/net-common.h | 4 ++++ net/Kconfig | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/net-common.h b/include/net-common.h index 69b6316c1ec..0c260873c2c 100644 --- a/include/net-common.h +++ b/include/net-common.h @@ -20,7 +20,9 @@ * alignment in memory. * */ +#if CONFIG_IS_ENABLED(NET) #define PKTBUFSRX CONFIG_SYS_RX_ETH_BUFFER +#endif #define PKTALIGN ARCH_DMA_MINALIGN /* IPv4 addresses are always 32 bits in size */ @@ -132,7 +134,9 @@ static inline void net_set_state(enum net_loop_state state) } extern int net_restart_wrap; /* Tried all network devices */ +#if CONFIG_IS_ENABLED(NET) extern uchar *net_rx_packets[PKTBUFSRX]; /* Receive packets */ +#endif extern const u8 net_bcast_ethaddr[ARP_HLEN]; /* Ethernet broadcast address */ extern struct in_addr net_ip; /* Our IP addr (0 = unknown) */ /* Indicates whether the pxe path prefix / config file was specified in dhcp option */ diff --git a/net/Kconfig b/net/Kconfig index e712a0dd2ac..171a88f8ed2 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -279,8 +279,6 @@ config TFTP_BLOCKSIZE almost-MTU block sizes. You can also activate CONFIG_IP_DEFRAG to set a larger block. -endif # if NET - config SYS_RX_ETH_BUFFER int "Number of receive packet buffers" default 4 @@ -289,3 +287,5 @@ config SYS_RX_ETH_BUFFER controllers it is recommended to set this value to 8 or even higher, since all buffers can be full shortly after enabling the interface on high Ethernet traffic. + +endif # if NET -- cgit v1.3.1 From d17251269095d058c7bf463f6cfb4922ad357147 Mon Sep 17 00:00:00 2001 From: Quentin Schulz Date: Thu, 7 May 2026 12:37:12 +0200 Subject: net: SYS_RX_ETH_BUFFER defaults to 8 when CONFIG_FSL_ENETC=y drivers/net/fsl_enetc.h specifies ENETC_BD_CNT "buffer descriptors count must be a multiple of 8". This constant is set to CONFIG_SYS_RX_ETH_BUFFER which defaults to 4. All defconfigs enabling CONFIG_FSL_ENETC fortunately have it set to 8, according to ./tools/qconfig.py -l -f CONFIG_FSL_ENETC '~CONFIG_SYS_RX_ETH_BUFFER=8'. Let's make sure the default is sane by having it set to 8 when this driver is enabled. Note that originally[1] it was said EEPRO100 and 405 EMAC should be 8 or higher. 405 (PPC405?) support seems to have been dropped in commit b5e7c84f72ee ("ppc4xx: remove ASH405 board"), 11 years ago. Maybe there's something we can do for EEPRO100 though? Start all lines with a tab instead of spaces. Specify limitation for FSL_ENETC in the help text. [1] commit 53cf9435ccf9 ("- CFG_RX_ETH_BUFFER added.") Reviewed-by: Simon Glass Signed-off-by: Quentin Schulz --- net/Kconfig | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/net/Kconfig b/net/Kconfig index 171a88f8ed2..6be392c1564 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -280,12 +280,15 @@ config TFTP_BLOCKSIZE You can also activate CONFIG_IP_DEFRAG to set a larger block. config SYS_RX_ETH_BUFFER - int "Number of receive packet buffers" - default 4 - help - Defines the number of Ethernet receive buffers. On some Ethernet - controllers it is recommended to set this value to 8 or even higher, - since all buffers can be full shortly after enabling the interface on - high Ethernet traffic. + int "Number of receive packet buffers" + default 8 if FSL_ENETC + default 4 + help + Defines the number of Ethernet receive buffers. On some Ethernet + controllers (e.g. FSL_ENETC) it is recommended to set this value to 8 + or even higher, since all buffers can be full shortly after enabling + the interface on high Ethernet traffic. + + FSL_ENETC requires this value to be a multiple of 8. endif # if NET -- cgit v1.3.1 From 3518bf17ba4435067bd5c7b3eb7148e7182fe6b1 Mon Sep 17 00:00:00 2001 From: David Lechner Date: Wed, 13 May 2026 09:11:52 -0500 Subject: phy: Kconfig: use bool instead of tristate Change all uses of tristate in the PHY Kconfigs to bool. U-Boot does not support modules, so tristate does not make sense here. Signed-off-by: David Lechner Reviewed-by: Tom Rini Reviewed-by: Quentin Schulz Reviewed-by: Macpaul Lin Reviewed-by: Anshul Dalal Reviewed-by: Casey Connolly --- drivers/phy/Kconfig | 14 +++++++------- drivers/phy/cadence/Kconfig | 4 ++-- drivers/phy/qcom/Kconfig | 16 ++++++++-------- drivers/phy/renesas/Kconfig | 6 +++--- drivers/phy/rockchip/Kconfig | 2 +- drivers/phy/ti/Kconfig | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig index 5c8ec2b146f..eafa82fe494 100644 --- a/drivers/phy/Kconfig +++ b/drivers/phy/Kconfig @@ -114,7 +114,7 @@ config BCM_SR_PCIE_PHY If unsure, say N. config PHY_DA8XX_USB - tristate "TI DA8xx USB PHY Driver" + bool "TI DA8xx USB PHY Driver" depends on PHY && ARCH_DAVINCI help Enable this to support the USB PHY on DA8xx SoCs. @@ -138,7 +138,7 @@ config SPL_PIPE3_PHY and omap5 config AM654_PHY - tristate "TI AM654 SERDES support" + bool "TI AM654 SERDES support" depends on PHY && ARCH_K3 select REGMAP select SYSCON @@ -155,7 +155,7 @@ config STI_USB_PHY STiH407 SoC families. config PHY_RCAR_GEN2 - tristate "Renesas R-Car Gen2 USB PHY" + bool "Renesas R-Car Gen2 USB PHY" depends on PHY && RCAR_GEN2 help Support for the Renesas R-Car Gen2 USB PHY. This driver operates the @@ -163,7 +163,7 @@ config PHY_RCAR_GEN2 allows configuring the module multiplexing. config PHY_RCAR_GEN3 - tristate "Renesas R-Car Gen3 USB PHY" + bool "Renesas R-Car Gen3 USB PHY" depends on PHY && CLK && DM_REGULATOR && (RCAR_GEN3 || RZG2L) default y if (RCAR_GEN3 || RZG2L) help @@ -171,7 +171,7 @@ config PHY_RCAR_GEN3 PHY connected to EHCI USB module and controls USB OTG operation. config PHY_STM32_USBPHYC - tristate "STMicroelectronics STM32 SoC USB HS PHY driver" + bool "STMicroelectronics STM32 SoC USB HS PHY driver" depends on PHY && ARCH_STM32MP help Enable this to support the High-Speed USB transceiver that is part of @@ -283,7 +283,7 @@ config PHY_MTK_TPHY so you can easily distinguish them by banks layout. config PHY_MTK_UFS - tristate "MediaTek UFS M-PHY driver" + bool "MediaTek UFS M-PHY driver" depends on ARCH_MEDIATEK depends on PHY help @@ -337,7 +337,7 @@ config PHY_IMX8M_PCIE This PHY is found on i.MX8M devices supporting PCIe. config PHY_XILINX_ZYNQMP - tristate "Xilinx ZynqMP PHY driver" + bool "Xilinx ZynqMP PHY driver" depends on PHY && ARCH_ZYNQMP help Enable this to support ZynqMP High Speed Gigabit Transceiver diff --git a/drivers/phy/cadence/Kconfig b/drivers/phy/cadence/Kconfig index 8c0ab80fbbc..f5f096889fe 100644 --- a/drivers/phy/cadence/Kconfig +++ b/drivers/phy/cadence/Kconfig @@ -1,11 +1,11 @@ config PHY_CADENCE_SIERRA - tristate "Cadence Sierra PHY Driver" + bool "Cadence Sierra PHY Driver" depends on DM_RESET help Enable this to support the Cadence Sierra PHY driver config PHY_CADENCE_TORRENT - tristate "Cadence Torrent PHY Driver" + bool "Cadence Torrent PHY Driver" depends on DM_RESET help Enable this to support the Cadence Torrent PHY driver diff --git a/drivers/phy/qcom/Kconfig b/drivers/phy/qcom/Kconfig index 49f830abf01..7094903d869 100644 --- a/drivers/phy/qcom/Kconfig +++ b/drivers/phy/qcom/Kconfig @@ -7,7 +7,7 @@ config MSM8916_USB_PHY This PHY is found on qualcomm dragonboard410c development board. config PHY_QCOM_IPQ4019_USB - tristate "Qualcomm IPQ4019 USB PHY driver" + bool "Qualcomm IPQ4019 USB PHY driver" depends on PHY && ARCH_IPQ40XX help Support for the USB PHY-s on Qualcomm IPQ40xx SoC-s. @@ -21,26 +21,26 @@ config PHY_QCOM_QMP_COMBO PHY (USB3 + DisplayPort). Currently only USB3 mode is supported. config PHY_QCOM_QMP_PCIE - tristate "Qualcomm QMP PCIe PHY driver" + bool "Qualcomm QMP PCIe PHY driver" depends on PHY && ARCH_SNAPDRAGON help Enable this to support the PCIe QMP PHY on various Qualcomm chipsets. config PHY_QCOM_QMP_UFS - tristate "Qualcomm QMP UFS PHY driver" + bool "Qualcomm QMP UFS PHY driver" depends on PHY && ARCH_SNAPDRAGON help Enable this to support the UFS QMP PHY on various Qualcomm chipsets. config PHY_QCOM_QUSB2 - tristate "Qualcomm USB QUSB2 PHY driver" + bool "Qualcomm USB QUSB2 PHY driver" depends on PHY && ARCH_SNAPDRAGON help Enable this to support the Super-Speed USB transceiver on various Qualcomm chipsets. config PHY_QCOM_USB_SNPS_FEMTO_V2 - tristate "Qualcomm SNPS FEMTO USB HS PHY v2" + bool "Qualcomm SNPS FEMTO USB HS PHY v2" depends on PHY && ARCH_SNAPDRAGON help Enable this to support the Qualcomm Synopsys DesignWare Core 7nm @@ -48,7 +48,7 @@ config PHY_QCOM_USB_SNPS_FEMTO_V2 is usually paired with Synopsys DWC3 USB IPs on MSM SOCs. config PHY_QCOM_SNPS_EUSB2 - tristate "Qualcomm Synopsys eUSB2 High-Speed PHY" + bool "Qualcomm Synopsys eUSB2 High-Speed PHY" depends on PHY && ARCH_SNAPDRAGON help Enable this to support the Qualcomm Synopsys DesignWare eUSB2 @@ -56,7 +56,7 @@ config PHY_QCOM_SNPS_EUSB2 is usually paired with Synopsys DWC3 USB IPs on MSM SOCs. config PHY_QCOM_USB_HS_28NM - tristate "Qualcomm 28nm High-Speed PHY" + bool "Qualcomm 28nm High-Speed PHY" depends on PHY && ARCH_SNAPDRAGON help Enable this to support the Qualcomm Synopsys DesignWare Core 28nm @@ -65,7 +65,7 @@ config PHY_QCOM_USB_HS_28NM IPs on MSM SOCs. config PHY_QCOM_USB_SS - tristate "Qualcomm USB Super-Speed PHY driver" + bool "Qualcomm USB Super-Speed PHY driver" depends on PHY && ARCH_SNAPDRAGON help Enable this to support the Super-Speed USB transceiver on various diff --git a/drivers/phy/renesas/Kconfig b/drivers/phy/renesas/Kconfig index affbee0500c..3358d454e59 100644 --- a/drivers/phy/renesas/Kconfig +++ b/drivers/phy/renesas/Kconfig @@ -3,19 +3,19 @@ # Phy drivers for Renesas platforms config PHY_R8A779F0_ETHERNET_SERDES - tristate "Renesas R-Car S4-8 Ethernet SERDES driver" + bool "Renesas R-Car S4-8 Ethernet SERDES driver" depends on RCAR_64 && PHY help Support for Ethernet SERDES found on Renesas R-Car S4-8 SoCs. config PHY_R8A78000_ETHERNET_PCS - tristate "Renesas R-Car X5H Ethernet PCS driver" + bool "Renesas R-Car X5H Ethernet PCS driver" depends on RCAR_64 && PHY help Support for Ethernet PCS found on Renesas R-Car X5H SoCs. config PHY_R8A78000_MP_PHY - tristate "Renesas R-Car X5H Multi-Protocol PHY driver" + bool "Renesas R-Car X5H Multi-Protocol PHY driver" depends on RCAR_64 && PHY help Support for Multi-Protocol PHY on Renesas R-Car X5H SoCs. diff --git a/drivers/phy/rockchip/Kconfig b/drivers/phy/rockchip/Kconfig index 80128335d52..6f3d7ebe29e 100644 --- a/drivers/phy/rockchip/Kconfig +++ b/drivers/phy/rockchip/Kconfig @@ -49,7 +49,7 @@ config PHY_ROCKCHIP_SNPS_PCIE3 also be able splited into multiple combinations of lanes. config PHY_ROCKCHIP_USBDP - tristate "Rockchip USBDP COMBO PHY Driver" + bool "Rockchip USBDP COMBO PHY Driver" depends on ARCH_ROCKCHIP select PHY help diff --git a/drivers/phy/ti/Kconfig b/drivers/phy/ti/Kconfig index df750b26d66..fe96eb6806f 100644 --- a/drivers/phy/ti/Kconfig +++ b/drivers/phy/ti/Kconfig @@ -1,5 +1,5 @@ config PHY_J721E_WIZ - tristate "TI J721E WIZ (SERDES Wrapper) support" + bool "TI J721E WIZ (SERDES Wrapper) support" depends on ARCH_K3 help This option enables support for WIZ module present in TI's J721E -- cgit v1.3.1 From 6184a9b10670efac4348735064712aa0e12fdf83 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Tue, 26 May 2026 14:39:14 +0800 Subject: phy: ti-pipe3: Use device API for DT parsing Replace legacy FDT parsing in get_reg() with the device API dev_read_phandle_with_args() which removes direct access to gd->fdt_blob and aligns the driver with modern U-Boot DT handling. The offset is retrieved from the phandle argument instead of manually parsing the property cells. Add validation for the argument count to avoid out-of-bounds access on malformed DTs. Also switch from devfdt_get_addr_size_index() to dev_read_addr_size_index() for consistency with the DM API. No functional changes. Signed-off-by: Peng Fan Reviewed-by: Stefan Roese --- drivers/phy/ti-pipe3-phy.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/phy/ti-pipe3-phy.c b/drivers/phy/ti-pipe3-phy.c index 62f6cc2bfbf..080016ba417 100644 --- a/drivers/phy/ti-pipe3-phy.c +++ b/drivers/phy/ti-pipe3-phy.c @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -428,10 +429,10 @@ static int pipe3_exit(struct phy *phy) static void *get_reg(struct udevice *dev, const char *name) { + struct ofnode_phandle_args phandle; struct udevice *syscon; struct regmap *regmap; - const fdt32_t *cell; - int len, err; + int err; void *base; err = uclass_get_device_by_phandle(UCLASS_SYSCON, dev, @@ -449,10 +450,14 @@ static void *get_reg(struct udevice *dev, const char *name) return NULL; } - cell = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), name, - &len); - if (len < 2*sizeof(fdt32_t)) { - pr_err("offset not available for %s\n", name); + err = dev_read_phandle_with_args(dev, name, NULL, 0, 0, &phandle); + if (err) { + dev_err(dev, "parse %s failed: %d\n", name, err); + return NULL; + } + + if (phandle.args_count < 1) { + dev_err(dev, "%s: missing args\n", name); return NULL; } @@ -460,7 +465,7 @@ static void *get_reg(struct udevice *dev, const char *name) if (!base) return NULL; - return fdtdec_get_number(cell + 1, 1) + base; + return base + phandle.args[0]; } static int pipe3_phy_probe(struct udevice *dev) @@ -471,7 +476,7 @@ static int pipe3_phy_probe(struct udevice *dev) struct pipe3_data *data; /* PHY_RX */ - addr = devfdt_get_addr_size_index(dev, 0, &sz); + addr = dev_read_addr_size_index(dev, 0, &sz); if (addr == FDT_ADDR_T_NONE) { pr_err("missing phy_rx address\n"); return -EINVAL; @@ -484,7 +489,7 @@ static int pipe3_phy_probe(struct udevice *dev) } /* PLLCTRL */ - addr = devfdt_get_addr_size_index(dev, 2, &sz); + addr = dev_read_addr_size_index(dev, 2, &sz); if (addr == FDT_ADDR_T_NONE) { pr_err("missing pll ctrl address\n"); return -EINVAL; -- cgit v1.3.1 From dde8b3b7e10deea87eed70a6a9078b4d4cbae860 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Tue, 26 May 2026 14:39:15 +0800 Subject: phy: marvell: comphy: Use dev_read_addr_index_ptr() Use dev_read_addr_index_ptr() which supports both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers. No functional changes. Signed-off-by: Peng Fan Reviewed-by: Stefan Roese --- drivers/phy/marvell/comphy_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/phy/marvell/comphy_core.c b/drivers/phy/marvell/comphy_core.c index b074d58f9f6..0ab5f9a3f0a 100644 --- a/drivers/phy/marvell/comphy_core.c +++ b/drivers/phy/marvell/comphy_core.c @@ -84,11 +84,11 @@ static int comphy_probe(struct udevice *dev) int res; /* Save base addresses for later use */ - chip_cfg->comphy_base_addr = devfdt_get_addr_index_ptr(dev, 0); + chip_cfg->comphy_base_addr = dev_read_addr_index_ptr(dev, 0); if (!chip_cfg->comphy_base_addr) return -EINVAL; - chip_cfg->hpipe3_base_addr = devfdt_get_addr_index_ptr(dev, 1); + chip_cfg->hpipe3_base_addr = dev_read_addr_index_ptr(dev, 1); if (!chip_cfg->hpipe3_base_addr) return -EINVAL; -- cgit v1.3.1 From b9469df60e17fb1168ba0f617b7bb16824951ac3 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Tue, 26 May 2026 14:39:16 +0800 Subject: phy: cadence: Use device API Use dev_remap_addr_index() and dev_read_addr_size_index() which support both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers. No functional changes. Signed-off-by: Peng Fan Reviewed-by: Stefan Roese --- drivers/phy/cadence/phy-cadence-sierra.c | 4 ++-- drivers/phy/cadence/phy-cadence-torrent.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/phy/cadence/phy-cadence-sierra.c b/drivers/phy/cadence/phy-cadence-sierra.c index bd7ab9d1b77..9f8a6d8d43d 100644 --- a/drivers/phy/cadence/phy-cadence-sierra.c +++ b/drivers/phy/cadence/phy-cadence-sierra.c @@ -1068,12 +1068,12 @@ static int cdns_sierra_phy_probe(struct udevice *dev) sp->dev = dev; - sp->base = devfdt_remap_addr_index(dev, 0); + sp->base = dev_remap_addr_index(dev, 0); if (!sp->base) { dev_err(dev, "unable to map regs\n"); return -ENOMEM; } - devfdt_get_addr_size_index(dev, 0, (fdt_size_t *)&sp->size); + dev_read_addr_size_index(dev, 0, (fdt_size_t *)&sp->size); /* Get init data for this PHY */ data = (struct cdns_sierra_data *)dev_get_driver_data(dev); diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c index 933533b2b0b..814aff15070 100644 --- a/drivers/phy/cadence/phy-cadence-torrent.c +++ b/drivers/phy/cadence/phy-cadence-torrent.c @@ -791,10 +791,10 @@ static int cdns_torrent_phy_probe(struct udevice *dev) return ret; } - cdns_phy->sd_base = devfdt_remap_addr_index(dev, 0); - if (IS_ERR(cdns_phy->sd_base)) - return PTR_ERR(cdns_phy->sd_base); - devfdt_get_addr_size_index(dev, 0, (fdt_size_t *)&cdns_phy->size); + cdns_phy->sd_base = dev_remap_addr_index(dev, 0); + if (!cdns_phy->sd_base) + return -EINVAL; + dev_read_addr_size_index(dev, 0, (fdt_size_t *)&cdns_phy->size); dev_for_each_subnode(child, dev) subnodes++; -- cgit v1.3.1 From 45e5625d71e977cef0157240c6ce6298888afb10 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 28 May 2026 16:00:19 +0800 Subject: net: ethoc: Use dev_read_addr_index() Use dev_read_addr_index() which supports both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers. No functional changes. Reviewed-by: Simon Glass Signed-off-by: Peng Fan --- drivers/net/ethoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c index dc7e6f1929f..87b2b3426c8 100644 --- a/drivers/net/ethoc.c +++ b/drivers/net/ethoc.c @@ -686,7 +686,7 @@ static int ethoc_of_to_plat(struct udevice *dev) fdt_addr_t addr; pdata->eth_pdata.iobase = dev_read_addr(dev); - addr = devfdt_get_addr_index(dev, 1); + addr = dev_read_addr_index(dev, 1); if (addr != FDT_ADDR_T_NONE) pdata->packet_base = addr; return 0; -- cgit v1.3.1 From c174c1f7f12b5951de657c3f9a7350f8733bf15e Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 28 May 2026 16:00:20 +0800 Subject: net: qe: dm_qe_uec: Use dev_read_addr() Use dev_read_addr() which supports both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers. No functional changes. Reviewed-by: Simon Glass Signed-off-by: Peng Fan Reviewed-by: Heiko Schocher --- drivers/net/qe/dm_qe_uec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/qe/dm_qe_uec.c b/drivers/net/qe/dm_qe_uec.c index ac3aedd8b49..f9bc5d49c8f 100644 --- a/drivers/net/qe/dm_qe_uec.c +++ b/drivers/net/qe/dm_qe_uec.c @@ -1133,7 +1133,7 @@ static int qe_uec_of_to_plat(struct udevice *dev) { struct eth_pdata *pdata = dev_get_plat(dev); - pdata->iobase = (phys_addr_t)devfdt_get_addr(dev); + pdata->iobase = (phys_addr_t)dev_read_addr(dev); pdata->phy_interface = dev_read_phy_mode(dev); if (pdata->phy_interface == PHY_INTERFACE_MODE_NA) -- cgit v1.3.1 From 0e2ba59bc5a825d494e83028bdd87c40014989b3 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 28 May 2026 16:00:21 +0800 Subject: net: calxedaxgmac: Use dev_read_addr() Use dev_read_addr() which supports both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers. No functional changes. Reviewed-by: Simon Glass Signed-off-by: Peng Fan --- drivers/net/calxedaxgmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/calxedaxgmac.c b/drivers/net/calxedaxgmac.c index 92990fa6d47..df0ed820e06 100644 --- a/drivers/net/calxedaxgmac.c +++ b/drivers/net/calxedaxgmac.c @@ -555,7 +555,7 @@ static int xgmac_ofdata_to_platdata(struct udevice *dev) return -ENOMEM; dev_set_priv(dev, priv); - pdata->iobase = devfdt_get_addr(dev); + pdata->iobase = dev_read_addr(dev); if (pdata->iobase == FDT_ADDR_T_NONE) { printf("%s: Cannot find XGMAC base address\n", __func__); return -EINVAL; -- cgit v1.3.1 From 23532fcb7d080eb19c87b3a1e8f459560792a042 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 28 May 2026 16:00:22 +0800 Subject: net: dc2114x: Use dev_remap_addr() Use dev_remap_addr() to simplify code. dev_remap_addr() does same thing as dev_read_addr() + map_physmem(). And it supports both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers. No functional changes. Reviewed-by: Simon Glass Signed-off-by: Peng Fan --- drivers/net/dc2114x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c index 8fa549280aa..2a21eceac57 100644 --- a/drivers/net/dc2114x.c +++ b/drivers/net/dc2114x.c @@ -653,7 +653,7 @@ static int dc2114x_of_to_plat(struct udevice *dev) struct eth_pdata *plat = dev_get_plat(dev); struct dc2114x_priv *priv = dev_get_priv(dev); - plat->iobase = (phys_addr_t)map_physmem((phys_addr_t)devfdt_get_addr(dev), 0, MAP_NOCACHE); + plat->iobase = (phys_addr_t)dev_remap_addr(dev); priv->iobase = (void *)plat->iobase; return 0; -- cgit v1.3.1 From f603d10d72bf6a341b2af238693f17e671e4bc07 Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 28 May 2026 16:00:23 +0800 Subject: net: mvpp2: Use dev_read_addr_index_ptr() Use dev_read_addr_index_ptr() which supports both live device tree and flat DT backends, avoiding direct dependency on devfdt_* helpers. No functional changes. Reviewed-by: Simon Glass Signed-off-by: Peng Fan --- drivers/net/mvpp2.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c index f9e979c4d58..193f82ea07d 100644 --- a/drivers/net/mvpp2.c +++ b/drivers/net/mvpp2.c @@ -5296,16 +5296,16 @@ static int mvpp2_base_probe(struct udevice *dev) } /* Save base addresses for later use */ - priv->base = devfdt_get_addr_index_ptr(dev, 0); + priv->base = dev_read_addr_index_ptr(dev, 0); if (!priv->base) return -EINVAL; if (priv->hw_version == MVPP21) { - priv->lms_base = devfdt_get_addr_index_ptr(dev, 1); + priv->lms_base = dev_read_addr_index_ptr(dev, 1); if (!priv->lms_base) return -EINVAL; } else { - priv->iface_base = devfdt_get_addr_index_ptr(dev, 1); + priv->iface_base = dev_read_addr_index_ptr(dev, 1); if (!priv->iface_base) return -EINVAL; @@ -5346,8 +5346,7 @@ static int mvpp2_probe(struct udevice *dev) if (priv->hw_version == MVPP21) { int priv_common_regs_num = 2; - port->base = devfdt_get_addr_index_ptr( - dev->parent, priv_common_regs_num + port->id); + port->base = dev_read_addr_index_ptr(dev->parent, priv_common_regs_num + port->id); if (!port->base) return -EINVAL; } else { -- cgit v1.3.1 From dafa6a36037b516bed3c4f578c69e0c5c8017acb Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Thu, 28 May 2026 16:00:24 +0800 Subject: net: mvpp2: convert FDT access to ofnode API Convert mvpp2 driver from legacy fdtdec/fdt_* APIs to the ofnode-based interfaces. Replace usage of dev_of_offset(), fdtdec_lookup_phandle(), fdtdec_get_int(), fdt_parent_offset(), and related helpers with their ofnode equivalents, including dev_ofnode(), ofnode_parse_phandle(), ofnode_read_s32_default(), ofnode_get_parent(), and ofnode_for_each_subnode(). Remove direct dependencies on gd->fdt_blob. Main changes: - Use ofnode_valid() instead of integer checks for node presence - Switch fixed-link detection to ofnode_find_subnode() - Replace uclass_get_device_by_of_offset() with uclass_get_device_by_ofnode() - Update subnode iteration and device binding to use ofnode No functional changes. Reviewed-by: Simon Glass Signed-off-by: Peng Fan --- drivers/net/mvpp2.c | 47 +++++++++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c index 193f82ea07d..fc137df14c4 100644 --- a/drivers/net/mvpp2.c +++ b/drivers/net/mvpp2.c @@ -4731,33 +4731,32 @@ static int mvpp2_port_init(struct udevice *dev, struct mvpp2_port *port) static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) { - int port_node = dev_of_offset(dev); - int phy_node; + ofnode port_node = dev_ofnode(dev); + ofnode phy_node; u32 id; int phyaddr = 0; - int fixed_link = 0; + ofnode fixed_link; int ret; - phy_node = fdtdec_lookup_phandle(gd->fdt_blob, port_node, "phy"); - fixed_link = fdt_subnode_offset(gd->fdt_blob, port_node, "fixed-link"); + phy_node = ofnode_parse_phandle(port_node, "phy", 0); + fixed_link = ofnode_find_subnode(port_node, "fixed-link"); - if (phy_node > 0) { - int parent; + if (ofnode_valid(phy_node)) { + ofnode parent; - if (fixed_link != -FDT_ERR_NOTFOUND) { + if (ofnode_valid(fixed_link)) { /* phy_addr is set to invalid value for fixed links */ phyaddr = PHY_MAX_ADDR; } else { - phyaddr = fdtdec_get_int(gd->fdt_blob, phy_node, - "reg", 0); + phyaddr = ofnode_read_s32_default(phy_node, "reg", 0); if (phyaddr < 0) { dev_err(dev, "could not find phy address\n"); return -1; } } - parent = fdt_parent_offset(gd->fdt_blob, phy_node); - ret = uclass_get_device_by_of_offset(UCLASS_MDIO, parent, - &port->mdio_dev); + parent = ofnode_get_parent(phy_node); + ret = uclass_get_device_by_ofnode(UCLASS_MDIO, parent, + &port->mdio_dev); if (ret) return ret; } else { @@ -4771,7 +4770,7 @@ static int phy_info_parse(struct udevice *dev, struct mvpp2_port *port) return -EINVAL; } - id = fdtdec_get_int(gd->fdt_blob, port_node, "port-id", -1); + id = dev_read_s32_default(dev, "port-id", -1); if (id == -1) { dev_err(dev, "missing port-id value\n"); return -EINVAL; @@ -4812,7 +4811,7 @@ static void mvpp2_gpio_init(struct mvpp2_port *port) /* Ports initialization */ static int mvpp2_port_probe(struct udevice *dev, struct mvpp2_port *port, - int port_node, + ofnode port_node, struct mvpp2 *priv) { int err; @@ -5350,8 +5349,7 @@ static int mvpp2_probe(struct udevice *dev) if (!port->base) return -EINVAL; } else { - port->gop_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev), - "gop-port-id", -1); + port->gop_id = ofnode_read_s32_default(dev_ofnode(dev), "gop-port-id", -1); if (port->gop_id == -1) { dev_err(dev, "missing gop-port-id value\n"); return -EINVAL; @@ -5375,7 +5373,7 @@ static int mvpp2_probe(struct udevice *dev) priv->probe_done = 1; } - err = mvpp2_port_probe(dev, port, dev_of_offset(dev), priv); + err = mvpp2_port_probe(dev, port, dev_ofnode(dev), priv); if (err) return err; @@ -5436,13 +5434,11 @@ static struct driver mvpp2_driver = { */ static int mvpp2_base_bind(struct udevice *parent) { - const void *blob = gd->fdt_blob; - int node = dev_of_offset(parent); struct uclass_driver *drv; struct udevice *dev; struct eth_pdata *plat; char *name; - int subnode; + ofnode subnode; u32 id; int base_id_add; @@ -5455,19 +5451,19 @@ static int mvpp2_base_bind(struct udevice *parent) base_id_add = base_id; - fdt_for_each_subnode(subnode, blob, node) { + dev_for_each_subnode(subnode, parent) { /* Increment base_id for all subnodes, also the disabled ones */ base_id++; /* Skip disabled ports */ - if (!fdtdec_get_is_enabled(blob, subnode)) + if (!ofnode_is_enabled(subnode)) continue; plat = calloc(1, sizeof(*plat)); if (!plat) return -ENOMEM; - id = fdtdec_get_int(blob, subnode, "port-id", -1); + id = ofnode_read_s32_default(subnode, "port-id", -1); id += base_id_add; name = calloc(1, 16); @@ -5478,8 +5474,7 @@ static int mvpp2_base_bind(struct udevice *parent) sprintf(name, "mvpp2-%d", id); /* Create child device UCLASS_ETH and bind it */ - device_bind(parent, &mvpp2_driver, name, plat, - offset_to_ofnode(subnode), &dev); + device_bind(parent, &mvpp2_driver, name, plat, subnode, &dev); } return 0; -- cgit v1.3.1