From 6f02910ded2c87aa1d6d631f6a1ac8dc405f0373 Mon Sep 17 00:00:00 2001 From: hselasky Date: Mon, 19 Jan 2015 07:18:59 +0000 Subject: [PATCH] MFC r276798: Fix handling of an error case when the MUSB driver is operating in USB device side mode. git-svn-id: svn://svn.freebsd.org/base/stable/10@277368 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/usb/controller/musb_otg.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/sys/dev/usb/controller/musb_otg.c b/sys/dev/usb/controller/musb_otg.c index 091e4716a..98dc62266 100644 --- a/sys/dev/usb/controller/musb_otg.c +++ b/sys/dev/usb/controller/musb_otg.c @@ -401,7 +401,7 @@ musbotg_dev_ctrl_setup_rx(struct musbotg_td *td) /* do not stall at this point */ td->did_stall = 1; /* wait for interrupt */ - DPRINTFN(0, "CSR0 DATAEND\n"); + DPRINTFN(1, "CSR0 DATAEND\n"); goto not_complete; } @@ -423,32 +423,37 @@ musbotg_dev_ctrl_setup_rx(struct musbotg_td *td) sc->sc_ep0_busy = 0; } if (sc->sc_ep0_busy) { - DPRINTFN(0, "EP0 BUSY\n"); + DPRINTFN(1, "EP0 BUSY\n"); goto not_complete; } if (!(csr & MUSB2_MASK_CSR0L_RXPKTRDY)) { goto not_complete; } - /* clear did stall flag */ - td->did_stall = 0; /* get the packet byte count */ count = MUSB2_READ_2(sc, MUSB2_REG_RXCOUNT); /* verify data length */ if (count != td->remainder) { - DPRINTFN(0, "Invalid SETUP packet " + DPRINTFN(1, "Invalid SETUP packet " "length, %d bytes\n", count); MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, MUSB2_MASK_CSR0L_RXPKTRDY_CLR); + /* don't clear stall */ + td->did_stall = 1; goto not_complete; } if (count != sizeof(req)) { - DPRINTFN(0, "Unsupported SETUP packet " + DPRINTFN(1, "Unsupported SETUP packet " "length, %d bytes\n", count); MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, MUSB2_MASK_CSR0L_RXPKTRDY_CLR); + /* don't clear stall */ + td->did_stall = 1; goto not_complete; } + /* clear did stall flag */ + td->did_stall = 0; + /* receive data */ bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), (void *)&req, sizeof(req)); -- 2.45.0