diff options
author | Huzefa Kankroliwala <huzefank@ti.com> | 2012-01-04 15:51:57 -0600 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 12:55:13 +0200 |
commit | 7b905dcb3e7d29d28907c4839fdf25a368a5353e (patch) | |
tree | ec703faad087d8e3c502c9e8ec8f165dfa42d52d | |
parent | 99b10fe0506d97bdbb111ca8d385fecddec0ca7a (diff) | |
download | kernel_samsung_tuna-7b905dcb3e7d29d28907c4839fdf25a368a5353e.zip kernel_samsung_tuna-7b905dcb3e7d29d28907c4839fdf25a368a5353e.tar.gz kernel_samsung_tuna-7b905dcb3e7d29d28907c4839fdf25a368a5353e.tar.bz2 |
OMAP: Support for Android RAM console
Android's RAMCONSOLE framework is handy framework which allows
saving the kernel printk messages to a buffer in RAM, so that
after a kernel panic they can be viewed in the next kernel
invocation, by accessing /proc/last_kmsg.
This obviously needs DDR to be in selfrefresh mode. Board files
which have relevant support need to enable CONFIG_OMAP_RAM_CONSOLE
and call omap_ram_console_init with relevant parameters for this
to function.
Change-Id: I2dd5ad55a0a3af5a5dcb9a9b8a797e1371af39bc
Signed-off-by: Huzefa Kankroliwala <huzefank@ti.com>
Signed-off-by: Akash Choudhari <akashc@ti.com>
Signed-off-by: Ameya Palande <ameya.palande@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
-rwxr-xr-x | arch/arm/mach-omap2/Kconfig | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_ram_console.c | 87 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_ram_console.h | 33 |
4 files changed, 132 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 5d83504..eac405e 100755 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -394,6 +394,16 @@ config OMAP_REBOOT_REASON depends on ARCH_OMAP4 bool +config OMAP_RAM_CONSOLE + bool "Enable OMAP support for Android RAM console" + depends on ANDROID_RAM_CONSOLE + help + Select this option to enable Android RAM console support on OMAP. + This allows saving the kernel printk messages to a buffer in RAM, so + that after a kernel panic they can be viewed in the next kernel + invocation, by accessing /proc/last_kmsg + NOTE: Board file needs to invoke relevant api to enable the support + endmenu endif diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 359c22f..61799c9 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -316,3 +316,5 @@ obj-$(CONFIG_OMAP_FIQ_DEBUGGER) += omap_fiq_debugger.o ifeq ($(CONFIG_OMAP_REBOOT_REASON),y) obj-$(CONFIG_ARCH_OMAP4) += omap4-reboot-reason.o endif + +obj-$(CONFIG_OMAP_RAM_CONSOLE) += omap_ram_console.o diff --git a/arch/arm/mach-omap2/omap_ram_console.c b/arch/arm/mach-omap2/omap_ram_console.c new file mode 100644 index 0000000..cf84c64 --- /dev/null +++ b/arch/arm/mach-omap2/omap_ram_console.c @@ -0,0 +1,87 @@ +/* + * OMAP ram console support + * + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ + * Author: Huzefa Kankroliwala <huzefank@ti.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <linux/platform_device.h> +#include <linux/platform_data/ram_console.h> +#include <linux/memblock.h> +#include <plat/cpu.h> +#include "resetreason.h" +#include "omap_ram_console.h" + +static struct resource ram_console_resources[] = { + { + .flags = IORESOURCE_MEM, + .start = OMAP_RAM_CONSOLE_START_DEFAULT, + .end = OMAP_RAM_CONSOLE_START_DEFAULT + + OMAP_RAM_CONSOLE_SIZE_DEFAULT - 1, + }, +}; + +static struct ram_console_platform_data ram_console_pdata; + +static struct platform_device ram_console_device = { + .name = "ram_console", + .id = -1, + .num_resources = ARRAY_SIZE(ram_console_resources), + .resource = ram_console_resources, + .dev = { + .platform_data = &ram_console_pdata, + }, +}; + +/** + * omap_ram_console_init() - setup the ram console device for OMAP + * @phy_addr: physical address of the start of ram console buffer + * @size: ram console buffer size + * + * Board files call this as part of the memory reservation routine + * Depending on the choice of memory geometry and desired size, + * provide appropriate parameters. + * + * IMPORTANT: board files need to ensure that the DDR configurations + * enable self refresh mode for this to function properly. + */ + +int __init omap_ram_console_init(phys_addr_t phy_addr, size_t size) +{ + int ret; + + /* Remove the ram console region from kernel's map */ + ret = memblock_remove(phy_addr, size); + if (ret) { + pr_err("%s: unable to remove memory for ram console:" + "start=0x%08x, size=0x%08x, ret=%d\n", + __func__, (u32)phy_addr, (u32)size, ret); + return ret; + } + + /* Update reset reason for platforms that have support for it */ + if (cpu_is_omap44xx()) + ram_console_pdata.bootinfo = omap4_get_resetreason(); + + ram_console_resources[0].start = phy_addr; + ram_console_resources[0].end = phy_addr + size - 1; + + ret = platform_device_register(&ram_console_device); + if (ret) { + pr_err("%s: unable to register ram console device:" + "start=0x%08x, size=0x%08x, ret=%d\n", + __func__, (u32)phy_addr, (u32)size, ret); + memblock_add(phy_addr, size); + } + + return ret; +} diff --git a/arch/arm/mach-omap2/omap_ram_console.h b/arch/arm/mach-omap2/omap_ram_console.h new file mode 100644 index 0000000..edd75e8 --- /dev/null +++ b/arch/arm/mach-omap2/omap_ram_console.h @@ -0,0 +1,33 @@ +/* + * OMAP ram console support + * + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ + * Author: Huzefa Kankroliwala <huzefank@ti.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + + * This program is distributed "as is" WITHOUT ANY WARRANTY of any + * kind, whether express or implied; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __OMAP_RAM_CONSOLE_H +#define __OMAP_RAM_CONSOLE_H + +/* Board files use the following if they are ok with 512M size defaults */ +#define OMAP_RAM_CONSOLE_START_DEFAULT (PLAT_PHYS_OFFSET + SZ_512M) +#define OMAP_RAM_CONSOLE_SIZE_DEFAULT SZ_2M + +#ifdef CONFIG_OMAP_RAM_CONSOLE +extern int omap_ram_console_init(phys_addr_t phy_addr, size_t size); +#else +static inline int omap_ram_console_init(phys_addr_t phy_addr, size_t size) +{ + return 0; +} +#endif /* CONFIG_OMAP_RAM_CONSOLE */ + +#endif |