public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
To: linux-sh@vger.kernel.org
Subject: Re: [PATCH] usb: add support R8A66597 peripheral controller driver
Date: Thu, 20 Aug 2009 07:01:06 +0000	[thread overview]
Message-ID: <4A8CF4B2.9090000@renesas.com> (raw)
In-Reply-To: <4A8B86BB.1020605@renesas.com>

Alan Stern wrote:
> On Wed, 19 Aug 2009, Yoshihiro Shimoda wrote:
> 
>> The R8A66597 is Renesas USB 2.0 host and peripheral controller.
>> This controller supports USB High-speed. This driver supports
>> peripheral side.
> 
>> +static struct usb_ep_ops r8a66597_ep_ops = {
>> +	.enable		= r8a66597_enable,
>> +	.disable	= r8a66597_disable,
>> +
>> +	.alloc_request	= r8a66597_alloc_request,
>> +	.free_request	= r8a66597_free_request,
>> +
>> +	.queue		= r8a66597_queue,
>> +	.dequeue	= r8a66597_dequeue,
>> +
>> +	.set_halt	= r8a66597_set_halt,
>> +	.fifo_flush	= r8a66597_fifo_flush,
>> +};
> 
> All new peripheral controller drivers should implement the set_wedge 
> method.

Thank you very much for your comment!
I made a new patch of implement the set_wedge method.
Would you check this patch?

Best regards,
Yoshihiro Shimoda

---
Subject: [PATCH] usb: r8a66597-udc: implement the set_wedge method

fix the problem that MSC Tests of USBCV detects some warnings.

Signed-off-by: Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
---
 drivers/usb/gadget/r8a66597-udc.c |   28 ++++++++++++++++++++++++++--
 drivers/usb/gadget/r8a66597-udc.h |    1 +
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/r8a66597-udc.c b/drivers/usb/gadget/r8a66597-udc.c
index 1e3e638..473e03e 100644
--- a/drivers/usb/gadget/r8a66597-udc.c
+++ b/drivers/usb/gadget/r8a66597-udc.c
@@ -974,8 +974,13 @@ static void clear_feature(struct r8a66597 *r8a66597,
 		u16 w_index = le16_to_cpu(ctrl->wIndex);

 		ep = r8a66597->epaddr2ep[w_index & USB_ENDPOINT_NUMBER_MASK];
-		pipe_stop(r8a66597, ep->pipenum);
-		control_reg_sqclr(r8a66597, ep->pipenum);
+		if (!ep->wedge) {
+			pipe_stop(r8a66597, ep->pipenum);
+			control_reg_sqclr(r8a66597, ep->pipenum);
+			spin_unlock(&r8a66597->lock);
+			usb_ep_clear_halt(&ep->ep);
+			spin_lock(&r8a66597->lock);
+		}

 		control_end(r8a66597, 1);

@@ -1348,6 +1353,7 @@ static int r8a66597_set_halt(struct usb_ep *_ep, int value)
 		pipe_stall(ep->r8a66597, ep->pipenum);
 	} else {
 		ep->busy = 0;
+		ep->wedge = 0;
 		pipe_stop(ep->r8a66597, ep->pipenum);
 	}

@@ -1356,6 +1362,23 @@ out:
 	return ret;
 }

+static int r8a66597_set_wedge(struct usb_ep *_ep)
+{
+	struct r8a66597_ep *ep;
+	unsigned long flags;
+
+	ep = container_of(_ep, struct r8a66597_ep, ep);
+
+	if (!ep || !ep->desc)
+		return -EINVAL;
+
+	spin_lock_irqsave(&ep->r8a66597->lock, flags);
+	ep->wedge = 1;
+	spin_unlock_irqrestore(&ep->r8a66597->lock, flags);
+
+	return usb_ep_set_halt(_ep);
+}
+
 static void r8a66597_fifo_flush(struct usb_ep *_ep)
 {
 	struct r8a66597_ep *ep;
@@ -1381,6 +1404,7 @@ static struct usb_ep_ops r8a66597_ep_ops = {
 	.dequeue	= r8a66597_dequeue,

 	.set_halt	= r8a66597_set_halt,
+	.set_wedge	= r8a66597_set_wedge,
 	.fifo_flush	= r8a66597_fifo_flush,
 };

diff --git a/drivers/usb/gadget/r8a66597-udc.h b/drivers/usb/gadget/r8a66597-udc.h
index 7d9a325..3ff922c 100644
--- a/drivers/usb/gadget/r8a66597-udc.h
+++ b/drivers/usb/gadget/r8a66597-udc.h
@@ -73,6 +73,7 @@ struct r8a66597_ep {

 	struct list_head	queue;
 	unsigned		busy:1;
+	unsigned		wedge:1;
 	unsigned		internal_ccpl:1;	/* use only control */

 	/* this member can able to after r8a66597_enable */
-- 
1.5.5


  parent reply	other threads:[~2009-08-20  7:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-19  4:59 [PATCH] usb: add support R8A66597 peripheral controller driver Yoshihiro Shimoda
2009-08-19 10:22 ` Magnus Damm
2009-08-19 14:14 ` Greg KH
2009-08-19 14:44 ` Alan Stern
2009-08-20  1:49 ` Paul Mundt
2009-08-20  7:01 ` Yoshihiro Shimoda [this message]
2009-08-20 14:18 ` Alan Stern
2009-08-20 23:44 ` Paul Mundt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A8CF4B2.9090000@renesas.com \
    --to=shimoda.yoshihiro@renesas.com \
    --cc=linux-sh@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox