diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2010-06-25 14:01:49 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 17:35:37 -0400 |
commit | 2138a1f1835274b1d131a1aafa1655f60b2af122 (patch) | |
tree | 88809be40b4eb3caf8c04753f62dde6798875d58 | |
parent | f8dae531ec78ed34f8a845e5f4ff75f0adeb6b13 (diff) |
USB: refactor the powermac-specific ASIC clock code
This patch (as1383) takes the powermac-specific code from the PCI HCD
glue layer and encapsulates it in its own subroutine.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index 7e2d5271b0c9..7c3b0af62241 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c | |||
@@ -332,6 +332,27 @@ EXPORT_SYMBOL_GPL(usb_hcd_pci_shutdown); | |||
332 | 332 | ||
333 | #ifdef CONFIG_PM_SLEEP | 333 | #ifdef CONFIG_PM_SLEEP |
334 | 334 | ||
335 | #ifdef CONFIG_PPC_PMAC | ||
336 | static void powermac_set_asic(struct pci_dev *pci_dev, int enable) | ||
337 | { | ||
338 | /* Enanble or disable ASIC clocks for USB */ | ||
339 | if (machine_is(powermac)) { | ||
340 | struct device_node *of_node; | ||
341 | |||
342 | of_node = pci_device_to_OF_node(pci_dev); | ||
343 | if (of_node) | ||
344 | pmac_call_feature(PMAC_FTR_USB_ENABLE, | ||
345 | of_node, 0, enable); | ||
346 | } | ||
347 | } | ||
348 | |||
349 | #else | ||
350 | |||
351 | static inline void powermac_set_asic(struct pci_dev *pci_dev, int enable) | ||
352 | {} | ||
353 | |||
354 | #endif /* CONFIG_PPC_PMAC */ | ||
355 | |||
335 | static int check_root_hub_suspended(struct device *dev) | 356 | static int check_root_hub_suspended(struct device *dev) |
336 | { | 357 | { |
337 | struct pci_dev *pci_dev = to_pci_dev(dev); | 358 | struct pci_dev *pci_dev = to_pci_dev(dev); |
@@ -416,16 +437,7 @@ static int hcd_pci_suspend_noirq(struct device *dev) | |||
416 | return retval; | 437 | return retval; |
417 | } | 438 | } |
418 | 439 | ||
419 | #ifdef CONFIG_PPC_PMAC | 440 | powermac_set_asic(pci_dev, 0); |
420 | /* Disable ASIC clocks for USB */ | ||
421 | if (machine_is(powermac)) { | ||
422 | struct device_node *of_node; | ||
423 | |||
424 | of_node = pci_device_to_OF_node(pci_dev); | ||
425 | if (of_node) | ||
426 | pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0); | ||
427 | } | ||
428 | #endif | ||
429 | return retval; | 441 | return retval; |
430 | } | 442 | } |
431 | 443 | ||
@@ -433,17 +445,7 @@ static int hcd_pci_resume_noirq(struct device *dev) | |||
433 | { | 445 | { |
434 | struct pci_dev *pci_dev = to_pci_dev(dev); | 446 | struct pci_dev *pci_dev = to_pci_dev(dev); |
435 | 447 | ||
436 | #ifdef CONFIG_PPC_PMAC | 448 | powermac_set_asic(pci_dev, 1); |
437 | /* Reenable ASIC clocks for USB */ | ||
438 | if (machine_is(powermac)) { | ||
439 | struct device_node *of_node; | ||
440 | |||
441 | of_node = pci_device_to_OF_node(pci_dev); | ||
442 | if (of_node) | ||
443 | pmac_call_feature(PMAC_FTR_USB_ENABLE, | ||
444 | of_node, 0, 1); | ||
445 | } | ||
446 | #endif | ||
447 | 449 | ||
448 | /* Go back to D0 and disable remote wakeup */ | 450 | /* Go back to D0 and disable remote wakeup */ |
449 | pci_back_from_sleep(pci_dev); | 451 | pci_back_from_sleep(pci_dev); |