Grab the devicetree node properties to override VendorId, ProductId,
bcdDevice, Manucacturer, Product and SerialNumber
Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@xxxxxxxxx>
@@ -1470,6 +1472,35 @@ static int composite_bind(struct usb_gadget *gadget)
cdev->desc = *composite->dev;
+ /* grab overrides from devicetree */
+ if (np) {
+ u32 reg;
+
+ if (!idVendor &&
+ of_property_read_u32(np, "vendor_id", ®) == 0)
+ idVendor = reg;
+
+ if (!idProduct &&
+ of_property_read_u32(np, "product_id", ®) == 0)
+ idProduct = reg;
+
+ if (!bcdDevice &&
+ of_property_read_u32(np, "bcd_device", ®) == 0)
+ bcdDevice = reg;
+
+ if (!iManufacturer)
+ of_property_read_string(np, "manufacturer",
+ &iManufacturer);
+
+ if (!iProduct)
+ of_property_read_string(np, "product",
+ &iProduct);
+
+ if (!iSerialNumber)
+ of_property_read_string(np, "serial_number",
+ &iSerialNumber);
+ }
+
/* standardized runtime overrides for device ID data */
if (idVendor)
cdev->desc.idVendor = cpu_to_le16(idVendor);