From patchwork Thu Dec 12 07:03:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904751 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 DBDF9E7717F for ; Thu, 12 Dec 2024 07:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=iUHH+eJbCiMl2j2oN03m6Q26pa8Tho3uZPMyt8IDCBg=; b=Jzkd7BS14rITWN1HyezqJ3PHbx adMr1NIOdsqK+FPZEA8hoNhZhGgCwpjEAIf5xzZ4hvy+JRdvjqIBQfksZOfef7RBhC3GrgwC6Ok9R dRe/Lg2QbNdDMmJUdh9lObwoEK0KNMqUOsVg8jT+ilnvwjOfAOC2+Wa5JrWmpCTbZQ9NJMxO7Ofz9 8PzD7Nr4gG8bAyOnPTKPVZ1s35j5I3AQpTeTbYoYo7yIbLdp0Jr+8ZOZA7/Um77mad839kuO4vLFY AO1S+h0XUBBHFnkF7huQX/BBLr2o2Ya1Woug+R8XMPxFMPgnW4Cpilrcc4LNGsGQfgCTqGiIwqEVa XhSjFkYQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLdHe-0000000H703-33kE; Thu, 12 Dec 2024 07:06:50 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLdFb-0000000H6SB-3Yps for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 07:04:44 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-724d23df764so218672b3a.1 for ; Wed, 11 Dec 2024 23:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987083; x=1734591883; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iUHH+eJbCiMl2j2oN03m6Q26pa8Tho3uZPMyt8IDCBg=; b=W/pP2YpcBF1ItwIPcBjZlV2xl2L6XkAL1xusIrDSNR3aNR683QowbFBodaRQb/R7xb cnZIrN3P8qyeGKT6pVFv7wq29WjWxrvdVEpAus3pd9AnBGQ1oCtihH5VjoFhogz2Norz DbJ1/umPjbIQ59B+qiKR5ypIsTE6kq/sVixn/bSZwC/9WFKA5k3Ir3xea5KSMpvQVOha 6RzZ9uMIb+BaCTV1ZGgWOIxbMypI5d4j1O8ip0iUm6tBF9NpQMLLBVL3/Q/zraJoVloC LaZg7btk94g8+OjBtw24ndWmpgZjtQP/vxFfCK9Iwntt1U/12FXvKYqBoD6MnvA3udtI ku3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987083; x=1734591883; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iUHH+eJbCiMl2j2oN03m6Q26pa8Tho3uZPMyt8IDCBg=; b=TJJ9uAyl938EJIQ3msqhnGVSHQcgvnWCZE040cZfl+H3xBPIe83i2SAoCb+F98LAEV LZrbAyxb5oVCtXcxajnYuZCNcPbjHEa1crVxJ7otVKgJ8Oyebzs65PDDtE2AXiqa3yB9 CyQMfnOVJhqgcjGXf+H7CGupLAMyZla/mJkxh+bLvCYkfi14Dtv/eNrLcHmo22pRpJTm cePw806K3+abFditYbSzqnYLxOjLKEtnkXPMwLGVEnt2ezBKbCQji6Dz041Op9Yslr80 ZAlChVCapcweIyLsEW5cURrXgC/rTulbFKtNuT2glz1CMt2vk7r7xU4pdiurxxog/SKZ 41ZA== X-Forwarded-Encrypted: i=1; AJvYcCWanbuuakv1O3g6c5hGjmwbr8QzgfVoHFcniaoHgNzrTvtKclb/ZqP7SX3YC4uzRgYRW1eJVlRVX/6765i2raMQ@lists.infradead.org X-Gm-Message-State: AOJu0YxHw1IGE0KA4dpzJ5u4uAD59/POnK4eBmBRabolrvdbeQ7wYhrf SfD9RA8lSOmoDWZmlHw3rzieZybHdqVPYz3rMusakYBaBlM+rM3XxojmWe9N X-Gm-Gg: ASbGncu1ULkhMMYCcOTuTbdOuT7p2iadCqVgv4fsoKp7AMzxPCWT691zhACB8KCW1EG /FHfaccY46OaGfSjHYVqB7r3bMrq7yOemi75ZcMz1qt1qpowsXPJ14zzdmdHphIiGAsAF/AMh+w s5AA7Z5f7Z70YRM71kM1zJndN5xtrYebiUlWpYIyDMCdE3WCQGq+L7N0UVilLktdDQCZflRAonJ OyPDsALFPDDWp3w33rNob7Yc65kxSu7W8Ut2GOcd5lzwCvmYiT2IsRrlTuphijmbvZh8F8c X-Google-Smtp-Source: AGHT+IGtN/4wOi7l9DheFzbvnmhfw8j2aOU+HkhGN2Yp/3Yo0IKmhXbzVUwwdn6N9+FFWNTL8LZBlw== X-Received: by 2002:a05:6a00:464f:b0:728:e196:b5b5 with SMTP id d2e1a72fcca58-728faad31f3mr3605642b3a.20.1733987082812; Wed, 11 Dec 2024 23:04:42 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:42 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 1/7] dt-bindings: cpufreq: apple,cluster-cpufreq: Add A7-A11, T2 compatibles Date: Thu, 12 Dec 2024 15:03:00 +0800 Message-ID: <20241212070344.3858-2-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_230443_879494_28499D12 X-CRM114-Status: GOOD ( 10.69 ) 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 Add compatibles for Apple A7-A11, T2 SoCs. Apple A7, A8, A8X gets the per-SoC compatible and the A7 "apple,s5l8960x-cluster-cpufreq" compatible. Apple A9, A9X, A10, A10X, T2, A11 gets the per-SoC compatible, M1 "apple,t8103-cluster-cpufreq" compatible, then the "apple,cluster-cpufreq" fallback compatible. Signed-off-by: Nick Chan Acked-by: Krzysztof Kozlowski --- .../bindings/cpufreq/apple,cluster-cpufreq.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml b/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml index 76cb9726660e..896276b8c6bb 100644 --- a/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml +++ b/Documentation/devicetree/bindings/cpufreq/apple,cluster-cpufreq.yaml @@ -24,9 +24,17 @@ properties: - apple,t8112-cluster-cpufreq - const: apple,cluster-cpufreq - items: - - const: apple,t6000-cluster-cpufreq + - enum: + - apple,s8000-cluster-cpufreq + - apple,t8010-cluster-cpufreq + - apple,t8015-cluster-cpufreq + - apple,t6000-cluster-cpufreq - const: apple,t8103-cluster-cpufreq - const: apple,cluster-cpufreq + - items: + - const: apple,t7000-cluster-cpufreq + - const: apple,s5l8960x-cluster-cpufreq + - const: apple,s5l8960x-cluster-cpufreq reg: maxItems: 1 From patchwork Thu Dec 12 07:03:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904752 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 AB9FDE77180 for ; Thu, 12 Dec 2024 07:08:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M0xMWNhFbRFrvmQCRSO20OEZKspqHRsl+17s4y7Ifdg=; b=KgN904jVAQEOrw1ns/kyFEsE6/ 6/5iia7M8ncdOMb2erynt4yjzKzBz+cHQUVt3GMdU709zgoRViLNR0HbmkareqVT9xYdkaUYlmbNE HB0RfncBnG/X1WdVj7EbIOCa3TuxOFBUOaKnmyzlUZrksuuLWawToq5QOCHpJqzyG4KCsSNUM0l7T 68E4TmO3DALtZG+AA4xJ75kcgj+taGqS1aBU+QOHtlUa63dXzCtAa1oBCdFp3Gb92Kb/5hAPTcmIG o4fgDKp7eEnTOBTUdDw7FC0b0SVX9uC0m/OnB7ATMoRRnypvKIlc3i4knrqEVVbNEP9IF8hZYI8Qm mqojXioQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLdIg-0000000H7DS-1Nvb; Thu, 12 Dec 2024 07:07:54 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLdFg-0000000H6Se-0MRi for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 07:04:49 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-725ecc42d43so244234b3a.3 for ; Wed, 11 Dec 2024 23:04:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987087; x=1734591887; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M0xMWNhFbRFrvmQCRSO20OEZKspqHRsl+17s4y7Ifdg=; b=XpjPwALJxAdjCJIgihrLMOPYD4yu2q0tFhuM6DHQMT8/z8E4K8wslqvxvhOnAxvswp jU1Aloi6qLFwXgqyUjKt1djIJR7wWefBZAJwl4iZR2fur6Xg0PXhKYTw4jsgGKONr4V6 Loof0ZURj1a7OKcUu+Z3PxApK4tsjVCKxFV1V8LKjxfcKSwp1TAim2DhCE/UAr9ThmDn tXPKmtOIx2oJAVM3aAI45tSZ6pzvieSTISFbdjeFiKsPE8BUySfQZ/uDxbNofhezo935 XHg2u71Lcu47ASAeKMZGRaOBS2aNfiv+eUgO7e/J6JfjKs5y4s2Vo3pFU8PIRDC4WCkA fCMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987087; x=1734591887; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M0xMWNhFbRFrvmQCRSO20OEZKspqHRsl+17s4y7Ifdg=; b=mmRrcztCsdMmHPDz0Quuw018cAPIhfVvQvY6dFtDzX+gGqC35effC6tjffN/KApk3W mo4ePZESDoy7PPOZ2HNHexkJEyPOMG8FMCRlME2JxO3XRAwoG6KG8LttE7YYIbFLxxzo jjFjFokly85kn4AeNVP0ZCK7p2Z9OvNuevMRYTvHxjXOSVTWSAJF0umFTHzn6Eec2+6R od8dOyI5EXIbot73LEwCXkJ7SIABF4EMZC8RIR0h7ZYqF66fW82RpsAvWbxYqH//N+04 X/FQEQuoH7iQ5uemvOifUIgGvy7qgHYLZldsTDi9uTXZrVoVd2cexVG04pYRUws1pPHg kTZw== X-Forwarded-Encrypted: i=1; AJvYcCXmuxF4Ek6xVFCOTCNIoAdJeqpSgGwpzRqwQaMVz5uoXJdUGAlzCymbHjgJWOeuduTeUiV57KyZ1xP/pySDUtz2@lists.infradead.org X-Gm-Message-State: AOJu0Yxai0Sy5AqmgyuvhOpzh2iMLM4JQRlGIKCjmNFpFXwGtyDabfha Zr5KulR70ZeYI5no3AxKd0SXQIMbk1ZYGmPPW/lapftpolb2Wkz+jWlvkxrU X-Gm-Gg: ASbGncsR02vQF3RCeKN8tcdSTc3IXCJbezXv2tCS4ytHzeDT/J+4adx/6B6XXrIlAGe TNGtkQP00B9tqYVSdc2chRelWuZKNgeC4JTlwqYbXtdP1EadmCofQvaIHjJstRmRxD0LFiplWXo jAhxR5NRX93wqUL8LwwNNZBjFm4eplqj/CUpS/X5lTuvaqO0sx/noIp3JVu0ndbDCAtVTL9v0x3 H2yFdozaB9TGmJvAAibn0cThU+Hzxnc9TE64xJKte9YB8dj6Y0UXHUYhlFgJiqKLSSI80Bq X-Google-Smtp-Source: AGHT+IGvBAQXtMRTleyDW6x3HzSYF2eqnBC5Rmkc6964KlaHxGxL1kuAEnMzaZToFmlebupGFAzwyQ== X-Received: by 2002:a05:6a00:999:b0:727:3cd0:112b with SMTP id d2e1a72fcca58-728fa9e5e39mr3210909b3a.9.1733987087085; Wed, 11 Dec 2024 23:04:47 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:46 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 2/7] cpufreq: apple-soc: Drop setting the PS2 field on M2+ Date: Thu, 12 Dec 2024 15:03:01 +0800 Message-ID: <20241212070344.3858-3-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_230448_115343_46F86722 X-CRM114-Status: GOOD ( 15.46 ) 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 From: Hector Martin Newer device do not use this. It is not known what this field does, but change the behavior to be same as macOS to be safe. Signed-off-by: Hector Martin Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 4dcacab9b4bf..ad6c7b8f290c 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -25,7 +25,7 @@ #define APPLE_DVFS_CMD 0x20 #define APPLE_DVFS_CMD_BUSY BIT(31) #define APPLE_DVFS_CMD_SET BIT(25) -#define APPLE_DVFS_CMD_PS2 GENMASK(16, 12) +#define APPLE_DVFS_CMD_PS2 GENMASK(15, 12) #define APPLE_DVFS_CMD_PS1 GENMASK(4, 0) /* Same timebase as CPU counter (24MHz) */ @@ -55,6 +55,7 @@ #define APPLE_DVFS_TRANSITION_TIMEOUT 100 struct apple_soc_cpufreq_info { + bool has_ps2; u64 max_pstate; u64 cur_pstate_mask; u64 cur_pstate_shift; @@ -69,18 +70,21 @@ struct apple_cpu_priv { static struct cpufreq_driver apple_soc_cpufreq_driver; static const struct apple_soc_cpufreq_info soc_t8103_info = { + .has_ps2 = true, .max_pstate = 15, .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8103, .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103, }; static const struct apple_soc_cpufreq_info soc_t8112_info = { + .has_ps2 = false, .max_pstate = 31, .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8112, .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8112, }; static const struct apple_soc_cpufreq_info soc_default_info = { + .has_ps2 = false, .max_pstate = 15, .cur_pstate_mask = 0, /* fallback */ }; @@ -148,9 +152,12 @@ static int apple_soc_cpufreq_set_target(struct cpufreq_policy *policy, return -EIO; } - reg &= ~(APPLE_DVFS_CMD_PS1 | APPLE_DVFS_CMD_PS2); + reg &= ~APPLE_DVFS_CMD_PS1; reg |= FIELD_PREP(APPLE_DVFS_CMD_PS1, pstate); - reg |= FIELD_PREP(APPLE_DVFS_CMD_PS2, pstate); + if (priv->info->has_ps2) { + reg &= ~APPLE_DVFS_CMD_PS2; + reg |= FIELD_PREP(APPLE_DVFS_CMD_PS2, pstate); + } reg |= APPLE_DVFS_CMD_SET; writeq_relaxed(reg, priv->reg_base + APPLE_DVFS_CMD); From patchwork Thu Dec 12 07:03:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904761 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 A32B5E7717F for ; Thu, 12 Dec 2024 07:09:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F1XYVqROmegnfGFhPLcLWSN8f1mP3yklImJht3PHB8s=; b=S7j7I8jL2tiD768vPaNr8IXksf nQitCGenwprxdqeq5p77qvUaB7zQ86/nJOlPCs9//3spwmTvOPddesdmuFo7rXO3ONWiT7Hmq2XIh vBJZsp935yQs+l0CZz8URBKJlH0DTxUjaYchzAaeZ8lFpCqYMBfzE4kqXfKW2T2Co/2+uSyXzT+fp auZxqpyrleCrSwHip2LdAXsnHl36mz6+R08oAg6lD3JYdqM+Zp+jtX8vVo/ulJrcMeqjlQ01IpdBq OamrmqWePBN3GUqwq4PpUfP1NAhkrjzNLZE0XhSqWL7M6VmsU/YQgxjekN1RK3HA/4FAykIMG0LZU 4K2gc3IQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLdJj-0000000H7QS-0Cx2; Thu, 12 Dec 2024 07:08:59 +0000 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLdFi-0000000H6TK-4BGv for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 07:04:52 +0000 Received: by mail-pg1-x533.google.com with SMTP id 41be03b00d2f7-7fc93152edcso227030a12.0 for ; Wed, 11 Dec 2024 23:04:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987090; x=1734591890; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=F1XYVqROmegnfGFhPLcLWSN8f1mP3yklImJht3PHB8s=; b=T1IrnPeQzuu1FF+S3cTZdmE0z9w5cBJTyLMARW3I1kiSO+k3LkWmdrYffkHl5DZ/Q8 QmbQqC2JpUOniy3Co3XhiJPruAFPo9UJbR7cj83VdWeVru2jFK2El82qkwBxVzmCNPRk SySXo4GAcyl0kh63mIrMNLBbwezlbfCdR1iit2jGAGVOV5GAsiU5IAH1tiTKfpXtU+d8 CZfCnbZSiXhElGE3OVMDQcJnR4a9tGc+52Z2gF5Lar1Y6kHu57vrJWk2c3tfg7/hmaeB hnU3ekcoz/lJ4RwSUPRG5i63YTxbdRlnyYs0xvS4rBoPILKhxEHL9GsHaEGbHM1Ge7C2 FYFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987090; x=1734591890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F1XYVqROmegnfGFhPLcLWSN8f1mP3yklImJht3PHB8s=; b=kMvdSYJVAoee4nahBT5P8rPxVZilb2AvJm4qZx8IkWiZddHcChlmzQanuQotQHwT0z 49DAku5cId50RMvNAG+ApkR5dBibtpECP4iGAc0OZk1mBtIOoN/I27ziZRXdlnpNg0xp l+qih+qXiWoFWzCpFirYcTxPcmUlDc5A2w/QpPZfEup9ZF3CymlL1wrP5vU53oERUej4 hQ410ua+mJH6651ujXoG9MguBbPTJBSxCIxKQ75ms9H2/U1CShrvaieL1gvQdysio9PG rADT+PhOn9sxNvyWLcfGx76gG1F7FzEnEop/a7jCiISi6wMJ/3SxbtQWQQru8hFsONM3 az6w== X-Forwarded-Encrypted: i=1; AJvYcCU8T43iZEuiSPZAhHVivOHCdPj4htPpkgGmjFer/e+qiWqLo20CX6OEdaioTRpgD8gQ2X1bN/edoWj+rmcY/sLL@lists.infradead.org X-Gm-Message-State: AOJu0YwbEe0IccOPcsbgxNeuuMMNVgxvqyrctFbAQYoZ85OIEGmCggro dUkE+Yws7ZPLJa2ynNNRtbUqO1NiRhug67uNWHwbezS1YTLiMIJe X-Gm-Gg: ASbGncsmJeGfW898/XtksTBj/e1ljeMyRfFdaY7JMAFWOZuvjTSvPHKgJmpOn2QztEK kudKqsToXkzazK5eAf5Hk7qHimi1GWyHG1KMILFIpPpZGv00izXqYEb9tDiGGdFAybLlemY4RCl WkGxs2P7hCUFchcgUz7KM652UE9niXtsWXL0dE3cMDbXLQlzcgwZfOjVOh7zEXwX8+IZZPHKkGd M7qCH06Cr+/bQDDEMz0Irp4kwwfElXV+8v1olITIS9LsnCZW0Mv1R4x6Z9vly6ckZXs2yzi X-Google-Smtp-Source: AGHT+IGD5L0XY10ir8ZWn31kZESh8+9pkRmRaTucZ22hPfqRxTf/NOnmFpSI0fmwVeu1XXmMvpKLow== X-Received: by 2002:a05:6a20:d98:b0:1e1:b0e8:11dc with SMTP id adf61e73a8af0-1e1cefbb8b9mr3506448637.21.1733987090125; Wed, 11 Dec 2024 23:04:50 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:49 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 3/7] cpufreq: apple-soc: Allow per-SoC configuration of APPLE_DVFS_CMD_PS1 Date: Thu, 12 Dec 2024 15:03:02 +0800 Message-ID: <20241212070344.3858-4-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_230451_026198_83194024 X-CRM114-Status: GOOD ( 15.92 ) 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 Support for SoC that has a different APPLE_DVFS_CMD_PS1 will be added soon, so modify the driver first to allow it to be configured per-SoC. Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index ad6c7b8f290c..90e34105b50b 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -27,6 +27,7 @@ #define APPLE_DVFS_CMD_SET BIT(25) #define APPLE_DVFS_CMD_PS2 GENMASK(15, 12) #define APPLE_DVFS_CMD_PS1 GENMASK(4, 0) +#define APPLE_DVFS_CMD_PS1_SHIFT 0 /* Same timebase as CPU counter (24MHz) */ #define APPLE_DVFS_LAST_CHG_TIME 0x38 @@ -59,6 +60,8 @@ struct apple_soc_cpufreq_info { u64 max_pstate; u64 cur_pstate_mask; u64 cur_pstate_shift; + u64 ps1_mask; + u64 ps1_shift; }; struct apple_cpu_priv { @@ -74,6 +77,8 @@ static const struct apple_soc_cpufreq_info soc_t8103_info = { .max_pstate = 15, .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8103, .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103, + .ps1_mask = APPLE_DVFS_CMD_PS1, + .ps1_shift = APPLE_DVFS_CMD_PS1_SHIFT, }; static const struct apple_soc_cpufreq_info soc_t8112_info = { @@ -81,12 +86,16 @@ static const struct apple_soc_cpufreq_info soc_t8112_info = { .max_pstate = 31, .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_T8112, .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8112, + .ps1_mask = APPLE_DVFS_CMD_PS1, + .ps1_shift = APPLE_DVFS_CMD_PS1_SHIFT, }; static const struct apple_soc_cpufreq_info soc_default_info = { .has_ps2 = false, .max_pstate = 15, .cur_pstate_mask = 0, /* fallback */ + .ps1_mask = APPLE_DVFS_CMD_PS1, + .ps1_shift = APPLE_DVFS_CMD_PS1_SHIFT, }; static const struct of_device_id apple_soc_cpufreq_of_match[] __maybe_unused = { @@ -152,8 +161,8 @@ static int apple_soc_cpufreq_set_target(struct cpufreq_policy *policy, return -EIO; } - reg &= ~APPLE_DVFS_CMD_PS1; - reg |= FIELD_PREP(APPLE_DVFS_CMD_PS1, pstate); + reg &= ~priv->info->ps1_mask; + reg |= pstate << priv->info->ps1_shift; if (priv->info->has_ps2) { reg &= ~APPLE_DVFS_CMD_PS2; reg |= FIELD_PREP(APPLE_DVFS_CMD_PS2, pstate); From patchwork Thu Dec 12 07:03:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904762 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 B8D1AE7717F for ; Thu, 12 Dec 2024 07:10:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WbzFAeUuXXanJwe/RhcZGcox5IaVXp9hGHM//yffMwQ=; b=l72JpNz+CeaEqux2fSgKPVJf1a ZoenbX3TQ2mHWKLia9VRsQSvgSOIQpdFHWCnrbZrI+/E+uQtJ2d0SUe2i6VQWX1teYSo8jf+GZd6R 90/n0ZRmyFTA0HLMGTHKAWZ4rLc/ZYv4mTrMSfXzfc0mtTCxr3mrDPQck07XG9sa2SZDs1YSF+WKo lu8IyY6lSMK8TkdKyQ2dGJ/cTlvP7tX9yqy2lLtWPMP5DSp/omd7x+VgZNvgeLuX6XhQvQOXlzXJp A+Iwaxa/rdMVRs5umWax8wCZspGuxg64Onui7DWRxa9TiQzepe2PUmJauSnbRtu44Wzt+f/iMVXy7 ErJV6NzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLdKk-0000000H7bk-2eRi; Thu, 12 Dec 2024 07:10:02 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLdFl-0000000H6UZ-4AW0 for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 07:04:55 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d2e1a72fcca58-725ea1e19f0so226427b3a.3 for ; Wed, 11 Dec 2024 23:04:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987093; x=1734591893; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WbzFAeUuXXanJwe/RhcZGcox5IaVXp9hGHM//yffMwQ=; b=ki4dz7D4AcKiAuHBgK6Qjfg2jfAZYT6ir8nYIjUjzEdieVgJGRyPln3AMR5ezweblA adzfYi2Ds7TzK0PG5c2PVIZTQJsuMtKrPbyHiCtOVxIe4d7nA37L8+T/nL6n0lima2Kw NrEuKyELqr7ry6gQf3t9pUOYF/0rpSBFjg1JLGLdi3KFBeITueRGakjDKJzcckTpljpM e4m92H+fECAK27dKxGOGSKBowdEzqf4xwEXpg0CvajOe/IZbtzLl+PmZ/YPNC4tMf4gt xeMnaTwtP903HLAz7SYG8rYUtt/HA+XoweSzTc6q1ERNflkrhimZXf52LwDXaU9xQ+sC pPfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987093; x=1734591893; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WbzFAeUuXXanJwe/RhcZGcox5IaVXp9hGHM//yffMwQ=; b=iEfqIIArwoOMIq0Lx4G/tG6OJJiZJUiU5fGkaiAKo/67UCr/o2HehrgGhxRuT1ZCni 9tSEri47RLHMYXar7pLcgwsuygkxbZTqOsc1vZu7XFLN9mkwQQzwh07rBmlUu5rEXG6e v1SbnHusZXnM+34jhV5M7JKw4UIX1ZIYrtSIYS1rGeGByJW0QF591o9mXBx3ylruYfwr v+bUTypuZvOW2gRfx1t8/jdRdnvOR7un2nJqBGYYTdfQ+XV7yzGePy2u9Qd4UDV5TN6h Z2hgrosuFgiAdzJNYrrNCo1Ft2i9jHbNhsENVqMiwXoA7rRzkoTVQvPRP5sWaFBzZE74 NybQ== X-Forwarded-Encrypted: i=1; AJvYcCUorsaqArCEIPaB/Vci0cTReY32BeU/diY+3TOztRBF2eP3IlSrAseMgAzHk/NtGDo2f7fx9bGlVe67KcpfAMFj@lists.infradead.org X-Gm-Message-State: AOJu0YwnDsJMFm8xpQBAR74OJ79nclGyTChYvVr2oKEHDoIpVqy+UPIa Fmxf6XZ+1A9RUUE0iYsn1dhXP9E5xMayx9mJArq7xSirDjkAKwtK X-Gm-Gg: ASbGncuhvzJOx3WGyU0pnHhHJOFxr3iO4IDyp24+3Cf0ubGgl+BtySmQ/BfGMqd6KpP +LmDtd/8veemih2ZpbQXM15QF2qDbc6DVbIHQUM2Do97CQPfFim2i6lukgGG7gh9OQMyr8x21Bt GtqXnIOVpw9dV42yH8UB8xltHBg1jiITaqZU7+61kbetnknFNpwboLbD5hQM/sDF9rDTYZ6naxW 9APPwp50YEyZYGaCnlmScevKCYHKRLNCsHID1i3s45v9pmWufYNVZ5XSXrnshBs7SQ9916P X-Google-Smtp-Source: AGHT+IEmXq444oBwmD5u2gt6hQ4Y1b6qVPA6zh/gRHg0XG/Uu/LCdJJ6Nmc53XVFX072F+jsIRC8gw== X-Received: by 2002:a05:6a00:3e09:b0:725:30f3:67d8 with SMTP id d2e1a72fcca58-728fa87787bmr2990369b3a.0.1733987093085; Wed, 11 Dec 2024 23:04:53 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:52 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 4/7] cpufreq: apple-soc: Use 32-bit read for status register Date: Thu, 12 Dec 2024 15:03:03 +0800 Message-ID: <20241212070344.3858-5-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_230454_025540_448D01CA X-CRM114-Status: GOOD ( 13.02 ) 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 Apple A7-A9(X) SoCs requires 32-bit reads on the status register. Newer SoCs accepts 32-bit reads on the status register as well. Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 90e34105b50b..b27d261fe5a6 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -122,7 +122,7 @@ static unsigned int apple_soc_cpufreq_get_rate(unsigned int cpu) unsigned int pstate; if (priv->info->cur_pstate_mask) { - u64 reg = readq_relaxed(priv->reg_base + APPLE_DVFS_STATUS); + u32 reg = readl_relaxed(priv->reg_base + APPLE_DVFS_STATUS); pstate = (reg & priv->info->cur_pstate_mask) >> priv->info->cur_pstate_shift; } else { From patchwork Thu Dec 12 07:03:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904763 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 9C8C7E7717F for ; Thu, 12 Dec 2024 07:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=11W4ToO5h1HZTorB4p+IfX/arkj3h4R3MbzsYg+yGqg=; b=TzCCBUm71b/ipk3rlC8dGoEtz8 CLFe/j6w4hu73Hxphkmsx1xhfC3rT4MZurnWLSAbnAipYhJWmXMjfnHt+tSl/JiR312qZoC7NZOvy oCy/UGmniT5Vi8Fvbn/uZQGCb9FXjBYbPrFQFFR1vsMgjBcq0dgfO18lvsYUrLXaANUN29QVXWQL2 CWh6QP+FmF3MEMJY9sqhUKeKGJY/DDjXgUsYnn8g9iXrK5BGvOIy+pqu5PbeScTH4Rs4fzWtgasRb sbYd3PeXficbQkFM5h78RELQKJ0eDQrn8LRg4uhBm8yNOTZ5BmN/HFV+k8/aFRpJw2BhGJj7/1ykk W0Sbm4CA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLdLn-0000000H7oD-1J19; Thu, 12 Dec 2024 07:11:07 +0000 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLdFo-0000000H6WO-47Ae for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 07:04:58 +0000 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-725ce7b82cbso320365b3a.0 for ; Wed, 11 Dec 2024 23:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987096; x=1734591896; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=11W4ToO5h1HZTorB4p+IfX/arkj3h4R3MbzsYg+yGqg=; b=lPcfx/qelxX7IPr9kmvZr5ZjqU4h8Xl8z9HjNFEYaDjWgFeIjTyQEStkRv39EZhib9 JWd3FXyjVwYhNfkbJARVCintaDDZssPo3zjI/nYLdl8FZlbmp6/V9RnyMGBPxXr2KCjW dJkERiuzq59uPlPDnVKlTkwhm1RGCHNASrf8HpxE+VaPLbvs/ZDlxgGV2jh5lhKxLZ77 E+6cD8dl3n+RLvHoaiQ0NMxn8Ed5fpLpblzX6AHINSR2uv8KFP2aIWGHG4hOkXyk2DqQ MX5gyOm0zK52uSSeacSQK6g4oAn+GPaTxn/pUBsqOg6KIIzFTk+AWOAMdREv9XQfj/lm PFKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987096; x=1734591896; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=11W4ToO5h1HZTorB4p+IfX/arkj3h4R3MbzsYg+yGqg=; b=HCOAPsh0PWYXti0ucRMl43oi/EgDugpGpOkvnaqlUT8qi0g28ltlu80Z6BsoL911mu AuOKjvw/S4OE26OAuEHpDoAD7AUS9pC9JIzzadK7UkF8Y+11aA2tMg9QgWfgG3yL3deg N7x7k7biM8I/ka429rwyVJqFOHYmi/Etl54zAuopuldtqVvrlIgCYM1Tgz39SuLAgOmc JIJ5o3NIIC6i0IXPQHAjIAR20ePD24xFNYhcqEs3mtNgNucxuZWTLabMf7RwVXLbEzuS V4OjU/whvfgY5n01RlRSJooSN8BiXK45znqzPxPvQKkkZESxQSXk30BvMX7R86Rv8MZ0 kBSQ== X-Forwarded-Encrypted: i=1; AJvYcCXVCpC6D8/7ZMEwl3FBkXOZ46IdTpS0bHURkYoz9KsxsW8dE6e19mwSMs1R9Z2kM1nz/LblW66fbo+UefrwnXPd@lists.infradead.org X-Gm-Message-State: AOJu0YxQ/sphbH/3MQGEN+9rUkperwarZyW9JXrx8vKE1BrGXOODLYKA KHluhl0zsqrJD/hooVjJ7veTmt9G7aPo76fCmhePt8+4PHJcei95 X-Gm-Gg: ASbGncu3Gj9XaN2SLYla6E21ygc4c0+B2quTF4WPGo1bXF3oOnaex13HaxJnr7IDlV4 bIjajgWfFcXnN+HsJcZGVC4LUUyiTgpaUzC53SltNkdi37+Cufj5Edj/E2VOlvpr+d8Y/i8zsEd 2dBKdmdmIUG/GViL39cjJW64vSVUZBHn/82u9t3WBd5SzH45zvB8AvnqFfIoOldNLbsH+JB8pmg kSPnbtLNnTMUNpdxVa6NSeWcaYOeEisJfPDJkPh0qayhwpJoEio/SXm4c8Z6qjgVw9zwbPN X-Google-Smtp-Source: AGHT+IHKPAp1Y9VHLYOP5k5Lmr6P41gM42/smjErSsBmXsfXGl8fcB/4q3SDqlWrJH5E2MTneTUBEw== X-Received: by 2002:a05:6a00:230a:b0:725:eacf:cfdb with SMTP id d2e1a72fcca58-728faad3a55mr3591696b3a.24.1733987096031; Wed, 11 Dec 2024 23:04:56 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:55 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 5/7] cpufreq: apple-soc: Increase cluster switch timeout to 400us Date: Thu, 12 Dec 2024 15:03:04 +0800 Message-ID: <20241212070344.3858-6-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_230457_010233_9B3A073C X-CRM114-Status: GOOD ( 12.10 ) 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 Apple A11 SoC takes a long time to switch. Maximum switch time observed is 345us, so increase the cluster switch timeout to 400us to be safe. Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index b27d261fe5a6..94e57f055a5f 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -53,7 +53,7 @@ #define APPLE_DVFS_PLL_FACTOR_MULT GENMASK(31, 16) #define APPLE_DVFS_PLL_FACTOR_DIV GENMASK(15, 0) -#define APPLE_DVFS_TRANSITION_TIMEOUT 100 +#define APPLE_DVFS_TRANSITION_TIMEOUT 400 struct apple_soc_cpufreq_info { bool has_ps2; From patchwork Thu Dec 12 07:03:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904764 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 88C6BE7717F for ; Thu, 12 Dec 2024 07:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=f+xNT9o8scJSCGD7/hX9myZPXhoesiiISnOX8ftRSxw=; b=YpNvreEoFyD42uRWgbbOhsNhBG auY70z/uJjkREDnoKvksqbQfb8b9SJw/szIxVkGXCXBqIRmRfJ36iA5cg45GSNfQz3Sp+gUA4wXqH qTjiiB49o70yBvP712bnkpLidqMS42Ma+Y1NBLPV08KZgSovbF+ccXqNwAIiNGF5r+I6WgNvYLgg1 6k88bBmn3qRFWHLdxGUgYLWs0HnhEI3Qyn+7vomlcO628GiyhWs6RXTvV9zQzS7pdrnvIBCOaz/Ta S4Bygm5qugYyGgfDEazdBEuTuakyZQUnxAHsuvmFbDh6c/7xUuLQoztNjpBVx0P2uHBSvcc5HMzSV iN9jKtbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLdMo-0000000H7uB-3m3A; Thu, 12 Dec 2024 07:12:10 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLdFr-0000000H6Wx-2fmZ for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 07:05:00 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-728e3826211so213044b3a.0 for ; Wed, 11 Dec 2024 23:04:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987099; x=1734591899; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f+xNT9o8scJSCGD7/hX9myZPXhoesiiISnOX8ftRSxw=; b=FOwWzLA1Yn4EuaTg2ypO74QWOSEXTZ5pAdqc4SQtfgsFQMKkpsHU2zP3ys2+ZwiXWK 2qeqXc+Ji6oBhbcXDkRb4zp52W6DopmnU8ckyzWw34kGg8Rs9zD3vmO5f0ifv9jSmibw OdTPp6H8pP+nJR4P2kKc3bmsJUYja03clBxz0eNspILdNCLxsu/WGGjwWmpuF/Tn/ejJ HGZ6KWJpgMPw7uOKrlEZnhjMju3TkzmLNfh6zm4pJBQJjiaSsT4CkMEnPTeDrgdSk7pp XUbEkwdS2AEBe2B+7tqvsizqFLczTgG+gj0Xo5AZ+xhqBOp6iBsiZvS4FYQcKV5QFnbj ZlXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987099; x=1734591899; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f+xNT9o8scJSCGD7/hX9myZPXhoesiiISnOX8ftRSxw=; b=pG1jKsaihWfUFA+EMZf8iyZMsepTKQQh6vtX5s6Y03q5XMtQ9LErhuOzDQ/OG5pHN6 xA+TUzw/0U685EEClZfWkmdBvz30MPXUOB+vRwkFtev9lizJOfEfctiFb7aEte6oWCGC fHUQAC7INkr/Xl978MyROAzekfj4tjIyx5iLU+ARfArYBk0YpfQtZIDGS0SoRfwa7/z9 8isksBxF+YikGCJklkzMPLN2L2kTvz9TZxFz1dxl/xqzqK5MqmXXYB84cTKmxU6KMxkA dpS9ghKiOZTuYsblHbl3ccDkedMZE2iX4NTmzPgEmz0M0owd6A3DIVf5BK8XmG60KNo+ AsgQ== X-Forwarded-Encrypted: i=1; AJvYcCXApnkkCt8aI8movDgzewAwYyKfxoCYLfsV94ozrVbCEk4EMvVRkENU7A2mOXU4D/ySDUtfko9A3218QjNPxRxK@lists.infradead.org X-Gm-Message-State: AOJu0Yyt1ydM91iDuElYJfYqY2EBI2kJaxwJM8SNMA/hvSsxPwDLM7d2 WXebaEVNINT0fYbyLBIU+2tr8Z5w7cxKwrffXr0cbDlnYr2cFlgC X-Gm-Gg: ASbGncvRmOiDnXm5fHpnxYsI3UB6l+6uWDUR57aEAbe+Bno0FFQygDk/YeJ7G6P24oq ejlcHudBTVomOoYMQkN/w6izGcTnuLV5/zN+zZyzbFNykQ5ZA78+alOfMp8EZCHyvH1cyTIOtU0 BwzPQ9/PQGMz53A+I06Zhe8Pxtd5p7JdlqXGA9AMmDCXFyDZ6mZ+dMUxuHe6I6QDxTPa9a37zl0 jkoODmxX2I7Cu7OXeGAK8zY/XPbiqdIXKdcnBzzWDoCSQr33FowemBnjz3B12DQIYNnLK2A X-Google-Smtp-Source: AGHT+IEWZFABNU2cmsx9g4Vfkxtd5tDRV33KNAhW9o7B+oCf+G6xKL0qxxHdO05yjrF+abxzB9dUcw== X-Received: by 2002:a05:6a21:398f:b0:1e1:b12e:edb8 with SMTP id adf61e73a8af0-1e1cebb7f15mr3582956637.30.1733987099042; Wed, 11 Dec 2024 23:04:59 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:04:58 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 6/7] cpufreq: apple-soc: Set fallback transition latency to APPLE_DVFS_TRANSITION_TIMEOUT Date: Thu, 12 Dec 2024 15:03:05 +0800 Message-ID: <20241212070344.3858-7-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_230459_671694_0F00C5C3 X-CRM114-Status: GOOD ( 13.58 ) 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 The driver already assumes transitions will not take longer than APPLE_DVFS_TRANSITION_TIMEOUT in apple_soc_cpufreq_set_target(), so it makes little sense to set CPUFREQ_ETERNAL as the transition latency when the transistion latency is not given by the opp-table. Signed-off-by: Nick Chan Reviewed-by: Christian Loehle --- drivers/cpufreq/apple-soc-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index 94e57f055a5f..c9f31a3653e2 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -291,7 +291,7 @@ static int apple_soc_cpufreq_init(struct cpufreq_policy *policy) transition_latency = dev_pm_opp_get_max_transition_latency(cpu_dev); if (!transition_latency) - transition_latency = CPUFREQ_ETERNAL; + transition_latency = APPLE_DVFS_TRANSITION_TIMEOUT * 1000; policy->cpuinfo.transition_latency = transition_latency; policy->dvfs_possible_from_any_cpu = true; From patchwork Thu Dec 12 07:03:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nick Chan X-Patchwork-Id: 13904765 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 85328E7717F for ; Thu, 12 Dec 2024 07:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=R6P537stxvMQqeF6f3roncNxbUVv366ZADaeaxeRSNY=; b=5CTpQCGwk7OLzCkYSImRSHja3S 2igrRkSsnVObcgzEw1iPXLUjkRt0aKeZBPwcRRRPaLd51DlVisaIEPX6oAnb0M//00r07Cztd1eEB WU2wnddsxRFBd3MNHXlh6iILUlE60XLwnXGh+6SOFdPs5jeQX1Vus8rsuGIBQvUPO/rT6IH4SWYco ajTF6mdeVkN+nXB9CwMFKqoybImb8aJ3Au9FSfBR6IOrMEcbioOV9oueicffN+nqKvp/uu+l3jy+C KLD9EeOraA1E/YXYX86Fqk7Y/ZHiBv7toVmUkeutmQ5QPzCIHUdwfyK4EGAdfngVs8eKyBURFbqIi TRzda7ww==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tLdNq-0000000H81u-21mF; Thu, 12 Dec 2024 07:13:14 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tLdFv-0000000H6Xv-1D8S for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2024 07:05:04 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-728ec840a8aso327305b3a.0 for ; Wed, 11 Dec 2024 23:05:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733987103; x=1734591903; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R6P537stxvMQqeF6f3roncNxbUVv366ZADaeaxeRSNY=; b=Memi8faq1Ia305Bybw4XVl85VLJnC7yrH3ctmOj66mm8hUwEpFGuPDZppQE/s9O70l 3bPDDzIP1PGq6wLx84VAGqgQAlRYV2UZDC+oengl7jcgMnJ+s7RhtxnY7nbppFMbF3N8 nckXpjsFuoDWu5eq+gLKjc9fFxES5ju2paBAvlFYUSO2y8ZoDe2BfyFldnG/h5mnCijO WGYBSKsZ6aTsCii9AWzluLZ+pVwSk+y5cuUZN6tlXobP7x6td42whSBJoqf4B7RK6/S2 aU5pTFgTSKtWGfcCo7x+1/LgnmITsxHK0AvZgv0tnodPf/pmN8XOsAJSmvq8dmx4VSzK AUuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733987103; x=1734591903; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R6P537stxvMQqeF6f3roncNxbUVv366ZADaeaxeRSNY=; b=ijL1OsNoIr0EKlCk9xG89bObeT3eVJQXpAPJH4DQaFPjkwBVwGH/8tJXMZwhNDie+9 sQAL4I7FaM6XHZ5XqwFTMIZBo6DX10T8b23iWyLh1pdBplg0Ga958g5nHfJM4ZP2tZfo gk4doU5L908d1zjyre6ZP2SH8QE4zGcydyl9gQHq0BmiFEf/2iqUPzWPUeTYJgy3K2ky W+OxEvjUXKC66uCFPkpYwRxRukSBgSEd2KNRW4p8j72//Q9xzK9GkKA2xBCGytjbujWN E8hhwc1jRxORMFByd0bqnm6KU7F5wL3dwLwSm7WsDPPB1wZvS8N1+ERuHgC8U8/A7Um+ 4Bwg== X-Forwarded-Encrypted: i=1; AJvYcCW/smtQKoy3UC8V/nLtmRfpPCnv8vSXfniPxF6897fpZc7BsOe8/i3nXhaJAbJ/iKXjGNejsxQKbyUpWFJt5hkj@lists.infradead.org X-Gm-Message-State: AOJu0Yzdm1QzpCcvLno3C6Fq7F1RE5jH0pZBrvvdyiUdQJ1lfhN7smtm JXxWLPH+aDMMWIee/U6nd97CM4lKkGjdvi0gnWaynA5JBhGXhZ/N X-Gm-Gg: ASbGncuYLhDrPp+9pdrN5o3w1SLxCmJezgLaLIIKPJSqwlxu0fXOhD1TweH5rcUjkWV 1JMJ86v57mmPcPoCMLftcAPGkzFrWpz4tCs3upjnD6WD9QqCHUEqg/avJ39cKnn566OZ+e3rFqg LjTntnjvJPbk7QvRA3sGINvgunNSnTvJuv4sqraOnQm9x5pU6ej5HbKJs6vHaH5tA5MK46TNeIp qy8QVvOP6wZv3jz3F5SYWPOdk6Yi+FcESyB1FUnrqYfgjgpNz9MZsZ0o8dBMCy8MTAbRuXL X-Google-Smtp-Source: AGHT+IGrdOYxBGn8CzjzAjnMQjSdYYWqQKbTysuxC6esT4QB5BXv4xEumBLxne4E9WmA5a4aAN8WoA== X-Received: by 2002:a05:6a00:1803:b0:725:eb85:f7ef with SMTP id d2e1a72fcca58-728faa62ae1mr3631124b3a.14.1733987102674; Wed, 11 Dec 2024 23:05:02 -0800 (PST) Received: from localhost.localdomain ([59.188.211.160]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-725ee10f928sm6519386b3a.32.2024.12.11.23.04.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Dec 2024 23:05:02 -0800 (PST) From: Nick Chan To: Hector Martin , Sven Peter , Alyssa Rosenzweig , "Rafael J . Wysocki" , Viresh Kumar , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Asahi Linux , Linux ARM Kernel Architecture , Linux power management , Devicetree , LKML Cc: Nick Chan Subject: [PATCH v2 7/7] cpufreq: apple-soc: Add Apple A7-A8X SoC cpufreq support Date: Thu, 12 Dec 2024 15:03:06 +0800 Message-ID: <20241212070344.3858-8-towinchenmi@gmail.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212070344.3858-1-towinchenmi@gmail.com> References: <20241212070344.3858-1-towinchenmi@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241211_230503_325766_BA2B3479 X-CRM114-Status: GOOD ( 14.59 ) 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 These SoCs only use 3 bits for p-states, and have a different APPLE_DVFS_CMD_PS1 mask value. Signed-off-by: Nick Chan --- drivers/cpufreq/apple-soc-cpufreq.c | 30 +++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/apple-soc-cpufreq.c b/drivers/cpufreq/apple-soc-cpufreq.c index c9f31a3653e2..c3a6dd8ae22a 100644 --- a/drivers/cpufreq/apple-soc-cpufreq.c +++ b/drivers/cpufreq/apple-soc-cpufreq.c @@ -22,12 +22,14 @@ #include #include -#define APPLE_DVFS_CMD 0x20 -#define APPLE_DVFS_CMD_BUSY BIT(31) -#define APPLE_DVFS_CMD_SET BIT(25) -#define APPLE_DVFS_CMD_PS2 GENMASK(15, 12) -#define APPLE_DVFS_CMD_PS1 GENMASK(4, 0) -#define APPLE_DVFS_CMD_PS1_SHIFT 0 +#define APPLE_DVFS_CMD 0x20 +#define APPLE_DVFS_CMD_BUSY BIT(31) +#define APPLE_DVFS_CMD_SET BIT(25) +#define APPLE_DVFS_CMD_PS1_S5L8960X GENMASK(24, 22) +#define APPLE_DVFS_CMD_PS1_S5L8960X_SHIFT 22 +#define APPLE_DVFS_CMD_PS2 GENMASK(15, 12) +#define APPLE_DVFS_CMD_PS1 GENMASK(4, 0) +#define APPLE_DVFS_CMD_PS1_SHIFT 0 /* Same timebase as CPU counter (24MHz) */ #define APPLE_DVFS_LAST_CHG_TIME 0x38 @@ -36,6 +38,9 @@ * Apple ran out of bits and had to shift this in T8112... */ #define APPLE_DVFS_STATUS 0x50 +#define APPLE_DVFS_STATUS_CUR_PS_S5L8960X GENMASK(5, 3) +#define APPLE_DVFS_STATUS_CUR_PS_SHIFT_S5L8960X 3 +#define APPLE_DVFS_STATUS_TGT_PS_S5L8960X GENMASK(2, 0) #define APPLE_DVFS_STATUS_CUR_PS_T8103 GENMASK(7, 4) #define APPLE_DVFS_STATUS_CUR_PS_SHIFT_T8103 4 #define APPLE_DVFS_STATUS_TGT_PS_T8103 GENMASK(3, 0) @@ -72,6 +77,15 @@ struct apple_cpu_priv { static struct cpufreq_driver apple_soc_cpufreq_driver; +static const struct apple_soc_cpufreq_info soc_s5l8960x_info = { + .has_ps2 = false, + .max_pstate = 7, + .cur_pstate_mask = APPLE_DVFS_STATUS_CUR_PS_S5L8960X, + .cur_pstate_shift = APPLE_DVFS_STATUS_CUR_PS_SHIFT_S5L8960X, + .ps1_mask = APPLE_DVFS_CMD_PS1_S5L8960X, + .ps1_shift = APPLE_DVFS_CMD_PS1_S5L8960X_SHIFT, +}; + static const struct apple_soc_cpufreq_info soc_t8103_info = { .has_ps2 = true, .max_pstate = 15, @@ -99,6 +113,10 @@ static const struct apple_soc_cpufreq_info soc_default_info = { }; static const struct of_device_id apple_soc_cpufreq_of_match[] __maybe_unused = { + { + .compatible = "apple,s5l8960x-cluster-cpufreq", + .data = &soc_s5l8960x_info, + }, { .compatible = "apple,t8103-cluster-cpufreq", .data = &soc_t8103_info,