From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 22 Jan 2016 08:24:05 +0100 Subject: [U-Boot] [PATCH 7/7] usb: dwc2: Do not mix data toggle for IN and OUT endpoints, check bounds In-Reply-To: <1453426243-833-1-git-send-email-stefan.bruens@rwth-aachen.de> References: <1453426243-833-1-git-send-email-stefan.bruens@rwth-aachen.de> Message-ID: <201601220824.05111.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday, January 22, 2016 at 02:30:43 AM, Stefan Br?ns wrote: > USB protocol allows for 16 IN and 16 OUT endpoints (USB 2.0 Spec, > 8.3.2.2 Endpoint Field). A function may have an EP 1 for both IN and OUT, > so these two should be kept separate. As EPs are either BULK or INTERRUPT > (or ISO), it is fine to have one array per direction for all transfer > types (also see e236519b7365ef75c5da6a5623f0b03d9c00cfae). > > USB device address is 7 bits, so a bus may have more than 16 devices. > Check the device number, as the DWC2 driver only supports BULK/ISO for > the first 16 devices. > > Signed-off-by: Stefan Br?ns > --- Since this is patch 7/7, where are the remaining 6 ? > drivers/usb/host/dwc2.c | 29 +++++++++++++++++++---------- > 1 file changed, 19 insertions(+), 10 deletions(-) > > diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c > index 291e4a5..7c107bc 100644 > --- a/drivers/usb/host/dwc2.c > +++ b/drivers/usb/host/dwc2.c > @@ -34,7 +34,8 @@ struct dwc2_priv { > uint8_t *aligned_buffer; > uint8_t *status_buffer; > #endif > - int bulk_data_toggle[MAX_DEVICE][MAX_ENDPOINT]; > + uint8_t in_data_toggle[MAX_DEVICE][MAX_ENDPOINT]; > + uint8_t out_data_toggle[MAX_DEVICE][MAX_ENDPOINT]; Use u8/u16/u32 please. All around the place . > struct dwc2_core_regs *regs; > int root_hub_devnum; > }; The rest is fine, Acked-by: Marek Vasut Thanks! Best regards, Marek Vasut