aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-dbg.c56
-rw-r--r--drivers/usb/host/ehci-hcd.c48
-rw-r--r--drivers/usb/host/ehci-hub.c27
-rw-r--r--drivers/usb/host/ehci-ppc-soc.c201
-rw-r--r--drivers/usb/host/ehci.h23
-rw-r--r--drivers/usb/host/isp116x-hcd.c13
-rw-r--r--drivers/usb/host/isp1760-if.c7
-rw-r--r--drivers/usb/host/ohci-dbg.c2
-rw-r--r--drivers/usb/host/ohci-hcd.c10
-rw-r--r--drivers/usb/host/ohci-hub.c87
-rw-r--r--drivers/usb/host/ohci-omap.c4
-rw-r--r--drivers/usb/host/ohci-pnx4008.c2
-rw-r--r--drivers/usb/host/ohci.h8
-rw-r--r--drivers/usb/host/r8a66597-hcd.c101
-rw-r--r--drivers/usb/host/sl811-hcd.c15
-rw-r--r--drivers/usb/host/uhci-hcd.c10
-rw-r--r--drivers/usb/host/uhci-q.c17
17 files changed, 256 insertions, 375 deletions
diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index b0f8ed5a7fb9..0cb53ca8d343 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -358,7 +358,8 @@ struct debug_buffer {
358 struct usb_bus *bus; 358 struct usb_bus *bus;
359 struct mutex mutex; /* protect filling of buffer */ 359 struct mutex mutex; /* protect filling of buffer */
360 size_t count; /* number of characters filled into buffer */ 360 size_t count; /* number of characters filled into buffer */
361 char *page; 361 char *output_buf;
362 size_t alloc_size;
362}; 363};
363 364
364#define speed_char(info1) ({ char tmp; \ 365#define speed_char(info1) ({ char tmp; \
@@ -488,8 +489,8 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
488 489
489 hcd = bus_to_hcd(buf->bus); 490 hcd = bus_to_hcd(buf->bus);
490 ehci = hcd_to_ehci (hcd); 491 ehci = hcd_to_ehci (hcd);
491 next = buf->page; 492 next = buf->output_buf;
492 size = PAGE_SIZE; 493 size = buf->alloc_size;
493 494
494 *next = 0; 495 *next = 0;
495 496
@@ -510,7 +511,7 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf)
510 } 511 }
511 spin_unlock_irqrestore (&ehci->lock, flags); 512 spin_unlock_irqrestore (&ehci->lock, flags);
512 513
513 return strlen(buf->page); 514 return strlen(buf->output_buf);
514} 515}
515 516
516#define DBG_SCHED_LIMIT 64 517#define DBG_SCHED_LIMIT 64
@@ -531,8 +532,8 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
531 532
532 hcd = bus_to_hcd(buf->bus); 533 hcd = bus_to_hcd(buf->bus);
533 ehci = hcd_to_ehci (hcd); 534 ehci = hcd_to_ehci (hcd);
534 next = buf->page; 535 next = buf->output_buf;
535 size = PAGE_SIZE; 536 size = buf->alloc_size;
536 537
537 temp = scnprintf (next, size, "size = %d\n", ehci->periodic_size); 538 temp = scnprintf (next, size, "size = %d\n", ehci->periodic_size);
538 size -= temp; 539 size -= temp;
@@ -568,14 +569,16 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
568 for (temp = 0; temp < seen_count; temp++) { 569 for (temp = 0; temp < seen_count; temp++) {
569 if (seen [temp].ptr != p.ptr) 570 if (seen [temp].ptr != p.ptr)
570 continue; 571 continue;
571 if (p.qh->qh_next.ptr) 572 if (p.qh->qh_next.ptr) {
572 temp = scnprintf (next, size, 573 temp = scnprintf (next, size,
573 " ..."); 574 " ...");
574 p.ptr = NULL; 575 size -= temp;
576 next += temp;
577 }
575 break; 578 break;
576 } 579 }
577 /* show more info the first time around */ 580 /* show more info the first time around */
578 if (temp == seen_count && p.ptr) { 581 if (temp == seen_count) {
579 u32 scratch = hc32_to_cpup(ehci, 582 u32 scratch = hc32_to_cpup(ehci,
580 &p.qh->hw_info1); 583 &p.qh->hw_info1);
581 struct ehci_qtd *qtd; 584 struct ehci_qtd *qtd;
@@ -649,7 +652,7 @@ static ssize_t fill_periodic_buffer(struct debug_buffer *buf)
649 spin_unlock_irqrestore (&ehci->lock, flags); 652 spin_unlock_irqrestore (&ehci->lock, flags);
650 kfree (seen); 653 kfree (seen);
651 654
652 return PAGE_SIZE - size; 655 return buf->alloc_size - size;
653} 656}
654#undef DBG_SCHED_LIMIT 657#undef DBG_SCHED_LIMIT
655 658
@@ -665,14 +668,14 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
665 668
666 hcd = bus_to_hcd(buf->bus); 669 hcd = bus_to_hcd(buf->bus);
667 ehci = hcd_to_ehci (hcd); 670 ehci = hcd_to_ehci (hcd);
668 next = buf->page; 671 next = buf->output_buf;
669 size = PAGE_SIZE; 672 size = buf->alloc_size;
670 673
671 spin_lock_irqsave (&ehci->lock, flags); 674 spin_lock_irqsave (&ehci->lock, flags);
672 675
673 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) { 676 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
674 size = scnprintf (next, size, 677 size = scnprintf (next, size,
675 "bus %s, device %s (driver " DRIVER_VERSION ")\n" 678 "bus %s, device %s\n"
676 "%s\n" 679 "%s\n"
677 "SUSPENDED (no register access)\n", 680 "SUSPENDED (no register access)\n",
678 hcd->self.controller->bus->name, 681 hcd->self.controller->bus->name,
@@ -684,7 +687,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
684 /* Capability Registers */ 687 /* Capability Registers */
685 i = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); 688 i = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
686 temp = scnprintf (next, size, 689 temp = scnprintf (next, size,
687 "bus %s, device %s (driver " DRIVER_VERSION ")\n" 690 "bus %s, device %s\n"
688 "%s\n" 691 "%s\n"
689 "EHCI %x.%02x, hcd state %d\n", 692 "EHCI %x.%02x, hcd state %d\n",
690 hcd->self.controller->bus->name, 693 hcd->self.controller->bus->name,
@@ -808,7 +811,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
808done: 811done:
809 spin_unlock_irqrestore (&ehci->lock, flags); 812 spin_unlock_irqrestore (&ehci->lock, flags);
810 813
811 return PAGE_SIZE - size; 814 return buf->alloc_size - size;
812} 815}
813 816
814static struct debug_buffer *alloc_buffer(struct usb_bus *bus, 817static struct debug_buffer *alloc_buffer(struct usb_bus *bus,
@@ -822,6 +825,7 @@ static struct debug_buffer *alloc_buffer(struct usb_bus *bus,
822 buf->bus = bus; 825 buf->bus = bus;
823 buf->fill_func = fill_func; 826 buf->fill_func = fill_func;
824 mutex_init(&buf->mutex); 827 mutex_init(&buf->mutex);
828 buf->alloc_size = PAGE_SIZE;
825 } 829 }
826 830
827 return buf; 831 return buf;
@@ -831,10 +835,10 @@ static int fill_buffer(struct debug_buffer *buf)
831{ 835{
832 int ret = 0; 836 int ret = 0;
833 837
834 if (!buf->page) 838 if (!buf->output_buf)
835 buf->page = (char *)get_zeroed_page(GFP_KERNEL); 839 buf->output_buf = (char *)vmalloc(buf->alloc_size);
836 840
837 if (!buf->page) { 841 if (!buf->output_buf) {
838 ret = -ENOMEM; 842 ret = -ENOMEM;
839 goto out; 843 goto out;
840 } 844 }
@@ -867,7 +871,7 @@ static ssize_t debug_output(struct file *file, char __user *user_buf,
867 mutex_unlock(&buf->mutex); 871 mutex_unlock(&buf->mutex);
868 872
869 ret = simple_read_from_buffer(user_buf, len, offset, 873 ret = simple_read_from_buffer(user_buf, len, offset,
870 buf->page, buf->count); 874 buf->output_buf, buf->count);
871 875
872out: 876out:
873 return ret; 877 return ret;
@@ -879,8 +883,8 @@ static int debug_close(struct inode *inode, struct file *file)
879 struct debug_buffer *buf = file->private_data; 883 struct debug_buffer *buf = file->private_data;
880 884
881 if (buf) { 885 if (buf) {
882 if (buf->page) 886 if (buf->output_buf)
883 free_page((unsigned long)buf->page); 887 vfree(buf->output_buf);
884 kfree(buf); 888 kfree(buf);
885 } 889 }
886 890
@@ -895,10 +899,14 @@ static int debug_async_open(struct inode *inode, struct file *file)
895 899
896static int debug_periodic_open(struct inode *inode, struct file *file) 900static int debug_periodic_open(struct inode *inode, struct file *file)
897{ 901{
898 file->private_data = alloc_buffer(inode->i_private, 902 struct debug_buffer *buf;
899 fill_periodic_buffer); 903 buf = alloc_buffer(inode->i_private, fill_periodic_buffer);
904 if (!buf)
905 return -ENOMEM;
900 906
901 return file->private_data ? 0 : -ENOMEM; 907 buf->alloc_size = (sizeof(void *) == 4 ? 6 : 8)*PAGE_SIZE;
908 file->private_data = buf;
909 return 0;
902} 910}
903 911
904static int debug_registers_open(struct inode *inode, struct file *file) 912static int debug_registers_open(struct inode *inode, struct file *file)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 8409e0705d63..d343afacb0b0 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -24,6 +24,7 @@
24#include <linux/ioport.h> 24#include <linux/ioport.h>
25#include <linux/sched.h> 25#include <linux/sched.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/vmalloc.h>
27#include <linux/errno.h> 28#include <linux/errno.h>
28#include <linux/init.h> 29#include <linux/init.h>
29#include <linux/timer.h> 30#include <linux/timer.h>
@@ -59,7 +60,6 @@
59 * providing early devices for those host controllers to talk to! 60 * providing early devices for those host controllers to talk to!
60 */ 61 */
61 62
62#define DRIVER_VERSION "10 Dec 2004"
63#define DRIVER_AUTHOR "David Brownell" 63#define DRIVER_AUTHOR "David Brownell"
64#define DRIVER_DESC "USB 2.0 'Enhanced' Host Controller (EHCI) Driver" 64#define DRIVER_DESC "USB 2.0 'Enhanced' Host Controller (EHCI) Driver"
65 65
@@ -620,9 +620,9 @@ static int ehci_run (struct usb_hcd *hcd)
620 620
621 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); 621 temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase));
622 ehci_info (ehci, 622 ehci_info (ehci,
623 "USB %x.%x started, EHCI %x.%02x, driver %s%s\n", 623 "USB %x.%x started, EHCI %x.%02x%s\n",
624 ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f), 624 ((ehci->sbrn & 0xf0)>>4), (ehci->sbrn & 0x0f),
625 temp >> 8, temp & 0xff, DRIVER_VERSION, 625 temp >> 8, temp & 0xff,
626 ignore_oc ? ", overcurrent ignored" : ""); 626 ignore_oc ? ", overcurrent ignored" : "");
627 627
628 ehci_writel(ehci, INTR_MASK, 628 ehci_writel(ehci, INTR_MASK,
@@ -706,7 +706,7 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
706 pcd_status = status; 706 pcd_status = status;
707 707
708 /* resume root hub? */ 708 /* resume root hub? */
709 if (!(ehci_readl(ehci, &ehci->regs->command) & CMD_RUN)) 709 if (!(cmd & CMD_RUN))
710 usb_hcd_resume_root_hub(hcd); 710 usb_hcd_resume_root_hub(hcd);
711 711
712 while (i--) { 712 while (i--) {
@@ -715,8 +715,11 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
715 715
716 if (pstatus & PORT_OWNER) 716 if (pstatus & PORT_OWNER)
717 continue; 717 continue;
718 if (!(pstatus & PORT_RESUME) 718 if (!(test_bit(i, &ehci->suspended_ports) &&
719 || ehci->reset_done [i] != 0) 719 ((pstatus & PORT_RESUME) ||
720 !(pstatus & PORT_SUSPEND)) &&
721 (pstatus & PORT_PE) &&
722 ehci->reset_done[i] == 0))
720 continue; 723 continue;
721 724
722 /* start 20 msec resume signaling from this port, 725 /* start 20 msec resume signaling from this port,
@@ -731,9 +734,8 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
731 734
732 /* PCI errors [4.15.2.4] */ 735 /* PCI errors [4.15.2.4] */
733 if (unlikely ((status & STS_FATAL) != 0)) { 736 if (unlikely ((status & STS_FATAL) != 0)) {
734 dbg_cmd (ehci, "fatal", ehci_readl(ehci, 737 dbg_cmd(ehci, "fatal", cmd);
735 &ehci->regs->command)); 738 dbg_status(ehci, "fatal", status);
736 dbg_status (ehci, "fatal", status);
737 if (status & STS_HALT) { 739 if (status & STS_HALT) {
738 ehci_err (ehci, "fatal error\n"); 740 ehci_err (ehci, "fatal error\n");
739dead: 741dead:
@@ -994,9 +996,7 @@ static int ehci_get_frame (struct usb_hcd *hcd)
994 996
995/*-------------------------------------------------------------------------*/ 997/*-------------------------------------------------------------------------*/
996 998
997#define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC 999MODULE_DESCRIPTION(DRIVER_DESC);
998
999MODULE_DESCRIPTION (DRIVER_INFO);
1000MODULE_AUTHOR (DRIVER_AUTHOR); 1000MODULE_AUTHOR (DRIVER_AUTHOR);
1001MODULE_LICENSE ("GPL"); 1001MODULE_LICENSE ("GPL");
1002 1002
@@ -1020,11 +1020,6 @@ MODULE_LICENSE ("GPL");
1020#define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver 1020#define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver
1021#endif 1021#endif
1022 1022
1023#if defined(CONFIG_440EPX) && !defined(CONFIG_PPC_MERGE)
1024#include "ehci-ppc-soc.c"
1025#define PLATFORM_DRIVER ehci_ppc_soc_driver
1026#endif
1027
1028#ifdef CONFIG_USB_EHCI_HCD_PPC_OF 1023#ifdef CONFIG_USB_EHCI_HCD_PPC_OF
1029#include "ehci-ppc-of.c" 1024#include "ehci-ppc-of.c"
1030#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver 1025#define OF_PLATFORM_DRIVER ehci_hcd_ppc_of_driver
@@ -1049,6 +1044,16 @@ static int __init ehci_hcd_init(void)
1049{ 1044{
1050 int retval = 0; 1045 int retval = 0;
1051 1046
1047 if (usb_disabled())
1048 return -ENODEV;
1049
1050 printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name);
1051 set_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
1052 if (test_bit(USB_UHCI_LOADED, &usb_hcds_loaded) ||
1053 test_bit(USB_OHCI_LOADED, &usb_hcds_loaded))
1054 printk(KERN_WARNING "Warning! ehci_hcd should always be loaded"
1055 " before uhci_hcd and ohci_hcd, not after\n");
1056
1052 pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n", 1057 pr_debug("%s: block sizes: qh %Zd qtd %Zd itd %Zd sitd %Zd\n",
1053 hcd_name, 1058 hcd_name,
1054 sizeof(struct ehci_qh), sizeof(struct ehci_qtd), 1059 sizeof(struct ehci_qh), sizeof(struct ehci_qtd),
@@ -1056,8 +1061,10 @@ static int __init ehci_hcd_init(void)
1056 1061
1057#ifdef DEBUG 1062#ifdef DEBUG
1058 ehci_debug_root = debugfs_create_dir("ehci", NULL); 1063 ehci_debug_root = debugfs_create_dir("ehci", NULL);
1059 if (!ehci_debug_root) 1064 if (!ehci_debug_root) {
1060 return -ENOENT; 1065 retval = -ENOENT;
1066 goto err_debug;
1067 }
1061#endif 1068#endif
1062 1069
1063#ifdef PLATFORM_DRIVER 1070#ifdef PLATFORM_DRIVER
@@ -1105,6 +1112,8 @@ clean0:
1105 debugfs_remove(ehci_debug_root); 1112 debugfs_remove(ehci_debug_root);
1106 ehci_debug_root = NULL; 1113 ehci_debug_root = NULL;
1107#endif 1114#endif
1115err_debug:
1116 clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
1108 return retval; 1117 return retval;
1109} 1118}
1110module_init(ehci_hcd_init); 1119module_init(ehci_hcd_init);
@@ -1126,6 +1135,7 @@ static void __exit ehci_hcd_cleanup(void)
1126#ifdef DEBUG 1135#ifdef DEBUG
1127 debugfs_remove(ehci_debug_root); 1136 debugfs_remove(ehci_debug_root);
1128#endif 1137#endif
1138 clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded);
1129} 1139}
1130module_exit(ehci_hcd_cleanup); 1140module_exit(ehci_hcd_cleanup);
1131 1141
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 740835bb8575..218f9660d7ee 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -236,10 +236,8 @@ static int ehci_bus_resume (struct usb_hcd *hcd)
236 temp = ehci_readl(ehci, &ehci->regs->port_status [i]); 236 temp = ehci_readl(ehci, &ehci->regs->port_status [i]);
237 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS); 237 temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
238 if (test_bit(i, &ehci->bus_suspended) && 238 if (test_bit(i, &ehci->bus_suspended) &&
239 (temp & PORT_SUSPEND)) { 239 (temp & PORT_SUSPEND))
240 ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
241 temp |= PORT_RESUME; 240 temp |= PORT_RESUME;
242 }
243 ehci_writel(ehci, temp, &ehci->regs->port_status [i]); 241 ehci_writel(ehci, temp, &ehci->regs->port_status [i]);
244 } 242 }
245 i = HCS_N_PORTS (ehci->hcs_params); 243 i = HCS_N_PORTS (ehci->hcs_params);
@@ -482,10 +480,9 @@ ehci_hub_status_data (struct usb_hcd *hcd, char *buf)
482 * controller by the user. 480 * controller by the user.
483 */ 481 */
484 482
485 if ((temp & mask) != 0 483 if ((temp & mask) != 0 || test_bit(i, &ehci->port_c_suspend)
486 || ((temp & PORT_RESUME) != 0 484 || (ehci->reset_done[i] && time_after_eq(
487 && time_after_eq(jiffies, 485 jiffies, ehci->reset_done[i]))) {
488 ehci->reset_done[i]))) {
489 if (i < 7) 486 if (i < 7)
490 buf [0] |= 1 << (i + 1); 487 buf [0] |= 1 << (i + 1);
491 else 488 else
@@ -688,6 +685,7 @@ static int ehci_hub_control (
688 /* resume completed? */ 685 /* resume completed? */
689 else if (time_after_eq(jiffies, 686 else if (time_after_eq(jiffies,
690 ehci->reset_done[wIndex])) { 687 ehci->reset_done[wIndex])) {
688 clear_bit(wIndex, &ehci->suspended_ports);
691 set_bit(wIndex, &ehci->port_c_suspend); 689 set_bit(wIndex, &ehci->port_c_suspend);
692 ehci->reset_done[wIndex] = 0; 690 ehci->reset_done[wIndex] = 0;
693 691
@@ -734,6 +732,9 @@ static int ehci_hub_control (
734 ehci_readl(ehci, status_reg)); 732 ehci_readl(ehci, status_reg));
735 } 733 }
736 734
735 if (!(temp & (PORT_RESUME|PORT_RESET)))
736 ehci->reset_done[wIndex] = 0;
737
737 /* transfer dedicated ports to the companion hc */ 738 /* transfer dedicated ports to the companion hc */
738 if ((temp & PORT_CONNECT) && 739 if ((temp & PORT_CONNECT) &&
739 test_bit(wIndex, &ehci->companion_ports)) { 740 test_bit(wIndex, &ehci->companion_ports)) {
@@ -757,8 +758,17 @@ static int ehci_hub_control (
757 } 758 }
758 if (temp & PORT_PE) 759 if (temp & PORT_PE)
759 status |= 1 << USB_PORT_FEAT_ENABLE; 760 status |= 1 << USB_PORT_FEAT_ENABLE;
760 if (temp & (PORT_SUSPEND|PORT_RESUME)) 761
762 /* maybe the port was unsuspended without our knowledge */
763 if (temp & (PORT_SUSPEND|PORT_RESUME)) {
761 status |= 1 << USB_PORT_FEAT_SUSPEND; 764 status |= 1 << USB_PORT_FEAT_SUSPEND;
765 } else if (test_bit(wIndex, &ehci->suspended_ports)) {
766 clear_bit(wIndex, &ehci->suspended_ports);
767 ehci->reset_done[wIndex] = 0;
768 if (temp & PORT_PE)
769 set_bit(wIndex, &ehci->port_c_suspend);
770 }
771
762 if (temp & PORT_OC) 772 if (temp & PORT_OC)
763 status |= 1 << USB_PORT_FEAT_OVER_CURRENT; 773 status |= 1 << USB_PORT_FEAT_OVER_CURRENT;
764 if (temp & PORT_RESET) 774 if (temp & PORT_RESET)
@@ -803,6 +813,7 @@ static int ehci_hub_control (
803 || (temp & PORT_RESET) != 0) 813 || (temp & PORT_RESET) != 0)
804 goto error; 814 goto error;
805 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg); 815 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
816 set_bit(wIndex, &ehci->suspended_ports);
806 break; 817 break;
807 case USB_PORT_FEAT_POWER: 818 case USB_PORT_FEAT_POWER:
808 if (HCS_PPC (ehci->hcs_params)) 819 if (HCS_PPC (ehci->hcs_params))
diff --git a/drivers/usb/host/ehci-ppc-soc.c b/drivers/usb/host/ehci-ppc-soc.c
deleted file mode 100644
index 529590eb4037..000000000000
--- a/drivers/usb/host/ehci-ppc-soc.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/*
2 * EHCI HCD (Host Controller Driver) for USB.
3 *
4 * (C) Copyright 2006-2007 Stefan Roese <sr@denx.de>, DENX Software Engineering
5 *
6 * Bus Glue for PPC On-Chip EHCI driver
7 * Tested on AMCC 440EPx
8 *
9 * Based on "ehci-au1xxx.c" by K.Boge <karsten.boge@amd.com>
10 *
11 * This file is licenced under the GPL.
12 */
13
14#include <linux/platform_device.h>
15
16extern int usb_disabled(void);
17
18/* called during probe() after chip reset completes */
19static int ehci_ppc_soc_setup(struct usb_hcd *hcd)
20{
21 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
22 int retval;
23
24 retval = ehci_halt(ehci);
25 if (retval)
26 return retval;
27
28 retval = ehci_init(hcd);
29 if (retval)
30 return retval;
31
32 ehci->sbrn = 0x20;
33 return ehci_reset(ehci);
34}
35
36/**
37 * usb_ehci_ppc_soc_probe - initialize PPC-SoC-based HCDs
38 * Context: !in_interrupt()
39 *
40 * Allocates basic resources for this USB host controller, and
41 * then invokes the start() method for the HCD associated with it
42 * through the hotplug entry's driver_data.
43 *
44 */
45int usb_ehci_ppc_soc_probe(const struct hc_driver *driver,
46 struct usb_hcd **hcd_out,
47 struct platform_device *dev)
48{
49 int retval;
50 struct usb_hcd *hcd;
51 struct ehci_hcd *ehci;
52
53 if (dev->resource[1].flags != IORESOURCE_IRQ) {
54 pr_debug("resource[1] is not IORESOURCE_IRQ");
55 retval = -ENOMEM;
56 }
57 hcd = usb_create_hcd(driver, &dev->dev, "PPC-SOC EHCI");
58 if (!hcd)
59 return -ENOMEM;
60 hcd->rsrc_start = dev->resource[0].start;
61 hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1;
62
63 if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
64 pr_debug("request_mem_region failed");
65 retval = -EBUSY;
66 goto err1;
67 }
68
69 hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
70 if (!hcd->regs) {
71 pr_debug("ioremap failed");
72 retval = -ENOMEM;
73 goto err2;
74 }
75
76 ehci = hcd_to_ehci(hcd);
77 ehci->big_endian_mmio = 1;
78 ehci->big_endian_desc = 1;
79 ehci->caps = hcd->regs;
80 ehci->regs = hcd->regs + HC_LENGTH(ehci_readl(ehci, &ehci->caps->hc_capbase));
81
82 /* cache this readonly data; minimize chip reads */
83 ehci->hcs_params = ehci_readl(ehci, &ehci->caps->hcs_params);
84
85#if defined(CONFIG_440EPX)
86 /*
87 * 440EPx Errata USBH_3
88 * Fix: Enable Break Memory Transfer (BMT) in INSNREG3
89 */
90 out_be32((void *)((ulong)(&ehci->regs->command) + 0x8c), (1 << 0));
91 ehci_dbg(ehci, "Break Memory Transfer (BMT) has beed enabled!\n");
92#endif
93
94 retval = usb_add_hcd(hcd, dev->resource[1].start, IRQF_DISABLED);
95 if (retval == 0)
96 return retval;
97
98 iounmap(hcd->regs);
99err2:
100 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
101err1:
102 usb_put_hcd(hcd);
103 return retval;
104}
105
106/* may be called without controller electrically present */
107/* may be called with controller, bus, and devices active */
108
109/**
110 * usb_ehci_hcd_ppc_soc_remove - shutdown processing for PPC-SoC-based HCDs
111 * @dev: USB Host Controller being removed
112 * Context: !in_interrupt()
113 *
114 * Reverses the effect of usb_ehci_hcd_ppc_soc_probe(), first invoking
115 * the HCD's stop() method. It is always called from a thread
116 * context, normally "rmmod", "apmd", or something similar.
117 *
118 */
119void usb_ehci_ppc_soc_remove(struct usb_hcd *hcd, struct platform_device *dev)
120{
121 usb_remove_hcd(hcd);
122 iounmap(hcd->regs);
123 release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
124 usb_put_hcd(hcd);
125}
126
127static const struct hc_driver ehci_ppc_soc_hc_driver = {
128 .description = hcd_name,
129 .product_desc = "PPC-SOC EHCI",
130 .hcd_priv_size = sizeof(struct ehci_hcd),
131
132 /*
133 * generic hardware linkage
134 */
135 .irq = ehci_irq,
136 .flags = HCD_MEMORY | HCD_USB2,
137
138 /*
139 * basic lifecycle operations
140 */
141 .reset = ehci_ppc_soc_setup,
142 .start = ehci_run,
143 .stop = ehci_stop,
144 .shutdown = ehci_shutdown,
145
146 /*
147 * managing i/o requests and associated device resources
148 */
149 .urb_enqueue = ehci_urb_enqueue,
150 .urb_dequeue = ehci_urb_dequeue,
151 .endpoint_disable = ehci_endpoint_disable,
152
153 /*
154 * scheduling support
155 */
156 .get_frame_number = ehci_get_frame,
157
158 /*
159 * root hub support
160 */
161 .hub_status_data = ehci_hub_status_data,
162 .hub_control = ehci_hub_control,
163 .bus_suspend = ehci_bus_suspend,
164 .bus_resume = ehci_bus_resume,
165 .relinquish_port = ehci_relinquish_port,
166 .port_handed_over = ehci_port_handed_over,
167};
168
169static int ehci_hcd_ppc_soc_drv_probe(struct platform_device *pdev)
170{
171 struct usb_hcd *hcd = NULL;
172 int ret;
173
174 pr_debug("In ehci_hcd_ppc_soc_drv_probe\n");
175
176 if (usb_disabled())
177 return -ENODEV;
178
179 /* FIXME we only want one one probe() not two */
180 ret = usb_ehci_ppc_soc_probe(&ehci_ppc_soc_hc_driver, &hcd, pdev);
181 return ret;
182}
183
184static int ehci_hcd_ppc_soc_drv_remove(struct platform_device *pdev)
185{
186 struct usb_hcd *hcd = platform_get_drvdata(pdev);
187
188 /* FIXME we only want one one remove() not two */
189 usb_ehci_ppc_soc_remove(hcd, pdev);
190 return 0;
191}
192
193MODULE_ALIAS("platform:ppc-soc-ehci");
194static struct platform_driver ehci_ppc_soc_driver = {
195 .probe = ehci_hcd_ppc_soc_drv_probe,
196 .remove = ehci_hcd_ppc_soc_drv_remove,
197 .shutdown = usb_hcd_platform_shutdown,
198 .driver = {
199 .name = "ppc-soc-ehci",
200 }
201};
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index b697a13364ec..b11798d17ae5 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -99,6 +99,8 @@ struct ehci_hcd { /* one per controller */
99 owned by the companion during a bus suspend */ 99 owned by the companion during a bus suspend */
100 unsigned long port_c_suspend; /* which ports have 100 unsigned long port_c_suspend; /* which ports have
101 the change-suspend feature turned on */ 101 the change-suspend feature turned on */
102 unsigned long suspended_ports; /* which ports are
103 suspended */
102 104
103 /* per-HC memory pools (could be per-bus, but ...) */ 105 /* per-HC memory pools (could be per-bus, but ...) */
104 struct dma_pool *qh_pool; /* qh per active urb */ 106 struct dma_pool *qh_pool; /* qh per active urb */
@@ -181,14 +183,16 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
181 * the async ring; just the I/O watchdog. Note that if a 183 * the async ring; just the I/O watchdog. Note that if a
182 * SHRINK were pending, OFF would never be requested. 184 * SHRINK were pending, OFF would never be requested.
183 */ 185 */
184 if (timer_pending(&ehci->watchdog) 186 enum ehci_timer_action oldactions = ehci->actions;
185 && ((BIT(TIMER_ASYNC_SHRINK) | BIT(TIMER_ASYNC_OFF))
186 & ehci->actions))
187 return;
188 187
189 if (!test_and_set_bit (action, &ehci->actions)) { 188 if (!test_and_set_bit (action, &ehci->actions)) {
190 unsigned long t; 189 unsigned long t;
191 190
191 if (timer_pending(&ehci->watchdog)
192 && ((BIT(TIMER_ASYNC_SHRINK) | BIT(TIMER_ASYNC_OFF))
193 & oldactions))
194 return;
195
192 switch (action) { 196 switch (action) {
193 case TIMER_IO_WATCHDOG: 197 case TIMER_IO_WATCHDOG:
194 t = EHCI_IO_JIFFIES; 198 t = EHCI_IO_JIFFIES;
@@ -204,7 +208,7 @@ timer_action (struct ehci_hcd *ehci, enum ehci_timer_action action)
204 t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1; 208 t = DIV_ROUND_UP(EHCI_SHRINK_FRAMES * HZ, 1000) + 1;
205 break; 209 break;
206 } 210 }
207 mod_timer(&ehci->watchdog, t + jiffies); 211 mod_timer(&ehci->watchdog, round_jiffies(t + jiffies));
208 } 212 }
209} 213}
210 214
@@ -604,16 +608,7 @@ ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
604/* 608/*
605 * Big-endian read/write functions are arch-specific. 609 * Big-endian read/write functions are arch-specific.
606 * Other arches can be added if/when they're needed. 610 * Other arches can be added if/when they're needed.
607 *
608 * REVISIT: arch/powerpc now has readl/writel_be, so the
609 * definition below can die once the 4xx support is
610 * finally ported over.
611 */ 611 */
612#if defined(CONFIG_PPC) && !defined(CONFIG_PPC_MERGE)
613#define readl_be(addr) in_be32((__force unsigned *)addr)
614#define writel_be(val, addr) out_be32((__force unsigned *)addr, val)
615#endif
616
617#if defined(CONFIG_ARM) && defined(CONFIG_ARCH_IXP4XX) 612#if defined(CONFIG_ARM) && defined(CONFIG_ARCH_IXP4XX)
618#define readl_be(addr) __raw_readl((__force unsigned *)addr) 613#define readl_be(addr) __raw_readl((__force unsigned *)addr)
619#define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr) 614#define writel_be(val, addr) __raw_writel(val, (__force unsigned *)addr)
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index ce1ca0ba0515..4dda31b26892 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1562,11 +1562,12 @@ static int __devinit isp116x_probe(struct platform_device *pdev)
1562{ 1562{
1563 struct usb_hcd *hcd; 1563 struct usb_hcd *hcd;
1564 struct isp116x *isp116x; 1564 struct isp116x *isp116x;
1565 struct resource *addr, *data; 1565 struct resource *addr, *data, *ires;
1566 void __iomem *addr_reg; 1566 void __iomem *addr_reg;
1567 void __iomem *data_reg; 1567 void __iomem *data_reg;
1568 int irq; 1568 int irq;
1569 int ret = 0; 1569 int ret = 0;
1570 unsigned long irqflags;
1570 1571
1571 if (pdev->num_resources < 3) { 1572 if (pdev->num_resources < 3) {
1572 ret = -ENODEV; 1573 ret = -ENODEV;
@@ -1575,12 +1576,16 @@ static int __devinit isp116x_probe(struct platform_device *pdev)
1575 1576
1576 data = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1577 data = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1577 addr = platform_get_resource(pdev, IORESOURCE_MEM, 1); 1578 addr = platform_get_resource(pdev, IORESOURCE_MEM, 1);
1578 irq = platform_get_irq(pdev, 0); 1579 ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
1579 if (!addr || !data || irq < 0) { 1580
1581 if (!addr || !data || !ires) {
1580 ret = -ENODEV; 1582 ret = -ENODEV;
1581 goto err1; 1583 goto err1;
1582 } 1584 }
1583 1585
1586 irq = ires->start;
1587 irqflags = ires->flags & IRQF_TRIGGER_MASK;
1588
1584 if (pdev->dev.dma_mask) { 1589 if (pdev->dev.dma_mask) {
1585 DBG("DMA not supported\n"); 1590 DBG("DMA not supported\n");
1586 ret = -EINVAL; 1591 ret = -EINVAL;
@@ -1634,7 +1639,7 @@ static int __devinit isp116x_probe(struct platform_device *pdev)
1634 goto err6; 1639 goto err6;
1635 } 1640 }
1636 1641
1637 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED); 1642 ret = usb_add_hcd(hcd, irq, irqflags | IRQF_DISABLED);
1638 if (ret) 1643 if (ret)
1639 goto err6; 1644 goto err6;
1640 1645
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index 051ef7b6bdc6..af849f596135 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -218,7 +218,7 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
218 * and reading back and checking the contents are same or not 218 * and reading back and checking the contents are same or not
219 */ 219 */
220 if (reg_data != 0xFACE) { 220 if (reg_data != 0xFACE) {
221 err("scratch register mismatch %x", reg_data); 221 dev_err(&dev->dev, "scratch register mismatch %x\n", reg_data);
222 goto clean; 222 goto clean;
223 } 223 }
224 224
@@ -232,9 +232,10 @@ static int __devinit isp1761_pci_probe(struct pci_dev *dev,
232 hcd = isp1760_register(pci_mem_phy0, length, dev->irq, 232 hcd = isp1760_register(pci_mem_phy0, length, dev->irq,
233 IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev), 233 IRQF_SHARED | IRQF_DISABLED, &dev->dev, dev_name(&dev->dev),
234 devflags); 234 devflags);
235 pci_set_drvdata(dev, hcd); 235 if (!IS_ERR(hcd)) {
236 if (!hcd) 236 pci_set_drvdata(dev, hcd);
237 return 0; 237 return 0;
238 }
238clean: 239clean:
239 status = -ENODEV; 240 status = -ENODEV;
240 iounmap(iobase); 241 iounmap(iobase);
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index 7cef1d2f7ccc..d3269656aa4d 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -649,7 +649,7 @@ static ssize_t fill_registers_buffer(struct debug_buffer *buf)
649 ohci_dbg_sw (ohci, &next, &size, 649 ohci_dbg_sw (ohci, &next, &size,
650 "bus %s, device %s\n" 650 "bus %s, device %s\n"
651 "%s\n" 651 "%s\n"
652 "%s version " DRIVER_VERSION "\n", 652 "%s\n",
653 hcd->self.controller->bus->name, 653 hcd->self.controller->bus->name,
654 dev_name(hcd->self.controller), 654 dev_name(hcd->self.controller),
655 hcd->product_desc, 655 hcd->product_desc,
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 89901962cbfd..8647dab0d7f9 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -46,7 +46,6 @@
46 46
47#include "../core/hcd.h" 47#include "../core/hcd.h"
48 48
49#define DRIVER_VERSION "2006 August 04"
50#define DRIVER_AUTHOR "Roman Weissgaerber, David Brownell" 49#define DRIVER_AUTHOR "Roman Weissgaerber, David Brownell"
51#define DRIVER_DESC "USB 1.1 'Open' Host Controller (OHCI) Driver" 50#define DRIVER_DESC "USB 1.1 'Open' Host Controller (OHCI) Driver"
52 51
@@ -984,10 +983,8 @@ static int ohci_restart (struct ohci_hcd *ohci)
984 983
985/*-------------------------------------------------------------------------*/ 984/*-------------------------------------------------------------------------*/
986 985
987#define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC
988
989MODULE_AUTHOR (DRIVER_AUTHOR); 986MODULE_AUTHOR (DRIVER_AUTHOR);
990MODULE_DESCRIPTION (DRIVER_INFO); 987MODULE_DESCRIPTION(DRIVER_DESC);
991MODULE_LICENSE ("GPL"); 988MODULE_LICENSE ("GPL");
992 989
993#ifdef CONFIG_PCI 990#ifdef CONFIG_PCI
@@ -1095,9 +1092,10 @@ static int __init ohci_hcd_mod_init(void)
1095 if (usb_disabled()) 1092 if (usb_disabled())
1096 return -ENODEV; 1093 return -ENODEV;
1097 1094
1098 printk (KERN_DEBUG "%s: " DRIVER_INFO "\n", hcd_name); 1095 printk(KERN_INFO "%s: " DRIVER_DESC "\n", hcd_name);
1099 pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name, 1096 pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
1100 sizeof (struct ed), sizeof (struct td)); 1097 sizeof (struct ed), sizeof (struct td));
1098 set_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
1101 1099
1102#ifdef DEBUG 1100#ifdef DEBUG
1103 ohci_debug_root = debugfs_create_dir("ohci", NULL); 1101 ohci_debug_root = debugfs_create_dir("ohci", NULL);
@@ -1184,6 +1182,7 @@ static int __init ohci_hcd_mod_init(void)
1184 error_debug: 1182 error_debug:
1185#endif 1183#endif
1186 1184
1185 clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
1187 return retval; 1186 return retval;
1188} 1187}
1189module_init(ohci_hcd_mod_init); 1188module_init(ohci_hcd_mod_init);
@@ -1214,6 +1213,7 @@ static void __exit ohci_hcd_mod_exit(void)
1214#ifdef DEBUG 1213#ifdef DEBUG
1215 debugfs_remove(ohci_debug_root); 1214 debugfs_remove(ohci_debug_root);
1216#endif 1215#endif
1216 clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded);
1217} 1217}
1218module_exit(ohci_hcd_mod_exit); 1218module_exit(ohci_hcd_mod_exit);
1219 1219
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 7ea9a7b31155..32bbce9718f0 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -359,21 +359,24 @@ static void ohci_finish_controller_resume(struct usb_hcd *hcd)
359 359
360/* Carry out polling-, autostop-, and autoresume-related state changes */ 360/* Carry out polling-, autostop-, and autoresume-related state changes */
361static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, 361static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
362 int any_connected) 362 int any_connected, int rhsc_status)
363{ 363{
364 int poll_rh = 1; 364 int poll_rh = 1;
365 int rhsc; 365 int rhsc_enable;
366 366
367 rhsc = ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC; 367 /* Some broken controllers never turn off RHCS in the interrupt
368 switch (ohci->hc_control & OHCI_CTRL_HCFS) { 368 * status register. For their sake we won't re-enable RHSC
369 * interrupts if the interrupt bit is already active.
370 */
371 rhsc_enable = ohci_readl(ohci, &ohci->regs->intrenable) &
372 OHCI_INTR_RHSC;
369 373
374 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
370 case OHCI_USB_OPER: 375 case OHCI_USB_OPER:
371 /* If no status changes are pending, enable status-change 376 /* If no status changes are pending, enable RHSC interrupts. */
372 * interrupts. 377 if (!rhsc_enable && !rhsc_status && !changed) {
373 */ 378 rhsc_enable = OHCI_INTR_RHSC;
374 if (!rhsc && !changed) { 379 ohci_writel(ohci, rhsc_enable, &ohci->regs->intrenable);
375 rhsc = OHCI_INTR_RHSC;
376 ohci_writel(ohci, rhsc, &ohci->regs->intrenable);
377 } 380 }
378 381
379 /* Keep on polling until we know a device is connected 382 /* Keep on polling until we know a device is connected
@@ -383,7 +386,7 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
383 if (any_connected || 386 if (any_connected ||
384 !device_may_wakeup(&ohci_to_hcd(ohci) 387 !device_may_wakeup(&ohci_to_hcd(ohci)
385 ->self.root_hub->dev)) { 388 ->self.root_hub->dev)) {
386 if (rhsc) 389 if (rhsc_enable)
387 poll_rh = 0; 390 poll_rh = 0;
388 } else { 391 } else {
389 ohci->autostop = 1; 392 ohci->autostop = 1;
@@ -396,34 +399,45 @@ static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
396 ohci->autostop = 0; 399 ohci->autostop = 0;
397 ohci->next_statechange = jiffies + 400 ohci->next_statechange = jiffies +
398 STATECHANGE_DELAY; 401 STATECHANGE_DELAY;
399 } else if (rhsc && time_after_eq(jiffies, 402 } else if (time_after_eq(jiffies,
400 ohci->next_statechange) 403 ohci->next_statechange)
401 && !ohci->ed_rm_list 404 && !ohci->ed_rm_list
402 && !(ohci->hc_control & 405 && !(ohci->hc_control &
403 OHCI_SCHED_ENABLES)) { 406 OHCI_SCHED_ENABLES)) {
404 ohci_rh_suspend(ohci, 1); 407 ohci_rh_suspend(ohci, 1);
405 poll_rh = 0; 408 if (rhsc_enable)
409 poll_rh = 0;
406 } 410 }
407 } 411 }
408 break; 412 break;
409 413
410 /* if there is a port change, autostart or ask to be resumed */
411 case OHCI_USB_SUSPEND: 414 case OHCI_USB_SUSPEND:
412 case OHCI_USB_RESUME: 415 case OHCI_USB_RESUME:
416 /* if there is a port change, autostart or ask to be resumed */
413 if (changed) { 417 if (changed) {
414 if (ohci->autostop) 418 if (ohci->autostop)
415 ohci_rh_resume(ohci); 419 ohci_rh_resume(ohci);
416 else 420 else
417 usb_hcd_resume_root_hub(ohci_to_hcd(ohci)); 421 usb_hcd_resume_root_hub(ohci_to_hcd(ohci));
418 } else {
419 if (!rhsc && (ohci->autostop ||
420 ohci_to_hcd(ohci)->self.root_hub->
421 do_remote_wakeup))
422 ohci_writel(ohci, OHCI_INTR_RHSC,
423 &ohci->regs->intrenable);
424 422
425 /* everything is idle, no need for polling */ 423 /* If remote wakeup is disabled, stop polling */
424 } else if (!ohci->autostop &&
425 !ohci_to_hcd(ohci)->self.root_hub->
426 do_remote_wakeup) {
426 poll_rh = 0; 427 poll_rh = 0;
428
429 } else {
430 /* If no status changes are pending,
431 * enable RHSC interrupts
432 */
433 if (!rhsc_enable && !rhsc_status) {
434 rhsc_enable = OHCI_INTR_RHSC;
435 ohci_writel(ohci, rhsc_enable,
436 &ohci->regs->intrenable);
437 }
438 /* Keep polling until RHSC is enabled */
439 if (rhsc_enable)
440 poll_rh = 0;
427 } 441 }
428 break; 442 break;
429 } 443 }
@@ -441,18 +455,22 @@ static inline int ohci_rh_resume(struct ohci_hcd *ohci)
441 * autostop isn't used when CONFIG_PM is turned off. 455 * autostop isn't used when CONFIG_PM is turned off.
442 */ 456 */
443static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed, 457static int ohci_root_hub_state_changes(struct ohci_hcd *ohci, int changed,
444 int any_connected) 458 int any_connected, int rhsc_status)
445{ 459{
446 /* If RHSC is enabled, don't poll */ 460 /* If RHSC is enabled, don't poll */
447 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC) 461 if (ohci_readl(ohci, &ohci->regs->intrenable) & OHCI_INTR_RHSC)
448 return 0; 462 return 0;
449 463
450 /* If no status changes are pending, enable status-change interrupts */ 464 /* If status changes are pending, continue polling.
451 if (!changed) { 465 * Conversely, if no status changes are pending but the RHSC
452 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); 466 * status bit was set, then RHSC may be broken so continue polling.
453 return 0; 467 */
454 } 468 if (changed || rhsc_status)
455 return 1; 469 return 1;
470
471 /* It's safe to re-enable RHSC interrupts */
472 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
473 return 0;
456} 474}
457 475
458#endif /* CONFIG_PM */ 476#endif /* CONFIG_PM */
@@ -467,6 +485,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
467 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 485 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
468 int i, changed = 0, length = 1; 486 int i, changed = 0, length = 1;
469 int any_connected = 0; 487 int any_connected = 0;
488 int rhsc_status;
470 unsigned long flags; 489 unsigned long flags;
471 490
472 spin_lock_irqsave (&ohci->lock, flags); 491 spin_lock_irqsave (&ohci->lock, flags);
@@ -492,12 +511,10 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
492 length++; 511 length++;
493 } 512 }
494 513
495 /* Some broken controllers never turn off RHCS in the interrupt 514 /* Clear the RHSC status flag before reading the port statuses */
496 * status register. For their sake we won't re-enable RHSC 515 ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrstatus);
497 * interrupts if the flag is already set. 516 rhsc_status = ohci_readl(ohci, &ohci->regs->intrstatus) &
498 */ 517 OHCI_INTR_RHSC;
499 if (ohci_readl(ohci, &ohci->regs->intrstatus) & OHCI_INTR_RHSC)
500 changed = 1;
501 518
502 /* look at each port */ 519 /* look at each port */
503 for (i = 0; i < ohci->num_ports; i++) { 520 for (i = 0; i < ohci->num_ports; i++) {
@@ -517,7 +534,7 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
517 } 534 }
518 535
519 hcd->poll_rh = ohci_root_hub_state_changes(ohci, changed, 536 hcd->poll_rh = ohci_root_hub_state_changes(ohci, changed,
520 any_connected); 537 any_connected, rhsc_status);
521 538
522done: 539done:
523 spin_unlock_irqrestore (&ohci->lock, flags); 540 spin_unlock_irqrestore (&ohci->lock, flags);
diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c
index 522185629624..91697bdb399f 100644
--- a/drivers/usb/host/ohci-omap.c
+++ b/drivers/usb/host/ohci-omap.c
@@ -231,7 +231,7 @@ static int ohci_omap_init(struct usb_hcd *hcd)
231 231
232 omap_ohci_clock_power(1); 232 omap_ohci_clock_power(1);
233 233
234 if (cpu_is_omap1510()) { 234 if (cpu_is_omap15xx()) {
235 omap_1510_local_bus_power(1); 235 omap_1510_local_bus_power(1);
236 omap_1510_local_bus_init(); 236 omap_1510_local_bus_init();
237 } 237 }
@@ -319,7 +319,7 @@ static int usb_hcd_omap_probe (const struct hc_driver *driver,
319 if (IS_ERR(usb_host_ck)) 319 if (IS_ERR(usb_host_ck))
320 return PTR_ERR(usb_host_ck); 320 return PTR_ERR(usb_host_ck);
321 321
322 if (!cpu_is_omap1510()) 322 if (!cpu_is_omap15xx())
323 usb_dc_ck = clk_get(0, "usb_dc_ck"); 323 usb_dc_ck = clk_get(0, "usb_dc_ck");
324 else 324 else
325 usb_dc_ck = clk_get(0, "lb_ck"); 325 usb_dc_ck = clk_get(0, "lb_ck");
diff --git a/drivers/usb/host/ohci-pnx4008.c b/drivers/usb/host/ohci-pnx4008.c
index 658a2a978c32..e306ca6aef3d 100644
--- a/drivers/usb/host/ohci-pnx4008.c
+++ b/drivers/usb/host/ohci-pnx4008.c
@@ -331,7 +331,7 @@ static int __devinit usb_hcd_pnx4008_probe(struct platform_device *pdev)
331 331
332 int ret = 0, irq; 332 int ret = 0, irq;
333 333
334 dev_dbg(&pdev->dev, "%s: " DRIVER_INFO " (pnx4008)\n", hcd_name); 334 dev_dbg(&pdev->dev, "%s: " DRIVER_DESC " (pnx4008)\n", hcd_name);
335 if (usb_disabled()) { 335 if (usb_disabled()) {
336 err("USB is disabled"); 336 err("USB is disabled");
337 ret = -ENODEV; 337 ret = -ENODEV;
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index faf622eafce7..222011f6172c 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -540,15 +540,7 @@ static inline struct usb_hcd *ohci_to_hcd (const struct ohci_hcd *ohci)
540 * Big-endian read/write functions are arch-specific. 540 * Big-endian read/write functions are arch-specific.
541 * Other arches can be added if/when they're needed. 541 * Other arches can be added if/when they're needed.
542 * 542 *
543 * REVISIT: arch/powerpc now has readl/writel_be, so the
544 * definition below can die once the STB04xxx support is
545 * finally ported over.
546 */ 543 */
547#if defined(CONFIG_PPC) && !defined(CONFIG_PPC_MERGE)
548#define readl_be(addr) in_be32((__force unsigned *)addr)
549#define writel_be(val, addr) out_be32((__force unsigned *)addr, val)
550#endif
551
552static inline unsigned int _ohci_readl (const struct ohci_hcd *ohci, 544static inline unsigned int _ohci_readl (const struct ohci_hcd *ohci,
553 __hc32 __iomem * regs) 545 __hc32 __iomem * regs)
554{ 546{
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index ea7126f99cab..c18d8790c410 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -66,7 +66,7 @@ static unsigned short endian;
66module_param(endian, ushort, 0644); 66module_param(endian, ushort, 0644);
67MODULE_PARM_DESC(endian, "data endian: big=256, little=0 (default=0)"); 67MODULE_PARM_DESC(endian, "data endian: big=256, little=0 (default=0)");
68 68
69static unsigned short irq_sense = INTL; 69static unsigned short irq_sense = 0xff;
70module_param(irq_sense, ushort, 0644); 70module_param(irq_sense, ushort, 0644);
71MODULE_PARM_DESC(irq_sense, "IRQ sense: low level=32, falling edge=0 " 71MODULE_PARM_DESC(irq_sense, "IRQ sense: low level=32, falling edge=0 "
72 "(default=32)"); 72 "(default=32)");
@@ -118,7 +118,7 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597)
118 r8a66597_write(r8a66597, SCKE, SYSCFG0); 118 r8a66597_write(r8a66597, SCKE, SYSCFG0);
119 tmp = r8a66597_read(r8a66597, SYSCFG0); 119 tmp = r8a66597_read(r8a66597, SYSCFG0);
120 if (i++ > 1000) { 120 if (i++ > 1000) {
121 err("register access fail."); 121 printk(KERN_ERR "r8a66597: register access fail.\n");
122 return -ENXIO; 122 return -ENXIO;
123 } 123 }
124 } while ((tmp & SCKE) != SCKE); 124 } while ((tmp & SCKE) != SCKE);
@@ -128,7 +128,7 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597)
128 r8a66597_write(r8a66597, USBE, SYSCFG0); 128 r8a66597_write(r8a66597, USBE, SYSCFG0);
129 tmp = r8a66597_read(r8a66597, SYSCFG0); 129 tmp = r8a66597_read(r8a66597, SYSCFG0);
130 if (i++ > 1000) { 130 if (i++ > 1000) {
131 err("register access fail."); 131 printk(KERN_ERR "r8a66597: register access fail.\n");
132 return -ENXIO; 132 return -ENXIO;
133 } 133 }
134 } while ((tmp & USBE) != USBE); 134 } while ((tmp & USBE) != USBE);
@@ -141,7 +141,7 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597)
141 msleep(1); 141 msleep(1);
142 tmp = r8a66597_read(r8a66597, SYSCFG0); 142 tmp = r8a66597_read(r8a66597, SYSCFG0);
143 if (i++ > 500) { 143 if (i++ > 500) {
144 err("register access fail."); 144 printk(KERN_ERR "r8a66597: register access fail.\n");
145 return -ENXIO; 145 return -ENXIO;
146 } 146 }
147 } while ((tmp & SCKE) != SCKE); 147 } while ((tmp & SCKE) != SCKE);
@@ -265,7 +265,7 @@ static void get_port_number(char *devpath, u16 *root_port, u16 *hub_port)
265 if (root_port) { 265 if (root_port) {
266 *root_port = (devpath[0] & 0x0F) - 1; 266 *root_port = (devpath[0] & 0x0F) - 1;
267 if (*root_port >= R8A66597_MAX_ROOT_HUB) 267 if (*root_port >= R8A66597_MAX_ROOT_HUB)
268 err("illegal root port number"); 268 printk(KERN_ERR "r8a66597: Illegal root port number.\n");
269 } 269 }
270 if (hub_port) 270 if (hub_port)
271 *hub_port = devpath[2] & 0x0F; 271 *hub_port = devpath[2] & 0x0F;
@@ -286,7 +286,7 @@ static u16 get_r8a66597_usb_speed(enum usb_device_speed speed)
286 usbspd = HSMODE; 286 usbspd = HSMODE;
287 break; 287 break;
288 default: 288 default:
289 err("unknown speed"); 289 printk(KERN_ERR "r8a66597: unknown speed\n");
290 break; 290 break;
291 } 291 }
292 292
@@ -385,7 +385,7 @@ static u8 alloc_usb_address(struct r8a66597 *r8a66597, struct urb *urb)
385 struct r8a66597_device *dev; 385 struct r8a66597_device *dev;
386 386
387 if (is_hub_limit(urb->dev->devpath)) { 387 if (is_hub_limit(urb->dev->devpath)) {
388 err("Externel hub limit reached."); 388 dev_err(&urb->dev->dev, "External hub limit reached.\n");
389 return 0; 389 return 0;
390 } 390 }
391 391
@@ -406,8 +406,9 @@ static u8 alloc_usb_address(struct r8a66597 *r8a66597, struct urb *urb)
406 return addr; 406 return addr;
407 } 407 }
408 408
409 err("cannot communicate with a USB device more than 10.(%x)", 409 dev_err(&urb->dev->dev,
410 r8a66597->address_map); 410 "cannot communicate with a USB device more than 10.(%x)\n",
411 r8a66597->address_map);
411 412
412 return 0; 413 return 0;
413} 414}
@@ -447,7 +448,8 @@ static void r8a66597_reg_wait(struct r8a66597 *r8a66597, unsigned long reg,
447 do { 448 do {
448 tmp = r8a66597_read(r8a66597, reg); 449 tmp = r8a66597_read(r8a66597, reg);
449 if (i++ > 1000000) { 450 if (i++ > 1000000) {
450 err("register%lx, loop %x is timeout", reg, loop); 451 printk(KERN_ERR "r8a66597: register%lx, loop %x "
452 "is timeout\n", reg, loop);
451 break; 453 break;
452 } 454 }
453 ndelay(1); 455 ndelay(1);
@@ -675,7 +677,7 @@ static u16 get_empty_pipenum(struct r8a66597 *r8a66597,
675 array[i++] = 1; 677 array[i++] = 1;
676 break; 678 break;
677 default: 679 default:
678 err("Illegal type"); 680 printk(KERN_ERR "r8a66597: Illegal type\n");
679 return 0; 681 return 0;
680 } 682 }
681 683
@@ -705,7 +707,7 @@ static u16 get_r8a66597_type(__u8 type)
705 r8a66597_type = R8A66597_ISO; 707 r8a66597_type = R8A66597_ISO;
706 break; 708 break;
707 default: 709 default:
708 err("Illegal type"); 710 printk(KERN_ERR "r8a66597: Illegal type\n");
709 r8a66597_type = 0x0000; 711 r8a66597_type = 0x0000;
710 break; 712 break;
711 } 713 }
@@ -724,7 +726,7 @@ static u16 get_bufnum(u16 pipenum)
724 else if (check_interrupt(pipenum)) 726 else if (check_interrupt(pipenum))
725 bufnum = 4 + (pipenum - 6); 727 bufnum = 4 + (pipenum - 6);
726 else 728 else
727 err("Illegal pipenum (%d)", pipenum); 729 printk(KERN_ERR "r8a66597: Illegal pipenum (%d)\n", pipenum);
728 730
729 return bufnum; 731 return bufnum;
730} 732}
@@ -740,7 +742,7 @@ static u16 get_buf_bsize(u16 pipenum)
740 else if (check_interrupt(pipenum)) 742 else if (check_interrupt(pipenum))
741 buf_bsize = 0; 743 buf_bsize = 0;
742 else 744 else
743 err("Illegal pipenum (%d)", pipenum); 745 printk(KERN_ERR "r8a66597: Illegal pipenum (%d)\n", pipenum);
744 746
745 return buf_bsize; 747 return buf_bsize;
746} 748}
@@ -760,10 +762,12 @@ static void enable_r8a66597_pipe_dma(struct r8a66597 *r8a66597,
760 if ((r8a66597->dma_map & (1 << i)) != 0) 762 if ((r8a66597->dma_map & (1 << i)) != 0)
761 continue; 763 continue;
762 764
763 info("address %d, EndpointAddress 0x%02x use DMA FIFO", 765 dev_info(&dev->udev->dev,
764 usb_pipedevice(urb->pipe), 766 "address %d, EndpointAddress 0x%02x use "
765 info->dir_in ? USB_ENDPOINT_DIR_MASK + info->epnum 767 "DMA FIFO\n", usb_pipedevice(urb->pipe),
766 : info->epnum); 768 info->dir_in ?
769 USB_ENDPOINT_DIR_MASK + info->epnum
770 : info->epnum);
767 771
768 r8a66597->dma_map |= 1 << i; 772 r8a66597->dma_map |= 1 << i;
769 dev->dma_map |= 1 << i; 773 dev->dma_map |= 1 << i;
@@ -1187,7 +1191,7 @@ static int start_transfer(struct r8a66597 *r8a66597, struct r8a66597_td *td)
1187 prepare_status_packet(r8a66597, td); 1191 prepare_status_packet(r8a66597, td);
1188 break; 1192 break;
1189 default: 1193 default:
1190 err("invalid type."); 1194 printk(KERN_ERR "r8a66597: invalid type.\n");
1191 break; 1195 break;
1192 } 1196 }
1193 1197
@@ -1295,7 +1299,7 @@ static void packet_read(struct r8a66597 *r8a66597, u16 pipenum)
1295 if (unlikely((tmp & FRDY) == 0)) { 1299 if (unlikely((tmp & FRDY) == 0)) {
1296 pipe_stop(r8a66597, td->pipe); 1300 pipe_stop(r8a66597, td->pipe);
1297 pipe_irq_disable(r8a66597, pipenum); 1301 pipe_irq_disable(r8a66597, pipenum);
1298 err("in fifo not ready (%d)", pipenum); 1302 printk(KERN_ERR "r8a66597: in fifo not ready (%d)\n", pipenum);
1299 finish_request(r8a66597, td, pipenum, td->urb, -EPIPE); 1303 finish_request(r8a66597, td, pipenum, td->urb, -EPIPE);
1300 return; 1304 return;
1301 } 1305 }
@@ -1370,7 +1374,7 @@ static void packet_write(struct r8a66597 *r8a66597, u16 pipenum)
1370 if (unlikely((tmp & FRDY) == 0)) { 1374 if (unlikely((tmp & FRDY) == 0)) {
1371 pipe_stop(r8a66597, td->pipe); 1375 pipe_stop(r8a66597, td->pipe);
1372 pipe_irq_disable(r8a66597, pipenum); 1376 pipe_irq_disable(r8a66597, pipenum);
1373 err("out write fifo not ready. (%d)", pipenum); 1377 printk(KERN_ERR "r8a66597: out fifo not ready (%d)\n", pipenum);
1374 finish_request(r8a66597, td, pipenum, urb, -EPIPE); 1378 finish_request(r8a66597, td, pipenum, urb, -EPIPE);
1375 return; 1379 return;
1376 } 1380 }
@@ -2005,7 +2009,7 @@ static struct r8a66597_device *get_r8a66597_device(struct r8a66597 *r8a66597,
2005 return dev; 2009 return dev;
2006 } 2010 }
2007 2011
2008 err("get_r8a66597_device fail.(%d)\n", addr); 2012 printk(KERN_ERR "r8a66597: get_r8a66597_device fail.(%d)\n", addr);
2009 return NULL; 2013 return NULL;
2010} 2014}
2011 2015
@@ -2263,7 +2267,7 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev)
2263#define resource_len(r) (((r)->end - (r)->start) + 1) 2267#define resource_len(r) (((r)->end - (r)->start) + 1)
2264static int __init r8a66597_probe(struct platform_device *pdev) 2268static int __init r8a66597_probe(struct platform_device *pdev)
2265{ 2269{
2266 struct resource *res = NULL; 2270 struct resource *res = NULL, *ires;
2267 int irq = -1; 2271 int irq = -1;
2268 void __iomem *reg = NULL; 2272 void __iomem *reg = NULL;
2269 struct usb_hcd *hcd = NULL; 2273 struct usb_hcd *hcd = NULL;
@@ -2274,7 +2278,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2274 2278
2275 if (pdev->dev.dma_mask) { 2279 if (pdev->dev.dma_mask) {
2276 ret = -EINVAL; 2280 ret = -EINVAL;
2277 err("dma not support"); 2281 dev_err(&pdev->dev, "dma not supported\n");
2278 goto clean_up; 2282 goto clean_up;
2279 } 2283 }
2280 2284
@@ -2282,21 +2286,25 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2282 (char *)hcd_name); 2286 (char *)hcd_name);
2283 if (!res) { 2287 if (!res) {
2284 ret = -ENODEV; 2288 ret = -ENODEV;
2285 err("platform_get_resource_byname error."); 2289 dev_err(&pdev->dev, "platform_get_resource_byname error.\n");
2286 goto clean_up; 2290 goto clean_up;
2287 } 2291 }
2288 2292
2289 irq = platform_get_irq(pdev, 0); 2293 ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
2290 if (irq < 0) { 2294 if (!ires) {
2291 ret = -ENODEV; 2295 ret = -ENODEV;
2292 err("platform_get_irq error."); 2296 dev_err(&pdev->dev,
2297 "platform_get_resource IORESOURCE_IRQ error.\n");
2293 goto clean_up; 2298 goto clean_up;
2294 } 2299 }
2295 2300
2301 irq = ires->start;
2302 irq_trigger = ires->flags & IRQF_TRIGGER_MASK;
2303
2296 reg = ioremap(res->start, resource_len(res)); 2304 reg = ioremap(res->start, resource_len(res));
2297 if (reg == NULL) { 2305 if (reg == NULL) {
2298 ret = -ENOMEM; 2306 ret = -ENOMEM;
2299 err("ioremap error."); 2307 dev_err(&pdev->dev, "ioremap error.\n");
2300 goto clean_up; 2308 goto clean_up;
2301 } 2309 }
2302 2310
@@ -2304,7 +2312,7 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2304 hcd = usb_create_hcd(&r8a66597_hc_driver, &pdev->dev, (char *)hcd_name); 2312 hcd = usb_create_hcd(&r8a66597_hc_driver, &pdev->dev, (char *)hcd_name);
2305 if (!hcd) { 2313 if (!hcd) {
2306 ret = -ENOMEM; 2314 ret = -ENOMEM;
2307 err("Failed to create hcd"); 2315 dev_err(&pdev->dev, "Failed to create hcd\n");
2308 goto clean_up; 2316 goto clean_up;
2309 } 2317 }
2310 r8a66597 = hcd_to_r8a66597(hcd); 2318 r8a66597 = hcd_to_r8a66597(hcd);
@@ -2329,13 +2337,33 @@ static int __init r8a66597_probe(struct platform_device *pdev)
2329 INIT_LIST_HEAD(&r8a66597->child_device); 2337 INIT_LIST_HEAD(&r8a66597->child_device);
2330 2338
2331 hcd->rsrc_start = res->start; 2339 hcd->rsrc_start = res->start;
2332 if (irq_sense == INTL) 2340
2333 irq_trigger = IRQF_TRIGGER_LOW; 2341 /* irq_sense setting on cmdline takes precedence over resource
2334 else 2342 * settings, so the introduction of irqflags in IRQ resourse
2335 irq_trigger = IRQF_TRIGGER_FALLING; 2343 * won't disturb existing setups */
2344 switch (irq_sense) {
2345 case INTL:
2346 irq_trigger = IRQF_TRIGGER_LOW;
2347 break;
2348 case 0:
2349 irq_trigger = IRQF_TRIGGER_FALLING;
2350 break;
2351 case 0xff:
2352 if (irq_trigger)
2353 irq_sense = (irq_trigger & IRQF_TRIGGER_LOW) ?
2354 INTL : 0;
2355 else {
2356 irq_sense = INTL;
2357 irq_trigger = IRQF_TRIGGER_LOW;
2358 }
2359 break;
2360 default:
2361 dev_err(&pdev->dev, "Unknown irq_sense value.\n");
2362 }
2363
2336 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger); 2364 ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | irq_trigger);
2337 if (ret != 0) { 2365 if (ret != 0) {
2338 err("Failed to add hcd"); 2366 dev_err(&pdev->dev, "Failed to add hcd\n");
2339 goto clean_up; 2367 goto clean_up;
2340 } 2368 }
2341 2369
@@ -2364,7 +2392,8 @@ static int __init r8a66597_init(void)
2364 if (usb_disabled()) 2392 if (usb_disabled())
2365 return -ENODEV; 2393 return -ENODEV;
2366 2394
2367 info("driver %s, %s", hcd_name, DRIVER_VERSION); 2395 printk(KERN_INFO KBUILD_MODNAME ": driver %s, %s\n", hcd_name,
2396 DRIVER_VERSION);
2368 return platform_driver_register(&r8a66597_driver); 2397 return platform_driver_register(&r8a66597_driver);
2369} 2398}
2370module_init(r8a66597_init); 2399module_init(r8a66597_init);
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 8a74bbb57d08..e106e9d48d4a 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1620,22 +1620,26 @@ sl811h_probe(struct platform_device *dev)
1620{ 1620{
1621 struct usb_hcd *hcd; 1621 struct usb_hcd *hcd;
1622 struct sl811 *sl811; 1622 struct sl811 *sl811;
1623 struct resource *addr, *data; 1623 struct resource *addr, *data, *ires;
1624 int irq; 1624 int irq;
1625 void __iomem *addr_reg; 1625 void __iomem *addr_reg;
1626 void __iomem *data_reg; 1626 void __iomem *data_reg;
1627 int retval; 1627 int retval;
1628 u8 tmp, ioaddr = 0; 1628 u8 tmp, ioaddr = 0;
1629 unsigned long irqflags;
1629 1630
1630 /* basic sanity checks first. board-specific init logic should 1631 /* basic sanity checks first. board-specific init logic should
1631 * have initialized these three resources and probably board 1632 * have initialized these three resources and probably board
1632 * specific platform_data. we don't probe for IRQs, and do only 1633 * specific platform_data. we don't probe for IRQs, and do only
1633 * minimal sanity checking. 1634 * minimal sanity checking.
1634 */ 1635 */
1635 irq = platform_get_irq(dev, 0); 1636 ires = platform_get_resource(dev, IORESOURCE_IRQ, 0);
1636 if (dev->num_resources < 3 || irq < 0) 1637 if (dev->num_resources < 3 || !ires)
1637 return -ENODEV; 1638 return -ENODEV;
1638 1639
1640 irq = ires->start;
1641 irqflags = ires->flags & IRQF_TRIGGER_MASK;
1642
1639 /* refuse to confuse usbcore */ 1643 /* refuse to confuse usbcore */
1640 if (dev->dev.dma_mask) { 1644 if (dev->dev.dma_mask) {
1641 DBG("no we won't dma\n"); 1645 DBG("no we won't dma\n");
@@ -1717,8 +1721,11 @@ sl811h_probe(struct platform_device *dev)
1717 * triggers (e.g. most ARM CPUs). Initial driver stress testing 1721 * triggers (e.g. most ARM CPUs). Initial driver stress testing
1718 * was on a system with single edge triggering, so most sorts of 1722 * was on a system with single edge triggering, so most sorts of
1719 * triggering arrangement should work. 1723 * triggering arrangement should work.
1724 *
1725 * Use resource IRQ flags if set by platform device setup.
1720 */ 1726 */
1721 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); 1727 irqflags |= IRQF_SHARED;
1728 retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | irqflags);
1722 if (retval != 0) 1729 if (retval != 0)
1723 goto err6; 1730 goto err6;
1724 1731
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 3a7bfe7a8874..cf5e4cf7ea42 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -53,7 +53,6 @@
53/* 53/*
54 * Version Information 54 * Version Information
55 */ 55 */
56#define DRIVER_VERSION "v3.0"
57#define DRIVER_AUTHOR "Linus 'Frodo Rabbit' Torvalds, Johannes Erdfelt, \ 56#define DRIVER_AUTHOR "Linus 'Frodo Rabbit' Torvalds, Johannes Erdfelt, \
58Randy Dunlap, Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber, \ 57Randy Dunlap, Georg Acher, Deti Fliegl, Thomas Sailer, Roman Weissgaerber, \
59Alan Stern" 58Alan Stern"
@@ -951,12 +950,13 @@ static int __init uhci_hcd_init(void)
951{ 950{
952 int retval = -ENOMEM; 951 int retval = -ENOMEM;
953 952
954 printk(KERN_INFO DRIVER_DESC " " DRIVER_VERSION "%s\n",
955 ignore_oc ? ", overcurrent ignored" : "");
956
957 if (usb_disabled()) 953 if (usb_disabled())
958 return -ENODEV; 954 return -ENODEV;
959 955
956 printk(KERN_INFO "uhci_hcd: " DRIVER_DESC "%s\n",
957 ignore_oc ? ", overcurrent ignored" : "");
958 set_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
959
960 if (DEBUG_CONFIGURED) { 960 if (DEBUG_CONFIGURED) {
961 errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL); 961 errbuf = kmalloc(ERRBUF_LEN, GFP_KERNEL);
962 if (!errbuf) 962 if (!errbuf)
@@ -988,6 +988,7 @@ debug_failed:
988 988
989errbuf_failed: 989errbuf_failed:
990 990
991 clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
991 return retval; 992 return retval;
992} 993}
993 994
@@ -997,6 +998,7 @@ static void __exit uhci_hcd_cleanup(void)
997 kmem_cache_destroy(uhci_up_cachep); 998 kmem_cache_destroy(uhci_up_cachep);
998 debugfs_remove(uhci_debugfs_root); 999 debugfs_remove(uhci_debugfs_root);
999 kfree(errbuf); 1000 kfree(errbuf);
1001 clear_bit(USB_UHCI_LOADED, &usb_hcds_loaded);
1000} 1002}
1001 1003
1002module_init(uhci_hcd_init); 1004module_init(uhci_hcd_init);
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 1f0c2cf26e5d..5631d89c8730 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -1065,13 +1065,18 @@ static int uhci_submit_interrupt(struct uhci_hcd *uhci, struct urb *urb,
1065 } 1065 }
1066 if (exponent < 0) 1066 if (exponent < 0)
1067 return -EINVAL; 1067 return -EINVAL;
1068 qh->period = 1 << exponent;
1069 qh->skel = SKEL_INDEX(exponent);
1070 1068
1071 /* For now, interrupt phase is fixed by the layout 1069 /* If the slot is full, try a lower period */
1072 * of the QH lists. */ 1070 do {
1073 qh->phase = (qh->period / 2) & (MAX_PHASE - 1); 1071 qh->period = 1 << exponent;
1074 ret = uhci_check_bandwidth(uhci, qh); 1072 qh->skel = SKEL_INDEX(exponent);
1073
1074 /* For now, interrupt phase is fixed by the layout
1075 * of the QH lists.
1076 */
1077 qh->phase = (qh->period / 2) & (MAX_PHASE - 1);
1078 ret = uhci_check_bandwidth(uhci, qh);
1079 } while (ret != 0 && --exponent >= 0);
1075 if (ret) 1080 if (ret)
1076 return ret; 1081 return ret;
1077 } else if (qh->period > urb->interval) 1082 } else if (qh->period > urb->interval)