From patchwork Wed Jan 10 14:23:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 186914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp825229dyi; Wed, 10 Jan 2024 06:25:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHLqvbr4ihjRIGx/8hQ98Qqio8941Axke/5Ai7gnfM0ydHH33459zmXUhQYBLyqVYAzml4 X-Received: by 2002:a05:6402:14d8:b0:557:153e:58cb with SMTP id f24-20020a05640214d800b00557153e58cbmr141343edx.16.1704896750683; Wed, 10 Jan 2024 06:25:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704896750; cv=none; d=google.com; s=arc-20160816; b=kBs+w7dSfIvsEXMHlAwi6Ltl6o/Q0hrLE138nZDHUxd4pkGDRXZOLN/nfRGWpy4QqB Hc1qI+dkEZ5Te+gRYN+NtbbxeerHa2pkK//vtIw/agLQxytIVBeKEmS2WFR2gUXQQ6oU oYhOWpfDAyayQK5H05713suPjft1Jv1euiJH0vJR7ymcaUxlyUAqZIlqvL/YXsk+72Hz U1hlhhBYB2HcQUkckpuiXBjvwvSCfHto2MVQqwhr0lI1itCY7+YQu7WxZefp4iaj3k3I 0H9CjQfAChzfIcoJVBztGob9F1GulWqVy3C25F04RZKDayLA1lUyFsBDsvUBXjAMqto4 6T5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Ie3OLWAf5ErheW64ectsfAG+UkqYuQ6pqp4ua1nMxYM=; fh=Hlf8HbBbieZppuVUlIK1f2w4DWLut2NumHgP1UNnThA=; b=PF4DpmkMlVwJTGZNPTt55v+Yk/ipPtheIzqNYmC/dgg+JFbyxH1wy4Z80QXFwrAJIY gXA90zvKsYWQvuvZ8IotrBlA69w6tUsPWB98l+b+LMkx/+XN6+rXU77U+qITZMyOc1TQ Xir6+epuxQXJPvFSPk8AzsR4Z5WxAuT4v5j5wFtbITLE8f55vCOA8Zy664K7zpQswQ+T jyJ6WY5m1u3SqtpAbrG+lGgXIJTPLW/l45UmgQL4oXcc1FTUL2sg1t+9MyCtlI04JMcY 1vOiB98S3X/4kS3I/a/SeI30GPQLPq1YVU3/wP7TIWf7lcERV0Enp1fGYSTmVJCt5YDs HdVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=qXH1T33+; spf=pass (google.com: domain of linux-kernel+bounces-22352-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22352-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id da12-20020a056402176c00b00554767dcb7bsi1808628edb.534.2024.01.10.06.25.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 06:25:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22352-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=qXH1T33+; spf=pass (google.com: domain of linux-kernel+bounces-22352-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22352-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 51A2D1F29EF0 for ; Wed, 10 Jan 2024 14:25:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C34A4A9AE; Wed, 10 Jan 2024 14:25:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="qXH1T33+" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E2D84B5C3; Wed, 10 Jan 2024 14:25:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704896719; bh=Juv4XBQIsz1piXPzn18UqxM8IeGZ96xkSUVgtLb3tVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qXH1T33+4hmdEE2IzGKyrDOCEZny724FGd7XanHY7s3izb1GhteXMdtM0RG1lYpg+ 5OP0ByQtNMNwcBtTHAA7ekWwqynL0F8YsBQa80gz15Yc0WaT2kCGQgoUMep+IfFeCU zf9vlHnQYUVaz+mIuNvQal2+apLgsEMJCxGQEZSg5isSHy10D4hlVODXAzAMG2Tfhj 3Q1vPHfAHs+mIZEOvekXSn41i35+YfyDyGMfhkzmCpdSqQUgqQkQW1cpZsO++Kgw65 5+RzHQ5YgqgWfYf9bUE5wBCr3XKz2JfA5TqxGH8iLgFg+PUsjgtYaYQ54VrRDlXR6m WLYDZG/yWfmhw== Received: from localhost.localdomain (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 39DB13780BFE; Wed, 10 Jan 2024 14:25:14 +0000 (UTC) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Viresh Kumar , "Rafael J . Wysocki" , AngeloGioacchino Del Regno , Matthias Brugger Cc: kernel@collabora.com, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Conor Dooley , Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v2 1/2] arm64: dts: mediatek: cherry: Describe CPU supplies Date: Wed, 10 Jan 2024 11:23:01 -0300 Message-ID: <20240110142305.755367-2-nfraprado@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240110142305.755367-1-nfraprado@collabora.com> References: <20240110142305.755367-1-nfraprado@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787713815150373987 X-GMAIL-MSGID: 1787713815150373987 Describe in each CPU node the regulator supplying it. Fixes: 260c04d425eb ("arm64: dts: mediatek: cherry: Enable MT6315 regulators on SPMI bus") Signed-off-by: NĂ­colas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno --- Changes in v2: - Moved supplies to CPU nodes - Added fixes tag .../boot/dts/mediatek/mt8195-cherry.dtsi | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi index 3c6079edda19..1f3a6755f155 100644 --- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi @@ -264,6 +264,38 @@ &auxadc { status = "okay"; }; +&cpu0 { + cpu-supply = <&mt6359_vcore_buck_reg>; +}; + +&cpu1 { + cpu-supply = <&mt6359_vcore_buck_reg>; +}; + +&cpu2 { + cpu-supply = <&mt6359_vcore_buck_reg>; +}; + +&cpu3 { + cpu-supply = <&mt6359_vcore_buck_reg>; +}; + +&cpu4 { + cpu-supply = <&mt6315_6_vbuck1>; +}; + +&cpu5 { + cpu-supply = <&mt6315_6_vbuck1>; +}; + +&cpu6 { + cpu-supply = <&mt6315_6_vbuck1>; +}; + +&cpu7 { + cpu-supply = <&mt6315_6_vbuck1>; +}; + &dp_intf0 { status = "okay"; From patchwork Wed Jan 10 14:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 186915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp825390dyi; Wed, 10 Jan 2024 06:26:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFCsobaVsatJEUl+TR7E47RDapjvSMgpG+1RhvYpyY2oc+qa0unf26iJ7qebrp2VWj1l4nJ X-Received: by 2002:a17:903:18f:b0:1d5:73f7:c016 with SMTP id z15-20020a170903018f00b001d573f7c016mr894919plg.109.1704896765118; Wed, 10 Jan 2024 06:26:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704896765; cv=none; d=google.com; s=arc-20160816; b=pxT/rU3uhYWazcCH8eUSrv2VNzE7i5g7OOsjlzHVoDHRBXRaxEydjKpTHobY6+nPmR lfDItUfe2tFfwVo0OXBnXIl1RvRowWunrYlRkOdzu2dlBvAFAhWplkUugqdz/o0pw75D hVgf6wAVZDYwp55BvcQXYSDsp93Xn4ymIOJkEfR7CaVi2eWt62NXtQufoyzHkXzO/csp +aH3bL0vr/fdroIh2pK71Pl6iYMNL0qm49g3xKiTRti+GQYTQSFmiGLtzG820zeLsFFy ZN6ENKiuX1R7fBPNBZEuU6/jraoa1uh22gTMbGN47G8zGdPwrjY+nWfAlEkgEB8oj55x YP9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=p2owic68I20DATGgxJ34JHR73fjNMYd+pcOW+WhXYvs=; fh=Kz22TZrlQB3XjCvYOJZJAfHgkHeRQHzAuy6TVyzWbxg=; b=GwCzzM1OLJGb0vcd5+jBT+Cmjb9NiSAKUSRBth+oleZfeBE0jGivSXHizn2d6tUp3q n0psWMmBDccRxqkjvFU3rwCk3kVilh4kGfG85BgG8mk+EStp2b0eh3Cd/A4IYKNgPLeB X/zXJlqwMElCmGX4TlYirEpW02SreJGhldhErSjy6iHV3C0NaHv64K43qsoE2oXhRy2f 6WyoC+AWk8oGkUwFrxJrQXg5LMzGsuxdTRcCKSiwVsKhO4Xig7R4sDPgrDeVk7Uvr5as eN7Pv0P6vk80uNVC/E5afsloA27u76GN/bA9bBsfmRnKyWiAq4ZDreld4ANLWLA5xVKP bmdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=xk4R8Lo4; spf=pass (google.com: domain of linux-kernel+bounces-22353-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22353-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id x20-20020a170902ea9400b001d4ca2fcc4asi3708713plb.291.2024.01.10.06.26.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 06:26:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22353-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=xk4R8Lo4; spf=pass (google.com: domain of linux-kernel+bounces-22353-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22353-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 6EACD285CD7 for ; Wed, 10 Jan 2024 14:26:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99AB54BAAC; Wed, 10 Jan 2024 14:25:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="xk4R8Lo4" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90A984A9AA; Wed, 10 Jan 2024 14:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1704896724; bh=GruA9Ly7wkFPn1q/+QSDJ+FMjRv9dhzwRyz0dijp/xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xk4R8Lo4pdDJpjNYh1MtD+Fi9asVHGwd6N8WSTyS4n1YXL+rfh8hRstEzqczRMEG8 fU8Uk++gBqW0TPdT57E8MF8Uw5MoBResvXMQMhVzU0TF+uC+3A2ELhP1Dg31GCT6Ht ZDYu469Es+04GxBmXOy7hD/7N03Qu5GnsMv01VeL6xSkqUL+wqBafX4F42UexZ5dSo W8eoUnXV+e21oX3chkWAEQcPwE9yu3Sa9Jam4fArXt4w0YV4TwWmm0aaZy7+yGPUxi ebfNbZE8HAaYqUh1iG4dOowf7YC/SKdSkZ7PUuJ0lixRBfWIu2Tc/XVQ8Ag3HxTdJj DFJKMiAhXOZHw== Received: from localhost.localdomain (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 6EA3C378045F; Wed, 10 Jan 2024 14:25:20 +0000 (UTC) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Viresh Kumar , "Rafael J . Wysocki" , AngeloGioacchino Del Regno , Matthias Brugger Cc: kernel@collabora.com, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , "Hector.Yuan" , Liam Girdwood , Mark Brown , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-pm@vger.kernel.org Subject: [PATCH v2 2/2] cpufreq: mediatek-hw: Wait for CPU supplies before probing Date: Wed, 10 Jan 2024 11:23:02 -0300 Message-ID: <20240110142305.755367-3-nfraprado@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240110142305.755367-1-nfraprado@collabora.com> References: <20240110142305.755367-1-nfraprado@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787713830325534307 X-GMAIL-MSGID: 1787713830325534307 Before proceeding with the probe and enabling frequency scaling for the CPUs, make sure that all supplies feeding the CPUs have probed. This fixes an issue observed on MT8195-Tomato where if the mediatek-cpufreq-hw driver enabled the hardware (by writing to REG_FREQ_ENABLE) before the SPMI controller driver (spmi-mtk-pmif), behind which lies the big CPU supply, probed the platform would hang shortly after with "rcu: INFO: rcu_preempt detected stalls on CPUs/tasks" being printed in the log. Fixes: 4855e26bcf4d ("cpufreq: mediatek-hw: Add support for CPUFREQ HW") Signed-off-by: NĂ­colas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Matthias Brugger --- Changes in v2: - Added this commit drivers/cpufreq/mediatek-cpufreq-hw.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/mediatek-cpufreq-hw.c b/drivers/cpufreq/mediatek-cpufreq-hw.c index d46afb3c0092..a1aa9385980a 100644 --- a/drivers/cpufreq/mediatek-cpufreq-hw.c +++ b/drivers/cpufreq/mediatek-cpufreq-hw.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #define LUT_MAX_ENTRIES 32U @@ -300,7 +301,23 @@ static struct cpufreq_driver cpufreq_mtk_hw_driver = { static int mtk_cpufreq_hw_driver_probe(struct platform_device *pdev) { const void *data; - int ret; + int ret, cpu; + struct device *cpu_dev; + struct regulator *cpu_reg; + + /* Make sure that all CPU supplies are available before proceeding. */ + for_each_possible_cpu(cpu) { + cpu_dev = get_cpu_device(cpu); + if (!cpu_dev) + return dev_err_probe(&pdev->dev, -EPROBE_DEFER, + "Failed to get cpu%d device\n", cpu); + + cpu_reg = devm_regulator_get_optional(cpu_dev, "cpu"); + if (IS_ERR(cpu_reg)) + return dev_err_probe(&pdev->dev, PTR_ERR(cpu_reg), + "CPU%d regulator get failed\n", cpu); + } + data = of_device_get_match_data(&pdev->dev); if (!data)