aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-11-02 05:03:51 -0400
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-11-17 04:01:20 -0500
commite08300043ee4e2df10be551b76e126d6c02f26cc (patch)
tree7b6125c6d6bb3d6e853bc251077fa4ac28223f7d
parent300f86da1787c680598ea441aaa602a1664fba86 (diff)
ARM: imx: dynamically allocate imx_udc device
This is only available for mx1 machines with no in-tree user. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--arch/arm/mach-imx/devices.c43
-rw-r--r--arch/arm/mach-imx/devices.h1
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig3
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx_udc.c75
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h16
-rw-r--r--arch/arm/plat-mxc/include/mach/mx1.h16
7 files changed, 103 insertions, 52 deletions
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
index cdc6f3271c5f..fba628551dc9 100644
--- a/arch/arm/mach-imx/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -70,49 +70,6 @@ struct platform_device imx1_camera_device = {
70 .num_resources = ARRAY_SIZE(imx1_camera_resources), 70 .num_resources = ARRAY_SIZE(imx1_camera_resources),
71}; 71};
72 72
73static struct resource imx_usb_resources[] = {
74 {
75 .start = 0x00212000,
76 .end = 0x00212148,
77 .flags = IORESOURCE_MEM,
78 }, {
79 .start = MX1_USBD_INT0,
80 .end = MX1_USBD_INT0,
81 .flags = IORESOURCE_IRQ,
82 }, {
83 .start = MX1_USBD_INT1,
84 .end = MX1_USBD_INT1,
85 .flags = IORESOURCE_IRQ,
86 }, {
87 .start = MX1_USBD_INT2,
88 .end = MX1_USBD_INT2,
89 .flags = IORESOURCE_IRQ,
90 }, {
91 .start = MX1_USBD_INT3,
92 .end = MX1_USBD_INT3,
93 .flags = IORESOURCE_IRQ,
94 }, {
95 .start = MX1_USBD_INT4,
96 .end = MX1_USBD_INT4,
97 .flags = IORESOURCE_IRQ,
98 }, {
99 .start = MX1_USBD_INT5,
100 .end = MX1_USBD_INT5,
101 .flags = IORESOURCE_IRQ,
102 }, {
103 .start = MX1_USBD_INT6,
104 .end = MX1_USBD_INT6,
105 .flags = IORESOURCE_IRQ,
106 },
107};
108
109struct platform_device imx_usb_device = {
110 .name = "imx_udc",
111 .id = 0,
112 .num_resources = ARRAY_SIZE(imx_usb_resources),
113 .resource = imx_usb_resources,
114};
115
116/* GPIO port description */ 73/* GPIO port description */
117static struct mxc_gpio_port imx_gpio_ports[] = { 74static struct mxc_gpio_port imx_gpio_ports[] = {
118 { 75 {
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h
index a7e47f4dbfcc..91906ce21c40 100644
--- a/arch/arm/mach-imx/devices.h
+++ b/arch/arm/mach-imx/devices.h
@@ -1,6 +1,5 @@
1#ifdef CONFIG_ARCH_MX1 1#ifdef CONFIG_ARCH_MX1
2extern struct platform_device imx1_camera_device; 2extern struct platform_device imx1_camera_device;
3extern struct platform_device imx_usb_device;
4#endif 3#endif
5 4
6#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) 5#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index fb664670c101..2703f5a05ce5 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -22,6 +22,9 @@ config IMX_HAVE_PLATFORM_IMX_SSI
22config IMX_HAVE_PLATFORM_IMX_UART 22config IMX_HAVE_PLATFORM_IMX_UART
23 bool 23 bool
24 24
25config IMX_HAVE_PLATFORM_IMX_UDC
26 bool
27
25config IMX_HAVE_PLATFORM_MXC_NAND 28config IMX_HAVE_PLATFORM_MXC_NAND
26 bool 29 bool
27 30
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 1d7d39201622..7c3eaf146f8b 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -6,6 +6,7 @@ obj-y += platform-imx-dma.o
6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o 6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
7obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o 7obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
8obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o 8obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
9obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o
9obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o 10obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
10obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o 11obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o
11obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o 12obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
diff --git a/arch/arm/plat-mxc/devices/platform-imx_udc.c b/arch/arm/plat-mxc/devices/platform-imx_udc.c
new file mode 100644
index 000000000000..6fd675dfce14
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx_udc.c
@@ -0,0 +1,75 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/hardware.h>
10#include <mach/devices-common.h>
11
12#define imx_imx_udc_data_entry_single(soc, _size) \
13 { \
14 .iobase = soc ## _USBD_BASE_ADDR, \
15 .iosize = _size, \
16 .irq0 = soc ## _INT_USBD0, \
17 .irq1 = soc ## _INT_USBD1, \
18 .irq2 = soc ## _INT_USBD2, \
19 .irq3 = soc ## _INT_USBD3, \
20 .irq4 = soc ## _INT_USBD4, \
21 .irq5 = soc ## _INT_USBD5, \
22 .irq6 = soc ## _INT_USBD6, \
23 }
24
25#define imx_imx_udc_data_entry(soc, _size) \
26 [_id] = imx_imx_udc_data_entry_single(soc, _size)
27
28#ifdef CONFIG_SOC_IMX1
29const struct imx_imx_udc_data imx1_imx_udc_data __initconst =
30 imx_imx_udc_data_entry_single(MX1, SZ_4K);
31#endif /* ifdef CONFIG_SOC_IMX1 */
32
33struct platform_device *__init imx_add_imx_udc(
34 const struct imx_imx_udc_data *data,
35 const struct imxusb_platform_data *pdata)
36{
37 struct resource res[] = {
38 {
39 .start = data->iobase,
40 .end = data->iobase + data->iosize - 1,
41 .flags = IORESOURCE_MEM,
42 }, {
43 .start = data->irq0,
44 .end = data->irq0,
45 .flags = IORESOURCE_IRQ,
46 }, {
47 .start = data->irq1,
48 .end = data->irq1,
49 .flags = IORESOURCE_IRQ,
50 }, {
51 .start = data->irq2,
52 .end = data->irq2,
53 .flags = IORESOURCE_IRQ,
54 }, {
55 .start = data->irq3,
56 .end = data->irq3,
57 .flags = IORESOURCE_IRQ,
58 }, {
59 .start = data->irq4,
60 .end = data->irq4,
61 .flags = IORESOURCE_IRQ,
62 }, {
63 .start = data->irq5,
64 .end = data->irq5,
65 .flags = IORESOURCE_IRQ,
66 }, {
67 .start = data->irq6,
68 .end = data->irq6,
69 .flags = IORESOURCE_IRQ,
70 },
71 };
72
73 return imx_add_platform_device("imx_udc", 0,
74 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
75}
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 431e0ef4a832..4eb45fa53ac5 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -82,6 +82,22 @@ struct platform_device *__init imx_add_imx_uart_1irq(
82 const struct imx_imx_uart_1irq_data *data, 82 const struct imx_imx_uart_1irq_data *data,
83 const struct imxuart_platform_data *pdata); 83 const struct imxuart_platform_data *pdata);
84 84
85#include <mach/usb.h>
86struct imx_imx_udc_data {
87 resource_size_t iobase;
88 resource_size_t iosize;
89 resource_size_t irq0;
90 resource_size_t irq1;
91 resource_size_t irq2;
92 resource_size_t irq3;
93 resource_size_t irq4;
94 resource_size_t irq5;
95 resource_size_t irq6;
96};
97struct platform_device *__init imx_add_imx_udc(
98 const struct imx_imx_udc_data *data,
99 const struct imxusb_platform_data *pdata);
100
85#include <mach/mxc_nand.h> 101#include <mach/mxc_nand.h>
86struct imx_mxc_nand_data { 102struct imx_mxc_nand_data {
87 /* 103 /*
diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/plat-mxc/include/mach/mx1.h
index b6771f4ef39c..2cd3fcd1e0cf 100644
--- a/arch/arm/plat-mxc/include/mach/mx1.h
+++ b/arch/arm/plat-mxc/include/mach/mx1.h
@@ -114,13 +114,13 @@
114#define MX1_SSI_RX_INT 44 114#define MX1_SSI_RX_INT 44
115#define MX1_SSI_RX_ERR_INT 45 115#define MX1_SSI_RX_ERR_INT 45
116#define MX1_TOUCH_INT 46 116#define MX1_TOUCH_INT 46
117#define MX1_USBD_INT0 47 117#define MX1_INT_USBD0 47
118#define MX1_USBD_INT1 48 118#define MX1_INT_USBD1 48
119#define MX1_USBD_INT2 49 119#define MX1_INT_USBD2 49
120#define MX1_USBD_INT3 50 120#define MX1_INT_USBD3 50
121#define MX1_USBD_INT4 51 121#define MX1_INT_USBD4 51
122#define MX1_USBD_INT5 52 122#define MX1_INT_USBD5 52
123#define MX1_USBD_INT6 53 123#define MX1_INT_USBD6 53
124#define MX1_BTSYS_INT 55 124#define MX1_BTSYS_INT 55
125#define MX1_BTTIM_INT 56 125#define MX1_BTTIM_INT 56
126#define MX1_BTWUI_INT 57 126#define MX1_BTWUI_INT 57
@@ -163,6 +163,6 @@
163 * to not break drivers/usb/gadget/imx_udc. Should go 163 * to not break drivers/usb/gadget/imx_udc. Should go
164 * away after this driver uses the new name. 164 * away after this driver uses the new name.
165 */ 165 */
166#define USBD_INT0 MX1_USBD_INT0 166#define USBD_INT0 MX1_INT_USBD0
167 167
168#endif /* ifndef __MACH_MX1_H__ */ 168#endif /* ifndef __MACH_MX1_H__ */