From patchwork Thu Aug 4 13:11:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 12936387 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56EE0C19F2A for ; Thu, 4 Aug 2022 13:15:34 +0000 (UTC) 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: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:In-Reply-To:References: List-Owner; bh=tP4VQXJCCYgk6lPs2sLXxjQb5dNpHjbnfPN/G7mgk1E=; b=tyBftG5hB0jgfB yytu3C7GEGDYN7g9tUxCxPqs1mGBZdD0J+gh9awCbWgUW5+jNCNnGRbuEwn+0h5heje1z/hnHxYRT fe/cevIer90QTz1zPn3qRh6U6LvnerHfn8YLiw/5Kwn78zAppflYv6CWCXe5fizqjJpUQMoqN9718 nxReKw6nPbL8VRWHy+/avlhrq5flreqz9KS1kDfoMkE7b8TkPlrmAzMUvY9G+RsNGNsXeHe4NYBjm TAKhSVFWpgqZSwnGOWXwS7AslBgbEMlsY5O2o9ZaIriBwRTcNepXyNcZLIf2NnO2F1xhBjSFi0uRX em8CYMf2XqG9a9UfhkpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJafx-006DAU-PD; Thu, 04 Aug 2022 13:14:10 +0000 Received: from phobos.denx.de ([2a01:238:438b:c500:173d:9f52:ddab:ee01]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oJadj-006BkC-Ss for linux-arm-kernel@lists.infradead.org; Thu, 04 Aug 2022 13:11:55 +0000 Received: from tr.lan (ip-86-49-12-201.bb.vodafone.cz [86.49.12.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id BE22D80469; Thu, 4 Aug 2022 15:11:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1659618709; bh=l+GIq5hXnzk6noaRG/tCVKRkchR1To4lqryGsgVMIs8=; h=From:To:Cc:Subject:Date:From; b=qDMKlMYIoGgBYHwESpNpZXQi+4CzZB8d27TeHb1Kk3GD4+G9f/vM2GZ476xnFruh/ SMHuTIu4fsNBWLIom4kdJ1Kq8oWFvdQk6AIcx8frFQ6bdiVjWS0kut3hxzE+0OrZyb o4TWGP7q7DaQI+QsUyIqd5Boi8UjIjXZsgqEocCXEQJYhCitffHIOcRXwZCUGMA4im LuElGLlkU3tf3ON4yldam0XMYy+ZHQapkpfzbzT5SqQko4ugY3MGH+QDJwNv7aWoaN qvoE9F/ZXFQG1ctYCLmy2l+nLPyr7MZE49qtSbj05sWyLm33xnynxWLiTxDcRV3ewD PFsU/36H0/kDQ== From: Marek Vasut To: linux-arm-kernel@lists.infradead.org Cc: Marek Vasut , Fabio Estevam , NXP Linux Team , Peng Fan , Shawn Guo Subject: [RFC][PATCH] ARM: dts: mx6sx: Handle shared VDD_ARM/VDD_SOC rail Date: Thu, 4 Aug 2022 15:11:33 +0200 Message-Id: <20220804131133.12746-1-marex@denx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220804_061152_351741_C7180A3F X-CRM114-Status: GOOD ( 18.20 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org It seems that powering off the CPU core results in some stability bug in case both the VDD_ARM and VDD_SOC power rails share the same supply. Further investigation shows that the system hangs on WFI instruction, which triggers pdn_req in GPC, which in turn powers down CPU core. However, it turns out that not powering down the CPU core on pdn_req is sufficient to always wake the system from WFI. This would indicate that powering down the CPU core leads to some power leakage between VDD_ARM and VDD_SOC, since VDD_ARM is off and VDD_SOC is still on. This would in turn destabilize the CPU core and lead to the hang. Further details at https://community.nxp.com/thread/504898 Signed-off-by: Marek Vasut --- Cc: Fabio Estevam Cc: NXP Linux Team Cc: Peng Fan Cc: Shawn Guo To: linux-arm-kernel@lists.infradead.org --- arch/arm/mach-imx/gpc.c | 55 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-imx/gpc.c b/arch/arm/mach-imx/gpc.c index ebc4339b8be48..87bba68c237c8 100644 --- a/arch/arm/mach-imx/gpc.c +++ b/arch/arm/mach-imx/gpc.c @@ -28,6 +28,7 @@ #define GPC_MAX_IRQS (IMR_NUM * 32) static void __iomem *gpc_base; +static bool shared_arm_soc_vdd_rail; static u32 gpc_wake_irqs[IMR_NUM]; static u32 gpc_saved_imrs[IMR_NUM]; @@ -45,7 +46,17 @@ void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw) void imx_gpc_set_arm_power_in_lpm(bool power_off) { - writel_relaxed(power_off, gpc_base + GPC_PGC_CPU_PDN); + /* + * FIXME: Do not power off the CPU core on pdn_req , as it + * seems that on MX6SX, there is some sort of voltage leak + * between the VDD_ARM and VDD_SOC through the CPU core in + * case both are supplied from the same voltage rail. + * + * If VDD_ARM is off, then the leaking current from VDD_SOC + * destabilizes the CPU core and it might fail to wake up. + */ + if (!shared_arm_soc_vdd_rail) + writel_relaxed(power_off, gpc_base + GPC_PGC_CPU_PDN); } void imx_gpc_set_l2_mem_power_in_lpm(bool power_off) @@ -224,6 +235,46 @@ static const struct irq_domain_ops imx_gpc_domain_ops = { .free = irq_domain_free_irqs_common, }; +static void __init imx_gpc_check_shared_arm_soc_vdd_rail(void) +{ + struct device_node *np_vdd_arm, *np_vdd_soc, *np_vin_arm, *np_vin_soc; + struct device_node *cpus, *np; + static int once; + + if (once++) + return; + + cpus = of_find_node_by_path("/cpus"); + if (!cpus) + return; + + for_each_child_of_node(cpus, np) { + np_vdd_arm = of_parse_phandle(np, "arm-supply", 0); + if (!np_vdd_arm) + continue; + + np_vin_arm = of_parse_phandle(np_vdd_arm, "vin-supply", 0); + if (!np_vin_arm) + continue; + + np_vdd_soc = of_parse_phandle(np, "soc-supply", 0); + if (!np_vdd_soc) + continue; + + np_vin_soc = of_parse_phandle(np_vdd_soc, "vin-supply", 0); + if (!np_vin_soc) + continue; + + if (np_vin_arm != np_vin_soc) + continue; + + /* VDD_ARM and VDD_SOC are connected to the same supply */ + shared_arm_soc_vdd_rail = true; + pr_err("VDD_ARM/VDD_SOC share the same supply, cannot disable CPU core power in idle!\n"); + return; + } +} + static int __init imx_gpc_init(struct device_node *node, struct device_node *parent) { @@ -245,6 +296,8 @@ static int __init imx_gpc_init(struct device_node *node, if (WARN_ON(!gpc_base)) return -ENOMEM; + imx_gpc_check_shared_arm_soc_vdd_rail(); + domain = irq_domain_add_hierarchy(parent_domain, 0, GPC_MAX_IRQS, node, &imx_gpc_domain_ops, NULL);