RE: [PATCH 2/2] USB: musb: gadget: fix MUSB_TXMAXP and MUSB_RXMAXP configuration

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

 



-----Original Message-----
From: Ming Lei [mailto:tom.leiming@xxxxxxxxx]
Sent: Monday, October 11, 2010 7:31 PM
To: Bob Liu
Cc: balbi@xxxxxx; Cai, Cliff; Liu, Bob; Zhang, Sonic; greg@xxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; David Brownell; Gadiyar, Anand; Mike Frysinger; Sergei Shtylyov; stable@xxxxxxxxxx
Subject: Re: [PATCH 2/2] USB: musb: gadget: fix MUSB_TXMAXP and MUSB_RXMAXP configuration

Hi Bob,

Since txstate will use dma mode1 at default to load fifo, for blackfin
we should set TXCOUNT register[1] before starting dma mode1, please
test the patch below.

BTW, the patch adjust the register write sequence according to [1], in fact
we should write TXCSR first, then start DMA.

[1], 'Peripheral Mode, Bulk IN, Transfer Size Known' section of
'USB OTG CONTROLLER' chapter.

diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
index 9cfd18b..fe5281d 100644
--- a/drivers/usb/musb/musb_gadget.c
+++ b/drivers/usb/musb/musb_gadget.c
@@ -317,10 +317,6 @@ static void txstate(struct musb *musb, struct
musb_request *req)
                        else
                                musb_ep->dma->desired_mode = 1;

-                       use_dma = use_dma && c->channel_program(
-                                       musb_ep->dma, musb_ep->packet_sz,
-                                       musb_ep->dma->desired_mode,
-                                       request->dma + request->actual, request_size);
                        if (use_dma) {
                                if (musb_ep->dma->desired_mode == 0) {
                                        /*
@@ -347,6 +343,14 @@ static void txstate(struct musb *musb, struct
musb_request *req)
                                csr &= ~MUSB_TXCSR_P_UNDERRUN;

                                musb_writew(epio, MUSB_TXCSR, csr);
+
+#ifdef CONFIG_BLACKFIN
+                               musb_writew(epio, MUSB_TXCOUNT, request_size);
+#endif
+                               use_dma = c->channel_program(
+                                       musb_ep->dma, musb_ep->packet_sz,
+                                       musb_ep->dma->desired_mode,
+                                       request->dma + request->actual, request_size);
                        }
                }

=================================================================================
Hi, Ming

Sorry for my mistake, in my test the failed case was case5 not case4.
Case5 is BULK OUT transfer, so this patch changed txstate() only won't have effect,
sorry for the noise.

Now the problem is if "fixed MUSB_TXMAXP and MUSB_RXMAXP configuration",
double buffer mode will be auto enabled on our platform which makes case5 fail sometimes.

And the root cause is in function rxstate()
===
if (csr & MUSB_RXCSR_RXPKTRDY) {
        len = musb_readw(epio, MUSB_RXCOUNT);
==
len will be read out with very strange value like 1022,514 which are not expected and
make things mess, so case5 failed.

It maybe our hardware's problem or something else, I am still not sure.

Thanks
-Bob
--
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