usb: gadget: fsl_udc_core: dTD's next dtd pointer need to be updated once written
authorPeter Chen <peter.chen@freescale.com>
Sun, 1 Apr 2012 07:17:16 +0000 (15:17 +0800)
committerBen Hutchings <ben@decadent.org.uk>
Wed, 30 May 2012 23:43:36 +0000 (00:43 +0100)
commit525e9aed9a619a41ba17d1e4ea57b4c2746eb2c0
tree2f1da13d9d27e8220cc0d272129aab3bee0e4d0a
parent248af05acf6bd1ee0c636d6af23759ef3f132c55
usb: gadget: fsl_udc_core: dTD's next dtd pointer need to be updated once written

commit 4d0947dec4db1224354e2f6f00ae22ce38e62a43 upstream.

dTD's next dtd pointer need to be updated once CPU writes it, or this
request may not be handled by controller, then host will get NAK from
device forever.

This problem occurs when there is a request is handling, we need to add
a new request to dTD list, if this new request is added before the current
one is finished, the new request is intended to added as next dtd pointer
at current dTD, but without wmb(), the dTD's next dtd pointer may not be
updated when the controller reads it. In that case, the controller will
still get Terminate Bit is 1 at dTD's next dtd pointer, that means there is
no next request, then this new request is missed by controller.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Li Yang <leoli@freescale.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/usb/gadget/fsl_udc_core.c