From patchwork Fri Feb 2 13:43:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1894553 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=epaoJzaZ; 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=n9bgRCL9; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=N2/8cuRx; 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 4TRH7N4JCQz23g7 for ; Sat, 3 Feb 2024 00:44:16 +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=3rVsql3s6mpnhu6Q64albWQfUhs/DktG6UHqUVgGpRs=; b=epaoJzaZUv+tK6 UGS4HNm619t15AdZGHMartKIJVRTPTmyOPJPwG3h088Hm8VqGcWmtqcic6/ysYaTLuWvMFuM5qayO T9gMV3IwajtLUPI93fdqDNcGruPoQeOPLaQ4iaVvdCcy+vouNa/h36sNU2zsDcOkXTwkI+Yhn1If7 kmrOE2dRH2ETaXQIosEHr6vkGXpHKY1q+Bi1wJ5pzrSP1hNTRGs/ZeAxy4sN6grlQmzledgzjgf+G 7Fsh1x1OR1QWdi7k6SdFbd8n+QhURhf+2BHZUmpC7y4VC5OlqdYbqNMyXwsKCSOcFi58ApM1pWeHc J+ACUJhbnENzOcStd/4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVtpx-0000000Be0O-3QZt; Fri, 02 Feb 2024 13:44:09 +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 1rVtpd-0000000BdrB-2XYj for opensbi@lists.infradead.org; Fri, 02 Feb 2024 13:44:08 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706881415; 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=dC2D1LzU199p07fOlrUdkfS/tgcGvTzaEJ7ULFcd5vw=; b=n9bgRCL9sJq305Qxd3LUDfqwu3pxnDWIeguA+7tnL12g+BGzDAlMbfcR99/KmEk3BkyhLM 7NzkwJQAyTc7ekovEGICShVTVKktkKz0M+a57ZlNyijDNnknC0pKfq1ajyVC/imelr2x6d MRnHbOkquSNmWDtzd8tTdEL5qkxLFqKxNk30lbhk83Y2EtYCyL2vHMBZ8y48l6q6MvxZJP b0CKXfQKsJwayM8Jjpvfn/iZ8V7b2iz4AUqOX+lGeagZIqoPwWn0shi49tgUM2wyP2qPlq 0L87XJNjuj0LtixIhvErLC5DOtyqVZS7rYc5lI+36x+bA8D3O5po2Yv8h/XHuA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706881415; 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=dC2D1LzU199p07fOlrUdkfS/tgcGvTzaEJ7ULFcd5vw=; b=N2/8cuRxDfIc+tfb3CeguLKLMRle63m16TqQkBlrZYavLXmd4PFiqm5Bp67BfWelgVQax9 6errTGIsLNzVm2Bg== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v3 6/7] platform: starfive: return error if needed devices are not present Date: Fri, 2 Feb 2024 14:43:27 +0100 Message-Id: <4f1504484813d64f8e8190e0174c4f5802cbbd6d.1706880734.git.namcao@linutronix.de> In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_054351_037489_F1F3C386 X-CRM114-Status: UNSURE ( 8.29 ) X-CRM114-Notice: Please train this message. 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 Jh7110's reset driver needs power management device and clock controller device to work. Currently, the driver proceed anyway without these devices, and invalid addresses (jh7110_inst.pmu_reg_base and jh7110_inst.clk_reg_base) are used during reboot, which causes unpredictable broken behaviors. If these devices are not present, return -SBI_ENODEV. Signed-off-by: Nam Cao --- platform/generic/starfive/jh7110.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c index f64e016..63baddb 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -244,6 +244,8 @@ static int starfive_jh7110_inst_init(void *fdt) if (rc) goto err; jh7110_inst.pmu_reg_base = addr; + } else { + return -SBI_ENODEV; } noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-syscrg"); @@ -252,6 +254,8 @@ static int starfive_jh7110_inst_init(void *fdt) if (rc) goto err; jh7110_inst.clk_reg_base = addr; + } else { + return -SBI_ENODEV; } if (pmic_inst.adapter) {