aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-imx
diff options
context:
space:
mode:
authorMarkus Pargmann <mpa@pengutronix.de>2013-06-06 08:41:57 -0400
committerShawn Guo <shawn.guo@linaro.org>2013-06-17 03:45:16 -0400
commit794987ace5f17f73e327b06b07588e2c4bfc54c6 (patch)
tree6f583a1bfc0aeb8046794b94570fa4041d2bb31f /arch/arm/mach-imx
parent5be913c6824e1957e03ae432b60717c21f2c53d1 (diff)
ARM: imx: Remove mxc specific ulpi access ops
There are ulpi access ops implemented in drivers/usb/phy/phy-ulpi.c. mxc access ops implement the same access operations within mach-imx. This patch removes the mxc ulpi file and uses phy-ulpi instead for imx_otg_ulpi_create. phy-ulpi successfully tested with i.MX27 Phytec phyCARD-S (pca100). Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Diffstat (limited to 'arch/arm/mach-imx')
-rw-r--r--arch/arm/mach-imx/Kconfig29
-rw-r--r--arch/arm/mach-imx/Makefile1
-rw-r--r--arch/arm/mach-imx/mach-pca100.c4
-rw-r--r--arch/arm/mach-imx/ulpi.c118
-rw-r--r--arch/arm/mach-imx/ulpi.h11
5 files changed, 22 insertions, 141 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index b7eddbd82880..f25cf888f3d4 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -56,9 +56,6 @@ config MXC_USE_EPIT
56 uses the same clocks as the GPT. Anyway, on some systems the GPT 56 uses the same clocks as the GPT. Anyway, on some systems the GPT
57 may be in use for other purposes. 57 may be in use for other purposes.
58 58
59config MXC_ULPI
60 bool
61
62config ARCH_HAS_RNGA 59config ARCH_HAS_RNGA
63 bool 60 bool
64 61
@@ -233,7 +230,7 @@ config MACH_EUKREA_CPUIMX25SD
233 select IMX_HAVE_PLATFORM_MXC_EHCI 230 select IMX_HAVE_PLATFORM_MXC_EHCI
234 select IMX_HAVE_PLATFORM_MXC_NAND 231 select IMX_HAVE_PLATFORM_MXC_NAND
235 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 232 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
236 select MXC_ULPI if USB_ULPI 233 select USB_ULPI_VIEWPORT if USB_ULPI
237 select SOC_IMX25 234 select SOC_IMX25
238 235
239choice 236choice
@@ -284,7 +281,7 @@ config MACH_PCM038
284 select IMX_HAVE_PLATFORM_MXC_NAND 281 select IMX_HAVE_PLATFORM_MXC_NAND
285 select IMX_HAVE_PLATFORM_MXC_W1 282 select IMX_HAVE_PLATFORM_MXC_W1
286 select IMX_HAVE_PLATFORM_SPI_IMX 283 select IMX_HAVE_PLATFORM_SPI_IMX
287 select MXC_ULPI if USB_ULPI 284 select USB_ULPI_VIEWPORT if USB_ULPI
288 select SOC_IMX27 285 select SOC_IMX27
289 help 286 help
290 Include support for phyCORE-i.MX27 (aka pcm038) platform. This 287 Include support for phyCORE-i.MX27 (aka pcm038) platform. This
@@ -314,7 +311,7 @@ config MACH_CPUIMX27
314 select IMX_HAVE_PLATFORM_MXC_EHCI 311 select IMX_HAVE_PLATFORM_MXC_EHCI
315 select IMX_HAVE_PLATFORM_MXC_NAND 312 select IMX_HAVE_PLATFORM_MXC_NAND
316 select IMX_HAVE_PLATFORM_MXC_W1 313 select IMX_HAVE_PLATFORM_MXC_W1
317 select MXC_ULPI if USB_ULPI 314 select USB_ULPI_VIEWPORT if USB_ULPI
318 select SOC_IMX27 315 select SOC_IMX27
319 help 316 help
320 Include support for Eukrea CPUIMX27 platform. This includes 317 Include support for Eukrea CPUIMX27 platform. This includes
@@ -369,7 +366,7 @@ config MACH_MX27_3DS
369 select IMX_HAVE_PLATFORM_MXC_MMC 366 select IMX_HAVE_PLATFORM_MXC_MMC
370 select IMX_HAVE_PLATFORM_SPI_IMX 367 select IMX_HAVE_PLATFORM_SPI_IMX
371 select MXC_DEBUG_BOARD 368 select MXC_DEBUG_BOARD
372 select MXC_ULPI if USB_ULPI 369 select USB_ULPI_VIEWPORT if USB_ULPI
373 select SOC_IMX27 370 select SOC_IMX27
374 help 371 help
375 Include support for MX27PDK platform. This includes specific 372 Include support for MX27PDK platform. This includes specific
@@ -414,7 +411,7 @@ config MACH_PCA100
414 select IMX_HAVE_PLATFORM_MXC_NAND 411 select IMX_HAVE_PLATFORM_MXC_NAND
415 select IMX_HAVE_PLATFORM_MXC_W1 412 select IMX_HAVE_PLATFORM_MXC_W1
416 select IMX_HAVE_PLATFORM_SPI_IMX 413 select IMX_HAVE_PLATFORM_SPI_IMX
417 select MXC_ULPI if USB_ULPI 414 select USB_ULPI_VIEWPORT if USB_ULPI
418 select SOC_IMX27 415 select SOC_IMX27
419 help 416 help
420 Include support for phyCARD-s (aka pca100) platform. This 417 Include support for phyCARD-s (aka pca100) platform. This
@@ -481,7 +478,7 @@ config MACH_MX31LILLY
481 select IMX_HAVE_PLATFORM_MXC_EHCI 478 select IMX_HAVE_PLATFORM_MXC_EHCI
482 select IMX_HAVE_PLATFORM_MXC_MMC 479 select IMX_HAVE_PLATFORM_MXC_MMC
483 select IMX_HAVE_PLATFORM_SPI_IMX 480 select IMX_HAVE_PLATFORM_SPI_IMX
484 select MXC_ULPI if USB_ULPI 481 select USB_ULPI_VIEWPORT if USB_ULPI
485 select SOC_IMX31 482 select SOC_IMX31
486 help 483 help
487 Include support for mx31 based LILLY1131 modules. This includes 484 Include support for mx31 based LILLY1131 modules. This includes
@@ -497,7 +494,7 @@ config MACH_MX31LITE
497 select IMX_HAVE_PLATFORM_MXC_RTC 494 select IMX_HAVE_PLATFORM_MXC_RTC
498 select IMX_HAVE_PLATFORM_SPI_IMX 495 select IMX_HAVE_PLATFORM_SPI_IMX
499 select LEDS_GPIO_REGISTER 496 select LEDS_GPIO_REGISTER
500 select MXC_ULPI if USB_ULPI 497 select USB_ULPI_VIEWPORT if USB_ULPI
501 select SOC_IMX31 498 select SOC_IMX31
502 help 499 help
503 Include support for MX31 LITEKIT platform. This includes specific 500 Include support for MX31 LITEKIT platform. This includes specific
@@ -514,7 +511,7 @@ config MACH_PCM037
514 select IMX_HAVE_PLATFORM_MXC_MMC 511 select IMX_HAVE_PLATFORM_MXC_MMC
515 select IMX_HAVE_PLATFORM_MXC_NAND 512 select IMX_HAVE_PLATFORM_MXC_NAND
516 select IMX_HAVE_PLATFORM_MXC_W1 513 select IMX_HAVE_PLATFORM_MXC_W1
517 select MXC_ULPI if USB_ULPI 514 select USB_ULPI_VIEWPORT if USB_ULPI
518 select SOC_IMX31 515 select SOC_IMX31
519 help 516 help
520 Include support for Phytec pcm037 platform. This includes 517 Include support for Phytec pcm037 platform. This includes
@@ -544,7 +541,7 @@ config MACH_MX31_3DS
544 select IMX_HAVE_PLATFORM_MXC_NAND 541 select IMX_HAVE_PLATFORM_MXC_NAND
545 select IMX_HAVE_PLATFORM_SPI_IMX 542 select IMX_HAVE_PLATFORM_SPI_IMX
546 select MXC_DEBUG_BOARD 543 select MXC_DEBUG_BOARD
547 select MXC_ULPI if USB_ULPI 544 select USB_ULPI_VIEWPORT if USB_ULPI
548 select SOC_IMX31 545 select SOC_IMX31
549 help 546 help
550 Include support for MX31PDK (3DS) platform. This includes specific 547 Include support for MX31PDK (3DS) platform. This includes specific
@@ -571,7 +568,7 @@ config MACH_MX31MOBOARD
571 select IMX_HAVE_PLATFORM_MXC_MMC 568 select IMX_HAVE_PLATFORM_MXC_MMC
572 select IMX_HAVE_PLATFORM_SPI_IMX 569 select IMX_HAVE_PLATFORM_SPI_IMX
573 select LEDS_GPIO_REGISTER 570 select LEDS_GPIO_REGISTER
574 select MXC_ULPI if USB_ULPI 571 select USB_ULPI_VIEWPORT if USB_ULPI
575 select SOC_IMX31 572 select SOC_IMX31
576 help 573 help
577 Include support for mx31moboard platform. This includes specific 574 Include support for mx31moboard platform. This includes specific
@@ -595,7 +592,7 @@ config MACH_ARMADILLO5X0
595 select IMX_HAVE_PLATFORM_MXC_EHCI 592 select IMX_HAVE_PLATFORM_MXC_EHCI
596 select IMX_HAVE_PLATFORM_MXC_MMC 593 select IMX_HAVE_PLATFORM_MXC_MMC
597 select IMX_HAVE_PLATFORM_MXC_NAND 594 select IMX_HAVE_PLATFORM_MXC_NAND
598 select MXC_ULPI if USB_ULPI 595 select USB_ULPI_VIEWPORT if USB_ULPI
599 select SOC_IMX31 596 select SOC_IMX31
600 help 597 help
601 Include support for Atmark Armadillo-500 platform. This includes 598 Include support for Atmark Armadillo-500 platform. This includes
@@ -639,7 +636,7 @@ config MACH_PCM043
639 select IMX_HAVE_PLATFORM_MXC_EHCI 636 select IMX_HAVE_PLATFORM_MXC_EHCI
640 select IMX_HAVE_PLATFORM_MXC_NAND 637 select IMX_HAVE_PLATFORM_MXC_NAND
641 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 638 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
642 select MXC_ULPI if USB_ULPI 639 select USB_ULPI_VIEWPORT if USB_ULPI
643 select SOC_IMX35 640 select SOC_IMX35
644 help 641 help
645 Include support for Phytec pcm043 platform. This includes 642 Include support for Phytec pcm043 platform. This includes
@@ -673,7 +670,7 @@ config MACH_EUKREA_CPUIMX35SD
673 select IMX_HAVE_PLATFORM_MXC_EHCI 670 select IMX_HAVE_PLATFORM_MXC_EHCI
674 select IMX_HAVE_PLATFORM_MXC_NAND 671 select IMX_HAVE_PLATFORM_MXC_NAND
675 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX 672 select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
676 select MXC_ULPI if USB_ULPI 673 select USB_ULPI_VIEWPORT if USB_ULPI
677 select SOC_IMX35 674 select SOC_IMX35
678 help 675 help
679 Include support for Eukrea CPUIMX35 platform. This includes 676 Include support for Eukrea CPUIMX35 platform. This includes
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 054f039fb62b..e20f22d58fd8 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -23,7 +23,6 @@ obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
23obj-$(CONFIG_MXC_TZIC) += tzic.o 23obj-$(CONFIG_MXC_TZIC) += tzic.o
24obj-$(CONFIG_MXC_AVIC) += avic.o 24obj-$(CONFIG_MXC_AVIC) += avic.o
25 25
26obj-$(CONFIG_MXC_ULPI) += ulpi.o
27obj-$(CONFIG_MXC_USE_EPIT) += epit.o 26obj-$(CONFIG_MXC_USE_EPIT) += epit.o
28obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o 27obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
29 28
diff --git a/arch/arm/mach-imx/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index b8b15bb1ffdf..19bb6441a7d4 100644
--- a/arch/arm/mach-imx/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -398,8 +398,8 @@ static void __init pca100_init(void)
398 imx27_add_fsl_usb2_udc(&otg_device_pdata); 398 imx27_add_fsl_usb2_udc(&otg_device_pdata);
399 } 399 }
400 400
401 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops, 401 usbh2_pdata.otg = imx_otg_ulpi_create(
402 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT); 402 ULPI_OTG_DRVVBUS | ULPI_OTG_DRVVBUS_EXT);
403 403
404 if (usbh2_pdata.otg) 404 if (usbh2_pdata.otg)
405 imx27_add_mxc_ehci_hs(2, &usbh2_pdata); 405 imx27_add_mxc_ehci_hs(2, &usbh2_pdata);
diff --git a/arch/arm/mach-imx/ulpi.c b/arch/arm/mach-imx/ulpi.c
deleted file mode 100644
index 0f051957d10c..000000000000
--- a/arch/arm/mach-imx/ulpi.c
+++ /dev/null
@@ -1,118 +0,0 @@
1/*
2 * Copyright 2008 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
3 * Copyright 2009 Daniel Mack <daniel@caiaq.de>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/io.h>
23#include <linux/delay.h>
24#include <linux/usb/otg.h>
25#include <linux/usb/ulpi.h>
26
27#include "ulpi.h"
28
29/* ULPIVIEW register bits */
30#define ULPIVW_WU (1 << 31) /* Wakeup */
31#define ULPIVW_RUN (1 << 30) /* read/write run */
32#define ULPIVW_WRITE (1 << 29) /* 0 = read 1 = write */
33#define ULPIVW_SS (1 << 27) /* SyncState */
34#define ULPIVW_PORT_MASK 0x07 /* Port field */
35#define ULPIVW_PORT_SHIFT 24
36#define ULPIVW_ADDR_MASK 0xff /* data address field */
37#define ULPIVW_ADDR_SHIFT 16
38#define ULPIVW_RDATA_MASK 0xff /* read data field */
39#define ULPIVW_RDATA_SHIFT 8
40#define ULPIVW_WDATA_MASK 0xff /* write data field */
41#define ULPIVW_WDATA_SHIFT 0
42
43static int ulpi_poll(void __iomem *view, u32 bit)
44{
45 int timeout = 10000;
46
47 while (timeout--) {
48 u32 data = __raw_readl(view);
49
50 if (!(data & bit))
51 return 0;
52
53 cpu_relax();
54 };
55
56 printk(KERN_WARNING "timeout polling for ULPI device\n");
57
58 return -ETIMEDOUT;
59}
60
61static int ulpi_read(struct usb_phy *otg, u32 reg)
62{
63 int ret;
64 void __iomem *view = otg->io_priv;
65
66 /* make sure interface is running */
67 if (!(__raw_readl(view) & ULPIVW_SS)) {
68 __raw_writel(ULPIVW_WU, view);
69
70 /* wait for wakeup */
71 ret = ulpi_poll(view, ULPIVW_WU);
72 if (ret)
73 return ret;
74 }
75
76 /* read the register */
77 __raw_writel((ULPIVW_RUN | (reg << ULPIVW_ADDR_SHIFT)), view);
78
79 /* wait for completion */
80 ret = ulpi_poll(view, ULPIVW_RUN);
81 if (ret)
82 return ret;
83
84 return (__raw_readl(view) >> ULPIVW_RDATA_SHIFT) & ULPIVW_RDATA_MASK;
85}
86
87static int ulpi_write(struct usb_phy *otg, u32 val, u32 reg)
88{
89 int ret;
90 void __iomem *view = otg->io_priv;
91
92 /* make sure the interface is running */
93 if (!(__raw_readl(view) & ULPIVW_SS)) {
94 __raw_writel(ULPIVW_WU, view);
95 /* wait for wakeup */
96 ret = ulpi_poll(view, ULPIVW_WU);
97 if (ret)
98 return ret;
99 }
100
101 __raw_writel((ULPIVW_RUN | ULPIVW_WRITE |
102 (reg << ULPIVW_ADDR_SHIFT) |
103 ((val & ULPIVW_WDATA_MASK) << ULPIVW_WDATA_SHIFT)), view);
104
105 /* wait for completion */
106 return ulpi_poll(view, ULPIVW_RUN);
107}
108
109struct usb_phy_io_ops mxc_ulpi_access_ops = {
110 .read = ulpi_read,
111 .write = ulpi_write,
112};
113EXPORT_SYMBOL_GPL(mxc_ulpi_access_ops);
114
115struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
116{
117 return otg_ulpi_create(&mxc_ulpi_access_ops, flags);
118}
diff --git a/arch/arm/mach-imx/ulpi.h b/arch/arm/mach-imx/ulpi.h
index 42bdaca6d7d9..23f5c0349e80 100644
--- a/arch/arm/mach-imx/ulpi.h
+++ b/arch/arm/mach-imx/ulpi.h
@@ -1,8 +1,13 @@
1#ifndef __MACH_ULPI_H 1#ifndef __MACH_ULPI_H
2#define __MACH_ULPI_H 2#define __MACH_ULPI_H
3 3
4#ifdef CONFIG_USB_ULPI 4#include <linux/usb/ulpi.h>
5struct usb_phy *imx_otg_ulpi_create(unsigned int flags); 5
6#ifdef CONFIG_USB_ULPI_VIEWPORT
7static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
8{
9 return otg_ulpi_create(&ulpi_viewport_access_ops, flags);
10}
6#else 11#else
7static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags) 12static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
8{ 13{
@@ -10,7 +15,5 @@ static inline struct usb_phy *imx_otg_ulpi_create(unsigned int flags)
10} 15}
11#endif 16#endif
12 17
13extern struct usb_phy_io_ops mxc_ulpi_access_ops;
14
15#endif /* __MACH_ULPI_H */ 18#endif /* __MACH_ULPI_H */
16 19