aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-28 15:34:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-28 15:34:33 -0400
commit09893ee84591b0417a9186a7e7cf1503ccf99ac2 (patch)
treeda8b044ad157b82203df04ae48cb60f4737cc390 /drivers/usb
parent4bb2d1009f671815870e8f78e826e4f9071392a7 (diff)
parent7d1206bc2859c6e9f46e35ae697c138e7d7858a7 (diff)
Merge tag 'dt2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull "ARM: More device tree support updates" from Olof Johansson: "This branch contains a number of updates for device tree support on several ARM platforms, in particular: * AT91 continues the device tree conversion adding support for a number of on-chip drivers and other functionality * ux500 adds probing of some of the core SoC blocks through device tree * Initial device tree support for ST SPEAr600 platforms * kirkwood continues the conversion to device-tree probing" Manually merge arch/arm/mach-ux500/Kconfig due to MACH_U8500 rename, and drivers/usb/gadget/at91_udc.c due to header file include cleanups. Also do an "evil merge" for the MACH_U8500 config option rename that the affected RMI4 touchscreen driver in staging. It's called MACH_MOP500 now, and it was missed during previous merges. * tag 'dt2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (48 commits) ARM: SPEAr600: Add device-tree support to SPEAr600 boards ARM: ux500: Provide local timer support for Device Tree ARM: ux500: Enable PL022 SSP Controller in Device Tree ARM: ux500: Enable PL310 Level 2 Cache Controller in Device Tree ARM: ux500: Enable PL011 AMBA UART Controller for Device Tree ARM: ux500: Enable Cortex-A9 GIC (Generic Interrupt Controller) in Device Tree ARM: ux500: db8500: list most devices in the snowball device tree ARM: ux500: split dts file for snowball into generic part ARM: ux500: combine the board init functions for DT boot ARM: ux500: Initial Device Tree support for Snowball ARM: ux500: CONFIG: Enable Device Tree support for future endeavours ARM: kirkwood: use devicetree for rtc-mv ARM: kirkwood: rtc-mv devicetree bindings ARM: kirkwood: fdt: define uart[01] as disabled, enable uart0 ARM: kirkwood: fdt: facilitate new boards during fdt migration ARM: kirkwood: fdt: absorb kirkwood_init() ARM: kirkwood: fdt: use mrvl ticker symbol ARM: orion: wdt: use resource vice direct access ARM: Kirkwood: Remove tclk from kirkwood_asoc_platform_data. ARM: orion: spi: remove enable_clock_fix which is not used ...
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/Kconfig2
-rw-r--r--drivers/usb/gadget/Kconfig2
-rw-r--r--drivers/usb/gadget/at91_udc.c40
-rw-r--r--drivers/usb/host/ehci-atmel.c24
-rw-r--r--drivers/usb/host/ohci-at91.c101
5 files changed, 163 insertions, 6 deletions
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 48ac6e781ba2..cbd8f5f80596 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -44,7 +44,7 @@ config USB_ARCH_HAS_EHCI
44 default y if PPC_MPC512x 44 default y if PPC_MPC512x
45 default y if ARCH_IXP4XX 45 default y if ARCH_IXP4XX
46 default y if ARCH_W90X900 46 default y if ARCH_W90X900
47 default y if ARCH_AT91SAM9G45 47 default y if ARCH_AT91
48 default y if ARCH_MXC 48 default y if ARCH_MXC
49 default y if ARCH_OMAP3 49 default y if ARCH_OMAP3
50 default y if ARCH_CNS3XXX 50 default y if ARCH_CNS3XXX
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 26c0b75f152e..2633f7595116 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 2db5f68f7960..36fd2b4b49a2 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -29,6 +29,8 @@
29#include <linux/clk.h> 29#include <linux/clk.h>
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/of.h>
33#include <linux/of_gpio.h>
32 34
33#include <asm/byteorder.h> 35#include <asm/byteorder.h>
34#include <mach/hardware.h> 36#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
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index a5a3ef1f0096..19f318ababa2 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/of_platform.h>
16 17
17/* interface and function clocks */ 18/* interface and function clocks */
18static struct clk *iclk, *fclk; 19static struct clk *iclk, *fclk;
@@ -115,6 +116,8 @@ static const struct hc_driver ehci_atmel_hc_driver = {
115 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, 116 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
116}; 117};
117 118
119static u64 at91_ehci_dma_mask = DMA_BIT_MASK(32);
120
118static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev) 121static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev)
119{ 122{
120 struct usb_hcd *hcd; 123 struct usb_hcd *hcd;
@@ -137,6 +140,13 @@ static int __devinit ehci_atmel_drv_probe(struct platform_device *pdev)
137 goto fail_create_hcd; 140 goto fail_create_hcd;
138 } 141 }
139 142
143 /* Right now device-tree probed devices don't get dma_mask set.
144 * Since shared usb code relies on it, set it here for now.
145 * Once we have dma capability bindings this can go away.
146 */
147 if (!pdev->dev.dma_mask)
148 pdev->dev.dma_mask = &at91_ehci_dma_mask;
149
140 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev)); 150 hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
141 if (!hcd) { 151 if (!hcd) {
142 retval = -ENOMEM; 152 retval = -ENOMEM;
@@ -225,9 +235,21 @@ static int __devexit ehci_atmel_drv_remove(struct platform_device *pdev)
225 return 0; 235 return 0;
226} 236}
227 237
238#ifdef CONFIG_OF
239static const struct of_device_id atmel_ehci_dt_ids[] = {
240 { .compatible = "atmel,at91sam9g45-ehci" },
241 { /* sentinel */ }
242};
243
244MODULE_DEVICE_TABLE(of, atmel_ehci_dt_ids);
245#endif
246
228static struct platform_driver ehci_atmel_driver = { 247static struct platform_driver ehci_atmel_driver = {
229 .probe = ehci_atmel_drv_probe, 248 .probe = ehci_atmel_drv_probe,
230 .remove = __devexit_p(ehci_atmel_drv_remove), 249 .remove = __devexit_p(ehci_atmel_drv_remove),
231 .shutdown = usb_hcd_platform_shutdown, 250 .shutdown = usb_hcd_platform_shutdown,
232 .driver.name = "atmel-ehci", 251 .driver = {
252 .name = "atmel-ehci",
253 .of_match_table = of_match_ptr(atmel_ehci_dt_ids),
254 },
233}; 255};
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
index 8e855eb0bf89..db8963f5fbce 100644
--- a/drivers/usb/host/ohci-at91.c
+++ b/drivers/usb/host/ohci-at91.c
@@ -14,6 +14,8 @@
14 14
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/of_platform.h>
18#include <linux/of_gpio.h>
17 19
18#include <mach/hardware.h> 20#include <mach/hardware.h>
19#include <asm/gpio.h> 21#include <asm/gpio.h>
@@ -477,13 +479,109 @@ static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
477 return IRQ_HANDLED; 479 return IRQ_HANDLED;
478} 480}
479 481
482#ifdef CONFIG_OF
483static const struct of_device_id at91_ohci_dt_ids[] = {
484 { .compatible = "atmel,at91rm9200-ohci" },
485 { /* sentinel */ }
486};
487
488MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);
489
490static u64 at91_ohci_dma_mask = DMA_BIT_MASK(32);
491
492static int __devinit ohci_at91_of_init(struct platform_device *pdev)
493{
494 struct device_node *np = pdev->dev.of_node;
495 int i, ret, gpio;
496 enum of_gpio_flags flags;
497 struct at91_usbh_data *pdata;
498 u32 ports;
499
500 if (!np)
501 return 0;
502
503 /* Right now device-tree probed devices don't get dma_mask set.
504 * Since shared usb code relies on it, set it here for now.
505 * Once we have dma capability bindings this can go away.
506 */
507 if (!pdev->dev.dma_mask)
508 pdev->dev.dma_mask = &at91_ohci_dma_mask;
509
510 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
511 if (!pdata)
512 return -ENOMEM;
513
514 if (!of_property_read_u32(np, "num-ports", &ports))
515 pdata->ports = ports;
516
517 for (i = 0; i < 2; i++) {
518 gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags);
519 pdata->vbus_pin[i] = gpio;
520 if (!gpio_is_valid(gpio))
521 continue;
522 pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
523 ret = gpio_request(gpio, "ohci_vbus");
524 if (ret) {
525 dev_warn(&pdev->dev, "can't request vbus gpio %d", gpio);
526 continue;
527 }
528 ret = gpio_direction_output(gpio, !(flags & OF_GPIO_ACTIVE_LOW) ^ 1);
529 if (ret)
530 dev_warn(&pdev->dev, "can't put vbus gpio %d as output %d",
531 !(flags & OF_GPIO_ACTIVE_LOW) ^ 1, gpio);
532 }
533
534 for (i = 0; i < 2; i++) {
535 gpio = of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
536 pdata->overcurrent_pin[i] = gpio;
537 if (!gpio_is_valid(gpio))
538 continue;
539 ret = gpio_request(gpio, "ohci_overcurrent");
540 if (ret) {
541 dev_err(&pdev->dev, "can't request overcurrent gpio %d", gpio);
542 continue;
543 }
544
545 ret = gpio_direction_input(gpio);
546 if (ret) {
547 dev_err(&pdev->dev, "can't configure overcurrent gpio %d as input", gpio);
548 continue;
549 }
550
551 ret = request_irq(gpio_to_irq(gpio),
552 ohci_hcd_at91_overcurrent_irq,
553 IRQF_SHARED, "ohci_overcurrent", pdev);
554 if (ret) {
555 gpio_free(gpio);
556 dev_warn(& pdev->dev, "cannot get GPIO IRQ for overcurrent\n");
557 }
558 }
559
560 pdev->dev.platform_data = pdata;
561
562 return 0;
563}
564#else
565static int __devinit ohci_at91_of_init(struct platform_device *pdev)
566{
567 return 0;
568}
569#endif
570
480/*-------------------------------------------------------------------------*/ 571/*-------------------------------------------------------------------------*/
481 572
482static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) 573static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
483{ 574{
484 struct at91_usbh_data *pdata = pdev->dev.platform_data; 575 struct at91_usbh_data *pdata;
485 int i; 576 int i;
486 577
578 i = ohci_at91_of_init(pdev);
579
580 if (i)
581 return i;
582
583 pdata = pdev->dev.platform_data;
584
487 if (pdata) { 585 if (pdata) {
488 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { 586 for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
489 if (!gpio_is_valid(pdata->vbus_pin[i])) 587 if (!gpio_is_valid(pdata->vbus_pin[i]))
@@ -596,5 +694,6 @@ static struct platform_driver ohci_hcd_at91_driver = {
596 .driver = { 694 .driver = {
597 .name = "at91_ohci", 695 .name = "at91_ohci",
598 .owner = THIS_MODULE, 696 .owner = THIS_MODULE,
697 .of_match_table = of_match_ptr(at91_ohci_dt_ids),
599 }, 698 },
600}; 699};