From 1803fe15ad54e68aae8b2b44e04a635e9b5d52f2 Mon Sep 17 00:00:00 2001 From: Robert Jarzmik Date: Wed, 1 Oct 2014 22:06:16 +0200 Subject: [PATCH] usb: gadget: pxa27x_udc: add devicetree support Add support for device-tree device discovery. If devicetree is not provided, fallback to legacy platform data "discovery". Signed-off-by: Robert Jarzmik Cc: devicetree@vger.kernel.org Signed-off-by: Felipe Balbi --- 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 5280f64683fb..55598c0d083c 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include @@ -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.20.1