aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3/mach-pcm043.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mx3/mach-pcm043.c')
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c154
1 files changed, 154 insertions, 0 deletions
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index 25942b8e8bed..1bf1ec2eef5e 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -26,8 +26,12 @@
26#include <linux/gpio.h> 26#include <linux/gpio.h>
27#include <linux/smc911x.h> 27#include <linux/smc911x.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/delay.h>
29#include <linux/i2c.h> 30#include <linux/i2c.h>
30#include <linux/i2c/at24.h> 31#include <linux/i2c/at24.h>
32#include <linux/usb/otg.h>
33#include <linux/usb/ulpi.h>
34#include <linux/fsl_devices.h>
31 35
32#include <asm/mach-types.h> 36#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
@@ -44,6 +48,10 @@
44#include <mach/ipu.h> 48#include <mach/ipu.h>
45#include <mach/mx3fb.h> 49#include <mach/mx3fb.h>
46#include <mach/mxc_nand.h> 50#include <mach/mxc_nand.h>
51#include <mach/mxc_ehci.h>
52#include <mach/ulpi.h>
53#include <mach/audmux.h>
54#include <mach/ssi.h>
47 55
48#include "devices.h" 56#include "devices.h"
49 57
@@ -205,6 +213,94 @@ static struct pad_desc pcm043_pads[] = {
205 MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS, 213 MX35_PAD_D3_CLS__IPU_DISPB_D3_CLS,
206 /* gpio */ 214 /* gpio */
207 MX35_PAD_ATA_CS0__GPIO2_6, 215 MX35_PAD_ATA_CS0__GPIO2_6,
216 /* USB host */
217 MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR,
218 MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC,
219 /* SSI */
220 MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS,
221 MX35_PAD_STXD4__AUDMUX_AUD4_TXD,
222 MX35_PAD_SRXD4__AUDMUX_AUD4_RXD,
223 MX35_PAD_SCK4__AUDMUX_AUD4_TXC,
224};
225
226#define AC97_GPIO_TXFS (1 * 32 + 31)
227#define AC97_GPIO_TXD (1 * 32 + 28)
228#define AC97_GPIO_RESET (1 * 32 + 0)
229
230static void pcm043_ac97_warm_reset(struct snd_ac97 *ac97)
231{
232 struct pad_desc txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
233 struct pad_desc txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
234 int ret;
235
236 ret = gpio_request(AC97_GPIO_TXFS, "SSI");
237 if (ret) {
238 printk("failed to get GPIO_TXFS: %d\n", ret);
239 return;
240 }
241
242 mxc_iomux_v3_setup_pad(&txfs_gpio);
243
244 /* warm reset */
245 gpio_direction_output(AC97_GPIO_TXFS, 1);
246 udelay(2);
247 gpio_set_value(AC97_GPIO_TXFS, 0);
248
249 gpio_free(AC97_GPIO_TXFS);
250 mxc_iomux_v3_setup_pad(&txfs);
251}
252
253static void pcm043_ac97_cold_reset(struct snd_ac97 *ac97)
254{
255 struct pad_desc txfs_gpio = MX35_PAD_STXFS4__GPIO2_31;
256 struct pad_desc txfs = MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS;
257 struct pad_desc txd_gpio = MX35_PAD_STXD4__GPIO2_28;
258 struct pad_desc txd = MX35_PAD_STXD4__AUDMUX_AUD4_TXD;
259 struct pad_desc reset_gpio = MX35_PAD_SD2_CMD__GPIO2_0;
260 int ret;
261
262 ret = gpio_request(AC97_GPIO_TXFS, "SSI");
263 if (ret)
264 goto err1;
265
266 ret = gpio_request(AC97_GPIO_TXD, "SSI");
267 if (ret)
268 goto err2;
269
270 ret = gpio_request(AC97_GPIO_RESET, "SSI");
271 if (ret)
272 goto err3;
273
274 mxc_iomux_v3_setup_pad(&txfs_gpio);
275 mxc_iomux_v3_setup_pad(&txd_gpio);
276 mxc_iomux_v3_setup_pad(&reset_gpio);
277
278 gpio_direction_output(AC97_GPIO_TXFS, 0);
279 gpio_direction_output(AC97_GPIO_TXD, 0);
280
281 /* cold reset */
282 gpio_direction_output(AC97_GPIO_RESET, 0);
283 udelay(10);
284 gpio_direction_output(AC97_GPIO_RESET, 1);
285
286 mxc_iomux_v3_setup_pad(&txd);
287 mxc_iomux_v3_setup_pad(&txfs);
288
289 gpio_free(AC97_GPIO_RESET);
290err3:
291 gpio_free(AC97_GPIO_TXD);
292err2:
293 gpio_free(AC97_GPIO_TXFS);
294err1:
295 if (ret)
296 printk("%s failed with %d\n", __func__, ret);
297 mdelay(1);
298}
299
300static struct imx_ssi_platform_data pcm043_ssi_pdata = {
301 .ac97_reset = pcm043_ac97_cold_reset,
302 .ac97_warm_reset = pcm043_ac97_warm_reset,
303 .flags = IMX_SSI_USE_AC97,
208}; 304};
209 305
210static struct mxc_nand_platform_data pcm037_nand_board_info = { 306static struct mxc_nand_platform_data pcm037_nand_board_info = {
@@ -212,6 +308,37 @@ static struct mxc_nand_platform_data pcm037_nand_board_info = {
212 .hw_ecc = 1, 308 .hw_ecc = 1,
213}; 309};
214 310
311static struct mxc_usbh_platform_data otg_pdata = {
312 .portsc = MXC_EHCI_MODE_UTMI,
313 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
314};
315
316static struct mxc_usbh_platform_data usbh1_pdata = {
317 .portsc = MXC_EHCI_MODE_SERIAL,
318 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
319 MXC_EHCI_IPPUE_DOWN,
320};
321
322static struct fsl_usb2_platform_data otg_device_pdata = {
323 .operating_mode = FSL_USB2_DR_DEVICE,
324 .phy_mode = FSL_USB2_PHY_UTMI,
325};
326
327static int otg_mode_host;
328
329static int __init pcm043_otg_mode(char *options)
330{
331 if (!strcmp(options, "host"))
332 otg_mode_host = 1;
333 else if (!strcmp(options, "device"))
334 otg_mode_host = 0;
335 else
336 pr_info("otg_mode neither \"host\" nor \"device\". "
337 "Defaulting to device\n");
338 return 0;
339}
340__setup("otg_mode=", pcm043_otg_mode);
341
215/* 342/*
216 * Board specific initialization. 343 * Board specific initialization.
217 */ 344 */
@@ -219,10 +346,23 @@ static void __init mxc_board_init(void)
219{ 346{
220 mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads)); 347 mxc_iomux_v3_setup_multiple_pads(pcm043_pads, ARRAY_SIZE(pcm043_pads));
221 348
349 mxc_audmux_v2_configure_port(3,
350 MXC_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
351 MXC_AUDMUX_V2_PTCR_TFSEL(0) |
352 MXC_AUDMUX_V2_PTCR_TFSDIR,
353 MXC_AUDMUX_V2_PDCR_RXDSEL(0));
354
355 mxc_audmux_v2_configure_port(0,
356 MXC_AUDMUX_V2_PTCR_SYN | /* 4wire mode */
357 MXC_AUDMUX_V2_PTCR_TCSEL(3) |
358 MXC_AUDMUX_V2_PTCR_TCLKDIR, /* clock is output */
359 MXC_AUDMUX_V2_PDCR_RXDSEL(3));
360
222 platform_add_devices(devices, ARRAY_SIZE(devices)); 361 platform_add_devices(devices, ARRAY_SIZE(devices));
223 362
224 mxc_register_device(&mxc_uart_device0, &uart_pdata); 363 mxc_register_device(&mxc_uart_device0, &uart_pdata);
225 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info); 364 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info);
365 mxc_register_device(&imx_ssi_device0, &pcm043_ssi_pdata);
226 366
227 mxc_register_device(&mxc_uart_device1, &uart_pdata); 367 mxc_register_device(&mxc_uart_device1, &uart_pdata);
228 368
@@ -235,6 +375,20 @@ static void __init mxc_board_init(void)
235 375
236 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 376 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
237 mxc_register_device(&mx3_fb, &mx3fb_pdata); 377 mxc_register_device(&mx3_fb, &mx3fb_pdata);
378
379#if defined(CONFIG_USB_ULPI)
380 if (otg_mode_host) {
381 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
382 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
383
384 mxc_register_device(&mxc_otg_host, &otg_pdata);
385 }
386
387 mxc_register_device(&mxc_usbh1, &usbh1_pdata);
388#endif
389 if (!otg_mode_host)
390 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
391
238} 392}
239 393
240static void __init pcm043_timer_init(void) 394static void __init pcm043_timer_init(void)