From patchwork Fri Mar 16 16:20:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 886982 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=c-s.fr Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 402rY83bTlz9sLw for ; Sat, 17 Mar 2018 03:30:36 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 09F30C21E4F; Fri, 16 Mar 2018 16:25:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 22836C21E73; Fri, 16 Mar 2018 16:22:25 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2E0EFC21E2F; Fri, 16 Mar 2018 16:21:04 +0000 (UTC) Received: from pegase1.c-s.fr (pegase1.c-s.fr [93.17.236.30]) by lists.denx.de (Postfix) with ESMTPS id 9D191C21E2B for ; Fri, 16 Mar 2018 16:21:00 +0000 (UTC) Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 402rKw2NNbz9tvQd; Fri, 16 Mar 2018 17:20:52 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id FggzfB5cb3pL; Fri, 16 Mar 2018 17:20:52 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 402rKw1kkyz9tvPl; Fri, 16 Mar 2018 17:20:52 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 424C18BBB1; Fri, 16 Mar 2018 17:21:00 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id spEtIcaFJvdL; Fri, 16 Mar 2018 17:21:00 +0100 (CET) Received: from po15720vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.30]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 0DA5C8BBAA; Fri, 16 Mar 2018 17:21:00 +0100 (CET) Received: by po15720vm.idsi0.si.c-s.fr (Postfix, from userid 0) id CCD0F6F128; Fri, 16 Mar 2018 17:20:59 +0100 (CET) Message-Id: <536e23b094c8198275223510ab3813b454ce2ca8.1521215903.git.christophe.leroy@c-s.fr> In-Reply-To: References: From: Christophe Leroy To: Tom Rini , Wolfgang Denk Date: Fri, 16 Mar 2018 17:20:59 +0100 (CET) Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v4 15/16] powerpc: mpc8xx: cleaning up watchdog X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In preparation of migration to DM watchdog, clean up a bit. The 8xx watchdog really is a HW watchdog, so declare it as is then it goes through Kconfig And the watchdog reset doesn't mind getting interrupted, so no need to disable interrupts Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 1 + arch/powerpc/cpu/mpc8xx/cpu.c | 19 +++---------------- arch/powerpc/cpu/mpc8xx/cpu_init.c | 9 +++++---- include/configs/MCR3000.h | 2 -- include/watchdog.h | 5 ----- 5 files changed, 9 insertions(+), 27 deletions(-) diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index 77c03330303..af45cfe8498 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -34,6 +34,7 @@ config MPC8xx bool "MPC8xx" select BOARD_EARLY_INIT_F imply CMD_REGINFO + imply HW_WATCHDOG endchoice diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c index 6a1bd8dce4b..7608970e3b1 100644 --- a/arch/powerpc/cpu/mpc8xx/cpu.c +++ b/arch/powerpc/cpu/mpc8xx/cpu.c @@ -272,24 +272,11 @@ unsigned long get_tbclk(void) /* ------------------------------------------------------------------------- */ -#if defined(CONFIG_WATCHDOG) -void watchdog_reset(void) +#if defined(CONFIG_HW_WATCHDOG) +void hw_watchdog_reset(void) { - int re_enable = disable_interrupts(); + immap_t __iomem *immr = (immap_t __iomem *)CONFIG_SYS_IMMR; - reset_8xx_watchdog((immap_t __iomem *)CONFIG_SYS_IMMR); - if (re_enable) - enable_interrupts(); -} -#endif /* CONFIG_WATCHDOG */ - -#if defined(CONFIG_WATCHDOG) - -void reset_8xx_watchdog(immap_t __iomem *immr) -{ - /* - * All other boards use the MPC8xx Internal Watchdog - */ out_be16(&immr->im_siu_conf.sc_swsr, 0x556c); /* write magic1 */ out_be16(&immr->im_siu_conf.sc_swsr, 0xaa39); /* write magic2 */ } diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c index 6127c9f7713..99e8c85e7a3 100644 --- a/arch/powerpc/cpu/mpc8xx/cpu_init.c +++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c @@ -26,11 +26,12 @@ void cpu_init_f(immap_t __iomem *immr) /* SYPCR - contains watchdog control (11-9) */ - out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR); +#ifndef CONFIG_HW_WATCHDOG + /* deactivate watchdog if not enabled in config */ + out_be32(&immr->im_siu_conf.sc_sypcr, CONFIG_SYS_SYPCR & ~SYPCR_SWE); +#endif -#if defined(CONFIG_WATCHDOG) - reset_8xx_watchdog(immr); -#endif /* CONFIG_WATCHDOG */ + WATCHDOG_RESET(); /* SIUMCR - contains debug pin configuration (11-6) */ setbits_be32(&immr->im_siu_conf.sc_siumcr, CONFIG_SYS_SIUMCR); diff --git a/include/configs/MCR3000.h b/include/configs/MCR3000.h index cb28d6522ab..aeda4742aab 100644 --- a/include/configs/MCR3000.h +++ b/include/configs/MCR3000.h @@ -60,8 +60,6 @@ #define CONFIG_LOADS_ECHO 1 /* echo on for serial download */ -#define CONFIG_WATCHDOG 1 /* watchdog enabled */ - /* Miscellaneous configurable options */ #define CONFIG_SYS_MEMTEST_START 0x00002000 diff --git a/include/watchdog.h b/include/watchdog.h index d420ab127b3..52f4c506b04 100644 --- a/include/watchdog.h +++ b/include/watchdog.h @@ -72,11 +72,6 @@ int init_func_watchdog_reset(void); * Prototypes from $(CPU)/cpu.c. */ -/* MPC 8xx */ -#if defined(CONFIG_MPC8xx) && !defined(__ASSEMBLY__) - void reset_8xx_watchdog(immap_t __iomem *immr); -#endif - #if defined(CONFIG_HW_WATCHDOG) && !defined(__ASSEMBLY__) void hw_watchdog_init(void); #endif