Skip to content

Commit

Permalink
watchdog: bcm2835: Fix poweroff behaviour
Browse files Browse the repository at this point in the history
Currently poweroff/halt results in a reboot on the Raspberry Pi.
The firmware uses the RSTS register to know which partiton to
boot from. The partiton value is spread into bits
0, 2, 4, 6, 8, 10. Partiton 63 is a special partition used by
the firmware to indicate halt.

The firmware made this change in 19 Aug 2013 and was matched
by the downstream commit:
Changes for new NOOBS multi partition booting from gsh

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
  • Loading branch information
Noralf Trønnes authored and Wim Van Sebroeck committed Sep 28, 2015
1 parent c73318f commit 898e686
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/watchdog/bcm2835_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@
#define PM_RSTC_WRCFG_FULL_RESET 0x00000020
#define PM_RSTC_RESET 0x00000102

/*
* The Raspberry Pi firmware uses the RSTS register to know which partiton
* to boot from. The partiton value is spread into bits 0, 2, 4, 6, 8, 10.
* Partiton 63 is a special partition used by the firmware to indicate halt.
*/
#define PM_RSTS_RASPBERRYPI_HALT 0x555

#define SECS_TO_WDOG_TICKS(x) ((x) << 16)
#define WDOG_TICKS_TO_SECS(x) ((x) >> 16)

Expand Down Expand Up @@ -151,8 +158,7 @@ static void bcm2835_power_off(void)
* hard reset.
*/
val = readl_relaxed(wdt->base + PM_RSTS);
val &= PM_RSTC_WRCFG_CLR;
val |= PM_PASSWORD | PM_RSTS_HADWRH_SET;
val |= PM_PASSWORD | PM_RSTS_RASPBERRYPI_HALT;
writel_relaxed(val, wdt->base + PM_RSTS);

/* Continue with normal reset mechanism */
Expand Down

0 comments on commit 898e686

Please sign in to comment.