From b20c51bc45c758e689218e2da73a50f19a5240d8 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 7 Jan 2025 23:56:07 +0100 Subject: [PATCH 1/3] usb: ehci-mx5: Use regulator_set_enable_if_allowed With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators. Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled. Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed") Signed-off-by: Marek Vasut Reviewed-by: Fabio Estevam Reviewed-by: Mattijs Korpershoek --- drivers/usb/host/ehci-mx5.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c index d8f521befe1..1392d29bc13 100644 --- a/drivers/usb/host/ehci-mx5.c +++ b/drivers/usb/host/ehci-mx5.c @@ -287,9 +287,9 @@ static int ehci_usb_probe(struct udevice *dev) debug("%s: No vbus supply\n", dev->name); if (!ret && priv->vbus_supply) { - ret = regulator_set_enable(priv->vbus_supply, - (type == USB_INIT_DEVICE) ? - false : true); + ret = regulator_set_enable_if_allowed(priv->vbus_supply, + (type == USB_INIT_DEVICE) ? + false : true); if (ret) { puts("Error enabling VBUS supply\n"); return ret; From addcb09fd507c75cb59c83eeaeb3ccc12a2248c6 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 7 Jan 2025 23:56:08 +0100 Subject: [PATCH 2/3] usb: ehci-mx6: Use regulator_set_enable_if_allowed With the commit 4fcba5d556b4 ("regulator: implement basic reference counter") the return value of regulator_set_enable may be EALREADY or EBUSY for fixed/gpio regulators. Change to use the more relaxed regulator_set_enable_if_allowed to continue if regulator already was enabled or disabled. Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed") Signed-off-by: Marek Vasut Reviewed-by: Fabio Estevam Reviewed-by: Mattijs Korpershoek --- drivers/usb/host/ehci-mx6.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c index a93fa5d5455..a8748cef7ad 100644 --- a/drivers/usb/host/ehci-mx6.c +++ b/drivers/usb/host/ehci-mx6.c @@ -479,9 +479,9 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev) #if CONFIG_IS_ENABLED(DM_REGULATOR) if (priv->vbus_supply) { int ret; - ret = regulator_set_enable(priv->vbus_supply, - (type == USB_INIT_DEVICE) ? - false : true); + ret = regulator_set_enable_if_allowed(priv->vbus_supply, + (type == USB_INIT_DEVICE) ? + false : true); if (ret && ret != -ENOSYS) { printf("Error enabling VBUS supply (ret=%i)\n", ret); return ret; From 801b5fafd35db53f229bde5e2eb7d290e5d172e7 Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 7 Jan 2025 23:59:07 +0100 Subject: [PATCH 3/3] usb: ehci-mx6: Add i.MX95 support i.MX95 uses the same USB IP as i.MX8MM. It can then reuse the ehci-mx6 driver. Signed-off-by: Marek Vasut Reviewed-by: Fabio Estevam --- drivers/usb/host/Kconfig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 24786a2bc91..a656265890e 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -217,14 +217,14 @@ config USB_EHCI_MX6 Enables support for the on-chip EHCI controller on i.MX6 SoCs. config USB_EHCI_MX7 - bool "Support for i.MX7 on-chip EHCI USB controller" - depends on ARCH_MX7 || IMX8M || IMX93 + bool "Support for i.MX7/i.MX8M/i.MX9 on-chip EHCI USB controller" + depends on ARCH_MX7 || IMX8M || IMX93 || IMX95 select EHCI_HCD_INIT_AFTER_RESET if ARCH_MX7 - select PHY if IMX8M || IMX93 - select NOP_PHY if IMX8M || IMX93 + select PHY if IMX8M || IMX93 || IMX95 + select NOP_PHY if IMX8M || IMX93 || IMX95 default y ---help--- - Enables support for the on-chip EHCI controller on i.MX7 SoCs. + Enables support for the on-chip EHCI controller on i.MX7/i.MX8M/i.MX9 SoCs. config USB_EHCI_MXS bool "Support for i.MX23/i.MX28 EHCI USB controller"