Loading drivers/usb/core/hcd.c +8 −19 Original line number Diff line number Diff line Loading @@ -2257,39 +2257,28 @@ int usb_hcd_sec_event_ring_cleanup(struct usb_device *udev, /*-------------------------------------------------------------------------*/ dma_addr_t usb_hcd_get_sec_event_ring_dma_addr(struct usb_device *udev, unsigned int intr_num) { struct usb_hcd *hcd = bus_to_hcd(udev->bus); if (!HCD_RH_RUNNING(hcd)) return 0; return hcd->driver->get_sec_event_ring_dma_addr(hcd, intr_num); } dma_addr_t usb_hcd_get_dcba_dma_addr(struct usb_device *udev) phys_addr_t usb_hcd_get_sec_event_ring_phys_addr(struct usb_device *udev, unsigned int intr_num, dma_addr_t *dma) { struct usb_hcd *hcd = bus_to_hcd(udev->bus); if (!HCD_RH_RUNNING(hcd)) return 0; return hcd->driver->get_dcba_dma_addr(hcd, udev); return hcd->driver->get_sec_event_ring_phys_addr(hcd, intr_num, dma); } dma_addr_t usb_hcd_get_xfer_ring_dma_addr(struct usb_device *udev, struct usb_host_endpoint *ep) phys_addr_t usb_hcd_get_xfer_ring_phys_addr(struct usb_device *udev, struct usb_host_endpoint *ep, dma_addr_t *dma) { struct usb_hcd *hcd = bus_to_hcd(udev->bus); if (!HCD_RH_RUNNING(hcd)) return 0; return hcd->driver->get_xfer_ring_dma_addr(hcd, udev, ep); return hcd->driver->get_xfer_ring_phys_addr(hcd, udev, ep, dma); } int usb_hcd_get_controller_id(struct usb_device *udev) Loading drivers/usb/core/usb.c +9 −22 Original line number Diff line number Diff line Loading @@ -838,43 +838,30 @@ EXPORT_SYMBOL(usb_sec_event_ring_setup); int usb_sec_event_ring_cleanup(struct usb_device *dev, unsigned int intr_num) { if (dev->state == USB_STATE_NOTATTACHED) return 0; return usb_hcd_sec_event_ring_cleanup(dev, intr_num); } EXPORT_SYMBOL(usb_sec_event_ring_cleanup); dma_addr_t usb_get_sec_event_ring_dma_addr(struct usb_device *dev, unsigned int intr_num) { if (dev->state == USB_STATE_NOTATTACHED) return 0; return usb_hcd_get_sec_event_ring_dma_addr(dev, intr_num); } EXPORT_SYMBOL(usb_get_sec_event_ring_dma_addr); dma_addr_t usb_get_dcba_dma_addr(struct usb_device *dev) phys_addr_t usb_get_sec_event_ring_phys_addr(struct usb_device *dev, unsigned int intr_num, dma_addr_t *dma) { if (dev->state == USB_STATE_NOTATTACHED) return 0; return usb_hcd_get_dcba_dma_addr(dev); return usb_hcd_get_sec_event_ring_phys_addr(dev, intr_num, dma); } EXPORT_SYMBOL(usb_get_dcba_dma_addr); EXPORT_SYMBOL(usb_get_sec_event_ring_phys_addr); dma_addr_t usb_get_xfer_ring_dma_addr(struct usb_device *dev, struct usb_host_endpoint *ep) phys_addr_t usb_get_xfer_ring_phys_addr(struct usb_device *dev, struct usb_host_endpoint *ep, dma_addr_t *dma) { if (dev->state == USB_STATE_NOTATTACHED) return 0; return usb_hcd_get_xfer_ring_dma_addr(dev, ep); return usb_hcd_get_xfer_ring_phys_addr(dev, ep, dma); } EXPORT_SYMBOL(usb_get_xfer_ring_dma_addr); EXPORT_SYMBOL(usb_get_xfer_ring_phys_addr); int usb_get_controller_id(struct usb_device *dev) { Loading drivers/usb/host/xhci-plat.c +19 −19 Original line number Diff line number Diff line Loading @@ -241,16 +241,10 @@ static int xhci_plat_probe(struct platform_device *pdev) return ret; } pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, dev_name(&pdev->dev), NULL); if (!hcd) { ret = -ENOMEM; goto disable_runtime; } if (!hcd) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&pdev->dev, res); Loading Loading @@ -286,6 +280,15 @@ static int xhci_plat_probe(struct platform_device *pdev) goto disable_reg_clk; } if (pdev->dev.parent) pm_runtime_resume(pdev->dev.parent); pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); xhci = hcd_to_xhci(hcd); priv_match = of_device_get_match_data(&pdev->dev); if (priv_match) { Loading Loading @@ -360,13 +363,9 @@ static int xhci_plat_probe(struct platform_device *pdev) __func__); device_enable_async_suspend(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); /* * Prevent runtime pm from being on as default, users should enable * runtime pm using power/control in sysfs. */ pm_runtime_forbid(&pdev->dev); pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); return 0; Loading @@ -389,10 +388,6 @@ static int xhci_plat_probe(struct platform_device *pdev) put_hcd: usb_put_hcd(hcd); disable_runtime: pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); return ret; } Loading Loading @@ -444,6 +439,11 @@ static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) struct usb_hcd *hcd = dev_get_drvdata(dev); struct xhci_hcd *xhci = hcd_to_xhci(hcd); if (!xhci) return 0; dev_dbg(dev, "xhci-plat runtime suspend\n"); return xhci_suspend(xhci, true); } Loading Loading @@ -473,7 +473,7 @@ static const struct dev_pm_ops xhci_plat_pm_ops = { SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume, NULL) xhci_plat_runtime_idle) }; static const struct acpi_device_id usb_xhci_acpi_match[] = { Loading drivers/usb/host/xhci.c +37 −20 Original line number Diff line number Diff line Loading @@ -5107,10 +5107,13 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) } EXPORT_SYMBOL_GPL(xhci_gen_setup); dma_addr_t xhci_get_sec_event_ring_dma_addr(struct usb_hcd *hcd, unsigned int intr_num) static phys_addr_t xhci_get_sec_event_ring_phys_addr(struct usb_hcd *hcd, unsigned int intr_num, dma_addr_t *dma) { struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct device *dev = hcd->self.sysdev; struct sg_table sgt; phys_addr_t pa; if (intr_num >= xhci->max_interrupters) { xhci_err(xhci, "intr num %d >= max intrs %d\n", intr_num, Loading @@ -5120,31 +5123,34 @@ dma_addr_t xhci_get_sec_event_ring_dma_addr(struct usb_hcd *hcd, if (!(xhci->xhc_state & XHCI_STATE_HALTED) && xhci->sec_event_ring && xhci->sec_event_ring[intr_num] && xhci->sec_event_ring[intr_num]->first_seg) return xhci->sec_event_ring[intr_num]->first_seg->dma; && xhci->sec_event_ring[intr_num]->first_seg) { return 0; } dma_get_sgtable(dev, &sgt, xhci->sec_event_ring[intr_num]->first_seg->trbs, xhci->sec_event_ring[intr_num]->first_seg->dma, TRB_SEGMENT_SIZE); dma_addr_t xhci_get_dcba_dma_addr(struct usb_hcd *hcd, struct usb_device *udev) { struct xhci_hcd *xhci = hcd_to_xhci(hcd); *dma = xhci->sec_event_ring[intr_num]->first_seg->dma; if (!(xhci->xhc_state & XHCI_STATE_HALTED) && xhci->dcbaa) return xhci->dcbaa->dev_context_ptrs[udev->slot_id]; pa = page_to_phys(sg_page(sgt.sgl)); sg_free_table(&sgt); return pa; } return 0; } dma_addr_t xhci_get_xfer_ring_dma_addr(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep) static phys_addr_t xhci_get_xfer_ring_phys_addr(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep, dma_addr_t *dma) { int ret; unsigned int ep_index; struct xhci_virt_device *virt_dev; struct device *dev = hcd->self.sysdev; struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct sg_table sgt; phys_addr_t pa; ret = xhci_check_args(hcd, udev, ep, 1, true, __func__); if (ret <= 0) { Loading @@ -5156,8 +5162,20 @@ dma_addr_t xhci_get_xfer_ring_dma_addr(struct usb_hcd *hcd, ep_index = xhci_get_endpoint_index(&ep->desc); if (virt_dev->eps[ep_index].ring && virt_dev->eps[ep_index].ring->first_seg) return virt_dev->eps[ep_index].ring->first_seg->dma; virt_dev->eps[ep_index].ring->first_seg) { dma_get_sgtable(dev, &sgt, virt_dev->eps[ep_index].ring->first_seg->trbs, virt_dev->eps[ep_index].ring->first_seg->dma, TRB_SEGMENT_SIZE); *dma = virt_dev->eps[ep_index].ring->first_seg->dma; pa = page_to_phys(sg_page(sgt.sgl)); sg_free_table(&sgt); return pa; } return 0; } Loading Loading @@ -5231,9 +5249,8 @@ static const struct hc_driver xhci_hc_driver = { .find_raw_port_number = xhci_find_raw_port_number, .sec_event_ring_setup = xhci_sec_event_ring_setup, .sec_event_ring_cleanup = xhci_sec_event_ring_cleanup, .get_sec_event_ring_dma_addr = xhci_get_sec_event_ring_dma_addr, .get_xfer_ring_dma_addr = xhci_get_xfer_ring_dma_addr, .get_dcba_dma_addr = xhci_get_dcba_dma_addr, .get_sec_event_ring_phys_addr = xhci_get_sec_event_ring_phys_addr, .get_xfer_ring_phys_addr = xhci_get_xfer_ring_phys_addr, .get_core_id = xhci_get_core_id, }; Loading include/linux/usb.h +4 −5 Original line number Diff line number Diff line Loading @@ -831,11 +831,10 @@ extern int usb_sec_event_ring_setup(struct usb_device *dev, extern int usb_sec_event_ring_cleanup(struct usb_device *dev, unsigned int intr_num); extern dma_addr_t usb_get_sec_event_ring_dma_addr(struct usb_device *dev, unsigned int intr_num); extern dma_addr_t usb_get_dcba_dma_addr(struct usb_device *dev); extern dma_addr_t usb_get_xfer_ring_dma_addr(struct usb_device *dev, struct usb_host_endpoint *ep); extern phys_addr_t usb_get_sec_event_ring_phys_addr( struct usb_device *dev, unsigned int intr_num, dma_addr_t *dma); extern phys_addr_t usb_get_xfer_ring_phys_addr(struct usb_device *dev, struct usb_host_endpoint *ep, dma_addr_t *dma); extern int usb_get_controller_id(struct usb_device *dev); /* Sets up a group of bulk endpoints to support multiple stream IDs. */ Loading Loading
drivers/usb/core/hcd.c +8 −19 Original line number Diff line number Diff line Loading @@ -2257,39 +2257,28 @@ int usb_hcd_sec_event_ring_cleanup(struct usb_device *udev, /*-------------------------------------------------------------------------*/ dma_addr_t usb_hcd_get_sec_event_ring_dma_addr(struct usb_device *udev, unsigned int intr_num) { struct usb_hcd *hcd = bus_to_hcd(udev->bus); if (!HCD_RH_RUNNING(hcd)) return 0; return hcd->driver->get_sec_event_ring_dma_addr(hcd, intr_num); } dma_addr_t usb_hcd_get_dcba_dma_addr(struct usb_device *udev) phys_addr_t usb_hcd_get_sec_event_ring_phys_addr(struct usb_device *udev, unsigned int intr_num, dma_addr_t *dma) { struct usb_hcd *hcd = bus_to_hcd(udev->bus); if (!HCD_RH_RUNNING(hcd)) return 0; return hcd->driver->get_dcba_dma_addr(hcd, udev); return hcd->driver->get_sec_event_ring_phys_addr(hcd, intr_num, dma); } dma_addr_t usb_hcd_get_xfer_ring_dma_addr(struct usb_device *udev, struct usb_host_endpoint *ep) phys_addr_t usb_hcd_get_xfer_ring_phys_addr(struct usb_device *udev, struct usb_host_endpoint *ep, dma_addr_t *dma) { struct usb_hcd *hcd = bus_to_hcd(udev->bus); if (!HCD_RH_RUNNING(hcd)) return 0; return hcd->driver->get_xfer_ring_dma_addr(hcd, udev, ep); return hcd->driver->get_xfer_ring_phys_addr(hcd, udev, ep, dma); } int usb_hcd_get_controller_id(struct usb_device *udev) Loading
drivers/usb/core/usb.c +9 −22 Original line number Diff line number Diff line Loading @@ -838,43 +838,30 @@ EXPORT_SYMBOL(usb_sec_event_ring_setup); int usb_sec_event_ring_cleanup(struct usb_device *dev, unsigned int intr_num) { if (dev->state == USB_STATE_NOTATTACHED) return 0; return usb_hcd_sec_event_ring_cleanup(dev, intr_num); } EXPORT_SYMBOL(usb_sec_event_ring_cleanup); dma_addr_t usb_get_sec_event_ring_dma_addr(struct usb_device *dev, unsigned int intr_num) { if (dev->state == USB_STATE_NOTATTACHED) return 0; return usb_hcd_get_sec_event_ring_dma_addr(dev, intr_num); } EXPORT_SYMBOL(usb_get_sec_event_ring_dma_addr); dma_addr_t usb_get_dcba_dma_addr(struct usb_device *dev) phys_addr_t usb_get_sec_event_ring_phys_addr(struct usb_device *dev, unsigned int intr_num, dma_addr_t *dma) { if (dev->state == USB_STATE_NOTATTACHED) return 0; return usb_hcd_get_dcba_dma_addr(dev); return usb_hcd_get_sec_event_ring_phys_addr(dev, intr_num, dma); } EXPORT_SYMBOL(usb_get_dcba_dma_addr); EXPORT_SYMBOL(usb_get_sec_event_ring_phys_addr); dma_addr_t usb_get_xfer_ring_dma_addr(struct usb_device *dev, struct usb_host_endpoint *ep) phys_addr_t usb_get_xfer_ring_phys_addr(struct usb_device *dev, struct usb_host_endpoint *ep, dma_addr_t *dma) { if (dev->state == USB_STATE_NOTATTACHED) return 0; return usb_hcd_get_xfer_ring_dma_addr(dev, ep); return usb_hcd_get_xfer_ring_phys_addr(dev, ep, dma); } EXPORT_SYMBOL(usb_get_xfer_ring_dma_addr); EXPORT_SYMBOL(usb_get_xfer_ring_phys_addr); int usb_get_controller_id(struct usb_device *dev) { Loading
drivers/usb/host/xhci-plat.c +19 −19 Original line number Diff line number Diff line Loading @@ -241,16 +241,10 @@ static int xhci_plat_probe(struct platform_device *pdev) return ret; } pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); pm_runtime_get_noresume(&pdev->dev); hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, dev_name(&pdev->dev), NULL); if (!hcd) { ret = -ENOMEM; goto disable_runtime; } if (!hcd) return -ENOMEM; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); hcd->regs = devm_ioremap_resource(&pdev->dev, res); Loading Loading @@ -286,6 +280,15 @@ static int xhci_plat_probe(struct platform_device *pdev) goto disable_reg_clk; } if (pdev->dev.parent) pm_runtime_resume(pdev->dev.parent); pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); pm_runtime_get_sync(&pdev->dev); xhci = hcd_to_xhci(hcd); priv_match = of_device_get_match_data(&pdev->dev); if (priv_match) { Loading Loading @@ -360,13 +363,9 @@ static int xhci_plat_probe(struct platform_device *pdev) __func__); device_enable_async_suspend(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); /* * Prevent runtime pm from being on as default, users should enable * runtime pm using power/control in sysfs. */ pm_runtime_forbid(&pdev->dev); pm_runtime_mark_last_busy(&pdev->dev); pm_runtime_put_autosuspend(&pdev->dev); return 0; Loading @@ -389,10 +388,6 @@ static int xhci_plat_probe(struct platform_device *pdev) put_hcd: usb_put_hcd(hcd); disable_runtime: pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); return ret; } Loading Loading @@ -444,6 +439,11 @@ static int __maybe_unused xhci_plat_runtime_suspend(struct device *dev) struct usb_hcd *hcd = dev_get_drvdata(dev); struct xhci_hcd *xhci = hcd_to_xhci(hcd); if (!xhci) return 0; dev_dbg(dev, "xhci-plat runtime suspend\n"); return xhci_suspend(xhci, true); } Loading Loading @@ -473,7 +473,7 @@ static const struct dev_pm_ops xhci_plat_pm_ops = { SET_RUNTIME_PM_OPS(xhci_plat_runtime_suspend, xhci_plat_runtime_resume, NULL) xhci_plat_runtime_idle) }; static const struct acpi_device_id usb_xhci_acpi_match[] = { Loading
drivers/usb/host/xhci.c +37 −20 Original line number Diff line number Diff line Loading @@ -5107,10 +5107,13 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) } EXPORT_SYMBOL_GPL(xhci_gen_setup); dma_addr_t xhci_get_sec_event_ring_dma_addr(struct usb_hcd *hcd, unsigned int intr_num) static phys_addr_t xhci_get_sec_event_ring_phys_addr(struct usb_hcd *hcd, unsigned int intr_num, dma_addr_t *dma) { struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct device *dev = hcd->self.sysdev; struct sg_table sgt; phys_addr_t pa; if (intr_num >= xhci->max_interrupters) { xhci_err(xhci, "intr num %d >= max intrs %d\n", intr_num, Loading @@ -5120,31 +5123,34 @@ dma_addr_t xhci_get_sec_event_ring_dma_addr(struct usb_hcd *hcd, if (!(xhci->xhc_state & XHCI_STATE_HALTED) && xhci->sec_event_ring && xhci->sec_event_ring[intr_num] && xhci->sec_event_ring[intr_num]->first_seg) return xhci->sec_event_ring[intr_num]->first_seg->dma; && xhci->sec_event_ring[intr_num]->first_seg) { return 0; } dma_get_sgtable(dev, &sgt, xhci->sec_event_ring[intr_num]->first_seg->trbs, xhci->sec_event_ring[intr_num]->first_seg->dma, TRB_SEGMENT_SIZE); dma_addr_t xhci_get_dcba_dma_addr(struct usb_hcd *hcd, struct usb_device *udev) { struct xhci_hcd *xhci = hcd_to_xhci(hcd); *dma = xhci->sec_event_ring[intr_num]->first_seg->dma; if (!(xhci->xhc_state & XHCI_STATE_HALTED) && xhci->dcbaa) return xhci->dcbaa->dev_context_ptrs[udev->slot_id]; pa = page_to_phys(sg_page(sgt.sgl)); sg_free_table(&sgt); return pa; } return 0; } dma_addr_t xhci_get_xfer_ring_dma_addr(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep) static phys_addr_t xhci_get_xfer_ring_phys_addr(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep, dma_addr_t *dma) { int ret; unsigned int ep_index; struct xhci_virt_device *virt_dev; struct device *dev = hcd->self.sysdev; struct xhci_hcd *xhci = hcd_to_xhci(hcd); struct sg_table sgt; phys_addr_t pa; ret = xhci_check_args(hcd, udev, ep, 1, true, __func__); if (ret <= 0) { Loading @@ -5156,8 +5162,20 @@ dma_addr_t xhci_get_xfer_ring_dma_addr(struct usb_hcd *hcd, ep_index = xhci_get_endpoint_index(&ep->desc); if (virt_dev->eps[ep_index].ring && virt_dev->eps[ep_index].ring->first_seg) return virt_dev->eps[ep_index].ring->first_seg->dma; virt_dev->eps[ep_index].ring->first_seg) { dma_get_sgtable(dev, &sgt, virt_dev->eps[ep_index].ring->first_seg->trbs, virt_dev->eps[ep_index].ring->first_seg->dma, TRB_SEGMENT_SIZE); *dma = virt_dev->eps[ep_index].ring->first_seg->dma; pa = page_to_phys(sg_page(sgt.sgl)); sg_free_table(&sgt); return pa; } return 0; } Loading Loading @@ -5231,9 +5249,8 @@ static const struct hc_driver xhci_hc_driver = { .find_raw_port_number = xhci_find_raw_port_number, .sec_event_ring_setup = xhci_sec_event_ring_setup, .sec_event_ring_cleanup = xhci_sec_event_ring_cleanup, .get_sec_event_ring_dma_addr = xhci_get_sec_event_ring_dma_addr, .get_xfer_ring_dma_addr = xhci_get_xfer_ring_dma_addr, .get_dcba_dma_addr = xhci_get_dcba_dma_addr, .get_sec_event_ring_phys_addr = xhci_get_sec_event_ring_phys_addr, .get_xfer_ring_phys_addr = xhci_get_xfer_ring_phys_addr, .get_core_id = xhci_get_core_id, }; Loading
include/linux/usb.h +4 −5 Original line number Diff line number Diff line Loading @@ -831,11 +831,10 @@ extern int usb_sec_event_ring_setup(struct usb_device *dev, extern int usb_sec_event_ring_cleanup(struct usb_device *dev, unsigned int intr_num); extern dma_addr_t usb_get_sec_event_ring_dma_addr(struct usb_device *dev, unsigned int intr_num); extern dma_addr_t usb_get_dcba_dma_addr(struct usb_device *dev); extern dma_addr_t usb_get_xfer_ring_dma_addr(struct usb_device *dev, struct usb_host_endpoint *ep); extern phys_addr_t usb_get_sec_event_ring_phys_addr( struct usb_device *dev, unsigned int intr_num, dma_addr_t *dma); extern phys_addr_t usb_get_xfer_ring_phys_addr(struct usb_device *dev, struct usb_host_endpoint *ep, dma_addr_t *dma); extern int usb_get_controller_id(struct usb_device *dev); /* Sets up a group of bulk endpoints to support multiple stream IDs. */ Loading