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 <robert.jarzmik@free.fr>
Cc: devicetree@vger.kernel.org
Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Robert Jarzmik 2014-10-01 22:06:16 +02:00 коммит произвёл Felipe Balbi
Родитель 3ec8347bfa
Коммит 1803fe15ad
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -27,6 +27,8 @@
#include <linux/prefetch.h> #include <linux/prefetch.h>
#include <linux/byteorder/generic.h> #include <linux/byteorder/generic.h>
#include <linux/platform_data/pxa2xx_udc.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.h>
#include <linux/usb/ch9.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 * pxa_udc_probe - probes the udc device
* @_dev: platform 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->gpiod = gpio_to_desc(mach->gpio_pullup);
} }
udc->udc_command = mach->udc_command; udc->udc_command = mach->udc_command;
} else {
udc->gpiod = devm_gpiod_get(&pdev->dev, NULL);
} }
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@ -2618,6 +2628,7 @@ static struct platform_driver udc_driver = {
.driver = { .driver = {
.name = "pxa27x-udc", .name = "pxa27x-udc",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_match_ptr(udc_pxa_dt_ids),
}, },
.probe = pxa_udc_probe, .probe = pxa_udc_probe,
.remove = pxa_udc_remove, .remove = pxa_udc_remove,