mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Shuwei Wu <shuwei.wu@mailbox.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	 Viresh Kumar <viresh.kumar@linaro.org>,
	Rob Herring <robh@kernel.org>,
	 Krzysztof Kozlowski <krzk+dt@kernel.org>,
	 Conor Dooley <conor+dt@kernel.org>,
	Paul Walmsley <pjw@kernel.org>,
	 Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	 Alexandre Ghiti <alex@ghiti.fr>, Yixun Lan <dlan@kernel.org>,
	 Yixun Lan <dlan@kernel.org>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	 devicetree@vger.kernel.org, Shuwei Wu <shuwei.wu@mailbox.org>
Subject: [PATCH v3 0/2] cpufreq: spacemit: Add cpufreq support for K1 SoC
Date: Fri, 12 Jun 2026 17:51:00 +0800	[thread overview]
Message-ID: <20260612-shadow-deps-v3-0-2f3ba88611ff@mailbox.org> (raw)

This series enables CPU frequency scaling for the SpacemiT K1 SoC.

K1 has two CPU cluster clocks but one shared CPU voltage rail. Add a
small K1-specific cpufreq driver so the two clocks and the shared OPP
transition can be handled together.

Tested on Banana Pi BPI-F3. The system boots with all eight CPUs online,
the K1 cpufreq driver registers one policy for CPUs 0-7, and both CPU
cluster clocks follow the selected cpufreq rate.

~ # cat /sys/devices/system/cpu/online
0-7

~ # ls /sys/devices/system/cpu/cpufreq
policy0

~ # cat /sys/devices/system/cpu/cpufreq/policy0/affected_cpus
0 1 2 3 4 5 6 7

~ # cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies
614400 819000 1000000 1228800 1600000

With the userspace governor:
----------------------------------------------------------------------------
Frequency    | scaling_cur | cpu_c0_core | cpu_c1_core | Real    | User
(kHz)        | (kHz)       | (Hz)        | (Hz)        | (s)     | (s)
-------------+-------------+-------------+-------------+---------+----------
1,600,000    | 1,600,000   | 1600000000  | 1600000000  | 1.80s   | 1.80s
1,228,800    | 1,228,800   | 1228800000  | 1228800000  | 2.33s   | 2.33s
1,000,000    | 1,000,000   | 1000000000  | 1000000000  | 2.88s   | 2.87s
  819,000    |   819,000   |  819200000  |  819200000  | 3.53s   | 3.52s
  614,400    |   614,400   |  614400000  |  614400000  | 4.72s   | 4.72s
----------------------------------------------------------------------------

Signed-off-by: Shuwei Wu <shuwei.wu@mailbox.org>
---
Changes in v3:
- Add a K1-specific cpufreq driver for the shared-rail, dual-clock topology
- Use one shared CPU OPP table and one cpufreq policy for all CPUs
- Link to v2: https://lore.kernel.org/r/20260410-shadow-deps-v2-0-4e16b8c0f60e@mailbox.org

Changes in v2:
- Move OPP tables to dedicated k1-opp.dtsi
- Enable OPP only on BPI-F3 with cpu-supply present
- Link to v1: https://lore.kernel.org/r/20260308-shadow-deps-v1-0-0ceb5c7c07eb@mailbox.org

---
Shuwei Wu (2):
      cpufreq: spacemit: Add K1 cpufreq driver
      riscv: dts: spacemit: Add cpu scaling for K1 SoC

 arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts |  35 +++-
 arch/riscv/boot/dts/spacemit/k1-opp.dtsi        |  70 +++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi            |   8 +
 drivers/cpufreq/Kconfig                         |   4 +
 drivers/cpufreq/Kconfig.riscv                   |  15 ++
 drivers/cpufreq/Makefile                        |   3 +
 drivers/cpufreq/cpufreq-dt-platdev.c            |   2 +
 drivers/cpufreq/spacemit-k1-cpufreq.c           | 251 ++++++++++++++++++++++++
 8 files changed, 387 insertions(+), 1 deletion(-)
---
base-commit: 5164e95565d3fd508ca8a95351323f5716dfb695
change-id: 20260307-shadow-deps-3582a78aa756
prerequisite-patch-id: 154bd4f720ce5065d58b988de8f273207b44572e
prerequisite-message-id: <20260206-spacemit-p1-v4-0-8f695d93811e@riscstar.com>
prerequisite-patch-id: 5da3e75b18291a5540d4f66d7a0600fb8975ef62
prerequisite-patch-id: bcf41917414ecef8cf743095d130f6004c32f6a5
prerequisite-patch-id: cfe3800f8c791ec4c63e070af9628e88e0fc31b9
prerequisite-message-id: <20260305-k1-clk-fix-v1-1-abca85d6e266@mailbox.org>
prerequisite-patch-id: 7c7fb9f87dba019ece4c97c45750349a7cd28f3a

Best regards,
-- 
Shuwei Wu <shuwei.wu@mailbox.org>


             reply	other threads:[~2026-06-12  9:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-12  9:51 Shuwei Wu [this message]
2026-06-12  9:51 ` [PATCH v3 1/2] cpufreq: spacemit: Add K1 cpufreq driver Shuwei Wu
2026-06-15  5:24   ` Viresh Kumar
2026-06-15  6:12     ` Shuwei Wu
2026-06-15  6:34       ` Viresh Kumar
2026-06-15 12:11         ` Shuwei Wu
2026-06-16  8:19           ` Viresh Kumar
2026-06-12  9:51 ` [PATCH v3 2/2] riscv: dts: spacemit: Add cpu scaling for K1 SoC Shuwei Wu
2026-06-14  6:50 ` [PATCH] riscv: dts: spacemit: orangepi-rv2: Add cpu scaling for K1, SoC Vincent Legoll
2026-06-15  0:41   ` Yixun Lan
2026-06-14 12:28 ` [PATCH] riscv: dts: spacemit: k1-musepi-pro: add cpu scaling Andre Heider
2026-06-15  5:07 ` [PATCH v3 0/2] cpufreq: spacemit: Add cpufreq support for K1 SoC Viresh Kumar
2026-06-20 14:23 ` Gong Shuai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260612-shadow-deps-v3-0-2f3ba88611ff@mailbox.org \
    --to=shuwei.wu@mailbox.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlan@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=spacemit@lists.linux.dev \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®