From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Date: Fri, 27 Feb 2015 21:33:31 -0700 Subject: [U-Boot] DWC2 driver issues In-Reply-To: <201502191529.02337.marex@denx.de> References: <54E236DD.3080204@wwwdotorg.org> <201502191529.02337.marex@denx.de> Message-ID: <54F1451B.1090206@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 02/19/2015 07:29 AM, Marek Vasut wrote: > On Monday, February 16, 2015 at 07:28:45 PM, Stephen Warren wrote: >> Following on from my Google+ post about DWC2/RPi USB host controller >> issues in U-Boot. ... >> On an RPi with the DWC2 controller connected directly to a single >> external USB connector (i.e model A, A+), a LS (and perhaps FS) device >> pluged directly into the board doesn't work due to the small max packet >> size limit. >> >> Your patch 9b1161af8c51 "usb: dwc2: Add support for multi-packet control >> xfers" in u-boot-usb.git topic/dwc2 addresses this issue for control >> transfers at least. With your patch, I can now enumerate a USB kbd on a >> model A+. That's a great improvement; thanks for the quick response with >> a patch. >> >> However, when I enable CONFIG_USB_KEYBOARD, I see errors when the USB >> >> keyboard input driver initializes: >>> starting USB... >>> USB0: Core Release: 2.80a >>> scanning bus 0 for devices... 3 USB Device(s) found >>> >>> scanning usb for storage devices... 0 Storage Device(s) found >>> scanning usb for ethernet devices... 0 Ethernet Device(s) found >>> >>> dev = 0df92ac0 pipe = 0x40408380 buf = 0db4a780 size = 8 int = 10 >>> Failed to get keyboard state from device 413c:2010 >> >> I haven't investigated this further yet. > > Wow, this error is new, I have not seen this one on SoCFPGA. This error is because the keyboard driver uses interrupt transfers, and these aren't implemented in DWC2. I worked around this by forcing the keyboard driver to use control transfers, and fixing what I think is a bug in this case; see patch below. With this, USB keyboard works on an RPI A+, although it hangs pretty quickly. I assume one of the busy loops in dwc2.c without a time out isn't completing. > diff --git a/common/usb_kbd.c b/common/usb_kbd.c > index ecc3085cc081..237dbbaf4fe0 100644 > --- a/common/usb_kbd.c > +++ b/common/usb_kbd.c > @@ -457,6 +457,8 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum) > USB_KBD_BOOT_REPORT_SIZE, data->new, > data->intinterval); > if (!data->intq) { > +#elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP) > + if (0) { > #else > if (usb_submit_int_msg(dev, data->intpipe, data->new, data->intpktsize, > data->intinterval) < 0) { > diff --git a/include/configs/rpi.h b/include/configs/rpi.h > index c94f4112026e..8d01bc845d73 100644 > --- a/include/configs/rpi.h > +++ b/include/configs/rpi.h > @@ -91,6 +91,9 @@ > #define CONFIG_USB_HOST_ETHER > #define CONFIG_USB_ETHER_SMSC95XX > #define CONFIG_MISC_INIT_R > +#define CONFIG_USB_KEYBOARD > +#define CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP > +#define CONFIG_SYS_STDIO_DEREGISTER > #endif > > /* Console UART */