linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA
@ 2014-12-17  9:18 Bo Shen
  2014-12-17  9:18 ` [PATCH 2/2] USB: gadget: udc: atmel: fix possible IN hang issue Bo Shen
  2014-12-18 17:20 ` [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA Nicolas Ferre
  0 siblings, 2 replies; 5+ messages in thread
From: Bo Shen @ 2014-12-17  9:18 UTC (permalink / raw)
  To: linux-arm-kernel

According to the datasheet, when transfer using DMA, the control
setting for IN packet only need END_BUF_EN, END_BUF_IE, CH_EN,
while for OUT packet, need more two bits END_TR_EN and END_TR_IE
to be configured.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---

 drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index ce88237..63e90f5 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -716,10 +716,10 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep,
 	req->using_dma = 1;
 	req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length)
 			| USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE
-			| USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
+			| USBA_DMA_END_BUF_EN;
 
-	if (ep->is_in)
-		req->ctrl |= USBA_DMA_END_BUF_EN;
+	if (!ep->is_in)
+		req->ctrl |= USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
 
 	/*
 	 * Add this request to the queue and submit for DMA if
-- 
2.1.0.24.g4109c28

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] USB: gadget: udc: atmel: fix possible IN hang issue
  2014-12-17  9:18 [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA Bo Shen
@ 2014-12-17  9:18 ` Bo Shen
  2014-12-18 17:22   ` Nicolas Ferre
  2014-12-18 17:20 ` [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA Nicolas Ferre
  1 sibling, 1 reply; 5+ messages in thread
From: Bo Shen @ 2014-12-17  9:18 UTC (permalink / raw)
  To: linux-arm-kernel

When receive data, the RXRDY in status register set by hardware
after a new packet has been stored in the endpoint FIFO. When it
is copied from FIFO, this bit is cleared which make the FIFO can
be accessed again.

In the receive_data() function, this bit RXRDY has been cleared.
So, after the receive_data() function return, this bit should
not be cleared again, or else it may cause the accessing FIFO
corrupt, which will make the data loss.

Signed-off-by: Bo Shen <voice.shen@atmel.com>
---

 drivers/usb/gadget/udc/atmel_usba_udc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 63e90f5..93328ea 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1563,7 +1563,6 @@ static void usba_ep_irq(struct usba_udc *udc, struct usba_ep *ep)
 	if ((epstatus & epctrl) & USBA_RX_BK_RDY) {
 		DBG(DBG_BUS, "%s: RX data ready\n", ep->ep.name);
 		receive_data(ep);
-		usba_ep_writel(ep, CLR_STA, USBA_RX_BK_RDY);
 	}
 }
 
-- 
2.1.0.24.g4109c28

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA
  2014-12-17  9:18 [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA Bo Shen
  2014-12-17  9:18 ` [PATCH 2/2] USB: gadget: udc: atmel: fix possible IN hang issue Bo Shen
@ 2014-12-18 17:20 ` Nicolas Ferre
  2014-12-22 16:38   ` Felipe Balbi
  1 sibling, 1 reply; 5+ messages in thread
From: Nicolas Ferre @ 2014-12-18 17:20 UTC (permalink / raw)
  To: linux-arm-kernel

Le 17/12/2014 10:18, Bo Shen a ?crit :
> According to the datasheet, when transfer using DMA, the control
> setting for IN packet only need END_BUF_EN, END_BUF_IE, CH_EN,
> while for OUT packet, need more two bits END_TR_EN and END_TR_IE
> to be configured.
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>

Seems okay, even if I am not used to these aspects:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

I would also add a "stable" tag to these patches, something like this:

Fixes: 914a3f3b3754 (USB: add atmel_usba_udc driver)
Cc: stable at vger.kernel.org # always been there...


Felipe,

Can you take both of these patches as fixes?

> ---
> 
>  drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index ce88237..63e90f5 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -716,10 +716,10 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep *ep,
>  	req->using_dma = 1;
>  	req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length)
>  			| USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE
> -			| USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
> +			| USBA_DMA_END_BUF_EN;
>  
> -	if (ep->is_in)
> -		req->ctrl |= USBA_DMA_END_BUF_EN;
> +	if (!ep->is_in)
> +		req->ctrl |= USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
>  
>  	/*
>  	 * Add this request to the queue and submit for DMA if
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] USB: gadget: udc: atmel: fix possible IN hang issue
  2014-12-17  9:18 ` [PATCH 2/2] USB: gadget: udc: atmel: fix possible IN hang issue Bo Shen
@ 2014-12-18 17:22   ` Nicolas Ferre
  0 siblings, 0 replies; 5+ messages in thread
From: Nicolas Ferre @ 2014-12-18 17:22 UTC (permalink / raw)
  To: linux-arm-kernel

Le 17/12/2014 10:18, Bo Shen a ?crit :
> When receive data, the RXRDY in status register set by hardware
> after a new packet has been stored in the endpoint FIFO. When it
> is copied from FIFO, this bit is cleared which make the FIFO can
> be accessed again.
> 
> In the receive_data() function, this bit RXRDY has been cleared.
> So, after the receive_data() function return, this bit should
> not be cleared again, or else it may cause the accessing FIFO
> corrupt, which will make the data loss.
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>


Seems okay:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

Like the former one:

Fixes: 914a3f3b3754 (USB: add atmel_usba_udc driver)
Cc: stable at vger.kernel.org # always been there...

> ---
> 
>  drivers/usb/gadget/udc/atmel_usba_udc.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index 63e90f5..93328ea 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -1563,7 +1563,6 @@ static void usba_ep_irq(struct usba_udc *udc, struct usba_ep *ep)
>  	if ((epstatus & epctrl) & USBA_RX_BK_RDY) {
>  		DBG(DBG_BUS, "%s: RX data ready\n", ep->ep.name);
>  		receive_data(ep);
> -		usba_ep_writel(ep, CLR_STA, USBA_RX_BK_RDY);
>  	}
>  }
>  
> 


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA
  2014-12-18 17:20 ` [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA Nicolas Ferre
@ 2014-12-22 16:38   ` Felipe Balbi
  0 siblings, 0 replies; 5+ messages in thread
From: Felipe Balbi @ 2014-12-22 16:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Dec 18, 2014 at 06:20:39PM +0100, Nicolas Ferre wrote:
> Le 17/12/2014 10:18, Bo Shen a ?crit :
> > According to the datasheet, when transfer using DMA, the control
> > setting for IN packet only need END_BUF_EN, END_BUF_IE, CH_EN,
> > while for OUT packet, need more two bits END_TR_EN and END_TR_IE
> > to be configured.
> > 
> > Signed-off-by: Bo Shen <voice.shen@atmel.com>
> 
> Seems okay, even if I am not used to these aspects:
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> I would also add a "stable" tag to these patches, something like this:
> 
> Fixes: 914a3f3b3754 (USB: add atmel_usba_udc driver)
> Cc: stable at vger.kernel.org # always been there...
> 
> 
> Felipe,
> 
> Can you take both of these patches as fixes?

I'll get back to them... Still other patches to go through.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141222/4150c2bf/attachment.sig>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-22 16:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17  9:18 [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA Bo Shen
2014-12-17  9:18 ` [PATCH 2/2] USB: gadget: udc: atmel: fix possible IN hang issue Bo Shen
2014-12-18 17:22   ` Nicolas Ferre
2014-12-18 17:20 ` [PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA Nicolas Ferre
2014-12-22 16:38   ` Felipe Balbi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).