From: Pavankumar Kondeti <pkondeti@codeaurora.org>
To: greg@kroah.com, linux-usb@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, davidb@codeaurora.org,
mina86@mina86.com, Anji jonnala <anjir@codeaurora.org>,
Pavankumar Kondeti <pkondeti@codeaurora.org>
Subject: [PATCH V2 6/7] USB: gadget: Initialize ep0 once while registering gadget in ci13xxx_udc
Date: Mon, 2 May 2011 11:56:32 +0530 [thread overview]
Message-ID: <1304317593-21808-7-git-send-email-pkondeti@codeaurora.org> (raw)
In-Reply-To: <1304317593-21808-1-git-send-email-pkondeti@codeaurora.org>
From: Anji jonnala <anjir@codeaurora.org>
Some of the simulators may cache the ep0 maxpacket size to zero
if the ep0 dQh is not setup before enabling the pullup. Hence
Setup ep0 and initialize the dQh fields once while registering the
gadget(before enabling the pullup).
HSUSB Chipidea link controller spec says ep0 is enabled always
in the HW. Hence disabling and enabling the ep0 as a part of
reset interrupt is unneccesary.
Remove the disable/enable ep0 logic from reset interrupt handling.
Signed-off-by: Anji jonnala <anjir@codeaurora.org>
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
---
drivers/usb/gadget/ci13xxx_udc.c | 31 +++++++++++++++++--------------
1 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c
index 09c76a1..68123ee 100644
--- a/drivers/usb/gadget/ci13xxx_udc.c
+++ b/drivers/usb/gadget/ci13xxx_udc.c
@@ -1634,8 +1634,6 @@ static int _gadget_stop_activity(struct usb_gadget *gadget)
gadget_for_each_ep(ep, gadget) {
usb_ep_disable(ep);
}
- usb_ep_disable(&udc->ep0out.ep);
- usb_ep_disable(&udc->ep0in.ep);
if (udc->status != NULL) {
usb_ep_free_request(&udc->ep0in.ep, udc->status);
@@ -1678,18 +1676,10 @@ __acquires(udc->lock)
if (retval)
goto done;
- retval = usb_ep_enable(&udc->ep0out.ep, &ctrl_endpt_out_desc);
- if (retval)
- goto done;
+ udc->status = usb_ep_alloc_request(&udc->ep0in.ep, GFP_ATOMIC);
+ if (udc->status == NULL)
+ retval = -ENOMEM;
- retval = usb_ep_enable(&udc->ep0in.ep, &ctrl_endpt_in_desc);
- if (!retval) {
- udc->status = usb_ep_alloc_request(&udc->ep0in.ep, GFP_ATOMIC);
- if (udc->status == NULL) {
- usb_ep_disable(&udc->ep0out.ep);
- retval = -ENOMEM;
- }
- }
spin_lock(udc->lock);
done:
@@ -2120,7 +2110,12 @@ static int ep_enable(struct usb_ep *ep,
(mEp->ep.maxpacket << ffs_nr(QH_MAX_PKT)) & QH_MAX_PKT;
mEp->qh.ptr->td.next |= TD_TERMINATE; /* needed? */
- retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type);
+ /*
+ * Enable endpoints in the HW other than ep0 as ep0
+ * is always enabled
+ */
+ if (mEp->num)
+ retval |= hw_ep_enable(mEp->num, mEp->dir, mEp->type);
spin_unlock_irqrestore(mEp->lock, flags);
return retval;
@@ -2609,6 +2604,14 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver,
}
if (retval)
goto done;
+ spin_unlock_irqrestore(udc->lock, flags);
+ retval = usb_ep_enable(&udc->ep0out.ep, &ctrl_endpt_out_desc);
+ if (retval)
+ return retval;
+ retval = usb_ep_enable(&udc->ep0in.ep, &ctrl_endpt_in_desc);
+ if (retval)
+ return retval;
+ spin_lock_irqsave(udc->lock, flags);
udc->gadget.ep0 = &udc->ep0in.ep;
/* bind gadget */
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
next prev parent reply other threads:[~2011-05-02 6:27 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-28 7:58 [PATCH 1/5] USB: gadget: Fix unused variable warning in ci13xxx_udc Pavankumar Kondeti
2011-04-28 7:58 ` [PATCH 2/5] USB: gadget: Fix bug in endpoint feature request processing " Pavankumar Kondeti
[not found] ` <1303977501-17115-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-04-28 7:58 ` [PATCH 3/5] USB: gadget: Use ep0out for control OUT data phase " Pavankumar Kondeti
2011-04-28 7:58 ` [PATCH 4/5] USB: gadget: Initialize ep0 once while registering gadget " Pavankumar Kondeti
2011-04-28 7:58 ` [PATCH 5/5] USB: OTG: msm: Clear in_lpm flag before enabling the IRQ in resume Pavankumar Kondeti
2011-04-28 10:01 ` [PATCH 1/5] USB: gadget: Fix unused variable warning in ci13xxx_udc Michal Nazarewicz
2011-04-28 10:19 ` Pavan Kondeti
[not found] ` <4DB93F48.4050803-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-04-28 16:30 ` David Brown
2011-04-29 5:12 ` [PATCH 1/7] USB: gadget: Fix typo (s/EBUSY/-EBUSY) " Pavankumar Kondeti
2011-04-29 5:12 ` [PATCH 2/7] USB: gadget: Use bitwise AND operator to test flags " Pavankumar Kondeti
2011-04-29 5:12 ` [PATCH 3/7] USB: gadget: Fix unused variable warning " Pavankumar Kondeti
2011-04-29 5:12 ` [PATCH 4/7] USB: gadget: Fix bug in endpoint feature request processing " Pavankumar Kondeti
[not found] ` <1304053975-1960-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-04-29 5:12 ` [PATCH 5/7] USB: gadget: Use ep0out for control OUT data phase " Pavankumar Kondeti
2011-04-29 16:04 ` [PATCH 1/7] USB: gadget: Fix typo (s/EBUSY/-EBUSY) " David Brown
[not found] ` <8yay62txcwc.fsf-AOX6H5vLt3Uj8izMo0bVsAC/G2K4zDHf@public.gmane.org>
2011-04-30 0:29 ` Greg KH
2011-05-02 5:44 ` Pavan Kondeti
2011-05-02 6:09 ` Pavan Kondeti
2011-04-29 5:12 ` [PATCH 6/7] USB: gadget: Initialize ep0 once while registering gadget " Pavankumar Kondeti
2011-04-29 5:12 ` [PATCH 7/7] USB: OTG: msm: Clear in_lpm flag before enabling the IRQ in resume Pavankumar Kondeti
2011-05-02 6:26 ` [PATCH V2 0/7] Typo & BUG fixes for MSM USB drivers Pavankumar Kondeti
2011-05-02 6:26 ` [PATCH V2 2/7] USB: gadget: Use bitwise AND operator to test flags in ci13xxx_udc Pavankumar Kondeti
[not found] ` <1304317593-21808-1-git-send-email-pkondeti-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2011-05-02 6:26 ` [PATCH V2 1/7] USB: gadget: Fix typo (s/EBUSY/-EBUSY) " Pavankumar Kondeti
2011-05-02 6:26 ` [PATCH V2 3/7] USB: gadget: Fix unused variable warning " Pavankumar Kondeti
2011-05-02 6:26 ` [PATCH V2 4/7] USB: gadget: Fix bug in endpoint feature request processing " Pavankumar Kondeti
2011-05-02 6:26 ` [PATCH V2 5/7] USB: gadget: Use ep0out for control OUT data phase " Pavankumar Kondeti
2011-05-02 6:26 ` Pavankumar Kondeti [this message]
2011-05-02 6:26 ` [PATCH V2 7/7] USB: OTG: msm: Clear in_lpm flag before enabling the IRQ in resume Pavankumar Kondeti
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=1304317593-21808-7-git-send-email-pkondeti@codeaurora.org \
--to=pkondeti@codeaurora.org \
--cc=anjir@codeaurora.org \
--cc=davidb@codeaurora.org \
--cc=greg@kroah.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mina86@mina86.com \
/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;
as well as URLs for NNTP newsgroup(s).