summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Adams <rgadams@codeaurora.org>2010-09-28 10:21:07 -0700
committerKyle Yan <kyan@codeaurora.org>2016-06-21 15:13:09 -0700
commit44ed42824b3b3fa37be82227409f7d2f64b18c43 (patch)
treecfd467e95ceb486d9a37a9355a25f0b12aa2d032
parentb60e5b41b9b9298fd8268c34a96440c770e80d16 (diff)
msm: falcon: put reason for boot in procfs from SMEM
During board initialization read the shared memory item SMEM_POWER_ON_STATUS_INFO and place it in the procfs at /proc/sys/kernel/boot_reason The data item is an integer with a bit being set to identify the reason the device was powered on. The values of this data item is defined in the document Document/arm/msm/boot.txt, the following is the data in the documentation file. power_on_status values set by the PMIC for power on event: ---------------------------------------------------------- 0x01 -- keyboard power on 0x02 -- RTC alarm 0x04 -- cable power on 0x08 -- SMPL 0x10 -- Watch Dog timeout 0x20 -- USB charger 0x40 -- Wall charger 0xFF -- error reading power_on_status value This is cherrypicked from commit <372d39f87b0da75> ("put reason for boot in procfs") of 3.18 tree. Change-Id: I59e665f92e6e29f7dfef4380314f676a2d92c94b Signed-off-by: Rick Adams <rgadams@codeaurora.org> [abhimany: fix up minor merge conflicts] Signed-off-by: Abhimanyu Kapur <abhimany@codeaurora.org> Signed-off-by: Srinivas Ramana <sramana@codeaurora.org>
-rw-r--r--Documentation/arm/msm/boot.txt23
-rw-r--r--arch/arm/include/asm/processor.h2
-rw-r--r--arch/arm/kernel/setup.c3
-rw-r--r--kernel/sysctl_binary.c1
4 files changed, 29 insertions, 0 deletions
diff --git a/Documentation/arm/msm/boot.txt b/Documentation/arm/msm/boot.txt
new file mode 100644
index 000000000000..1a41cd532020
--- /dev/null
+++ b/Documentation/arm/msm/boot.txt
@@ -0,0 +1,23 @@
+Introduction
+=============
+The power management integrated circuit (PMIC) records the reason the
+Application processor was powered on in Shared Memory.
+The hardware and software used is the shared memory interface. This document
+is not for the purpose of describing this interface, but to identify the
+possible values for this data item.
+
+Description
+===========
+Shared memory item (SMEM_POWER_ON_STATUS_INFO) is read to get access to
+this data. The table below identifies the possible values stored.
+
+power_on_status values set by the PMIC for power on event:
+----------------------------------------------------------
+0x01 -- keyboard power on
+0x02 -- RTC alarm
+0x04 -- cable power on
+0x08 -- SMPL
+0x10 -- Watch Dog timeout
+0x20 -- USB charger
+0x40 -- Wall charger
+0xFF -- error reading power_on_status value
diff --git a/arch/arm/include/asm/processor.h b/arch/arm/include/asm/processor.h
index 8a1e8e995dae..04621d1a8848 100644
--- a/arch/arm/include/asm/processor.h
+++ b/arch/arm/include/asm/processor.h
@@ -30,6 +30,8 @@
#define STACK_TOP_MAX TASK_SIZE
#endif
+extern unsigned int boot_reason;
+
struct debug_info {
#ifdef CONFIG_HAVE_HW_BREAKPOINT
struct perf_event *hbp[ARM_MAX_HBP_SLOTS];
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index a0ebc3d8afbc..a35c62bf9b37 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -114,6 +114,9 @@ EXPORT_SYMBOL(elf_hwcap2);
char* (*arch_read_hardware_id)(void);
EXPORT_SYMBOL(arch_read_hardware_id);
+unsigned int boot_reason;
+EXPORT_SYMBOL(boot_reason);
+
#ifdef MULTI_CPU
struct processor processor __read_mostly;
#endif
diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
index 15f80b481fcb..5ec5bbc09d39 100644
--- a/kernel/sysctl_binary.c
+++ b/kernel/sysctl_binary.c
@@ -138,6 +138,7 @@ static const struct bin_table bin_kern_table[] = {
{ CTL_INT, KERN_MAX_LOCK_DEPTH, "max_lock_depth" },
{ CTL_INT, KERN_PANIC_ON_NMI, "panic_on_unrecovered_nmi" },
{ CTL_INT, KERN_PANIC_ON_WARN, "panic_on_warn" },
+ { CTL_INT, KERN_BOOT_REASON, "boot_reason" },
{}
};