This workaround is required to allow HSIC ports to connect again after a
reset - without this, only the initial `usb start` will be successful,
but after a `usb reset` no devices are found anymore.

A similar fix was introduced in Linux commit fc6b68ba4990
("usb: chipidea: add work-around for Marvell HSIC PHY startup").

Signed-off-by: Nora Schiffer <[email protected]>
---
 drivers/usb/host/ehci-mx6.c | 12 ++++++++++++
 include/usb/ehci-ci.h       |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index c804af8ab45..aa0d8174103 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -454,6 +454,17 @@ static u32 mx6_portsc(enum usb_phy_interface phy_type)
        }
 }
 
+static void mx6_ehci_enable_port_power(struct ehci_ctrl *ctrl,
+                                      uint32_t *status_reg, uint32_t reg)
+{
+       struct ehci_mx6_priv_data *priv = ctrl->priv;
+
+       if (priv->phy_type == USBPHY_INTERFACE_MODE_HSIC)
+               ehci_writel(status_reg, reg | PORT_PP | PORT_PTC_HS);
+
+       ehci_writel(status_reg, reg | PORT_PP);
+}
+
 static int mx6_init_after_reset(struct ehci_ctrl *dev)
 {
        struct ehci_mx6_priv_data *priv = dev->priv;
@@ -499,6 +510,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
 }
 
 static const struct ehci_ops mx6_ehci_ops = {
+       .enable_port_power = mx6_ehci_enable_port_power,
        .init_after_reset = mx6_init_after_reset
 };
 
diff --git a/include/usb/ehci-ci.h b/include/usb/ehci-ci.h
index bc980934585..2d513b338c7 100644
--- a/include/usb/ehci-ci.h
+++ b/include/usb/ehci-ci.h
@@ -26,6 +26,7 @@
 #define PORT_PTS_HSIC          (1 << 25)
 #define PORT_PFSC              (1 << 24) /* Defined on Page 39-44 of the 
mpc5151 ERM */
 #define PORT_PTS_PHCD          (1 << 23)
+#define PORT_PTC_HS            (5 << 16)
 #define PORT_PP                        (1 << 12)
 #define PORT_PR                        (1 << 8)
 
-- 
2.55.0

Reply via email to