diff options
author | Andrew Thompson <thompsa@FreeBSD.org> | 2009-04-05 18:18:16 +0000 |
---|---|---|
committer | Andrew Thompson <thompsa@FreeBSD.org> | 2009-04-05 18:18:16 +0000 |
commit | f3464815ee2177165cdb1f6f402e4ec58f207676 (patch) | |
tree | 67b47e6b44aa7e337d832537ee1f429eb3c13517 /sys/dev/usb/controller/atmegadci.c | |
parent | df075012e8b76087e413db1e3a258eca5a390767 (diff) | |
download | src-f3464815ee2177165cdb1f6f402e4ec58f207676.tar.gz src-f3464815ee2177165cdb1f6f402e4ec58f207676.zip |
MFp4 //depot/projects/usb@159673
Fix a corner case around stalling SETUP packets in device side mode.
Submitted by: Hans Petter Selasky
Notes
Notes:
svn path=/head/; revision=190721
Diffstat (limited to 'sys/dev/usb/controller/atmegadci.c')
-rw-r--r-- | sys/dev/usb/controller/atmegadci.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c index 57a091feda37..11067128cad4 100644 --- a/sys/dev/usb/controller/atmegadci.c +++ b/sys/dev/usb/controller/atmegadci.c @@ -250,16 +250,10 @@ atmegadci_setup_rx(struct atmegadci_td *td) DPRINTFN(5, "UEINTX=0x%02x\n", temp); if (!(temp & ATMEGA_UEINTX_RXSTPI)) { - /* abort any ongoing transfer */ - if (!td->did_stall) { - DPRINTFN(5, "stalling\n"); - ATMEGA_WRITE_1(sc, ATMEGA_UECONX, - ATMEGA_UECONX_EPEN | - ATMEGA_UECONX_STALLRQ); - td->did_stall = 1; - } goto not_complete; } + /* clear did stall */ + td->did_stall = 0; /* get the packet byte count */ count = (ATMEGA_READ_1(sc, ATMEGA_UEBCHX) << 8) | @@ -304,6 +298,15 @@ atmegadci_setup_rx(struct atmegadci_td *td) return (0); /* complete */ not_complete: + /* abort any ongoing transfer */ + if (!td->did_stall) { + DPRINTFN(5, "stalling\n"); + ATMEGA_WRITE_1(sc, ATMEGA_UECONX, + ATMEGA_UECONX_EPEN | + ATMEGA_UECONX_STALLRQ); + td->did_stall = 1; + } + /* we only want to know if there is a SETUP packet */ ATMEGA_WRITE_1(sc, ATMEGA_UEIENX, ATMEGA_UEIENX_RXSTPE); return (1); /* not complete */ |