mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fsl_usb2_udc: Add a wmb before priming endpoint.
@ 2008-06-03 15:20 Will Newton
  2008-06-03 17:24 ` Felipe Balbi
  0 siblings, 1 reply; 3+ messages in thread
From: Will Newton @ 2008-06-03 15:20 UTC (permalink / raw)
  To: linux-usb, Linux Kernel list, leoli

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

Add a wmb to fsl_queue_td before priming the endpoint. This ensures that the
modifications to the QH are seen by the hardware.

Signed-off-by: Will Newton <will.newton@gmail.com>
---
 drivers/usb/gadget/fsl_usb2_udc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/fsl_usb2_udc.c
b/drivers/usb/gadget/fsl_usb2_udc.c
index 1868754..dd06a5b 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -653,6 +653,8 @@ static int fsl_queue_td(struct fsl_ep *ep, struct
fsl_req *req)
 			| EP_QUEUE_HEAD_STATUS_HALT));
 	dQH->size_ioc_int_sts &= temp;

+	wmb();
+
 	/* Prime endpoint by writing 1 to ENDPTPRIME */
 	temp = ep_is_in(ep)
 		? (1 << (ep_index(ep) + 16))
-- 
1.5.5.2

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-fsl_usb2_udc-Add-a-wmb-before-priming-endpoint.patch --]
[-- Type: text/x-patch; name=0001-fsl_usb2_udc-Add-a-wmb-before-priming-endpoint.patch, Size: 971 bytes --]

From a14164b03dedfb2ed1bdb12a091c56bee68fce4e Mon Sep 17 00:00:00 2001
From: Will Newton <will.newton@gmail.com>
Date: Tue, 3 Jun 2008 16:15:01 +0100
Subject: [PATCH] fsl_usb2_udc: Add a wmb before priming endpoint.

Add a wmb to fsl_queue_td before priming the endpoint. This ensures that the
modifications to the QH are seen by the hardware.

Signed-off-by: Will Newton <will.newton@gmail.com>
---
 drivers/usb/gadget/fsl_usb2_udc.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c
index 1868754..dd06a5b 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.c
+++ b/drivers/usb/gadget/fsl_usb2_udc.c
@@ -653,6 +653,8 @@ static int fsl_queue_td(struct fsl_ep *ep, struct fsl_req *req)
 			| EP_QUEUE_HEAD_STATUS_HALT));
 	dQH->size_ioc_int_sts &= temp;
 
+	wmb();
+
 	/* Prime endpoint by writing 1 to ENDPTPRIME */
 	temp = ep_is_in(ep)
 		? (1 << (ep_index(ep) + 16))
-- 
1.5.5.2


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

* Re: [PATCH] fsl_usb2_udc: Add a wmb before priming endpoint.
  2008-06-03 15:20 [PATCH] fsl_usb2_udc: Add a wmb before priming endpoint Will Newton
@ 2008-06-03 17:24 ` Felipe Balbi
  2008-06-05 12:00   ` Will Newton
  0 siblings, 1 reply; 3+ messages in thread
From: Felipe Balbi @ 2008-06-03 17:24 UTC (permalink / raw)
  To: Will Newton; +Cc: linux-usb, Linux Kernel list, leoli

On Tue, Jun 03, 2008 at 04:20:25PM +0100, Will Newton wrote:
> Add a wmb to fsl_queue_td before priming the endpoint. This ensures that the
> modifications to the QH are seen by the hardware.
> 
> Signed-off-by: Will Newton <will.newton@gmail.com>
> ---
>  drivers/usb/gadget/fsl_usb2_udc.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/gadget/fsl_usb2_udc.c
> b/drivers/usb/gadget/fsl_usb2_udc.c
> index 1868754..dd06a5b 100644
> --- a/drivers/usb/gadget/fsl_usb2_udc.c
> +++ b/drivers/usb/gadget/fsl_usb2_udc.c
> @@ -653,6 +653,8 @@ static int fsl_queue_td(struct fsl_ep *ep, struct
> fsl_req *req)
>  			| EP_QUEUE_HEAD_STATUS_HALT));
>  	dQH->size_ioc_int_sts &= temp;
> 
> +	wmb();

checkpatch.pl will complain that there's not comment above the memory
barrier. Could you just add it and in one line summarize why wmb()??

> +
>  	/* Prime endpoint by writing 1 to ENDPTPRIME */
>  	temp = ep_is_in(ep)
>  		? (1 << (ep_index(ep) + 16))
> -- 
> 1.5.5.2



-- 
Best Regards,

Felipe Balbi
me@felipebalbi.com
http://blog.felipebalbi.com

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

* Re: [PATCH] fsl_usb2_udc: Add a wmb before priming endpoint.
  2008-06-03 17:24 ` Felipe Balbi
@ 2008-06-05 12:00   ` Will Newton
  0 siblings, 0 replies; 3+ messages in thread
From: Will Newton @ 2008-06-05 12:00 UTC (permalink / raw)
  To: me; +Cc: linux-usb, Linux Kernel list, leoli

On Tue, Jun 3, 2008 at 6:24 PM, Felipe Balbi <me@felipebalbi.com> wrote:
> On Tue, Jun 03, 2008 at 04:20:25PM +0100, Will Newton wrote:
>> Add a wmb to fsl_queue_td before priming the endpoint. This ensures that the
>> modifications to the QH are seen by the hardware.
>>
>> Signed-off-by: Will Newton <will.newton@gmail.com>
>> ---
>>  drivers/usb/gadget/fsl_usb2_udc.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/fsl_usb2_udc.c
>> b/drivers/usb/gadget/fsl_usb2_udc.c
>> index 1868754..dd06a5b 100644
>> --- a/drivers/usb/gadget/fsl_usb2_udc.c
>> +++ b/drivers/usb/gadget/fsl_usb2_udc.c
>> @@ -653,6 +653,8 @@ static int fsl_queue_td(struct fsl_ep *ep, struct
>> fsl_req *req)
>>                       | EP_QUEUE_HEAD_STATUS_HALT));
>>       dQH->size_ioc_int_sts &= temp;
>>
>> +     wmb();
>
> checkpatch.pl will complain that there's not comment above the memory
> barrier. Could you just add it and in one line summarize why wmb()??

Yes, I'll do that and resend the patch along with the rest of the series I have.

My checkpatch does not seem to complain about the missing comment btw.

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

end of thread, other threads:[~2008-06-05 12:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-03 15:20 [PATCH] fsl_usb2_udc: Add a wmb before priming endpoint Will Newton
2008-06-03 17:24 ` Felipe Balbi
2008-06-05 12:00   ` Will Newton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®