diff options
author | Daniel Mack <daniel@caiaq.de> | 2010-04-13 14:11:37 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2010-04-14 03:03:03 -0400 |
commit | 066fb8472036805e31ee002097f619815e25a127 (patch) | |
tree | 5faf12baafb96682ffae48e0448d3e80d37892cd /arch/arm/mach-mx3 | |
parent | 63f4079b6a90e2a8ee64c5900a6d4d0bcb79bc65 (diff) |
ARM: mx3/lilly1131: add USB support
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx3')
-rw-r--r-- | arch/arm/mach-mx3/Kconfig | 1 | ||||
-rw-r--r-- | arch/arm/mach-mx3/mach-mx31lilly.c | 145 |
2 files changed, 146 insertions, 0 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 | |||
82 | config MACH_MX31LILLY | 82 | config 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/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 | |||
121 | static 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 | |||
165 | static 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 | |||
192 | static 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 | |||
229 | static 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 | |||
235 | static 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 | |||
241 | static 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 | |||
111 | static struct platform_device *devices[] __initdata = { | 247 | static 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 | ||
188 | static void __init mx31lilly_timer_init(void) | 333 | static void __init mx31lilly_timer_init(void) |