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

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Mon Jun 13 19:23:17 CEST 2022


Hi Marek,

Am 13.06.2022 um 18:00 schrieb Marek Vasut:
> On 6/13/22 17:39, Stefan Herbrechtsmeier wrote:
>> Hi Marek,
> 
> Hi,
> 
>> sorry for the late comments but I think the driver doesn't work as 
>> expected.
> 
> How come ? It works on my board.

Have you test with 16 bit property data?

> 
> [...]
> 
>>> +
>>> +    if (IS_ENABLED(CONFIG_DM_REGULATOR)) {
>>> +        err = device_get_supply_regulator(dev, "vdd-supply",
>>> +                          &hub->vdd);
>>> +        if (err && err != -ENOENT) {
>>> +            dev_err(dev, "Warning: cannot get power supply\n");
>>> +            return err;
>>> +        }
>>> +    }
>>
>> Shouldn't the gpio and regulator request be part of the probe?
> 
> What makes you think that ?

It's more a question regarding the device model design:

of_to_plat - convert device tree data to plat

> 
>>> +    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.



More information about the U-Boot mailing list