diff options
| -rw-r--r-- | drivers/usb/host/ehci-omap.c | 6 | ||||
| -rw-r--r-- | drivers/usb/musb/blackfin.c | 1 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_core.c | 10 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_core.h | 12 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_dma.h | 3 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_gadget.c | 71 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_gadget.h | 8 | ||||
| -rw-r--r-- | drivers/usb/musb/musb_host.c | 11 | ||||
| -rw-r--r-- | drivers/usb/musb/musbhsdma.h | 19 |
9 files changed, 96 insertions, 45 deletions
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index 680f2ef4e59f..f784ceb862a3 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c | |||
| @@ -796,7 +796,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
| 796 | hcd = usb_create_hcd(&ehci_omap_hc_driver, &pdev->dev, | 796 | hcd = usb_create_hcd(&ehci_omap_hc_driver, &pdev->dev, |
| 797 | dev_name(&pdev->dev)); | 797 | dev_name(&pdev->dev)); |
| 798 | if (!hcd) { | 798 | if (!hcd) { |
| 799 | dev_dbg(&pdev->dev, "failed to create hcd with err %d\n", ret); | 799 | dev_err(&pdev->dev, "failed to create hcd with err %d\n", ret); |
| 800 | ret = -ENOMEM; | 800 | ret = -ENOMEM; |
| 801 | goto err_create_hcd; | 801 | goto err_create_hcd; |
| 802 | } | 802 | } |
| @@ -864,7 +864,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
| 864 | 864 | ||
| 865 | ret = omap_start_ehc(omap, hcd); | 865 | ret = omap_start_ehc(omap, hcd); |
| 866 | if (ret) { | 866 | if (ret) { |
| 867 | dev_dbg(&pdev->dev, "failed to start ehci\n"); | 867 | dev_err(&pdev->dev, "failed to start ehci with err %d\n", ret); |
| 868 | goto err_start; | 868 | goto err_start; |
| 869 | } | 869 | } |
| 870 | 870 | ||
| @@ -879,7 +879,7 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev) | |||
| 879 | 879 | ||
| 880 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); | 880 | ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED); |
| 881 | if (ret) { | 881 | if (ret) { |
| 882 | dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret); | 882 | dev_err(&pdev->dev, "failed to add hcd with err %d\n", ret); |
| 883 | goto err_add_hcd; | 883 | goto err_add_hcd; |
| 884 | } | 884 | } |
| 885 | 885 | ||
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c index eeba228eb2af..9d49d1cd7ce2 100644 --- a/drivers/usb/musb/blackfin.c +++ b/drivers/usb/musb/blackfin.c | |||
| @@ -404,6 +404,7 @@ static int bfin_musb_init(struct musb *musb) | |||
| 404 | musb->xceiv->set_power = bfin_musb_set_power; | 404 | musb->xceiv->set_power = bfin_musb_set_power; |
| 405 | 405 | ||
| 406 | musb->isr = blackfin_interrupt; | 406 | musb->isr = blackfin_interrupt; |
| 407 | musb->double_buffer_not_ok = true; | ||
| 407 | 408 | ||
| 408 | return 0; | 409 | return 0; |
| 409 | } | 410 | } |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 07cf394e491b..54a8bd1047d6 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
| @@ -128,12 +128,7 @@ MODULE_ALIAS("platform:" MUSB_DRIVER_NAME); | |||
| 128 | 128 | ||
| 129 | static inline struct musb *dev_to_musb(struct device *dev) | 129 | static inline struct musb *dev_to_musb(struct device *dev) |
| 130 | { | 130 | { |
| 131 | #ifdef CONFIG_USB_MUSB_HDRC_HCD | ||
| 132 | /* usbcore insists dev->driver_data is a "struct hcd *" */ | ||
| 133 | return hcd_to_musb(dev_get_drvdata(dev)); | ||
| 134 | #else | ||
| 135 | return dev_get_drvdata(dev); | 131 | return dev_get_drvdata(dev); |
| 136 | #endif | ||
| 137 | } | 132 | } |
| 138 | 133 | ||
| 139 | /*-------------------------------------------------------------------------*/ | 134 | /*-------------------------------------------------------------------------*/ |
| @@ -1876,10 +1871,9 @@ allocate_instance(struct device *dev, | |||
| 1876 | musb = kzalloc(sizeof *musb, GFP_KERNEL); | 1871 | musb = kzalloc(sizeof *musb, GFP_KERNEL); |
| 1877 | if (!musb) | 1872 | if (!musb) |
| 1878 | return NULL; | 1873 | return NULL; |
| 1879 | dev_set_drvdata(dev, musb); | ||
| 1880 | 1874 | ||
| 1881 | #endif | 1875 | #endif |
| 1882 | 1876 | dev_set_drvdata(dev, musb); | |
| 1883 | musb->mregs = mbase; | 1877 | musb->mregs = mbase; |
| 1884 | musb->ctrl_base = mbase; | 1878 | musb->ctrl_base = mbase; |
| 1885 | musb->nIrq = -ENODEV; | 1879 | musb->nIrq = -ENODEV; |
| @@ -2191,7 +2185,7 @@ static int __init musb_probe(struct platform_device *pdev) | |||
| 2191 | void __iomem *base; | 2185 | void __iomem *base; |
| 2192 | 2186 | ||
| 2193 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2187 | iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 2194 | if (!iomem || irq == 0) | 2188 | if (!iomem || irq <= 0) |
| 2195 | return -ENODEV; | 2189 | return -ENODEV; |
| 2196 | 2190 | ||
| 2197 | base = ioremap(iomem->start, resource_size(iomem)); | 2191 | base = ioremap(iomem->start, resource_size(iomem)); |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index d0c236f8e191..d74a8113ae74 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
| @@ -488,6 +488,18 @@ struct musb { | |||
| 488 | unsigned set_address:1; | 488 | unsigned set_address:1; |
| 489 | unsigned test_mode:1; | 489 | unsigned test_mode:1; |
| 490 | unsigned softconnect:1; | 490 | unsigned softconnect:1; |
| 491 | /* | ||
| 492 | * FIXME: Remove this flag. | ||
| 493 | * | ||
| 494 | * This is only added to allow Blackfin to work | ||
| 495 | * with current driver. For some unknown reason | ||
| 496 | * Blackfin doesn't work with double buffering | ||
| 497 | * and that's enabled by default. | ||
| 498 | * | ||
| 499 | * We added this flag to forcefully disable double | ||
| 500 | * buffering until we get it working. | ||
| 501 | */ | ||
| 502 | unsigned double_buffer_not_ok:1 __deprecated; | ||
| 491 | 503 | ||
| 492 | u8 address; | 504 | u8 address; |
| 493 | u8 test_mode_nr; | 505 | u8 test_mode_nr; |
diff --git a/drivers/usb/musb/musb_dma.h b/drivers/usb/musb/musb_dma.h index 916065ba9e70..3a97c4e2d4f5 100644 --- a/drivers/usb/musb/musb_dma.h +++ b/drivers/usb/musb/musb_dma.h | |||
| @@ -169,6 +169,9 @@ struct dma_controller { | |||
| 169 | dma_addr_t dma_addr, | 169 | dma_addr_t dma_addr, |
| 170 | u32 length); | 170 | u32 length); |
| 171 | int (*channel_abort)(struct dma_channel *); | 171 | int (*channel_abort)(struct dma_channel *); |
| 172 | int (*is_compatible)(struct dma_channel *channel, | ||
| 173 | u16 maxpacket, | ||
| 174 | void *buf, u32 length); | ||
| 172 | }; | 175 | }; |
| 173 | 176 | ||
| 174 | /* called after channel_program(), may indicate a fault */ | 177 | /* called after channel_program(), may indicate a fault */ |
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index ed58c6c8f15c..2fe304611dcf 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
| @@ -92,11 +92,33 @@ | |||
| 92 | 92 | ||
| 93 | /* ----------------------------------------------------------------------- */ | 93 | /* ----------------------------------------------------------------------- */ |
| 94 | 94 | ||
| 95 | #define is_buffer_mapped(req) (is_dma_capable() && \ | ||
| 96 | (req->map_state != UN_MAPPED)) | ||
| 97 | |||
| 95 | /* Maps the buffer to dma */ | 98 | /* Maps the buffer to dma */ |
| 96 | 99 | ||
| 97 | static inline void map_dma_buffer(struct musb_request *request, | 100 | static inline void map_dma_buffer(struct musb_request *request, |
| 98 | struct musb *musb) | 101 | struct musb *musb, struct musb_ep *musb_ep) |
| 99 | { | 102 | { |
| 103 | int compatible = true; | ||
| 104 | struct dma_controller *dma = musb->dma_controller; | ||
| 105 | |||
| 106 | request->map_state = UN_MAPPED; | ||
| 107 | |||
| 108 | if (!is_dma_capable() || !musb_ep->dma) | ||
| 109 | return; | ||
| 110 | |||
| 111 | /* Check if DMA engine can handle this request. | ||
| 112 | * DMA code must reject the USB request explicitly. | ||
| 113 | * Default behaviour is to map the request. | ||
| 114 | */ | ||
| 115 | if (dma->is_compatible) | ||
| 116 | compatible = dma->is_compatible(musb_ep->dma, | ||
| 117 | musb_ep->packet_sz, request->request.buf, | ||
| 118 | request->request.length); | ||
| 119 | if (!compatible) | ||
| 120 | return; | ||
| 121 | |||
| 100 | if (request->request.dma == DMA_ADDR_INVALID) { | 122 | if (request->request.dma == DMA_ADDR_INVALID) { |
| 101 | request->request.dma = dma_map_single( | 123 | request->request.dma = dma_map_single( |
| 102 | musb->controller, | 124 | musb->controller, |
| @@ -105,7 +127,7 @@ static inline void map_dma_buffer(struct musb_request *request, | |||
| 105 | request->tx | 127 | request->tx |
| 106 | ? DMA_TO_DEVICE | 128 | ? DMA_TO_DEVICE |
| 107 | : DMA_FROM_DEVICE); | 129 | : DMA_FROM_DEVICE); |
| 108 | request->mapped = 1; | 130 | request->map_state = MUSB_MAPPED; |
| 109 | } else { | 131 | } else { |
| 110 | dma_sync_single_for_device(musb->controller, | 132 | dma_sync_single_for_device(musb->controller, |
