aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2012-10-31 13:21:06 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-31 15:48:07 -0400
commitc73cee717e7d5da0698acb720ad1219646fe4f46 (patch)
tree7905e61101886695d291e39c7c2ee4042e2e6f70 /drivers/usb/host
parent4968f951913997adc8c68c4e986e8168ee1d2998 (diff)
USB: EHCI: remove ehci_port_power() routine
This patch (as1623) removes the ehci_port_power() routine and all the places that call it. There's no reason for ehci-hcd to change the port power settings; the hub driver takes care of all that stuff. There is one exception: When the controller is resumed from hibernation or following a loss of power, the ports that are supposed to be handed over to a companion controller must be powered on first. Otherwise the handover won't work. This process is not visible to the hub driver, so it has to be handled in ehci-hcd. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-atmel.c9
-rw-r--r--drivers/usb/host/ehci-fsl.c1
-rw-r--r--drivers/usb/host/ehci-grlib.c18
-rw-r--r--drivers/usb/host/ehci-hcd.c21
-rw-r--r--drivers/usb/host/ehci-hub.c13
-rw-r--r--drivers/usb/host/ehci-msm.c1
-rw-r--r--drivers/usb/host/ehci-mxc.c8
-rw-r--r--drivers/usb/host/ehci-octeon.c3
-rw-r--r--drivers/usb/host/ehci-omap.c3
-rw-r--r--drivers/usb/host/ehci-orion.c16
-rw-r--r--drivers/usb/host/ehci-pci.c1
-rw-r--r--drivers/usb/host/ehci-platform.c5
-rw-r--r--drivers/usb/host/ehci-pmcmsp.c1
-rw-r--r--drivers/usb/host/ehci-sh.c9
-rw-r--r--drivers/usb/host/ehci-spear.c9
-rw-r--r--drivers/usb/host/ehci-tegra.c8
16 files changed, 20 insertions, 106 deletions
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 411bb74152eb..d23321ec0e46 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -53,18 +53,11 @@ static void atmel_stop_ehci(struct platform_device *pdev)
53static int ehci_atmel_setup(struct usb_hcd *hcd) 53static int ehci_atmel_setup(struct usb_hcd *hcd)
54{ 54{
55 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 55 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
56 int retval;
57 56
58 /* registers start at offset 0x0 */ 57 /* registers start at offset 0x0 */
59 ehci->caps = hcd->regs; 58 ehci->caps = hcd->regs;
60 59
61 retval = ehci_setup(hcd); 60 return ehci_setup(hcd);
62 if (retval)
63 return retval;
64
65 ehci_port_power(ehci, 0);
66
67 return retval;
68} 61}
69 62
70static const struct hc_driver ehci_atmel_hc_driver = { 63static const struct hc_driver ehci_atmel_hc_driver = {
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index 0d2f35ca93f1..fd9b5424b860 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -349,7 +349,6 @@ static int ehci_fsl_reinit(struct ehci_hcd *ehci)
349{ 349{
350 if (ehci_fsl_usb_setup(ehci)) 350 if (ehci_fsl_usb_setup(ehci))
351 return -EINVAL; 351 return -EINVAL;
352 ehci_port_power(ehci, 0);
353 352
354 return 0; 353 return 0;
355} 354}
diff --git a/drivers/usb/host/ehci-grlib.c b/drivers/usb/host/ehci-grlib.c
index 3180cb3624d9..da4269550fba 100644
--- a/drivers/usb/host/ehci-grlib.c
+++ b/drivers/usb/host/ehci-grlib.c
@@ -34,22 +34,6 @@
34 34
35#define GRUSBHC_HCIVERSION 0x0100 /* Known value of cap. reg. HCIVERSION */ 35#define GRUSBHC_HCIVERSION 0x0100 /* Known value of cap. reg. HCIVERSION */
36 36
37/* called during probe() after chip reset completes */
38static int ehci_grlib_setup(struct usb_hcd *hcd)
39{
40 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
41 int retval;
42
43 retval = ehci_setup(hcd);
44 if (retval)
45 return retval;
46
47 ehci_port_power(ehci, 1);
48
49 return retval;
50}
51
52
53static const struct hc_driver ehci_grlib_hc_driver = { 37static const struct hc_driver ehci_grlib_hc_driver = {
54 .description = hcd_name, 38 .description = hcd_name,
55 .product_desc = "GRLIB GRUSBHC EHCI", 39 .product_desc = "GRLIB GRUSBHC EHCI",
@@ -64,7 +48,7 @@ static const struct hc_driver ehci_grlib_hc_driver = {
64 /* 48 /*
65 * basic lifecycle operations 49 * basic lifecycle operations
66 */ 50 */
67 .reset = ehci_grlib_setup, 51 .reset = ehci_setup,
68 .start = ehci_run, 52 .start = ehci_run,
69 .stop = ehci_stop, 53 .stop = ehci_stop,
70 .shutdown = ehci_shutdown, 54 .shutdown = ehci_shutdown,
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 68dd1c99b1f5..ab4a769a4104 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -371,24 +371,6 @@ static void ehci_shutdown(struct usb_hcd *hcd)
371 hrtimer_cancel(&ehci->hrtimer); 371 hrtimer_cancel(&ehci->hrtimer);
372} 372}
373 373
374static void ehci_port_power (struct ehci_hcd *ehci, int is_on)
375{
376 unsigned port;
377
378 if (!HCS_PPC (ehci->hcs_params))
379 return;
380
381 ehci_dbg (ehci, "...power%s ports...\n", is_on ? "up" : "down");
382 for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; )
383 (void) ehci_hub_control(ehci_to_hcd(ehci),
384 is_on ? SetPortFeature : ClearPortFeature,
385 USB_PORT_FEAT_POWER,
386 port--, NULL, 0);
387 /* Flush those writes */
388 ehci_readl(ehci, &ehci->regs->command);
389 msleep(20);
390}
391
392/*-------------------------------------------------------------------------*/ 374/*-------------------------------------------------------------------------*/
393 375
394/* 376/*
@@ -1184,9 +1166,6 @@ static int __maybe_unused ehci_resume(struct usb_hcd *hcd, bool hibernated)
1184 ehci->rh_state = EHCI_RH_SUSPENDED; 1166 ehci->rh_state = EHCI_RH_SUSPENDED;
1185 spin_unlock_irq(&ehci->lock); 1167 spin_unlock_irq(&ehci->lock);
1186 1168
1187 /* here we "know" root ports should always stay powered */
1188 ehci_port_power(ehci, 1);
1189
1190 return 1; 1169 return 1;
1191} 1170}
1192 1171
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index a2c56cdd2c3a..a59c61fea09f 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -56,6 +56,19 @@ static void ehci_handover_companion_ports(struct ehci_hcd *ehci)
56 if (!ehci->owned_ports) 56 if (!ehci->owned_ports)
57 return; 57 return;
58 58
59 /* Make sure the ports are powered */
60 port = HCS_N_PORTS(ehci->hcs_params);
61 while (port--) {
62 if (test_bit(port, &ehci->owned_ports)) {
63 reg = &ehci->regs->port_status[port];
64 status = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
65 if (!(status & PORT_POWER)) {
66 status |= PORT_POWER;
67 ehci_writel(ehci, status, reg);
68 }
69 }
70 }
71
59 /* Give the connections some time to appear */ 72 /* Give the connections some time to appear */
60 msleep(20); 73 msleep(20);
61 74
diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 4af4dc5b618c..7fa1ba4de789 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -53,7 +53,6 @@ static int ehci_msm_reset(struct usb_hcd *hcd)
53 /* Disable streaming mode and select host mode */ 53 /* Disable streaming mode and select host mode */
54 writel(0x13, USB_USBMODE); 54 writel(0x13, USB_USBMODE);
55 55
56 ehci_port_power(ehci, 1);
57 return 0; 56 return 0;
58} 57}
59 58
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index 4a08fc0b27c9..a37224a4a49b 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -40,16 +40,10 @@ struct ehci_mxc_priv {
40static int ehci_mxc_setup(struct usb_hcd *hcd) 40static int ehci_mxc_setup(struct usb_hcd *hcd)
41{ 41{
42 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 42 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
43 int retval;
44 43
45 hcd->has_tt = 1; 44 hcd->has_tt = 1;
46 45
47 retval = ehci_setup(hcd); 46 return ehci_setup(hcd);
48 if (retval)
49 return retval;
50
51 ehci_port_power(ehci, 0);
52 return 0;
53} 47}
54 48
55static const struct hc_driver ehci_mxc_hc_driver = { 49static const struct hc_driver ehci_mxc_hc_driver = {
diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c
index ba26957abf46..a89750fff4ff 100644
--- a/drivers/usb/host/ehci-octeon.c
+++ b/drivers/usb/host/ehci-octeon.c
@@ -159,9 +159,6 @@ static int ehci_octeon_drv_probe(struct platform_device *pdev)
159 159
160 platform_set_drvdata(pdev, hcd); 160 platform_set_drvdata(pdev, hcd);
161 161
162 /* root ports should always stay powered */
163 ehci_port_power(ehci, 1);
164
165 return 0; 162 return 0;
166err3: 163err3:
167 ehci_octeon_stop(); 164 ehci_octeon_stop();
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index d7fe287d0678..44e7d0f638e8 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -146,9 +146,6 @@ static int omap_ehci_init(struct usb_hcd *hcd)
146 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1); 146 gpio_set_value_cansleep(pdata->reset_gpio_port[1], 1);
147 } 147 }
148 148
149 /* root ports should always stay powered */
150 ehci_port_power(ehci, 1);
151
152 return rc; 149 return rc;
153} 150}
154 151
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c
index 9c2717d66730..96da679becef 100644
--- a/drivers/usb/host/ehci-orion.c
+++ b/drivers/usb/host/ehci-orion.c
@@ -101,20 +101,6 @@ static void orion_usb_phy_v1_setup(struct usb_hcd *hcd)
101 wrl(USB_MODE, 0x13); 101 wrl(USB_MODE, 0x13);
102} 102}
103 103
104static int ehci_orion_setup(struct usb_hcd *hcd)
105{
106 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
107 int retval;
108
109 retval = ehci_setup(hcd);
110 if (retval)
111 return retval;
112
113 ehci_port_power(ehci, 0);
114
115 return retval;
116}
117
118static const struct hc_driver ehci_orion_hc_driver = { 104static const struct hc_driver ehci_orion_hc_driver = {
119 .description = hcd_name, 105 .description = hcd_name,
120 .product_desc = "Marvell Orion EHCI", 106 .product_desc = "Marvell Orion EHCI",
@@ -129,7 +115,7 @@ static const struct hc_driver ehci_orion_hc_driver = {
129 /* 115 /*
130 * basic lifecycle operations 116 * basic lifecycle operations
131 */ 117 */
132 .reset = ehci_orion_setup, 118 .reset = ehci_setup,
133 .start = ehci_run, 119 .start = ehci_run,
134 .stop = ehci_stop, 120 .stop = ehci_stop,
135 .shutdown = ehci_shutdown, 121 .shutdown = ehci_shutdown,
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index e17330ae0aee..c92dcaee0d4d 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -297,7 +297,6 @@ static int ehci_pci_setup(struct usb_hcd *hcd)
297 ehci_warn(ehci, "selective suspend/wakeup unavailable\n"); 297 ehci_warn(ehci, "selective suspend/wakeup unavailable\n");
298#endif 298#endif
299 299
300 ehci_port_power(ehci, 1);
301 retval = ehci_pci_reinit(ehci, pdev); 300 retval = ehci_pci_reinit(ehci, pdev);
302done: 301done:
303 return retval; 302 return retval;
diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c
index 272728c48c9e..6e6c23bdb484 100644
--- a/drivers/usb/host/ehci-platform.c
+++ b/drivers/usb/host/ehci-platform.c
@@ -40,11 +40,6 @@ static int ehci_platform_reset(struct usb_hcd *hcd)
40 40
41 if (pdata->no_io_watchdog) 41 if (pdata->no_io_watchdog)
42 ehci->need_io_watchdog = 0; 42 ehci->need_io_watchdog = 0;
43 if (pdata->port_power_on)
44 ehci_port_power(ehci, 1);
45 if (pdata->port_power_off)
46 ehci_port_power(ehci, 0);
47
48 return 0; 43 return 0;
49} 44}
50 45
diff --git a/drivers/usb/host/ehci-pmcmsp.c b/drivers/usb/host/ehci-pmcmsp.c
index 087aee2a904f..363890ee41d2 100644
--- a/drivers/usb/host/ehci-pmcmsp.c
+++ b/drivers/usb/host/ehci-pmcmsp.c
@@ -90,7 +90,6 @@ static int ehci_msp_setup(struct usb_hcd *hcd)
90 return retval; 90 return retval;
91 91
92 usb_hcd_tdi_set_mode(ehci); 92 usb_hcd_tdi_set_mode(ehci);
93 ehci_port_power(ehci, 0);
94 93
95 return retval; 94 return retval;
96} 95}
diff --git a/drivers/usb/host/ehci-sh.c b/drivers/usb/host/ehci-sh.c
index 6081e1ed3ac9..0c90a24fa989 100644
--- a/drivers/usb/host/ehci-sh.c
+++ b/drivers/usb/host/ehci-sh.c
@@ -21,17 +21,10 @@ struct ehci_sh_priv {
21static int ehci_sh_reset(struct usb_hcd *hcd) 21static int ehci_sh_reset(struct usb_hcd *hcd)
22{ 22{
23 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 23 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
24 int ret;
25 24
26 ehci->caps = hcd->regs; 25 ehci->caps = hcd->regs;
27 26
28 ret = ehci_setup(hcd); 27 return ehci_setup(hcd);
29 if (unlikely(ret))
30 return ret;
31
32 ehci_port_power(ehci, 0);
33
34 return ret;
35} 28}
36 29
37static const struct hc_driver ehci_sh_hc_driver = { 30static const struct hc_driver ehci_sh_hc_driver = {
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index c718a065e154..719ca48a471a 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -37,18 +37,11 @@ static void spear_stop_ehci(struct spear_ehci *ehci)
37static int ehci_spear_setup(struct usb_hcd *hcd) 37static int ehci_spear_setup(struct usb_hcd *hcd)
38{ 38{
39 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 39 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
40 int retval = 0;
41 40
42 /* registers start at offset 0x0 */ 41 /* registers start at offset 0x0 */
43 ehci->caps = hcd->regs; 42 ehci->caps = hcd->regs;
44 43
45 retval = ehci_setup(hcd); 44 return ehci_setup(hcd);
46 if (retval)
47 return retval;
48
49 ehci_port_power(ehci, 0);
50
51 return retval;
52} 45}
53 46
54static const struct hc_driver ehci_spear_hc_driver = { 47static const struct hc_driver ehci_spear_hc_driver = {
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 2de089001ae9..94ee3212094e 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -280,7 +280,6 @@ static void tegra_ehci_shutdown(struct usb_hcd *hcd)
280static int tegra_ehci_setup(struct usb_hcd *hcd) 280static int tegra_ehci_setup(struct usb_hcd *hcd)
281{ 281{
282 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 282 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
283 int retval;
284 283
285 /* EHCI registers start at offset 0x100 */ 284 /* EHCI registers start at offset 0x100 */
286 ehci->caps = hcd->regs + 0x100; 285 ehci->caps = hcd->regs + 0x100;
@@ -288,12 +287,7 @@ static int tegra_ehci_setup(struct usb_hcd *hcd)
288 /* switch to host mode */ 287 /* switch to host mode */
289 hcd->has_tt = 1; 288 hcd->has_tt = 1;
290 289
291 retval = ehci_setup(hcd); 290 return ehci_setup(hcd);
292 if (retval)
293 return retval;
294
295 ehci_port_power(ehci, 1);
296 return retval;
297} 291}
298 292
299struct dma_aligned_buffer { 293struct dma_aligned_buffer {