From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8070CC00144 for ; Mon, 1 Aug 2022 13:32:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B181B84488; Mon, 1 Aug 2022 15:32:11 +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="N1ENXdug"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4AF72844DE; Mon, 1 Aug 2022 15:32:10 +0200 (CEST) Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) (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 E65FE8415B for ; Mon, 1 Aug 2022 15:32:07 +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 sin.source.kernel.org (Postfix) with ESMTPS id A1B46CE16B3; Mon, 1 Aug 2022 13:32:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7D5CC43470; Mon, 1 Aug 2022 13:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659360722; bh=/G0+LhbqAn5iWcO4DxuHrlmkurcWrIBabPeSPARUhDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N1ENXdugxPhHbj3H8g4xvp8Fc4Yv4vRbaQTz4YbZ9G4PaOwk95TussZvqdve1g9Ed EuXTGQ/XzXnTsQ9td/4vEXSi5lotobgdBW7+uezZUaJCweW3WxB1CB9b2j9GUbeqvz qJys+6CUrO6R5xBPIkuoH7CZSDSnaL21mOUJUAPHfjAj9I4OcZZvKSMq7+TUbnUvWW Nw8lgpfwHWJZapcBrdFzl241qXjy5tkWHwVfnNw23penU68cGG4TSVl1iqdfp5qzd2 E6Izw2GvBtr6fbwQnBTbZUYuzPt+tig1j60QTDVIsyetef2T/Bt/ClujkOz7LHmpl8 KwIQT3TyqXdSQ== Received: by pali.im (Postfix) id 3EB44CE4; Mon, 1 Aug 2022 15:32:00 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: "Peng Fan (OSS)" Cc: Tom Rini , u-boot@lists.denx.de Subject: [PATCH v2 3/4] board: freescale: p1_p2_rdb_pc: Avoid usage of CPLD's system reset register Date: Mon, 1 Aug 2022 15:31:45 +0200 Message-Id: <20220801133146.11481-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220801133146.11481-1-pali@kernel.org> References: <20220501122314.32626-1-pali@kernel.org> <20220801133146.11481-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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's system reset register is buggy and requires workaround in U-Boot. So use this kind of board reset only when there is no other reset option. Introduce a new board_reset_last() callback which is last-stage board-specific reset and implement CPLD's system reset in this new board_reset_last() callback instead of board_reset() callback. Fixes: 20fb58fc5a1c ("board: freescale: p1_p2_rdb_pc: Implement board_reset()") Signed-off-by: Pali Rohár --- arch/powerpc/cpu/mpc85xx/cpu.c | 4 ++++ board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c index 226a26ba320a..c63c17286811 100644 --- a/arch/powerpc/cpu/mpc85xx/cpu.c +++ b/arch/powerpc/cpu/mpc85xx/cpu.c @@ -44,6 +44,7 @@ __board_reset(void) /* Do nothing */ } void board_reset(void) __attribute__((weak, alias("__board_reset"))); +void board_reset_last(void) __attribute__((weak, alias("__board_reset"))); int checkcpu (void) { @@ -328,6 +329,9 @@ int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) /* Next try asserting HRESET_REQ */ out_be32(&gur->rstcr, 0x2); udelay(100); + + /* Attempt last-stage board-specific reset */ + board_reset_last(); #endif return 1; 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 16224752adb1..4bcb05bed9b8 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 @@ -83,7 +83,7 @@ struct cpld_data { #define CPLD_FXS_LED 0x0F #define CPLD_SYS_RST 0x00 -void board_reset(void) +void board_reset_last(void) { struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE); out_8(&cpld_data->system_rst, 1); -- 2.20.1