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

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Tue Jun 14 09:08:01 CEST 2022


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?


More information about the U-Boot mailing list