devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
To: Linux USB Mailing List
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Greg KH
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	Paul Zimmerman
	<paul.zimmerman-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>,
	daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org,
	leoli-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
	andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	mina86-deATy8a+UHjQT0dZR+AlfA@public.gmane.org,
	Peter.Chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org,
	Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
Subject: [PATCH 15/67] usb: gadget: pxa27x_udc: add devicetree support
Date: Fri, 17 Oct 2014 12:16:22 -0500	[thread overview]
Message-ID: <1413566234-13537-16-git-send-email-balbi@ti.com> (raw)
In-Reply-To: <1413566234-13537-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>

From: Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>

Add support for device-tree device discovery. If devicetree is not
provided, fallback to legacy platform data "discovery".

Signed-off-by: Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
---
 drivers/usb/gadget/udc/pxa27x_udc.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 5280f64..55598c0 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -27,6 +27,8 @@
 #include <linux/prefetch.h>
 #include <linux/byteorder/generic.h>
 #include <linux/platform_data/pxa2xx_udc.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
 
 #include <linux/usb.h>
 #include <linux/usb/ch9.h>
@@ -2400,6 +2402,12 @@ static struct pxa_udc memory = {
 	}
 };
 
+static struct of_device_id udc_pxa_dt_ids[] = {
+	{ .compatible = "marvell,pxa270-udc" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, udc_pxa_dt_ids);
+
 /**
  * pxa_udc_probe - probes the udc device
  * @_dev: platform device
@@ -2427,6 +2435,8 @@ static int pxa_udc_probe(struct platform_device *pdev)
 			udc->gpiod = gpio_to_desc(mach->gpio_pullup);
 		}
 		udc->udc_command = mach->udc_command;
+	} else {
+		udc->gpiod = devm_gpiod_get(&pdev->dev, NULL);
 	}
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -2618,6 +2628,7 @@ static struct platform_driver udc_driver = {
 	.driver		= {
 		.name	= "pxa27x-udc",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(udc_pxa_dt_ids),
 	},
 	.probe		= pxa_udc_probe,
 	.remove		= pxa_udc_remove,
-- 
2.1.0.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

           reply	other threads:[~2014-10-17 17:16 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1413566234-13537-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>]

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=1413566234-13537-16-git-send-email-balbi@ti.com \
    --to=balbi-l0cymroini0@public.gmane.org \
    --cc=Peter.Chen-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=leoli-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=mina86-deATy8a+UHjQT0dZR+AlfA@public.gmane.org \
    --cc=paul.zimmerman-HKixBCOQz3hWk0Htik3J/w@public.gmane.org \
    --cc=r.baldyga-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=robert.jarzmik-GANU6spQydw@public.gmane.org \
    /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;
as well as URLs for NNTP newsgroup(s).