diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2015-01-29 15:05:04 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2015-01-31 12:05:06 -0500 |
commit | 074f9dd55f9cab1b82690ed7e44bcf38b9616ce0 (patch) | |
tree | 5ef4e9054a862b930cd75f394f2c0a62e14361b2 | |
parent | 3f2cee73b650921b2e214bf487b2061a1c266504 (diff) |
USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd)
Currently the USB stack assumes that all host controller drivers are
capable of receiving wakeup requests from downstream devices.
However, this isn't true for the isp1760-hcd driver, which means that
it isn't safe to do a runtime suspend of any device attached to a
root-hub port if the device requires wakeup.
This patch adds a "cant_recv_wakeups" flag to the usb_hcd structure
and sets the flag in isp1760-hcd. The core is modified to prevent a
direct child of the root hub from being put into runtime suspend with
wakeup enabled if the flag is set.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Nicolas Pitre <nico@linaro.org>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-rw-r--r-- | drivers/usb/core/driver.c | 12 | ||||
-rw-r--r-- | drivers/usb/host/isp1760-hcd.c | 3 | ||||
-rw-r--r-- | include/linux/usb/hcd.h | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index c76ec9758ce3..818369afff63 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -1780,6 +1780,18 @@ static int autosuspend_check(struct usb_device *udev) | |||
1780 | dev_dbg(&udev->dev, "remote wakeup needed for autosuspend\n"); | 1780 | dev_dbg(&udev->dev, "remote wakeup needed for autosuspend\n"); |
1781 | return -EOPNOTSUPP; | 1781 | return -EOPNOTSUPP; |
1782 | } | 1782 | } |
1783 | |||
1784 | /* | ||
1785 | * If the device is a direct child of the root hub and the HCD | ||
1786 | * doesn't handle wakeup requests, don't allow autosuspend when | ||
1787 | * wakeup is needed. | ||
1788 | */ | ||
1789 | if (w && udev->parent == udev->bus->root_hub && | ||
1790 | bus_to_hcd(udev->bus)->cant_recv_wakeups) { | ||
1791 | dev_dbg(&udev->dev, "HCD doesn't handle wakeup requests\n"); | ||
1792 | return -EOPNOTSUPP; | ||
1793 | } | ||
1794 | |||
1783 | udev->do_remote_wakeup = w; | 1795 | udev->do_remote_wakeup = w; |
1784 | return 0; | 1796 | return 0; |
1785 | } | 1797 | } |
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c index dbba455884f4..cecf39a220e7 100644 --- a/drivers/usb/host/isp1760-hcd.c +++ b/drivers/usb/host/isp1760-hcd.c | |||
@@ -2245,6 +2245,9 @@ struct usb_hcd *isp1760_register(phys_addr_t res_start, resource_size_t res_len, | |||
2245 | hcd->rsrc_start = res_start; | 2245 | hcd->rsrc_start = res_start; |
2246 | hcd->rsrc_len = res_len; | 2246 | hcd->rsrc_len = res_len; |
2247 | 2247 | ||
2248 | /* This driver doesn't support wakeup requests */ | ||
2249 | hcd->cant_recv_wakeups = 1; | ||
2250 | |||
2248 | ret = usb_add_hcd(hcd, irq, irqflags); | 2251 | ret = usb_add_hcd(hcd, irq, irqflags); |
2249 | if (ret) | 2252 | if (ret) |
2250 | goto err_unmap; | 2253 | goto err_unmap; |
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 8968f616e414..68b1e836dff1 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -146,6 +146,8 @@ struct usb_hcd { | |||
146 | unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ | 146 | unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */ |
147 | unsigned can_do_streams:1; /* HC supports streams */ | 147 | unsigned can_do_streams:1; /* HC supports streams */ |
148 | unsigned tpl_support:1; /* OTG & EH TPL support */ | 148 | unsigned tpl_support:1; /* OTG & EH TPL support */ |
149 | unsigned cant_recv_wakeups:1; | ||
150 | /* wakeup requests from downstream aren't received */ | ||
149 | 151 | ||
150 | unsigned int irq; /* irq allocated */ | 152 | unsigned int irq; /* irq allocated */ |
151 | void __iomem *regs; /* device memory/io */ | 153 | void __iomem *regs; /* device memory/io */ |