MFp4 //depot/projects/usb@159674

Fix more corner cases around reception of SETUP packets.

Submitted by:	Hans Petter Selasky
This commit is contained in:
Andrew Thompson 2009-04-05 18:18:25 +00:00
parent f3464815ee
commit eb846b4eb5
3 changed files with 21 additions and 5 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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));