aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2005-11-23 18:45:42 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-24 02:04:28 -0500
commit21b1861fb2ba5b25b32c63bc540bbc7ca1d186f8 (patch)
treebb99e3e7d2ff715d9dbee2db6b3c229d75c2365b /drivers/usb
parent188075211cc75a31190de4a19a084e3d83ee1c89 (diff)
[PATCH] USB: ohci, move ppc asic tweaks nearer pci
This should fix a suspend/resume issues that appear with OHCI on some PPC hardware. The PCI layer should doesn't have the hooks needed for such ASIC-specific hooks (in this case, software clock gating), so this moves the code to do that into hcd-pci.c ... where it can be done after the relevant PCI PM state transition (to/from D3). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/hcd-pci.c38
-rw-r--r--drivers/usb/host/ohci-pci.c36
2 files changed, 36 insertions, 38 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 7feb829362d6..5131d88e8c5b 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -20,9 +20,17 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <linux/usb.h>
24
23#include <asm/io.h> 25#include <asm/io.h>
24#include <asm/irq.h> 26#include <asm/irq.h>
25#include <linux/usb.h> 27
28#ifdef CONFIG_PPC_PMAC
29#include <asm/machdep.h>
30#include <asm/pmac_feature.h>
31#include <asm/pci-bridge.h>
32#include <asm/prom.h>
33#endif
26 34
27#include "usb.h" 35#include "usb.h"
28#include "hcd.h" 36#include "hcd.h"
@@ -277,8 +285,22 @@ int usb_hcd_pci_suspend (struct pci_dev *dev, pm_message_t message)
277 } 285 }
278 286
279done: 287done:
280 if (retval == 0) 288 if (retval == 0) {
281 dev->dev.power.power_state = PMSG_SUSPEND; 289 dev->dev.power.power_state = PMSG_SUSPEND;
290
291#ifdef CONFIG_PPC_PMAC
292 /* Disable ASIC clocks for USB */
293 if (_machine == _MACH_Pmac) {
294 struct device_node *of_node;
295
296 of_node = pci_device_to_OF_node (dev);
297 if (of_node)
298 pmac_call_feature(PMAC_FTR_USB_ENABLE,
299 of_node, 0, 0);
300 }
301#endif
302 }
303
282 return retval; 304 return retval;
283} 305}
284EXPORT_SYMBOL (usb_hcd_pci_suspend); 306EXPORT_SYMBOL (usb_hcd_pci_suspend);
@@ -301,6 +323,18 @@ int usb_hcd_pci_resume (struct pci_dev *dev)
301 return 0; 323 return 0;
302 } 324 }
303 325
326#ifdef CONFIG_PPC_PMAC
327 /* Reenable ASIC clocks for USB */
328 if (_machine == _MACH_Pmac) {
329 struct device_node *of_node;
330
331 of_node = pci_device_to_OF_node (dev);
332 if (of_node)
333 pmac_call_feature (PMAC_FTR_USB_ENABLE,
334 of_node, 0, 1);
335 }
336#endif
337
304 /* NOTE: chip docs cover clean "real suspend" cases (what Linux 338 /* NOTE: chip docs cover clean "real suspend" cases (what Linux
305 * calls "standby", "suspend to RAM", and so on). There are also 339 * calls "standby", "suspend to RAM", and so on). There are also
306 * dirty cases when swsusp fakes a suspend in "shutdown" mode. 340 * dirty cases when swsusp fakes a suspend in "shutdown" mode.
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index a59e536441e1..5f22e6590cd1 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -14,15 +14,6 @@
14 * This file is licenced under the GPL. 14 * This file is licenced under the GPL.
15 */ 15 */
16 16
17#include <linux/jiffies.h>
18
19#ifdef CONFIG_PPC_PMAC
20#include <asm/machdep.h>
21#include <asm/pmac_feature.h>
22#include <asm/pci-bridge.h>
23#include <asm/prom.h>
24#endif
25
26#ifndef CONFIG_PCI 17#ifndef CONFIG_PCI
27#error "This file is PCI bus glue. CONFIG_PCI must be defined." 18#error "This file is PCI bus glue. CONFIG_PCI must be defined."
28#endif 19#endif
@@ -115,39 +106,12 @@ ohci_pci_start (struct usb_hcd *hcd)
115static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) 106static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
116{ 107{
117 /* root hub was already suspended */ 108 /* root hub was already suspended */
118
119 /* FIXME these PMAC things get called in the wrong places. ASIC
120 * clocks should be turned off AFTER entering D3, and on BEFORE
121 * trying to enter D0. Evidently the PCI layer doesn't currently
122 * provide the right sort of platform hooks for this ...
123 */
124#ifdef CONFIG_PPC_PMAC
125 if (_machine == _MACH_Pmac) {
126 struct device_node *of_node;
127
128 /* Disable USB PAD & cell clock */
129 of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
130 if (of_node)
131 pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
132 }
133#endif /* CONFIG_PPC_PMAC */
134 return 0; 109 return 0;
135} 110}
136 111
137 112
138static int ohci_pci_resume (struct usb_hcd *hcd) 113static int ohci_pci_resume (struct usb_hcd *hcd)
139{ 114{
140#ifdef CONFIG_PPC_PMAC
141 if (_machine == _MACH_Pmac) {
142 struct device_node *of_node;
143
144 /* Re-enable USB PAD & cell clock */
145 of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
146 if (of_node)
147 pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
148 }
149#endif /* CONFIG_PPC_PMAC */
150
151 usb_hcd_resume_root_hub(hcd); 115 usb_hcd_resume_root_hub(hcd);
152 return 0; 116 return 0;
153} 117}