Re: [PATCH v3 RFC/RFT] MUSB: Do not enable TX and RX DMA at the same time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, Nov 30, 2009 at 11:53:26AM +0100, ext Sergei Shtylyov wrote:
@@ -175,6 +182,19 @@ static int dma_channel_program(struct dm
    BUG_ON(channel->status == MUSB_DMA_STATUS_UNKNOWN ||
        channel->status == MUSB_DMA_STATUS_BUSY);

+    /* In version 1.4, if two DMA channels are simultaneously
+     * enabled in opposite directions, there is a chance that
+     * the DMA controller will hang. However, it is safe to
+     * have multiple DMA channels enabled in the same direction
+     * at the same time.
+     */
+    if (musb->hwvers == MUSB_HWVERS_1400) {
+        if (musb_channel->transmit && controller->rx_active)
+            return false;
+        else if    (!musb_channel->transmit && controller->tx_active)
+            return false;

how about returning error code here ?

  How? The channel_program() method returns zero on error, and non-zero
on sucess.

if this is on top of the mode1 support then you're wrong:

 464 static void musb_ep_restart(struct musb *musb, struct musb_request *req)
 465 {
 466         DBG(3, "<== TX/IN request %p len %u on hw_ep%d%s\n",
 467                 &req->request, req->request.length, req->epnum,
 468                 req->ep->dma ? " (dma)" : "(pio)");
469 470 musb_ep_select(musb->mregs, req->epnum); 471 472 if (start_dma(musb, req) < 0)
 473                 do_pio_tx(musb, req);
 474 }

and I'm assuming Anand is using that already ?? There's only one change needed on start_dma() to actually make this work as supposed, something like:

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 808a432..6901cbd 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -250,8 +250,9 @@ static int start_dma(struct musb *musb, struct musb_request *req)
musb_ep->dma = dma; - (void) cntr->channel_program(dma, packet_sz, true, req->request.dma,
-                                    transfer_size);
+       if (cntr->channel_program(dma, packet_sz, true, req->request.dma,
+                                    transfer_size) < 0)
+               return -1;
DBG(4, "%s dma started (addr 0x%08x, len %u, CSR %04x)\n",
            musb_ep->name, req->request.dma, transfer_size, csr);

--
balbi
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux