From patchwork Wed Jan 31 13:09:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1893493 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=hvMMpitJ; 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=Jv0tOncy; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=LpG6rEuw; 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 4TQ2ST3TXlz23g7 for ; Thu, 1 Feb 2024 00:09:45 +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=ZGy4XijmoiaoIRGpKkZ2qf5xpLgWiLXpWfED+RNw/nU=; b=hvMMpitJUPih43 pAsiVklWQhjZvV//B7C7/AG56krxQWPdmUJL14XO8ldcPsnDjYOTFok7+x+JWujjWqHEn2CDEDVF7 UmgT3YLOFKVYHLyritKM0gA+RI6l58Cwxh1/JDXNIUXG40qFO80RUO/JVaXLM1lni9JIewznp4DGL mdFy7TcRdjS57RpakmQx5EVoKvmpB4rLb+8nNy5Tb2jPOuKuV1HldJBxM1q7thEOHLdOcB67hykcU 6Qxw4DinSsnFrzN0v4w6l5Ya/NQFz3/uXYw8mESQeJOc1iQqxpoZX6PnCVQTPCoIXpH3AagB1mOpr nWiOyx3+j7aWsftwSwMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVALS-00000003XbG-35m3; Wed, 31 Jan 2024 13:09:38 +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 1rVALE-00000003XS9-1brD for opensbi@lists.infradead.org; Wed, 31 Jan 2024 13:09:35 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706706561; 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=3daOGjOJHNMS3EieDvlvEd4HgViuIptdN7Oi+1mtSZo=; b=Jv0tOncyWobW89bHmrdUaA3GK1q7Rs51xBrIItFxFQHUtxnNuGKEYu0hK3/Q71giunTbj2 293MBtwZAaFzlV5jFhhB5AfcM6evle9GwZBMRrV091NoqJI/Qh7d4Z2QDJVi+BcXfE8Y4Q SHCnDDwQB0OJqxKwQ+ZQ8US5qLyCWeEvr9dw3nzLT/iKmbI41gICYqu4gds5CtX3AwWZ4U 8djibZ5nBEJwcCUiljoF6bnt2NOeMYpvgpbQe4SWcP6CSgHdPYznwV+O+SnYdlWxL3YUJ+ NUgZn8LVMYGMLBbxtVmte/18GI2JdD1kcK39ClzjioODrYGGsLumQR3NBUPxPA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706706561; 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=3daOGjOJHNMS3EieDvlvEd4HgViuIptdN7Oi+1mtSZo=; b=LpG6rEuwGc/jb+ZMio0gA5EQGGuwvwfoCQisU23HMJCdLo9/YCUCg6MMUEfg8xezEBhG+4 z5O1tAhfb0AYnqCg== To: opensbi@lists.infradead.org Cc: Nam Cao Subject: [PATCH 1/5] platform: starfive: remove redundant compatibility check in pmic_ops Date: Wed, 31 Jan 2024 14:09:03 +0100 Message-Id: <9e1ba85be2617f7f8d18c08bba7fcdd8e746b6e5.1706705649.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-20240131_050924_650941_FCFA92F2 X-CRM114-Status: UNSURE ( 9.03 ) 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 dcd6306..72969e4 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 Wed Jan 31 13:09:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1893491 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=q4rtv8W6; 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=uVHDZaro; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=OkElSvCG; 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 4TQ2ST6wBnz23h1 for ; Thu, 1 Feb 2024 00:09:45 +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=olnvaM0P/R+ohEkfcmGhK+65YHDlz8bCXxeclWxO9ys=; b=q4rtv8W6u+sFO9 JW/T9wk7R+aoFDmX5V97bA24F7hkWrJwtoTK8ycpbtnz6Cd3We04rxI9zND9e02iESfXSPDS9qQ1Y rrEEHyMu8RjiS0IEKQ0KsZCBj2AQkmZ1uIgRx859s6Eu3KTyaBT8smAKNL2PenQOL7RZdfLSotSbT h/EwlqV6w/AAnu3HdjQ+XbCA4+Hp8y/yhpr1vBXElcSBBENIim66qKankfIBXf6y3ii3u2/F4lF73 nj0XDwMA4wsiBcFtQXHT5vANH4LCXDu4Fx12Xei7yHa+IuK17wFKfScuFusM4aukfvYk1LcBtE2R0 ++G6gG0aFBgfXh60HcFw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVALR-00000003Xaa-2tkp; Wed, 31 Jan 2024 13:09:37 +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 1rVALE-00000003XSB-1bmN for opensbi@lists.infradead.org; Wed, 31 Jan 2024 13:09:35 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706706561; 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=zUVvY0yxE/3exQTnsiF6MLIM4ME1WvgN39pw3TFRaS0=; b=uVHDZaroUZfcU5uu8SVAWVIoD7yPcJYBIWWiGIbgKINvNexh9LGQTG46bvrkZgBJ//MXi0 iEEaJth3zQBp8SArMAfczBeoI2Gyfi4B6CYQvWPG9+B4nGA9RAbCM0HV1Ie/R/7jEVxfi6 qCfCLoOlnMDxOvJ1LQ/p4u7myTRROo1i7vaOw7jUG4w5bRmUXZmAV2uK4Oj96sT7XtFgjI fWRQZAJRYqUn4iMyew9dN51VGaVE+fYtUt6JmmEM0hGnyxdlzCeeDNce68yyeH/IcvpK0i SczWehakSjzFaLHdQ4X9o7b0mLcksjIJy5LTLVkS+QENc3K2XG19SlIlu4g+0Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706706561; 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=zUVvY0yxE/3exQTnsiF6MLIM4ME1WvgN39pw3TFRaS0=; b=OkElSvCGtUpyb07rfy4UuPInGxDXAhDs1oYegUNOmvLXnpJ6NMMp0tU2PPb6VD1uMtFW0W srimDNzJtSQwoRAg== To: opensbi@lists.infradead.org Cc: Nam Cao Subject: [PATCH 2/5] platform: starfive: rename "stf,axp15060-regulator" -> "x-powers,axp15060" Date: Wed, 31 Jan 2024 14:09:04 +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-20240131_050924_663075_7664E8AF X-CRM114-Status: GOOD ( 11.14 ) 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 --- Actually "x-powers,axp15060" does not exist in U-Boot at the moment. But it is being added: https://lore.kernel.org/u-boot/47fd2b2225f52a2d5c3a91494ef7b9036e944199.1706517351.git.namcao@linutronix.de/ 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 72969e4..9f5261b 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -227,7 +227,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 Wed Jan 31 13:09:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1893492 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=OIM+Ncx3; 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=skYQalUc; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=256Xu+DQ; 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 4TQ2SS627jz23gV for ; Thu, 1 Feb 2024 00:09:43 +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=PgQhxieao9HSKwzX6v9P94XL7Am2cROPOjOUtqfwyR0=; b=OIM+Ncx34qOxmr wgMw2uR1VGzcrnwMsltKRyBLSMMZ0hVbyUYjzKMl8On2FWVn/fl2KHaZ7TE1797bhwFG4D50X3Aix UwmUh54YEnlBJs80L6+jy8hH/1l7dZcG2MMeA+A0HyvgvvTfUMrqMXiwb1xk0LYDTdCFYapYdiOq1 2sPL/kJ11CZQGkoYbSBky0ihUNQWYrZj+iOZCSDUraz/JZ98np4t0dc4fcwfyIOgQKbGr/isu4V6/ n1AFgeCLxNvsVvqD0f7nchBkxOZifcIwNJsNi4JlUDuWc5NZvTzkSkoAopKputoU2TnpC90cOyI7g pIc2CrZFsSUvpmEsdRAQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVALM-00000003XXD-2Hug; Wed, 31 Jan 2024 13:09:32 +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 1rVALE-00000003XSE-1cFq for opensbi@lists.infradead.org; Wed, 31 Jan 2024 13:09:28 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706706561; 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=JI6rEyIbW8HoYw+0rKB9Wwzr591z9m+YjXijoUGB0sA=; b=skYQalUchs4JCCusv+HoI7lSSFcV2/18cOFxHu4IupRUT4CIPgk6XHo+r6RLjIzO3RQ5an tpy8hB4eB8UbXuWp1J8nLv0DOYWbeNKzcBnyXuRPP7ZKyJX1s/k3Ryg3OMPh4mMXtOaUNB o1xMKMBDgcpfnKJaZ1e4PpXX0bb72EaWvIC20otzoL8FfZCUQIcntaSYZoJB1MuuxdK8XF 07tZWNrR57/f8PtDXAEV37ljAbvl1TKb587TEo929CwHTUw3XfpQ08vlRcnupwbzNqsrRO XukQliwHC5s0u1WyoVNwJbXr62XF6ulP7CINlGCK7BqPYRxn0vEd3Ckf1LSd0g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706706561; 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=JI6rEyIbW8HoYw+0rKB9Wwzr591z9m+YjXijoUGB0sA=; b=256Xu+DQYuJx7QRS5t0HP5wkHWih2lJx7cd/100RVGs6xvv5swbSQvpF18PrdFqXBKAU9m TbIcEGHnEpsO+zCQ== To: opensbi@lists.infradead.org Cc: Nam Cao Subject: [PATCH 3/5] platform: starfive: drop "compatible" from struct pmic Date: Wed, 31 Jan 2024 14:09:05 +0100 Message-Id: <0abbfca26af666f06268003c40ecc2069b5fcecf.1706705649.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-20240131_050924_629126_0139C60F X-CRM114-Status: UNSURE ( 7.20 ) 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 9f5261b..cb8c48d 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 { @@ -208,7 +207,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 Wed Jan 31 13:09:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1893494 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=tieJ8O2y; 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=GqeKiv4j; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=7+IjCaG6; 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 4TQ2SV43wPz23h2 for ; Thu, 1 Feb 2024 00:09:46 +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=I76KHygFy8CdBEX0ePHRj5SiVINsMuBlYgsH+T11R7g=; b=tieJ8O2yZHGmQD uHkNGXHPh1KTQBLYS+0e8yFumh8RWOPkZQ/AGkqgxQXJ6Nn/6CZ96TVHxjeZcK8xXqxrRvPCcpF1y FSDhtlXevmAJvCFsQPTZJJRChOZORZs0yP4TUMr4Oq1KzcJpRJazCOvDvn4gBcJ8hlUVSSeSP6hV5 OUyUCVFWlyyEMLMrp4ZzJh6aqr/rwim5/vgV3Q+YJWDZmj+hCVqoJB5nxiuf/3oJSRot+xAEVg5Yq YwY9J3yjfDJT5HyzfmqkVoMPH6zilOB2gSQ3Gdj4NKqPpLGoEDFDeEQP1A9vbs/gFzEen7BkR/pN6 L99IZXosPue/BqqyS5MQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVALT-00000003Xbr-2vjg; Wed, 31 Jan 2024 13:09:39 +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 1rVALE-00000003XSF-1bXI for opensbi@lists.infradead.org; Wed, 31 Jan 2024 13:09:36 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706706561; 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=+T6Sby0CaY0ybTdR7iH5TbyP/MPPXe4gl4sSRnBi8+Y=; b=GqeKiv4j0p98sj5itlrYWKz2m4h7Pa1zZX/RbJhMMoN1IH9hNQEOYFU4INajeknXxD7xSV dKksb9zKQ0vUmvszAKB4Nbbb/ggPrOkYMRn7xFL+DvjTMAdIH75IbDWPuzO4Z5IqYc+8G+ ORneSA9L9b0XBtIrII7qsXRCKOWy71eGz1XsqqEDxtvqs5ypmkS53BjURGAHMZ95z1riE8 w/tJm3nAEhckY3Fd+Dcg6e7FFlvSeWch+Jxhe5A6kbPebPoXg2i+vIaKK90KcPMA06Va07 5g/0uWXw/rxNN+EGqiekMEVfmJhYlPHJnCZykmankT60c8Gb5SLuJMWzavJfaQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706706561; 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=+T6Sby0CaY0ybTdR7iH5TbyP/MPPXe4gl4sSRnBi8+Y=; b=7+IjCaG6s0N5DVcABUdTDWWmdNTt6zqtQJKQJWfrsGzto4CtLwbe87rWXhccaruGgGxuLq aCLVt2ek7hSikrBQ== To: opensbi@lists.infradead.org Cc: Nam Cao Subject: [PATCH 4/5] platform: starfive: return error if needed devices are not present Date: Wed, 31 Jan 2024 14:09:06 +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-20240131_050924_633500_3BDF7762 X-CRM114-Status: UNSURE ( 8.17 ) 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 cb8c48d..f9942d3 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -246,6 +246,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-clkgen"); @@ -254,6 +256,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 Wed Jan 31 13:09:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nam Cao X-Patchwork-Id: 1893495 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=10g8BL0j; 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=W6d3RHvJ; dkim=fail reason="signature verification failed" header.d=linutronix.de header.i=@linutronix.de header.a=ed25519-sha256 header.s=2020e header.b=Uht5yoXw; 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 4TQ2SW4SKJz23h3 for ; Thu, 1 Feb 2024 00:09:47 +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=F9jU4NKuHrLbBBzD7E5hhQ6C+WlwjLWwq9014zPTIR8=; b=10g8BL0jcsyW+U dCTbopXh31yO3cxZfv3XTAQdG9GlvHYYdC1cpCMsZ+jn2hcv9UQMc5XIK4Vb3HFX6kacpbNhDhxPJ kGXxm9KJKcSYJEOQ7tYEAQwty8FuAVPeDL7n8wN55A2D5DVCdSyShiAUB3YR0VVZMpqnr9vQ0Q/AF 0YVd1feO2fgCbzpWWWqXaDAj95qmXP1bv2o3kYLDZUoeQVSTObRRH5T6q7zAZQh8VfcZN0P7eCgIK BW/BEFIjI4Ja/BI1ngjfLNJvW3t77aHpEW8skOy6PlOvixphTxduulInuOHQjg4KzsMqSfs9zqHVo 1qIrPqJkpcFLBMmnqRqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVALU-00000003Xch-2wr8; Wed, 31 Jan 2024 13:09:40 +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 1rVALJ-00000003XVC-1Fx6 for opensbi@lists.infradead.org; Wed, 31 Jan 2024 13:09:39 +0000 From: Nam Cao DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706706562; 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=AnT1yx28e/4a98YwFYONeRTWCfcn+VzGyuoDUQ490Oc=; b=W6d3RHvJAnq9hLSRG7ykpKHJAyEgBn2m7k+K8u89U/KesM82yxTOTgEvCy7qmV9gI27F2e 5b2CGs1r6A3UDzgxcEQ2k9F5dslOCCfFrCsk8PY+4iNY1FlDBCoWWq762+E9YLVPxor9Qq 4TTIbYEb21Mlhdk4Qeobe2N7/1oLI65GtV8cOJOWlsOsBhWaOjg9XJoGyA8Qqt7Qw95ZPZ jdmV47+b7wMM+73j2/w+JsZuTlgr37Sw6Oz3J7fdelyzDJNB4vffykabIfwpr5CWNSRxbt 7PzFnCEVNFQkrU8+RE/hGKOUgpNiAOnWBQCvRGCG4+JSWljFg3hVGGLuPdrx4g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706706562; 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=AnT1yx28e/4a98YwFYONeRTWCfcn+VzGyuoDUQ490Oc=; b=Uht5yoXw8Dh56/d5fec0SHHLsBe2N2pqrkfxmGZtCNQ9gVfk5CN6KtQCztxIhTEOeqngnV ZXhCCJwj+Y6j93Bw== To: opensbi@lists.infradead.org Cc: Nam Cao Subject: [PATCH 5/5] platform: starfive: call starfive_jh7110_inst_init() in pm_reset_init() Date: Wed, 31 Jan 2024 14:09:07 +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-20240131_050929_545115_C4CC7DF4 X-CRM114-Status: GOOD ( 11.07 ) 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 f9942d3..520bc8a 100644 --- a/platform/generic/starfive/jh7110.c +++ b/platform/generic/starfive/jh7110.c @@ -194,6 +194,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) { @@ -219,6 +221,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;