From patchwork Mon Jan 6 18:39:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 3440201 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 339C6C02DC for ; Mon, 6 Jan 2014 18:39:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 061DE2016D for ; Mon, 6 Jan 2014 18:39:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3E1220109 for ; Mon, 6 Jan 2014 18:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755420AbaAFSjd (ORCPT ); Mon, 6 Jan 2014 13:39:33 -0500 Received: from gloria.sntech.de ([95.129.55.99]:56037 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755401AbaAFSjc (ORCPT ); Mon, 6 Jan 2014 13:39:32 -0500 Received: from ip545477c2.speed.planet.nl ([84.84.119.194] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1W0F5E-0002fZ-HN; Mon, 06 Jan 2014 19:39:28 +0100 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: kgene.kim@samsung.com Cc: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 3/5] ARM: S3C24XX: add common reset function Date: Mon, 06 Jan 2014 19:39:16 +0100 Message-ID: <3212735.MOokUY2h0f@phil> User-Agent: KMail/4.11.3 (Linux/3.11-2-amd64; KDE/4.11.3; x86_64; ; ) In-Reply-To: <3105326.uFdOVLyXH8@phil> References: <3105326.uFdOVLyXH8@phil> MIME-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The function first tries to use a swrst-block if available, then a watchdog-reset and at the end a soft_restart as last measure. Signed-off-by: Heiko Stuebner --- arch/arm/mach-s3c24xx/common.c | 26 ++++++++++++++++++++++++++ arch/arm/mach-s3c24xx/common.h | 2 ++ 2 files changed, 28 insertions(+) diff --git a/arch/arm/mach-s3c24xx/common.c b/arch/arm/mach-s3c24xx/common.c index a7b1269..a3b1d98 100644 --- a/arch/arm/mach-s3c24xx/common.c +++ b/arch/arm/mach-s3c24xx/common.c @@ -587,3 +587,29 @@ struct platform_device s3c2410_device_dclk = { .resource = s3c2410_dclk_resource, }; #endif + +/* + * Some S3C24XX-SoCs have a special software-reset register and + * all of them seem to support the watchdog reset. + */ +void s3c24xx_restart(enum reboot_mode mode, const char *cmd) +{ + if (mode == REBOOT_SOFT) + soft_restart(0); + + if (s3c24xx_swrst_reset_available()) { + pr_debug("s3c24xx: trying swrst-reset\n"); + s3c24xx_swrst_reset(); + /* delay to allow the serial port to show the message */ + mdelay(50); + } + +#ifdef CONFIG_SAMSUNG_WDT_RESET + pr_debug("s3c24xx: trying watchdog-reset\n"); + samsung_wdt_reset(); + mdelay(50); +#endif + + /* we'll take a jump through zero as a poor second */ + soft_restart(0); +} diff --git a/arch/arm/mach-s3c24xx/common.h b/arch/arm/mach-s3c24xx/common.h index caf1534..20829a8 100644 --- a/arch/arm/mach-s3c24xx/common.h +++ b/arch/arm/mach-s3c24xx/common.h @@ -147,4 +147,6 @@ static inline void s3c24xx_swrst_reset_init(void __iomem *base, bool is_s3c2412) {} #endif +void s3c24xx_restart(enum reboot_mode mode, const char *cmd); + #endif /* __ARCH_ARM_MACH_S3C24XX_COMMON_H */