From: "Michal Nazarewicz" <mina86@mina86.com>
To: "Felipe Balbi" <balbi@ti.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
"Grant Likely" <grant.likely@secretlab.ca>,
"Rob Herring" <rob.herring@calxeda.com>,
devicetree-discuss@lists.ozlabs.org,
"Alexandre Pereira da Silva" <aletes.xgr@gmail.com>
Subject: Re: [RFC 2/2] usb: gadget: composite: parse dt overrides
Date: Mon, 25 Jun 2012 23:30:36 +0200 [thread overview]
Message-ID: <op.wgg91aya3l0zgt@mpn-glaptop> (raw)
In-Reply-To: <1340655832-30447-1-git-send-email-aletes.xgr@gmail.com>
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", ®) == 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);
--
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--
next prev parent reply other threads:[~2012-06-25 21:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-25 20:23 Alexandre Pereira da Silva
2012-06-25 21:30 ` Michal Nazarewicz [this message]
2012-06-25 23:49 ` Rob Herring
2012-06-26 1:12 ` Alexandre Pereira da Silva
2012-06-26 5:38 ` Mitch Bradley
2012-06-26 14:04 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=op.wgg91aya3l0zgt@mpn-glaptop \
--to=mina86@mina86.com \
--cc=aletes.xgr@gmail.com \
--cc=balbi@ti.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rob.herring@calxeda.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®