mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
usb: add a HCD_DMA flag instead of guestimating DMA capabilities
The usb core is the only major place in the kernel that checks for a non-NULL device dma_mask to see if a device is DMA capable. This is generally a bad idea, as all major busses always set up a DMA mask, even if the device is not DMA capable - in fact bus layers like PCI can't even know if a device is DMA capable at enumeration time. This leads to lots of workaround in HCD drivers, and also prevented us from setting up a DMA mask for platform devices by default last time we tried. Replace this guess with an explicit HCD_DMA that is set by drivers that appear to have DMA support. Signed-off-by: Christoph Hellwig <hch@lst.de> Link: https://lore.kernel.org/r/20190816062435.881-4-hch@lst.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0709831a50
commit
7b81cb6bdd
@@ -3512,7 +3512,7 @@ static const struct hc_driver octeon_hc_driver = {
|
||||
.product_desc = "Octeon Host Controller",
|
||||
.hcd_priv_size = sizeof(struct octeon_hcd),
|
||||
.irq = octeon_usb_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB2,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB2,
|
||||
.start = octeon_usb_start,
|
||||
.stop = octeon_usb_stop,
|
||||
.urb_enqueue = octeon_usb_urb_enqueue,
|
||||
|
||||
@@ -2454,7 +2454,6 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver,
|
||||
hcd->self.controller = dev;
|
||||
hcd->self.sysdev = sysdev;
|
||||
hcd->self.bus_name = bus_name;
|
||||
hcd->self.uses_dma = (sysdev->dma_mask != NULL);
|
||||
|
||||
timer_setup(&hcd->rh_timer, rh_timer_func, 0);
|
||||
#ifdef CONFIG_PM
|
||||
|
||||
@@ -5062,13 +5062,13 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
|
||||
dwc2_hc_driver.reset_device = dwc2_reset_device;
|
||||
}
|
||||
|
||||
if (hsotg->params.host_dma)
|
||||
dwc2_hc_driver.flags |= HCD_DMA;
|
||||
|
||||
hcd = usb_create_hcd(&dwc2_hc_driver, hsotg->dev, dev_name(hsotg->dev));
|
||||
if (!hcd)
|
||||
goto error1;
|
||||
|
||||
if (!hsotg->params.host_dma)
|
||||
hcd->self.uses_dma = 0;
|
||||
|
||||
hcd->has_tt = 1;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
|
||||
@@ -30,7 +30,7 @@ static const struct hc_driver ehci_grlib_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ehci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -1193,7 +1193,7 @@ static const struct hc_driver ehci_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ehci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -250,7 +250,7 @@ static const struct hc_driver ehci_msp_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ehci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -31,7 +31,7 @@ static const struct hc_driver ehci_ppc_of_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ehci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -59,7 +59,7 @@ static const struct hc_driver ps3_ehci_hc_driver = {
|
||||
.product_desc = "PS3 EHCI Host Controller",
|
||||
.hcd_priv_size = sizeof(struct ehci_hcd),
|
||||
.irq = ehci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,
|
||||
.reset = ps3_ehci_hc_reset,
|
||||
.start = ehci_run,
|
||||
.stop = ehci_stop,
|
||||
|
||||
@@ -33,7 +33,7 @@ static const struct hc_driver ehci_sh_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ehci_irq,
|
||||
.flags = HCD_USB2 | HCD_MEMORY | HCD_BH,
|
||||
.flags = HCD_USB2 | HCD_DMA | HCD_MEMORY | HCD_BH,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -66,7 +66,7 @@ static const struct hc_driver ehci_xilinx_of_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ehci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB2 | HCD_BH,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -538,7 +538,7 @@ static const struct hc_driver fhci_driver = {
|
||||
|
||||
/* generic hardware linkage */
|
||||
.irq = fhci_irq,
|
||||
.flags = HCD_USB11 | HCD_MEMORY,
|
||||
.flags = HCD_DMA | HCD_USB11 | HCD_MEMORY,
|
||||
|
||||
/* basic lifecycle operation */
|
||||
.start = fhci_start,
|
||||
|
||||
@@ -5508,7 +5508,7 @@ static const struct hc_driver fotg210_fotg210_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = fotg210_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB2,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB2,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -1771,7 +1771,7 @@ static const struct hc_driver imx21_hc_driver = {
|
||||
.product_desc = "IMX21 USB Host Controller",
|
||||
.hcd_priv_size = sizeof(struct imx21),
|
||||
|
||||
.flags = HCD_USB11,
|
||||
.flags = HCD_DMA | HCD_USB11,
|
||||
.irq = imx21_irq,
|
||||
|
||||
.reset = imx21_hc_reset,
|
||||
|
||||
@@ -1581,12 +1581,6 @@ static int isp116x_probe(struct platform_device *pdev)
|
||||
irq = ires->start;
|
||||
irqflags = ires->flags & IRQF_TRIGGER_MASK;
|
||||
|
||||
if (pdev->dev.dma_mask) {
|
||||
DBG("DMA not supported\n");
|
||||
ret = -EINVAL;
|
||||
goto err1;
|
||||
}
|
||||
|
||||
if (!request_mem_region(addr->start, 2, hcd_name)) {
|
||||
ret = -EBUSY;
|
||||
goto err1;
|
||||
|
||||
@@ -2645,11 +2645,6 @@ static int isp1362_probe(struct platform_device *pdev)
|
||||
if (pdev->num_resources < 3)
|
||||
return -ENODEV;
|
||||
|
||||
if (pdev->dev.dma_mask) {
|
||||
DBG(1, "won't do DMA");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
|
||||
if (!irq_res)
|
||||
return -ENODEV;
|
||||
|
||||
@@ -1178,7 +1178,7 @@ static const struct hc_driver ohci_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ohci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB11,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB11,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -50,7 +50,7 @@ static const struct hc_driver ohci_ppc_of_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ohci_irq,
|
||||
.flags = HCD_USB11 | HCD_MEMORY,
|
||||
.flags = HCD_USB11 | HCD_DMA | HCD_MEMORY,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -46,7 +46,7 @@ static const struct hc_driver ps3_ohci_hc_driver = {
|
||||
.product_desc = "PS3 OHCI Host Controller",
|
||||
.hcd_priv_size = sizeof(struct ohci_hcd),
|
||||
.irq = ohci_irq,
|
||||
.flags = HCD_MEMORY | HCD_USB11,
|
||||
.flags = HCD_MEMORY | HCD_DMA | HCD_USB11,
|
||||
.reset = ps3_ohci_hc_reset,
|
||||
.start = ps3_ohci_hc_start,
|
||||
.stop = ohci_stop,
|
||||
|
||||
@@ -84,7 +84,7 @@ static const struct hc_driver ohci_sa1111_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ohci_irq,
|
||||
.flags = HCD_USB11 | HCD_MEMORY,
|
||||
.flags = HCD_USB11 | HCD_DMA | HCD_MEMORY,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
@@ -49,7 +49,7 @@ static const struct hc_driver ohci_sm501_hc_driver = {
|
||||
* generic hardware linkage
|
||||
*/
|
||||
.irq = ohci_irq,
|
||||
.flags = HCD_USB11 | HCD_MEMORY,
|
||||
.flags = HCD_USB11 | HCD_DMA | HCD_MEMORY,
|
||||
|
||||
/*
|
||||
* basic lifecycle operations
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user