aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2012-10-08 09:11:29 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-22 14:23:59 -0400
commitcfa49b4b88fe14d2b5792f2ea7ba5b88c8cd1d15 (patch)
tree5a689a1365b7b0844421ec5a18a3a9af4d28c323 /drivers/usb
parentd4ae47dc5670efecd2214110caf33dfc0ff7191f (diff)
USB: ohci: merge ohci_finish_controller_resume with ohci_resume
Merge ohci_finish_controller_resume with ohci_resume as suggested by Alan Stern. Since ohci_finish_controller_resume no longer exists, update the various OHCI drivers to call ohci_resume() instead. Some drivers used to set themselves the bit HCD_FLAG_HW_ACCESSIBLE, which is now handled by ohci_resume(). Acked-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Signed-off-by: Florian Fainelli <florian@openwrt.org> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ohci-at91.c2
-rw-r--r--drivers/usb/host/ohci-ep93xx.c2
-rw-r--r--drivers/usb/host/ohci-exynos.c5
-rw-r--r--drivers/usb/host/ohci-hcd.c41
-rw-r--r--drivers/usb/host/ohci-hub.c42
-rw-r--r--drivers/usb/host/ohci-omap.c2
-rw-r--r--drivers/usb/host/ohci-platform.c2
-rw-r--r--drivers/usb/host/ohci-pxa27x.c2
-rw-r--r--drivers/usb/host/ohci-s3c2410.c3
-rw-r--r--drivers/usb/host/ohci-spear.c2
-rw-r--r--drivers/usb/host/ohci-tmio.c2
11 files changed, 48 insertions, 57 deletions
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 0bf72f943b00..908d84af1dd7 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -705,7 +705,7 @@ static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
705 if (!clocked) 705 if (!clocked)
706 at91_start_clock(); 706 at91_start_clock();
707 707
708 ohci_finish_controller_resume(hcd); 708 ohci_resume(hcd, false);
709 return 0; 709 return 0;
710} 710}
711#else 711#else
diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c
index dbfbd1dfd2e2..a982f04ed787 100644
--- a/drivers/usb/host/ohci-ep93xx.c
+++ b/drivers/usb/host/ohci-ep93xx.c
@@ -194,7 +194,7 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev)
194 194
195 ep93xx_start_hc(&pdev->dev); 195 ep93xx_start_hc(&pdev->dev);
196 196
197 ohci_finish_controller_resume(hcd); 197 ohci_resume(hcd, false);
198 return 0; 198 return 0;
199} 199}
200#endif 200#endif
diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c
index 20a50081f922..929a49437e2e 100644
--- a/drivers/usb/host/ohci-exynos.c
+++ b/drivers/usb/host/ohci-exynos.c
@@ -252,10 +252,7 @@ static int exynos_ohci_resume(struct device *dev)
252 if (pdata && pdata->phy_init) 252 if (pdata && pdata->phy_init)
253 pdata->phy_init(pdev, S5P_USB_PHY_HOST); 253 pdata->phy_init(pdev, S5P_USB_PHY_HOST);
254 254
255 /* Mark hardware accessible again as we are out of D3 state by now */ 255 ohci_resume(hcd, false);
256 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
257
258 ohci_finish_controller_resume(hcd);
259 256
260 return 0; 257 return 0;
261} 258}
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 76663295e1c7..bac662636969 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1035,13 +1035,50 @@ static int __maybe_unused ohci_suspend(struct usb_hcd *hcd, bool do_wakeup)
1035 1035
1036static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated) 1036static int __maybe_unused ohci_resume(struct usb_hcd *hcd, bool hibernated)
1037{ 1037{
1038 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
1039 int port;
1040 bool need_reinit = false;
1041
1038 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 1042 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
1039 1043
1040 /* Make sure resume from hibernation re-enumerates everything */ 1044 /* Make sure resume from hibernation re-enumerates everything */
1041 if (hibernated) 1045 if (hibernated)
1042 ohci_usb_reset(hcd_to_ohci(hcd)); 1046 ohci_usb_reset(ohci);
1047
1048 /* See if the controller is already running or has been reset */
1049 ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
1050 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
1051 need_reinit = true;
1052 } else {
1053 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
1054 case OHCI_USB_OPER:
1055 case OHCI_USB_RESET:
1056 need_reinit = true;
1057 }
1058 }
1059
1060 /* If needed, reinitialize and suspend the root hub */
1061 if (need_reinit) {
1062 spin_lock_irq(&ohci->lock);
1063 ohci_rh_resume(ohci);
1064 ohci_rh_suspend(ohci, 0);
1065 spin_unlock_irq(&ohci->lock);
1066 }
1067
1068 /* Normally just turn on port power and enable interrupts */
1069 else {
1070 ohci_dbg(ohci, "powerup ports\n");
1071 for (port = 0; port < ohci->num_ports; port++)
1072 ohci_writel(ohci, RH_PS_PPS,
1073 &ohci->regs->roothub.portstatus[port]);
1074
1075 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
1076 ohci_readl(ohci, &ohci->regs->intrenable);
1077 msleep(20);
1078 }
1079
1080 usb_hcd_resume_root_hub(hcd);
1043 1081
1044 ohci_finish_controller_resume(hcd);
1045 return 0; 1082 return 0;
1046} 1083}
1047 1084
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 2f3619eefefa..db09dae7b557 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -316,48 +316,6 @@ static int ohci_bus_resume (struct usb_hcd *hcd)
316 return rc; 316 return rc;
317} 317}
318 318
319/* Carry out the final steps of resuming the controller device */
320static void __maybe_unused ohci_finish_controller_resume(struct usb_hcd *hcd)
321{
322 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
323 int port;
324 bool need_reinit = false;
325
326 /* See if the controller is already running or has been reset */
327 ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
328 if (ohci->hc_control & (OHCI_CTRL_IR | OHCI_SCHED_ENABLES)) {
329 need_reinit = true;
330 } else {
331 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
332 case OHCI_USB_OPER:
333 case OHCI_USB_RESET:
334 need_reinit = true;
335 }
336 }
337
338 /* If needed, reinitialize and suspend the root hub */
339 if (need_reinit) {
340 spin_lock_irq(&ohci->lock);
341 ohci_rh_resume(ohci);
342 ohci_rh_suspend(ohci, 0);
343 spin_unlock_irq(&ohci->lock);
344 }
345
346 /* Normally just turn on port power and enable interrupts */
347 else {
348 ohci_dbg(ohci, "powerup ports\n");
349 for (port = 0; port < ohci->num_ports; port++)
350 ohci_writel(ohci, RH_PS_PPS,
351 &ohci->regs->roothub.portstatus[port]);
352
353 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable);
354 ohci_readl(ohci, &ohci->regs->intrenable);
355 msleep(20);
356 }
357
358 usb_hcd_resume_root_hub(hcd);
359}
360
361/* Carry out polling-, autostop-, and autoresume-related state changes */ 319/* Carry out polling-, autostop-, and autoresume-related state changes */
362static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, 320static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
363 int any_connected, int rhsc_status) 321 int any_connected, int rhsc_status)
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 4531d03503c3..733c77c36355 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -530,7 +530,7 @@ static int ohci_omap_resume(struct platform_device *dev)
530 ohci->next_statechange = jiffies; 530 ohci->next_statechange = jiffies;
531 531
532 omap_ohci_clock_power(1); 532 omap_ohci_clock_power(1);
533 ohci_finish_controller_resume(hcd); 533 ohci_resume(hcd, false);
534 return 0; 534 return 0;
535} 535}
536 536
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 1caaf657c5ea..99d17552d809 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -203,7 +203,7 @@ static int ohci_platform_resume(struct device *dev)
203 return err; 203 return err;
204 } 204 }
205 205
206 ohci_finish_controller_resume(hcd); 206 ohci_resume(hcd, false);
207 return 0; 207 return 0;
208} 208}
209 209
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 2bf11440b010..156d289d3bb5 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -591,7 +591,7 @@ static int ohci_hcd_pxa27x_drv_resume(struct device *dev)
591 /* Select Power Management Mode */ 591 /* Select Power Management Mode */
592 pxa27x_ohci_select_pmm(ohci, inf->port_mode); 592 pxa27x_ohci_select_pmm(ohci, inf->port_mode);
593 593
594 ohci_finish_controller_resume(hcd); 594 ohci_resume(hcd, false);
595 return 0; 595 return 0;
596} 596}
597 597
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c
index 0d2309ca471e..281d5c658e36 100644
--- a/drivers/usb/host/ohci-s3c2410.c
+++ b/drivers/usb/host/ohci-s3c2410.c
@@ -524,8 +524,7 @@ static int ohci_hcd_s3c2410_drv_resume(struct device *dev)
524 524
525 s3c2410_start_hc(pdev, hcd); 525 s3c2410_start_hc(pdev, hcd);
526 526
527 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 527 ohci_resume(hcd, false);
528 ohci_finish_controller_resume(hcd);
529 528
530 return 0; 529 return 0;
531} 530}
diff --git a/drivers/usb/host/ohci-spear.c b/drivers/usb/host/ohci-spear.c
index fc7305ee3c9c..d607be33c03c 100644
--- a/drivers/usb/host/ohci-spear.c
+++ b/drivers/usb/host/ohci-spear.c
@@ -231,7 +231,7 @@ static int spear_ohci_hcd_drv_resume(struct platform_device *dev)
231 ohci->next_statechange = jiffies; 231 ohci->next_statechange = jiffies;
232 232
233 spear_start_ohci(ohci_p); 233 spear_start_ohci(ohci_p);
234 ohci_finish_controller_resume(hcd); 234 ohci_resume(hcd, false);
235 return 0; 235 return 0;
236} 236}
237#endif 237#endif
diff --git a/drivers/usb/host/ohci-tmio.c b/drivers/usb/host/ohci-tmio.c
index 60c2b0722f2e..2c9ab8f126d4 100644
--- a/drivers/usb/host/ohci-tmio.c
+++ b/drivers/usb/host/ohci-tmio.c
@@ -352,7 +352,7 @@ static int ohci_hcd_tmio_drv_resume(struct platform_device *dev)
352 352
353 spin_unlock_irqrestore(&tmio->lock, flags); 353 spin_unlock_irqrestore(&tmio->lock, flags);
354 354
355 ohci_finish_controller_resume(hcd); 355 ohci_resume(hcd, false);
356 356
357 return 0; 357 return 0;
358} 358}