| Message ID | 20260930-a733-clk-v5-0-11175b41cd2d@pigmoral.tech (mailing list archive) |
|---|---|
| Headers |
Return-Path: <linux-sunxi+bounces-26395-sunxi=pue.re@lists.linux.dev> X-Original-To: noreply@patchwork.local Delivered-To: noreply@patchwork.local Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mxe881.netcup.net (Postfix) with ESMTPS id 55A2C1C02BB for <noreply@patchwork.local>; Tue, 29 Sep 2026 19:29:31 +0200 (CEST) Authentication-Results: mxe881; dkim=pass header.d=pigmoral.tech; spf=pass (sender IP is 172.234.253.10) smtp.mailfrom=linux-sunxi+bounces-26395-noreply=patchwork.local@lists.linux.dev smtp.helo=sea.lore.kernel.org Received-SPF: pass (mxe881: domain of lists.linux.dev designates 172.234.253.10 as permitted sender) client-ip=172.234.253.10; envelope-from=linux-sunxi+bounces-26395-noreply=patchwork.local@lists.linux.dev; helo=sea.lore.kernel.org; Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sea.lore.kernel.org (Postfix) with ESMTP id F0AFF2408F for <noreply@patchwork.local>; Tue, 29 Sep 2026 17:27:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4329A457E73; Tue, 29 Sep 2026 17:27:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=pigmoral.tech header.i=junhui.liu@pigmoral.tech header.b="q9JliJP0" X-Original-To: linux-sunxi@lists.linux.dev Received: from sender6-op-o15.zoho.com (sender6-op-o15.zoho.com [165.173.180.15]) (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 296CB3A2559 for <linux-sunxi@lists.linux.dev>; Tue, 29 Sep 2026 17:27:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=165.173.180.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790702847; cv=pass; b=T9X4VSYN1l1mxnGaQVKwS4c4Vn9oAki73KrDRX6g7/NObFv/E4skFCcprNV8RMcR6XmtJEXLYPHGGOlKkyepjfMNE1sh//lhjVsloqPIY57pPJuMPyIFY4LwYG4rlBw7sgIcJasuJw/lQz3pWq5UFOXhoh9wgpBib7o+aTz1dVk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790702847; c=relaxed/simple; bh=p/GHIp4Q+wktNYmNZSYzDRjvrWbldK01OubfVytpjns=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=ZRsBpzqeGBdZhBrM9PUDBaQY7RjoQBUoefnZZO3J8+IJQXxYNXZH1BUopA6YjtZU166F7Hu7xc7b+kTe6kUYBlY+GtI3sjjbyEtLCZyV0IE8DAqKkV+Z+sD8EUvcgSI2QZVbZfvf0/X/wfPHZj/ceqteRD8x01urlXxI/PME65s= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pigmoral.tech; spf=pass smtp.mailfrom=pigmoral.tech; dkim=pass (1024-bit key) header.d=pigmoral.tech header.i=junhui.liu@pigmoral.tech header.b=q9JliJP0; arc=pass smtp.client-ip=165.173.180.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pigmoral.tech Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pigmoral.tech ARC-Seal: i=1; a=rsa-sha256; t=1790702811; cv=none; d=zohomail.com; s=zohoarc; b=Vhhckjv+Fp9yy4wONDWghNm8HBWYDPtQP4iYbZ5xTE/f1J1j/UhiLDupiUCbMaX8BTClRmThYqiMVmMTmSAxpObBydaYTRbap3rz4IhQIlQsruJ03s1flgXyhpbiNjguPmgqY+fL4SqarZxkFm1rCCMjp2Zo2Dhs6dJYuIw+uyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1790702811; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=uKbN1/2S72+Ds1i9QYOJgPbItX37Pf7LrEr2RrJNMN4=; b=I9HiVCyFW/1dAlPhxJ0la2SqCxljMxY/marh5UT/+nXeVr6rsnC1GKJ6jHqzHvj7m5dIJJfcR8A8T4no7G8lUETym9Wi7xyLlsrgVt/oOqPF1q1QhBLLgKc6N3siQpEfAJKrVxMxUy/bj0KBVvyK9o/E/A7jGsoU+uv+4Rfb5OE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=pigmoral.tech; spf=pass smtp.mailfrom=junhui.liu@pigmoral.tech; dmarc=pass header.from=<junhui.liu@pigmoral.tech> DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1790702811; s=zmail; d=pigmoral.tech; i=junhui.liu@pigmoral.tech; h=From:From:Subject:Subject:Date:Date:Message-Id:Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding:To:To:Cc:Cc:Reply-To; bh=uKbN1/2S72+Ds1i9QYOJgPbItX37Pf7LrEr2RrJNMN4=; b=q9JliJP0jLlP954Aqp+Kr1YUHjUf0M7ZEwkXLgClIxWO7tgXZzu6LHb3BQ6q5kvt qpk/BcEHv14/tz/PfYwNz6alvs3mrovAK2EgnsqTOkRAduAuPw+4kpVrWpl0/LM+Odo bJlkPug2cseu+GgF8sEfAFGplXcltN6E6Acv/toc= Received: by smtp.zohomail.com with SMTPS id 1790702810475424.1998192636315; Tue, 29 Sep 2026 10:26:50 -0700 (PDT) From: Junhui Liu <junhui.liu@pigmoral.tech> Subject: [PATCH v5 0/8] clk: sunxi-ng: Add support for Allwinner A733 CCU and PRCM Date: Wed, 30 Sep 2026 01:26:07 +0800 Message-Id: <20260930-a733-clk-v5-0-11175b41cd2d@pigmoral.tech> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: <linux-sunxi.lists.linux.dev> List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev> List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/22QS2rDMBRFt2I0roJ+tiwTSvdROpCfnxLR+FPJM Skhe69sF+yWTARX6Jwr7p1EDB4jqbI7CTj56PsuhfwlI3C23Qmpb1ImgomCpYNaLSWFyydljXL AmDXOAEnPh4DO3xbV+0fKZx/HPnwv5onPt6tEcrZJJk4ZlUWt0NRCqVy/Df7U9sFeDiPCmcyiS Wyw5nwHiwQbrRpellAjg2ew3GDD8h0sE5wzJ2TppAFdPoPVDhb7ZjU3Ay8V1mgs8P/wYx0k4Nc 1TTquq5AWY7TLpFV2/P1SQeO1u/lF2/V0WCeBukHBwTgszF/367x1bSNS6NvWj1U26YOkAXhqf fwAgGvNKNABAAA= X-Change-ID: 20260202-a733-clk-0d4fc00a9f9c To: Stephen Boyd <sboyd@kernel.org>, Brian Masney <bmasney+clk@redhat.com>, Jerome Brunet <jbrunet+clk@baylibre.com>, Rob Herring <robh@kernel.org>, Krzysztof Kozlowski <krzk+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org>, Chen-Yu Tsai <wens@kernel.org>, Jernej Skrabec <jernej.skrabec@gmail.com>, Samuel Holland <samuel@sholland.org>, Philipp Zabel <p.zabel@pengutronix.de>, Junhui Liu <junhui.liu@pigmoral.tech>, Paul Walmsley <pjw@kernel.org>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Alexandre Ghiti <alex@ghiti.fr>, Richard Cochran <richardcochran@gmail.com> Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org, Jerome Brunet <jbrunet@baylibre.com>, Enzo Adriano <enzo.adriano.code@gmail.com>, Andre Przywara <andre.przywara@arm.com>, Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> X-Mailer: b4 0.16.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6367; i=junhui.liu@pigmoral.tech; h=from:subject:message-id; bh=p/GHIp4Q+wktNYmNZSYzDRjvrWbldK01OubfVytpjns=; b=owGbwMvMwCWWvDb1VEXc8j+Mp9WSGLJ2f9m0uvIjT8M6D1kb3+js7l0rYgUSORcuef0+8kR5f T2/RoR3RykLgxgXg6yYIguXv/g/ax2eb0cEWu/DzGFlAhnCwMUpABPRkGX473w0OP7o+4LDr1zP hhaJWernXflodeDhu1O+3LF8J0tMXBj+cNybKnfYJUUmy7xlX4zCL7Ml3oWmB7T85jkKL5kifyC HFwA= X-Developer-Key: i=junhui.liu@pigmoral.tech; a=openpgp; fpr=15B30CC69C4BF0CC3C08F85A2A90CDC122DF37BF X-ZohoMailClient: External X-Rspamd-Server: rspamd-worker-8404 X-Spamd-Result: default: False [-2.16 / 15.00]; BAYES_HAM(-5.50)[100.00%]; RBL_SENDERSCORE(2.00)[172.234.253.10:from]; SUSPICIOUS_RECIPS(1.50)[]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; BAD_REP_POLICIES(0.10)[]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_TWELVE(0.00)[27]; TAGGED_RCPT(0.00)[clk,dt]; PRECEDENCE_BULK(0.00)[]; FORGED_SENDER_MAILLIST(0.00)[]; DMARC_NA(0.00)[pigmoral.tech]; FREEMAIL_CC(0.00)[vger.kernel.org,lists.infradead.org,lists.linux.dev,baylibre.com,gmail.com,arm.com,oss.qualcomm.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[msgid.link:url,pigmoral.tech:email,pigmoral.tech:dkim,sea.lore.kernel.org:rdns,sea.lore.kernel.org:helo]; ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=2]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[165.173.180.15:received,100.90.174.1:received]; FROM_HAS_DN(0.00)[]; R_DKIM_ALLOW(0.00)[pigmoral.tech:s=zmail]; FREEMAIL_TO(0.00)[kernel.org,redhat.com,baylibre.com,gmail.com,sholland.org,pengutronix.de,pigmoral.tech,dabbelt.com,eecs.berkeley.edu,ghiti.fr]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; DKIM_TRACE(0.00)[pigmoral.tech:+]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(0.00)[+ip4:172.234.253.10:c]; RCVD_COUNT_FIVE(0.00)[5]; MIME_TRACE(0.00)[0:+]; MID_RHS_MATCH_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[junhui.liu@pigmoral.tech,linux-sunxi@lists.linux.dev]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:63949, ipnet:172.234.224.0/19, country:SG]; TAGGED_FROM(0.00)[bounces-26395-noreply=patchwork.local]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[172.234.253.10:from] X-Rspamd-Queue-Id: 55A2C1C02BB X-MORS-Enabled: yes X-MORS-DOMAIN: patchwork.local X-MORS-HOSTING: hosting172546 X-MORS-USER: hosting172546 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= |
| Series |
clk: sunxi-ng: Add support for Allwinner A733 CCU and PRCM
|
|
Message
Junhui Liu
Sept. 29, 2026, 5:26 p.m. UTC
Add support for the main CCU and the PRCM module (R-CCU) found in the
Allwinner A733 SoC. The clock architecture is derived from the previous
A523 design, with the MCU_CCU removed and the clock tree extended for
the additional functional blocks found on the A733.
The A733 introduces a "pll-ref" clock that normalizes the physical
oscillator frequency, which can be 19.2MHz, 24MHz, or 26MHz, into a
consistent 24MHz reference for the PLL clock tree.
The peripheral, video, and DE PLLs provide multiple independently gated
outputs with programmable dividers. Model these outputs as separate
divider-and-gate child clocks. Also follow the documented hierarchy for
the derived peripheral PLL outputs. The explicitly named PLL_AUDIO1 /2
and /5 outputs are modeled as fixed-factor clocks, with their divider
fields initialized accordingly.
Also extend the sunxi-ng SDM (Sigma-Delta Modulation) support for the
dual-pattern register layout used by the A733 PLLs. PLL_AUDIO0 uses the
dual-pattern SDM support to synthesize its fractional output.
PLL_AUDIO1 does not expose fractional rates, but its SDM controls are
modeled so that stale settings left by firmware can be disabled when an
integer rate is programmed.
The actual parents of a small number of bus gates are not documented in
the user manual. Follow the vendor BSP and keep these gates parented to
"hosc" until more complete hardware information is available.
This series depends on the A523 single-divider clock fixes [1], which
add feature support to the M-only clock macro used by the MBUS and DRAM0
clocks. The prerequisite series has been applied to the
sunxi/clk-for-7.4 branch.
Link: https://patch.msgid.link/20260906-sunxi-clk-no-p-v1-0-cbde21c9fe69@pigmoral.tech [1]
Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech>
---
Changes in v5:
- Add the CLK_GIC binding ID, inserted after CLK_TRACE
- Add the GIC clock and mark it critical
- Fix the continuation line alignment of the trace clock
- Mark ahb-cpus critical
- Link to v4: https://patch.msgid.link/20260921-a733-clk-v4-0-9c184ebe9ac1@pigmoral.tech
Changes in v4:
- Model the MBUS and DRAM0 clocks as M-only clocks
- Base the series on the A523 single-divider clock fixes
- Link to v3: https://patch.msgid.link/20260905-a733-clk-v3-0-50f238f39c78@pigmoral.tech
Changes in v3:
- Patch 1: Rename the clock/reset binding headers with the allwinner vendor
prefix, use BSD-2-Clause for their dual license, and reorder the binding
properties according to the preferred schema layout
- Patches 1 and 4: Drop the undocumented 12X suffix from the video and DE
PLL core clock names and binding IDs
- Patch 2: Require all PAT1 enable bits to be set when checking whether SDM
is enabled
- Patch 4: Model the independently gated peripheral, video, and DE PLL
outputs as programmable-divider child clocks
- Patch 4: Follow the documented hierarchy for the derived peripheral PLL
outputs
- Patch 4: Model the explicitly named PLL_AUDIO1 /2 and /5 outputs as
fixed-factor clocks and initialize their divider fields accordingly
- Patch 4: Model the PLL_AUDIO1 SDM controls so stale firmware settings are
disabled when an integer rate is programmed
- Patch 4: Add the missing module device table and remove an unused include
- Patch 6: Replace the MP helpers used by timer clocks, which have no M
divider, with the corresponding P-only helpers
- Patch 7: Document the unresolved parents of bus gates kept on hosc and
fix the APB/AHB IOMMU1 system clock names
- Patches 3 and 8: Make the reset maps const
- Link to v2: https://patch.msgid.link/20260711-a733-clk-v2-0-974d188cbe0c@pigmoral.tech
Changes in v2:
- Rework the clocks property in DT bindings to source hosc directly from
the oscillator to adapt to the new RTC binding
- Clean up the SDM dual-pattern helper macro and add the missing enable
parameter for pll-audio0
- Number single-instance clocks with 0, e.g. GPU0, VE_ENC0/VE_DEC0,
DRAM0, NAND0, GPADC0, THS0, etc
- Correct 8x PLL post-divider names to 12x for video and DE PLLs
(pll-videoX-12x, pll-de-12x)
- Drop gic, cpu-peri, nsi clocks
- Rename clocks: OWA -> SPDIF, USB_REF -> USB01_REF, HDMI_ESM -> HDCP_ESM,
PWMCTRL -> PWM
- Mark bus-dram0, ahb-store and mbus-store critical to avoid DMA, MMC and
SPI NOR failures when unused clocks are disabled
- Switch PRCM timer clocks to P-only helpers
- Fix bus gate bit positions for UARTs and correct the sysdap register
address
- Interleave bus clocks into function clocks
- Link to v1: https://lore.kernel.org/r/20260310-a733-clk-v1-0-36b4e9b24457@pigmoral.tech
---
Junhui Liu (8):
dt-bindings: clk: sun60i-a733-ccu: Add Allwinner A733 support
clk: sunxi-ng: sdm: Add dual patterns support
clk: sunxi-ng: a733: Add PRCM CCU
clk: sunxi-ng: a733: Add PLL clocks support
clk: sunxi-ng: a733: Add bus clocks support
clk: sunxi-ng: a733: Add mod clocks support
clk: sunxi-ng: a733: Add bus clock gates
clk: sunxi-ng: a733: Add reset lines
.../bindings/clock/allwinner,sun60i-a733-ccu.yaml | 107 +
drivers/clk/sunxi-ng/Kconfig | 10 +
drivers/clk/sunxi-ng/Makefile | 4 +
drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 273 +++
drivers/clk/sunxi-ng/ccu-sun60i-a733.c | 2406 ++++++++++++++++++++
drivers/clk/sunxi-ng/ccu_sdm.c | 52 +-
drivers/clk/sunxi-ng/ccu_sdm.h | 29 +-
.../dt-bindings/clock/allwinner,sun60i-a733-ccu.h | 291 +++
.../clock/allwinner,sun60i-a733-r-ccu.h | 39 +
.../dt-bindings/reset/allwinner,sun60i-a733-ccu.h | 129 ++
.../reset/allwinner,sun60i-a733-r-ccu.h | 23 +
11 files changed, 3337 insertions(+), 26 deletions(-)
---
base-commit: e5e04726cdd043e309677071ab1b65a4b18f422b
change-id: 20260202-a733-clk-0d4fc00a9f9c
prerequisite-message-id: <20260906-sunxi-clk-no-p-v1-0-cbde21c9fe69@pigmoral.tech>
prerequisite-patch-id: 0df2ae41836b86fd868dfa01ddfde57f888f761a
prerequisite-patch-id: 88f3a431e7c551a9fa732f062188f10fdd362eeb
prerequisite-patch-id: 3e88bc873c909059d1199f82cda4013765e7a5e5
prerequisite-patch-id: 0dbc27cd7417352319a0705a051dff35085e8922
Best regards,
--
Junhui Liu <junhui.liu@pigmoral.tech>
Comments
Hi folks, Gentle ping on this series. It would be great if this could make it into v7.4, as other A733 drivers can then be developed on top of the clock/reset support provided by this series. On Wed Sep 30, 2026 at 1:26 AM CST, Junhui Liu wrote: > Add support for the main CCU and the PRCM module (R-CCU) found in the > Allwinner A733 SoC. The clock architecture is derived from the previous > A523 design, with the MCU_CCU removed and the clock tree extended for > the additional functional blocks found on the A733. > > The A733 introduces a "pll-ref" clock that normalizes the physical > oscillator frequency, which can be 19.2MHz, 24MHz, or 26MHz, into a > consistent 24MHz reference for the PLL clock tree. > > The peripheral, video, and DE PLLs provide multiple independently gated > outputs with programmable dividers. Model these outputs as separate > divider-and-gate child clocks. Also follow the documented hierarchy for > the derived peripheral PLL outputs. The explicitly named PLL_AUDIO1 /2 > and /5 outputs are modeled as fixed-factor clocks, with their divider > fields initialized accordingly. > > Also extend the sunxi-ng SDM (Sigma-Delta Modulation) support for the > dual-pattern register layout used by the A733 PLLs. PLL_AUDIO0 uses the > dual-pattern SDM support to synthesize its fractional output. > PLL_AUDIO1 does not expose fractional rates, but its SDM controls are > modeled so that stale settings left by firmware can be disabled when an > integer rate is programmed. > > The actual parents of a small number of bus gates are not documented in > the user manual. Follow the vendor BSP and keep these gates parented to > "hosc" until more complete hardware information is available. > > This series depends on the A523 single-divider clock fixes [1], which > add feature support to the M-only clock macro used by the MBUS and DRAM0 > clocks. The prerequisite series has been applied to the > sunxi/clk-for-7.4 branch. > > Link: https://patch.msgid.link/20260906-sunxi-clk-no-p-v1-0-cbde21c9fe69@pigmoral.tech [1] > Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech> > --- > Changes in v5: > - Add the CLK_GIC binding ID, inserted after CLK_TRACE > - Add the GIC clock and mark it critical > - Fix the continuation line alignment of the trace clock > - Mark ahb-cpus critical > - Link to v4: https://patch.msgid.link/20260921-a733-clk-v4-0-9c184ebe9ac1@pigmoral.tech > > Changes in v4: > - Model the MBUS and DRAM0 clocks as M-only clocks > - Base the series on the A523 single-divider clock fixes > - Link to v3: https://patch.msgid.link/20260905-a733-clk-v3-0-50f238f39c78@pigmoral.tech > > Changes in v3: > - Patch 1: Rename the clock/reset binding headers with the allwinner vendor > prefix, use BSD-2-Clause for their dual license, and reorder the binding > properties according to the preferred schema layout > - Patches 1 and 4: Drop the undocumented 12X suffix from the video and DE > PLL core clock names and binding IDs > - Patch 2: Require all PAT1 enable bits to be set when checking whether SDM > is enabled > - Patch 4: Model the independently gated peripheral, video, and DE PLL > outputs as programmable-divider child clocks > - Patch 4: Follow the documented hierarchy for the derived peripheral PLL > outputs > - Patch 4: Model the explicitly named PLL_AUDIO1 /2 and /5 outputs as > fixed-factor clocks and initialize their divider fields accordingly > - Patch 4: Model the PLL_AUDIO1 SDM controls so stale firmware settings are > disabled when an integer rate is programmed > - Patch 4: Add the missing module device table and remove an unused include > - Patch 6: Replace the MP helpers used by timer clocks, which have no M > divider, with the corresponding P-only helpers > - Patch 7: Document the unresolved parents of bus gates kept on hosc and > fix the APB/AHB IOMMU1 system clock names > - Patches 3 and 8: Make the reset maps const > - Link to v2: https://patch.msgid.link/20260711-a733-clk-v2-0-974d188cbe0c@pigmoral.tech > > Changes in v2: > - Rework the clocks property in DT bindings to source hosc directly from > the oscillator to adapt to the new RTC binding > - Clean up the SDM dual-pattern helper macro and add the missing enable > parameter for pll-audio0 > - Number single-instance clocks with 0, e.g. GPU0, VE_ENC0/VE_DEC0, > DRAM0, NAND0, GPADC0, THS0, etc > - Correct 8x PLL post-divider names to 12x for video and DE PLLs > (pll-videoX-12x, pll-de-12x) > - Drop gic, cpu-peri, nsi clocks > - Rename clocks: OWA -> SPDIF, USB_REF -> USB01_REF, HDMI_ESM -> HDCP_ESM, > PWMCTRL -> PWM > - Mark bus-dram0, ahb-store and mbus-store critical to avoid DMA, MMC and > SPI NOR failures when unused clocks are disabled > - Switch PRCM timer clocks to P-only helpers > - Fix bus gate bit positions for UARTs and correct the sysdap register > address > - Interleave bus clocks into function clocks > - Link to v1: https://lore.kernel.org/r/20260310-a733-clk-v1-0-36b4e9b24457@pigmoral.tech > > --- > Junhui Liu (8): > dt-bindings: clk: sun60i-a733-ccu: Add Allwinner A733 support > clk: sunxi-ng: sdm: Add dual patterns support > clk: sunxi-ng: a733: Add PRCM CCU > clk: sunxi-ng: a733: Add PLL clocks support > clk: sunxi-ng: a733: Add bus clocks support > clk: sunxi-ng: a733: Add mod clocks support > clk: sunxi-ng: a733: Add bus clock gates > clk: sunxi-ng: a733: Add reset lines > > .../bindings/clock/allwinner,sun60i-a733-ccu.yaml | 107 + > drivers/clk/sunxi-ng/Kconfig | 10 + > drivers/clk/sunxi-ng/Makefile | 4 + > drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 273 +++ > drivers/clk/sunxi-ng/ccu-sun60i-a733.c | 2406 ++++++++++++++++++++ > drivers/clk/sunxi-ng/ccu_sdm.c | 52 +- > drivers/clk/sunxi-ng/ccu_sdm.h | 29 +- > .../dt-bindings/clock/allwinner,sun60i-a733-ccu.h | 291 +++ > .../clock/allwinner,sun60i-a733-r-ccu.h | 39 + > .../dt-bindings/reset/allwinner,sun60i-a733-ccu.h | 129 ++ > .../reset/allwinner,sun60i-a733-r-ccu.h | 23 + > 11 files changed, 3337 insertions(+), 26 deletions(-) > --- > base-commit: e5e04726cdd043e309677071ab1b65a4b18f422b > change-id: 20260202-a733-clk-0d4fc00a9f9c > prerequisite-message-id: <20260906-sunxi-clk-no-p-v1-0-cbde21c9fe69@pigmoral.tech> > prerequisite-patch-id: 0df2ae41836b86fd868dfa01ddfde57f888f761a > prerequisite-patch-id: 88f3a431e7c551a9fa732f062188f10fdd362eeb > prerequisite-patch-id: 3e88bc873c909059d1199f82cda4013765e7a5e5 > prerequisite-patch-id: 0dbc27cd7417352319a0705a051dff35085e8922 > > Best regards, > -- > Junhui Liu <junhui.liu@pigmoral.tech>
On Wed, Sep 30, 2026 at 1:27 AM Junhui Liu <junhui.liu@pigmoral.tech> wrote: > > Add support for the main CCU and the PRCM module (R-CCU) found in the > Allwinner A733 SoC. The clock architecture is derived from the previous > A523 design, with the MCU_CCU removed and the clock tree extended for > the additional functional blocks found on the A733. > > The A733 introduces a "pll-ref" clock that normalizes the physical > oscillator frequency, which can be 19.2MHz, 24MHz, or 26MHz, into a > consistent 24MHz reference for the PLL clock tree. > > The peripheral, video, and DE PLLs provide multiple independently gated > outputs with programmable dividers. Model these outputs as separate > divider-and-gate child clocks. Also follow the documented hierarchy for > the derived peripheral PLL outputs. The explicitly named PLL_AUDIO1 /2 > and /5 outputs are modeled as fixed-factor clocks, with their divider > fields initialized accordingly. > > Also extend the sunxi-ng SDM (Sigma-Delta Modulation) support for the > dual-pattern register layout used by the A733 PLLs. PLL_AUDIO0 uses the > dual-pattern SDM support to synthesize its fractional output. > PLL_AUDIO1 does not expose fractional rates, but its SDM controls are > modeled so that stale settings left by firmware can be disabled when an > integer rate is programmed. Some of the clock controls, like the PLL and AHB/APB bus dividers, are secure by default and need to be set to non-secure for Linux to be able to use them properly. And there is also a TWD clock in the PRCM that the user manual says is secure only. Have you given any thought to this? If we end up having to convert to SCMI or something to handle those clocks it's going to be a bit ugly. And presumably things work now because the secure/non-secure access bit isn't in effect right now because you aren't using secure boot? At least this was a thing in the past... Thanks ChenYu > The actual parents of a small number of bus gates are not documented in > the user manual. Follow the vendor BSP and keep these gates parented to > "hosc" until more complete hardware information is available. > > This series depends on the A523 single-divider clock fixes [1], which > add feature support to the M-only clock macro used by the MBUS and DRAM0 > clocks. The prerequisite series has been applied to the > sunxi/clk-for-7.4 branch. > > Link: https://patch.msgid.link/20260906-sunxi-clk-no-p-v1-0-cbde21c9fe69@pigmoral.tech [1] > Signed-off-by: Junhui Liu <junhui.liu@pigmoral.tech> > --- > Changes in v5: > - Add the CLK_GIC binding ID, inserted after CLK_TRACE > - Add the GIC clock and mark it critical > - Fix the continuation line alignment of the trace clock > - Mark ahb-cpus critical > - Link to v4: https://patch.msgid.link/20260921-a733-clk-v4-0-9c184ebe9ac1@pigmoral.tech > > Changes in v4: > - Model the MBUS and DRAM0 clocks as M-only clocks > - Base the series on the A523 single-divider clock fixes > - Link to v3: https://patch.msgid.link/20260905-a733-clk-v3-0-50f238f39c78@pigmoral.tech > > Changes in v3: > - Patch 1: Rename the clock/reset binding headers with the allwinner vendor > prefix, use BSD-2-Clause for their dual license, and reorder the binding > properties according to the preferred schema layout > - Patches 1 and 4: Drop the undocumented 12X suffix from the video and DE > PLL core clock names and binding IDs > - Patch 2: Require all PAT1 enable bits to be set when checking whether SDM > is enabled > - Patch 4: Model the independently gated peripheral, video, and DE PLL > outputs as programmable-divider child clocks > - Patch 4: Follow the documented hierarchy for the derived peripheral PLL > outputs > - Patch 4: Model the explicitly named PLL_AUDIO1 /2 and /5 outputs as > fixed-factor clocks and initialize their divider fields accordingly > - Patch 4: Model the PLL_AUDIO1 SDM controls so stale firmware settings are > disabled when an integer rate is programmed > - Patch 4: Add the missing module device table and remove an unused include > - Patch 6: Replace the MP helpers used by timer clocks, which have no M > divider, with the corresponding P-only helpers > - Patch 7: Document the unresolved parents of bus gates kept on hosc and > fix the APB/AHB IOMMU1 system clock names > - Patches 3 and 8: Make the reset maps const > - Link to v2: https://patch.msgid.link/20260711-a733-clk-v2-0-974d188cbe0c@pigmoral.tech > > Changes in v2: > - Rework the clocks property in DT bindings to source hosc directly from > the oscillator to adapt to the new RTC binding > - Clean up the SDM dual-pattern helper macro and add the missing enable > parameter for pll-audio0 > - Number single-instance clocks with 0, e.g. GPU0, VE_ENC0/VE_DEC0, > DRAM0, NAND0, GPADC0, THS0, etc > - Correct 8x PLL post-divider names to 12x for video and DE PLLs > (pll-videoX-12x, pll-de-12x) > - Drop gic, cpu-peri, nsi clocks > - Rename clocks: OWA -> SPDIF, USB_REF -> USB01_REF, HDMI_ESM -> HDCP_ESM, > PWMCTRL -> PWM > - Mark bus-dram0, ahb-store and mbus-store critical to avoid DMA, MMC and > SPI NOR failures when unused clocks are disabled > - Switch PRCM timer clocks to P-only helpers > - Fix bus gate bit positions for UARTs and correct the sysdap register > address > - Interleave bus clocks into function clocks > - Link to v1: https://lore.kernel.org/r/20260310-a733-clk-v1-0-36b4e9b24457@pigmoral.tech > > --- > Junhui Liu (8): > dt-bindings: clk: sun60i-a733-ccu: Add Allwinner A733 support > clk: sunxi-ng: sdm: Add dual patterns support > clk: sunxi-ng: a733: Add PRCM CCU > clk: sunxi-ng: a733: Add PLL clocks support > clk: sunxi-ng: a733: Add bus clocks support > clk: sunxi-ng: a733: Add mod clocks support > clk: sunxi-ng: a733: Add bus clock gates > clk: sunxi-ng: a733: Add reset lines > > .../bindings/clock/allwinner,sun60i-a733-ccu.yaml | 107 + > drivers/clk/sunxi-ng/Kconfig | 10 + > drivers/clk/sunxi-ng/Makefile | 4 + > drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 273 +++ > drivers/clk/sunxi-ng/ccu-sun60i-a733.c | 2406 ++++++++++++++++++++ > drivers/clk/sunxi-ng/ccu_sdm.c | 52 +- > drivers/clk/sunxi-ng/ccu_sdm.h | 29 +- > .../dt-bindings/clock/allwinner,sun60i-a733-ccu.h | 291 +++ > .../clock/allwinner,sun60i-a733-r-ccu.h | 39 + > .../dt-bindings/reset/allwinner,sun60i-a733-ccu.h | 129 ++ > .../reset/allwinner,sun60i-a733-r-ccu.h | 23 + > 11 files changed, 3337 insertions(+), 26 deletions(-) > --- > base-commit: e5e04726cdd043e309677071ab1b65a4b18f422b > change-id: 20260202-a733-clk-0d4fc00a9f9c > prerequisite-message-id: <20260906-sunxi-clk-no-p-v1-0-cbde21c9fe69@pigmoral.tech> > prerequisite-patch-id: 0df2ae41836b86fd868dfa01ddfde57f888f761a > prerequisite-patch-id: 88f3a431e7c551a9fa732f062188f10fdd362eeb > prerequisite-patch-id: 3e88bc873c909059d1199f82cda4013765e7a5e5 > prerequisite-patch-id: 0dbc27cd7417352319a0705a051dff35085e8922 > > Best regards, > -- > Junhui Liu <junhui.liu@pigmoral.tech> > >
Hi ChenYu, > And presumably things work now because the secure/non-secure access bit > isn't in effect right now because you aren't using secure boot? Yes, on our side. One data point from a single board type, Radxa Cubie A7S, two boards. The measurements and this summary were done by AI agents (Claude) working on my boards, so please read it as a report, not as a Tested-by. - Secure boot is not enabled on these boards: SID + 0xA0 (0x030060A0, SID_SECURE_MODE in the vendor boot0 sources; the UM does not describe the SID) reads 0 on both. The notes under PRCM_SEC_SWITCH_REG (UM V1.00 4.2.5.26) say these registers are always non-secure when the system is in non-security mode. - The vendor BL31 blob in Radxa's u-boot package (v2.5) opens the switches at boot: PRCM_SEC_SWITCH_REG |= 0x7, then 0x7 to CCMU_SEC_SWITCH_REG at 0x02003F00. TF-A's sunxi_security_setup() does the same for the H6/H616. - On the A733, CCMU_SEC_SWITCH_REG is at CCU + 0x1F00 (UM 4.1.6.278), not 0x0F00 as on the H6/H616; here 0x0F00 is SPI0_CLK_REG (UM 4.1.6.160). The A733 TF-A port at github.com/dlan17/trusted-firmware-a (branch A733, f4c0b0dba, the commit Radxa's package pins) still uses 0x0F00. On one of our boards the 0x7 ended up in SPI0_CLK_REG until we moved it to 0x1F00. - TWD: UM 4.2.5.9 marks S_TWD_BGR_REG as fixed secure. We have not measured it. Boot chain on these boards: vendor boot0 (DRAM init), U-Boot SPL and U-Boot from Radxa's A733 tree with a few board patches, TF-A lts-v2.12.15 with the A733 port above plus our fixes. Thanks, Norman
Hi Chen-Yu, On Sat Oct 3, 2026 at 9:37 PM CST, Chen-Yu Tsai wrote: > On Wed, Sep 30, 2026 at 1:27 AM Junhui Liu <junhui.liu@pigmoral.tech> wrote: >> >> Add support for the main CCU and the PRCM module (R-CCU) found in the >> Allwinner A733 SoC. The clock architecture is derived from the previous >> A523 design, with the MCU_CCU removed and the clock tree extended for >> the additional functional blocks found on the A733. >> >> The A733 introduces a "pll-ref" clock that normalizes the physical >> oscillator frequency, which can be 19.2MHz, 24MHz, or 26MHz, into a >> consistent 24MHz reference for the PLL clock tree. >> >> The peripheral, video, and DE PLLs provide multiple independently gated >> outputs with programmable dividers. Model these outputs as separate >> divider-and-gate child clocks. Also follow the documented hierarchy for >> the derived peripheral PLL outputs. The explicitly named PLL_AUDIO1 /2 >> and /5 outputs are modeled as fixed-factor clocks, with their divider >> fields initialized accordingly. >> >> Also extend the sunxi-ng SDM (Sigma-Delta Modulation) support for the >> dual-pattern register layout used by the A733 PLLs. PLL_AUDIO0 uses the >> dual-pattern SDM support to synthesize its fractional output. >> PLL_AUDIO1 does not expose fractional rates, but its SDM controls are >> modeled so that stale settings left by firmware can be disabled when an >> integer rate is programmed. > > Some of the clock controls, like the PLL and AHB/APB bus dividers, are > secure by default and need to be set to non-secure for Linux to be able > to use them properly. And there is also a TWD clock in the PRCM that the > user manual says is secure only. > > Have you given any thought to this? If we end up having to convert to > SCMI or something to handle those clocks it's going to be a bit ugly. > > And presumably things work now because the secure/non-secure access bit > isn't in effect right now because you aren't using secure boot? At least > this was a thing in the past... > Thanks for pointing this out. This is indeed something I had not considered before. I will try enabling secure boot on my spare Cubie A7Z board and test it on actual hardware. For the PLL and AHB/APB bus clock controls, the user manual indicates that the relevant security bits can be set by TF-A to allow the kernel to access these registers. This also appears to be how this has traditionally been handled on sunxi platforms. So I think we can do the same in TF-A for the A733. For bus_r_twd_clk, I will test whether the register is indeed always secure. If it is, I think the clock can be removed from the kernel and left enabled by its hardware reset value or by the boot firmware. > > Thanks > ChenYu >
Hi Junhui, > Thanks for pointing this out. This is indeed something I had not > considered before. I will try enabling secure boot on my spare Cubie A7Z > board and test it on actual hardware. First a correction to my earlier reply in this thread. I answered ChenYu's "presumably ... the secure/non-secure access bit isn't in effect" with "yes" and quoted the UM note that these registers are always non-secure in non-security mode. On our non-fused A7S boards (SID + 0xA0 = 0, also when read from EL3) that does not hold for every register. Read from EL3 with a test BL31, CCMU_SEC_SWITCH_REG is 0x7 after BL31's security setup, S_TWD_BGR_REG is 0x1 and the SPC status registers are 0xffffffff, but from non-secure all of them read 0, and non-secure writes to the first two do not stick. So secure filtering is active on these parts even without the fuse. > For the PLL and AHB/APB bus clock controls, the user manual indicates > that the relevant security bits can be set by TF-A to allow the kernel > to access these registers. This also appears to be how this has > traditionally been handled on sunxi platforms. So I think we can do the > same in TF-A for the A733. That is what the BL31 on our boards does: PRCM_SEC_SWITCH_REG |= 0x7 and 0x7 to CCMU_SEC_SWITCH_REG at CCU + 0x1F00, as the vendor BL31 does. From EL3 both read 0 before and 0x7 after. The 0x1F00 versus 0x0F00 trap in the A733 TF-A port is in my first reply. > For bus_r_twd_clk, I will test whether the register is indeed always > secure. If it is, I think the clock can be removed from the kernel and > left enabled by its hardware reset value or by the boot firmware. On our non-fused boards it is already inaccessible from the non-secure side (reads 0, writes ignored). From EL3 it reads 0x1, the UM default, so the gate is open. Details are in my reply to ChenYu on patch 3/8, which crossed with yours. Same boards and caveats as before: AI agents (Claude) on my boards, a report, not a Tested-by. Thanks, Norman
Hi Norman, Thanks for testing this. You saved my A7Z board from an almost certain sacrifice. :) On Sat Oct 3, 2026 at 11:05 PM CST, Norman Herms wrote: > Hi Junhui, > >> Thanks for pointing this out. This is indeed something I had not >> considered before. I will try enabling secure boot on my spare Cubie A7Z >> board and test it on actual hardware. > > First a correction to my earlier reply in this thread. I answered > ChenYu's "presumably ... the secure/non-secure access bit isn't in > effect" with "yes" and quoted the UM note that these registers are > always non-secure in non-security mode. On our non-fused A7S boards > (SID + 0xA0 = 0, also when read from EL3) that does not hold for every > register. Read from EL3 with a test BL31, CCMU_SEC_SWITCH_REG is 0x7 > after BL31's security setup, S_TWD_BGR_REG is 0x1 and the SPC status > registers are 0xffffffff, but from non-secure all of them read 0, and > non-secure writes to the first two do not stick. So secure filtering > is active on these parts even without the fuse. I will double-check this on my side and add the relevant comments as Chen-Yu suggested. > >> For the PLL and AHB/APB bus clock controls, the user manual indicates >> that the relevant security bits can be set by TF-A to allow the kernel >> to access these registers. This also appears to be how this has >> traditionally been handled on sunxi platforms. So I think we can do the >> same in TF-A for the A733. > > That is what the BL31 on our boards does: PRCM_SEC_SWITCH_REG |= 0x7 > and 0x7 to CCMU_SEC_SWITCH_REG at CCU + 0x1F00, as the vendor BL31 > does. From EL3 both read 0 before and 0x7 after. The 0x1F00 versus > 0x0F00 trap in the A733 TF-A port is in my first reply. > >> For bus_r_twd_clk, I will test whether the register is indeed always >> secure. If it is, I think the clock can be removed from the kernel and >> left enabled by its hardware reset value or by the boot firmware. > > On our non-fused boards it is already inaccessible from the non-secure > side (reads 0, writes ignored). From EL3 it reads 0x1, the UM default, > so the gate is open. Details are in my reply to ChenYu on patch 3/8, > which crossed with yours. Understood. This bus gate is therefore not meaningful to the kernel, so I will remove the clock in the next version. > > Same boards and caveats as before: AI agents (Claude) on my boards, a > report, not a Tested-by. > > Thanks, > Norman