[U-Boot] Is it an error in function ehci_submit_root() in ehci-hcd.c
Michael Trimarchi
trimarchi at gandalf.sssup.it
Wed Jul 29 17:11:10 CEST 2009
Remy Bohmer wrote:
> Hi,
>
> 2009/7/29 Lv Terry-R65388 <Rui.Lv at freescale.com>:
>
>> Hi All,
>>
>> I'm trying to enable ehci usb in our board and I found that there
>> maybe two issues in funcion ehci_submit_root() in ehci-hcd.c.
>>
>> 1)
>> In ehci_submit_root(), the function will do the following operation.
>>
>> From line 553 in ehci-hcd.c:
>>
>> typeReq = req->request << 8 | req->requesttype;
>>
>> switch (le16_to_cpu(typeReq)) {
>> case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
>> ...
>> ...
>> case USB_REQ_GET_DESCRIPTOR | ((USB_DIR_IN | USB_RT_HUB) << 8):
>> ...
>> ...
>> }
>>
>> As in function usb_get_descriptor() in usb.c,
>>
>> res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
>> USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
>> (type << 8) + index, 0,
>> buf, size, USB_CNTL_TIMEOUT);
>>
>> req->request will be assigned USB_REQ_GET_DESCRIPTOR,
>> req->requesttype will be assigned USB_DIR_IN.
>> The value of typeReq will be 0x680 which can't match any value in
>> switch (le16_to_cpu(typeReq)) .
>>
>
> In current mainline this le16_to_cpu() macro has been removed.
> Does that change anything?
>
>
>> Do I miss any config here?
>>
>
> I guess not.
>
>
>> 2)
>> In funcion usb_get_descriptor() in usb.c, it will pass index 0 to
>> usb_control_msg. setup_packet.index will be assigned 0.
>>
>> res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
>> USB_REQ_GET_DESCRIPTOR, USB_DIR_IN,
>> (type << 8) + index, 0,
>> buf, size, USB_CNTL_TIMEOUT); /* The sixty parameter
>> is index */
>>
>> Then in funcion ehci_submit_root() in ehci-hcd.c,
>>
>> status_reg = (uint32_t *)&hcor->or_portsc[le16_to_cpu(req->index) -
>> 1];
>>
>> (le16_to_cpu(req->index) - 1) will be -1 here.
>>
>> Is it correct?
>>
>
> Nice catch!
> Prafulla/Michael, what do you think?
>
That we need a patch here urgent :).
Terry, Can you provide the proper fix?
Michael
> Kind Regards,
>
> Remy
>
>
More information about the U-Boot
mailing list