misc: usb251xb: Support 8/16 bit device tree values
authorStefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Tue, 14 Jun 2022 13:21:31 +0000 (15:21 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 14 Sep 2022 19:23:03 +0000 (15:23 -0400)
The device tree binding [1] specify the vendor-id, product-id, device-id
and language-id as 16 bit values and the linux driver reads the boost-up
value as 8 bit value.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/usb/usb251xb.txt

Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Reviewed-by: Marek Vasut <marex@denx.de>
drivers/misc/usb251xb.c

index 077edc2..a78ad18 100644 (file)
@@ -400,14 +400,14 @@ static int usb251xb_of_to_plat(struct udevice *dev)
                }
        }
 
-       if (dev_read_u32(dev, "vendor-id", &hub->vendor_id))
-               hub->vendor_id = USB251XB_DEF_VENDOR_ID;
+       hub->vendor_id = dev_read_u16_default(dev, "vendor-id",
+                                             USB251XB_DEF_VENDOR_ID);
 
-       if (dev_read_u32(dev, "product-id", &hub->product_id))
-               hub->product_id = data->product_id;
+       hub->product_id = dev_read_u16_default(dev, "product-id",
+                                              data->product_id);
 
-       if (dev_read_u32(dev, "device-id", &hub->device_id))
-               hub->device_id = USB251XB_DEF_DEVICE_ID;
+       hub->device_id = dev_read_u16_default(dev, "device-id",
+                                             USB251XB_DEF_DEVICE_ID);
 
        hub->conf_data1 = USB251XB_DEF_CONFIG_DATA_1;
        if (dev_read_bool(dev, "self-powered")) {
@@ -513,11 +513,11 @@ static int usb251xb_of_to_plat(struct udevice *dev)
        if (!dev_read_u32(dev, "power-on-time-ms", &property_u32))
                hub->power_on_time = min_t(u8, property_u32 / 2, 255);
 
-       if (dev_read_u32(dev, "language-id", &hub->lang_id))
-               hub->lang_id = USB251XB_DEF_LANGUAGE_ID;
+       hub->lang_id = dev_read_u16_default(dev, "language-id",
+                                           USB251XB_DEF_LANGUAGE_ID);
 
-       if (!dev_read_u32(dev, "boost-up", &hub->boost_up))
-               hub->boost_up = USB251XB_DEF_BOOST_UP;
+       hub->boost_up = dev_read_u8_default(dev, "boost-up",
+                                           USB251XB_DEF_BOOST_UP);
 
        cproperty_char = dev_read_string(dev, "manufacturer");
        strlcpy(str, cproperty_char ? : USB251XB_DEF_MANUFACTURER_STRING,