Lines Matching refs:hcd
426 rh_string(int id, struct usb_hcd const *hcd, u8 *data, unsigned len) in rh_string() argument
443 s = hcd->self.bus_name; in rh_string()
447 s = hcd->product_desc; in rh_string()
452 init_utsname()->release, hcd->driver->description); in rh_string()
465 static int rh_call_control (struct usb_hcd *hcd, struct urb *urb) in rh_call_control() argument
481 status = usb_hcd_link_urb_to_ep(hcd, urb); in rh_call_control()
485 urb->hcpriv = hcd; /* Indicate it's queued */ in rh_call_control()
530 tbuf[0] = (device_may_wakeup(&hcd->self.root_hub->dev) in rh_call_control()
538 device_set_wakeup_enable(&hcd->self.root_hub->dev, 0); in rh_call_control()
543 if (device_can_wakeup(&hcd->self.root_hub->dev) in rh_call_control()
545 device_set_wakeup_enable(&hcd->self.root_hub->dev, 1); in rh_call_control()
558 switch (hcd->speed) { in rh_call_control()
576 if (hcd->has_tt) in rh_call_control()
580 switch (hcd->speed) { in rh_call_control()
598 if (device_can_wakeup(&hcd->self.root_hub->dev)) in rh_call_control()
604 hcd, ubuf, wLength); in rh_call_control()
622 dev_dbg (hcd->self.controller, "root hub device address %d\n", in rh_call_control()
638 dev_dbg (hcd->self.controller, "no endpoint features yet\n"); in rh_call_control()
658 status = hcd->driver->hub_control (hcd, in rh_call_control()
663 usb_hub_adjust_deviceremovable(hcd->self.root_hub, in rh_call_control()
674 dev_dbg (hcd->self.controller, in rh_call_control()
711 usb_hcd_unlink_urb_from_ep(hcd, urb); in rh_call_control()
712 usb_hcd_giveback_urb(hcd, urb, status); in rh_call_control()
727 void usb_hcd_poll_rh_status(struct usb_hcd *hcd) in usb_hcd_poll_rh_status() argument
734 if (unlikely(!hcd->rh_pollable)) in usb_hcd_poll_rh_status()
736 if (!hcd->uses_new_polling && !hcd->status_urb) in usb_hcd_poll_rh_status()
739 length = hcd->driver->hub_status_data(hcd, buffer); in usb_hcd_poll_rh_status()
744 urb = hcd->status_urb; in usb_hcd_poll_rh_status()
746 clear_bit(HCD_FLAG_POLL_PENDING, &hcd->flags); in usb_hcd_poll_rh_status()
747 hcd->status_urb = NULL; in usb_hcd_poll_rh_status()
751 usb_hcd_unlink_urb_from_ep(hcd, urb); in usb_hcd_poll_rh_status()
752 usb_hcd_giveback_urb(hcd, urb, 0); in usb_hcd_poll_rh_status()
755 set_bit(HCD_FLAG_POLL_PENDING, &hcd->flags); in usb_hcd_poll_rh_status()
764 if (hcd->uses_new_polling ? HCD_POLL_RH(hcd) : in usb_hcd_poll_rh_status()
765 (length == 0 && hcd->status_urb != NULL)) in usb_hcd_poll_rh_status()
766 mod_timer (&hcd->rh_timer, (jiffies/(HZ/4) + 1) * (HZ/4)); in usb_hcd_poll_rh_status()
778 static int rh_queue_status (struct usb_hcd *hcd, struct urb *urb) in rh_queue_status() argument
785 if (hcd->status_urb || urb->transfer_buffer_length < len) { in rh_queue_status()
786 dev_dbg (hcd->self.controller, "not queuing rh status urb\n"); in rh_queue_status()
791 retval = usb_hcd_link_urb_to_ep(hcd, urb); in rh_queue_status()
795 hcd->status_urb = urb; in rh_queue_status()
796 urb->hcpriv = hcd; /* indicate it's queued */ in rh_queue_status()
797 if (!hcd->uses_new_polling) in rh_queue_status()
798 mod_timer(&hcd->rh_timer, (jiffies/(HZ/4) + 1) * (HZ/4)); in rh_queue_status()
801 else if (HCD_POLL_PENDING(hcd)) in rh_queue_status()
802 mod_timer(&hcd->rh_timer, jiffies); in rh_queue_status()
809 static int rh_urb_enqueue (struct usb_hcd *hcd, struct urb *urb) in rh_urb_enqueue() argument
812 return rh_queue_status (hcd, urb); in rh_urb_enqueue()
814 return rh_call_control (hcd, urb); in rh_urb_enqueue()
823 static int usb_rh_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) in usb_rh_urb_dequeue() argument
829 rc = usb_hcd_check_unlink_urb(hcd, urb, status); in usb_rh_urb_dequeue()
837 if (!hcd->uses_new_polling) in usb_rh_urb_dequeue()
838 del_timer (&hcd->rh_timer); in usb_rh_urb_dequeue()
839 if (urb == hcd->status_urb) { in usb_rh_urb_dequeue()
840 hcd->status_urb = NULL; in usb_rh_urb_dequeue()
841 usb_hcd_unlink_urb_from_ep(hcd, urb); in usb_rh_urb_dequeue()
842 usb_hcd_giveback_urb(hcd, urb, status); in usb_rh_urb_dequeue()
860 struct usb_hcd *hcd; in authorized_default_show() local
862 hcd = bus_to_hcd(usb_bus); in authorized_default_show()
863 return snprintf(buf, PAGE_SIZE, "%u\n", !!HCD_DEV_AUTHORIZED(hcd)); in authorized_default_show()
874 struct usb_hcd *hcd; in authorized_default_store() local
876 hcd = bus_to_hcd(usb_bus); in authorized_default_store()
880 set_bit(HCD_FLAG_DEV_AUTHORIZED, &hcd->flags); in authorized_default_store()
882 clear_bit(HCD_FLAG_DEV_AUTHORIZED, &hcd->flags); in authorized_default_store()
903 struct usb_hcd *hcd = bus_to_hcd(usb_dev->bus); in interface_authorized_default_show() local
905 return sprintf(buf, "%u\n", !!HCD_INTF_AUTHORIZED(hcd)); in interface_authorized_default_show()
919 struct usb_hcd *hcd = bus_to_hcd(usb_dev->bus); in interface_authorized_default_store() local
927 set_bit(HCD_FLAG_INTF_AUTHORIZED, &hcd->flags); in interface_authorized_default_store()
929 clear_bit(HCD_FLAG_INTF_AUTHORIZED, &hcd->flags); in interface_authorized_default_store()
1052 static int register_root_hub(struct usb_hcd *hcd) in register_root_hub() argument
1054 struct device *parent_dev = hcd->self.controller; in register_root_hub()
1055 struct usb_device *usb_dev = hcd->self.root_hub; in register_root_hub()
1095 hcd->rh_registered = 1; in register_root_hub()
1099 if (HCD_DEAD(hcd)) in register_root_hub()
1100 usb_hc_died (hcd); /* This time clean up */ in register_root_hub()
1225 int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb) in usb_hcd_link_urb_to_ep() argument
1251 if (HCD_RH_RUNNING(hcd)) { in usb_hcd_link_urb_to_ep()
1283 int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, in usb_hcd_check_unlink_urb() argument
1316 void usb_hcd_unlink_urb_from_ep(struct usb_hcd *hcd, struct urb *urb) in usb_hcd_unlink_urb_from_ep() argument
1409 void usb_hcd_unmap_urb_setup_for_dma(struct usb_hcd *hcd, struct urb *urb) in usb_hcd_unmap_urb_setup_for_dma() argument
1412 dma_unmap_single(hcd->self.controller, in usb_hcd_unmap_urb_setup_for_dma()
1428 static void unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) in unmap_urb_for_dma() argument
1430 if (hcd->driver->unmap_urb_for_dma) in unmap_urb_for_dma()
1431 hcd->driver->unmap_urb_for_dma(hcd, urb); in unmap_urb_for_dma()
1433 usb_hcd_unmap_urb_for_dma(hcd, urb); in unmap_urb_for_dma()
1436 void usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb) in usb_hcd_unmap_urb_for_dma() argument
1440 usb_hcd_unmap_urb_setup_for_dma(hcd, urb); in usb_hcd_unmap_urb_for_dma()
1444 dma_unmap_sg(hcd->self.controller, in usb_hcd_unmap_urb_for_dma()
1449 dma_unmap_page(hcd->self.controller, in usb_hcd_unmap_urb_for_dma()
1454 dma_unmap_single(hcd->self.controller, in usb_hcd_unmap_urb_for_dma()
1471 static int map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, in map_urb_for_dma() argument
1474 if (hcd->driver->map_urb_for_dma) in map_urb_for_dma()
1475 return hcd->driver->map_urb_for_dma(hcd, urb, mem_flags); in map_urb_for_dma()
1477 return usb_hcd_map_urb_for_dma(hcd, urb, mem_flags); in map_urb_for_dma()
1480 int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb, in usb_hcd_map_urb_for_dma() argument
1493 if (hcd->self.uses_pio_for_control) in usb_hcd_map_urb_for_dma()
1495 if (hcd->self.uses_dma) { in usb_hcd_map_urb_for_dma()
1497 hcd->self.controller, in usb_hcd_map_urb_for_dma()
1501 if (dma_mapping_error(hcd->self.controller, in usb_hcd_map_urb_for_dma()
1505 } else if (hcd->driver->flags & HCD_LOCAL_MEM) { in usb_hcd_map_urb_for_dma()
1521 if (hcd->self.uses_dma) { in usb_hcd_map_urb_for_dma()
1532 hcd->self.controller, in usb_hcd_map_urb_for_dma()
1547 hcd->self.controller, in usb_hcd_map_urb_for_dma()
1552 if (dma_mapping_error(hcd->self.controller, in usb_hcd_map_urb_for_dma()
1562 hcd->self.controller, in usb_hcd_map_urb_for_dma()
1566 if (dma_mapping_error(hcd->self.controller, in usb_hcd_map_urb_for_dma()
1572 } else if (hcd->driver->flags & HCD_LOCAL_MEM) { in usb_hcd_map_urb_for_dma()
1584 usb_hcd_unmap_urb_for_dma(hcd, urb); in usb_hcd_map_urb_for_dma()
1600 struct usb_hcd *hcd = bus_to_hcd(urb->dev->bus); in usb_hcd_submit_urb() local
1609 usbmon_urb_submit(&hcd->self, urb); in usb_hcd_submit_urb()
1620 status = rh_urb_enqueue(hcd, urb); in usb_hcd_submit_urb()
1622 status = map_urb_for_dma(hcd, urb, mem_flags); in usb_hcd_submit_urb()
1624 status = hcd->driver->urb_enqueue(hcd, urb, mem_flags); in usb_hcd_submit_urb()
1626 unmap_urb_for_dma(hcd, urb); in usb_hcd_submit_urb()
1631 usbmon_urb_submit_error(&hcd->self, urb, status); in usb_hcd_submit_urb()
1650 static int unlink1(struct usb_hcd *hcd, struct urb *urb, int status) in unlink1() argument
1655 value = usb_rh_urb_dequeue(hcd, urb, status); in unlink1()
1661 value = hcd->driver->urb_dequeue(hcd, urb, status); in unlink1()
1674 struct usb_hcd *hcd; in usb_hcd_unlink_urb() local
1691 hcd = bus_to_hcd(urb->dev->bus); in usb_hcd_unlink_urb()
1692 retval = unlink1(hcd, urb, status); in usb_hcd_unlink_urb()
1707 struct usb_hcd *hcd = bus_to_hcd(urb->dev->bus); in __usb_hcd_giveback_urb() local
1718 unmap_urb_for_dma(hcd, urb); in __usb_hcd_giveback_urb()
1719 usbmon_urb_complete(&hcd->self, urb, status); in __usb_hcd_giveback_urb()
1795 void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status) in usb_hcd_giveback_urb() argument
1804 if (!hcd_giveback_urb_in_bh(hcd) && !is_root_hub(urb->dev)) { in usb_hcd_giveback_urb()
1810 bh = &hcd->high_prio_bh; in usb_hcd_giveback_urb()
1813 bh = &hcd->low_prio_bh; in usb_hcd_giveback_urb()
1840 struct usb_hcd *hcd; in usb_hcd_flush_endpoint() local
1846 hcd = bus_to_hcd(udev->bus); in usb_hcd_flush_endpoint()
1861 unlink1(hcd, urb, -ESHUTDOWN); in usb_hcd_flush_endpoint()
1862 dev_dbg (hcd->self.controller, in usb_hcd_flush_endpoint()
1937 struct usb_hcd *hcd; in usb_hcd_alloc_bandwidth() local
1940 hcd = bus_to_hcd(udev->bus); in usb_hcd_alloc_bandwidth()
1941 if (!hcd->driver->check_bandwidth) in usb_hcd_alloc_bandwidth()
1949 hcd->driver->drop_endpoint(hcd, udev, ep); in usb_hcd_alloc_bandwidth()
1952 hcd->driver->drop_endpoint(hcd, udev, ep); in usb_hcd_alloc_bandwidth()
1954 hcd->driver->check_bandwidth(hcd, udev); in usb_hcd_alloc_bandwidth()
1970 ret = hcd->driver->drop_endpoint(hcd, udev, ep); in usb_hcd_alloc_bandwidth()
1976 ret = hcd->driver->drop_endpoint(hcd, udev, ep); in usb_hcd_alloc_bandwidth()
1994 ret = hcd->driver->add_endpoint(hcd, udev, &alt->endpoint[j]); in usb_hcd_alloc_bandwidth()
2023 ret = hcd->driver->drop_endpoint(hcd, udev, in usb_hcd_alloc_bandwidth()
2030 ret = hcd->driver->add_endpoint(hcd, udev, in usb_hcd_alloc_bandwidth()
2036 ret = hcd->driver->check_bandwidth(hcd, udev); in usb_hcd_alloc_bandwidth()
2039 hcd->driver->reset_bandwidth(hcd, udev); in usb_hcd_alloc_bandwidth()
2054 struct usb_hcd *hcd; in usb_hcd_disable_endpoint() local
2057 hcd = bus_to_hcd(udev->bus); in usb_hcd_disable_endpoint()
2058 if (hcd->driver->endpoint_disable) in usb_hcd_disable_endpoint()
2059 hcd->driver->endpoint_disable(hcd, ep); in usb_hcd_disable_endpoint()
2073 struct usb_hcd *hcd = bus_to_hcd(udev->bus); in usb_hcd_reset_endpoint() local
2075 if (hcd->driver->endpoint_reset) in usb_hcd_reset_endpoint()
2076 hcd->driver->endpoint_reset(hcd, ep); in usb_hcd_reset_endpoint()
2107 struct usb_hcd *hcd; in usb_alloc_streams() local
2112 hcd = bus_to_hcd(dev->bus); in usb_alloc_streams()
2113 if (!hcd->driver->alloc_streams || !hcd->driver->free_streams) in usb_alloc_streams()
2129 ret = hcd->driver->alloc_streams(hcd, dev, eps, num_eps, in usb_alloc_streams()
2157 struct usb_hcd *hcd; in usb_free_streams() local
2162 hcd = bus_to_hcd(dev->bus); in usb_free_streams()
2171 ret = hcd->driver->free_streams(hcd, dev, eps, num_eps, mem_flags); in usb_free_streams()
2198 struct usb_hcd *hcd = bus_to_hcd(udev->bus); in usb_hcd_get_frame_number() local
2200 if (!HCD_RH_RUNNING(hcd)) in usb_hcd_get_frame_number()
2202 return hcd->driver->get_frame_number (hcd); in usb_hcd_get_frame_number()
2211 struct usb_hcd *hcd = container_of(rhdev->bus, struct usb_hcd, self); in hcd_bus_suspend() local
2213 int old_state = hcd->state; in hcd_bus_suspend()
2218 if (HCD_DEAD(hcd)) { in hcd_bus_suspend()
2223 if (!hcd->driver->bus_suspend) { in hcd_bus_suspend()
2226 clear_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); in hcd_bus_suspend()
2227 hcd->state = HC_STATE_QUIESCING; in hcd_bus_suspend()
2228 status = hcd->driver->bus_suspend(hcd); in hcd_bus_suspend()
2232 hcd->state = HC_STATE_SUSPENDED; in hcd_bus_suspend()
2238 status = hcd->driver->hub_status_data(hcd, buffer); in hcd_bus_suspend()
2247 if (!HCD_DEAD(hcd)) { in hcd_bus_suspend()
2248 set_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); in hcd_bus_suspend()
2249 hcd->state = old_state; in hcd_bus_suspend()
2260 struct usb_hcd *hcd = container_of(rhdev->bus, struct usb_hcd, self); in hcd_bus_resume() local
2262 int old_state = hcd->state; in hcd_bus_resume()
2266 if (HCD_DEAD(hcd)) { in hcd_bus_resume()
2270 if (!hcd->driver->bus_resume) in hcd_bus_resume()
2272 if (HCD_RH_RUNNING(hcd)) in hcd_bus_resume()
2275 hcd->state = HC_STATE_RESUMING; in hcd_bus_resume()
2276 status = hcd->driver->bus_resume(hcd); in hcd_bus_resume()
2277 clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); in hcd_bus_resume()
2283 if (!HCD_DEAD(hcd)) { in hcd_bus_resume()
2287 set_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); in hcd_bus_resume()
2288 hcd->state = HC_STATE_RUNNING; in hcd_bus_resume()
2306 hcd->state = old_state; in hcd_bus_resume()
2310 usb_hc_died(hcd); in hcd_bus_resume()
2318 struct usb_hcd *hcd = container_of(work, struct usb_hcd, wakeup_work); in hcd_resume_work() local
2319 struct usb_device *udev = hcd->self.root_hub; in hcd_resume_work()
2333 void usb_hcd_resume_root_hub (struct usb_hcd *hcd) in usb_hcd_resume_root_hub() argument
2338 if (hcd->rh_registered) { in usb_hcd_resume_root_hub()
2339 set_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); in usb_hcd_resume_root_hub()
2340 queue_work(pm_wq, &hcd->wakeup_work); in usb_hcd_resume_root_hub()
2367 struct usb_hcd *hcd; in usb_bus_start_enum() local
2374 hcd = container_of (bus, struct usb_hcd, self); in usb_bus_start_enum()
2375 if (port_num && hcd->driver->start_port_reset) in usb_bus_start_enum()
2376 status = hcd->driver->start_port_reset(hcd, port_num); in usb_bus_start_enum()
2382 mod_timer(&hcd->rh_timer, jiffies + msecs_to_jiffies(10)); in usb_bus_start_enum()
2403 struct usb_hcd *hcd = __hcd; in usb_hcd_irq() local
2406 if (unlikely(HCD_DEAD(hcd) || !HCD_HW_ACCESSIBLE(hcd))) in usb_hcd_irq()
2408 else if (hcd->driver->irq(hcd) == IRQ_NONE) in usb_hcd_irq()
2429 void usb_hc_died (struct usb_hcd *hcd) in usb_hc_died() argument
2433 dev_err (hcd->self.controller, "HC died; cleaning up\n"); in usb_hc_died()
2436 clear_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); in usb_hc_died()
2437 set_bit(HCD_FLAG_DEAD, &hcd->flags); in usb_hc_died()
2438 if (hcd->rh_registered) { in usb_hc_died()
2439 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); in usb_hc_died()
2442 usb_set_device_state (hcd->self.root_hub, in usb_hc_died()
2444 usb_kick_hub_wq(hcd->self.root_hub); in usb_hc_died()
2446 if (usb_hcd_is_primary_hcd(hcd) && hcd->shared_hcd) { in usb_hc_died()
2447 hcd = hcd->shared_hcd; in usb_hc_died()
2448 if (hcd->rh_registered) { in usb_hc_died()
2449 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); in usb_hc_died()
2452 usb_set_device_state(hcd->self.root_hub, in usb_hc_died()
2454 usb_kick_hub_wq(hcd->self.root_hub); in usb_hc_died()
2492 struct usb_hcd *hcd; in usb_create_shared_hcd() local
2494 hcd = kzalloc(sizeof(*hcd) + driver->hcd_priv_size, GFP_KERNEL); in usb_create_shared_hcd()
2495 if (!hcd) { in usb_create_shared_hcd()
2500 hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex), in usb_create_shared_hcd()
2502 if (!hcd->bandwidth_mutex) { in usb_create_shared_hcd()
2503 kfree(hcd); in usb_create_shared_hcd()
2507 mutex_init(hcd->bandwidth_mutex); in usb_create_shared_hcd()
2508 dev_set_drvdata(dev, hcd); in usb_create_shared_hcd()
2511 hcd->bandwidth_mutex = primary_hcd->bandwidth_mutex; in usb_create_shared_hcd()
2512 hcd->primary_hcd = primary_hcd; in usb_create_shared_hcd()
2514 hcd->shared_hcd = primary_hcd; in usb_create_shared_hcd()
2515 primary_hcd->shared_hcd = hcd; in usb_create_shared_hcd()
2519 kref_init(&hcd->kref); in usb_create_shared_hcd()
2521 usb_bus_init(&hcd->self); in usb_create_shared_hcd()
2522 hcd->self.controller = dev; in usb_create_shared_hcd()
2523 hcd->self.bus_name = bus_name; in usb_create_shared_hcd()
2524 hcd->self.uses_dma = (dev->dma_mask != NULL); in usb_create_shared_hcd()
2526 init_timer(&hcd->rh_timer); in usb_create_shared_hcd()
2527 hcd->rh_timer.function = rh_timer_func; in usb_create_shared_hcd()
2528 hcd->rh_timer.data = (unsigned long) hcd; in usb_create_shared_hcd()
2530 INIT_WORK(&hcd->wakeup_work, hcd_resume_work); in usb_create_shared_hcd()
2533 hcd->driver = driver; in usb_create_shared_hcd()
2534 hcd->speed = driver->flags & HCD_MASK; in usb_create_shared_hcd()
2535 hcd->product_desc = (driver->product_desc) ? driver->product_desc : in usb_create_shared_hcd()
2537 return hcd; in usb_create_shared_hcd()
2574 struct usb_hcd *hcd = container_of (kref, struct usb_hcd, kref); in hcd_release() local
2577 if (usb_hcd_is_primary_hcd(hcd)) in hcd_release()
2578 kfree(hcd->bandwidth_mutex); in hcd_release()
2579 if (hcd->shared_hcd) { in hcd_release()
2580 struct usb_hcd *peer = hcd->shared_hcd; in hcd_release()
2583 if (peer->primary_hcd == hcd) in hcd_release()
2587 kfree(hcd); in hcd_release()
2590 struct usb_hcd *usb_get_hcd (struct usb_hcd *hcd) in usb_get_hcd() argument
2592 if (hcd) in usb_get_hcd()
2593 kref_get (&hcd->kref); in usb_get_hcd()
2594 return hcd; in usb_get_hcd()
2598 void usb_put_hcd (struct usb_hcd *hcd) in usb_put_hcd() argument
2600 if (hcd) in usb_put_hcd()
2601 kref_put (&hcd->kref, hcd_release); in usb_put_hcd()
2605 int usb_hcd_is_primary_hcd(struct usb_hcd *hcd) in usb_hcd_is_primary_hcd() argument
2607 if (!hcd->primary_hcd) in usb_hcd_is_primary_hcd()
2609 return hcd == hcd->primary_hcd; in usb_hcd_is_primary_hcd()
2613 int usb_hcd_find_raw_port_number(struct usb_hcd *hcd, int port1) in usb_hcd_find_raw_port_number() argument
2615 if (!hcd->driver->find_raw_port_number) in usb_hcd_find_raw_port_number()
2618 return hcd->driver->find_raw_port_number(hcd, port1); in usb_hcd_find_raw_port_number()
2621 static int usb_hcd_request_irqs(struct usb_hcd *hcd, in usb_hcd_request_irqs() argument
2626 if (hcd->driver->irq) { in usb_hcd_request_irqs()
2628 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d", in usb_hcd_request_irqs()
2629 hcd->driver->description, hcd->self.busnum); in usb_hcd_request_irqs()
2631 hcd->irq_descr, hcd); in usb_hcd_request_irqs()
2633 dev_err(hcd->self.controller, in usb_hcd_request_irqs()
2638 hcd->irq = irqnum; in usb_hcd_request_irqs()
2639 dev_info(hcd->self.controller, "irq %d, %s 0x%08llx\n", irqnum, in usb_hcd_request_irqs()
2640 (hcd->driver->flags & HCD_MEMORY) ? in usb_hcd_request_irqs()
2642 (unsigned long long)hcd->rsrc_start); in usb_hcd_request_irqs()
2644 hcd->irq = 0; in usb_hcd_request_irqs()
2645 if (hcd->rsrc_start) in usb_hcd_request_irqs()
2646 dev_info(hcd->self.controller, "%s 0x%08llx\n", in usb_hcd_request_irqs()
2647 (hcd->driver->flags & HCD_MEMORY) ? in usb_hcd_request_irqs()
2649 (unsigned long long)hcd->rsrc_start); in usb_hcd_request_irqs()
2658 static void usb_put_invalidate_rhdev(struct usb_hcd *hcd) in usb_put_invalidate_rhdev() argument
2663 rhdev = hcd->self.root_hub; in usb_put_invalidate_rhdev()
2664 hcd->self.root_hub = NULL; in usb_put_invalidate_rhdev()
2679 int usb_add_hcd(struct usb_hcd *hcd, in usb_add_hcd() argument
2685 if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->usb_phy) { in usb_add_hcd()
2686 struct usb_phy *phy = usb_get_phy_dev(hcd->self.controller, 0); in usb_add_hcd()
2698 hcd->usb_phy = phy; in usb_add_hcd()
2699 hcd->remove_phy = 1; in usb_add_hcd()
2703 if (IS_ENABLED(CONFIG_GENERIC_PHY) && !hcd->phy) { in usb_add_hcd()
2704 struct phy *phy = phy_get(hcd->self.controller, "usb"); in usb_add_hcd()
2722 hcd->phy = phy; in usb_add_hcd()
2723 hcd->remove_phy = 1; in usb_add_hcd()
2727 dev_info(hcd->self.controller, "%s\n", hcd->product_desc); in usb_add_hcd()
2731 if (hcd->wireless) in usb_add_hcd()
2732 clear_bit(HCD_FLAG_DEV_AUTHORIZED, &hcd->flags); in usb_add_hcd()
2734 set_bit(HCD_FLAG_DEV_AUTHORIZED, &hcd->flags); in usb_add_hcd()
2737 set_bit(HCD_FLAG_DEV_AUTHORIZED, &hcd->flags); in usb_add_hcd()
2739 clear_bit(HCD_FLAG_DEV_AUTHORIZED, &hcd->flags); in usb_add_hcd()
2741 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); in usb_add_hcd()
2744 set_bit(HCD_FLAG_INTF_AUTHORIZED, &hcd->flags); in usb_add_hcd()
2750 retval = hcd_buffer_create(hcd); in usb_add_hcd()
2752 dev_dbg(hcd->self.controller, "pool alloc failed\n"); in usb_add_hcd()
2756 retval = usb_register_bus(&hcd->self); in usb_add_hcd()
2760 rhdev = usb_alloc_dev(NULL, &hcd->self, 0); in usb_add_hcd()
2762 dev_err(hcd->self.controller, "unable to allocate root hub\n"); in usb_add_hcd()
2767 hcd->self.root_hub = rhdev; in usb_add_hcd()
2770 switch (hcd->speed) { in usb_add_hcd()
2799 set_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); in usb_add_hcd()
2804 if (hcd->driver->reset) { in usb_add_hcd()
2805 retval = hcd->driver->reset(hcd); in usb_add_hcd()
2807 dev_err(hcd->self.controller, "can't setup: %d\n", in usb_add_hcd()
2812 hcd->rh_pollable = 1; in usb_add_hcd()
2815 if (device_can_wakeup(hcd->self.controller) in usb_add_hcd()
2816 && device_can_wakeup(&hcd->self.root_hub->dev)) in usb_add_hcd()
2817 dev_dbg(hcd->self.controller, "supports USB remote wakeup\n"); in usb_add_hcd()
2820 init_giveback_urb_bh(&hcd->high_prio_bh); in usb_add_hcd()
2821 init_giveback_urb_bh(&hcd->low_prio_bh); in usb_add_hcd()
2826 if (usb_hcd_is_primary_hcd(hcd) && irqnum) { in usb_add_hcd()
2827 retval = usb_hcd_request_irqs(hcd, irqnum, irqflags); in usb_add_hcd()
2832 hcd->state = HC_STATE_RUNNING; in usb_add_hcd()
2833 retval = hcd->driver->start(hcd); in usb_add_hcd()
2835 dev_err(hcd->self.controller, "startup error %d\n", retval); in usb_add_hcd()
2840 retval = register_root_hub(hcd); in usb_add_hcd()
2850 if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) in usb_add_hcd()
2851 usb_hcd_poll_rh_status(hcd); in usb_add_hcd()
2856 clear_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); in usb_add_hcd()
2857 if (HC_IS_RUNNING(hcd->state)) in usb_add_hcd()
2858 hcd->state = HC_STATE_QUIESCING; in usb_add_hcd()
2860 hcd->rh_registered = 0; in usb_add_hcd()
2864 cancel_work_sync(&hcd->wakeup_work); in usb_add_hcd()
2870 hcd->rh_pollable = 0; in usb_add_hcd()
2871 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); in usb_add_hcd()
2872 del_timer_sync(&hcd->rh_timer); in usb_add_hcd()
2873 hcd->driver->stop(hcd); in usb_add_hcd()
2874 hcd->state = HC_STATE_HALT; in usb_add_hcd()
2875 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); in usb_add_hcd()
2876 del_timer_sync(&hcd->rh_timer); in usb_add_hcd()
2878 if (usb_hcd_is_primary_hcd(hcd) && hcd->irq > 0) in usb_add_hcd()
2879 free_irq(irqnum, hcd); in usb_add_hcd()
2883 usb_put_invalidate_rhdev(hcd); in usb_add_hcd()
2885 usb_deregister_bus(&hcd->self); in usb_add_hcd()
2887 hcd_buffer_destroy(hcd); in usb_add_hcd()
2889 if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) { in usb_add_hcd()
2890 phy_power_off(hcd->phy); in usb_add_hcd()
2891 phy_exit(hcd->phy); in usb_add_hcd()
2892 phy_put(hcd->phy); in usb_add_hcd()
2893 hcd->phy = NULL; in usb_add_hcd()
2896 if (hcd->remove_phy && hcd->usb_phy) { in usb_add_hcd()
2897 usb_phy_shutdown(hcd->usb_phy); in usb_add_hcd()
2898 usb_put_phy(hcd->usb_phy); in usb_add_hcd()
2899 hcd->usb_phy = NULL; in usb_add_hcd()
2913 void usb_remove_hcd(struct usb_hcd *hcd) in usb_remove_hcd() argument
2915 struct usb_device *rhdev = hcd->self.root_hub; in usb_remove_hcd()
2917 dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); in usb_remove_hcd()
2922 clear_bit(HCD_FLAG_RH_RUNNING, &hcd->flags); in usb_remove_hcd()
2923 if (HC_IS_RUNNING (hcd->state)) in usb_remove_hcd()
2924 hcd->state = HC_STATE_QUIESCING; in usb_remove_hcd()
2926 dev_dbg(hcd->self.controller, "roothub graceful disconnect\n"); in usb_remove_hcd()
2928 hcd->rh_registered = 0; in usb_remove_hcd()
2932 cancel_work_sync(&hcd->wakeup_work); in usb_remove_hcd()
2954 hcd->rh_pollable = 0; in usb_remove_hcd()
2955 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); in usb_remove_hcd()
2956 del_timer_sync(&hcd->rh_timer); in usb_remove_hcd()
2958 hcd->driver->stop(hcd); in usb_remove_hcd()
2959 hcd->state = HC_STATE_HALT; in usb_remove_hcd()
2962 clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); in usb_remove_hcd()
2963 del_timer_sync(&hcd->rh_timer); in usb_remove_hcd()
2965 if (usb_hcd_is_primary_hcd(hcd)) { in usb_remove_hcd()
2966 if (hcd->irq > 0) in usb_remove_hcd()
2967 free_irq(hcd->irq, hcd); in usb_remove_hcd()
2970 usb_deregister_bus(&hcd->self); in usb_remove_hcd()
2971 hcd_buffer_destroy(hcd); in usb_remove_hcd()
2973 if (IS_ENABLED(CONFIG_GENERIC_PHY) && hcd->remove_phy && hcd->phy) { in usb_remove_hcd()
2974 phy_power_off(hcd->phy); in usb_remove_hcd()
2975 phy_exit(hcd->phy); in usb_remove_hcd()
2976 phy_put(hcd->phy); in usb_remove_hcd()
2977 hcd->phy = NULL; in usb_remove_hcd()
2979 if (hcd->remove_phy && hcd->usb_phy) { in usb_remove_hcd()
2980 usb_phy_shutdown(hcd->usb_phy); in usb_remove_hcd()
2981 usb_put_phy(hcd->usb_phy); in usb_remove_hcd()
2982 hcd->usb_phy = NULL; in usb_remove_hcd()
2985 usb_put_invalidate_rhdev(hcd); in usb_remove_hcd()
2992 struct usb_hcd *hcd = platform_get_drvdata(dev); in usb_hcd_platform_shutdown() local
2994 if (hcd->driver->shutdown) in usb_hcd_platform_shutdown()
2995 hcd->driver->shutdown(hcd); in usb_hcd_platform_shutdown()