diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-06-28 08:45:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-07-18 07:14:12 +0200 |
commit | f8cc882812259f763f785ec41e8efae45aee05d8 (patch) | |
tree | eb3ab89403fc7a8651dc5daa482fbab810512d0b /arch/sandbox | |
parent | 5de4d6e7eb28ac5277db2d60c5b4148716682281 (diff) | |
download | barebox-f8cc882812259f763f785ec41e8efae45aee05d8.tar.gz barebox-f8cc882812259f763f785ec41e8efae45aee05d8.tar.xz |
sandbox: power: set $global.system.reset=POR on poweroff
Now that the stickypage is a regular hostfile, it survives poweroff.
This $global.system.reset will only be POR on first boot. For subsequent
boots, the power driver must itself take care to write POR to the nvmem
cell.
While at it remove two minor issues:
- src_offset is unused
- len is used to store a length into. Its original value is unused
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20210628064517.28636-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/board/power.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/arch/sandbox/board/power.c b/arch/sandbox/board/power.c index 3112c80348..aa778792c1 100644 --- a/arch/sandbox/board/power.c +++ b/arch/sandbox/board/power.c @@ -8,12 +8,15 @@ struct sandbox_power { struct restart_handler rst_hang, rst_reexec; + struct poweroff_handler poweroff; struct nvmem_cell *reset_source_cell; - u32 src_offset; }; static void sandbox_poweroff(struct poweroff_handler *poweroff) { + struct sandbox_power *power = container_of(poweroff, struct sandbox_power, poweroff); + + nvmem_cell_write(power->reset_source_cell, &(u8) { RESET_POR }, 1); linux_exit(); } @@ -36,10 +39,15 @@ static void sandbox_rst_reexec(struct restart_handler *rst) static int sandbox_power_probe(struct device_d *dev) { struct sandbox_power *power = xzalloc(sizeof(*power)); - size_t len = 1; + size_t len; u8 *rst; - poweroff_handler_register_fn(sandbox_poweroff); + power->poweroff = (struct poweroff_handler) { + .name = "exit", + .poweroff = sandbox_poweroff + }; + + poweroff_handler_register(&power->poweroff); power->rst_hang = (struct restart_handler) { .name = "hang", |