From patchwork Mon Feb 5 08:49:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1895177 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=Dt9y6G0j; 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=ZASyr7es; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=dsdpW9gh; 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 4TT0Rz5yl1z23g7 for ; Mon, 5 Feb 2024 19:49:35 +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=KzVHoblqyKmV3TMFQNB95I7IR0Px7e8rQ7SrvXGkHyk=; b=Dt9y6G0j6vMX9f RBcmpmZx/eX+CxGG74M9HDkMI+MHXFVWRI+ixvKn+1ADVy3xSbYZ/PI9Ggcgvc1SCUt7fWMzNXF+p xlr/TeyUBztqieJfSO3fdU/AZwniv+TVp1kYUt1T69kme3mfjgxKQ2YI7VrmXxxCh8KhiQJGTQDNk eDyyHHgNVsGXKcxyj4rFLokGfVw0IJ2o1l/TsZmi2kKgT0dBOgyHRRanGIjKJwWuK4NtZfsn7Qypz GRWX1o+7uPlY+37jlkaAiQ3IffH03iEdWBgrERDD+lR3bqbYX82K+5pHZ0TjoqaUhafd0+UwGoRB4 rtiXKILznQqms2KFLdWQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rWufR-00000002UFC-1amL; Mon, 05 Feb 2024 08:49:29 +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-00000002U7n-1jvm for opensbi@lists.infradead.org; Mon, 05 Feb 2024 08:49:24 +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=Imk/nC1QLhg4oP/xebCpXuBf+37v8OriidyOrcVloJM=; b=ZASyr7estlIFJA70B2PWG3+XPNF9G6fpAaOOed2szpP25YtOpcwEEYg7Q2FN91tXrKTdI+ 9mJmOJpKIpb8cBCuCPtSmANf3/LQ56Q22AQu0+XuEyJFXpXs4adqa8Sv8znC+KNBYgW5Yp J3hBmdFXovPw5H4UPduoEVhHfrZsM/rFvEjQ9ntRz1/MmVlRUVUebJezeD5CBhok3YBLG8 6/Bi/hgLz66D3bMBNlvDxrjEtO7IF0pVOjbC8S3oMLQS1uJ0Er3vq1aYSdcs6S8zDJiE1t wjeibVyM253uM1zUIWXq5pjvTxGUCp8x0LQB30l7D5uTTzWVXZwJdzCk6ujMfw== 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=Imk/nC1QLhg4oP/xebCpXuBf+37v8OriidyOrcVloJM=; b=dsdpW9ghcsMI5mlC+Ntsx8QAgZRPULG+O91VZ8AliSyT/bfLtXPsxUhFb4kf/yB3ZueZex ZYbfnMoWfi9ZdNBg== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v4 6/7] platform: starfive: return error if needed devices are not present Date: Mon, 5 Feb 2024 09:49:01 +0100 Message-Id: <6cf247a45ca69412337ee7ff163c530263d5d8ed.1707122766.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-20240205_004916_689853_1F708488 X-CRM114-Status: UNSURE ( 7.94 ) 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 b0b1e35..6990425 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -243,6 +243,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"); @@ -251,6 +253,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) {