summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun Wadekar <vwadekar@nvidia.com>2012-04-17 18:10:49 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 12:33:39 -0700
commit37b2dd13d9ea3292edc27d64cf37a13a9cb1b9ef (patch)
treeb0024c000ab44ecbabbc0d18a7c221c37680e442
parenteae036b44aea75669573f1bfef953ac6bc9205f2 (diff)
ARM: Tegra: add support for persistent_ram
ram_console driver now depends on persistent_ram to carve the chunk of memory that it needs. So ask persistent_ram driver to reserve memory for ram_console instead of doing it in the tegra common code. Change-Id: I43854f059f0610f3b5bf54acd1af51e33f9dd330 Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Signed-off-by: Johnny Qiu <joqiu@nvidia.com> Reviewed-on: http://git-master/r/130066 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com> Rebase-Id: R550a9de8ddc5acaf3c3ca03bad879119710a02f7 fixup ramconsole move to fs/pstore Signed-off-by: Dan Willemsen <dwillemsen@nvidia.com>
-rw-r--r--arch/arm/mach-tegra/board.h9
-rw-r--r--arch/arm/mach-tegra/common.c47
2 files changed, 25 insertions, 31 deletions
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index facfe90f3b79..a7f973d4e301 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -80,8 +80,6 @@ void __init tegra_init_irq(void);
void __init tegra_dt_init_irq(void);
void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
unsigned long fb2_size);
-void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size);
-void __init tegra_ram_console_debug_init(void);
void __init tegra_release_bootloader_fb(void);
void __init tegra_protected_aperture_init(unsigned long aperture);
int __init tegra_init_board_info(void);
@@ -90,6 +88,13 @@ void tegra_move_framebuffer(unsigned long to, unsigned long from,
bool is_tegra_debug_uartport_hs(void);
int get_tegra_uart_debug_port_id(void);
+#ifdef CONFIG_PSTORE_RAM
+void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size);
+#else
+static inline void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size)
+{}
+#endif
+
extern unsigned long tegra_bootloader_fb_start;
extern unsigned long tegra_bootloader_fb_size;
extern unsigned long tegra_fb_start;
diff --git a/arch/arm/mach-tegra/common.c b/arch/arm/mach-tegra/common.c
index 340430a4919d..75354cca9228 100644
--- a/arch/arm/mach-tegra/common.c
+++ b/arch/arm/mach-tegra/common.c
@@ -31,6 +31,7 @@
#include <linux/bitops.h>
#include <linux/sched.h>
#include <linux/of.h>
+#include <linux/pstore_ram.h>
#include <asm/hardware/cache-l2x0.h>
#include <asm/system.h>
@@ -489,6 +490,7 @@ void __init tegra20_init_early(void)
tegra_init_ahb_gizmo_settings();
tegra_init_debug_uart_rate();
tegra_gpio_resume_init();
+ tegra_ram_console_debug_reserve(SZ_1M);
}
#endif
#ifdef CONFIG_ARCH_TEGRA_3x_SOC
@@ -510,6 +512,7 @@ void __init tegra30_init_early(void)
tegra_init_ahb_gizmo_settings();
tegra_init_debug_uart_rate();
tegra_gpio_resume_init();
+ tegra_ram_console_debug_reserve(SZ_1M);
}
#endif
#ifdef CONFIG_ARCH_TEGRA_11x_SOC
@@ -1060,50 +1063,36 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
}
}
-static struct resource ram_console_resources[] = {
- {
- .flags = IORESOURCE_MEM,
- },
+#ifdef CONFIG_PSTORE_RAM
+static struct persistent_ram_descriptor desc = {
+ .name = "ramoops",
};
-static struct platform_device ram_console_device = {
- .name = "ram_console",
- .id = -1,
- .num_resources = ARRAY_SIZE(ram_console_resources),
- .resource = ram_console_resources,
+static struct persistent_ram ram = {
+ .descs = &desc,
+ .num_descs = 1,
};
void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size)
{
- struct resource *res;
- long ret;
+ int ret;
- res = platform_get_resource(&ram_console_device, IORESOURCE_MEM, 0);
- if (!res)
- goto fail;
- res->start = memblock_end_of_DRAM() - ram_console_size;
- res->end = res->start + ram_console_size - 1;
- ret = memblock_remove(res->start, ram_console_size);
+ ram.start = memblock_end_of_DRAM() - ram_console_size;
+ ram.size = ram_console_size;
+ ram.descs->size = ram_console_size;
+
+ INIT_LIST_HEAD(&ram.node);
+
+ ret = persistent_ram_early_init(&ram);
if (ret)
goto fail;
return;
fail:
- ram_console_device.resource = NULL;
- ram_console_device.num_resources = 0;
pr_err("Failed to reserve memory block for ram console\n");
}
-
-void __init tegra_ram_console_debug_init(void)
-{
- int err;
-
- err = platform_device_register(&ram_console_device);
- if (err)
- pr_err("%s: ram console registration failed (%d)!\n",
- __func__, err);
-}
+#endif
void __init tegra_release_bootloader_fb(void)
{