blob: a09eb9f2d6e47c1bb7bcb28abca37b840608a40b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
/*
* Reboot reason special handler
*
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* Nishanth Menon
*
* 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/reboot.h>
#include <linux/notifier.h>
#include <mach/hardware.h>
#include <mach/omap4-common.h>
#include "omap4-sar-layout.h"
#ifdef CONFIG_OMAP4_DPLL_CASCADING
static struct device fake_reset_dev;
#endif
static int omap_reboot_notifier_call(struct notifier_block *this,
unsigned long code, void *cmd)
{
void __iomem *sar_base;
char *reason = "normal";
#ifdef CONFIG_OMAP4_DPLL_CASCADING
pr_info("%s: exit DPLL cascading\n", __func__);
omap4_dpll_cascading_blocker_hold(&fake_reset_dev);
#endif
sar_base = omap4_get_sar_ram_base();
if (!sar_base)
return notifier_from_errno(-ENOMEM);
/* Save reboot mode in scratch memory */
if (code == SYS_RESTART && cmd != NULL && strlen(cmd))
reason = cmd;
else if (code == SYS_POWER_OFF)
reason = "off";
strncpy(sar_base + OMAP_REBOOT_REASON_OFFSET,
reason, OMAP_REBOOT_REASON_SIZE);
return NOTIFY_DONE;
}
static struct notifier_block omap_reboot_notifier = {
.notifier_call = omap_reboot_notifier_call,
};
static int __init omap_reboot_reason_init(void)
{
void __iomem *sar_base;
sar_base = omap4_get_sar_ram_base();
if (sar_base)
strncpy(sar_base + OMAP_REBOOT_REASON_OFFSET,
"", OMAP_REBOOT_REASON_SIZE);
return register_reboot_notifier(&omap_reboot_notifier);
}
late_initcall(omap_reboot_reason_init);
|