aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2005-04-25 11:28:04 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-27 17:43:49 -0400
commit247f3105636caa9d1d8a4c3dfb755de42633bc80 (patch)
treef5fca7b566ee3304d661485a11dc4877652e7904 /drivers
parent8ec8d20b21f00a36343ca0ebd6c6be9421724a1e (diff)
[PATCH] USB HCDs: no longer need to register root hub
This patch changes the host controller drivers; they no longer need to register their root hubs because usbcore will take care of it for them. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c24
-rw-r--r--drivers/usb/host/ehci-hcd.c31
-rw-r--r--drivers/usb/host/isp116x-hcd.c16
-rw-r--r--drivers/usb/host/ohci-hcd.c30
-rw-r--r--drivers/usb/host/sl811-hcd.c13
-rw-r--r--drivers/usb/host/uhci-hcd.c25
6 files changed, 4 insertions, 135 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index 9d37fc771b27..1918d10f7569 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -1625,7 +1625,6 @@ static DEVICE_ATTR (urbs, S_IRUGO, show_urbs, NULL);
1625static int dummy_start (struct usb_hcd *hcd) 1625static int dummy_start (struct usb_hcd *hcd)
1626{ 1626{
1627 struct dummy *dum; 1627 struct dummy *dum;
1628 struct usb_device *root;
1629 int retval; 1628 int retval;
1630 1629
1631 dum = hcd_to_dummy (hcd); 1630 dum = hcd_to_dummy (hcd);
@@ -1642,35 +1641,16 @@ static int dummy_start (struct usb_hcd *hcd)
1642 1641
1643 INIT_LIST_HEAD (&dum->urbp_list); 1642 INIT_LIST_HEAD (&dum->urbp_list);
1644 1643
1645 root = usb_alloc_dev (NULL, &hcd->self, 0); 1644 if ((retval = dummy_register_udc (dum)) != 0)
1646 if (!root) 1645 return retval;
1647 return -ENOMEM;
1648 1646
1649 /* only show a low-power port: just 8mA */ 1647 /* only show a low-power port: just 8mA */
1650 hcd->power_budget = 8; 1648 hcd->power_budget = 8;
1651
1652 /* root hub enters addressed state... */
1653 hcd->state = HC_STATE_RUNNING; 1649 hcd->state = HC_STATE_RUNNING;
1654 root->speed = USB_SPEED_HIGH;
1655
1656 /* ...then configured, so khubd sees us. */
1657 if ((retval = usb_hcd_register_root_hub (root, hcd)) != 0) {
1658 goto err1;
1659 }
1660
1661 if ((retval = dummy_register_udc (dum)) != 0)
1662 goto err2;
1663 1650
1664 /* FIXME 'urbs' should be a per-device thing, maybe in usbcore */ 1651 /* FIXME 'urbs' should be a per-device thing, maybe in usbcore */
1665 device_create_file (dummy_dev(dum), &dev_attr_urbs); 1652 device_create_file (dummy_dev(dum), &dev_attr_urbs);
1666 return 0; 1653 return 0;
1667
1668 err2:
1669 usb_disconnect (&hcd->self.root_hub);
1670 err1:
1671 usb_put_dev (root);
1672 hcd->state = HC_STATE_QUIESCING;
1673 return retval;
1674} 1654}
1675 1655
1676static void dummy_stop (struct usb_hcd *hcd) 1656static void dummy_stop (struct usb_hcd *hcd)
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index bc69bd7acebe..527abc693b17 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -492,8 +492,6 @@ static int ehci_start (struct usb_hcd *hcd)
492{ 492{
493 struct ehci_hcd *ehci = hcd_to_ehci (hcd); 493 struct ehci_hcd *ehci = hcd_to_ehci (hcd);
494 u32 temp; 494 u32 temp;
495 struct usb_device *udev;
496 struct usb_bus *bus;
497 int retval; 495 int retval;
498 u32 hcc_params; 496 u32 hcc_params;
499 u8 sbrn = 0; 497 u8 sbrn = 0;
@@ -631,17 +629,6 @@ static int ehci_start (struct usb_hcd *hcd)
631 629
632 /* set async sleep time = 10 us ... ? */ 630 /* set async sleep time = 10 us ... ? */
633 631
634 /* wire up the root hub */
635 bus = hcd_to_bus (hcd);
636 udev = first ? usb_alloc_dev (NULL, bus, 0) : bus->root_hub;
637 if (!udev) {
638done2:
639 ehci_mem_cleanup (ehci);
640 return -ENOMEM;
641 }
642 udev->speed = USB_SPEED_HIGH;
643 udev->state = first ? USB_STATE_ATTACHED : USB_STATE_CONFIGURED;
644
645 /* 632 /*
646 * Start, enabling full USB 2.0 functionality ... usb 1.1 devices 633 * Start, enabling full USB 2.0 functionality ... usb 1.1 devices
647 * are explicitly handed to companion controller(s), so no TT is 634 * are explicitly handed to companion controller(s), so no TT is
@@ -664,24 +651,6 @@ done2:
664 first ? "initialized" : "restarted", 651 first ? "initialized" : "restarted",
665 temp >> 8, temp & 0xff, DRIVER_VERSION); 652 temp >> 8, temp & 0xff, DRIVER_VERSION);
666 653
667 /*
668 * From here on, khubd concurrently accesses the root
669 * hub; drivers will be talking to enumerated devices.
670 * (On restart paths, khubd already knows about the root
671 * hub and could find work as soon as we wrote FLAG_CF.)
672 *
673 * Before this point the HC was idle/ready. After, khubd
674 * and device drivers may start it running.
675 */
676 if (first && usb_hcd_register_root_hub (udev, hcd) != 0) {
677 if (hcd->state == HC_STATE_RUNNING)
678 ehci_quiesce (ehci);
679 ehci_reset (ehci);
680 usb_put_dev (udev);
681 retval = -ENODEV;
682 goto done2;
683 }
684
685 writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */ 654 writel (INTR_MASK, &ehci->regs->intr_enable); /* Turn On Interrupts */
686 655
687 if (first) 656 if (first)
diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c
index 1183988fdf54..ff0a168e8eed 100644
--- a/drivers/usb/host/isp116x-hcd.c
+++ b/drivers/usb/host/isp116x-hcd.c
@@ -1547,7 +1547,6 @@ static int isp116x_start(struct usb_hcd *hcd)
1547{ 1547{
1548 struct isp116x *isp116x = hcd_to_isp116x(hcd); 1548 struct isp116x *isp116x = hcd_to_isp116x(hcd);
1549 struct isp116x_platform_data *board = isp116x->board; 1549 struct isp116x_platform_data *board = isp116x->board;
1550 struct usb_device *udev;
1551 u32 val; 1550 u32 val;
1552 unsigned long flags; 1551 unsigned long flags;
1553 1552
@@ -1609,24 +1608,9 @@ static int isp116x_start(struct usb_hcd *hcd)
1609 isp116x->rhstatus = isp116x_read_reg32(isp116x, HCRHSTATUS); 1608 isp116x->rhstatus = isp116x_read_reg32(isp116x, HCRHSTATUS);
1610 1609
1611 isp116x_write_reg32(isp116x, HCFMINTVL, 0x27782edf); 1610 isp116x_write_reg32(isp116x, HCFMINTVL, 0x27782edf);
1612 spin_unlock_irqrestore(&isp116x->lock, flags);
1613
1614 udev = usb_alloc_dev(NULL, &hcd->self, 0);
1615 if (!udev) {
1616 isp116x_stop(hcd);
1617 return -ENOMEM;
1618 }
1619 1611
1620 udev->speed = USB_SPEED_FULL;
1621 hcd->state = HC_STATE_RUNNING; 1612 hcd->state = HC_STATE_RUNNING;
1622 1613
1623 if (usb_hcd_register_root_hub(udev, hcd) != 0) {
1624 isp116x_stop(hcd);
1625 usb_put_dev(udev);
1626 return -ENODEV;
1627 }
1628
1629 spin_lock_irqsave(&isp116x->lock, flags);
1630 /* Set up interrupts */ 1614 /* Set up interrupts */
1631 isp116x->intenb = HCINT_MIE | HCINT_RHSC | HCINT_UE; 1615 isp116x->intenb = HCINT_MIE | HCINT_RHSC | HCINT_UE;
1632 if (board->remote_wakeup_enable) 1616 if (board->remote_wakeup_enable)
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 0da996191251..13cd2177b557 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -505,13 +505,10 @@ static int ohci_init (struct ohci_hcd *ohci)
505/* Start an OHCI controller, set the BUS operational 505/* Start an OHCI controller, set the BUS operational
506 * resets USB and controller 506 * resets USB and controller
507 * enable interrupts 507 * enable interrupts
508 * connect the virtual root hub
509 */ 508 */
510static int ohci_run (struct ohci_hcd *ohci) 509static int ohci_run (struct ohci_hcd *ohci)
511{ 510{
512 u32 mask, temp; 511 u32 mask, temp;
513 struct usb_device *udev;
514 struct usb_bus *bus;
515 int first = ohci->fminterval == 0; 512 int first = ohci->fminterval == 0;
516 513
517 disable (ohci); 514 disable (ohci);
@@ -672,36 +669,13 @@ retry:
672 669
673 // POTPGT delay is bits 24-31, in 2 ms units. 670 // POTPGT delay is bits 24-31, in 2 ms units.
674 mdelay ((temp >> 23) & 0x1fe); 671 mdelay ((temp >> 23) & 0x1fe);
675 bus = &ohci_to_hcd(ohci)->self;
676 ohci_to_hcd(ohci)->state = HC_STATE_RUNNING; 672 ohci_to_hcd(ohci)->state = HC_STATE_RUNNING;
677 673
678 ohci_dump (ohci, 1); 674 ohci_dump (ohci, 1);
679 675
680 udev = bus->root_hub; 676 if (ohci_to_hcd(ohci)->self.root_hub == NULL)
681 if (udev) { 677 create_debug_files (ohci);
682 return 0;
683 }
684
685 /* connect the virtual root hub */
686 udev = usb_alloc_dev (NULL, bus, 0);
687 if (!udev) {
688 disable (ohci);
689 ohci->hc_control &= ~OHCI_CTRL_HCFS;
690 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
691 return -ENOMEM;
692 }
693
694 udev->speed = USB_SPEED_FULL;
695 if (usb_hcd_register_root_hub (udev, ohci_to_hcd(ohci)) != 0) {
696 usb_put_dev (udev);
697 disable (ohci);
698 ohci->hc_control &= ~OHCI_CTRL_HCFS;
699 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
700 return -ENODEV;
701 }
702 678
703 register_reboot_notifier (&ohci->reboot_notifier);
704 create_debug_files (ohci);
705 return 0; 679 return 0;
706} 680}
707 681
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index 1f2d00fe983a..6c3f910bc307 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -1563,15 +1563,8 @@ static int
1563sl811h_start(struct usb_hcd *hcd) 1563sl811h_start(struct usb_hcd *hcd)
1564{ 1564{
1565 struct sl811 *sl811 = hcd_to_sl811(hcd); 1565 struct sl811 *sl811 = hcd_to_sl811(hcd);
1566 struct usb_device *udev;
1567 1566
1568 /* chip has been reset, VBUS power is off */ 1567 /* chip has been reset, VBUS power is off */
1569
1570 udev = usb_alloc_dev(NULL, &hcd->self, 0);
1571 if (!udev)
1572 return -ENOMEM;
1573
1574 udev->speed = USB_SPEED_FULL;
1575 hcd->state = HC_STATE_RUNNING; 1568 hcd->state = HC_STATE_RUNNING;
1576 1569
1577 if (sl811->board) { 1570 if (sl811->board) {
@@ -1579,12 +1572,6 @@ sl811h_start(struct usb_hcd *hcd)
1579 hcd->power_budget = sl811->board->power * 2; 1572 hcd->power_budget = sl811->board->power * 2;
1580 } 1573 }
1581 1574
1582 if (usb_hcd_register_root_hub(udev, hcd) != 0) {
1583 usb_put_dev(udev);
1584 sl811h_stop(hcd);
1585 return -ENODEV;
1586 }
1587
1588 /* enable power and interupts */ 1575 /* enable power and interupts */
1589 port_power(sl811, 1); 1576 port_power(sl811, 1);
1590 1577
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 6b87bd74b046..fdf54295da73 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -562,7 +562,6 @@ static int uhci_start(struct usb_hcd *hcd)
562 int retval = -EBUSY; 562 int retval = -EBUSY;
563 int i; 563 int i;
564 dma_addr_t dma_handle; 564 dma_addr_t dma_handle;
565 struct usb_device *udev;
566 struct dentry *dentry; 565 struct dentry *dentry;
567 566
568 hcd->uses_new_polling = 1; 567 hcd->uses_new_polling = 1;
@@ -626,14 +625,6 @@ static int uhci_start(struct usb_hcd *hcd)
626 goto err_create_qh_pool; 625 goto err_create_qh_pool;
627 } 626 }
628 627
629 /* Initialize the root hub */
630
631 udev = usb_alloc_dev(NULL, &hcd->self, 0);
632 if (!udev) {
633 dev_err(uhci_dev(uhci), "unable to allocate root hub\n");
634 goto err_alloc_root_hub;
635 }
636
637 uhci->term_td = uhci_alloc_td(uhci); 628 uhci->term_td = uhci_alloc_td(uhci);
638 if (!uhci->term_td) { 629 if (!uhci->term_td) {
639 dev_err(uhci_dev(uhci), "unable to allocate terminating TD\n"); 630 dev_err(uhci_dev(uhci), "unable to allocate terminating TD\n");
@@ -713,24 +704,11 @@ static int uhci_start(struct usb_hcd *hcd)
713 704
714 configure_hc(uhci); 705 configure_hc(uhci);
715 start_rh(uhci); 706 start_rh(uhci);
716
717 udev->speed = USB_SPEED_FULL;
718
719 if (usb_hcd_register_root_hub(udev, hcd) != 0) {
720 dev_err(uhci_dev(uhci), "unable to start root hub\n");
721 retval = -ENOMEM;
722 goto err_start_root_hub;
723 }
724
725 return 0; 707 return 0;
726 708
727/* 709/*
728 * error exits: 710 * error exits:
729 */ 711 */
730err_start_root_hub:
731 reset_hc(uhci);
732 del_timer_sync(&uhci->stall_timer);
733
734err_alloc_skelqh: 712err_alloc_skelqh:
735 for (i = 0; i < UHCI_NUM_SKELQH; i++) 713 for (i = 0; i < UHCI_NUM_SKELQH; i++)
736 if (uhci->skelqh[i]) { 714 if (uhci->skelqh[i]) {
@@ -742,9 +720,6 @@ err_alloc_skelqh:
742 uhci->term_td = NULL; 720 uhci->term_td = NULL;
743 721
744err_alloc_term_td: 722err_alloc_term_td:
745 usb_put_dev(udev);
746
747err_alloc_root_hub:
748 dma_pool_destroy(uhci->qh_pool); 723 dma_pool_destroy(uhci->qh_pool);
749 uhci->qh_pool = NULL; 724 uhci->qh_pool = NULL;
750 725