From patchwork Fri Feb 2 13:43:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1894549 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=c9+E1Wpl; 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=o6MdpGo9; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=wLVHCYCH; 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 4TRH7F4v0Mz23g7 for ; Sat, 3 Feb 2024 00:44:09 +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=rgyEDDMAN2rWRjRfh7k2R+PDxwyUZq8dWQR+TltZvBk=; b=c9+E1WplQaNsGn xRcSRovD2X9otRQeQBegNe0ZjrDV9lFM6ryT6UQ2Ou/M4TuTOhvVgUdp5cKria4mBMdcNm1H8S8lF W3hzz5NMi4NKVaU1uWoiP6jRIV8mH00DBkxUGRS4oFGmuX2zVQfqJ+EjTePOYQDTrtNrGZ+SdsUjv Gj3t6xreCFSDWgKS3mbfyEoocfd6nk87JcCJFrlFWVIptDvSjS9lHmM2mRkh7PViqZ49qaEbBgFAA AP3PtbrFzYdf84gnsmcMu+Go4E9HrhewLa+67XaonCAmFx2OuO9Oett82VNijXsqaVLBVatQNUbnm qzkBfjmDCRlO4xTJlwig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVtpn-0000000BduN-2NnF; Fri, 02 Feb 2024 13:43:59 +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 1rVtpU-0000000Bdp9-0kqo for opensbi@lists.infradead.org; Fri, 02 Feb 2024 13:43:57 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706881414; 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=907NVLOi8Lq5cEjQa6Fx1ad8vwwTZ1ODc7T3J4HOzDU=; b=o6MdpGo9D/CqYrAhs0KOrf3eYIQXMzmjClm4O/l4OQNe2ohd2V0s/fcO5XZXsac+zV0xhz aVmQsKbwRvOjz+xHC8dUN5IF91sXrFXx/Xz0I/HFemw1ciR33YxIywjQeV16RzCB+rUcXW rp8nQFBvjANh6oIHCNMm7VlOItAWf81JBAw1hn8aWsABlXuWdCP/i7IBOeB/CQINAd31hn NV1hrdhX2qOqL0kOkwtdxrCi5h+YyFs7Zvyj0lcDff4G8l3K2Ru9MHGn9776i/hWfsBmIR yx6wvcCB3A6DAjDZq9uCoAGwN0gxCJg6zm65IICMJRgDUDqJk3bOHTVevMrz+Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706881414; 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=907NVLOi8Lq5cEjQa6Fx1ad8vwwTZ1ODc7T3J4HOzDU=; b=wLVHCYCH2mfwfVLR2wl71lo09zJc47sxzCSpvyCDPuGlvj4k/NlWLelC7NrDxivv6yDFUb +3PliW9EK/7kNXBw== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v3 1/7] platform: starfive: correct system clock device tree node Date: Fri, 2 Feb 2024 14:43:22 +0100 Message-Id: <063d675dcf59e79892091b0ef085a6a2ca4f6bee.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_054342_047728_7F3CBF8F X-CRM114-Status: UNSURE ( 9.70 ) 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 Starfive names the system clock device tree node "starfive,jh7110-clkgen" in all their git repositories. However, a different name is used in upstream U-Boot (and also Linux): "starfive,jh7110-syscrg". Since OpenSBI gets the device tree from U-Boot, this inconsistency leads the problem that OpenSBI doesn't know the system clock device exists. Correct this name to keep the consistency. Signed-off-by: Nam Cao --- platform/generic/starfive/jh7110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c index dcd6306..4b22175 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -252,7 +252,7 @@ static int starfive_jh7110_inst_init(void *fdt) jh7110_inst.pmu_reg_base = addr; } - noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-clkgen"); + noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-syscrg"); if (-1 < noff) { rc = fdt_get_node_addr_size(fdt, noff, 0, &addr, NULL); if (rc) From patchwork Fri Feb 2 13:43:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1894550 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=DdtMzq28; 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=VXfq+Rfk; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=BjsX2eyK; 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 4TRH7F5T2Wz23gx for ; Sat, 3 Feb 2024 00:44:09 +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=sif6hCbHH0AluqfVWdvx7WUBe0Yb33Kao9AOuAT7YTg=; b=DdtMzq28wMvzGL i3lurN/fvZHb0Sx7DOiqfScuVbu8uPrZi/zYFPSzkS8hSBggfBDG3VCpO0Hhl2N+oerJA7p6Lw46j p3RDHiXcnMSiH/yt4MCrzRds6GvIs/w7Pf4A55kHSRQxZacivNzNV2oXQhLWMTmAjt2zWb3V5yWV1 +7JYGcNMqFoGRM8TFd+09BGQUHgAxvWkyvPhSm2TJ9w5M3Adbwnq/kE4SLMZONmh2Fb3dsLmqko80 gx6v4p6tn6XHdFPOHIJFPAaf8FnTCEdOMnuQ3fe2AfV3fWMksxP6VsyVN3zOoVKzUEoXza6SSuqAE /yimYSMdTDrUKR8IrRVw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVtpo-0000000Bdum-2kJy; Fri, 02 Feb 2024 13:44:00 +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 1rVtpU-0000000BdpA-0fTh for opensbi@lists.infradead.org; Fri, 02 Feb 2024 13:43:58 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706881414; 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=jFGjokFD901GS3OfOOvV9JF6VaY4EiNBgPX36Q6l3uc=; b=VXfq+Rfk8r0Hd23q+2Kbsgyuyp8LI6hVmWoRsJwgztaXOsz+MFWttIMdjTE3AZPAOw7AH4 dC1haUC6EJDgRP9tw9muU7tmXKzT171RzmMokuDziEb4tll4kNJrR7x+XMnnmqwC4uWwo3 v5h/JuVXNcjOe3qwHN4PrMlrfACkgwMMFnT0Pm9g5VrXc1igRVHZa6ESPvDdW3TZ72Mt/Y hSnfA+EUm1bNNevwdJubSc8qq7w0rGEKyT9pWjP/vpkaLq90PJxeOpc88LxSD1S4m2VKWT 73ygTJj2cB286D1weF2lna7vcNQaJ/NvtF1smOFmArqf81bk1iNx6hE2dZEUwQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706881414; 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=jFGjokFD901GS3OfOOvV9JF6VaY4EiNBgPX36Q6l3uc=; b=BjsX2eyKEuY3iXVTo/Rw5xJ1L236tAsaBRiKk+8Uu5yuZIDaUXcIpPWZMm4ywW7KRwLpLL puxGlqN8pgvnl1AQ== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v3 2/7] platform: starfive: get I2C offset address from clocks property Date: Fri, 2 Feb 2024 14:43:23 +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-20240202_054342_056167_0601BA4C X-CRM114-Status: GOOD ( 13.99 ) 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 current code gets the I2C offset address using the device tree node name: it get the I2C device index from the 4th character in the node name (for example, "i2c5" -> i2c device 5). However, the device tree node's name in U-Boot is actually just "i2c" without the number, so the current code cannot be used with the device tree from U-Boot. Get the I2C offset address from the "clocks" property instead. Signed-off-by: Nam Cao Reviewed-by: Minda Chen --- platform/generic/starfive/jh7110.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c index 4b22175..846b068 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -29,7 +29,7 @@ struct pmic { struct jh7110 { u64 pmu_reg_base; u64 clk_reg_base; - u32 i2c_index; + u32 i2c_clk_offset; }; static struct pmic pmic_inst; @@ -163,10 +163,7 @@ static void pmic_i2c_clk_enable(void) unsigned long clock_base; unsigned int val; - clock_base = jh7110_inst.clk_reg_base + - I2C_APB_CLK_OFFSET + - (jh7110_inst.i2c_index << 2); - + clock_base = jh7110_inst.clk_reg_base + jh7110_inst.i2c_clk_offset; val = readl((void *)clock_base); if (!val) @@ -241,7 +238,8 @@ static struct fdt_reset fdt_reset_pmic = { static int starfive_jh7110_inst_init(void *fdt) { int noff, rc = 0; - const char *name; + const fdt32_t *val; + int len; u64 addr; noff = fdt_node_offset_by_compatible(fdt, -1, "starfive,jh7110-pmu"); @@ -261,9 +259,12 @@ static int starfive_jh7110_inst_init(void *fdt) } if (pmic_inst.adapter) { - name = fdt_get_name(fdt, pmic_inst.adapter->id, NULL); - if (!sbi_strncmp(name, "i2c", 3)) - jh7110_inst.i2c_index = name[3] - '0'; + val = fdt_getprop(fdt, pmic_inst.adapter->id, "clocks", &len); + /* The clocks property looks like this: clocks = <&syscrg JH7110_SYSCLK_I2C5_APB>; + * So check that the length is 8 bytes, and get the offset from the second value + */ + if (val && len == 8) + jh7110_inst.i2c_clk_offset = fdt32_to_cpu(val[1]) << 2; else rc = SBI_EINVAL; } From patchwork Fri Feb 2 13:43:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1894547 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=QQrgfVLg; 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=Ehhp76ya; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=xKLnxiX+; 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 4TRH7B1TlQz23gx for ; Sat, 3 Feb 2024 00:44:04 +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=aYPuqZzQem/9EqYqpLD5wqaJFh5VZGpKWAwjoOw9uUY=; b=QQrgfVLgVA3mRm c6pOO6hjmlPH1L4/1aRB3BkUPtsDxVhWy+KkPXn8VsrMbeYIRBlQfT3lwmJ3B+xOb7OT3sEJ3o5u/ 2lLnC+SGVF8idoVu+hrX+0bHqeOXdbZr6ZyFBFRtNXCO1ZOmQVjfnqhimVcRdFDFDlsAj+93s8JJK IjAg3YLyzCHGh0qb9UddFZ5+pAyVLYYtPjJ3cBIeddfcWEfQTAThRIMTiVeOg2JCdzRVSWWG39sPI oTm7tqdMfvIGJ4+QQ11IhiZLjgdRSxr7Ga8z5CaOgDopbUbTaauKZXkchKnsmfRPCfjwm3QfsrRgN 2UVganoGsuyS/onmiWAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVtpg-0000000BdsR-3f5T; Fri, 02 Feb 2024 13:43:53 +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 1rVtpU-0000000Bdp4-0oWO for opensbi@lists.infradead.org; Fri, 02 Feb 2024 13:43:46 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706881414; 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=aeCrJGi/PH1fgm4jn/9O4XWd70Pho9IOFgGvTkacZ5U=; b=Ehhp76yaZ+RRaY7n9M7hLMuqrKEQhxoym6GtmGu8wsBPEQ/AvphdNEr7ltagGAHBKHyuSy W6yZ4NV/uTEpAktpolOKFbs78njcH/GQbzSZSHsorvdf2t8avHxe6BGH/olOn9H9FCX2Vc wg4tOBJUccayq7spmkr8/k1As+ipjFhs0Av40oraTcGIN1S/gotX4OSvpULlezCDXZzf66 Zslfcdlf6qzCLS8PoIar6YuksMDX1IXDncFLluTrHItBAc8ejSyj6ri/g2VmJgQhhsYzw6 ImrnbBkPjbfJUs2h7Ke4GsGYS5SLF4dRtNq2QkfXV9FKgAnl6CKX+V2YBgf73Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706881414; 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=aeCrJGi/PH1fgm4jn/9O4XWd70Pho9IOFgGvTkacZ5U=; b=xKLnxiX+9NFA92mb8fpwqp+9KETycV0eFwqy8BCsU3AdWN6iql8oTAS/u/efLhVlTVjpcI S9+dCH2G5inYE+BQ== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v3 3/7] platform: starfive: remove redundant compatibility check in pmic_ops Date: Fri, 2 Feb 2024 14:43:24 +0100 Message-Id: <16ada695eb73656550b0474b6640dc0d42f1f1fe.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_054342_042496_53743327 X-CRM114-Status: UNSURE ( 9.18 ) 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 pmic_ops() is only called if a compatible device is found in device tree. It is redundant for this function to check the compability again. Remove this check. Signed-off-by: Nam Cao --- platform/generic/starfive/jh7110.c | 36 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c index 846b068..d3647c2 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -134,28 +134,26 @@ static void pmic_ops(struct pmic *pmic, int type) if (ret) return; - if (!sbi_strcmp("stf,axp15060-regulator", pmic->compatible)) { - ret = i2c_adapter_reg_read(pmic->adapter, pmic->dev_addr, - AXP15060_POWER_REG, &val); - - if (ret) { - sbi_printf("%s: cannot read pmic power register\n", - __func__); - return; - } + ret = i2c_adapter_reg_read(pmic->adapter, pmic->dev_addr, + AXP15060_POWER_REG, &val); + + if (ret) { + sbi_printf("%s: cannot read pmic power register\n", + __func__); + return; + } + val |= AXP15060_POWER_OFF_BIT; + if (type == SBI_SRST_RESET_TYPE_SHUTDOWN) val |= AXP15060_POWER_OFF_BIT; - if (type == SBI_SRST_RESET_TYPE_SHUTDOWN) - val |= AXP15060_POWER_OFF_BIT; - else - val |= AXP15060_RESET_BIT; + else + val |= AXP15060_RESET_BIT; - ret = i2c_adapter_reg_write(pmic->adapter, pmic->dev_addr, - AXP15060_POWER_REG, val); - if (ret) - sbi_printf("%s: cannot write pmic power register\n", - __func__); - } + ret = i2c_adapter_reg_write(pmic->adapter, pmic->dev_addr, + AXP15060_POWER_REG, val); + if (ret) + sbi_printf("%s: cannot write pmic power register\n", + __func__); } static void pmic_i2c_clk_enable(void) From patchwork Fri Feb 2 13:43:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1894551 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=Yg2W+8FE; 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=Auh/oI1v; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=BQGbWsAQ; 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 4TRH7H5Nw0z23g7 for ; Sat, 3 Feb 2024 00:44:11 +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=xU29/PTd9ZC3thVT3LQK7WAGctfmoTVSSjrt7Axc8vs=; b=Yg2W+8FEnfsVfH kUDyiBbesvmIHgoxJ/rGh4Z/SLvoBjHmo9IG9zOZ9EeJIiPFcqITXk9RgtJp3nY4aNZLS5c0yOqoE smdXzOrpuqf1ElmLtrr1gHgFSjjzieyYfCIqaPH/VPdJo1qoHPTFsRuPl2xD/fI9fKBwJ6Rh9Hdr4 zQQQTRZaQBcybPqFh8qcMXy1dMEwujFGXJHYeRcqMJnkLTA4AHxX2wEUaHKjLTs3D7KO8Ev6+6tH5 Dx/AbqSjCmzgUaBIWhDucmEwMz9WAwV5cxa6BlAJIE2n0St5HDoo0wphDqAhoOF3Wqit49AQvqWr/ YEE0KX9lVoNZGzAbcTnw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVtpp-0000000BdwK-4BhH; Fri, 02 Feb 2024 13:44:02 +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 1rVtpU-0000000Bdp5-0aL9 for opensbi@lists.infradead.org; Fri, 02 Feb 2024 13:43:58 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706881414; 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=27QFTgyRBPvCy82y1RJ4V855J0aiw6jHzd1DNwsndRE=; b=Auh/oI1vHVNuwaJWLEb+Ws3fqqKjLV9AyGE4sLurzyZmsMNO+9hmVkzS/gqgpPtVq+AYWP 55yrc1W3lCGs31rIABmpVp8cUKV0NHCzFADV5PZ/UXTYHMNtDmzKIHX6tiwZhoBhXnLTN2 eERIZEGX/OyitO9RdT2PxP8Yd26NMoOPkxI5hE9k9LRBGqMoAMEenev7QPj9lxF5Rr6OcD P7utooXfL1URlHwBzSvw8MxqkzzbGs0yn0nhNabJRcubGorzp0305E9yWyKMH3abOAAIuw D2UyG32vW9M9Wf/hQv4BnuLyFmKDDGZGeIyjaOsgbtwMjqi8suGE1AgDDOiseg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706881414; 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=27QFTgyRBPvCy82y1RJ4V855J0aiw6jHzd1DNwsndRE=; b=BQGbWsAQI8Tg+wQZli1SlYCcoU42C6ccV1JrYuKvOUB+WjB2NQPo6oS08muSanBwyHDWLh iLKuJWGPdSPl/hBA== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v3 4/7] platform: starfive: rename "stf,axp15060-regulator" -> "x-powers,axp15060" Date: Fri, 2 Feb 2024 14:43:25 +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-20240202_054342_042855_C9C9A434 X-CRM114-Status: GOOD ( 11.37 ) 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 OpenSBI uses the device tree compatible string "stf,axp15060-regulator" for the regulator node. However, the string used by U-Boot (and Linux) is actually "x-powers,axp15060". As OpenSBI gets the device tree from U-Boot, this causes the regulator device to be undetected, and OpenSBI does not use this device to perform board reset/shutdown. Rename this device tree compatible string to match U-Boot (and Linux). Signed-off-by: Nam Cao --- platform/generic/starfive/jh7110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c index d3647c2..385e09c 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -224,7 +224,7 @@ static int pm_reset_init(void *fdt, int nodeoff, } static const struct fdt_match pm_reset_match[] = { - { .compatible = "stf,axp15060-regulator", .data = (void *)true }, + { .compatible = "x-powers,axp15060", .data = (void *)true }, { }, }; From patchwork Fri Feb 2 13:43:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1894552 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=OG8c1eFp; 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=wOW+vxu/; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=bkFlwRD/; 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 4TRH7H6h6xz23gx for ; Sat, 3 Feb 2024 00:44:11 +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=At64OAR9HqHdUkAKiUVORlr8q1zutVGgQc7UFHpPz84=; b=OG8c1eFpZULlpp RB0BpLkXCxVn7wndGgsbC5hbkTI3dlGTsvQhPox51KUOqBjzqRZ1Q1efobSpd2hZnI/4bYR3kwcR9 KOc2aTz1ztvu1kPmDBj1Kw1zKxiBkoYAm2XHkQSTk3vLYAFYxg+nZgwxo6+dClET9VknROeLKKR7h RUumcRZQVa0N2hL3De3ze6ZphOz3v56gBpFrNwg16ruVUHHZfa75gI3PY8bo3tVKnZy7iFs82e+CG ixKIJW3Ou5am51CeXyC35Mw3bOTgQaZnYG5Kj2lDj9Ji6y/LWbZHsX5UojDinlsJXY4lXZahKSX/y tgJ+TDvgAmDJYsxFeHrw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVtpr-0000000Bdwy-0IeR; Fri, 02 Feb 2024 13:44:03 +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 1rVtpb-0000000BdrC-1fel for opensbi@lists.infradead.org; Fri, 02 Feb 2024 13:43:58 +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=r7h7cM369Sjwo6yjt3+1VA9wKpvdPOhdQaFEHaqIYkE=; b=wOW+vxu/wLFm8piherx2kcYntj06ZkXsomttuLL9pyWxM8/p7X1kB2CyzQ+O14gNoQBTJD LfBzr3aZiLU5Q+IilyIK2/tucslUAC1nWJ04tFosS3Z3+WXnBCR7CIQes+d/r/WLLgt/FJ kI3B+lceOSuWLs+wFXfYmdxh6qHh+wsB82gQAUr9uHx71FCoTVxzaj08pCGh1WXoVL14Ai b8K+IyO6p+CsplTwKi06ddoSYjlSGJ8G7yamiF+pu2qeZyMDEn2y76gXsfbf74g+NuLuuJ tRIuniGWGkXYUVCtAaNpU4vnFXCcEUf5tZXUDV4N9FQmtTKqe6gGLqTDK2bIWg== 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=r7h7cM369Sjwo6yjt3+1VA9wKpvdPOhdQaFEHaqIYkE=; b=bkFlwRD/QdCZQ2CMm+zElxgZ7SgJm8jEvVJiN/haEvbwYgFgVOK+2eTnJdiqT8e1W49tCu ozxstfR8BgxQTFCw== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v3 5/7] platform: starfive: drop "compatible" from struct pmic Date: Fri, 2 Feb 2024 14:43:26 +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-20240202_054347_744662_DB56B620 X-CRM114-Status: UNSURE ( 7.40 ) 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 The member "compatible" of struct pmic is not used. Delete it. Signed-off-by: Nam Cao --- platform/generic/starfive/jh7110.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform/generic/starfive/jh7110.c b/platform/generic/starfive/jh7110.c index 385e09c..f64e016 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -23,7 +23,6 @@ struct pmic { struct i2c_adapter *adapter; u32 dev_addr; - const char *compatible; }; struct jh7110 { @@ -205,7 +204,6 @@ static int pm_reset_init(void *fdt, int nodeoff, return rc; pmic_inst.dev_addr = addr; - pmic_inst.compatible = match->compatible; i2c_bus = fdt_parent_offset(fdt, nodeoff); if (i2c_bus < 0) 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) { From patchwork Fri Feb 2 13:43:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1894554 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=IyzNCr9r; 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=3rjdhBc/; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=86S8poNS; 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 4TRH7Q0Cl8z23g7 for ; Sat, 3 Feb 2024 00:44:18 +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=HGRcaBM6Is21vJBmFp5JABdY/PoARicKuXav/cMO/Dg=; b=IyzNCr9rsEIvZ+ M0m0YxQAzwPEL/hWoAqC/GLM5o9s8+LHGHWgi1gk34oFCc29igUVeFA8a3c4Xhv3g84pWvSVL3iF5 AJwlhxe7JTky5A2EFiRfRq2814CcxGZ+mvmhrCIgRrWKhh9ABIz63pFu3mawVxOWJlEWaa7nJ0ntp vza3IX4eyc5w+XppAIbXGvQEcwC2Y8wARIh0mif9UKPswuN/0LwUXgBMpw+Vh60sEjiYzdmFl61nw mRfn4n0FPvcfCC5mf8k61gDvh3yoyr7SbG9WxI/f/7O1tWcQA37WxNJdU5wwGS5jWzkGl/j6ODaWV 9ibfhut8ZTBxegtGs6bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVtpz-0000000Be1j-1YM6; Fri, 02 Feb 2024 13:44:11 +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-0000000BdrS-2XUf 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=rQ3JY3c+QU8UIxg6iY/+31MfyLVavX6UODMBSpvt4cA=; b=3rjdhBc/e98m9hJ9hAY5j5c8PVIePrgTBto39AhIgDiDPR9RIW9k2DBKEYKBs0mE5CVWdG PYRldTgUC11eIENHNXJbsWY3Sc93YSmEzLRG5ZZNY544YMyTxXQfw9HGDHbpx75z6lAhIK Z3Ysgi67QGE8p5BsfL7l1yaftitN9B0SpHNtSxYZM6wSOT0AkyBDWUJL7QQ/Vr6I9mrVFR igM6k2oN/Ngtgch+J8xqEuUBf8is4pnSqH/GZgUsoWMknkR0JJbXJod+BOJdxFBhS9jlp1 N9RSvRfTt75bGLThFJ30pS6poa2ZJGNwHf6yT2oyPKyeFNx5TYBxeOM0fEY6/Q== 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=rQ3JY3c+QU8UIxg6iY/+31MfyLVavX6UODMBSpvt4cA=; b=86S8poNSuZCKkRtQ7BdO/PepbAHfZW/mdZof4BG5hAqMYwF6Lhj+r7Jlh8f8wh9BkggDm/ qlpFDUdxji4Cj5DQ== To: opensbi@lists.infradead.org, Cheehong Ang , Wei Liang Lim , minda.chen@starfivetech.com Cc: Nam Cao Subject: [PATCH v3 7/7] platform: starfive: call starfive_jh7110_inst_init() in pm_reset_init() Date: Fri, 2 Feb 2024 14:43:28 +0100 Message-Id: <5e478ee9042b05c53ff4d38a65bd5842591f960d.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_108570_C015C1DC X-CRM114-Status: GOOD ( 11.32 ) 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 --- 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 63baddb..1577cb4 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -191,6 +191,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) { @@ -216,6 +218,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; @@ -279,7 +285,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;