[U-Boot] DWC2 driver issues

Stephen Warren swarren at wwwdotorg.org
Sat Feb 28 05:33:31 CET 2015


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



More information about the U-Boot mailing list