From patchwork Wed Jun 17 14:04:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Noralf_Tr=C3=B8nnes?= X-Patchwork-Id: 485453 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AABBA140290 for ; Thu, 18 Jun 2015 00:08:15 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5DyG-0005Kh-15; Wed, 17 Jun 2015 14:05:40 +0000 Received: from asav22.altibox.net ([109.247.116.9]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5Dy9-0005Gw-FV; Wed, 17 Jun 2015 14:05:37 +0000 Received: from localhost (localhost [127.0.0.1]) by asav22.altibox.net (Postfix) with ESMTP id 8FCA720920; Wed, 17 Jun 2015 16:05:03 +0200 (CEST) Received: from asav22.altibox.net ([127.0.0.1]) by localhost (asav22.lysetele.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IfuMbN3D2Z-Z; Wed, 17 Jun 2015 16:05:03 +0200 (CEST) Received: from localhost.localdomain (48.81-166-104.customer.lyse.net [81.166.104.48]) by asav22.altibox.net (Postfix) with ESMTP id C78E320916; Wed, 17 Jun 2015 16:05:02 +0200 (CEST) From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= To: linux-watchdog@vger.kernel.org Subject: [PATCH v3] watchdog: bcm2835: Fix poweroff behaviour Date: Wed, 17 Jun 2015 16:04:04 +0200 Message-Id: <1434549844-11704-1-git-send-email-noralf@tronnes.org> X-Mailer: git-send-email 2.2.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150617_070533_696612_695F4CD8 X-CRM114-Status: UNSURE ( 9.85 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- Cc: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org 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 Tested-by: Stephen Warren Acked-by: Stephen Warren Reviewed-by: Guenter Roeck --- 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(-) -- 2.2.2 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 */