ARM: tegra: reserve memory for ramoops by default
Ajay Nandakumar [Wed, 29 Jan 2014 09:45:22 +0000 (14:45 +0530)]
Reserving memory of 1MB for ramoops by default in tegra_reserve when
PSTORE configs are enabled. This way we can enable ramoops on all
platforms by just enabling the configs.

Bug 1258617

Change-Id: I2074c553cc9c32bca133bc8eb36eb03dc12fbbe1
Signed-off-by: Sumit Singh <sumsingh@nvidia.com>
Reviewed-on: http://git-master/r/361425
(cherry picked from commit f90bd3fe3ecee42c1f2db4b5325e31fe33ff39f3)
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Signed-off-by: Prabhu Kuttiyam <pkuttiyam@nvidia.com>
Reviewed-on: http://git-master/r/408432
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Winnie Hsu <whsu@nvidia.com>

arch/arm/mach-tegra/board-ardbeg.c
arch/arm/mach-tegra/board-dalmore.c
arch/arm/mach-tegra/board-loki.c
arch/arm/mach-tegra/board-macallan.c
arch/arm/mach-tegra/board-pismo.c
arch/arm/mach-tegra/board-pluto.c
arch/arm/mach-tegra/board-roth.c
arch/arm/mach-tegra/board-vcm30_t124.c
arch/arm/mach-tegra/board.h
arch/arm/mach-tegra/common.c

index 36e9c59..28e7fef 100644 (file)
@@ -1372,11 +1372,6 @@ static void __init tegra_ardbeg_late_init(void)
        ardbeg_sysedp_batmon_init();
 }
 
-static void __init ardbeg_ramconsole_reserve(unsigned long size)
-{
-       tegra_reserve_ramoops_memory(SZ_1M);
-}
-
 static void __init tegra_ardbeg_init_early(void)
 {
        ardbeg_rail_alignment_init();
@@ -1418,7 +1413,6 @@ static void __init tegra_ardbeg_reserve(void)
 #endif
 
        tegra_reserve(carveout_size, fb1_size, fb2_size);
-       ardbeg_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const ardbeg_dt_board_compat[] = {
index 96d34cd..9cadf4b 100644 (file)
@@ -701,11 +701,6 @@ static void __init tegra_dalmore_late_init(void)
        tegra_register_fuse();
 }
 
-static void __init dalmore_ramconsole_reserve(unsigned long size)
-{
-       tegra_reserve_ramoops_memory(SZ_1M);
-}
-
 static void __init tegra_dalmore_dt_init(void)
 {
        tegra_get_board_info(&board_info);
@@ -728,7 +723,6 @@ static void __init tegra_dalmore_reserve(void)
 #else
        tegra_reserve(SZ_512M, SZ_16M + SZ_2M, SZ_4M);
 #endif
-       dalmore_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const dalmore_dt_board_compat[] = {
index acb7e9d..b730466 100644 (file)
@@ -826,11 +826,6 @@ static void __init tegra_loki_late_init(void)
 #endif
 }
 
-static void __init loki_ramconsole_reserve(unsigned long size)
-{
-       tegra_reserve_ramoops_memory(SZ_1M);
-}
-
 static void __init tegra_loki_dt_init(void)
 {
        tegra_get_board_info(&board_info);
@@ -855,7 +850,6 @@ static void __init tegra_loki_reserve(void)
 #else
        tegra_reserve(SZ_1G, SZ_16M + SZ_2M, SZ_4M);
 #endif
-       loki_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const loki_dt_board_compat[] = {
index 3ce948d..47d320b 100644 (file)
@@ -571,11 +571,6 @@ static void __init tegra_macallan_late_init(void)
        tegra_register_fuse();
 }
 
-static void __init macallan_ramconsole_reserve(unsigned long size)
-{
-       tegra_reserve_ramoops_memory(SZ_1M);
-}
-
 static void __init tegra_macallan_dt_init(void)
 {
        tegra_get_board_info(&board_info);
@@ -602,7 +597,6 @@ static void __init tegra_macallan_reserve(void)
 #else
        tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_16M + SZ_2M);
 #endif
-       macallan_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const macallan_dt_board_compat[] = {
index 8db6779..7dd931c 100644 (file)
@@ -618,11 +618,6 @@ static void __init tegra_pismo_init(void)
        pismo_soctherm_init();
 }
 
-static void __init pismo_ramconsole_reserve(unsigned long size)
-{
-       tegra_reserve_ramoops_memory(SZ_1M);
-}
-
 #ifdef CONFIG_USE_OF
 struct of_dev_auxdata pismo_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("nvidia,tegra114-host1x", TEGRA_HOST1X_BASE, "host1x",
@@ -660,7 +655,6 @@ static void __init tegra_pismo_reserve(void)
 #else
        tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_4M);
 #endif
-       pismo_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const pismo_dt_board_compat[] = {
index f24ab3c..0735f58 100644 (file)
@@ -1257,10 +1257,6 @@ static void __init tegra_pluto_late_init(void)
        tegra_register_fuse();
 }
 
-static void __init pluto_ramconsole_reserve(unsigned long size)
-{
-       tegra_reserve_ramoops_memory(SZ_1M);
-}
 
 static void __init tegra_pluto_dt_init(void)
 {
@@ -1281,7 +1277,6 @@ static void __init tegra_pluto_reserve(void)
 #else
        tegra_reserve(SZ_128M, SZ_16M, SZ_4M);
 #endif
-       pluto_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const pluto_dt_board_compat[] = {
index bfd728d..64e45e9 100644 (file)
@@ -600,11 +600,6 @@ static void __init tegra_roth_init(void)
        roth_issp_init();
 }
 
-static void __init roth_ramconsole_reserve(unsigned long size)
-{
-       tegra_reserve_ramoops_memory(SZ_1M);
-}
-
 #ifdef CONFIG_USE_OF
 struct of_dev_auxdata roth_auxdata_lookup[] __initdata = {
        OF_DEV_AUXDATA("nvidia,tegra114-host1x", TEGRA_HOST1X_BASE, "host1x",
@@ -642,7 +637,6 @@ static void __init tegra_roth_reserve(void)
 #else
        tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_4M);
 #endif
-       roth_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const roth_dt_board_compat[] = {
index 16dfd3c..eebf65a 100644 (file)
@@ -487,11 +487,6 @@ static void __init tegra_vcm30_t124_late_init(void)
        vcm30_t124_panel_init();
 }
 
-static void __init vcm30_t124_ramconsole_reserve(unsigned long size)
-{
-       tegra_reserve_ramoops_memory(SZ_1M);
-}
-
 static void __init tegra_vcm30_t124_dt_init(void)
 {
        tegra_get_board_info(&board_info);
@@ -515,7 +510,6 @@ static void __init tegra_vcm30_t124_reserve(void)
 #else
        tegra_reserve(SZ_128M, SZ_16M + SZ_2M, SZ_4M);
 #endif
-       vcm30_t124_ramconsole_reserve(SZ_1M);
 }
 
 static const char * const vcm30_t124_dt_board_compat[] = {
index 738ddab..1db0118 100644 (file)
@@ -122,14 +122,6 @@ int get_sd_uart_port_id(void);
 void set_sd_uart_port_id(int);
 int __init tegra_register_fuse(void);
 
-#ifdef CONFIG_PSTORE_RAM
-void __init tegra_reserve_ramoops_memory(unsigned long ram_console_size);
-#else
-static inline void __init
-       tegra_reserve_ramoops_memory(unsigned long ram_console_size)
-{}
-#endif
-
 extern phys_addr_t tegra_bootloader_fb_start;
 extern phys_addr_t tegra_bootloader_fb_size;
 extern phys_addr_t tegra_bootloader_fb2_start;
index 79065ea..8536ed5 100644 (file)
@@ -1832,6 +1832,37 @@ void __tegra_clear_framebuffer(struct platform_device *pdev,
        iounmap(to_io);
 }
 
+#ifdef CONFIG_PSTORE_RAM
+static struct ramoops_platform_data ramoops_data;
+
+static struct platform_device ramoops_dev  = {
+       .name = "ramoops",
+       .dev = {
+               .platform_data = &ramoops_data,
+       },
+};
+
+static void __init tegra_reserve_ramoops_memory(unsigned long reserve_size)
+{
+       ramoops_data.mem_size = reserve_size;
+       ramoops_data.mem_address = memblock_end_of_4G() - reserve_size;
+       ramoops_data.console_size = reserve_size;
+       ramoops_data.dump_oops = 1;
+       memblock_reserve(ramoops_data.mem_address, ramoops_data.mem_size);
+}
+
+static int __init tegra_register_ramoops_device(void)
+{
+       int ret = platform_device_register(&ramoops_dev);
+       if (ret) {
+               pr_info("Unable to register ramoops platform device\n");
+               return ret;
+       }
+       return ret;
+}
+core_initcall(tegra_register_ramoops_device);
+#endif
+
 void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
        unsigned long fb2_size)
 {
@@ -2123,6 +2154,9 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
 #endif
 
        tegra_fb_linear_set(map);
+#ifdef CONFIG_PSTORE_RAM
+       tegra_reserve_ramoops_memory(SZ_1M);
+#endif
 }
 
 void tegra_get_fb_resource(struct resource *fb_res)
@@ -2139,34 +2173,6 @@ void tegra_get_fb2_resource(struct resource *fb2_res)
                        (resource_size_t) tegra_fb2_size - 1;
 }
 
-#ifdef CONFIG_PSTORE_RAM
-static struct ramoops_platform_data ramoops_data;
-
-static struct platform_device ramoops_dev  = {
-       .name = "ramoops",
-       .dev = {
-               .platform_data = &ramoops_data,
-       },
-};
-
-
-void __init tegra_reserve_ramoops_memory(unsigned long reserve_size)
-{
-       ramoops_data.mem_size = reserve_size;
-       ramoops_data.mem_address = memblock_end_of_4G() - reserve_size;
-       ramoops_data.console_size = reserve_size;
-       ramoops_data.dump_oops = 1;
-       memblock_reserve(ramoops_data.mem_address, ramoops_data.mem_size);
-}
-
-static void __init tegra_register_ramoops_device()
-{
-       if (platform_device_register(&ramoops_dev))
-               pr_info("Unable to register ramoops platform device\n");
-}
-core_initcall(tegra_register_ramoops_device);
-#endif
-
 int __init tegra_register_fuse(void)
 {
        return platform_device_register(&tegra_fuse_device);