arm: tegra: cardhu: cleanup ram console
Tom Cherry [Thu, 8 Sep 2011 00:10:38 +0000 (17:10 -0700)]
Various cleanup including removing two unneeded static variables and
an unneeded function, as well as reserving the ram console after the
carveout and framebuffer.

Reviewed-on: http://git-master/r/51214
(cherry-picked from commit cb64054a12aca84b097556c7c4f4e7c67916fd93)

Change-Id: I2b950a6a8637beed3910cc59f1e8028dc3c10562
Reviewed-on: http://git-master/r/55086
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Rf58d7de18ab7714a58d3acb79e5cbec60e4294f9

arch/arm/mach-tegra/board-cardhu.c

index 77792b9..6a48935 100644 (file)
@@ -69,9 +69,6 @@
 #include "baseband-xmm-power.h"
 #include "wdt-recovery.h"
 
-static unsigned long ramconsole_start;
-static unsigned long ramconsole_size;
-
 /* All units are in millicelsius */
 static struct tegra_thermal_data thermal_data = {
        .temp_throttle = 85000,
@@ -1141,14 +1138,6 @@ static void cardhu_sata_init(void)
 static void cardhu_sata_init(void) { }
 #endif
 
-static void cardhu_ramconsole_init(void)
-{
-       struct resource *res;
-       res = platform_get_resource(&ram_console_device, IORESOURCE_MEM, 0);
-       res->start = ramconsole_start;
-       res->end = res->start + ramconsole_size - 1;
-}
-
 static void __init tegra_cardhu_init(void)
 {
        tegra_thermal_init(&thermal_data);
@@ -1161,7 +1150,6 @@ static void __init tegra_cardhu_init(void)
        cardhu_edp_init();
 #endif
        cardhu_uart_init();
-       cardhu_ramconsole_init();
        platform_add_devices(cardhu_devices, ARRAY_SIZE(cardhu_devices));
        cardhu_sdhci_init();
        cardhu_regulator_init();
@@ -1190,23 +1178,35 @@ static void __init tegra_cardhu_init(void)
 #endif
 }
 
-static void __init tegra_cardhu_reserve(void)
+static void __init cardhu_ramconsole_reserve(unsigned long size)
 {
+       struct resource *res;
        long ret;
-       ramconsole_size = SZ_1M;
-       ramconsole_start = memblock_end_of_DRAM() - ramconsole_size;
-       ret = memblock_remove(ramconsole_start, ramconsole_size);
+
+       res = platform_get_resource(&ram_console_device, IORESOURCE_MEM, 0);
+       if (!res) {
+               pr_err("Failed to find memory resource for ram console\n");
+               return;
+       }
+       res->start = memblock_end_of_DRAM() - size;
+       res->end = res->start + size - 1;
+       ret = memblock_remove(res->start, size);
        if (ret) {
-               ramconsole_size = 0;
+               ram_console_device.resource = NULL;
+               ram_console_device.num_resources = 0;
                pr_err("Failed to reserve memory block for ram console\n");
        }
+}
 
+static void __init tegra_cardhu_reserve(void)
+{
 #if defined(CONFIG_NVMAP_CONVERT_CARVEOUT_TO_IOVMM)
        /* support 1920X1200 with 24bpp */
        tegra_reserve(0, SZ_8M + SZ_1M, SZ_8M + SZ_1M);
 #else
        tegra_reserve(SZ_128M, SZ_8M, SZ_8M);
 #endif
+       cardhu_ramconsole_reserve(SZ_1M);
 }
 
 MACHINE_START(CARDHU, "cardhu")