From patchwork Mon Aug 1 13:35:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1662603 X-Patchwork-Delegate: marek.behun@nic.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=L22wEd8n; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LxK0L484Jz9sCD for ; Mon, 1 Aug 2022 23:36:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 32BBB83F8E; Mon, 1 Aug 2022 15:36:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="L22wEd8n"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5F5FE84005; Mon, 1 Aug 2022 15:36:28 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1EE868215A for ; Mon, 1 Aug 2022 15:36:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 13190612D7; Mon, 1 Aug 2022 13:36:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 540BAC433D6; Mon, 1 Aug 2022 13:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659360984; bh=PYio21gFqRoxFba4brZ4lVyQsow/6nUTvyltWR7nK90=; h=From:To:Cc:Subject:Date:From; b=L22wEd8nR5ls2a7PgSCJ0lTy1C3roggexNR+QLOqavTptNzGZQ6VovVczHXikhFa7 oJWkze4ncBb18KSfdHF3EWins1N+7TQOckiEHZl08Sb8rc4Qbws/adBJCQWbvbBAT5 bViSwxaapHc6cLI1OCtyFIujGCVe8A1M5TnvlBcrkUuyWYKkqjsEBNNZUlyhF6BmnH Uhc//VRYd2033VRTRu7fH5phk5qC4Z1Sev1h88vDYTy91Tp/PwiUpEoU2sNzK/1j06 yYkj8o0PeUZcb+SOVDplherlG80Mmv7YfKzdoB4OiLewviCX70qpGkrswFIwQLJw0F F/iPbBeyqVfyA== Received: by pali.im (Postfix) id C088075F; Mon, 1 Aug 2022 15:36:21 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Peng Fan Cc: u-boot@lists.denx.de Subject: [PATCH] board: freescale: p1_p2_rdb_pc: Delete watchdog max6370 node in load_default mode Date: Mon, 1 Aug 2022 15:35:43 +0200 Message-Id: <20220801133543.11806-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean CPLD in load_default mode ignores watchdog reset signal. It does not reset board when watchdog triggers reset signal. Detect load_default mode by GPIO7 - LOAD_DEFAULT_N and delete watchdog max6370 node from device to prevent registering driver for non-working watchdog. Signed-off-by: Pali Rohár --- board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c index a71952dcf399..06cab729e4ab 100644 --- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c +++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c @@ -368,6 +368,24 @@ int board_eth_init(struct bd_info *bis) } #endif +#if defined(CONFIG_OF_BOARD_SETUP) || defined(CONFIG_OF_BOARD_FIXUP) +static void fix_max6370_watchdog(void *blob) +{ + int off = fdt_node_offset_by_compatible(blob, -1, "maxim,max6370"); + ccsr_gpio_t *pgpio = (void *)(CONFIG_SYS_MPC85xx_GPIO_ADDR); + u32 gpioval = in_be32(&pgpio->gpdat); + + /* + * Delete watchdog max6370 node in load_default mode (detected by + * GPIO7 - LOAD_DEFAULT_N) because CPLD in load_default mode ignores + * watchdog reset signal. CPLD in load_default mode does not reset + * board when watchdog triggers reset signal. + */ + if (!(gpioval & BIT(31-7)) && off >= 0) + fdt_del_node(blob, off); +} +#endif + #ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup(void *blob, struct bd_info *bd) { @@ -393,6 +411,8 @@ int ft_board_setup(void *blob, struct bd_info *bd) sizeof("okay"), 0); #endif + fix_max6370_watchdog(blob); + #if defined(CONFIG_HAS_FSL_DR_USB) fsl_fdt_fixup_dr_usb(blob, bd); #endif @@ -444,3 +464,11 @@ int ft_board_setup(void *blob, struct bd_info *bd) return 0; } #endif + +#ifdef CONFIG_OF_BOARD_FIXUP +int board_fix_fdt(void *blob) +{ + fix_max6370_watchdog(blob); + return 0; +} +#endif