aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx3')
-rw-r--r--arch/arm/mach-mx3/Kconfig1
-rw-r--r--arch/arm/mach-mx3/devices.c40
-rw-r--r--arch/arm/mach-mx3/devices.h2
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c87
-rw-r--r--arch/arm/mach-mx3/mach-mx31lilly.c145
-rw-r--r--arch/arm/mach-mx3/mach-mx31moboard.c104
-rw-r--r--arch/arm/mach-mx3/mach-pcm037.c1
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c1
-rw-r--r--arch/arm/mach-mx3/mx31lite-db.c1
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c9
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c8
-rw-r--r--arch/arm/mach-mx3/mx31moboard-smartbot.c53
12 files changed, 379 insertions, 73 deletions
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 170f68e46dd5..344753fdf25e 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -82,6 +82,7 @@ config MACH_MX31MOBOARD
82config MACH_MX31LILLY 82config MACH_MX31LILLY
83 bool "Support MX31 LILLY-1131 platforms (INCO startec)" 83 bool "Support MX31 LILLY-1131 platforms (INCO startec)"
84 select ARCH_MX31 84 select ARCH_MX31
85 select MXC_ULPI if USB_ULPI
85 help 86 help
86 Include support for mx31 based LILLY1131 modules. This includes 87 Include support for mx31 based LILLY1131 modules. This includes
87 specific configurations for the board and its peripherals. 88 specific configurations for the board and its peripherals.
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index f8911154a9fa..db7acd6e9101 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -582,12 +582,50 @@ static struct resource imx_wdt_resources[] = {
582}; 582};
583 583
584struct platform_device imx_wdt_device0 = { 584struct platform_device imx_wdt_device0 = {
585 .name = "imx-wdt", 585 .name = "imx2-wdt",
586 .id = 0, 586 .id = 0,
587 .num_resources = ARRAY_SIZE(imx_wdt_resources), 587 .num_resources = ARRAY_SIZE(imx_wdt_resources),
588 .resource = imx_wdt_resources, 588 .resource = imx_wdt_resources,
589}; 589};
590 590
591static struct resource imx_rtc_resources[] = {
592 {
593 .start = MX31_RTC_BASE_ADDR,
594 .end = MX31_RTC_BASE_ADDR + 0x3fff,
595 .flags = IORESOURCE_MEM,
596 },
597 {
598 .start = MX31_INT_RTC,
599 .flags = IORESOURCE_IRQ,
600 },
601};
602
603struct platform_device imx_rtc_device0 = {
604 .name = "mxc_rtc",
605 .id = -1,
606 .num_resources = ARRAY_SIZE(imx_rtc_resources),
607 .resource = imx_rtc_resources,
608};
609
610static struct resource imx_kpp_resources[] = {
611 {
612 .start = MX3x_KPP_BASE_ADDR,
613 .end = MX3x_KPP_BASE_ADDR + 0xf,
614 .flags = IORESOURCE_MEM
615 }, {
616 .start = MX3x_INT_KPP,
617 .end = MX3x_INT_KPP,
618 .flags = IORESOURCE_IRQ,
619 },
620};
621
622struct platform_device imx_kpp_device = {
623 .name = "imx-keypad",
624 .id = -1,
625 .num_resources = ARRAY_SIZE(imx_kpp_resources),
626 .resource = imx_kpp_resources,
627};
628
591static int __init mx3_devices_init(void) 629static int __init mx3_devices_init(void)
592{ 630{
593 if (cpu_is_mx31()) { 631 if (cpu_is_mx31()) {
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 4f77eb501274..2c3c8646a29e 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -27,3 +27,5 @@ extern struct platform_device imx_ssi_device0;
27extern struct platform_device imx_ssi_device1; 27extern struct platform_device imx_ssi_device1;
28extern struct platform_device imx_ssi_device1; 28extern struct platform_device imx_ssi_device1;
29extern struct platform_device imx_wdt_device0; 29extern struct platform_device imx_wdt_device0;
30extern struct platform_device imx_rtc_device0;
31extern struct platform_device imx_kpp_device;
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index f54af1e29ca4..58e57291b79d 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -16,6 +16,7 @@
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */ 17 */
18 18
19#include <linux/delay.h>
19#include <linux/types.h> 20#include <linux/types.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/clk.h> 22#include <linux/clk.h>
@@ -26,6 +27,8 @@
26#include <linux/mfd/mc13783.h> 27#include <linux/mfd/mc13783.h>
27#include <linux/spi/spi.h> 28#include <linux/spi/spi.h>
28#include <linux/regulator/machine.h> 29#include <linux/regulator/machine.h>
30#include <linux/fsl_devices.h>
31#include <linux/input/matrix_keypad.h>
29 32
30#include <mach/hardware.h> 33#include <mach/hardware.h>
31#include <asm/mach-types.h> 34#include <asm/mach-types.h>
@@ -65,6 +68,50 @@ static int mx31_3ds_pins[] = {
65 MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */ 68 MX31_PIN_CSPI2_SS2__SS2, /*CS for MC13783 */
66 /* MC13783 IRQ */ 69 /* MC13783 IRQ */
67 IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO), 70 IOMUX_MODE(MX31_PIN_GPIO1_3, IOMUX_CONFIG_GPIO),
71 /* USB OTG reset */
72 IOMUX_MODE(MX31_PIN_USB_PWR, IOMUX_CONFIG_GPIO),
73 /* USB OTG */
74 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
75 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
76 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
77 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
78 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
79 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
80 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
81 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
82 MX31_PIN_USBOTG_CLK__USBOTG_CLK,
83 MX31_PIN_USBOTG_DIR__USBOTG_DIR,
84 MX31_PIN_USBOTG_NXT__USBOTG_NXT,
85 MX31_PIN_USBOTG_STP__USBOTG_STP,
86 /*Keyboard*/
87 MX31_PIN_KEY_ROW0_KEY_ROW0,
88 MX31_PIN_KEY_ROW1_KEY_ROW1,
89 MX31_PIN_KEY_ROW2_KEY_ROW2,
90 MX31_PIN_KEY_COL0_KEY_COL0,
91 MX31_PIN_KEY_COL1_KEY_COL1,
92 MX31_PIN_KEY_COL2_KEY_COL2,
93 MX31_PIN_KEY_COL3_KEY_COL3,
94};
95
96/*
97 * Matrix keyboard
98 */
99
100static const uint32_t mx31_3ds_keymap[] = {
101 KEY(0, 0, KEY_UP),
102 KEY(0, 1, KEY_DOWN),
103 KEY(1, 0, KEY_RIGHT),
104 KEY(1, 1, KEY_LEFT),
105 KEY(1, 2, KEY_ENTER),
106 KEY(2, 0, KEY_F6),
107 KEY(2, 1, KEY_F8),
108 KEY(2, 2, KEY_F9),
109 KEY(2, 3, KEY_F10),
110};
111
112static struct matrix_keymap_data mx31_3ds_keymap_data = {
113 .keymap = mx31_3ds_keymap,
114 .keymap_size = ARRAY_SIZE(mx31_3ds_keymap),
68}; 115};
69 116
70/* Regulators */ 117/* Regulators */
@@ -126,6 +173,41 @@ static struct mxc_nand_platform_data imx31_3ds_nand_flash_pdata = {
126#endif 173#endif
127}; 174};
128 175
176/*
177 * USB OTG
178 */
179
180#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
181 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
182
183#define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR)
184
185static void mx31_3ds_usbotg_init(void)
186{
187 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
188 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
189 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
190 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
191 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
192 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
193 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
194 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
195 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
196 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
197 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
198 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
199
200 gpio_request(USBOTG_RST_B, "otgusb-reset");
201 gpio_direction_output(USBOTG_RST_B, 0);
202 mdelay(1);
203 gpio_set_value(USBOTG_RST_B, 1);
204}
205
206static struct fsl_usb2_platform_data usbotg_pdata = {
207 .operating_mode = FSL_USB2_DR_DEVICE,
208 .phy_mode = FSL_USB2_PHY_ULPI,
209};
210
129static struct imxuart_platform_data uart_pdata = { 211static struct imxuart_platform_data uart_pdata = {
130 .flags = IMXUART_HAVE_RTSCTS, 212 .flags = IMXUART_HAVE_RTSCTS,
131}; 213};
@@ -315,6 +397,11 @@ static void __init mxc_board_init(void)
315 spi_register_board_info(mx31_3ds_spi_devs, 397 spi_register_board_info(mx31_3ds_spi_devs,
316 ARRAY_SIZE(mx31_3ds_spi_devs)); 398 ARRAY_SIZE(mx31_3ds_spi_devs));
317 399
400 mxc_register_device(&imx_kpp_device, &mx31_3ds_keymap_data);
401
402 mx31_3ds_usbotg_init();
403 mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata);
404
318 if (!mx31_3ds_init_expio()) 405 if (!mx31_3ds_init_expio())
319 platform_device_register(&smsc911x_device); 406 platform_device_register(&smsc911x_device);
320} 407}
diff --git a/arch/arm/mach-mx3/mach-mx31lilly.c b/arch/arm/mach-mx3/mach-mx31lilly.c
index 80847b04c063..d3d5877c750e 100644
--- a/arch/arm/mach-mx3/mach-mx31lilly.c
+++ b/arch/arm/mach-mx3/mach-mx31lilly.c
@@ -27,12 +27,15 @@
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/clk.h> 29#include <linux/clk.h>
30#include <linux/gpio.h>
30#include <linux/platform_device.h> 31#include <linux/platform_device.h>
31#include <linux/interrupt.h> 32#include <linux/interrupt.h>
32#include <linux/smsc911x.h> 33#include <linux/smsc911x.h>
33#include <linux/mtd/physmap.h> 34#include <linux/mtd/physmap.h>
34#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
35#include <linux/mfd/mc13783.h> 36#include <linux/mfd/mc13783.h>
37#include <linux/usb/otg.h>
38#include <linux/usb/ulpi.h>
36 39
37#include <asm/mach-types.h> 40#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 41#include <asm/mach/arch.h>
@@ -44,6 +47,8 @@
44#include <mach/iomux-mx3.h> 47#include <mach/iomux-mx3.h>
45#include <mach/board-mx31lilly.h> 48#include <mach/board-mx31lilly.h>
46#include <mach/spi.h> 49#include <mach/spi.h>
50#include <mach/mxc_ehci.h>
51#include <mach/ulpi.h>
47 52
48#include "devices.h" 53#include "devices.h"
49 54
@@ -108,6 +113,137 @@ static struct platform_device physmap_flash_device = {
108 .num_resources = 1, 113 .num_resources = 1,
109}; 114};
110 115
116/* USB */
117
118#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
119 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
120
121static int usbotg_init(struct platform_device *pdev)
122{
123 unsigned int pins[] = {
124 MX31_PIN_USBOTG_DATA0__USBOTG_DATA0,
125 MX31_PIN_USBOTG_DATA1__USBOTG_DATA1,
126 MX31_PIN_USBOTG_DATA2__USBOTG_DATA2,
127 MX31_PIN_USBOTG_DATA3__USBOTG_DATA3,
128 MX31_PIN_USBOTG_DATA4__USBOTG_DATA4,
129 MX31_PIN_USBOTG_DATA5__USBOTG_DATA5,
130 MX31_PIN_USBOTG_DATA6__USBOTG_DATA6,
131 MX31_PIN_USBOTG_DATA7__USBOTG_DATA7,
132 MX31_PIN_USBOTG_CLK__USBOTG_CLK,
133 MX31_PIN_USBOTG_DIR__USBOTG_DIR,
134 MX31_PIN_USBOTG_NXT__USBOTG_NXT,
135 MX31_PIN_USBOTG_STP__USBOTG_STP,
136 };
137
138 mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB OTG");
139
140 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
141 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
142 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
143 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
144 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
145 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
146 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
147 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
148 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
149 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
150 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
151 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
152
153 mxc_iomux_set_gpr(MUX_PGP_USB_4WIRE, true);
154 mxc_iomux_set_gpr(MUX_PGP_USB_COMMON, true);
155
156 /* chip select */
157 mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE2, IOMUX_CONFIG_GPIO),
158 "USBOTG_CS");
159 gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE2), "USBH1 CS");
160 gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE2), 0);
161
162 return 0;
163}
164
165static int usbh1_init(struct platform_device *pdev)
166{
167 int pins[] = {
168 MX31_PIN_CSPI1_MOSI__USBH1_RXDM,
169 MX31_PIN_CSPI1_MISO__USBH1_RXDP,
170 MX31_PIN_CSPI1_SS0__USBH1_TXDM,
171 MX31_PIN_CSPI1_SS1__USBH1_TXDP,
172 MX31_PIN_CSPI1_SS2__USBH1_RCV,
173 MX31_PIN_CSPI1_SCLK__USBH1_OEB,
174 MX31_PIN_CSPI1_SPI_RDY__USBH1_FS,
175 };
176
177 mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H1");
178
179 mxc_iomux_set_pad(MX31_PIN_CSPI1_MOSI, USB_PAD_CFG);
180 mxc_iomux_set_pad(MX31_PIN_CSPI1_MISO, USB_PAD_CFG);
181 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS0, USB_PAD_CFG);
182 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS1, USB_PAD_CFG);
183 mxc_iomux_set_pad(MX31_PIN_CSPI1_SS2, USB_PAD_CFG);
184 mxc_iomux_set_pad(MX31_PIN_CSPI1_SCLK, USB_PAD_CFG);
185 mxc_iomux_set_pad(MX31_PIN_CSPI1_SPI_RDY, USB_PAD_CFG);
186
187 mxc_iomux_set_gpr(MUX_PGP_USB_SUSPEND, true);
188
189 return 0;
190}
191
192static int usbh2_init(struct platform_device *pdev)
193{
194 int pins[] = {
195 MX31_PIN_USBH2_DATA0__USBH2_DATA0,
196 MX31_PIN_USBH2_DATA1__USBH2_DATA1,
197 MX31_PIN_USBH2_CLK__USBH2_CLK,
198 MX31_PIN_USBH2_DIR__USBH2_DIR,
199 MX31_PIN_USBH2_NXT__USBH2_NXT,
200 MX31_PIN_USBH2_STP__USBH2_STP,
201 };
202
203 mxc_iomux_setup_multiple_pins(pins, ARRAY_SIZE(pins), "USB H2");
204
205 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG);
206 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG);
207 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG);
208 mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
209 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
210 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
211 mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
212 mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
213 mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
214 mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
215 mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
216 mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
217
218 mxc_iomux_set_gpr(MUX_PGP_UH2, true);
219
220 /* chip select */
221 mxc_iomux_alloc_pin(IOMUX_MODE(MX31_PIN_DTR_DCE1, IOMUX_CONFIG_GPIO),
222 "USBH2_CS");
223 gpio_request(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), "USBH2 CS");
224 gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1), 0);
225
226 return 0;
227}
228
229static struct mxc_usbh_platform_data usbotg_pdata = {
230 .init = usbotg_init,
231 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
232 .flags = MXC_EHCI_POWER_PINS_ENABLED,
233};
234
235static struct mxc_usbh_platform_data usbh1_pdata = {
236 .init = usbh1_init,
237 .portsc = MXC_EHCI_MODE_UTMI | MXC_EHCI_SERIAL,
238 .flags = MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_INTERFACE_SINGLE_UNI,
239};
240
241static struct mxc_usbh_platform_data usbh2_pdata = {
242 .init = usbh2_init,
243 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
244 .flags = MXC_EHCI_POWER_PINS_ENABLED,
245};
246
111static struct platform_device *devices[] __initdata = { 247static struct platform_device *devices[] __initdata = {
112 &smsc91x_device, 248 &smsc91x_device,
113 &physmap_flash_device, 249 &physmap_flash_device,
@@ -183,6 +319,15 @@ static void __init mx31lilly_board_init(void)
183 spi_register_board_info(&mc13783_dev, 1); 319 spi_register_board_info(&mc13783_dev, 1);
184 320
185 platform_add_devices(devices, ARRAY_SIZE(devices)); 321 platform_add_devices(devices, ARRAY_SIZE(devices));
322
323 /* USB */
324 usbotg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
325 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
326 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
327 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
328
329 mxc_register_device(&mxc_usbh1, &usbh1_pdata);
330 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
186} 331}
187 332
188static void __init mx31lilly_timer_init(void) 333static void __init mx31lilly_timer_init(void)
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index fccb9207b78d..33a8d35498a7 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -18,7 +18,6 @@
18 18
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/dma-mapping.h> 20#include <linux/dma-mapping.h>
21#include <linux/fsl_devices.h>
22#include <linux/gfp.h> 21#include <linux/gfp.h>
23#include <linux/gpio.h> 22#include <linux/gpio.h>
24#include <linux/init.h> 23#include <linux/init.h>
@@ -306,84 +305,56 @@ static struct imxmmc_platform_data sdhc1_pdata = {
306 * this pin is dedicated for all mx31moboard systems, so we do it here 305 * this pin is dedicated for all mx31moboard systems, so we do it here
307 */ 306 */
308#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0) 307#define USB_RESET_B IOMUX_TO_GPIO(MX31_PIN_GPIO1_0)
309
310static void usb_xcvr_reset(void)
311{
312 gpio_request(USB_RESET_B, "usb-reset");
313 gpio_direction_output(USB_RESET_B, 0);
314 mdelay(1);
315 gpio_set_value(USB_RESET_B, 1);
316}
317
318#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ 308#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
319 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) 309 PAD_CTL_ODE_CMOS)
320 310
321#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC) 311#define OTG_EN_B IOMUX_TO_GPIO(MX31_PIN_USB_OC)
322
323static void moboard_usbotg_init(void)
324{
325 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
326 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
327 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
328 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG);
329 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG);
330 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG);
331 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG);
332 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG);
333 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG);
334 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG);
335 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
336 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
337
338 gpio_request(OTG_EN_B, "usb-udc-en");
339 gpio_direction_output(OTG_EN_B, 0);
340}
341
342static struct fsl_usb2_platform_data usb_pdata = {
343 .operating_mode = FSL_USB2_DR_DEVICE,
344 .phy_mode = FSL_USB2_PHY_ULPI,
345};
346
347#if defined(CONFIG_USB_ULPI)
348
349#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6) 312#define USBH2_EN_B IOMUX_TO_GPIO(MX31_PIN_SCK6)
350 313
351static int moboard_usbh2_hw_init(struct platform_device *pdev) 314static void usb_xcvr_reset(void)
352{ 315{
353 int ret; 316 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
317 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
318 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG | PAD_CTL_100K_PD);
319 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA3, USB_PAD_CFG | PAD_CTL_100K_PD);
320 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA4, USB_PAD_CFG | PAD_CTL_100K_PD);
321 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA5, USB_PAD_CFG | PAD_CTL_100K_PD);
322 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA6, USB_PAD_CFG | PAD_CTL_100K_PD);
323 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA7, USB_PAD_CFG | PAD_CTL_100K_PD);
324 mxc_iomux_set_pad(MX31_PIN_USBOTG_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
325 mxc_iomux_set_pad(MX31_PIN_USBOTG_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
326 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
327 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
354 328
355 mxc_iomux_set_gpr(MUX_PGP_UH2, true); 329 mxc_iomux_set_gpr(MUX_PGP_UH2, true);
330 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG | PAD_CTL_100K_PU);
331 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG | PAD_CTL_100K_PU);
332 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG | PAD_CTL_100K_PU);
333 mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG | PAD_CTL_100K_PU);
334 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG | PAD_CTL_100K_PD);
335 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG | PAD_CTL_100K_PD);
336 mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
337 mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG | PAD_CTL_100K_PD);
338 mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG | PAD_CTL_100K_PD);
339 mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG | PAD_CTL_100K_PD);
340 mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
341 mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG | PAD_CTL_100K_PD);
356 342
357 mxc_iomux_set_pad(MX31_PIN_USBH2_CLK, USB_PAD_CFG); 343 gpio_request(OTG_EN_B, "usb-udc-en");
358 mxc_iomux_set_pad(MX31_PIN_USBH2_DIR, USB_PAD_CFG); 344 gpio_direction_output(OTG_EN_B, 0);
359 mxc_iomux_set_pad(MX31_PIN_USBH2_NXT, USB_PAD_CFG); 345 gpio_request(USBH2_EN_B, "usbh2-en");
360 mxc_iomux_set_pad(MX31_PIN_USBH2_STP, USB_PAD_CFG);
361 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA0, USB_PAD_CFG);
362 mxc_iomux_set_pad(MX31_PIN_USBH2_DATA1, USB_PAD_CFG);
363 mxc_iomux_set_pad(MX31_PIN_SRXD6, USB_PAD_CFG);
364 mxc_iomux_set_pad(MX31_PIN_STXD6, USB_PAD_CFG);
365 mxc_iomux_set_pad(MX31_PIN_SFS3, USB_PAD_CFG);
366 mxc_iomux_set_pad(MX31_PIN_SCK3, USB_PAD_CFG);
367 mxc_iomux_set_pad(MX31_PIN_SRXD3, USB_PAD_CFG);
368 mxc_iomux_set_pad(MX31_PIN_STXD3, USB_PAD_CFG);
369
370 ret = gpio_request(USBH2_EN_B, "usbh2-en");
371 if (ret)
372 return ret;
373 gpio_direction_output(USBH2_EN_B, 0); 346 gpio_direction_output(USBH2_EN_B, 0);
374 347
375 return 0; 348 gpio_request(USB_RESET_B, "usb-reset");
349 gpio_direction_output(USB_RESET_B, 0);
350 mdelay(1);
351 gpio_set_value(USB_RESET_B, 1);
352 mdelay(1);
376} 353}
377 354
378static int moboard_usbh2_hw_exit(struct platform_device *pdev) 355#if defined(CONFIG_USB_ULPI)
379{
380 gpio_free(USBH2_EN_B);
381 return 0;
382}
383 356
384static struct mxc_usbh_platform_data usbh2_pdata = { 357static struct mxc_usbh_platform_data usbh2_pdata = {
385 .init = moboard_usbh2_hw_init,
386 .exit = moboard_usbh2_hw_exit,
387 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, 358 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
388 .flags = MXC_EHCI_POWER_PINS_ENABLED, 359 .flags = MXC_EHCI_POWER_PINS_ENABLED,
389}; 360};
@@ -508,8 +479,6 @@ static void __init mxc_board_init(void)
508 479
509 usb_xcvr_reset(); 480 usb_xcvr_reset();
510 481
511 moboard_usbotg_init();
512 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
513 moboard_usbh2_init(); 482 moboard_usbh2_init();
514 483
515 switch (mx31moboard_baseboard) { 484 switch (mx31moboard_baseboard) {
@@ -522,7 +491,8 @@ static void __init mxc_board_init(void)
522 mx31moboard_marxbot_init(); 491 mx31moboard_marxbot_init();
523 break; 492 break;
524 case MX31SMARTBOT: 493 case MX31SMARTBOT:
525 mx31moboard_smartbot_init(); 494 case MX31EYEBOT:
495 mx31moboard_smartbot_init(mx31moboard_baseboard);
526 break; 496 break;
527 default: 497 default:
528 printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n", 498 printk(KERN_ERR "Illegal mx31moboard_baseboard type %d\n",
diff --git a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
index 78ecd751549b..cce410662383 100644
--- a/arch/arm/mach-mx3/mach-pcm037.c
+++ b/arch/arm/mach-mx3/mach-pcm037.c
@@ -449,6 +449,7 @@ static int __init pcm037_camera_alloc_dma(const size_t buf_size)
449static struct platform_device *devices[] __initdata = { 449static struct platform_device *devices[] __initdata = {
450 &pcm037_flash, 450 &pcm037_flash,
451 &pcm037_sram_device, 451 &pcm037_sram_device,
452 &imx_wdt_device0,
452 &pcm037_mt9t031, 453 &pcm037_mt9t031,
453 &pcm037_mt9v022, 454 &pcm037_mt9v022,
454}; 455};
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index 1bf1ec2eef5e..78d9185a9d4b 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -150,6 +150,7 @@ static struct i2c_board_info pcm043_i2c_devices[] = {
150static struct platform_device *devices[] __initdata = { 150static struct platform_device *devices[] __initdata = {
151 &pcm043_flash, 151 &pcm043_flash,
152 &mxc_fec_device, 152 &mxc_fec_device,
153 &imx_wdt_device0,
153}; 154};
154 155
155static struct pad_desc pcm043_pads[] = { 156static struct pad_desc pcm043_pads[] = {
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
index 093c595ca581..5f05bfbec380 100644
--- a/arch/arm/mach-mx3/mx31lite-db.c
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -206,5 +206,6 @@ void __init mx31lite_db_init(void)
206 mxc_register_device(&mxc_spi_device0, &spi0_pdata); 206 mxc_register_device(&mxc_spi_device0, &spi0_pdata);
207 platform_device_register(&litekit_led_device); 207 platform_device_register(&litekit_led_device);
208 mxc_register_device(&imx_wdt_device0, NULL); 208 mxc_register_device(&imx_wdt_device0, NULL);
209 mxc_register_device(&imx_rtc_device0, NULL);
209} 210}
210 211
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 11b906ce7eae..582299cb2c08 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -22,6 +22,7 @@
22#include <linux/platform_device.h> 22#include <linux/platform_device.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/fsl_devices.h>
25 26
26#include <linux/usb/otg.h> 27#include <linux/usb/otg.h>
27 28
@@ -213,6 +214,12 @@ static int __init devboard_usbh1_init(void)
213 return mxc_register_device(&mxc_usbh1, &usbh1_pdata); 214 return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
214} 215}
215 216
217
218static struct fsl_usb2_platform_data usb_pdata = {
219 .operating_mode = FSL_USB2_DR_DEVICE,
220 .phy_mode = FSL_USB2_PHY_ULPI,
221};
222
216/* 223/*
217 * system init for baseboard usage. Will be called by mx31moboard init. 224 * system init for baseboard usage. Will be called by mx31moboard init.
218 */ 225 */
@@ -229,5 +236,7 @@ void __init mx31moboard_devboard_init(void)
229 236
230 devboard_init_sel_gpios(); 237 devboard_init_sel_gpios();
231 238
239 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
240
232 devboard_usbh1_init(); 241 devboard_usbh1_init();
233} 242}
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index ffb105e14d88..4930f8c27e66 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -25,6 +25,7 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/platform_device.h> 26#include <linux/platform_device.h>
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/fsl_devices.h>
28 29
29#include <linux/usb/otg.h> 30#include <linux/usb/otg.h>
30 31
@@ -329,6 +330,11 @@ static int __init marxbot_usbh1_init(void)
329 return mxc_register_device(&mxc_usbh1, &usbh1_pdata); 330 return mxc_register_device(&mxc_usbh1, &usbh1_pdata);
330} 331}
331 332
333static struct fsl_usb2_platform_data usb_pdata = {
334 .operating_mode = FSL_USB2_DR_DEVICE,
335 .phy_mode = FSL_USB2_PHY_ULPI,
336};
337
332/* 338/*
333 * system init for baseboard usage. Will be called by mx31moboard init. 339 * system init for baseboard usage. Will be called by mx31moboard init.
334 */ 340 */
@@ -356,5 +362,7 @@ void __init mx31moboard_marxbot_init(void)
356 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0)); 362 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_LCS0));
357 gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false); 363 gpio_export(IOMUX_TO_GPIO(MX31_PIN_LCS0), false);
358 364
365 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
366
359 marxbot_usbh1_init(); 367 marxbot_usbh1_init();
360} 368}
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
index 52a69fc8b14f..293eea6d9d97 100644
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -23,11 +23,18 @@
23#include <linux/i2c.h> 23#include <linux/i2c.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/fsl_devices.h>
27
28#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h>
26 30
27#include <mach/common.h> 31#include <mach/common.h>
28#include <mach/hardware.h> 32#include <mach/hardware.h>
29#include <mach/imx-uart.h> 33#include <mach/imx-uart.h>
30#include <mach/iomux-mx3.h> 34#include <mach/iomux-mx3.h>
35#include <mach/board-mx31moboard.h>
36#include <mach/mxc_ehci.h>
37#include <mach/ulpi.h>
31 38
32#include <media/soc_camera.h> 39#include <media/soc_camera.h>
33 40
@@ -116,10 +123,33 @@ static int __init smartbot_cam_init(void)
116 return 0; 123 return 0;
117} 124}
118 125
126static struct fsl_usb2_platform_data usb_pdata = {
127 .operating_mode = FSL_USB2_DR_DEVICE,
128 .phy_mode = FSL_USB2_PHY_ULPI,
129};
130
131#if defined(CONFIG_USB_ULPI)
132
133static struct mxc_usbh_platform_data otg_host_pdata = {
134 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
135 .flags = MXC_EHCI_POWER_PINS_ENABLED,
136};
137
138static int __init smartbot_otg_host_init(void)
139{
140 otg_host_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
141 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
142
143 return mxc_register_device(&mxc_otg_host, &otg_host_pdata);
144}
145#else
146static inline int smartbot_otg_host_init(void) { return 0; }
147#endif
148
119#define POWER_EN IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1) 149#define POWER_EN IOMUX_TO_GPIO(MX31_PIN_DTR_DCE1)
120#define DSPIC_RST_B IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1) 150#define DSPIC_RST_B IOMUX_TO_GPIO(MX31_PIN_DSR_DCE1)
121#define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_RI_DCE1) 151#define TRSLAT_RST_B IOMUX_TO_GPIO(MX31_PIN_RI_DCE1)
122#define SEL3 IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1) 152#define TRSLAT_SRC_CHOICE IOMUX_TO_GPIO(MX31_PIN_DCD_DCE1)
123 153
124static void smartbot_resets_init(void) 154static void smartbot_resets_init(void)
125{ 155{
@@ -138,15 +168,15 @@ static void smartbot_resets_init(void)
138 gpio_export(TRSLAT_RST_B, false); 168 gpio_export(TRSLAT_RST_B, false);
139 } 169 }
140 170
141 if (!gpio_request(SEL3, "sel3")) { 171 if (!gpio_request(TRSLAT_SRC_CHOICE, "translator-src-choice")) {
142 gpio_direction_input(SEL3); 172 gpio_direction_output(TRSLAT_SRC_CHOICE, 0);
143 gpio_export(SEL3, true); 173 gpio_export(TRSLAT_SRC_CHOICE, false);
144 } 174 }
145} 175}
146/* 176/*
147 * system init for baseboard usage. Will be called by mx31moboard init. 177 * system init for baseboard usage. Will be called by mx31moboard init.
148 */ 178 */
149void __init mx31moboard_smartbot_init(void) 179void __init mx31moboard_smartbot_init(int board)
150{ 180{
151 printk(KERN_INFO "Initializing mx31smartbot peripherals\n"); 181 printk(KERN_INFO "Initializing mx31smartbot peripherals\n");
152 182
@@ -155,6 +185,19 @@ void __init mx31moboard_smartbot_init(void)
155 185
156 mxc_register_device(&mxc_uart_device1, &uart_pdata); 186 mxc_register_device(&mxc_uart_device1, &uart_pdata);
157 187
188
189 switch (board) {
190 case MX31SMARTBOT:
191 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
192 break;
193 case MX31EYEBOT:
194 smartbot_otg_host_init();
195 break;
196 default:
197 printk(KERN_WARNING "Unknown board %d, USB OTG not initialized",
198 board);
199 }
200
158 smartbot_resets_init(); 201 smartbot_resets_init();
159 202
160 smartbot_cam_init(); 203 smartbot_cam_init();