Enable USB and ENETC on i.MX943 EVK
Subsystems (6)
cover Enable USB and ENETC on i.MX943 EVK
Changes for v1:
- Adding USB2 and USB3 device tree nodes with required PHY and regulator support.
- Enabling ENETC1 and ENETC2.
- Updating Kconfig and DTSI files to support these interfaces.
This series depends on "imx: add i.MX94 support".
---
Alice Guo (6):
usb: ehci-mx6: Extend support to i.MX91, i.MX93, i.MX94, and i.MX95
arm: arch-imx9: Add USB2.0 and USB3.0 base address definitions
imx943_evk: Enable USB 2.0 controller host mode
phy: imx8mq-usb: Add SPL support for i.MX8MQ, i.MX8MP, i.MX95, and i.MX94 USB3.0 PHY
imx943_evk: Add support for booting from USB SDP on USB3.0
imx943_evk: Enable ENETC1 and ENETC2
Frank Li (1):
Add serial# for SPL SDP download
Ye Li (3):
usb: f_sdp: Update SDP driver to support PQC container
net: fsl_enetc: Add i.MX94 support to NETC block control driver
net: fsl_enetc_mdio: Add support for phy-supply property
arch/arm/dts/imx943-evk-u-boot.dtsi | 182 ++++++++++++++++ arch/arm/dts/imx943-u-boot.dtsi | 234 +++++++++++++++++++++ arch/arm/include/asm/arch-imx9/imx-regs.h | 5 + arch/arm/mach-imx/spl.c | 10 + configs/imx943_evk_defconfig | 30 +++ drivers/net/Kconfig | 5 +- drivers/net/fsl_enetc_mdio.c | 25 +++ drivers/net/fsl_enetc_netc_blk_ctrl.c | 338 +++++++++++++++++++++++++++++- drivers/phy/Kconfig | 14 +- drivers/phy/Makefile | 2 +- drivers/usb/gadget/f_sdp.c | 2 +- drivers/usb/host/Kconfig | 6 +- 12 files changed, 835 insertions(+), 18 deletions(-)
---
base-commit: a82d2da84090eb64cf6f8270ec93380641f32867
change-id: 20250923-usbnetc-62095b487e9a
Best regards,
Signature · 1 line
Alice Guo <[email protected]>
PATCH 1/10 usb: ehci-mx6: Extend support to i.MX91, i.MX93, i.MX94, and i.MX95
From: Alice Guo <[email protected]>
Since the EHCI USB driver is shared across i.MX91, i.MX93, i.MX94, and i.MX95, the condition check is updated to use IMX9.
--- drivers/usb/host/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/Kconfig +3 -3
@@ -209,10 +209,10 @@ config USB_EHCI_MX6 config USB_EHCI_MX7 bool "Support for i.MX7/i.MX8M/i.MX9 on-chip EHCI USB controller" - depends on ARCH_MX7 || IMX8M || IMX93 || IMX95 + depends on ARCH_MX7 || IMX8M || IMX9 select EHCI_HCD_INIT_AFTER_RESET if ARCH_MX7 - select PHY if IMX8M || IMX93 || IMX95 - select NOP_PHY if IMX8M || IMX93 || IMX95 + select PHY if IMX8M || IMX9 + select NOP_PHY if IMX8M || IMX9 default y ---help--- Enables support for the on-chip EHCI controller on i.MX7/i.MX8M/i.MX9 SoCs.
Signature · 1 line
2.43.0
PATCH 2/10 arm: arch-imx9: Add USB2.0 and USB3.0 base address definitions
In reply to Alice Guo (OSS)From: Alice Guo <[email protected]>
Add USB1_BASE_ADDR and USB2_BASE_ADDR for i.MX9 platform, and define USB_BASE_ADDR as an alias to USB2_BASE_ADDR.
--- arch/arm/include/asm/arch-imx9/imx-regs.h | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/include/asm/arch-imx9/imx-regs.h +5 -0
@@ -39,6 +39,11 @@#define ANATOP_BASE_ADDR 0x44480000UL +#define USB1_BASE_ADDR 0x4c100000 +#define USB2_BASE_ADDR 0x4c200000 + +#define USB_BASE_ADDR USB2_BASE_ADDR +#define BLK_CTRL_WAKEUPMIX_BASE_ADDR 0x42420000#define BLK_CTRL_NS_ANOMIX_BASE_ADDR 0x44210000#define BLK_CTRL_S_ANOMIX_BASE_ADDR 0x444f0000
Signature · 1 line
2.43.0
PATCH 3/10 imx943_evk: Enable USB 2.0 controller host mode
In reply to Alice Guo (OSS)From: Alice Guo <[email protected]>
This patch enables the USB 2.0 controller to operate in host mode on the i.MX943 EVK board. It updates the device tree files to configure the USB 2.0 controller appropriately and modifies the defconfig to include necessary support.
--- arch/arm/dts/imx943-evk-u-boot.dtsi | 9 +++++++++ arch/arm/dts/imx943-u-boot.dtsi | 28 ++++++++++++++++++++++++++++ configs/imx943_evk_defconfig | 3 +++ 3 files changed, 40 insertions(+)
arch/arm/dts/imx943-evk-u-boot.dtsi +9 -0
@@ -13,6 +13,15 @@ bootph-pre-ram; }; +&usb2 { + dr_mode = "host"; + hnp-disable; + srp-disable; + adp-disable; + disable-over-current; + status = "okay"; +}; + &usdhc1 { bootph-pre-ram; };
arch/arm/dts/imx943-u-boot.dtsi +28 -0
@@ -83,6 +83,13 @@ }; }; }; + + usbphynop: usbphynop { + compatible = "usb-nop-xceiv"; + clocks = <&scmi_clk IMX94_CLK_HSIO>; + clock-names = "main_clk"; + #phy-cells = <0>; + }; }; &cpu0 {
@@ -192,6 +199,27 @@ &{/soc} { bootph-all; + usb2: usb@4c200000 { + compatible = "fsl,imx95-usb", "fsl,imx7d-usb", "fsl,imx27-usb"; + reg = <0x0 0x4c200000 0x0 0x200>; + interrupts = <GIC_SPI 181 IRQ_TYPE_LEVEL_HIGH>, + <GIC_SPI 387 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&scmi_clk IMX94_CLK_HSIO>, + <&scmi_clk IMX94_CLK_32K>; + clock-names = "usb_ctrl_root", "usb_wakeup"; + power-domains = <&scmi_devpd IMX94_PD_HSIO_TOP>; + phys = <&usbphynop>; + fsl,usbmisc = <&usbmisc 0>; + status = "disabled"; + }; + + usbmisc: usbmisc@4c200200 { + compatible = "fsl,imx95-usbmisc", "fsl,imx7d-usbmisc", "fsl,imx6q-usbmisc"; + reg = <0x0 0x4c200200 0x0 0x200>, + <0x0 0x4c010014 0x0 0x04>; + #index-cells = <1>; + }; + elemu1: mailbox@47530000 { compatible = "fsl,imx93-mu-s4"; reg = <0x0 0x47530000 0x0 0x10000>;
configs/imx943_evk_defconfig +3 -0
@@ -66,6 +66,7 @@ CONFIG_CMD_GPT=y CONFIG_CMD_MMC=y CONFIG_CMD_PCI=y CONFIG_CMD_POWEROFF=y +CONFIG_CMD_USB=y CONFIG_CMD_SNTP=y CONFIG_CMD_CACHE=y CONFIG_CMD_EFIDEBUG=y
@@ -112,4 +113,6 @@ CONFIG_DM_REGULATOR_GPIO=y CONFIG_DM_RTC=y CONFIG_DM_SERIAL=y CONFIG_FSL_LPUART=y +CONFIG_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_ULP_WATCHDOG=y
Signature · 1 line
2.43.0
PATCH 4/10 Add serial# for SPL SDP download
In reply to Alice Guo (OSS)From: Frank Li <[email protected]>
After update this, uuu(>1.6) can use below command to filter out devices when multi boards connected.
uuu -ms <serial#> ...
[sudo] uuu -lsusb can list known devices with serial# informaiton.
--- arch/arm/mach-imx/spl.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/mach-imx/spl.c +10 -0
@@ -21,6 +21,8 @@#include <g_dnl.h> #include <linux/libfdt.h> #include <memalign.h> +#include <asm/setup.h> +#include <asm/bootm.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -184,6 +186,14 @@ u32 spl_boot_device(void)#ifdef CONFIG_SPL_USB_GADGET int g_dnl_bind_fixup (struct usb_device_descriptor *dev,const char *name) { +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG +struct tag_serialnr serialnr; +char serial_string[0x21 ] = {0 }; + +get_board_serial (&serialnr); +snprintf (serial_string,sizeof (serial_string),"%08x%08x" , serialnr.high, serialnr.low); +g_dnl_set_serialnumber (serial_string); +#endif put_unaligned (CONFIG_USB_GADGET_PRODUCT_NUM +0xfff , &dev->idProduct);return 0 ;
Signature · 1 line
2.43.0
PATCH 5/10 usb: f_sdp: Update SDP driver to support PQC container
In reply to Alice Guo (OSS)From: Ye Li <[email protected]>
Since PQC container has changed version to 0x2 in container header, update the header's check.
--- drivers/usb/gadget/f_sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/f_sdp.c +1 -1
@@ -765,7 +765,7 @@ static ulong search_container_header(ulong p, int size)for (i =0 ; i < size; i +=4 ) { hdr = (u8 *)(p + i); -if (*(hdr +3 ) ==0x87 && *hdr ==0 ) +if (*(hdr +3 ) ==0x87 && (*hdr ==0 || *hdr ==2 ))if (*(hdr +1 ) !=0 || *(hdr +2 ) !=0 )return p + i; }
Signature · 1 line
2.43.0
Re: [PATCH 05/10] usb: f_sdp: Update SDP driver to support PQC container
Hi Alice,
Thank you for the patch.
Quoted 9 lines · Alice Guo (OSS)
From: Ye Li <[email protected]>
Since PQC container has changed version to
0x2in container header, update the header's check.Signed-off-by Ye Li <[email protected]>Signed-off-by Alice Guo <[email protected]>Acked-by Peng Fan <[email protected]>Reviewed-by Jacky Bai <[email protected]>
Quoted 20 lines
--- drivers/usb/gadget/f_sdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/gadget/f_sdp.c +1
-1@@ -765,7 +765,7 @@ static ulong search_container_header(ulong p, int size)for (i =0 ; i < size; i +=4 ) { hdr = (u8 *)(p + i); -if (*(hdr +3 ) ==0x87 && *hdr ==0 ) +if (*(hdr +3 ) ==0x87 && (*hdr ==0 || *hdr ==2 ))if (*(hdr +1 ) !=0 || *(hdr +2 ) !=0 )return p + i; }Signature · 2 lines
-- 2.43.0
PATCH 6/10 phy: imx8mq-usb: Add SPL support for i.MX8MQ, i.MX8MP, i.MX95, and i.MX94 USB3.0 PHY
In reply to Alice Guo (OSS)From: Alice Guo <[email protected]>
This patch adds SPL Kconfig option (SPL_PHY_IMX8MQ_USB) for the i.MX8MQ, i.MX8MP, i.MX95, and i.MX94 USB3.0 PHY driver, allowing the driver to be compiled and probed in SPL stage.
--- drivers/phy/Kconfig | 14 +++++++++++--- drivers/phy/Makefile | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-)
drivers/phy/Kconfig +11 -3
@@ -289,11 +289,19 @@ config PHY_NPCM_USB Support the USB PHY in NPCM SoCs config PHY_IMX8MQ_USB - bool "NXP i.MX8MQ/i.MX8MP/i.MX95 USB PHY Driver" + bool "NXP i.MX8MQ/i.MX8MP/i.MX95/i.MX94 USB PHY Driver" depends on PHY - depends on IMX8MQ || IMX8MP || IMX95 + depends on IMX8MQ || IMX8MP || IMX95 || IMX94 help - Support the USB3.0 PHY in NXP i.MX8MQ, i.MX8MP, and i.MX95 SoC + Support the USB3.0 PHY in NXP i.MX8MQ, i.MX8MP, i.MX95, and i.MX94 SoCs. + +config SPL_PHY_IMX8MQ_USB + bool "Enable NXP i.MX8MQ/i.MX8MP/i.MX95/i.MX94 USB3.0 PHY Driver in SPL" + depends on SPL_PHY + depends on IMX8MQ || IMX8MP || IMX95 || IMX94 + help + Enable support for the USB3.0 PHY in NXP i.MX8MQ, i.MX8MP, i.MX95, and + i.MX94 SoCs in SPL. config PHY_IMX8M_PCIE bool "NXP i.MX8MM/i.MX8MP PCIe PHY Driver"
drivers/phy/Makefile +1 -1
@@ -38,7 +38,7 @@ obj-$(CONFIG_PHY_DA8XX_USB) += phy-da8xx-usb.o obj-$(CONFIG_PHY_EXYNOS_USBDRD) += phy-exynos-usbdrd.o obj-$(CONFIG_PHY_MTK_TPHY) += phy-mtk-tphy.o obj-$(CONFIG_PHY_NPCM_USB) += phy-npcm-usb.o -obj-$(CONFIG_PHY_IMX8MQ_USB) += phy-imx8mq-usb.o +obj-$(CONFIG_$(PHASE_)PHY_IMX8MQ_USB) += phy-imx8mq-usb.o obj-$(CONFIG_PHY_IMX8M_PCIE) += phy-imx8m-pcie.o obj-$(CONFIG_PHY_XILINX_ZYNQMP) += phy-zynqmp.o obj-y += cadence/
Signature · 1 line
2.43.0
PATCH 7/10 imx943_evk: Add support for booting from USB SDP on USB3.0
In reply to Alice Guo (OSS)From: Alice Guo <[email protected]>
This patch is used to enable USB Gadget in SPL to make i.MX943 evk board can use SDP on USB3.0 interface.
--- arch/arm/dts/imx943-evk-u-boot.dtsi | 24 ++++++++++++++++++++++ arch/arm/dts/imx943-u-boot.dtsi | 40 +++++++++++++++++++++++++++++++++++++ configs/imx943_evk_defconfig | 14 +++++++++++++ 3 files changed, 78 insertions(+)
arch/arm/dts/imx943-evk-u-boot.dtsi +24 -0
@@ -22,6 +22,30 @@ status = "okay"; }; +&usb3 { + bootph-pre-ram; + status = "okay"; +}; + +&usb3_dwc3 { + bootph-pre-ram; + dr_mode = "otg"; + hnp-disable; + srp-disable; + adp-disable; + usb-role-switch; + role-switch-default-mode = "peripheral"; + snps,dis-u1-entry-quirk; + snps,dis-u2-entry-quirk; + status = "okay"; +}; + +&usb3_phy { + bootph-pre-ram; + orientation-switch; + status = "okay"; +}; + &usdhc1 { bootph-pre-ram; };
arch/arm/dts/imx943-u-boot.dtsi +40 -0
@@ -199,6 +199,46 @@ &{/soc} { bootph-all; + usb3: usb@4c010010 { + compatible = "fsl,imx95-dwc3", "fsl,imx8mp-dwc3"; + reg = <0x0 0x4c010010 0x0 0x04>, + <0x0 0x4c1f0000 0x0 0x20>; + ranges; + interrupts = <GIC_SPI 386 IRQ_TYPE_LEVEL_HIGH>; + #address-cells = <2>; + #size-cells = <2>; + clocks = <&scmi_clk IMX94_CLK_HSIO>, + <&scmi_clk IMX94_CLK_32K>; + clock-names = "hsio", "suspend"; + power-domains = <&scmi_devpd IMX94_PD_HSIO_TOP>; + status = "disabled"; + + usb3_dwc3: usb@4c100000 { + compatible = "snps,dwc3"; + reg = <0x0 0x4c100000 0x0 0x10000>; + interrupts = <GIC_SPI 180 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&scmi_clk IMX94_CLK_HSIO>, + <&scmi_clk IMX94_CLK_24M>, + <&scmi_clk IMX94_CLK_32K>; + clock-names = "bus_early", "ref", "suspend"; + phys = <&usb3_phy>, <&usb3_phy>; + phy-names = "usb2-phy", "usb3-phy"; + snps,gfladj-refclk-lpm-sel-quirk; + snps,parkmode-disable-ss-quirk; + }; + }; + + usb3_phy: phy@4c1f0040 { + compatible = "fsl,imx95-usb-phy", "fsl,imx8mp-usb-phy"; + reg = <0x0 0x4c1f0040 0x0 0x40>, + <0x0 0x4c1fc000 0x0 0x100>; + clocks = <&scmi_clk IMX94_CLK_HSIO>; + clock-names = "phy"; + #phy-cells = <0>; + power-domains = <&scmi_devpd IMX94_PD_HSIO_TOP>; + status = "disabled"; + }; + usb2: usb@4c200000 { compatible = "fsl,imx95-usb", "fsl,imx7d-usb", "fsl,imx27-usb"; reg = <0x0 0x4c200000 0x0 0x200>;
configs/imx943_evk_defconfig +14 -0
@@ -100,6 +100,8 @@ CONFIG_IMX_RGPIO2P=y CONFIG_IMX_MU_MBOX=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_FSL_USDHC=y +CONFIG_SPL_PHY=y +CONFIG_SPL_PHY_IMX8MQ_USB=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX_SCMI=y
@@ -114,5 +116,17 @@ CONFIG_DM_RTC=y CONFIG_DM_SERIAL=y CONFIG_FSL_LPUART=y CONFIG_USB=y +CONFIG_SPL_DM_USB_GADGET=y +CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y +CONFIG_USB_DWC3=y +CONFIG_USB_DWC3_GENERIC=y +CONFIG_SPL_USB_DWC3_GENERIC=y +CONFIG_USB_GADGET=y +CONFIG_SPL_USB_GADGET=y +CONFIG_USB_GADGET_MANUFACTURER="FSL" +CONFIG_USB_GADGET_VENDOR_NUM=0x0525 +CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 +CONFIG_SDP_LOADADDR=0x90400000 +CONFIG_SPL_USB_SDP_SUPPORT=y CONFIG_ULP_WATCHDOG=y
Signature · 1 line
2.43.0
PATCH 8/10 net: fsl_enetc: Add i.MX94 support to NETC block control driver
In reply to Alice Guo (OSS)From: Ye Li <[email protected]>
Extend the NETC block control driver to support the i.MX94 SoC.
--- drivers/net/Kconfig | 5 +- drivers/net/fsl_enetc_netc_blk_ctrl.c | 338 +++++++++++++++++++++++++++++++++- 2 files changed, 333 insertions(+), 10 deletions(-)
drivers/net/Kconfig +3 -2
@@ -1002,8 +1002,9 @@ config FSL_ENETC config FSL_ENETC_NETC_BLK_CTRL bool "NXP ENETC NETC blocks control driver" - depends on FSL_ENETC && IMX95 - default y if IMX95 + depends on FSL_ENETC + depends on IMX95 || IMX94 + default y if IMX95 || IMX94 help This driver configures Integrated Endpoint Register Block (IERB) and Privileged Register Block (PRB) of NETC. For i.MX platforms, it also
drivers/net/fsl_enetc_netc_blk_ctrl.c +330 -8
414 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 08/10] net: fsl_enetc: Add i.MX94 support to NETC block control driver
Quoted 140 lines · Alice Guo (OSS)
From: Ye Li <[email protected]>
Extend the NETC block control driver to support the i.MX94 SoC.
Acked-by Peng Fan <[email protected]>Reviewed-by Jacky Bai <[email protected]>Signed-off-by Ye Li <[email protected]>Signed-off-by Alice Guo <[email protected]>--- drivers/net/Kconfig | 5 +- drivers/net/fsl_enetc_netc_blk_ctrl.c | 338 +++++++++++++++++++++++++++++++++- 2 files changed, 333 insertions(+), 10 deletions(-)drivers/net/Kconfig +3
-2@@ -1002,8 +1002,9 @@ config FSL_ENETC config FSL_ENETC_NETC_BLK_CTRL bool "NXP ENETC NETC blocks control driver" - depends on FSL_ENETC && IMX95 - default y if IMX95 + depends on FSL_ENETC + depends on IMX95 || IMX94 + default y if IMX95 || IMX94 help This driver configures Integrated Endpoint Register Block (IERB) and Privileged Register Block (PRB) of NETC. For i.MX platforms, it alsodrivers/net/fsl_enetc_netc_blk_ctrl.c +75
-0@@ -43,6 +43,19 @@#define PCS_PROT_SFI BIT(4)#define PCS_PROT_10G_SXGMII BIT(6) +#define IMX94_MISC_SOC_CONTROL 0x0 +#define SEL_XPCS_1 BIT(1) +#define IMX94_XPCS_PORT_0 0x0 +#define IMX94_XPCS_PORT_1 0x1 + +#define IMX94_EXT_PIN_CONTROL 0x10 +#define MAC2_MAC3_SEL BIT(1) + +#define IMX94_CFG_LINK_PCS_PROT (a) (0x14 + (a) * 4) +#define IMX94_NETC_LINK_CFG (a) (0x4c + (a) * 4) +#define NETC_LINK_CFG_MII_PROT GENMASK(3, 0) +#define NETC_LINK_CFG_IO_VAR GENMASK(19, 16) +/* NETC privileged register block register */ #define PRB_NETCRR 0x100#define NETCRR_SR BIT(0)@@ -55,6 +68,7 @@/* NETC integrated endpoint register block register */ #define IERB_EMDIOFAUXR 0x344#define IERB_T0FAUXR 0x444 +#define IERB_ETBCR (a) (0x300c + 0x100 * (a))#define IERB_EFAUXR (a) (0x3044 + 0x100 * (a))#define IERB_VFAUXR (a) (0x4004 + 0x40 * (a))#define FAUXR_LDID GENMASK(3, 0)@@ -64,6 +78,26 @@#define IMX95_ENETC1_BUS_DEVFN 0x40#define IMX95_ENETC2_BUS_DEVFN 0x80 +#define IMX94_ENETC3_BUS_DEVFN 0x0 +#define IMX94_TIMER0_BUS_DEVFN 0x1 +#define IMX94_SWITCH_BUS_DEVFN 0x2 +#define IMX94_ENETC0_BUS_DEVFN 0x100 +#define IMX94_TIMER1_BUS_DEVFN 0x101 +#define IMX94_ENETC1_BUS_DEVFN 0x140 +#define IMX94_ENETC2_BUS_DEVFN 0x180 +#define IMX94_TIMER2_BUS_DEVFN 0x181 +#define IMX94_ENETC0_LINK 3 +#define IMX94_ENETC1_LINK 4 +#define IMX94_ENETC2_LINK 5 +#define IMX94_ENETC0_OFFSET 0 +#define IMX94_ENETC1_OFFSET 1 +#define IMX94_ENETC2_OFFSET 2 +#define IMX94_SWITCH_PORT2 2 +#define IMX94_SWITCH_CPU_PORT 3 +#define IMX94_TIMER0_ID 0 +#define IMX94_TIMER1_ID 1 +#define IMX94_TIMER2_ID 2 +/* Flags for different platforms */ #define NETC_HAS_NETCMIX BIT(0)@@ -73,6 +107,15 @@ struct netc_blk_ctrl {void __iomem *netcmix; }; +struct netc_devinfo { +int (*netcmix_init)(struct udevice *dev); +int (*ierb_init)(struct udevice *dev); +void (*xpcs_port_init)(struct netc_blk_ctrl *priv,int port); +}; + +static struct netc_blk_ctrl *netc_bc; +static struct netc_devinfo *netc_di; +static void netc_reg_write (void __iomem *base,u32 offset,u32 val) {writel (val, base + offset);@@ -183,6 +226,150 @@ static int imx95_netcmix_init(struct udevice *dev)return 0 ; } +static int imx94_enetc_get_link_num (ofnode np) +{ +int bus_devfn; + + bus_devfn =netc_of_pci_get_bus_devfn (np); +if (bus_devfn <0 ) +return -EINVAL ; + +/* Parse ENETC link number */ +switch (bus_devfn) { +case IMX94_ENETC0_BUS_DEVFN : +return IMX94_ENETC0_LINK ; +case IMX94_ENETC1_BUS_DEVFN : +return IMX94_ENETC1_LINK ; +case IMX94_ENETC2_BUS_DEVFN : +return IMX94_ENETC2_LINK ; +default : +return -EINVAL ; + } +} + +static int imx94_link_config (struct netc_blk_ctrl *priv, +ofnode np,int link_id) +{ +phy_interface_t interface; +int mii_proto; +u32 val; + + interface =ofnode_read_phy_mode (np); +if (interface ==-1 ) +return -EINVAL ; +
drivers/net/fsl_enetc_netc_blk_ctrl.c static int imx95_netcmix_init(struct udevice *dev) · line 270
Quoted 10 lines
drivers/net/fsl_enetc_netc_blk_ctrl.c +10
-0+ mii_proto =netc_get_link_mii_protocol (interface); +if (mii_proto <0 ) +return -EINVAL ; + + val = mii_proto &NETC_LINK_CFG_MII_PROT ; +if (mii_proto ==MII_PROT_SERIAL ) { +int pcs_proto =PCS_PROT_1G_SGMII ; + +if (pcs_proto ==PHY_INTERFACE_MODE_2500BASEX ) + pcs_proto =PCS_PROT_2500M_SGMII ;
It is dead code here. We already have a fix for it. Please combine the fix into the patch.
Best regards,
Ye Li> +
Quoted 308 lines
drivers/net/fsl_enetc_netc_blk_ctrl.c +244
-8+netc_reg_write (priv->netcmix,IMX94_CFG_LINK_PCS_PROT (link_id), + pcs_proto); + val =u32_replace_bits (val,IO_VAR_16FF_16G_SERDES , +NETC_LINK_CFG_IO_VAR ); + } + +netc_reg_write (priv->netcmix,IMX94_NETC_LINK_CFG (link_id), val); + +if (link_id ==IMX94_ENETC0_LINK ) { + val =netc_reg_read (priv->netcmix,IMX94_EXT_PIN_CONTROL ); + val |=MAC2_MAC3_SEL ; +netc_reg_write (priv->netcmix,IMX94_EXT_PIN_CONTROL , val); + } + +return 0 ; +} + +static int imx94_enetc_link_config (struct netc_blk_ctrl *priv, +ofnode np,bool *enetc0_en) +{ +int link_id; + + link_id =imx94_enetc_get_link_num (np); +if (link_id <0 ) +return -EINVAL ; + +if (link_id ==IMX94_ENETC0_LINK ) + *enetc0_en = true; + +return imx94_link_config (priv, np, link_id); +} + +static int imx94_switch_link_config (struct netc_blk_ctrl *priv, +ofnode np,bool *swp2_en) +{ +ofnode ports, child; +int port_id, err =0 ; + + ports =ofnode_find_subnode (np,"ports" ); +if (!ofnode_valid (ports)) + ports =ofnode_find_subnode (np,"ethernet-ports" ); +if (!ofnode_valid (ports)) +return -ENODEV ; + +ofnode_for_each_subnode (child, ports) { +if (ofnode_read_u32 (child,"reg" , &port_id) <0 ) { + err = -ENODEV ; + goto end; + } + +if (port_id ==IMX94_SWITCH_CPU_PORT ) +continue ; + +if (port_id ==IMX94_SWITCH_PORT2 ) + *swp2_en = true; + + err =imx94_link_config (priv, child, port_id); +if (err) + goto end; + } + +end: +return err; +} + +static int imx94_netcmix_init (struct udevice *dev) +{ +struct netc_blk_ctrl *priv =dev_get_priv (dev); +ofnode child, gchild; +bool enetc0_en = false, swp2_en = false; +int err; + +dev_for_each_subnode (child, dev) { +if (!ofnode_is_enabled (child)) +continue ; + +ofnode_for_each_subnode (gchild, child) { +if (!ofnode_is_enabled (gchild)) +continue ; + +if (ofnode_device_is_compatible (gchild,"pci1131,e101" )) { + err =imx94_enetc_link_config (priv, gchild, &enetc0_en); +if (err) +return err; + }else if (ofnode_device_is_compatible (gchild,"pci1131,eef2" )) { + err =imx94_switch_link_config (priv, gchild, &swp2_en); +if (err) +return err; + } + } + } + +if (enetc0_en && swp2_en) { +dev_err (dev,"Cannot enable swp2 and enetc0 at the same time\n" ); + +return -EINVAL ; + } + +return 0 ; +} +static bool netc_ierb_is_locked (struct netc_blk_ctrl *priv) {return !!(netc_reg_read (priv->prb,PRB_NETCRR ) &NETCRR_LOCK );@@ -238,9 +425,99 @@ static int imx95_ierb_init(struct udevice *dev)return 0 ; } +static int imx94_enetc_get_enetc_offset (ofnode np) +{ +int bus_devfn; + + bus_devfn =netc_of_pci_get_bus_devfn (np); +if (bus_devfn <0 ) +return -EINVAL ; + +/* Parse ENETC offset */ +switch (bus_devfn) { +case IMX94_ENETC0_BUS_DEVFN : +return IMX94_ENETC0_OFFSET ; +case IMX94_ENETC1_BUS_DEVFN : +return IMX94_ENETC1_OFFSET ; +case IMX94_ENETC2_BUS_DEVFN : +return IMX94_ENETC2_OFFSET ; +default : +return -EINVAL ; + } +} + +static int imx94_enetc_get_timer_id (ofnode np) +{ +int bus_devfn; + + bus_devfn =netc_of_pci_get_bus_devfn (np); +if (bus_devfn <0 ) +return -EINVAL ; + +/* Parse ENETC PTP timer ID */ +switch (bus_devfn) { +case IMX94_TIMER0_BUS_DEVFN : +return IMX94_TIMER0_ID ; +case IMX94_TIMER1_BUS_DEVFN : +return IMX94_TIMER1_ID ; +case IMX94_TIMER2_BUS_DEVFN : +return IMX94_TIMER2_ID ; +default : +return -EINVAL ; + } +} + +static int imx94_enetc_update_tid (struct netc_blk_ctrl *priv,ofnode pf_np) +{ +ofnode timer_np; +int offset, tid; + + offset =imx94_enetc_get_enetc_offset (pf_np); +if (offset <0 ) { +printf ("Find unknown PF node.\n" ); +return offset; + } + + timer_np =ofnode_parse_phandle (pf_np,"nxp,ptp-timer" ,0 ); +if (!ofnode_valid (timer_np)) { +/* +* If nxp,ptp-timer is not set, the first timer of the bus +* where enetc is located will be used as the default timer. +*/ + tid =IMX94_TIMER1_ID ; + goto update_reg; + } + + tid =imx94_enetc_get_timer_id (timer_np); +if (tid <0 ) { +printf ("Incorrect bus/devfn of ptp-timer.\n" ); +return tid; + } + +update_reg: +netc_reg_write (priv->ierb,IERB_ETBCR (offset), tid); + +return 0 ; +} + +static int imx94_ierb_init (struct udevice *dev) +{ +struct netc_blk_ctrl *priv =dev_get_priv (dev); +ofnode bus_np, pf_np; +int ret =0 ; + +dev_for_each_subnode (bus_np, dev) +ofnode_for_each_subnode (pf_np, bus_np) +if (ofnode_device_is_compatible (pf_np,"pci1131,e101" )) + ret =imx94_enetc_update_tid (priv, pf_np); + +return ret; +} +static int netc_ierb_init (struct udevice *dev) {struct netc_blk_ctrl *priv =dev_get_priv (dev); +struct netc_devinfo *devinfo = (struct netc_devinfo *)dev_get_driver_data (dev);int err;if (netc_ierb_is_locked (priv)) {@@ -251,9 +528,11 @@ static int netc_ierb_init(struct udevice *dev) } } - err =imx95_ierb_init (dev); -if (err) -return err; +if (devinfo->ierb_init) { + err = devinfo->ierb_init (dev); +if (err) +return err; + } err =netc_lock_ierb (priv);if (err) {@@ -264,6 +543,31 @@ static int netc_ierb_init(struct udevice *dev)return 0 ; } +static void imx94_netc_xpcs_port_init (struct netc_blk_ctrl *priv,int port) +{ +u32 val; + + val =netc_reg_read (priv->netcmix,IMX94_MISC_SOC_CONTROL ); +if (port ==IMX94_XPCS_PORT_1 ) + val |=SEL_XPCS_1 ; +else + val &= ~SEL_XPCS_1 ; +netc_reg_write (priv->netcmix,IMX94_MISC_SOC_CONTROL , val); +} + +void netc_xpcs_port_init (int port) +{ +struct netc_blk_ctrl *priv = netc_bc; +struct netc_devinfo *devinfo; + +if (!priv) +return ; + + devinfo = netc_di; +if (devinfo->xpcs_port_init) + devinfo->xpcs_port_init (priv, port); +} +static int netc_prb_check_error (struct netc_blk_ctrl *priv) {if (netc_reg_read (priv->prb,PRB_NETCSR ) &NETCSR_ERROR )@@ -272,14 +576,27 @@ static int netc_prb_check_error(struct netc_blk_ctrl *priv)return 0 ; } +static const struct netc_devinfo imx95_devinfo = { + .netcmix_init = imx95_netcmix_init, + .ierb_init = imx95_ierb_init, +}; + +static const struct netc_devinfo imx94_devinfo = { + .netcmix_init = imx94_netcmix_init, + .ierb_init = imx94_ierb_init, + .xpcs_port_init = imx94_netc_xpcs_port_init, +}; +static const struct udevice_id netc_blk_ctrl_match[] = { - { .compatible ="nxp,imx95-netc-blk-ctrl" }, + { .compatible ="nxp,imx95-netc-blk-ctrl" , .data = (ulong)&imx95_devinfo }, + { .compatible ="nxp,imx94-netc-blk-ctrl" , .data = (ulong)&imx94_devinfo }, {}, };static int netc_blk_ctrl_probe (struct udevice *dev) {struct netc_blk_ctrl *priv =dev_get_priv (dev); +struct netc_devinfo *devinfo = (struct netc_devinfo *)dev_get_driver_data (dev);struct clk *ipg_clk;fdt_addr_t regs;int err;@@ -318,10 +635,12 @@ static int netc_blk_ctrl_probe(struct udevice *dev) priv->netcmix = (void __iomem *)regs; - err =imx95_netcmix_init (dev); -if (err) { -dev_err (dev,"Initializing NETCMIX failed\n" ); -return err; +if (devinfo->netcmix_init) { + err = devinfo->netcmix_init (dev); +if (err) { +dev_err (dev,"Initializing NETCMIX failed\n" ); +return err; + } } err =netc_ierb_init (dev);@@ -333,6 +652,9 @@ static int netc_blk_ctrl_probe(struct udevice *dev)if (netc_prb_check_error (priv) <0 )dev_warn (dev,"The current IERB configuration is invalid\n" ); + netc_bc = priv; + netc_di = devinfo; +return 0 ; }
PATCH 9/10 net: fsl_enetc_mdio: Add support for phy-supply property
In reply to Alice Guo (OSS)From: Ye Li <[email protected]>
Add support for the optional 'phy-supply' property in the ENETC MDIO driver. This allows the driver to enable and manage the PHY's power supply via the regulator framework when specified in device tree.
--- drivers/net/fsl_enetc_mdio.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/net/fsl_enetc_mdio.c +25 -0
@@ -11,6 +11,8 @@#include <asm/io.h> #include <asm/processor.h> #include <miiphy.h> +#include <linux/delay.h> +#include <power/regulator.h> #include "fsl_enetc.h"
@@ -135,6 +137,8 @@ static int enetc_mdio_probe(struct udevice *dev)struct pci_child_plat *pplat =dev_get_parent_plat (dev);struct enetc_mdio_priv *priv =dev_get_priv (dev);u16 cmd =PCI_COMMAND_MEMORY ; +int ret; +struct udevice *supply =NULL ; priv->regs_base =dm_pci_map_bar (dev,PCI_BASE_ADDRESS_0 ,0 ,0 ,PCI_REGION_TYPE ,0 );if (!priv->regs_base) {
@@ -144,6 +148,27 @@ static int enetc_mdio_probe(struct udevice *dev) priv->regs_base +=ENETC_MDIO_BASE ; +if (CONFIG_IS_ENABLED (DM_REGULATOR )) { + ret =device_get_supply_regulator (dev,"phy-supply" , + &supply); +if (ret && ret != -ENOENT ) { +printf ("%s: device_get_supply_regulator failed: %d\n" , + __func__, ret); +return ret; + } + +if (supply) { +regulator_set_enable (supply, false); +mdelay (100 ); + + ret =regulator_set_enable_if_allowed (supply, true); +if (ret) { +printf ("%s: Error enabling phy supply\n" , dev->name); +return ret; + } + } + } +if (pplat->vendor ==PCI_VENDOR_ID_PHILIPS )/* i.MX95 */ cmd |=PCI_COMMAND_MASTER ;
Signature · 1 line
2.43.0
PATCH 10/10 imx943_evk: Enable ENETC1 and ENETC2
In reply to Alice Guo (OSS)From: Alice Guo <[email protected]>
With this patch, both ENETC1 and ENETC2 are functional on the i.MX943 EVK board and can be used for networking.
--- arch/arm/dts/imx943-evk-u-boot.dtsi | 149 ++++++++++++++++++++++++++++++++ arch/arm/dts/imx943-u-boot.dtsi | 166 ++++++++++++++++++++++++++++++++++++ configs/imx943_evk_defconfig | 13 +++ 3 files changed, 328 insertions(+)
arch/arm/dts/imx943-evk-u-boot.dtsi +149 -0
@@ -5,10 +5,109 @@ #include "imx943-u-boot.dtsi" +&enetc1 { + clocks = <&scmi_clk IMX94_CLK_MAC4>; + clock-names = "enet_ref_clk"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_eth3>; + phy-handle = <ðphy5>; + phy-mode = "rgmii-id"; + status = "okay"; +}; + +&enetc2 { + clocks = <&scmi_clk IMX94_CLK_MAC5>; + clock-names = "enet_ref_clk"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_eth4>; + phy-handle = <ðphy6>; + phy-mode = "rgmii-id"; + status = "okay"; +}; + +&lpi2c3 { + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lpi2c3>; + status = "okay"; + + pca9548_i2c3: i2c-mux@77 { + compatible = "nxp,pca9548"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x77>; + + i2c@5 { + #address-cells = <1>; + #size-cells = <0>; + reg = <5>; + + pcal6416_i2c3_u171: gpio@21 { + compatible = "nxp,pcal6416"; + reg = <0x21>; + gpio-controller; + #gpio-cells = <2>; + + ethphy2-on-hog { + gpio-hog; + gpios = <2 GPIO_ACTIVE_HIGH>; + output-high; + }; + + ethphy3-on-hog { + gpio-hog; + gpios = <3 GPIO_ACTIVE_HIGH>; + output-high; + }; + + ethphy4-on-hog { + gpio-hog; + gpios = <4 GPIO_ACTIVE_HIGH>; + output-high; + }; + + lvds-en-hog { + gpio-hog; + gpios = <9 GPIO_ACTIVE_HIGH>; + output-high; + }; + }; + }; + }; +}; + &lpuart1 { bootph-pre-ram; }; +&netc_blk_ctrl { + assigned-clocks = <&scmi_clk IMX94_CLK_MAC2>, + <&scmi_clk IMX94_CLK_MAC4>, + <&scmi_clk IMX94_CLK_MAC5>; + assigned-clock-parents = <&scmi_clk IMX94_CLK_SYSPLL1_PFD0>, + <&scmi_clk IMX94_CLK_SYSPLL1_PFD0>, + <&scmi_clk IMX94_CLK_SYSPLL1_PFD0>; + assigned-clock-rates = <250000000>, <250000000>, <250000000>; + status = "okay"; +}; + +&netc_emdio { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_emdio>; + phy-supply = <®_gpy_en>; + status = "okay"; + + ethphy5: ethernet-phy@6 { + reg = <0x6>; + realtek,clkout-disable; + }; + + ethphy6: ethernet-phy@7 { + reg = <0x7>; + realtek,clkout-disable; + }; +}; + ®_usdhc2_vmmc { bootph-pre-ram; };
@@ -58,6 +157,56 @@ status = "disabled"; }; +&scmi_iomuxc { + pinctrl_emdio: emdiogrp { + fsl,pins = < + IMX94_PAD_ETH4_MDC_GPIO1__NETC_EMDC 0x57e + IMX94_PAD_ETH4_MDIO_GPIO2__NETC_EMDIO 0x97e + >; + }; + + pinctrl_eth3: eth3grp { + fsl,pins = < + IMX94_PAD_ETH3_TXD3__NETC_PINMUX_ETH3_TXD3 0x57e + IMX94_PAD_ETH3_TXD2__NETC_PINMUX_ETH3_TXD2 0x57e + IMX94_PAD_ETH3_TXD1__NETC_PINMUX_ETH3_TXD1 0x57e + IMX94_PAD_ETH3_TXD0__NETC_PINMUX_ETH3_TXD0 0x57e + IMX94_PAD_ETH3_TX_CTL__NETC_PINMUX_ETH3_TX_CTL 0x57e + IMX94_PAD_ETH3_TX_CLK__NETC_PINMUX_ETH3_TX_CLK 0x5fe + IMX94_PAD_ETH3_RX_CTL__NETC_PINMUX_ETH3_RX_CTL 0x57e + IMX94_PAD_ETH3_RX_CLK__NETC_PINMUX_ETH3_RX_CLK 0x5fe + IMX94_PAD_ETH3_RXD0__NETC_PINMUX_ETH3_RXD0 0x57e + IMX94_PAD_ETH3_RXD1__NETC_PINMUX_ETH3_RXD1 0x57e + IMX94_PAD_ETH3_RXD2__NETC_PINMUX_ETH3_RXD2 0x57e + IMX94_PAD_ETH3_RXD3__NETC_PINMUX_ETH3_RXD3 0x57e + >; + }; + + pinctrl_eth4: eth4grp { + fsl,pins = < + IMX94_PAD_ETH4_TXD3__NETC_PINMUX_ETH4_TXD3 0x57e + IMX94_PAD_ETH4_TXD2__NETC_PINMUX_ETH4_TXD2 0x57e + IMX94_PAD_ETH4_TXD1__NETC_PINMUX_ETH4_TXD1 0x57e + IMX94_PAD_ETH4_TXD0__NETC_PINMUX_ETH4_TXD0 0x57e + IMX94_PAD_ETH4_TX_CTL__NETC_PINMUX_ETH4_TX_CTL 0x57e + IMX94_PAD_ETH4_TX_CLK__NETC_PINMUX_ETH4_TX_CLK 0x5fe + IMX94_PAD_ETH4_RX_CTL__NETC_PINMUX_ETH4_RX_CTL 0x57e + IMX94_PAD_ETH4_RX_CLK__NETC_PINMUX_ETH4_RX_CLK 0x5fe + IMX94_PAD_ETH4_RXD0__NETC_PINMUX_ETH4_RXD0 0x57e + IMX94_PAD_ETH4_RXD1__NETC_PINMUX_ETH4_RXD1 0x57e + IMX94_PAD_ETH4_RXD2__NETC_PINMUX_ETH4_RXD2 0x57e + IMX94_PAD_ETH4_RXD3__NETC_PINMUX_ETH4_RXD3 0x57e + >; + }; + + pinctrl_lpi2c3: lpi2c3grp { + fsl,pins = < + IMX94_PAD_GPIO_IO16__LPI2C3_SDA 0x40000b9e + IMX94_PAD_GPIO_IO17__LPI2C3_SCL 0x40000b9e + >; + }; +}; + &pinctrl_reg_usdhc2_vmmc { bootph-pre-ram; };
arch/arm/dts/imx943-u-boot.dtsi +166 -0
178 lines not on this page · raw message
configs/imx943_evk_defconfig +13 -0
@@ -39,6 +39,7 @@ CONFIG_SYS_CBSIZE=2048 CONFIG_SYS_PBSIZE=2074 CONFIG_BOARD_EARLY_INIT_F=y CONFIG_BOARD_LATE_INIT=y +CONFIG_PCI_INIT_R=y CONFIG_SPL_MAX_SIZE=0x30000 CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_LOAD_IMX_CONTAINER=y
@@ -83,6 +84,8 @@ CONFIG_ENV_OVERWRITE=y CONFIG_ENV_IS_NOWHERE=y CONFIG_ENV_IS_IN_MMC=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +CONFIG_NET_RANDOM_ETHADDR=y +CONFIG_SYS_RX_ETH_BUFFER=8 CONFIG_SPL_DM=y CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_REGMAP=y
@@ -97,9 +100,19 @@ CONFIG_SPL_CLK_SCMI=y CONFIG_SPL_FIRMWARE=y # CONFIG_SCMI_AGENT_SMCCC is not set CONFIG_IMX_RGPIO2P=y +CONFIG_DM_PCA953X=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_IMX_LPI2C=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y CONFIG_IMX_MU_MBOX=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_FSL_USDHC=y +CONFIG_PHYLIB=y +CONFIG_PHY_REALTEK=y +CONFIG_DM_MDIO=y +CONFIG_FSL_ENETC=y +CONFIG_PCIE_ECAM_GENERIC=y CONFIG_SPL_PHY=y CONFIG_SPL_PHY_IMX8MQ_USB=y CONFIG_PINCTRL=y
Signature · 1 line
2.43.0
Fabio Estevam
reviewerHi Marek,
Quoted 8 lines · Alice Guo (OSS)
Changes for v1:
- Adding USB2 and USB3 device tree nodes with required PHY and regulator support.
- Enabling ENETC1 and ENETC2.
- UpdatingKconfigand DTSI files to support these interfaces.This series depends on "imx: add i.MX94 support".
Could you please help review the USB parts of this series?
Thanks
On 10/7/25 1:23 PM, Fabio Estevam wrote:
Hello Fabio,
Quoted 9 lines
Quoted 7 lines
Changes for v1:
- Adding USB2 and USB3 device tree nodes with required PHY and regulator support.
- Enabling ENETC1 and ENETC2.
- UpdatingKconfigand DTSI files to support these interfaces.This series depends on "imx: add i.MX94 support".
Could you please help review the USB parts of this series?
I don't think I ever received the entire series, can Alice please resend it and CC me on ALL the patches ?
Thank you
Fabio Estevam
reviewerHi Alice,
Quoted 2 lines · Marek Vasut
I don't think I ever received the entire series, can Alice please resend it and CC me on ALL the patches ?
Please resend the series with Marek on Cc on all the patches.
Thanks
Quoted 8 lines · Fabio Estevam
Hi Alice,
Quoted 2 lines · Marek Vasut
I don't think I ever received the entire series, can Alice please resend it and CC me on ALL the patches ?
Please resend the series with Marek on Cc on all the patches.
Hi Marek,
I checked the series and it looks like your denx.de email is CC'd on the whole series: Marek Vasut <[email protected]>.
This is also what's seen on lore:
http://lore.kernel.org/r/[email protected]
If that one is no longer valid, maybe we can consider updating MAINTAINERS?
It's still listed for the USB entry.
Quoted 2 lines
Thanks