aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Herbrechtsmeier2022-06-14 15:21:31 +0200
committerTom Rini2022-09-14 15:23:03 -0400
commitc0facda1976f7990ad9edbaecb6802369867c1d6 (patch)
tree132088c1b293e4fe76be30ada4a41d59d53a12fd
parentb471bdc47b2acabe0b5fcb0fb40a0b1c0602d3b3 (diff)
misc: usb251xb: Support 8/16 bit device tree values
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>
-rw-r--r--drivers/misc/usb251xb.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/misc/usb251xb.c b/drivers/misc/usb251xb.c
index 077edc25045..a78ad1843ae 100644
--- a/drivers/misc/usb251xb.c
+++ b/drivers/misc/usb251xb.c
@@ -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,