devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 15/67] usb: gadget: pxa27x_udc: add devicetree support
       [not found] ` <1413566234-13537-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
@ 2014-10-17 17:16   ` Felipe Balbi
  0 siblings, 0 replies; only message in thread
From: Felipe Balbi @ 2014-10-17 17:16 UTC (permalink / raw)
  To: Linux USB Mailing List
  Cc: Greg KH, m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ, Paul Zimmerman,
	daniel-cYrQPVfZoowdnm+yROfE0A, leoli-KZfg59tc24xl57MIdRCFDg,
	andrzej.p-Sze3O3UU22JBDgjK7y7TUQ,
	r.baldyga-Sze3O3UU22JBDgjK7y7TUQ, mina86-deATy8a+UHjQT0dZR+AlfA,
	Peter.Chen-KZfg59tc24xl57MIdRCFDg, Robert Jarzmik,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Felipe Balbi

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-10-17 17:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1413566234-13537-1-git-send-email-balbi@ti.com>
     [not found] ` <1413566234-13537-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org>
2014-10-17 17:16   ` [PATCH 15/67] usb: gadget: pxa27x_udc: add devicetree support Felipe Balbi

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).