aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-03-02 03:27:42 -0500
committerSascha Hauer <s.hauer@pengutronix.de>2011-03-07 13:29:41 -0500
commit48f6b0999673cce33e4a54d89c78460cc28e5156 (patch)
tree1ada2b337a7af540246968a9150b0c0a8ebabc3c /arch/arm/mach-mx3
parent94573e6623cf9159f036adc670a3d4b29e6d86fe (diff)
ARM i.MX: introduce imx_otg_ulpi_create to create ULPI transceivers
The boards are currently using otg_ulpi_create and mxc_ulpi_access_ops, both are only present if CONFIG_USB_ULPI is set. To remove the need of ifdefs in the board code introduce a imx_otg_ulpi_create functions which expands to a static inline function if compiled without ulpi. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3')
-rw-r--r--arch/arm/mach-mx3/mach-armadillo5x0.c20
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c20
-rw-r--r--arch/arm/mach-mx3/mach-mx31lilly.c15
-rw-r--r--arch/arm/mach-mx3/mach-mx31lite.c12
-rw-r--r--arch/arm/mach-mx3/mach-mx31moboard.c11
-rw-r--r--arch/arm/mach-mx3/mach-pcm037.c19
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c12
-rw-r--r--arch/arm/mach-mx3/mx31moboard-smartbot.c6
8 files changed, 47 insertions, 68 deletions
diff --git a/arch/arm/mach-mx3/mach-armadillo5x0.c b/arch/arm/mach-mx3/mach-armadillo5x0.c
index 34e619e811e6..226829bf7c25 100644
--- a/arch/arm/mach-mx3/mach-armadillo5x0.c
+++ b/arch/arm/mach-mx3/mach-armadillo5x0.c
@@ -133,7 +133,6 @@ static int armadillo5x0_pins[] = {
133}; 133};
134 134
135/* USB */ 135/* USB */
136#if defined(CONFIG_USB_ULPI)
137 136
138#define OTG_RESET IOMUX_TO_GPIO(MX31_PIN_STXD4) 137#define OTG_RESET IOMUX_TO_GPIO(MX31_PIN_STXD4)
139#define USBH2_RESET IOMUX_TO_GPIO(MX31_PIN_SCK6) 138#define USBH2_RESET IOMUX_TO_GPIO(MX31_PIN_SCK6)
@@ -256,7 +255,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
256 .init = usbh2_init, 255 .init = usbh2_init,
257 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, 256 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
258}; 257};
259#endif /* CONFIG_USB_ULPI */
260 258
261/* RTC over I2C*/ 259/* RTC over I2C*/
262#define ARMADILLO5X0_RTC_GPIO IOMUX_TO_GPIO(MX31_PIN_SRXD4) 260#define ARMADILLO5X0_RTC_GPIO IOMUX_TO_GPIO(MX31_PIN_SRXD4)
@@ -549,15 +547,15 @@ static void __init armadillo5x0_init(void)
549 i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1); 547 i2c_register_board_info(1, &armadillo5x0_i2c_rtc, 1);
550 548
551 /* USB */ 549 /* USB */
552#if defined(CONFIG_USB_ULPI) 550
553 usbotg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 551 usbotg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
554 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 552 ULPI_OTG_DRVVBUS_EXT);
555 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 553 if (usbotg_pdata.otg)
556 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 554 imx31_add_mxc_ehci_otg(&usbotg_pdata);
557 555 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
558 imx31_add_mxc_ehci_otg(&usbotg_pdata); 556 ULPI_OTG_DRVVBUS_EXT);
559 imx31_add_mxc_ehci_hs(2, &usbh2_pdata); 557 if (usbh2_pdata.otg)
560#endif 558 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
561} 559}
562 560
563static void __init armadillo5x0_timer_init(void) 561static void __init armadillo5x0_timer_init(void)
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index 35fdb2aeeaa3..f1dbb9d4a84d 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -244,7 +244,6 @@ usbotg_free_reset:
244 return err; 244 return err;
245} 245}
246 246
247#if defined(CONFIG_USB_ULPI)
248static int mx31_3ds_otg_init(struct platform_device *pdev) 247static int mx31_3ds_otg_init(struct platform_device *pdev)
249{ 248{
250 return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); 249 return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
@@ -300,7 +299,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
300 .init = mx31_3ds_host2_init, 299 .init = mx31_3ds_host2_init,
301 .portsc = MXC_EHCI_MODE_ULPI, 300 .portsc = MXC_EHCI_MODE_ULPI,
302}; 301};
303#endif
304 302
305static const struct fsl_usb2_platform_data usbotg_pdata __initconst = { 303static const struct fsl_usb2_platform_data usbotg_pdata __initconst = {
306 .operating_mode = FSL_USB2_DR_DEVICE, 304 .operating_mode = FSL_USB2_DR_DEVICE,
@@ -345,17 +343,17 @@ static void __init mx31_3ds_init(void)
345 imx31_add_imx_keypad(&mx31_3ds_keymap_data); 343 imx31_add_imx_keypad(&mx31_3ds_keymap_data);
346 344
347 mx31_3ds_usbotg_init(); 345 mx31_3ds_usbotg_init();
348#if defined(CONFIG_USB_ULPI)
349 if (otg_mode_host) { 346 if (otg_mode_host) {
350 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 347 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
351 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 348 ULPI_OTG_DRVVBUS_EXT);
352 349 if (otg_pdata.otg)
353 imx31_add_mxc_ehci_otg(&otg_pdata); 350 imx31_add_mxc_ehci_otg(&otg_pdata);
354 } 351 }
355 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 352 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
356 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 353 ULPI_OTG_DRVVBUS_EXT);
357 imx31_add_mxc_ehci_hs(2, &usbh2_pdata); 354 if (usbh2_pdata.otg)
358#endif 355 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
356
359 if (!otg_mode_host) 357 if (!otg_mode_host)
360 imx31_add_fsl_usb2_udc(&usbotg_pdata); 358 imx31_add_fsl_usb2_udc(&usbotg_pdata);
361 359
diff --git a/arch/arm/mach-mx3/mach-mx31lilly.c b/arch/arm/mach-mx3/mach-mx31lilly.c
index e2f9de10ad9f..ed95745163b8 100644
--- a/arch/arm/mach-mx3/mach-mx31lilly.c
+++ b/arch/arm/mach-mx3/mach-mx31lilly.c
@@ -111,8 +111,6 @@ static struct platform_device physmap_flash_device = {
111 111
112/* USB */ 112/* USB */
113 113
114#if defined(CONFIG_USB_ULPI)
115
116#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ 114#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
117 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) 115 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
118 116
@@ -197,16 +195,13 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
197 195
198static void lilly1131_usb_init(void) 196static void lilly1131_usb_init(void)
199{ 197{
200 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
201 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
202
203 imx31_add_mxc_ehci_hs(1, &usbh1_pdata); 198 imx31_add_mxc_ehci_hs(1, &usbh1_pdata);
204 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
205}
206 199
207#else 200 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
208static inline void lilly1131_usb_init(void) {} 201 ULPI_OTG_DRVVBUS_EXT);
209#endif /* CONFIG_USB_ULPI */ 202 if (usbh2_pdata.otg)
203 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
204}
210 205
211/* SPI */ 206/* SPI */
212 207
diff --git a/arch/arm/mach-mx3/mach-mx31lite.c b/arch/arm/mach-mx3/mach-mx31lite.c
index 81021bf8f6b3..24a21a384bf1 100644
--- a/arch/arm/mach-mx3/mach-mx31lite.c
+++ b/arch/arm/mach-mx3/mach-mx31lite.c
@@ -130,7 +130,6 @@ static struct spi_board_info mc13783_spi_dev __initdata = {
130 * USB 130 * USB
131 */ 131 */
132 132
133#if defined(CONFIG_USB_ULPI)
134#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \ 133#define USB_PAD_CFG (PAD_CTL_DRV_MAX | PAD_CTL_SRE_FAST | PAD_CTL_HYS_CMOS | \
135 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU) 134 PAD_CTL_ODE_CMOS | PAD_CTL_100K_PU)
136 135
@@ -177,7 +176,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
177 .init = usbh2_init, 176 .init = usbh2_init,
178 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT, 177 .portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
179}; 178};
180#endif
181 179
182/* 180/*
183 * NOR flash 181 * NOR flash
@@ -254,13 +252,11 @@ static void __init mx31lite_init(void)
254 imx31_add_spi_imx1(&spi1_pdata); 252 imx31_add_spi_imx1(&spi1_pdata);
255 spi_register_board_info(&mc13783_spi_dev, 1); 253 spi_register_board_info(&mc13783_spi_dev, 1);
256 254
257#if defined(CONFIG_USB_ULPI)
258 /* USB */ 255 /* USB */
259 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 256 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
260 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 257 ULPI_OTG_DRVVBUS_EXT);
261 258 if (usbh2_pdata.otg)
262 imx31_add_mxc_ehci_hs(2, &usbh2_pdata); 259 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
263#endif
264 260
265 /* SMSC9117 IRQ pin */ 261 /* SMSC9117 IRQ pin */
266 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq"); 262 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_SFS6), "sms9117-irq");
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index 845d0b6b2539..6f3692bccb8a 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -400,7 +400,6 @@ static void usb_xcvr_reset(void)
400 mdelay(1); 400 mdelay(1);
401} 401}
402 402
403#if defined(CONFIG_USB_ULPI)
404static int moboard_usbh2_init_hw(struct platform_device *pdev) 403static int moboard_usbh2_init_hw(struct platform_device *pdev)
405{ 404{
406 return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED); 405 return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_POWER_PINS_ENABLED);
@@ -415,8 +414,10 @@ static int __init moboard_usbh2_init(void)
415{ 414{
416 struct platform_device *pdev; 415 struct platform_device *pdev;
417 416
418 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 417 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
419 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 418 ULPI_OTG_DRVVBUS_EXT);
419 if (!usbh2_pdata.otg)
420 return -ENODEV;
420 421
421 pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata); 422 pdev = imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
422 if (IS_ERR(pdev)) 423 if (IS_ERR(pdev))
@@ -424,10 +425,6 @@ static int __init moboard_usbh2_init(void)
424 425
425 return 0; 426 return 0;
426} 427}
427#else
428static inline int moboard_usbh2_init(void) { return 0; }
429#endif
430
431 428
432static struct gpio_led mx31moboard_leds[] = { 429static struct gpio_led mx31moboard_leds[] = {
433 { 430 {
diff --git a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
index 783d31b8e8a7..f07d3bded674 100644
--- a/arch/arm/mach-mx3/mach-pcm037.c
+++ b/arch/arm/mach-mx3/mach-pcm037.c
@@ -533,7 +533,6 @@ static struct platform_device pcm970_sja1000 = {
533 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources), 533 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
534}; 534};
535 535
536#if defined(CONFIG_USB_ULPI)
537static int pcm037_otg_init(struct platform_device *pdev) 536static int pcm037_otg_init(struct platform_device *pdev)
538{ 537{
539 return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); 538 return mx31_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
@@ -553,7 +552,6 @@ static struct mxc_usbh_platform_data usbh2_pdata __initdata = {
553 .init = pcm037_usbh2_init, 552 .init = pcm037_usbh2_init,
554 .portsc = MXC_EHCI_MODE_ULPI, 553 .portsc = MXC_EHCI_MODE_ULPI,
555}; 554};
556#endif
557 555
558static const struct fsl_usb2_platform_data otg_device_pdata __initconst = { 556static const struct fsl_usb2_platform_data otg_device_pdata __initconst = {
559 .operating_mode = FSL_USB2_DR_DEVICE, 557 .operating_mode = FSL_USB2_DR_DEVICE,
@@ -656,19 +654,18 @@ static void __init pcm037_init(void)
656 654
657 platform_device_register(&pcm970_sja1000); 655 platform_device_register(&pcm970_sja1000);
658 656
659#if defined(CONFIG_USB_ULPI)
660 if (otg_mode_host) { 657 if (otg_mode_host) {
661 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 658 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
662 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 659 ULPI_OTG_DRVVBUS_EXT);
663 660 if (otg_pdata.otg)
664 imx31_add_mxc_ehci_otg(&otg_pdata); 661 imx31_add_mxc_ehci_otg(&otg_pdata);
665 } 662 }
666 663
667 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 664 usbh2_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
668 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 665 ULPI_OTG_DRVVBUS_EXT);
666 if (usbh2_pdata.otg)
667 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
669 668
670 imx31_add_mxc_ehci_hs(2, &usbh2_pdata);
671#endif
672 if (!otg_mode_host) 669 if (!otg_mode_host)
673 imx31_add_fsl_usb2_udc(&otg_device_pdata); 670 imx31_add_fsl_usb2_udc(&otg_device_pdata);
674 671
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index 262af17db44c..b3ecfb22d241 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -305,7 +305,6 @@ pcm037_nand_board_info __initconst = {
305 .hw_ecc = 1, 305 .hw_ecc = 1,
306}; 306};
307 307
308#if defined(CONFIG_USB_ULPI)
309static int pcm043_otg_init(struct platform_device *pdev) 308static int pcm043_otg_init(struct platform_device *pdev)
310{ 309{
311 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI); 310 return mx35_initialize_usb_hw(pdev->id, MXC_EHCI_INTERFACE_DIFF_UNI);
@@ -315,7 +314,6 @@ static struct mxc_usbh_platform_data otg_pdata __initdata = {
315 .init = pcm043_otg_init, 314 .init = pcm043_otg_init,
316 .portsc = MXC_EHCI_MODE_UTMI, 315 .portsc = MXC_EHCI_MODE_UTMI,
317}; 316};
318#endif
319 317
320static int pcm043_usbh1_init(struct platform_device *pdev) 318static int pcm043_usbh1_init(struct platform_device *pdev)
321{ 319{
@@ -385,14 +383,12 @@ static void __init pcm043_init(void)
385 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 383 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
386 mxc_register_device(&mx3_fb, &mx3fb_pdata); 384 mxc_register_device(&mx3_fb, &mx3fb_pdata);
387 385
388#if defined(CONFIG_USB_ULPI)
389 if (otg_mode_host) { 386 if (otg_mode_host) {
390 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 387 otg_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
391 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 388 ULPI_OTG_DRVVBUS_EXT);
392 389 if (otg_pdata.otg)
393 imx35_add_mxc_ehci_otg(&otg_pdata); 390 imx35_add_mxc_ehci_otg(&otg_pdata);
394 } 391 }
395#endif
396 imx35_add_mxc_ehci_hs(&usbh1_pdata); 392 imx35_add_mxc_ehci_hs(&usbh1_pdata);
397 393
398 if (!otg_mode_host) 394 if (!otg_mode_host)
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
index 87d556f40ecf..35f806e737c1 100644
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -137,8 +137,10 @@ static int __init smartbot_otg_host_init(void)
137{ 137{
138 struct platform_device *pdev; 138 struct platform_device *pdev;
139 139
140 otg_host_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 140 otg_host_pdata.otg = imx_otg_ulpi_create(ULPI_OTG_DRVVBUS |
141 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 141 ULPI_OTG_DRVVBUS_EXT);
142 if (!otg_host_pdata.otg)
143 return -ENODEV;
142 144
143 pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata); 145 pdev = imx31_add_mxc_ehci_otg(&otg_host_pdata);
144 if (IS_ERR(pdev)) 146 if (IS_ERR(pdev))