From: Anton Vorontsov <hidden> Date: 2008-12-25 14:15:25
In case of probing errors the driver kfrees the udc_controller, but it
doesn't set the pointer to NULL.
When usb_gadget_register_driver is called, it checks for udc_controller
!= NULL, the check passes and the driver accesses nonexistent memory.
Fix this by setting udc_controller to NULL in case of errors.
While at it, also implement irq_of_parse_and_map()'s failure and cleanup
cases.
Signed-off-by: Anton Vorontsov <redacted>
Acked-by: David Brownell <redacted>
---
drivers/usb/gadget/fsl_qe_udc.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
From: Anton Vorontsov <hidden> Date: 2008-12-25 14:15:46
The call chain is this:
qe_udc_irq() <- grabs the udc->lock spinlock
rx_irq()
qe_ep0_rx()
ep0_setup_handle()
setup_received_handle()
ch9getstatus()
qe_ep_queue() <- tries to grab the udc->lock again
It seems unsafe to temporarily drop the lock in the ch9getstatus(),
so to fix that bug the lock-less __qe_ep_queue() function
implemented and used by the ch9getstatus().
Signed-off-by: Anton Vorontsov <redacted>
Acked-by: David Brownell <redacted>
---
drivers/usb/gadget/fsl_qe_udc.c | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
@@ -1681,14 +1681,11 @@ static void qe_free_request(struct usb_ep *_ep, struct usb_request *_req)kfree(req);}-/* queues (submits) an I/O request to an endpoint */-staticintqe_ep_queue(structusb_ep*_ep,structusb_request*_req,-gfp_tgfp_flags)+staticint__qe_ep_queue(structusb_ep*_ep,structusb_request*_req){structqe_ep*ep=container_of(_ep,structqe_ep,ep);structqe_req*req=container_of(_req,structqe_req,req);structqe_udc*udc;-unsignedlongflags;intreval;udc=ep->udc;
@@ -1732,7 +1729,7 @@ static int qe_ep_queue(struct usb_ep *_ep, struct usb_request *_req,list_add_tail(&req->queue,&ep->queue);dev_vdbg(udc->dev,"gadget have request in %s! %d\n",ep->name,req->req.length);-spin_lock_irqsave(&udc->lock,flags);+/* push the request to device */if(ep_is_in(ep))reval=ep_req_send(ep,req);
@@ -1748,11 +1745,24 @@ static int qe_ep_queue(struct usb_ep *_ep, struct usb_request *_req,if(ep->dir==USB_DIR_OUT)reval=ep_req_receive(ep,req);-spin_unlock_irqrestore(&udc->lock,flags);-return0;}+/* queues (submits) an I/O request to an endpoint */+staticintqe_ep_queue(structusb_ep*_ep,structusb_request*_req,+gfp_tgfp_flags)+{+structqe_ep*ep=container_of(_ep,structqe_ep,ep);+structqe_udc*udc=ep->udc;+unsignedlongflags;+intret;++spin_lock_irqsave(&udc->lock,flags);+ret=__qe_ep_queue(_ep,_req);+spin_unlock_irqrestore(&udc->lock,flags);+returnret;+}+/* dequeues (cancels, unlinks) an I/O request from an endpoint */staticintqe_ep_dequeue(structusb_ep*_ep,structusb_request*_req){
From: Anton Vorontsov <hidden> Date: 2008-12-25 14:16:00
qe_udc_reg_init() leaves the USB controller enabled before muram memory
initialized. Sometimes the uninitialized muram memory confuses the
controller, and it start sending the busy interrupts.
Fix this by disabling the controller, it will be enabled later by
the gadget driver, at bind time.
Signed-off-by: Anton Vorontsov <redacted>
---
drivers/usb/gadget/fsl_qe_udc.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
@@ -2452,8 +2452,12 @@ static int __devinit qe_udc_reg_init(struct qe_udc *udc)structusb_ctlr__iomem*qe_usbregs;qe_usbregs=udc->usb_regs;-/* Init the usb register */+/* Spec says that we must enable the USB controller to change mode. */out_8(&qe_usbregs->usb_usmod,0x01);+/* Mode changed, now disable it, since muram isn't initialized yet. */+out_8(&qe_usbregs->usb_usmod,0x00);++/* Initialize the rest. */out_be16(&qe_usbregs->usb_usbmr,0);out_8(&qe_usbregs->usb_uscom,0);out_be16(&qe_usbregs->usb_usber,USBER_ALL_CLEAR);
From: Anton Vorontsov <hidden> Date: 2008-12-25 14:16:25
Freescale QE UDC controllers can't report the "port change" states,
so the only way to handle disconnects is to process bus reset
interrupts. The bus reset can take some time, that is, few irqs.
Gadgets may print the disconnection events, and this causes few
repetitive messages in the kernel log.
This patch fixes the issue by using the usb_state machine, if the
usb controller has been already reset, just quit the reset irq
early.
Signed-off-by: Anton Vorontsov <redacted>
Acked-by: David Brownell <redacted>
---
drivers/usb/gadget/fsl_qe_udc.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
From: Anton Vorontsov <hidden> Date: 2008-12-25 14:16:39
Before freeing an endpoint's muram memory, we should stop all activity
of the endpoint, otherwise the QE UDC controller might do nasty things
with the muram memory that isn't belong to that endpoint anymore.
The qe_ep_reset() effectively flushes the hardware fifos, finishes all
late transaction and thus prevents the corruption.
Signed-off-by: Anton Vorontsov <redacted>
Acked-by: David Brownell <redacted>
---
drivers/usb/gadget/fsl_qe_udc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
From: Anton Vorontsov <hidden> Date: 2008-12-25 14:16:56
While disabling an endpoint the driver nuking any pending requests,
thus completing them with -ESHUTDOWN status. But the driver doesn't
clear the tx_req, which means that a next TX request (after
ep_enable), might get stalled, since the driver won't queue the new
reqests.
This patch fixes a bug I'm observing with ethernet gadget while
playing with ifconfig usb0 up/down (the up/down sequence disables
and enables `in' and `out' endpoints).
Signed-off-by: Anton Vorontsov <redacted>
Acked-by: David Brownell <redacted>
---
drivers/usb/gadget/fsl_qe_udc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
On Tue, Jan 06, 2009 at 10:44:13PM -0600, Kumar Gala wrote:
On Dec 25, 2008, at 8:14 AM, Anton Vorontsov wrote:
quoted
Hi all,
Just resending some fixes that seem to be lost...
Greg,
What happened w/this patch set?
As it was sent during the hollidays (on Christmas day at that), it's
still in my "to-review" queue. I'll get to it in a few days after I
resync the USB tree with Linus.
thanks,
greg k-h
From: Kumar Gala <hidden> Date: 2009-01-13 15:53:17
On Jan 6, 2009, at 10:53 PM, Greg KH wrote:
On Tue, Jan 06, 2009 at 10:44:13PM -0600, Kumar Gala wrote:
quoted
On Dec 25, 2008, at 8:14 AM, Anton Vorontsov wrote:
quoted
Hi all,
Just resending some fixes that seem to be lost...
Greg,
What happened w/this patch set?
As it was sent during the hollidays (on Christmas day at that), it's
still in my "to-review" queue. I'll get to it in a few days after I
resync the USB tree with Linus.
On Tue, Jan 13, 2009 at 09:49:39AM -0600, Kumar Gala wrote:
On Jan 6, 2009, at 10:53 PM, Greg KH wrote:
quoted
On Tue, Jan 06, 2009 at 10:44:13PM -0600, Kumar Gala wrote:
quoted
On Dec 25, 2008, at 8:14 AM, Anton Vorontsov wrote:
quoted
Hi all,
Just resending some fixes that seem to be lost...
Greg,
What happened w/this patch set?
As it was sent during the hollidays (on Christmas day at that), it's
still in my "to-review" queue. I'll get to it in a few days after I
resync the USB tree with Linus.
Any update on the review of these 6 patches?
It's in my queue, been busy with "real work" for a bit right now,
sorry...
thanks,
greg k-h
From: Kumar Gala <hidden> Date: 2009-01-13 17:32:54
quoted
quoted
quoted
quoted
Just resending some fixes that seem to be lost...
Greg,
What happened w/this patch set?
As it was sent during the hollidays (on Christmas day at that), it's
still in my "to-review" queue. I'll get to it in a few days after I
resync the USB tree with Linus.
Any update on the review of these 6 patches?
It's in my queue, been busy with "real work" for a bit right now,
sorry...
thanks,
greg k-h
np. Just going through my patchworks queue and hadn't seen these show
up in any tree.
- k
From: Anton Vorontsov <hidden> Date: 2009-02-02 15:50:26
On Tue, Jan 13, 2009 at 08:40:01AM -0800, Greg KH wrote:
On Tue, Jan 13, 2009 at 09:49:39AM -0600, Kumar Gala wrote:
quoted
On Jan 6, 2009, at 10:53 PM, Greg KH wrote:
quoted
On Tue, Jan 06, 2009 at 10:44:13PM -0600, Kumar Gala wrote:
quoted
On Dec 25, 2008, at 8:14 AM, Anton Vorontsov wrote:
quoted
Hi all,
Just resending some fixes that seem to be lost...
Greg,
What happened w/this patch set?
As it was sent during the hollidays (on Christmas day at that), it's
still in my "to-review" queue. I'll get to it in a few days after I
resync the USB tree with Linus.
Any update on the review of these 6 patches?
It's in my queue, been busy with "real work" for a bit right now,
sorry...
Hello Greg,
Can you please look into these patches? I think they all are 2.6.29
material, since the QE UDC driver is barely usable w/o these fixes.
Thanks,
p.s. And thank you for merging the FHCI driver!
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
On Mon, Feb 02, 2009 at 06:50:04PM +0300, Anton Vorontsov wrote:
On Tue, Jan 13, 2009 at 08:40:01AM -0800, Greg KH wrote:
quoted
On Tue, Jan 13, 2009 at 09:49:39AM -0600, Kumar Gala wrote:
quoted
On Jan 6, 2009, at 10:53 PM, Greg KH wrote:
quoted
On Tue, Jan 06, 2009 at 10:44:13PM -0600, Kumar Gala wrote:
quoted
On Dec 25, 2008, at 8:14 AM, Anton Vorontsov wrote:
quoted
Hi all,
Just resending some fixes that seem to be lost...
Greg,
What happened w/this patch set?
As it was sent during the hollidays (on Christmas day at that), it's
still in my "to-review" queue. I'll get to it in a few days after I
resync the USB tree with Linus.
Any update on the review of these 6 patches?
It's in my queue, been busy with "real work" for a bit right now,
sorry...
Hello Greg,
Can you please look into these patches? I think they all are 2.6.29
material, since the QE UDC driver is barely usable w/o these fixes.
My appologies, I've now applied them all and will queue them up to Linus
before .29 is out.
thanks,
greg k-h