public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour
@ 2015-06-17 14:04 Noralf Trønnes
  2015-06-18  2:08 ` Stephen Warren
  2015-06-18  3:58 ` Guenter Roeck
  0 siblings, 2 replies; 5+ messages in thread
From: Noralf Trønnes @ 2015-06-17 14:04 UTC (permalink / raw)
  To: linux-watchdog
  Cc: linux-arm-kernel, linux-rpi-kernel, linux-kernel,
	Noralf Trønnes

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>
---

v2: Fix typo in commit message

v3: Only Raspberry Pi is supported so it's ok to just modify
    the poweroff function (Stephen Warrren)

 drivers/watchdog/bcm2835_wdt.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
index 7116968..43dbf5b 100644
--- a/drivers/watchdog/bcm2835_wdt.c
+++ b/drivers/watchdog/bcm2835_wdt.c
@@ -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)

@@ -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 */
--
2.2.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour
  2015-06-17 14:04 [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour Noralf Trønnes
@ 2015-06-18  2:08 ` Stephen Warren
  2015-06-18  3:58 ` Guenter Roeck
  1 sibling, 0 replies; 5+ messages in thread
From: Stephen Warren @ 2015-06-18  2:08 UTC (permalink / raw)
  To: Noralf Trønnes
  Cc: linux-watchdog, linux-arm-kernel, linux-rpi-kernel, linux-kernel

On 06/17/2015 08:04 AM, Noralf Trønnes wrote:
> 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

Tested-by: Stephen Warren <swarren@wwwdotorg.org>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>

I wonder if, sometime down the road, it's worth querying the firmware
version via the firmware driver and dynamically doing the right thing.
Still, the combination of a bleeding edge kernel and an ancient firmware
seems a bit unlikely, so perhaps not worth the bother.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour
  2015-06-17 14:04 [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour Noralf Trønnes
  2015-06-18  2:08 ` Stephen Warren
@ 2015-06-18  3:58 ` Guenter Roeck
  2015-09-13 19:26   ` Noralf Trønnes
  1 sibling, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2015-06-18  3:58 UTC (permalink / raw)
  To: Noralf Trønnes, linux-watchdog
  Cc: linux-arm-kernel, linux-rpi-kernel, linux-kernel

On 06/17/2015 07:04 AM, Noralf Trønnes wrote:
> 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>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour
  2015-06-18  3:58 ` Guenter Roeck
@ 2015-09-13 19:26   ` Noralf Trønnes
  2015-09-13 19:54     ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Noralf Trønnes @ 2015-09-13 19:26 UTC (permalink / raw)
  To: Guenter Roeck, linux-watchdog, Eric Anholt; +Cc: linux-rpi-kernel, linux-kernel


Den 18.06.2015 05:58, skrev Guenter Roeck:
> On 06/17/2015 07:04 AM, Noralf Trønnes wrote:
>> 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>
>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>

It seems that this has slipped through the cracks, at least it didn't
enter in the 4.3 merge window.


Noralf.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour
  2015-09-13 19:26   ` Noralf Trønnes
@ 2015-09-13 19:54     ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2015-09-13 19:54 UTC (permalink / raw)
  To: Noralf Trønnes, linux-watchdog, Eric Anholt
  Cc: linux-rpi-kernel, linux-kernel

On 09/13/2015 12:26 PM, Noralf Trønnes wrote:
>
> Den 18.06.2015 05:58, skrev Guenter Roeck:
>> On 06/17/2015 07:04 AM, Noralf Trønnes wrote:
>>> 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>
>>
>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>>
>
> It seems that this has slipped through the cracks, at least it didn't
> enter in the 4.3 merge window.
>

Yes, completely. It slipped through my cracks as well :-(.

Guenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-13 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-17 14:04 [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour Noralf Trønnes
2015-06-18  2:08 ` Stephen Warren
2015-06-18  3:58 ` Guenter Roeck
2015-09-13 19:26   ` Noralf Trønnes
2015-09-13 19:54     ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox