summaryrefslogtreecommitdiff
path: root/arch/arm/mach-ux500/cpu.c
diff options
context:
space:
mode:
authorPhilippe Langlais <philippe.langlais@linaro.org>2011-05-05 16:21:11 +0200
committerUlf Hansson <ulf.hansson@stericsson.com>2011-09-19 15:15:02 +0200
commit56e6fc7c13bd19025049f6d089ff9b9e1020f1a6 (patch)
tree1117bdd405b266ccdb2f7930e637450e8e40894b /arch/arm/mach-ux500/cpu.c
parent8b0ffab72a5eaa13d9758099bd769c82a21bd596 (diff)
ux500: sw reset: Save SW Reset Reason before reset
Converts the reboot reason string received in SYSCALL_DEFINE4 in sys.c into a 2 bytes reset reason code. This 16 bit value is stored in the TCDM Memory at location: tcdm_base + 0xFF8. The string to code mapping structure has been added in file reboot_reasons.h and reboot_reasons.c. The code for translation has been placed in cpu.c. ST-Ericsson Linux next: Tested and reviewed with 2011-03-28 ST-Ericsson ID: 327863 ST-Ericsson FOSS-OUT ID: Trivial Change-Id: I5fe83b824c6dbe3f61a3d77671ce845e6f81d87b Signed-off-by: rickard evertsson <rickard.evertsson@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/19174 Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com> Conflicts: arch/arm/mach-ux500/Makefile arch/arm/mach-ux500/cpu.c
Diffstat (limited to 'arch/arm/mach-ux500/cpu.c')
-rw-r--r--arch/arm/mach-ux500/cpu.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index d8a62845791..3d4ceed17e3 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -24,6 +24,7 @@
#include <mach/devices.h>
#include <mach/prcmu-fw-api.h>
#include <mach/prcmu-db5500.h>
+#include <mach/reboot_reasons.h>
#include "clock.h"
@@ -33,9 +34,37 @@ void __iomem *_PRCMU_BASE;
static void __iomem *l2x0_base;
#endif
+/*
+ * The reboot reason string can be 255 characters long and the memory
+ * in which we save the sw reset reason is 2 bytes. Therefore we need to
+ * convert the string into a 16 bit pattern.
+ *
+ * See file reboot_reasons.h for conversion.
+ */
+static unsigned short map_cmd_to_code(const char *cmd)
+{
+ int i;
+
+ if (cmd == NULL)
+ /* normal reboot w/o argument */
+ return SW_RESET_NO_ARGUMENT;
+
+ /* Search through reboot reason list */
+ for (i = 0; i < reboot_reasons_size; i++) {
+ if (!strcmp(reboot_reasons[i].reason, cmd))
+ return reboot_reasons[i].code;
+ }
+
+ /* No valid Reboot Reason found */
+ return SW_RESET_CRASH;
+}
+
static void ux500_restart(char mode, const char *cmd)
{
- prcmu_system_reset();
+ unsigned short reset_code;
+
+ reset_code = map_cmd_to_code(cmd);
+ prcmu_system_reset(reset_code);
mdelay(1000);
printk("Reboot via PRCMU failed -- System halted\n");