ARM: 6283/1: Remove useless PCIO_BASE definitions
[pandora-kernel.git] / arch / arm / mach-imx / mach-cpuimx27.c
index 06dcd23..575ff1a 100644 (file)
 #include <linux/mtd/physmap.h>
 #include <linux/platform_device.h>
 #include <linux/serial_8250.h>
+#include <linux/usb/otg.h>
+#include <linux/usb/ulpi.h>
+#include <linux/fsl_devices.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
 #include <asm/mach/map.h>
 
-#include <mach/board-eukrea_cpuimx27.h>
+#include <mach/eukrea-baseboards.h>
 #include <mach/common.h>
 #include <mach/hardware.h>
 #include <mach/iomux-mx27.h>
-#include <mach/imx-uart.h>
 #include <mach/mxc_nand.h>
+#include <mach/mxc_ehci.h>
+#include <mach/ulpi.h>
 
 #include "devices-imx27.h"
 #include "devices.h"
@@ -49,10 +53,12 @@ static int eukrea_cpuimx27_pins[] = {
        PE14_PF_UART1_CTS,
        PE15_PF_UART1_RTS,
        /* UART4 */
+#if defined(MACH_EUKREA_CPUIMX27_USEUART4)
        PB26_AF_UART4_RTS,
        PB28_AF_UART4_TXD,
        PB29_AF_UART4_CTS,
        PB31_AF_UART4_RXD,
+#endif
        /* FEC */
        PD0_AIN_FEC_TXD0,
        PD1_AIN_FEC_TXD1,
@@ -76,19 +82,47 @@ static int eukrea_cpuimx27_pins[] = {
        PD17_PF_I2C_DATA,
        PD18_PF_I2C_CLK,
        /* SDHC2 */
+#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
        PB4_PF_SD2_D0,
        PB5_PF_SD2_D1,
        PB6_PF_SD2_D2,
        PB7_PF_SD2_D3,
        PB8_PF_SD2_CMD,
        PB9_PF_SD2_CLK,
+#endif
 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
        /* Quad UART's IRQ */
-       GPIO_PORTD | 22 | GPIO_GPIO | GPIO_IN,
-       GPIO_PORTD | 23 | GPIO_GPIO | GPIO_IN,
-       GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN,
-       GPIO_PORTD | 30 | GPIO_GPIO | GPIO_IN,
+       GPIO_PORTB | 22 | GPIO_GPIO | GPIO_IN,
+       GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN,
+       GPIO_PORTB | 27 | GPIO_GPIO | GPIO_IN,
+       GPIO_PORTB | 30 | GPIO_GPIO | GPIO_IN,
 #endif
+       /* OTG */
+       PC7_PF_USBOTG_DATA5,
+       PC8_PF_USBOTG_DATA6,
+       PC9_PF_USBOTG_DATA0,
+       PC10_PF_USBOTG_DATA2,
+       PC11_PF_USBOTG_DATA1,
+       PC12_PF_USBOTG_DATA4,
+       PC13_PF_USBOTG_DATA3,
+       PE0_PF_USBOTG_NXT,
+       PE1_PF_USBOTG_STP,
+       PE2_PF_USBOTG_DIR,
+       PE24_PF_USBOTG_CLK,
+       PE25_PF_USBOTG_DATA7,
+       /* USBH2 */
+       PA0_PF_USBH2_CLK,
+       PA1_PF_USBH2_DIR,
+       PA2_PF_USBH2_DATA7,
+       PA3_PF_USBH2_NXT,
+       PA4_PF_USBH2_STP,
+       PD19_AF_USBH2_DATA4,
+       PD20_AF_USBH2_DATA3,
+       PD21_AF_USBH2_DATA6,
+       PD22_AF_USBH2_DATA0,
+       PD23_AF_USBH2_DATA2,
+       PD24_AF_USBH2_DATA1,
+       PD26_AF_USBH2_DATA5,
 };
 
 static struct physmap_flash_data eukrea_cpuimx27_flash_data = {
@@ -111,12 +145,8 @@ static struct platform_device eukrea_cpuimx27_nor_mtd_device = {
        .resource = &eukrea_cpuimx27_flash_resource,
 };
 
-static struct imxuart_platform_data uart_pdata[] = {
-       {
-               .flags = IMXUART_HAVE_RTSCTS,
-       }, {
-               .flags = IMXUART_HAVE_RTSCTS,
-       },
+static const struct imxuart_platform_data uart_pdata __initconst = {
+       .flags = IMXUART_HAVE_RTSCTS,
 };
 
 static const struct mxc_nand_platform_data
@@ -128,6 +158,8 @@ cpuimx27_nand_board_info __initconst = {
 static struct platform_device *platform_devices[] __initdata = {
        &eukrea_cpuimx27_nor_mtd_device,
        &mxc_fec_device,
+       &mxc_wdt,
+       &mxc_w1_master_device,
 };
 
 static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
@@ -183,12 +215,44 @@ static struct platform_device serial_device = {
 };
 #endif
 
+#if defined(CONFIG_USB_ULPI)
+static struct mxc_usbh_platform_data otg_pdata = {
+       .portsc = MXC_EHCI_MODE_ULPI,
+       .flags  = MXC_EHCI_INTERFACE_DIFF_UNI,
+};
+
+static struct mxc_usbh_platform_data usbh2_pdata = {
+       .portsc = MXC_EHCI_MODE_ULPI,
+       .flags  = MXC_EHCI_INTERFACE_DIFF_UNI,
+};
+#endif
+
+static struct fsl_usb2_platform_data otg_device_pdata = {
+       .operating_mode = FSL_USB2_DR_DEVICE,
+       .phy_mode       = FSL_USB2_PHY_ULPI,
+};
+
+static int otg_mode_host;
+
+static int __init eukrea_cpuimx27_otg_mode(char *options)
+{
+       if (!strcmp(options, "host"))
+               otg_mode_host = 1;
+       else if (!strcmp(options, "device"))
+               otg_mode_host = 0;
+       else
+               pr_info("otg_mode neither \"host\" nor \"device\". "
+                       "Defaulting to device\n");
+       return 0;
+}
+__setup("otg_mode=", eukrea_cpuimx27_otg_mode);
+
 static void __init eukrea_cpuimx27_init(void)
 {
        mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
                ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");
 
-       mxc_register_device(&imx2x_uart_device0, &uart_pdata[0]);
+       imx27_add_imx_uart0(&uart_pdata);
 
        imx27_add_mxc_nand(&cpuimx27_nand_board_info);
 
@@ -202,14 +266,32 @@ static void __init eukrea_cpuimx27_init(void)
 #if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
        /* SDHC2 can be used for Wifi */
        mxc_register_device(&mxc_sdhc_device1, NULL);
+#endif
+#if defined(MACH_EUKREA_CPUIMX27_USEUART4)
        /* in which case UART4 is also used for Bluetooth */
-       mxc_register_device(&imx2x_uart_device3, &uart_pdata[1]);
+       imx27_add_imx_uart3(&uart_pdata);
 #endif
 
 #if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
        platform_device_register(&serial_device);
 #endif
 
+#if defined(CONFIG_USB_ULPI)
+       if (otg_mode_host) {
+               otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
+                               USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
+
+               mxc_register_device(&mxc_otg_host, &otg_pdata);
+       }
+
+       usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
+                               USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
+
+       mxc_register_device(&mxc_usbh2, &usbh2_pdata);
+#endif
+       if (!otg_mode_host)
+               mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
+
 #ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
        eukrea_mbimx27_baseboard_init();
 #endif