aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-03-16 09:07:59 -0400
committerArnd Bergmann <arnd@arndb.de>2012-03-16 09:07:59 -0400
commit4acf18232f80c29906356f0f35b2d5f800b5953d (patch)
tree158de45bede17ecc679b772d022288c7f5a56b74 /drivers
parent2a9f23d82a79d2785429aba43b02683abf103c0b (diff)
parent0f5c4b996a740c3849d657b11b390bba07374415 (diff)
Merge branch 'at91-3.4-cleanup2-DT2+USB' of git://github.com/at91linux/linux-at91 into next/dt
* 'at91-3.4-cleanup2-DT2+USB' of git://github.com/at91linux/linux-at91: ARM: at91: sam9g20 udc add dt support USB: at91: Device udc add dt support
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/gadget/Kconfig2
-rw-r--r--drivers/usb/gadget/at91_udc.c40
2 files changed, 39 insertions, 3 deletions
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 85ae4b46bb68..edf114412135 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -137,7 +137,7 @@ choice
137 137
138config USB_AT91 138config USB_AT91
139 tristate "Atmel AT91 USB Device Port" 139 tristate "Atmel AT91 USB Device Port"
140 depends on ARCH_AT91 && !ARCH_AT91SAM9RL && !ARCH_AT91SAM9G45 140 depends on ARCH_AT91
141 help 141 help
142 Many Atmel AT91 processors (such as the AT91RM2000) have a 142 Many Atmel AT91 processors (such as the AT91RM2000) have a
143 full speed USB Device Port with support for five configurable 143 full speed USB Device Port with support for five configurable
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index f99b3dc745bd..4063209fe8da 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -30,6 +30,8 @@
30#include <linux/usb/ch9.h> 30#include <linux/usb/ch9.h>
31#include <linux/usb/gadget.h> 31#include <linux/usb/gadget.h>
32#include <linux/prefetch.h> 32#include <linux/prefetch.h>
33#include <linux/of.h>
34#include <linux/of_gpio.h>
33 35
34#include <asm/byteorder.h> 36#include <asm/byteorder.h>
35#include <mach/hardware.h> 37#include <mach/hardware.h>
@@ -1707,7 +1709,27 @@ static void at91udc_shutdown(struct platform_device *dev)
1707 spin_unlock_irqrestore(&udc->lock, flags); 1709 spin_unlock_irqrestore(&udc->lock, flags);
1708} 1710}
1709 1711
1710static int __init at91udc_probe(struct platform_device *pdev) 1712static void __devinit at91udc_of_init(struct at91_udc *udc,
1713 struct device_node *np)
1714{
1715 struct at91_udc_data *board = &udc->board;
1716 u32 val;
1717 enum of_gpio_flags flags;
1718
1719 if (of_property_read_u32(np, "atmel,vbus-polled", &val) == 0)
1720 board->vbus_polled = 1;
1721
1722 board->vbus_pin = of_get_named_gpio_flags(np, "atmel,vbus-gpio", 0,
1723 &flags);
1724 board->vbus_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
1725
1726 board->pullup_pin = of_get_named_gpio_flags(np, "atmel,pullup-gpio", 0,
1727 &flags);
1728
1729 board->pullup_active_low = (flags & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
1730}
1731
1732static int __devinit at91udc_probe(struct platform_device *pdev)
1711{ 1733{
1712 struct device *dev = &pdev->dev; 1734 struct device *dev = &pdev->dev;
1713 struct at91_udc *udc; 1735 struct at91_udc *udc;
@@ -1742,7 +1764,11 @@ static int __init at91udc_probe(struct platform_device *pdev)
1742 /* init software state */ 1764 /* init software state */
1743 udc = &controller; 1765 udc = &controller;
1744 udc->gadget.dev.parent = dev; 1766 udc->gadget.dev.parent = dev;
1745 udc->board = *(struct at91_udc_data *) dev->platform_data; 1767 if (pdev->dev.of_node)
1768 at91udc_of_init(udc, pdev->dev.of_node);
1769 else
1770 memcpy(&udc->board, dev->platform_data,
1771 sizeof(struct at91_udc_data));
1746 udc->pdev = pdev; 1772 udc->pdev = pdev;
1747 udc->enabled = 0; 1773 udc->enabled = 0;
1748 spin_lock_init(&udc->lock); 1774 spin_lock_init(&udc->lock);
@@ -1971,6 +1997,15 @@ static int at91udc_resume(struct platform_device *pdev)
1971#define at91udc_resume NULL 1997#define at91udc_resume NULL
1972#endif 1998#endif
1973 1999
2000#if defined(CONFIG_OF)
2001static const struct of_device_id at91_udc_dt_ids[] = {
2002 { .compatible = "atmel,at91rm9200-udc" },
2003 { /* sentinel */ }
2004};
2005
2006MODULE_DEVICE_TABLE(of, at91_udc_dt_ids);
2007#endif
2008
1974static struct platform_driver at91_udc_driver = { 2009static struct platform_driver at91_udc_driver = {
1975 .remove = __exit_p(at91udc_remove), 2010 .remove = __exit_p(at91udc_remove),
1976 .shutdown = at91udc_shutdown, 2011 .shutdown = at91udc_shutdown,
@@ -1979,6 +2014,7 @@ static struct platform_driver at91_udc_driver = {
1979 .driver = { 2014 .driver = {
1980 .name = (char *) driver_name, 2015 .name = (char *) driver_name,
1981 .owner = THIS_MODULE, 2016 .owner = THIS_MODULE,
2017 .of_match_table = of_match_ptr(at91_udc_dt_ids),
1982 }, 2018 },
1983}; 2019};
1984 2020