Commit 3c9740a117d40a74412775b5d3fe2b88a7635a0e

Authored by Peter Chen
Committed by Greg Kroah-Hartman
1 parent c4962e03f4

usb: hcd: move controller wakeup setting initialization to individual driver

Individual controller driver has different requirement for wakeup
setting, so move it from core to itself. In order to align with
current etting the default wakeup setting is enabled (except for
chipidea host).

Pass compile test with below commands:
	make O=outout/all allmodconfig
	make -j$CPU_NUM O=outout/all drivers/usb

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 64 changed files with 92 additions and 16 deletions Side-by-side Diff

drivers/staging/dwc2/hcd.c
... ... @@ -2921,6 +2921,8 @@
2921 2921 if (retval < 0)
2922 2922 goto error3;
2923 2923  
  2924 + device_wakeup_enable(hcd->self.controller);
  2925 +
2924 2926 dwc2_hcd_dump_state(hsotg);
2925 2927  
2926 2928 dwc2_enable_global_interrupts(hsotg);
drivers/staging/octeon-usb/octeon-hcd.c
... ... @@ -3498,6 +3498,7 @@
3498 3498 kfree(hcd);
3499 3499 return -1;
3500 3500 }
  3501 + device_wakeup_enable(hcd->self.controller);
3501 3502  
3502 3503 dev_dbg(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq);
3503 3504  
drivers/staging/ozwpan/ozhcd.c
... ... @@ -2270,6 +2270,8 @@
2270 2270 usb_put_hcd(hcd);
2271 2271 return -1;
2272 2272 }
  2273 + device_wakeup_enable(hcd->self.controller);
  2274 +
2273 2275 spin_lock_bh(&g_hcdlock);
2274 2276 g_ozhcd = ozhcd;
2275 2277 spin_unlock_bh(&g_hcdlock);
drivers/usb/c67x00/c67x00-hcd.c
... ... @@ -384,6 +384,8 @@
384 384 goto err2;
385 385 }
386 386  
  387 + device_wakeup_enable(hcd->self.controller);
  388 +
387 389 spin_lock_irqsave(&sie->lock, flags);
388 390 sie->private_data = c67x00;
389 391 sie->irq = c67x00_hcd_irq;
drivers/usb/core/hcd-pci.c
... ... @@ -282,6 +282,7 @@
282 282  
283 283 if (retval != 0)
284 284 goto unmap_registers;
  285 + device_wakeup_enable(hcd->self.controller);
285 286  
286 287 if (pci_dev_run_wake(dev))
287 288 pm_runtime_put_noidle(&dev->dev);
drivers/usb/core/hcd.c
... ... @@ -2712,12 +2712,6 @@
2712 2712 if (hcd->uses_new_polling && HCD_POLL_RH(hcd))
2713 2713 usb_hcd_poll_rh_status(hcd);
2714 2714  
2715   - /*
2716   - * Host controllers don't generate their own wakeup requests;
2717   - * they only forward requests from the root hub. Therefore
2718   - * controllers should always be enabled for remote wakeup.
2719   - */
2720   - device_wakeup_enable(hcd->self.controller);
2721 2715 return retval;
2722 2716  
2723 2717 error_create_attr_group:
drivers/usb/host/ehci-atmel.c
... ... @@ -153,6 +153,7 @@
153 153 retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
154 154 if (retval)
155 155 goto fail_add_hcd;
  156 + device_wakeup_enable(hcd->self.controller);
156 157  
157 158 return retval;
158 159  
drivers/usb/host/ehci-exynos.c
... ... @@ -166,6 +166,7 @@
166 166 dev_err(&pdev->dev, "Failed to add USB HCD\n");
167 167 goto fail_add_hcd;
168 168 }
  169 + device_wakeup_enable(hcd->self.controller);
169 170  
170 171 platform_set_drvdata(pdev, hcd);
171 172  
drivers/usb/host/ehci-fsl.c
... ... @@ -138,6 +138,7 @@
138 138 retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
139 139 if (retval != 0)
140 140 goto err4;
  141 + device_wakeup_enable(hcd->self.controller);
141 142  
142 143 #ifdef CONFIG_USB_OTG
143 144 if (pdata->operating_mode == FSL_USB2_DR_OTG) {
drivers/usb/host/ehci-grlib.c
... ... @@ -140,6 +140,7 @@
140 140 if (rv)
141 141 goto err_ioremap;
142 142  
  143 + device_wakeup_enable(hcd->self.controller);
143 144 return 0;
144 145  
145 146 err_ioremap:
drivers/usb/host/ehci-mv.c
... ... @@ -257,6 +257,7 @@
257 257 "failed to add hcd with err %d\n", retval);
258 258 goto err_set_vbus;
259 259 }
  260 + device_wakeup_enable(hcd->self.controller);
260 261 }
261 262  
262 263 if (pdata->private_init)
drivers/usb/host/ehci-mxc.c
... ... @@ -155,6 +155,7 @@
155 155 if (ret)
156 156 goto err_add;
157 157  
  158 + device_wakeup_enable(hcd->self.controller);
158 159 return 0;
159 160  
160 161 err_add:
drivers/usb/host/ehci-octeon.c
... ... @@ -158,6 +158,7 @@
158 158 dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret);
159 159 goto err3;
160 160 }
  161 + device_wakeup_enable(hcd->self.controller);
161 162  
162 163 platform_set_drvdata(pdev, hcd);
163 164  
drivers/usb/host/ehci-omap.c
... ... @@ -215,6 +215,7 @@
215 215 dev_err(dev, "failed to add hcd with err %d\n", ret);
216 216 goto err_pm_runtime;
217 217 }
  218 + device_wakeup_enable(hcd->self.controller);
218 219  
219 220 /*
220 221 * Bring PHYs out of reset for non PHY modes.
drivers/usb/host/ehci-orion.c
... ... @@ -252,6 +252,7 @@
252 252 if (err)
253 253 goto err4;
254 254  
  255 + device_wakeup_enable(hcd->self.controller);
255 256 return 0;
256 257  
257 258 err4:
drivers/usb/host/ehci-platform.c
... ... @@ -132,6 +132,7 @@
132 132 if (err)
133 133 goto err_put_hcd;
134 134  
  135 + device_wakeup_enable(hcd->self.controller);
135 136 platform_set_drvdata(dev, hcd);
136 137  
137 138 return err;
drivers/usb/host/ehci-pmcmsp.c
... ... @@ -210,8 +210,10 @@
210 210  
211 211  
212 212 retval = usb_add_hcd(hcd, res->start, IRQF_SHARED);
213   - if (retval == 0)
  213 + if (retval == 0) {
  214 + device_wakeup_enable(hcd->self.controller);
214 215 return 0;
  216 + }
215 217  
216 218 usb_remove_hcd(hcd);
217 219 err3:
drivers/usb/host/ehci-ppc-of.c
... ... @@ -169,6 +169,7 @@
169 169 if (rv)
170 170 goto err_ioremap;
171 171  
  172 + device_wakeup_enable(hcd->self.controller);
172 173 return 0;
173 174  
174 175 err_ioremap:
drivers/usb/host/ehci-ps3.c
... ... @@ -189,6 +189,7 @@
189 189 goto fail_add_hcd;
190 190 }
191 191  
  192 + device_wakeup_enable(hcd->self.controller);
192 193 return result;
193 194  
194 195 fail_add_hcd:
drivers/usb/host/ehci-sead3.c
... ... @@ -126,6 +126,7 @@
126 126 IRQF_SHARED);
127 127 if (ret == 0) {
128 128 platform_set_drvdata(pdev, hcd);
  129 + device_wakeup_enable(hcd->self.controller);
129 130 return ret;
130 131 }
131 132  
drivers/usb/host/ehci-sh.c
... ... @@ -151,6 +151,7 @@
151 151 dev_err(&pdev->dev, "Failed to add hcd");
152 152 goto fail_add_hcd;
153 153 }
  154 + device_wakeup_enable(hcd->self.controller);
154 155  
155 156 priv->hcd = hcd;
156 157 platform_set_drvdata(pdev, priv);
drivers/usb/host/ehci-spear.c
... ... @@ -130,6 +130,7 @@
130 130 if (retval)
131 131 goto err_stop_ehci;
132 132  
  133 + device_wakeup_enable(hcd->self.controller);
133 134 return retval;
134 135  
135 136 err_stop_ehci:
drivers/usb/host/ehci-tegra.c
... ... @@ -455,6 +455,7 @@
455 455 dev_err(&pdev->dev, "Failed to add USB HCD\n");
456 456 goto cleanup_otg_set_host;
457 457 }
  458 + device_wakeup_enable(hcd->self.controller);
458 459  
459 460 return err;
460 461  
drivers/usb/host/ehci-tilegx.c
... ... @@ -170,6 +170,7 @@
170 170 ret = usb_add_hcd(hcd, pdata->irq, IRQF_SHARED);
171 171 if (ret == 0) {
172 172 platform_set_drvdata(pdev, hcd);
  173 + device_wakeup_enable(hcd->self.controller);
173 174 return ret;
174 175 }
175 176  
drivers/usb/host/ehci-w90x900.c
... ... @@ -94,6 +94,7 @@
94 94 if (retval != 0)
95 95 goto err4;
96 96  
  97 + device_wakeup_enable(hcd->self.controller);
97 98 return retval;
98 99 err4:
99 100 iounmap(hcd->regs);
drivers/usb/host/ehci-xilinx-of.c
... ... @@ -191,8 +191,10 @@
191 191 ehci->caps = hcd->regs + 0x100;
192 192  
193 193 rv = usb_add_hcd(hcd, irq, 0);
194   - if (rv == 0)
  194 + if (rv == 0) {
  195 + device_wakeup_enable(hcd->self.controller);
195 196 return 0;
  197 + }
196 198  
197 199 err_irq:
198 200 usb_put_hcd(hcd);
drivers/usb/host/fhci-hcd.c
... ... @@ -754,6 +754,8 @@
754 754 if (ret < 0)
755 755 goto err_add_hcd;
756 756  
  757 + device_wakeup_enable(hcd->self.controller);
  758 +
757 759 fhci_dfs_create(fhci);
758 760  
759 761 return 0;
drivers/usb/host/fotg210-hcd.c
... ... @@ -5889,6 +5889,7 @@
5889 5889 dev_err(dev, "failed to add hcd with err %d\n", retval);
5890 5890 goto fail_add_hcd;
5891 5891 }
  5892 + device_wakeup_enable(hcd->self.controller);
5892 5893  
5893 5894 return retval;
5894 5895  
drivers/usb/host/fusbh200-hcd.c
... ... @@ -5798,6 +5798,7 @@
5798 5798 dev_err(dev, "failed to add hcd with err %d\n", retval);
5799 5799 goto fail_add_hcd;
5800 5800 }
  5801 + device_wakeup_enable(hcd->self.controller);
5801 5802  
5802 5803 return retval;
5803 5804  
drivers/usb/host/hwa-hc.c
... ... @@ -791,6 +791,7 @@
791 791 dev_err(dev, "Cannot add HCD: %d\n", result);
792 792 goto error_add_hcd;
793 793 }
  794 + device_wakeup_enable(usb_hcd->self.controller);
794 795 result = wusbhc_b_create(&hwahc->wusbhc);
795 796 if (result < 0) {
796 797 dev_err(dev, "Cannot setup phase B of WUSBHC: %d\n", result);
drivers/usb/host/imx21-hcd.c
... ... @@ -1910,6 +1910,7 @@
1910 1910 dev_err(imx21->dev, "usb_add_hcd() returned %d\n", ret);
1911 1911 goto failed_add_hcd;
1912 1912 }
  1913 + device_wakeup_enable(hcd->self.controller);
1913 1914  
1914 1915 return 0;
1915 1916  
drivers/usb/host/isp116x-hcd.c
... ... @@ -1645,6 +1645,8 @@
1645 1645 if (ret)
1646 1646 goto err6;
1647 1647  
  1648 + device_wakeup_enable(hcd->self.controller);
  1649 +
1648 1650 ret = create_debug_file(isp116x);
1649 1651 if (ret) {
1650 1652 ERR("Couldn't create debugfs entry\n");
drivers/usb/host/isp1362-hcd.c
... ... @@ -2746,6 +2746,8 @@
2746 2746 retval = usb_add_hcd(hcd, irq, irq_flags | IRQF_SHARED);
2747 2747 if (retval != 0)
2748 2748 goto err6;
  2749 + device_wakeup_enable(hcd->self.controller);
  2750 +
2749 2751 pr_info("%s, irq %d\n", hcd->product_desc, irq);
2750 2752  
2751 2753 create_debug_file(isp1362_hcd);
drivers/usb/host/isp1760-hcd.c
... ... @@ -2250,6 +2250,7 @@
2250 2250 ret = usb_add_hcd(hcd, irq, irqflags);
2251 2251 if (ret)
2252 2252 goto err_unmap;
  2253 + device_wakeup_enable(hcd->self.controller);
2253 2254  
2254 2255 return hcd;
2255 2256  
drivers/usb/host/ohci-at91.c
... ... @@ -200,8 +200,10 @@
200 200 at91_start_hc(pdev);
201 201  
202 202 retval = usb_add_hcd(hcd, pdev->resource[1].start, IRQF_SHARED);
203   - if (retval == 0)
  203 + if (retval == 0) {
  204 + device_wakeup_enable(hcd->self.controller);
204 205 return retval;
  206 + }
205 207  
206 208 /* Error handling */
207 209 at91_stop_hc(pdev);
drivers/usb/host/ohci-da8xx.c
... ... @@ -348,6 +348,8 @@
348 348 if (error)
349 349 goto err4;
350 350  
  351 + device_wakeup_enable(hcd->self.controller);
  352 +
351 353 if (hub->ocic_notify) {
352 354 error = hub->ocic_notify(ohci_da8xx_ocic_handler);
353 355 if (!error)
drivers/usb/host/ohci-exynos.c
... ... @@ -146,6 +146,7 @@
146 146 dev_err(&pdev->dev, "Failed to add USB HCD\n");
147 147 goto fail_add_hcd;
148 148 }
  149 + device_wakeup_enable(hcd->self.controller);
149 150 return 0;
150 151  
151 152 fail_add_hcd:
drivers/usb/host/ohci-jz4740.c
... ... @@ -217,6 +217,7 @@
217 217 dev_err(&pdev->dev, "Failed to add hcd: %d\n", ret);
218 218 goto err_disable;
219 219 }
  220 + device_wakeup_enable(hcd->self.controller);
220 221  
221 222 return 0;
222 223  
drivers/usb/host/ohci-nxp.c
... ... @@ -274,8 +274,10 @@
274 274  
275 275 dev_info(&pdev->dev, "at 0x%p, irq %d\n", hcd->regs, hcd->irq);
276 276 ret = usb_add_hcd(hcd, irq, 0);
277   - if (ret == 0)
  277 + if (ret == 0) {
  278 + device_wakeup_enable(hcd->self.controller);
278 279 return ret;
  280 + }
279 281  
280 282 ohci_nxp_stop_hc();
281 283 fail_resource:
drivers/usb/host/ohci-octeon.c
... ... @@ -171,6 +171,8 @@
171 171 goto err3;
172 172 }
173 173  
  174 + device_wakeup_enable(hcd->self.controller);
  175 +
174 176 platform_set_drvdata(pdev, hcd);
175 177  
176 178 return 0;
drivers/usb/host/ohci-omap.c
... ... @@ -367,6 +367,7 @@
367 367 if (retval)
368 368 goto err3;
369 369  
  370 + device_wakeup_enable(hcd->self.controller);
370 371 return 0;
371 372 err3:
372 373 iounmap(hcd->regs);
drivers/usb/host/ohci-omap3.c
... ... @@ -130,6 +130,7 @@
130 130 dev_dbg(dev, "failed to add hcd with err %d\n", ret);
131 131 goto err_add_hcd;
132 132 }
  133 + device_wakeup_enable(hcd->self.controller);
133 134  
134 135 return 0;
135 136  
drivers/usb/host/ohci-platform.c
... ... @@ -108,6 +108,8 @@
108 108 if (err)
109 109 goto err_put_hcd;
110 110  
  111 + device_wakeup_enable(hcd->self.controller);
  112 +
111 113 platform_set_drvdata(dev, hcd);
112 114  
113 115 return err;
drivers/usb/host/ohci-ppc-of.c
... ... @@ -147,8 +147,10 @@
147 147 ohci_hcd_init(ohci);
148 148  
149 149 rv = usb_add_hcd(hcd, irq, 0);
150   - if (rv == 0)
  150 + if (rv == 0) {
  151 + device_wakeup_enable(hcd->self.controller);
151 152 return 0;
  153 + }
152 154  
153 155 /* by now, 440epx is known to show usb_23 erratum */
154 156 np = of_find_compatible_node(NULL, NULL, "ibm,usb-ehci-440epx");
drivers/usb/host/ohci-ps3.c
... ... @@ -173,6 +173,7 @@
173 173 goto fail_add_hcd;
174 174 }
175 175  
  176 + device_wakeup_enable(hcd->self.controller);
176 177 return result;
177 178  
178 179 fail_add_hcd:
drivers/usb/host/ohci-pxa27x.c
... ... @@ -442,8 +442,10 @@
442 442 ohci->num_ports = 3;
443 443  
444 444 retval = usb_add_hcd(hcd, irq, 0);
445   - if (retval == 0)
  445 + if (retval == 0) {
  446 + device_wakeup_enable(hcd->self.controller);
446 447 return retval;
  448 + }
447 449  
448 450 pxa27x_stop_hc(pxa_ohci, &pdev->dev);
449 451 err3:
drivers/usb/host/ohci-s3c2410.c
... ... @@ -395,6 +395,7 @@
395 395 if (retval != 0)
396 396 goto err_ioremap;
397 397  
  398 + device_wakeup_enable(hcd->self.controller);
398 399 return 0;
399 400  
400 401 err_ioremap:
drivers/usb/host/ohci-sa1111.c
... ... @@ -211,8 +211,10 @@
211 211 goto err2;
212 212  
213 213 ret = usb_add_hcd(hcd, dev->irq[1], 0);
214   - if (ret == 0)
  214 + if (ret == 0) {
  215 + device_wakeup_enable(hcd->self.controller);
215 216 return ret;
  217 + }
216 218  
217 219 sa1111_stop_hc(dev);
218 220 err2:
drivers/usb/host/ohci-sm501.c
... ... @@ -168,6 +168,7 @@
168 168 retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
169 169 if (retval)
170 170 goto err5;
  171 + device_wakeup_enable(hcd->self.controller);
171 172  
172 173 /* enable power and unmask interrupts */
173 174  
drivers/usb/host/ohci-spear.c
... ... @@ -103,8 +103,10 @@
103 103 ohci = hcd_to_ohci(hcd);
104 104  
105 105 retval = usb_add_hcd(hcd, platform_get_irq(pdev, 0), 0);
106   - if (retval == 0)
  106 + if (retval == 0) {
  107 + device_wakeup_enable(hcd->self.controller);
107 108 return retval;
  109 + }
108 110  
109 111 clk_disable_unprepare(sohci_p->clk);
110 112 err_put_hcd:
drivers/usb/host/ohci-tilegx.c
... ... @@ -159,6 +159,7 @@
159 159 ret = usb_add_hcd(hcd, pdata->irq, IRQF_SHARED);
160 160 if (ret == 0) {
161 161 platform_set_drvdata(pdev, hcd);
  162 + device_wakeup_enable(hcd->self.controller);
162 163 return ret;
163 164 }
164 165  
drivers/usb/host/ohci-tmio.c
... ... @@ -250,6 +250,7 @@
250 250 if (ret)
251 251 goto err_add_hcd;
252 252  
  253 + device_wakeup_enable(hcd->self.controller);
253 254 if (ret == 0)
254 255 return ret;
255 256  
drivers/usb/host/oxu210hp-hcd.c
... ... @@ -3751,6 +3751,7 @@
3751 3751 if (ret < 0)
3752 3752 return ERR_PTR(ret);
3753 3753  
  3754 + device_wakeup_enable(hcd->self.controller);
3754 3755 return hcd;
3755 3756 }
3756 3757  
drivers/usb/host/r8a66597-hcd.c
... ... @@ -2514,6 +2514,7 @@
2514 2514 dev_err(&pdev->dev, "Failed to add hcd\n");
2515 2515 goto clean_up3;
2516 2516 }
  2517 + device_wakeup_enable(hcd->self.controller);
2517 2518  
2518 2519 return 0;
2519 2520  
drivers/usb/host/sl811-hcd.c
... ... @@ -1732,6 +1732,8 @@
1732 1732 if (retval != 0)
1733 1733 goto err6;
1734 1734  
  1735 + device_wakeup_enable(hcd->self.controller);
  1736 +
1735 1737 create_debug_file(sl811);
1736 1738 return retval;
1737 1739  
drivers/usb/host/u132-hcd.c
... ... @@ -3133,6 +3133,7 @@
3133 3133 u132_u132_put_kref(u132);
3134 3134 return retval;
3135 3135 } else {
  3136 + device_wakeup_enable(hcd->self.controller);
3136 3137 u132_monitor_queue_work(u132, 100);
3137 3138 return 0;
3138 3139 }
drivers/usb/host/uhci-grlib.c
... ... @@ -141,6 +141,7 @@
141 141 if (rv)
142 142 goto err_uhci;
143 143  
  144 + device_wakeup_enable(hcd->self.controller);
144 145 return 0;
145 146  
146 147 err_uhci:
drivers/usb/host/uhci-platform.c
... ... @@ -108,6 +108,7 @@
108 108 if (ret)
109 109 goto err_uhci;
110 110  
  111 + device_wakeup_enable(hcd->self.controller);
111 112 return 0;
112 113  
113 114 err_uhci:
drivers/usb/host/whci/hcd.c
... ... @@ -293,6 +293,7 @@
293 293 dev_err(dev, "cannot add HCD: %d\n", ret);
294 294 goto error_usb_add_hcd;
295 295 }
  296 + device_wakeup_enable(usb_hcd->self.controller);
296 297  
297 298 ret = wusbhc_b_create(wusbhc);
298 299 if (ret) {
drivers/usb/host/xhci-plat.c
... ... @@ -139,6 +139,7 @@
139 139 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
140 140 if (ret)
141 141 goto unmap_registers;
  142 + device_wakeup_enable(hcd->self.controller);
142 143  
143 144 /* USB 2.0 roothub is stored in the platform_device now. */
144 145 hcd = platform_get_drvdata(pdev);
drivers/usb/musb/musb_host.c
... ... @@ -2657,6 +2657,7 @@
2657 2657 if (ret < 0)
2658 2658 return ret;
2659 2659  
  2660 + device_wakeup_enable(hcd->self.controller);
2660 2661 return 0;
2661 2662 }
2662 2663  
drivers/usb/phy/phy-msm-usb.c
... ... @@ -669,6 +669,7 @@
669 669 pdata->setup_gpio(OTG_STATE_A_HOST);
670 670 #ifdef CONFIG_USB
671 671 usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
  672 + device_wakeup_enable(hcd->self.controller);
672 673 #endif
673 674 } else {
674 675 dev_dbg(phy->dev, "host off\n");
drivers/usb/phy/phy-mv-usb.c
... ... @@ -213,10 +213,12 @@
213 213  
214 214 hcd = bus_to_hcd(otg->host);
215 215  
216   - if (on)
  216 + if (on) {
217 217 usb_add_hcd(hcd, hcd->irq, IRQF_SHARED);
218   - else
  218 + device_wakeup_enable(hcd->self.controller);
  219 + } else {
219 220 usb_remove_hcd(hcd);
  221 + }
220 222 #endif /* CONFIG_USB */
221 223 }
222 224  
drivers/usb/renesas_usbhs/mod_host.c
... ... @@ -1469,6 +1469,7 @@
1469 1469 ret = usb_add_hcd(hcd, 0, 0);
1470 1470 if (ret < 0)
1471 1471 return 0;
  1472 + device_wakeup_enable(hcd->self.controller);
1472 1473  
1473 1474 /*
1474 1475 * pipe initialize and enable DCP