diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-04-05 18:18:25 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-04-05 18:18:25 +0000 |
commit | 34883831ec3d5073196c6ee0d5211a3cdc65fa99 (patch) | |
tree | 9a4a63c3a542ded2bab376dec545c7efa036909c /sys/dev/usb/controller | |
parent | da86d5814edc3c040ec8b32c0433bc58f79a0d02 (diff) | |
download | FreeBSD-src-34883831ec3d5073196c6ee0d5211a3cdc65fa99.zip FreeBSD-src-34883831ec3d5073196c6ee0d5211a3cdc65fa99.tar.gz |
MFp4 //depot/projects/usb@159674
Fix more corner cases around reception of SETUP packets.
Submitted by: Hans Petter Selasky
Diffstat (limited to 'sys/dev/usb/controller')
-rw-r--r-- | sys/dev/usb/controller/atmegadci.c | 5 | ||||
-rw-r--r-- | sys/dev/usb/controller/musb_otg.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/controller/uss820dci.c | 17 |
3 files changed, 21 insertions, 5 deletions
diff --git a/sys/dev/usb/controller/atmegadci.c b/sys/dev/usb/controller/atmegadci.c index 1106712..f9261e7 100644 --- a/sys/dev/usb/controller/atmegadci.c +++ b/sys/dev/usb/controller/atmegadci.c @@ -306,7 +306,10 @@ not_complete: ATMEGA_UECONX_STALLRQ); td->did_stall = 1; } - + if (temp & ATMEGA_UEINTX_RXSTPI) { + /* clear SETUP packet interrupt */ + ATMEGA_WRITE_1(sc, ATMEGA_UEINTX, ~ATMEGA_UEINTX_RXSTPI); + } /* we only want to know if there is a SETUP packet */ ATMEGA_WRITE_1(sc, ATMEGA_UEIENX, ATMEGA_UEIENX_RXSTPE); return (1); /* not complete */ diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c index ac63aab..23af416 100644 --- a/sys/dev/usb/controller/musb_otg.c +++ b/sys/dev/usb/controller/musb_otg.c @@ -292,11 +292,15 @@ musbotg_setup_rx(struct musbotg_td *td) if (count != td->remainder) { DPRINTFN(0, "Invalid SETUP packet " "length, %d bytes\n", count); + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_RXPKTRDY_CLR); goto not_complete; } if (count != sizeof(req)) { DPRINTFN(0, "Unsupported SETUP packet " "length, %d bytes\n", count); + MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, + MUSB2_MASK_CSR0L_RXPKTRDY_CLR); goto not_complete; } /* receive data */ diff --git a/sys/dev/usb/controller/uss820dci.c b/sys/dev/usb/controller/uss820dci.c index ed87983..bcf877e 100644 --- a/sys/dev/usb/controller/uss820dci.c +++ b/sys/dev/usb/controller/uss820dci.c @@ -275,12 +275,12 @@ uss820dci_setup_rx(struct uss820dci_td *td) if (count != td->remainder) { DPRINTFN(0, "Invalid SETUP packet " "length, %d bytes\n", count); - goto not_complete; + goto setup_not_complete; } if (count != sizeof(req)) { DPRINTFN(0, "Unsupported SETUP packet " "length, %d bytes\n", count); - goto not_complete; + goto setup_not_complete; } /* receive data */ bus_space_read_multi_1(td->io_tag, td->io_hdl, @@ -323,13 +323,22 @@ uss820dci_setup_rx(struct uss820dci_td *td) } return (0); /* complete */ +setup_not_complete: + + /* set RXFFRC bit */ + temp = bus_space_read_1(td->io_tag, td->io_hdl, + td->rx_cntl_reg); + temp |= USS820_RXCON_RXFFRC; + bus_space_write_1(td->io_tag, td->io_hdl, + td->rx_cntl_reg, temp); + + /* FALLTHROUGH */ + not_complete: /* abort any ongoing transfer */ if (!td->did_stall) { DPRINTFN(5, "stalling\n"); - /* set stall */ - uss820dci_update_shared_1(sc, USS820_EPCON, 0xFF, (USS820_EPCON_TXSTL | USS820_EPCON_RXSTL)); |