* [U-Boot] [PATCH V2] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback
@ 2015-08-28 1:20 Peng Fan
2015-08-29 13:57 ` Marek Vasut
2015-09-09 23:04 ` Fabio Estevam
0 siblings, 2 replies; 4+ messages in thread
From: Peng Fan @ 2015-08-28 1:20 UTC (permalink / raw)
To: u-boot
Implement endpoint dequeue callback function.
Without this function, uboot will hang when executing fastboot comamnd.
See following flow:
"fastboot_tx_write_str->fastboot_tx_write->usb_ep_dequeue->ep->ops->dequeue"
without implement ci_udc dequeue function, ep->ops->dequeue is NULL, then
uboot will hang.
Tested on mx6qsabresd board with fastboot enabled.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
Cc: "?ukasz Majewski" <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
---
Changes v2:
discard useless "debug("callback completed\n")" info.
drivers/usb/gadget/ci_udc.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index 3e8eb87..c0d23a4 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -87,6 +87,7 @@ static int ci_ep_enable(struct usb_ep *ep,
static int ci_ep_disable(struct usb_ep *ep);
static int ci_ep_queue(struct usb_ep *ep,
struct usb_request *req, gfp_t gfp_flags);
+static int ci_ep_dequeue(struct usb_ep *ep, struct usb_request *req);
static struct usb_request *
ci_ep_alloc_request(struct usb_ep *ep, unsigned int gfp_flags);
static void ci_ep_free_request(struct usb_ep *ep, struct usb_request *_req);
@@ -99,6 +100,7 @@ static struct usb_ep_ops ci_ep_ops = {
.enable = ci_ep_enable,
.disable = ci_ep_disable,
.queue = ci_ep_queue,
+ .dequeue = ci_ep_dequeue,
.alloc_request = ci_ep_alloc_request,
.free_request = ci_ep_free_request,
};
@@ -525,6 +527,30 @@ static void ci_ep_submit_next_request(struct ci_ep *ci_ep)
writel(bit, &udc->epprime);
}
+static int ci_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
+{
+ struct ci_ep *ci_ep = container_of(_ep, struct ci_ep, ep);
+ struct ci_req *ci_req;
+
+ list_for_each_entry(ci_req, &ci_ep->queue, queue) {
+ if (&ci_req->req == _req)
+ break;
+ }
+
+ if (&ci_req->req != _req)
+ return -EINVAL;
+
+ list_del_init(&ci_req->queue);
+
+ if (ci_req->req.status == -EINPROGRESS) {
+ ci_req->req.status = -ECONNRESET;
+ if (ci_req->req.complete)
+ ci_req->req.complete(_ep, _req);
+ }
+
+ return 0;
+}
+
static int ci_ep_queue(struct usb_ep *ep,
struct usb_request *req, gfp_t gfp_flags)
{
--
1.8.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH V2] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback
2015-08-28 1:20 [U-Boot] [PATCH V2] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback Peng Fan
@ 2015-08-29 13:57 ` Marek Vasut
2015-09-09 23:04 ` Fabio Estevam
1 sibling, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2015-08-29 13:57 UTC (permalink / raw)
To: u-boot
On Friday, August 28, 2015 at 03:20:30 AM, Peng Fan wrote:
> Implement endpoint dequeue callback function.
>
> Without this function, uboot will hang when executing fastboot comamnd.
> See following flow:
> "fastboot_tx_write_str->fastboot_tx_write->usb_ep_dequeue->ep->ops->dequeue
> " without implement ci_udc dequeue function, ep->ops->dequeue is NULL, then
> uboot will hang.
>
> Tested on mx6qsabresd board with fastboot enabled.
>
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: "?ukasz Majewski" <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
>
> Changes v2:
> discard useless "debug("callback completed\n")" info.
Hi,
I see Stephen had some concerns about V1, but I don't see them addressed.
I would prefer if you sent V2 only after the discussion about the previous
version of the patch reaches a conclusion. Can you please address the
concerns Stephen had there ? Thanks!
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH V2] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback
2015-08-28 1:20 [U-Boot] [PATCH V2] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback Peng Fan
2015-08-29 13:57 ` Marek Vasut
@ 2015-09-09 23:04 ` Fabio Estevam
2015-09-09 23:20 ` Marek Vasut
1 sibling, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2015-09-09 23:04 UTC (permalink / raw)
To: u-boot
On Thu, Aug 27, 2015 at 10:20 PM, Peng Fan <Peng.Fan@freescale.com> wrote:
> Implement endpoint dequeue callback function.
>
> Without this function, uboot will hang when executing fastboot comamnd.
> See following flow:
> "fastboot_tx_write_str->fastboot_tx_write->usb_ep_dequeue->ep->ops->dequeue"
> without implement ci_udc dequeue function, ep->ops->dequeue is NULL, then
> uboot will hang.
>
> Tested on mx6qsabresd board with fastboot enabled.
Managed to get fastboot working with this patch applied, thanks.
$ fastboot getvar bootloader-version -i 0x0525
bootloader-version: U-Boot 2015.10-rc2-23960-g2462cce-dirty
finished. total time: 0.000s
$ fastboot reboot -i 0x0525 --> board reboots fine.
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH V2] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback
2015-09-09 23:04 ` Fabio Estevam
@ 2015-09-09 23:20 ` Marek Vasut
0 siblings, 0 replies; 4+ messages in thread
From: Marek Vasut @ 2015-09-09 23:20 UTC (permalink / raw)
To: u-boot
On Thursday, September 10, 2015 at 01:04:23 AM, Fabio Estevam wrote:
> On Thu, Aug 27, 2015 at 10:20 PM, Peng Fan <Peng.Fan@freescale.com> wrote:
> > Implement endpoint dequeue callback function.
> >
> > Without this function, uboot will hang when executing fastboot comamnd.
> > See following flow:
> > "fastboot_tx_write_str->fastboot_tx_write->usb_ep_dequeue->ep->ops->deque
> > ue" without implement ci_udc dequeue function, ep->ops->dequeue is NULL,
> > then uboot will hang.
> >
> > Tested on mx6qsabresd board with fastboot enabled.
>
> Managed to get fastboot working with this patch applied, thanks.
>
> $ fastboot getvar bootloader-version -i 0x0525
> bootloader-version: U-Boot 2015.10-rc2-23960-g2462cce-dirty
> finished. total time: 0.000s
>
> $ fastboot reboot -i 0x0525 --> board reboots fine.
>
> Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Applied, thanks!
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-09 23:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-28 1:20 [U-Boot] [PATCH V2] usb: gadget: ci_udc: implement usb_ep_ops dequeue callback Peng Fan
2015-08-29 13:57 ` Marek Vasut
2015-09-09 23:04 ` Fabio Estevam
2015-09-09 23:20 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox