Skip to content

Commit

Permalink
usb: pch_udc: Fix setup transfers with data out
Browse files Browse the repository at this point in the history
This patch fixes an issue where the driver does not handle out data in
setup transactions.

The per endpoint cached status register is cleared in the
pch_udc_svc_control_out function. When there is out data available the
function pch_udc_svc_data_out is called which tries to pick it up the
status, which now is cleared to 0. When the status is 0, the function
doesn't start reading the data from the FIFO.

There is a second bug in all this, pch_udc_svc_data_out takes the
endpoint number (0 for EP0), while pch_udc_svc_control_out passes the
endpoint index (1 for EP0). Effectively pch_udc_svc_data_out picks up
the wrong internal ep structure.

This patch makes sure to put back the cached status and pass the
endpoint number rather than index when calling pch_udc_svc_data_out.

Signed-off-by: Richard Röjfors <richard.rojfors@pelagicore.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Richard Röjfors authored and Greg Kroah-Hartman committed Dec 10, 2010
1 parent 49e2083 commit ff176a4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/usb/gadget/pch_udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2150,7 +2150,10 @@ static void pch_udc_svc_control_out(struct pch_udc_dev *dev)
pch_udc_set_dma(dev, DMA_DIR_RX);
} else {
/* control write */
pch_udc_svc_data_out(dev, UDC_EP0OUT_IDX);
/* next function will pickuo an clear the status */
ep->epsts = stat;

pch_udc_svc_data_out(dev, 0);
/* re-program desc. pointer for possible ZLPs */
pch_udc_ep_set_ddptr(ep, ep->td_data_phys);
pch_udc_set_dma(dev, DMA_DIR_RX);
Expand Down

0 comments on commit ff176a4

Please sign in to comment.