[U-Boot] DWC2 driver issues

Stephen Warren
2015-03-02T23:33:41Z

On 03/02/2015 04:42 AM, Marek Vasut wrote:
> On Saturday, February 28, 2015 at 05:33:31 AM, Stephen Warren wrote:
>> 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.
>
> Uh, the debugging spit in submit_int_msg() should certainly be converted
> into something more human readable.
>
>> 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+
>
> Cool, good job.
>
>> although it hangs pretty quickly. I assume one of the busy loops
>> in dwc2.c without a time out isn't completing.
>
> Oh, dang. Those should certainly be fixed.
>
> Looking at the patch, could it be that CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP
> support in usb_kbd.c is broken altogether ?

Well, once I applied that patch I did manage to type a few characters
into the U-Boot shell via usbkbd one of the two times I tested, so it's
not *completely* broken. It's still possible it's quite broken though,
given the hangs:-)