[PATCH] misc: Port USB251xB/xBi Hi-Speed Hub Controller Driver from Linux

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Mon Jul 11 11:28:50 CEST 2022


Hi Marek,

Am 14.06.2022 um 09:38 schrieb Marek Vasut:
> On 6/14/22 09:08, Stefan Herbrechtsmeier wrote:
>> Am 13.06.2022 um 22:26 schrieb Marek Vasut:
>>> On 6/13/22 19:23, Stefan Herbrechtsmeier wrote:
>>
>> [snip]
>>
>>>>>>> +    if (dev_read_u32(dev, "vendor-id", &hub->vendor_id))
>>>>>>> +        hub->vendor_id = USB251XB_DEF_VENDOR_ID;
>>>>>>> +
>>>>>>> +    if (dev_read_u32(dev, "product-id", &hub->product_id))
>>>>>>> +        hub->product_id = data->product_id;
>>>>>>> +
>>>>>>> +    if (dev_read_u32(dev, "device-id", &hub->device_id))
>>>>>>> +        hub->device_id = USB251XB_DEF_DEVICE_ID;
>>>>>>> +
>>>>>>
>>>>>> [snip]
>>>>>>
>>>>>>> +    if (dev_read_u32(dev, "language-id", &hub->lang_id))
>>>>>>> +        hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
>>>>>>> +
>>>>>>
>>>>>> This doesn't work because the ids are 16 bit [1,2] and the 
>>>>>> dev_read_u32 function checks the size.
>>>>>>
>>>>>>> +    if (!dev_read_u32(dev, "boost-up", &hub->boost_up))
>>>>>>> +        hub->boost_up = USB251XB_DEF_BOOST_UP;
>>>>>>
>>>>>> This looks like a 8 bit value [1].
>>>>>
>>>>> The dev_read_u32() is also capable of reading 0xNNNN 16bit value 
>>>>> from DT.
>>>>>
>>>>> What kind of problem are you running into exactly ?
>>>>
>>>> Have you test the values from device tree binding documentation:
>>>>
>>>> vendor-id = /bits/ 16 <0xNNNN>;
>>>> product-id = /bits/ 16 <0xNNNN>;
>>>>
>>>> I get an EOVERFLOW error.
>>>
>>> No, I only tested foo = <0xNNNN>; .
>>>
>>> Can you send a fix ?
>>
>> Should I add a function to the driver or a dev_read_u8/16, 
>> ofnode_read_u8/16 and friends function?
> 
> It seems more like you would have to add the _u8 and _u16 variants into 
> common code, alongside the _u32 variant (should be easy) and then use 
> them in this driver (should also be easy), so two patches.

https://lists.denx.de/pipermail/u-boot/2022-June/486423.html
https://lists.denx.de/pipermail/u-boot/2022-June/486424.html

Do you have any comments?

Regards
   Stefan


More information about the U-Boot mailing list