lkml.org 
[lkml]   [2012]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC 2/2] usb: gadget: composite: parse dt overrides
Date
From
On Mon, 25 Jun 2012 22:23:52 +0200, Alexandre Pereira da Silva <aletes.xgr@gmail.com> wrote:
> Grab the devicetree node properties to override VendorId, ProductId,
> bcdDevice, Manucacturer, Product and SerialNumber
>
> Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>

Acked-by: Michal Nazarewicz <mina86@mina86.com>

> @@ -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", &reg) == 0)
> + idVendor = reg;
> +
> + if (!idProduct &&
> + of_property_read_u32(np, "product_id", &reg) == 0)
> + idProduct = reg;
> +
> + if (!bcdDevice &&
> + of_property_read_u32(np, "bcd_device", &reg) == 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);


--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michał “mina86” Nazarewicz (o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2012-06-26 00:21    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site