ARM: tegra20: ventana: enable emc scaling early in the boot process
Varun Wadekar [Fri, 13 Apr 2012 06:15:50 +0000 (11:15 +0530)]
Change-Id: Idd9599aaed202e106bf6186fa0f4e783f850db0a
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>

arch/arm/mach-tegra/board-ventana-memory.c
arch/arm/mach-tegra/board-ventana.c

index 51d635e..5e193a8 100644 (file)
@@ -23,6 +23,7 @@
 #include "board-ventana.h"
 #include "tegra2_emc.h"
 #include "board.h"
+#include "devices.h"
 
 static const struct tegra_emc_table ventana_emc_tables_elpida_300Mhz[] = {
        {
@@ -540,54 +541,52 @@ static const struct tegra_emc_table ventana_emc_tables_elpida_400Mhz[] = {
        }
 };
 
-static const struct tegra_emc_chip ventana_emc_chips[] = {
-       {
-               .description = "Elpida 300MHz",
-               .mem_manufacturer_id = 0x0303,
-               .mem_revision_id1 = -1,
-               .mem_revision_id2 = -1,
-               .mem_pid = -1,
-               .table = ventana_emc_tables_elpida_300Mhz,
-               .table_size = ARRAY_SIZE(ventana_emc_tables_elpida_300Mhz)
-       },
+static const struct tegra_emc_pdata ventana_emc_chip = {
+       .description = "Elpida 300MHz",
+       .mem_manufacturer_id = 0x0303,
+       .mem_revision_id1 = -1,
+       .mem_revision_id2 = -1,
+       .mem_pid = -1,
+       .tables = ventana_emc_tables_elpida_300Mhz,
+       .num_tables = ARRAY_SIZE(ventana_emc_tables_elpida_300Mhz)
 };
 
-static const struct tegra_emc_chip ventana_t25_emc_chips[] = {
-       {
-               .description = "Elpida 400MHz",
-               .mem_manufacturer_id = 0x0303,
-               .mem_revision_id1 = -1,
-               .mem_revision_id2 = -1,
-               .mem_pid = -1,
-               .table = ventana_emc_tables_elpida_400Mhz,
-               .table_size = ARRAY_SIZE(ventana_emc_tables_elpida_400Mhz)
-       },
+static const struct tegra_emc_pdata ventana_t25_emc_chip = {
+       .description = "Elpida 400MHz",
+       .mem_manufacturer_id = 0x0303,
+       .mem_revision_id1 = -1,
+       .mem_revision_id2 = -1,
+       .mem_pid = -1,
+       .tables = ventana_emc_tables_elpida_400Mhz,
+       .num_tables = ARRAY_SIZE(ventana_emc_tables_elpida_400Mhz)
 };
 
-static const struct tegra_emc_chip ventana_siblings_emc_chips[] = {
+static const struct tegra_emc_pdata ventana_siblings_emc_chip = {
 };
 
 #define TEGRA25_SKU            0x0B00
-#define board_is_ventana(bi) (bi.board_id == 0x24b || bi.board_id == 0x252)
 
 int ventana_emc_init(void)
 {
        struct board_info BoardInfo;
+       struct tegra_emc_pdata *emc_platdata;
 
        tegra_get_board_info(&BoardInfo);
 
-       if (board_is_ventana(BoardInfo)) {
+       if (BoardInfo.board_id == 0x24b || BoardInfo.board_id == 0x252) {
                if (BoardInfo.sku == TEGRA25_SKU)
-                       tegra_init_emc(ventana_t25_emc_chips,
-                                      ARRAY_SIZE(ventana_t25_emc_chips));
+                       emc_platdata = &ventana_t25_emc_chip;
                else
-                       tegra_init_emc(ventana_emc_chips,
-                                      ARRAY_SIZE(ventana_emc_chips));
+                       emc_platdata = &ventana_emc_chip;
        } else {
                pr_info("ventana_emc_init: using ventana_siblings_emc_chips\n");
-               tegra_init_emc(ventana_siblings_emc_chips,
-                              ARRAY_SIZE(ventana_siblings_emc_chips));
+               emc_platdata = &ventana_siblings_emc_chip;
        }
 
+       tegra_emc_device.dev.platform_data = emc_platdata;
+       platform_device_register(&tegra_emc_device);
+
+       tegra_emc_init();
+
        return 0;
 }
index 2ee3b21..4b0b578 100644 (file)
@@ -438,7 +438,6 @@ static struct platform_device *ventana_devices[] __initdata = {
        &ventana_bcm4329_rfkill_device,
        &tegra_pcm_device,
        &ventana_audio_device,
-       &tegra_emc_device,
 };
 
 
@@ -578,6 +577,7 @@ static void __init tegra_ventana_init(void)
        struct board_info BoardInfo;
 
        tegra_clk_init_from_table(ventana_clk_init_table);
+       ventana_emc_init();
        tegra_enable_pinmux();
        ventana_pinmux_init();
        ventana_i2c_init();
@@ -611,7 +611,6 @@ static void __init tegra_ventana_init(void)
        ventana_panel_init();
        ventana_sensors_init();
        ventana_bt_rfkill();
-       ventana_emc_init();
 
        ventana_setup_bluesleep();
        tegra_release_bootloader_fb();