From 746e03845863b790ba58da93d3b9ed053d44118c Mon Sep 17 00:00:00 2001 From: lyz Date: Wed, 10 Dec 2014 15:57:17 +0800 Subject: [PATCH] rk32: ehci: work-around for abnormal ohci --- drivers/usb/host/ehci-rockchip.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/usb/host/ehci-rockchip.c b/drivers/usb/host/ehci-rockchip.c index 4e4be6996918..16b1558673c3 100755 --- a/drivers/usb/host/ehci-rockchip.c +++ b/drivers/usb/host/ehci-rockchip.c @@ -458,14 +458,36 @@ static const struct ehci_driver_overrides rk_overrides __initdata = { .extra_priv_size = sizeof(struct rk_ehci_hcd), }; +static void rk32_ehci_relinquish_port(struct usb_hcd *hcd, int portnum) +{ + struct ehci_hcd *ehci = hcd_to_ehci(hcd); + u32 *status_reg = &ehci->regs->port_status[--portnum]; + u32 portsc; + + portsc = ehci_readl(ehci, status_reg); + portsc &= ~(PORT_OWNER | PORT_RWC_BITS); + + ehci_writel(ehci, portsc, status_reg); +} + static int __init ehci_rk_init(void) { if (usb_disabled()) return -ENODEV; ehci_init_driver(&rk_ehci_hc_driver, &rk_overrides); + + /* + * Work-around: RK3288 do not support OHCI controller, so our + * vendor-spec ehci driver has to prevent handing off this port to + * OHCI by standard ehci-hub driver, put PORT_OWNER back to 0 manually. + */ + if (cpu_is_rk3288()) + rk_ehci_hc_driver.relinquish_port = rk32_ehci_relinquish_port; + return platform_driver_register(&rk_ehci_driver); } + module_init(ehci_rk_init); static void __exit ehci_rk_cleanup(void) -- 2.34.1