From a03c5f1ef55e42898290f4c44fec727f250fce87 Mon Sep 17 00:00:00 2001 From: Frank Wang Date: Mon, 22 Jan 2018 15:02:49 +0800 Subject: [PATCH] usb: amend ehci no-relinquish-port for rk3288 platform For the hardware bug of RK3288 OHCI, we use commit cfe6f1dd57e0 ("usb: ehci: add rockchip relinquishing port quirk support") to fix it previously. However, it have been ineffective after upstream commit 94c43b9897ab ("USB: Check for dropped connection before switching to full speed") was merged due to the condition of relinquishing port was changed. This patch adds an additional condition for the previous commit to ensure no relinquish port quirk can take effect for RK3288 EHCI. Change-Id: I0630265e101afb349816955e069e1c121745ac08 Signed-off-by: Frank Wang --- drivers/usb/core/hub.c | 3 ++- drivers/usb/host/ehci-platform.c | 4 +++- include/linux/usb/hcd.h | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index cc62707c0251..4eb5586450bf 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -5091,7 +5091,8 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, done: hub_port_disable(hub, port1, 1); if (hcd->driver->relinquish_port && !hub->hdev->parent) { - if (status != -ENOTCONN && status != -ENODEV) + if ((status != -ENOTCONN && status != -ENODEV) || + (status == -ENOTCONN && hcd->rk3288_relinquish_port_quirk)) hcd->driver->relinquish_port(hcd, port1); } } diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 4ebb88b0ff00..491da8033a78 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -192,9 +192,11 @@ static int ehci_platform_probe(struct platform_device *dev) if (of_machine_is_compatible("rockchip,rk3288") && of_property_read_bool(dev->dev.of_node, - "rockchip-relinquish-port")) + "rockchip-relinquish-port")) { ehci_platform_hc_driver.relinquish_port = ehci_rockchip_relinquish_port; + hcd->rk3288_relinquish_port_quirk = 1; + } for (clk = 0; clk < EHCI_MAX_CLKS; clk++) { priv->clks[clk] = of_clk_get(dev->dev.of_node, clk); diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 97e2ddec18b1..d2c344aaddd9 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -167,6 +167,7 @@ struct usb_hcd { unsigned tpl_support:1; /* OTG & EH TPL support */ unsigned cant_recv_wakeups:1; /* wakeup requests from downstream aren't received */ + unsigned rk3288_relinquish_port_quirk:1; unsigned int irq; /* irq allocated */ void __iomem *regs; /* device memory/io */