From patchwork Mon Feb 5 08:49:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1895175 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=ZJeZ3tb7; 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=vircfyvV; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=OaT1G9wd; 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 4TT0S06vRBz23hK for ; Mon, 5 Feb 2024 19:49:36 +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=l55Fpn8SNBsKkrA3njM8mcFgsQnpp6En0WIvNVK5RUw=; b=ZJeZ3tb7ZFfo9S ORAm+GtN77hlmtp49QwuIwEPQGSTg+vx6HwPBguVlw5XKvGIRYmB4xZ4Hr5/5dCt8nhZGkcSSPyNj 6k5Xi/9YW0xXwGku+NlnYp5OWwKy/5y1yYWPm5IntTogNW47nPZRiXxdgOVHIWGU6txNiTVAFbBxC xMD+QRwwGksTH5780HP0Sf9Gp8OFE7452puDdcWAp4L41GTZNQ/fYHh6yGUuylKxbrObm9JgZa+h8 AP72W1x5fs9bSDPrLMvSaoaPP5FtZmTHdD+I/mlkLsulCYjHQ3/kpU6EKfTCs4zvtstq8RR7pNyNM TTPI0qH5JLWSVhaE8fbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWufS-00000002UG9-2DaX; Mon, 05 Feb 2024 08:49:30 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWufE-00000002U7y-3Daf for opensbi@lists.infradead.org; Mon, 05 Feb 2024 08:49:28 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707122952; 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=JW6PH8OB9JQgF5j8x3rfrsQghcJdT3L6Lo9d+zPd3yU=; b=vircfyvVDTp8lFAEuZTh/zkhKRuAYvsDD3xuax6KFy2bJ5JfgD1sPpwimreS78P8r3wl4Q TpUixPVxQQO7c8FiKgoAfsE7rGaC6s2XVGZwDcLQqyLmsHMtvAzj+f3Yv4FtC9iX8dg9N+ 9vclAy43wuQx0ScxJcQUFZborilQfSBC2Vp3f8BN7wK9hdefgAZwUFht1pt8N9pZdHcjnr e1dvCoY8mGnWxSJUu901FcIZerjXq3BSxP04H7wLTYgiIb28QWWsrYYJUNK/PytOrCvlN2 K/rY/1+BX3tO+O2oh8q7zJHVgFaseIkfELLy0kcuWJBliA1Lps+eMuGWVbKo7g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707122952; 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=JW6PH8OB9JQgF5j8x3rfrsQghcJdT3L6Lo9d+zPd3yU=; b=OaT1G9wdebXxkTfGbi1OoXkuLTrIQpmGElQzBaWxP3P5AH16xD5e/rZJLUHdwtsHCFH9sX wuKk07EzuaqT9ACQ== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v4 7/7] platform: starfive: call starfive_jh7110_inst_init() in pm_reset_init() Date: Mon, 5 Feb 2024 09:49:02 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240205_004917_391317_10A7652A X-CRM114-Status: GOOD ( 11.04 ) 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;