]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - drivers/usb/musb/musbhsdma.c
Merge branch 'master' into tk71
[mv-sheeva.git] / drivers / usb / musb / musbhsdma.c
index 6dc107f252455d1f9133a57a320bd40f285ba6ae..0144a2d481fd8daf8b8c3ab30102e57154096c5e 100644 (file)
@@ -91,7 +91,7 @@ static struct dma_channel *dma_channel_allocate(struct dma_controller *c,
                        channel = &(musb_channel->channel);
                        channel->private_data = musb_channel;
                        channel->status = MUSB_DMA_STATUS_FREE;
-                       channel->max_len = 0x10000;
+                       channel->max_len = 0x100000;
                        /* Tx => mode 1; Rx => mode 0 */
                        channel->desired_mode = transmit;
                        channel->actual_len = 0;
@@ -158,6 +158,8 @@ static int dma_channel_program(struct dma_channel *channel,
                                dma_addr_t dma_addr, u32 len)
 {
        struct musb_dma_channel *musb_channel = channel->private_data;
+       struct musb_dma_controller *controller = musb_channel->controller;
+       struct musb *musb = controller->private_data;
 
        DBG(2, "ep%d-%s pkt_sz %d, dma_addr 0x%x length %d, mode %d\n",
                musb_channel->epnum,
@@ -167,6 +169,18 @@ static int dma_channel_program(struct dma_channel *channel,
        BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN ||
                channel->status == MUSB_DMA_STATUS_BUSY);
 
+       /*
+        * The DMA engine in RTL1.8 and above cannot handle
+        * DMA addresses that are not aligned to a 4 byte boundary.
+        * It ends up masking the last two bits of the address
+        * programmed in DMA_ADDR.
+        *
+        * Fail such DMA transfers, so that the backup PIO mode
+        * can carry out the transfer
+        */
+       if ((musb->hwvers >= MUSB_HWVERS_1800) && (dma_addr % 4))
+               return false;
+
        channel->actual_len = 0;
        musb_channel->start_addr = dma_addr;
        musb_channel->len = len;
@@ -363,7 +377,7 @@ dma_controller_create(struct musb *musb, void __iomem *base)
        struct musb_dma_controller *controller;
        struct device *dev = musb->controller;
        struct platform_device *pdev = to_platform_device(dev);
-       int irq = platform_get_irq(pdev, 1);
+       int irq = platform_get_irq_byname(pdev, "dma");
 
        if (irq == 0) {
                dev_err(dev, "No DMA interrupt line!\n");