Skip to contentSkip to conversation

usb: ehci-mx6: Add i.MX95 OTG support

PATCH In review Tim Harvey 4 participants 6 messages Jul 21, 2025 – Aug 23, 2025

Subsystems (3)
lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

PATCH v2 1/1 usb: ehci-mx6: Add i.MX95 OTG support

When the usb node is defined dr_mode="otg" ehci_usb_phy_mode() is called to determine the mode from status registers.

The IMX95RM does not currently define the USBNC STATUS register but it is assumed to be an omission as the first three registers are defined. It has been expirimentally verified that the USBNC_PHY_STATUS register at offset 0x23C bit4 (USBNC_PHYSTATUS_ID_DIG) reads 0 when USB_ID is GND and 1 when floating.

Use is_imx9() as this driver works for i.MX91, i.MX93 and i.MX95 and all of these determine the role based on the USBNC_PHY_STATUS register.

Fixes 801b5fafd35d "(usb: ehci-mx6: Add i.MX95 support")

---
v2: use is_imx9 as suggested by Alice and update commit log

---
 drivers/usb/host/ehci-mx6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ehci-mx6.c +1 -1
index a8748cef7ad..25907f22612 100644
@@ -537,7 +537,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
 			plat->init_type = USB_INIT_DEVICE;
 		else
 			plat->init_type = USB_INIT_HOST;
-	} else if (is_mx7() || is_imx8mm() || is_imx8mn() || is_imx93()) {
+	} else if (is_mx7() || is_imx8mm() || is_imx8mn() || is_imx9()) {
 		phy_status = (void __iomem *)(addr +
 					      USBNC_PHY_STATUS_OFFSET);
 		val = readl(phy_status);
Signature · 1 line
2.34.1
Reviewed-by Alice Guo on v2 1/1
#1 lore raw

Best Regards,
Alice Guo

Quoted 45 lines

-----邮件原件-----
发件人: Tim Harvey <[email protected]>
发送时间: 2025年7月22日 2:02
收件人: Marek Vasut <[email protected]>; Fabio Estevam <[email protected]>; Alice Guo (OSS) <[email protected]>; dl-uboot-imx <[email protected]>; Peng Fan <[email protected]>; Stefano Babic <[email protected]>; Ye Li <[email protected]>
抄送: [email protected]; [email protected]
主题: [PATCH v2] usb: ehci-mx6: Add i.MX95 OTG support

When the usb node is defined dr_mode="otg" ehci_usb_phy_mode() is called to determine the mode from status registers.

The IMX95RM does not currently define the USBNC STATUS register but it is assumed to be an omission as the first three registers are defined. It has been expirimentally verified that the USBNC_PHY_STATUS register at offset 0x23C bit4 (USBNC_PHYSTATUS_ID_DIG) reads 0 when USB_ID is GND and 1 when floating.

Use is_imx9() as this driver works for i.MX91, i.MX93 and i.MX95 and all of these determine the role based on the USBNC_PHY_STATUS register.

Fixes 801b5fafd35d "(usb: ehci-mx6: Add i.MX95 support")

---
v2: use is_imx9 as suggested by Alice and update commit log

---
 drivers/usb/host/ehci-mx6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ehci-mx6.c index renamed from drivers/usb/host/ehci-mx6.c +0 -0

a8748cef7ad..25907f22612 100644

drivers/usb/host/ehci-mx6.c +1 -2
@@ -537,7 +537,7 @@ static int ehci_usb_phy_mode(struct udevice *dev)
 			plat->init_type = USB_INIT_DEVICE;
 		else
 			plat->init_type = USB_INIT_HOST;
-	} else if (is_mx7() || is_imx8mm() || is_imx8mn() || is_imx93()) {
+	} else if (is_mx7() || is_imx8mm() || is_imx8mn() || is_imx9()) {
 		phy_status = (void __iomem *)(addr +
 					      USBNC_PHY_STATUS_OFFSET);
 		val = readl(phy_status);
--

2.34.1

Reviewed-by on v2 1/1
#2 lore raw
In reply to Tim Harvey

Hi Tim,

Quoted 11 lines · Tim Harvey

When the usb node is defined dr_mode="otg" ehci_usb_phy_mode() is called to determine the mode from status registers.

The IMX95RM does not currently define the USBNC STATUS register but it is assumed to be an omission as the first three registers are defined. It has been expirimentally verified that the USBNC_PHY_STATUS register at offset 0x23C bit4 (USBNC_PHYSTATUS_ID_DIG) reads 0 when USB_ID is GND and 1 when floating.

Use is_imx9() as this driver works for i.MX91, i.MX93 and i.MX95 and all of these determine the role based on the USBNC_PHY_STATUS register.

Just a question, does your board use USB2.0 port for SDP? And any public patches ready for that?

Quoted 3 lines
Fixes 801b5fafd35d "(usb: ehci-mx6: Add i.MX95 support")

LGTM:

author
#3 lore raw
Quoted 13 lines · Peng Fan

Hi Tim,

Quoted 9 lines · Tim Harvey

When the usb node is defined dr_mode="otg" ehci_usb_phy_mode() is called to determine the mode from status registers.

The IMX95RM does not currently define the USBNC STATUS register but it is assumed to be an omission as the first three registers are defined. It has been expirimentally verified that the USBNC_PHY_STATUS register at offset 0x23C bit4 (USBNC_PHYSTATUS_ID_DIG) reads 0 when USB_ID is GND and 1 when floating.

Quoted 6 lines
Quoted 2 lines

Use is_imx9() as this driver works for i.MX91, i.MX93 and i.MX95 and all of these determine the role based on the USBNC_PHY_STATUS register.

Just a question, does your board use USB2.0 port for SDP? And any public patches ready for that?

Hi Peng,

Yes, I am using the USB2.0 interface for SDP. Aside from this patch the usb2 nodes need to be added to the dt (usbphynop, usb2, usbmisc which are already in kernel but not yet in uboot dts/upstream).

However, unlike SDP on the USB3.0 interface which I was able to get working, I was getting stuck somewhere between the ATF and U-Boot proper on USB2.0. I can no longer boot software on my imx95_19x19_evk after the changes merged for B0 so I'm unable to test and compare notes at the moment.

Best Regards,

Tim

Quoted 7 lines
Quoted 3 lines
Fixes 801b5fafd35d "(usb: ehci-mx6: Add i.MX95 support")

LGTM:

author
#4 lore raw
Quoted 34 lines · Tim Harvey
Quoted 13 lines · Peng Fan

Hi Tim,

Quoted 9 lines · Tim Harvey

When the usb node is defined dr_mode="otg" ehci_usb_phy_mode() is called to determine the mode from status registers.

The IMX95RM does not currently define the USBNC STATUS register but it is assumed to be an omission as the first three registers are defined. It has been expirimentally verified that the USBNC_PHY_STATUS register at offset 0x23C bit4 (USBNC_PHYSTATUS_ID_DIG) reads 0 when USB_ID is GND and 1 when floating.

Quoted 6 lines
Quoted 2 lines

Use is_imx9() as this driver works for i.MX91, i.MX93 and i.MX95 and all of these determine the role based on the USBNC_PHY_STATUS register.

Just a question, does your board use USB2.0 port for SDP? And any public patches ready for that?

Hi Peng,

Yes, I am using the USB2.0 interface for SDP. Aside from this patch the usb2 nodes need to be added to the dt (usbphynop, usb2, usbmisc which are already in kernel but not yet in uboot dts/upstream).

However, unlike SDP on the USB3.0 interface which I was able to get working, I was getting stuck somewhere between the ATF and U-Boot proper on USB2.0. I can no longer boot software on my imx95_19x19_evk after the changes merged for B0 so I'm unable to test and compare notes at the moment.

Quoted 5 lines

Best Regards,

Tim

Hi Peng,

Just to follow-up here I have been able to get imx95 to boot via SDP on imx95-19x19's USB2 with the following:
1. the patch in this thread
2. the env-is-nowhere patch from João Paulo Gonçalves:
https://www.mail-archive.com/[email protected]/msg550594.html
3. adding the usb2/reg_usb_vbus/usbphynop to imx95-19x19-evk-u-boot.dtsi
4. the following changes to defconfig:

configs/imx95.config +7 -3
@@ -129,6 +129,8 @@ CONFIG_DM_MDIO=y
 CONFIG_MII=y
 CONFIG_FSL_ENETC=y
 CONFIG_PCIE_ECAM_GENERIC=y
+CONFIG_SPL_PHY=y
+CONFIG_SPL_NOP_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX_SCMI=y
@@ -146,16 +148,17 @@ CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_NXP_FSPI=y
 CONFIG_USB=y
-CONFIG_SPL_DM_USB_GADGET=y
+CONFIG_SPL_USB_HOST=y
+CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_DWC3=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=0x1fc9
 CONFIG_USB_GADGET_PRODUCT_NUM=0x0152
+CONFIG_CI_UDC=y
 CONFIG_SDP_LOADADDR=0x90400000
+CONFIG_USB_GADGET_DOWNLOAD=y
+CONFIG_USB_FUNCTION_SDP=y
 CONFIG_SPL_USB_SDP_SUPPORT=y
 CONFIG_ULP_WATCHDOG=y
 CONFIG_LZO=y

Note that I had to disable DWC3 and I think that's because it uses dm for gadget mode and CI_UDC does not support that and thus duplicates functions.

This was needed to bring up a custom board that runs USB3 to a HUB and USB2 to a Type-C connector.

Fabio,

I'm not sure if you were needing more reviews for this one or if you were just waiting for a follow-up to Peng's question.

Best Regards,

Tim

reviewer Reviewed-by
#5 lore raw

Hi Tim,

Quoted 4 lines · Tim Harvey

Fabio,

I'm not sure if you were needing more reviews for this one or if you were just waiting for a follow-up to Peng's question.

This patch looks good to me:

It will go through Marek's USB tree.

Thanks