From patchwork Thu Feb 22 08:16:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1902608 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=YHTIIfVJ; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=linutronix.de header.i=@linutronix.de header.a=rsa-sha256 header.s=2020 header.b=BCbQrPpA; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=hkN2VLWG; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TgQwQ6mWvz23cl for ; Thu, 22 Feb 2024 19:16:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=U276nJkElpQqJvxpNLrqYQ0fXlU8hhNbPEzDZ7l0Nv8=; b=YHTIIfVJ4oHRHM HWm5Sb92P40dTb2r8cI01pWrwzLWf6d46BZbQ3I/zPTTzdo+fvvxNfrg+vk3SzZsiMR/p9CzOgRF0 v0FkPV0EjnVsJz3W+lVH4LnR88nxnw8hsrMkZozfs2d7WvNyHxOAuPtuo1PSC82E5NdELaAIoQlSr qnOxp3XNAvUi10Kw5JR9Xk1iPmH6sgZFtTkcxjFsfLZAsi+9oeJz/U716ZWPmFVBJrI9uXSDz9e2u lkAZFR49SxnDP6Jw0hsIZ3TC5YM9yVM4psd9UU9KknHbNVyqyJhROBGqBTc3p24zRuO5GdJRlKyVX LFANaf32WmFNUhULas1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rd4G7-00000003y9P-2FB2; Thu, 22 Feb 2024 08:16:47 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rd4Fv-00000003y1y-1gCr for opensbi@lists.infradead.org; Thu, 22 Feb 2024 08:16:43 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708589786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HDPFnYPMK3QFB/MzVfovgFSIF63OuU03XcagLi20GVU=; b=BCbQrPpAyTLZYu2gh5i6hp77EGKK+yJUzSQMs7BNzYWnyDrWghYR/atvDtSlj9unoO/FP6 niGOpVTRv3rCA8Aed8Z5znj/U4qQaQuKUwLOXEHOqUcsZOZTZq83Ij1PYRpu2x4dfxVwPJ nWjsdVGxiwfq9DU3Gst5UOe53QhFDxLpyUM4bZNKQDWc8A72jrmzFNmwgh3ElLrbpGvU4q TvRrXe3RpZxJpQTnuJ/HruVXyCqvjkgLZYrS/i/Flg2fHklgrZE2Xw1I0UtpgAGE/1FBEO v+JkzFn4DDV5mbYpLr4A8iBM+2hnlTMZUOToont/SklwZyt5VpBzxkBpngd+Dg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708589786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HDPFnYPMK3QFB/MzVfovgFSIF63OuU03XcagLi20GVU=; b=hkN2VLWGZiTFqLmccAQQDjIa7Jbqqq2mvdWg7X3KcXsDOY3Z1eBcpNUklyAHp5tBHuMFSL ImKjapfUskAlq8Ag== To: opensbi@lists.infradead.org, cheehong.ang@starfivetech.com, weiliang.lim@starfivetech.com, minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v5 6/6] platform: starfive: call starfive_jh7110_inst_init() in pm_reset_init() Date: Thu, 22 Feb 2024 09:16:19 +0100 Message-Id: <20240222081619.275869-7-namcao@linutronix.de> In-Reply-To: <20240222081619.275869-1-namcao@linutronix.de> References: <20240222081619.275869-1-namcao@linutronix.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240222_001635_646286_C4DBBE98 X-CRM114-Status: GOOD ( 10.91 ) X-Spam-Note: SpamAssassin invocation failed X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The function starfive_jh7110_inst_init() initialize some power management unit address and clock addresses, needed for the reset driver. It doesn't do anything else, and also the reset driver doesn't work without calling this function. Thus, it does not make much sense that this function is independent from pm_reset_init(). Delete the separate call to starfive_jh7110_inst_init(), and instead just call this function inside pm_reset_init(). Doing this also fixes another problem: if starfive_jh7110_inst_init() returns an error code, it gets propagated to final_init() and OpenSBI hangs. This hang is not necessary, because failures within starfive_jh7110_inst_init() only mean OpenSBI cannot perform reboot or shutdown, but the system can still function normally. Signed-off-by: Nam Cao Tested-by: Minda Chen --- platform/generic/starfive/jh7110.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c index 6990425..c25e645 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -190,6 +190,8 @@ static struct sbi_system_reset_device pm_reset = { .system_reset = pm_system_reset }; +static int starfive_jh7110_inst_init(void *fdt); + static int pm_reset_init(void *fdt, int nodeoff, const struct fdt_match *match) { @@ -215,6 +217,10 @@ static int pm_reset_init(void *fdt, int nodeoff, pmic_inst.adapter = adapter; + rc = starfive_jh7110_inst_init(fdt); + if (rc) + return rc; + sbi_system_reset_add_device(&pm_reset); return 0; @@ -278,7 +284,6 @@ static int starfive_jh7110_final_init(bool cold_boot, if (cold_boot) { fdt_reset_driver_init(fdt, &fdt_reset_pmic); - return starfive_jh7110_inst_init(fdt); } return 0;