arm: tegra: sd: enable sd dpd
[linux-2.6.git] / arch / arm / mach-tegra / board-whistler.c
index e396c18..06e704e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-whistler.c
  *
- * Copyright (c) 2010 - 2011, NVIDIA Corporation.
+ * Copyright (c) 2010-2012 NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -37,6 +37,7 @@
 #include <linux/mfd/max8907c.h>
 #include <linux/memblock.h>
 #include <linux/tegra_uart.h>
+#include <linux/rfkill-gpio.h>
 
 #include <mach/clk.h>
 #include <mach/iomap.h>
@@ -45,7 +46,7 @@
 #include <mach/iomap.h>
 #include <mach/io.h>
 #include <mach/i2s.h>
-#include <mach/tegra_wm8753_pdata.h>
+#include <mach/tegra_asoc_pdata.h>
 #include <sound/tlv320aic326x.h>
 
 #include <asm/mach-types.h>
 #include "pm.h"
 #include "board-whistler-baseband.h"
 
+#define SZ_3M (SZ_1M + SZ_2M)
+#define SZ_152M (SZ_128M + SZ_16M + SZ_8M)
 #define USB1_VBUS_GPIO TCA6416_GPIO_BASE
 
-static struct plat_serial8250_port debug_uartb_platform_data[] = {
-       {
-               .membase        = IO_ADDRESS(TEGRA_UARTB_BASE),
-               .mapbase        = TEGRA_UARTB_BASE,
-               .irq            = INT_UARTB,
-               .flags          = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
-               .type           = PORT_TEGRA,
-               .iotype         = UPIO_MEM,
-               .regshift       = 2,
-               .uartclk        = 216000000,
-       }, {
-               .flags          = 0,
-       }
-};
-
-static struct platform_device debug_uartb = {
-       .name = "serial8250",
-       .id = PLAT8250_DEV_PLATFORM,
-       .dev = {
-               .platform_data = debug_uartb_platform_data,
-       },
-};
-
-static struct plat_serial8250_port debug_uarta_platform_data[] = {
-       {
-               .membase        = IO_ADDRESS(TEGRA_UARTA_BASE),
-               .mapbase        = TEGRA_UARTA_BASE,
-               .irq            = INT_UARTA,
-               .flags          = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
-               .type           = PORT_TEGRA,
-               .iotype         = UPIO_MEM,
-               .regshift       = 2,
-               .uartclk        = 216000000,
-       }, {
-               .flags          = 0,
-       }
-};
-
-static struct platform_device debug_uarta = {
-       .name = "serial8250",
-       .id = PLAT8250_DEV_PLATFORM,
-       .dev = {
-               .platform_data = debug_uarta_platform_data,
-       },
-};
-
 static struct platform_device *whistler_uart_devices[] __initdata = {
        &tegra_uarta_device,
        &tegra_uartb_device,
@@ -133,12 +90,15 @@ static void __init uart_debug_init(void)
        if (modem_id == 0x1) {
                /* UARTB is the debug port. */
                pr_info("Selecting UARTB as the debug console\n");
-               whistler_uart_devices[1] = &debug_uartb;
+               whistler_uart_devices[1] = &debug_uartb_device;
+               debug_uart_port_base = ((struct plat_serial8250_port *)(
+                       debug_uartb_device.dev.platform_data))->mapbase;
                debug_uart_clk = clk_get_sys("serial8250.0", "uartb");
 
                /* Clock enable for the debug channel */
                if (!IS_ERR_OR_NULL(debug_uart_clk)) {
-                       rate = debug_uartb_platform_data[0].uartclk;
+                       rate = ((struct plat_serial8250_port *)(
+                       debug_uartb_device.dev.platform_data))->uartclk;
                        pr_info("The debug console clock name is %s\n",
                                                debug_uart_clk->name);
                        c = tegra_get_clock_by_name("pll_p");
@@ -156,12 +116,15 @@ static void __init uart_debug_init(void)
        } else {
                /* UARTA is the debug port. */
                pr_info("Selecting UARTA as the debug console\n");
-               whistler_uart_devices[0] = &debug_uarta;
+               whistler_uart_devices[0] = &debug_uarta_device;
+               debug_uart_port_base = ((struct plat_serial8250_port *)(
+                       debug_uarta_device.dev.platform_data))->mapbase;
                debug_uart_clk = clk_get_sys("serial8250.0", "uarta");
 
                /* Clock enable for the debug channel */
                if (!IS_ERR_OR_NULL(debug_uart_clk)) {
-                       rate = debug_uarta_platform_data[0].uartclk;
+                       rate = ((struct plat_serial8250_port *)(
+                       debug_uarta_device.dev.platform_data))->uartclk;
                        pr_info("The debug console clock name is %s\n",
                                                debug_uart_clk->name);
                        c = tegra_get_clock_by_name("pll_p");
@@ -207,21 +170,21 @@ static void __init whistler_uart_init(void)
        platform_add_devices(whistler_uart_devices,
                                ARRAY_SIZE(whistler_uart_devices));
 }
-
-static struct resource whistler_bcm4329_rfkill_resources[] = {
+static struct rfkill_gpio_platform_data whistler_bt_rfkill_pdata[] = {
        {
-               .name   = "bcm4329_nshutdown_gpio",
-               .start  = TEGRA_GPIO_PU0,
-               .end    = TEGRA_GPIO_PU0,
-               .flags  = IORESOURCE_IO,
+               .name           = "bt_rfkill",
+               .shutdown_gpio  = TEGRA_GPIO_PU0,
+               .reset_gpio     = TEGRA_GPIO_INVALID,
+               .type           = RFKILL_TYPE_BLUETOOTH,
        },
 };
 
-static struct platform_device whistler_bcm4329_rfkill_device = {
-       .name           = "bcm4329_rfkill",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(whistler_bcm4329_rfkill_resources),
-       .resource       = whistler_bcm4329_rfkill_resources,
+static struct platform_device whistler_bt_rfkill_device = {
+       .name = "rfkill_gpio",
+       .id   = -1,
+       .dev  = {
+               .platform_data  = whistler_bt_rfkill_pdata,
+       },
 };
 
 static struct resource whistler_bluesleep_resources[] = {
@@ -255,37 +218,9 @@ static struct platform_device whistler_bluesleep_device = {
 static void __init whistler_setup_bluesleep(void)
 {
        platform_device_register(&whistler_bluesleep_device);
-       tegra_gpio_enable(TEGRA_GPIO_PU6);
-       tegra_gpio_enable(TEGRA_GPIO_PU1);
        return;
 }
 
-static struct tegra_utmip_config utmi_phy_config[] = {
-       [0] = {
-                       .hssync_start_delay = 9,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 15,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-               },
-       [1] = {
-                       .hssync_start_delay = 9,
-                       .idle_wait_delay = 17,
-                       .elastic_limit = 16,
-                       .term_range_adj = 6,
-                       .xcvr_setup = 8,
-                       .xcvr_lsfslew = 2,
-                       .xcvr_lsrslew = 2,
-               },
-};
-
-static struct tegra_ulpi_config ulpi_phy_config = {
-       .reset_gpio = TEGRA_GPIO_PG2,
-       .clk = "cdev2",
-};
-
 static __initdata struct tegra_clk_init_table whistler_clk_init_table[] = {
        /* name         parent          rate            enabled */
        { "pwm",        "clk_32k",      32768,          false},
@@ -304,6 +239,7 @@ static struct tegra_i2c_platform_data whistler_i2c1_platform_data = {
        .scl_gpio               = {TEGRA_GPIO_PC4, 0},
        .sda_gpio               = {TEGRA_GPIO_PC5, 0},
        .arb_recovery = arb_lost_recovery,
+       .slave_addr = 0xFC,
 };
 
 static const struct tegra_pingroup_config i2c2_ddc = {
@@ -319,12 +255,13 @@ static const struct tegra_pingroup_config i2c2_gen2 = {
 static struct tegra_i2c_platform_data whistler_i2c2_platform_data = {
        .adapter_nr     = 1,
        .bus_count      = 2,
-       .bus_clk_rate   = { 100000, 100000 },
+       .bus_clk_rate   = { 10000, 100000 },
        .bus_mux        = { &i2c2_ddc, &i2c2_gen2 },
        .bus_mux_len    = { 1, 1 },
        .scl_gpio               = {0, TEGRA_GPIO_PT5},
        .sda_gpio               = {0, TEGRA_GPIO_PT6},
        .arb_recovery = arb_lost_recovery,
+       .slave_addr = 0xFC,
 };
 
 static struct tegra_i2c_platform_data whistler_i2c3_platform_data = {
@@ -334,6 +271,7 @@ static struct tegra_i2c_platform_data whistler_i2c3_platform_data = {
        .scl_gpio               = {TEGRA_GPIO_PBB2, 0},
        .sda_gpio               = {TEGRA_GPIO_PBB3, 0},
        .arb_recovery = arb_lost_recovery,
+       .slave_addr = 0xFC,
 };
 
 static struct tegra_i2c_platform_data whistler_dvc_platform_data = {
@@ -357,7 +295,7 @@ static struct i2c_board_info __initdata wm8753_board_info[] = {
                .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_HP_DET),
        },
        {
-               I2C_BOARD_INFO("tlv320aic3262", 0x18),
+               I2C_BOARD_INFO("aic3262-codec", 0x18),
                .platform_data = &whistler_aic3262_pdata,
                .irq = TEGRA_GPIO_TO_IRQ(TEGRA_GPIO_HP_DET),
        },
@@ -413,7 +351,7 @@ static struct platform_device tegra_camera = {
        .id = -1,
 };
 
-static struct tegra_wm8753_platform_data whistler_audio_pdata = {
+static struct tegra_asoc_platform_data whistler_audio_pdata = {
        .gpio_spkr_en = -1,
        .gpio_hp_det = TEGRA_GPIO_HP_DET,
        .gpio_hp_mute = -1,
@@ -422,7 +360,7 @@ static struct tegra_wm8753_platform_data whistler_audio_pdata = {
        .debounce_time_hp = 200,
 };
 
-static struct platform_device whistler_audio_device1 = {
+static struct platform_device whistler_audio_aic326x_device = {
        .name   = "tegra-snd-aic326x",
        .id     = 0,
        .dev    = {
@@ -430,7 +368,7 @@ static struct platform_device whistler_audio_device1 = {
        },
 };
 
-static struct platform_device whistler_audio_device2 = {
+static struct platform_device whistler_audio_wm8753_device = {
        .name   = "tegra-snd-wm8753",
        .id     = 0,
        .dev    = {
@@ -442,6 +380,7 @@ static struct platform_device *whistler_devices[] __initdata = {
        &tegra_pmu_device,
        &tegra_udc_device,
        &tegra_gart_device,
+       &tegra_aes_device,
        &tegra_wdt_device,
        &tegra_avp_device,
        &whistler_scroll_device,
@@ -453,10 +392,10 @@ static struct platform_device *whistler_devices[] __initdata = {
        &spdif_dit_device,
        &bluetooth_dit_device,
        &baseband_dit_device,
-       &whistler_bcm4329_rfkill_device,
+       &whistler_bt_rfkill_device,
        &tegra_pcm_device,
-       &whistler_audio_device1,
-       &whistler_audio_device2,
+       &whistler_audio_aic326x_device,
+       &whistler_audio_wm8753_device,
 };
 
 static struct synaptics_i2c_rmi_platform_data synaptics_pdata = {
@@ -474,91 +413,70 @@ static const struct i2c_board_info whistler_i2c_touch_info[] = {
 
 static int __init whistler_touch_init(void)
 {
-       tegra_gpio_enable(TEGRA_GPIO_PC6);
        i2c_register_board_info(0, whistler_i2c_touch_info, 1);
 
        return 0;
 }
 
-static int __init whistler_scroll_init(void)
-{
-       int i;
-       for (i = 0; i < ARRAY_SIZE(scroll_keys); i++)
-               tegra_gpio_enable(scroll_keys[i].gpio);
-
-       return 0;
-}
-
-static struct usb_phy_plat_data tegra_usb_phy_pdata[] = {
-       [0] = {
-                       .instance = 0,
-                       .vbus_irq = MAX8907C_INT_BASE + MAX8907C_IRQ_VCHG_DC_R,
-                       .vbus_gpio = USB1_VBUS_GPIO,
+static struct tegra_usb_platform_data tegra_udc_pdata = {
+       .port_otg = true,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode = TEGRA_USB_OPMODE_DEVICE,
+       .u_data.dev = {
+               .vbus_pmu_irq = MAX8907C_INT_BASE + MAX8907C_IRQ_VCHG_DC_R,
+               .vbus_gpio = -1,
+               .charging_supported = false,
+               .remote_wakeup_supported = false,
        },
-       [1] = {
-                       .instance = 1,
-                       .vbus_gpio = -1,
-       },
-       [2] = {
-                       .instance = 2,
-                       .vbus_gpio = -1,
+       .u_cfg.utmi = {
+               .hssync_start_delay = 0,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
+               .xcvr_setup_offset = 0,
+               .xcvr_use_fuses = 1,
        },
 };
 
-static struct tegra_ehci_platform_data tegra_ehci_pdata[] = {
-       [0] = {
-                       .phy_config = &utmi_phy_config[0],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-               },
-       [1] = {
-                       .phy_config = &ulpi_phy_config,
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
-               },
-       [2] = {
-                       .phy_config = &utmi_phy_config[1],
-                       .operating_mode = TEGRA_USB_HOST,
-                       .power_down_on_bus_suspend = 1,
+static struct tegra_usb_platform_data tegra_ehci1_utmi_pdata = {
+       .port_otg = true,
+       .has_hostpc = false,
+       .phy_intf = TEGRA_USB_PHY_INTF_UTMI,
+       .op_mode        = TEGRA_USB_OPMODE_HOST,
+       .u_data.host = {
+               .vbus_gpio = TEGRA_GPIO_PN6,
+               .vbus_reg = NULL,
+               .hot_plug = true,
+               .remote_wakeup_supported = false,
+               .power_off_on_suspend = true,
+       },
+       .u_cfg.utmi = {
+               .hssync_start_delay = 9,
+               .elastic_limit = 16,
+               .idle_wait_delay = 17,
+               .term_range_adj = 6,
+               .xcvr_setup = 8,
+               .xcvr_lsfslew = 2,
+               .xcvr_lsrslew = 2,
        },
 };
 
-static struct tegra_otg_platform_data tegra_otg_pdata = {
+static struct tegra_usb_otg_data tegra_otg_pdata = {
        .ehci_device = &tegra_ehci1_device,
-       .ehci_pdata = &tegra_ehci_pdata[0],
+       .ehci_pdata = &tegra_ehci1_utmi_pdata,
 };
 
-static int __init whistler_gps_init(void)
-{
-       tegra_gpio_enable(TEGRA_GPIO_PU4);
-       return 0;
-}
-
-static void whistler_power_off(void)
-{
-       int ret;
-
-       ret = max8907c_power_off();
-       if (ret)
-               pr_err("whistler: failed to power off\n");
-
-       while (1);
-}
-
-static void __init whistler_power_off_init(void)
-{
-       pm_power_off = whistler_power_off;
-}
-
+#define SERIAL_NUMBER_LENGTH 20
 static void whistler_usb_init(void)
 {
-       tegra_usb_phy_init(tegra_usb_phy_pdata, ARRAY_SIZE(tegra_usb_phy_pdata));
-
        tegra_otg_device.dev.platform_data = &tegra_otg_pdata;
        platform_device_register(&tegra_otg_device);
 
-       tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata[2];
-       platform_device_register(&tegra_ehci3_device);
+       tegra_udc_device.dev.platform_data = &tegra_udc_pdata;
 }
 
 static void __init tegra_whistler_init(void)
@@ -569,17 +487,14 @@ static void __init tegra_whistler_init(void)
        whistler_i2c_init();
        whistler_uart_init();
        platform_add_devices(whistler_devices, ARRAY_SIZE(whistler_devices));
-
+       tegra_ram_console_debug_init();
        whistler_sdhci_init();
        whistler_regulator_init();
        whistler_panel_init();
        whistler_sensors_init();
        whistler_touch_init();
        whistler_kbc_init();
-       whistler_gps_init();
        whistler_usb_init();
-       whistler_scroll_init();
-       whistler_power_off_init();
        whistler_emc_init();
        if (modem_id == 0x1)
                whistler_baseband_init();
@@ -598,7 +513,8 @@ void __init tegra_whistler_reserve(void)
        if (memblock_reserve(0x0, 4096) < 0)
                pr_warn("Cannot reserve first 4K of memory for safety\n");
 
-       tegra_reserve(SZ_128M, SZ_8M, SZ_16M);
+       tegra_reserve(SZ_152M, SZ_3M, SZ_1M);
+       tegra_ram_console_debug_reserve(SZ_1M);
 }
 
 MACHINE_START(WHISTLER, "whistler")