The system configuration API should be called before the controller
run, otherwise, undefined results may occur. So, we override hcd
reset API, and add system configuration API after controller reset.

Cc: Li Jun <[email protected]>
Cc: Alan Stern <[email protected]>
Signed-off-by: Peter Chen <[email protected]>
---
 drivers/usb/chipidea/host.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/host.c b/drivers/usb/chipidea/host.c
index 4455431..f88df40 100644
--- a/drivers/usb/chipidea/host.c
+++ b/drivers/usb/chipidea/host.c
@@ -78,9 +78,25 @@ static int ehci_ci_portpower(struct usb_hcd *hcd, int 
portnum, bool enable)
        return 0;
 };
 
+static int ehci_ci_reset(struct usb_hcd *hcd)
+{
+       struct device *dev = hcd->self.controller;
+       struct ci_hdrc *ci = dev_get_drvdata(dev);
+       int ret;
+
+       ret = ehci_setup(hcd);
+       if (ret)
+               return ret;
+
+       ci_platform_configure(ci);
+
+       return ret;
+}
+
 static const struct ehci_driver_overrides ehci_ci_overrides = {
        .extra_priv_size = sizeof(struct ehci_ci_priv),
        .port_power      = ehci_ci_portpower,
+       .reset           = ehci_ci_reset,
 };
 
 static irqreturn_t host_irq(struct ci_hdrc *ci)
@@ -153,8 +169,6 @@ static int host_start(struct ci_hdrc *ci)
                }
        }
 
-       ci_platform_configure(ci);
-
        return ret;
 
 disable_reg:
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to