| Message ID | 20261112-a733-fwclk-v2@gmail.com (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-27571-sunxi=pue.re@lists.linux.dev>
X-Original-To: noreply@patchwork.local
Delivered-To: noreply@patchwork.local
Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mxe881.netcup.net (Postfix) with ESMTPS id 6CF1F1C096A
for <noreply@patchwork.local>; Fri, 13 Nov 2026 02:05:22 +0100 (CET)
Authentication-Results: mxe881;
dkim=pass header.d=gmail.com;
spf=pass (sender IP is 104.64.211.4)
smtp.mailfrom=linux-sunxi+bounces-27571-noreply=patchwork.local@lists.linux.dev
smtp.helo=sin.lore.kernel.org
Received-SPF: pass (mxe881: domain of lists.linux.dev designates 104.64.211.4
as permitted sender) client-ip=104.64.211.4;
envelope-from=linux-sunxi+bounces-27571-noreply=patchwork.local@lists.linux.dev;
helo=sin.lore.kernel.org;
Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org
[100.77.114.92])
by sin.lore.kernel.org (Postfix) with ESMTP id CF3451C4A23
for <noreply@patchwork.local>; Thu, 12 Nov 2026 21:38:25 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1794519494;
b=YPi56BmxyB9Ulu6eISyJOYXIvOvmqoFvv05vuCfD0o35Mv62N+51F25n2OzpllzE1SoQ
a/uv3zkeJT8ecF3LFvKegSR56gInlZ4F9caPxW1vxBHmzyiw2bi0vlKABflVBWZ45lZqh
p/8NDppnF3WxItDM85qMpzH1S/zSiIyZjJPq8+v/164gL2vX3UorBVnsXUpXACosRR6+J
ZJyKWQApOb5T8PSejtcKk+LURUtIICbtwtEWJp/+ZQw/KbkZhDXLuskB7eOYPznPcabiE
6rYnIb9LoV7bIYUHkCHzYqObgE/1awcvjbvZ8KnhOvnVkiUTzXUwkkZf8iPCeqUsMTw==
ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794519494;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=EaGxXuKjbqWsjiNJFFTn53rRjYcJvhNf+ZE9bk47lFk=;
b=KqtlTJntIkCZdNF7Yho4A8pjoUYAKwRE0QFccKjAysbbjwoaEZ9mPfJHiMiEQ9NDspVK
Vy42VfZ80Hr8IVVss1R5PDQHdNH9R6nHFUfVHNCSZT5uD0rR6ORFMnn6lpx+9e7LNpoMa
EHwl00cv746QczbTGKrZkc1Jou1hT8c99D0nAirSXLPz7TrPrPqM+35CPzINYNlkPQ/33
Te0B/hGQlnXqafpLaVOrg40KCvEUPmZCk92LmW3zyfMMY/v+rACDeO//+MoSSWlC2woO4
XvfHjDwqRVj6Vv18cYUyITqlG9mE12mqcaCm8efdlin4bIgQadrDx0WNHrziE8M9mFw==
ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
header.s=20260707 header.b=MbdBOQiU;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 7B350606A882;
Thu, 12 Nov 2026 21:38:14 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com
header.a=rsa-sha256 header.s=20260707 header.b=MbdBOQiU
X-Original-To: linux-sunxi@lists.linux.dev
Authentication-Results: smtp.subspace.kernel.org;
arc=none smtp.remote-ip=209.85.161.50
ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1794519494;
b=KuWUSC7qYGlXMxZfNsOJNEWt8/30/Yby8ImSvTOCXF8/bnzAPnIIEyogF8tcPYFqa/EX
+uVJu82JcfdYmXiRJxdESEenOZ4ZaFj0d93N8qtomm2A8prXO2n2FPLFGHSbT7nGPqvgv
HDOKa+eF9/VrcdInLqnQUOs6TYk7mxCFg2odWZkSMzkjBzp6Q+mYjqKuvUTLWt87Nwzkc
0Tk/yhWyp6JTRPipR8Ct0TL01FKhq5DT6lXvJPgdc9tv+zmJDg7ZSNHX7b6keddNOzw8R
+KWAR/9foPeWgpndjXqb0W4lXMpTVIaL8yJiVGRVFg5nXLu1P3q9TFvxOH0h1D6nMJA==
ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1794519494;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
Content-Transfer-Encoding;
bh=EaGxXuKjbqWsjiNJFFTn53rRjYcJvhNf+ZE9bk47lFk=;
b=5DhgU7V7G3/1jYEyp0agTn4noic2NHtL73dFLkNKjyzP8d49H5C0SCvKPy1+kmRmEiIR
/ibikvANhAFXHmCdqxYUtVlxlIqyW3vSDoajPkYxLwNROj4ELbvmF0Rehy/H6tQSkwpcK
nuxjQ1+U/kaV5Ljudbg3xWk8p1QneuVU8clfnsxmlgPXjyF5GpqjyB1YBbrMEjzMcilmw
glWKWHRh4rFBh6XNNiZZXp/XBteh+X6pcCPdBk5AfECaPsXcyfT06SYWYMHWNnVMb052b
OVojfRnApsqN+nVKFSxNHqRVv6t8MEdVWcGhIpck1bKgsZR5bQv0DE5yz4hJ5V54RIQ==
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256
header.s=20260707 header.b=MbdBOQiU;
arc=none smtp.remote-ip=209.85.161.50
Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com
[209.85.161.50])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest
SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9903606A33F
for <linux-sunxi@lists.linux.dev>; Thu, 12 Nov 2026 21:38:13 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B9903606A33F
Authentication-Results: smtp.subspace.kernel.org;
dmarc=pass (p=none dis=none) header.from=gmail.com
Authentication-Results: smtp.subspace.kernel.org;
spf=pass smtp.mailfrom=gmail.com
Received: by mail-oo1-f50.google.com with SMTP id
006d021491bc7-6f8a519e215so480975eaf.1
for <linux-sunxi@lists.linux.dev>;
Thu, 12 Nov 2026 13:38:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1794519493; x=1795124293;
darn=lists.linux.dev;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=EaGxXuKjbqWsjiNJFFTn53rRjYcJvhNf+ZE9bk47lFk=;
b=MbdBOQiUuoXo/reoGucp7hbbWBVKwU0fLCArw7mxmHjb3QdKZmtf2w/VXOZWXB1dKd
KZGA0IjpiLwV5Df9KpEPdO+CVhFfdzF5LCf6dPGuvDa0EqbAZLL5PsQqJYKQEnUnfIQ9
dSaywXkzo6mcgQWnHc58oy7doBPcVWvErGjbC/gsyGuq9w3CeYPvRvYOfWfPcg8mw3Lr
p4BOw7/0OcXZi7rXs6kWZLp3Txsd+Qy8JnqGgBxvHL92oDRThVy5Px3pvQFJZp5DMhOh
bEg3Aj34cVhXOSZ70G3Y8fbFS1mwwlREOsyqHlLuVrKpPHNrHSadAnfsPrg+jeim818+
vN/A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1794519493; x=1795124293;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=EaGxXuKjbqWsjiNJFFTn53rRjYcJvhNf+ZE9bk47lFk=;
b=flfXcX328LCGn4/Hucy9l3WxeClPrkHuqYUX52ouCoAk6RDCP9VRzdkOQ9O8n2cksC
abW0m0DdavRvvQb6vxvxc+pmjAD3VvXLiNvqPE3qmnnR0XJe1eTtyS8mS9FJsLbGzecM
mjDVe7bRsKVi3fS+HtfOItKyaTXxHwpQVwg96HfTOmPir3Csn+lrPe3P5OuuSxT1ZLz4
qR3UiosY8bpweV3OF/1Zy2Wsw92iVHfD5SqiGupiyTaqFx5d1f5HPyiQfBfr9B6dnEGY
uYfl8M4qE7azk4ioJaGOolmkFjMgk8phbm4+eZVamB2BQzOlB0C99X30JDev/FqLkZhw
o8wg==
X-Forwarded-Encrypted: i=1;
AL+hErE63Tb3hVMFMqWXZXZWlULUoryyjcghIDzQ6u1FzowG47VVwy6yZdWERdQQzGG5OlHe5pp6zsUkx62VRQ==@lists.linux.dev
X-Gm-Message-State: APuU4Z+eqUD4nIhvpT2yuDe+gG5l8rACSkrrFnUkKHbOVp00uM8mtksq
Da53qTowQnT3Bec+54haRu8uaBsB8LTzYCXEm3YT8rCQW45kUhtj4gY7
X-Gm-Gg: AYBFou1Nu6naYZE6fMVIWn6Istu+CeyN75hvFKI81kqxQM+vmuZ9aFAGlcF+seU+q8H
CFZG0GhqGvAspuBtjVj2ifIIBj7NS94feSSVYfFWk29mTIkCq7u248ALLzq279HhIzjj1297jhT
TOyXaD/EkCMw2buSbqL31NUopoLVIpWdG0uLYcEJQ9sWKU/WxbN+8I3kghWmicsDwiLcb39GYwA
7tmep8/r8jUnnGbtBeI+XkiePoZXklpL9HU+NhjFAwNGFbwKYIbtEcxV6PcFJnDgK3EGgDMW7yp
OLDJD5wACf9jkvl6d3v9MJmZ5+wRN1YHLBnSagD1rL3o/Ae4QiWfpU47uOmssHEyQPZ10DD+DXi
0t0UDXq/+S6CjiFmTP2mzQN/Eur7FcC7jSmYkNEstpoS6/MC5fH/EVp8b6gPZL6GyBphrcwAV3E
ahQKD9k7bDj5d4X2xOJWR9u5TUFmNc5INwOrWvUYgRXUHPpFekSgBPx5uLfkP0RSiBqVKoFvWkX
h1JeK1fj2gS75Bn4BkLjVCwXBk1DEWHLuX9SSVtEFQMzs361c8ZanOnrYUnKG+d0G9tu+u2uL5a
j2XaFn8zatVBvnHRCXoWHc/DXEgw9KUnWUlzRc7Fe7tgvjm+IJynguOjnz+pJv7lOBrsGHR/uLC
sSGkA
X-Received: by 2002:a05:6820:f02d:b0:6d3:abd1:9b8e with SMTP id
006d021491bc7-7197cf224d0mr2811908eaf.52.1794519492651;
Thu, 12 Nov 2026 13:38:12 -0800 (PST)
Received: from AMD.home.internal (dhcp-9-244-8-156.gobrightspeed.net.
[9.244.8.156])
by smtp.gmail.com with ESMTPSA id
586e51a60fabf-4afe229b9d1sm234017fac.11.2026.11.12.13.38.10
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 12 Nov 2026 13:38:11 -0800 (PST)
From: Enzo Adriano <enzo.adriano.code@gmail.com>
To: sboyd@kernel.org,
bmasney+clk@redhat.com,
jbrunet+clk@baylibre.com,
wens@kernel.org,
jernej.skrabec@gmail.com,
samuel@sholland.org
Cc: Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-clk@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev,
linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org,
Junhui Liu <junhui.liu@pigmoral.tech>,
Andre Przywara <andre.przywara@arm.com>,
Vinicius Pedrosa <vinicius.eduardo.pedrosa@gmail.com>
Subject: [PATCH v2] clk: sunxi-ng: a733: Keep SCP firmware bus clocks enabled
Date: Thu, 12 Nov 2026 16:38:09 -0500
Message-ID: <20261112-a733-fwclk-v2@gmail.com>
X-Mailer: git-send-email 2.53.0
X-Mailing-List: linux-sunxi@lists.linux.dev
List-Id: <linux-sunxi.lists.linux.dev>
List-Post: <mailto:linux-sunxi@lists.linux.dev>
List-Help: <mailto:linux-sunxi+help@lists.linux.dev>
List-Subscribe: <mailto:linux-sunxi+subscribe@lists.linux.dev>
List-Unsubscribe: <mailto:linux-sunxi+unsubscribe@lists.linux.dev>
List-Owner: <mailto:linux-sunxi+owner@lists.linux.dev>
Precedence: list
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Rspamd-Server: rspamd-worker-8404
X-Spamd-Result: default: False [-0.69 / 15.00];
BAYES_HAM(-5.50)[100.00%];
RBL_SENDERSCORE(2.00)[104.64.211.4:from];
SUSPICIOUS_RECIPS(1.50)[];
DMARC_POLICY_SOFTFAIL(1.00)[gmail.com : SPF not aligned (relaxed),
No valid DKIM,none];
R_MISSING_CHARSET(0.50)[];
MAILLIST(-0.18)[generic];
MIME_GOOD(-0.10)[text/plain];
BAD_REP_POLICIES(0.10)[];
HAS_LIST_UNSUB(-0.01)[];
DBL_BLOCKED_OPENRESOLVER(0.00)[sin.lore.kernel.org:helo,sin.lore.kernel.org:rdns];
FORGED_SENDER_MAILLIST(0.00)[];
RCVD_COUNT_FIVE(0.00)[6];
RCPT_COUNT_TWELVE(0.00)[18];
FROM_HAS_DN(0.00)[];
FREEMAIL_CC(0.00)[kernel.org,dabbelt.com,eecs.berkeley.edu,ghiti.fr,vger.kernel.org,lists.infradead.org,lists.linux.dev,pigmoral.tech,arm.com,gmail.com];
TAGGED_RCPT(0.00)[clk];
FROM_NEQ_ENVFROM(0.00)[enzoadrianocode@gmail.com,linux-sunxi@lists.linux.dev];
ASN(0.00)[asn:63949, ipnet:104.64.192.0/19, country:SG];
MID_RHS_MATCH_FROM(0.00)[];
TO_DN_SOME(0.00)[];
FREEMAIL_FROM(0.00)[gmail.com];
RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[100.77.114.92:received,209.85.161.50:received,9.244.8.156:received];
RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[104.64.211.4:from];
TAGGED_FROM(0.00)[bounces-27571-noreply=patchwork.local];
R_SPF_ALLOW(0.00)[+ip4:104.64.211.4];
FORGED_RECIPIENTS_MAILLIST(0.00)[];
ARC_ALLOW(0.00)[subspace.kernel.org:s=arc20261015:i=2];
FREEMAIL_TO(0.00)[kernel.org,redhat.com,baylibre.com,gmail.com,sholland.org];
RCVD_TLS_LAST(0.00)[];
MIME_TRACE(0.00)[0:+];
RCVD_VIA_SMTP_AUTH(0.00)[]
X-Rspamd-Queue-Id: 6CF1F1C096A
X-MORS-Enabled: yes
X-MORS-DOMAIN: patchwork.local
X-MORS-HOSTING: hosting172546
X-MORS-USER: hosting172546
X-getmail-retrieved-from-mailbox: INBOX
|
| Series |
[v2] clk: sunxi-ng: a733: Keep SCP firmware bus clocks enabled
|
|
Commit Message
Enzo Adriano
Nov. 12, 2026, 9:38 p.m. UTC
The A733 PRCM's bus-r-riscv and bus-r-msgbox gates have no Linux
consumers, so unused-clock cleanup gates them. With vendor SCP firmware
running on the E902 as shipped on Cubie A7S, warm reboot then stalls.
Keep both critical until remoteproc/mailbox drivers can claim them.
This follows A523 bus-r-cpucfg in commit 1dba74abf3e2 ("clk: sunxi-ng:
Mark A523 bus-r-cpucfg clock as critical") and the temporary SCPI firmware
clock protection for Meson AXG fclk_div3 in drivers/clk/meson/axg.c.
On Cubie A7S with vendor boot0/BL31/SCP/U-Boot and without
clk_ignore_unused, warm reboot returns with both clocks critical and
stalls without them. Vinicius found either flag alone insufficient on
Cubie A7Z. Power-off, suspend, single flags on A7S, other
boards/firmware and upstream TF-A were not tested.
Link: https://lore.kernel.org/r/20261005183038.417798-1-vinicius.eduardo.pedrosa@gmail.com
Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com>
---
Changes in v2:
- Drop r-timer0, bus-r-timer and bus-msgbox0: A7S warm reboot works with
these at 0/0. Keep only the two E902/mailbox bus gates after Junhui's
review, pending remoteproc/mailbox ownership.
- Rebase on CCU v7; its PRCM clock definitions are unchanged from v6.
v1:
https://lore.kernel.org/r/20261031020640-263f7b05-a7s-clock@gmail.com
Base: v7.4-rc1. Depends on CCU v7 (all eight patches):
https://lore.kernel.org/r/20261112-a733-clk-v7-0-db7c5451ffa2@pigmoral.tech
November 12 board test: two RAM boots and warm reboot -f returns on
Cubie A7S with vendor boot0/BL31/SCP/U-Boot, without clk_ignore_unused.
Both retained clocks were 1/1; all three dropped clocks were 0/0.
The no-flag stall was observed with CCU v6 on Nov 10; PRCM code is
byte-identical in v7, where the no-flag control was not repeated.
Runtime used DT v3 and its dependencies (all four UART v2 patches),
with the PMIC identifier and pinctrl IRQ-map context adapted to the base:
https://lore.kernel.org/r/cover.1794227241.git.enzo.adriano.code@gmail.com
drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
Comments
Hi, the patch itself looks fine, but the comments and the commit message are not entirely correct, I think. On 11/12/26 22:38, Enzo Adriano wrote: > The A733 PRCM's bus-r-riscv and bus-r-msgbox gates have no Linux > consumers, so unused-clock cleanup gates them. With vendor SCP firmware > running on the E902 as shipped on Cubie A7S, warm reboot then stalls. Please note that we don't support "vendor firmware" with mainline Linux. That was mostly incompatible in the past, and while it might work these days, this is not something we control and want to endorse. So we would be quite reluctant (to put it mildly) about merging patches that are solely needed for BSP firmware bits. > Keep both critical until remoteproc/mailbox drivers can claim them. I don't think this "until" is an argument. Even if we'd have Linux driver support, they would be optional to use (not compiled, not loaded), and would only be needed to *communicate* with the firmware. But those clocks are actually there to drive the RISC-V core clock, and also the "RISC-V side" of the peripherals, due to a lack of separate clock controls in the SoC in the Allwinner design. So the kernel should not care about or touch those clocks at all - which is what CLK_IS_CRITICAL does. > This follows A523 bus-r-cpucfg in commit 1dba74abf3e2 ("clk: sunxi-ng: > Mark A523 bus-r-cpucfg clock as critical") and the temporary SCPI firmware > clock protection for Meson AXG fclk_div3 in drivers/clk/meson/axg.c. > > On Cubie A7S with vendor boot0/BL31/SCP/U-Boot and without > clk_ignore_unused, warm reboot returns with both clocks critical and > stalls without them. Vinicius found either flag alone insufficient on > Cubie A7Z. Power-off, suspend, single flags on A7S, other > boards/firmware and upstream TF-A were not tested. > > Link: https://lore.kernel.org/r/20261005183038.417798-1-vinicius.eduardo.pedrosa@gmail.com > Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com> > --- > Changes in v2: > - Drop r-timer0, bus-r-timer and bus-msgbox0: A7S warm reboot works with > these at 0/0. Keep only the two E902/mailbox bus gates after Junhui's > review, pending remoteproc/mailbox ownership. > - Rebase on CCU v7; its PRCM clock definitions are unchanged from v6. > > v1: > https://lore.kernel.org/r/20261031020640-263f7b05-a7s-clock@gmail.com > > Base: v7.4-rc1. Depends on CCU v7 (all eight patches): > https://lore.kernel.org/r/20261112-a733-clk-v7-0-db7c5451ffa2@pigmoral.tech > > November 12 board test: two RAM boots and warm reboot -f returns on > Cubie A7S with vendor boot0/BL31/SCP/U-Boot, without clk_ignore_unused. > Both retained clocks were 1/1; all three dropped clocks were 0/0. > The no-flag stall was observed with CCU v6 on Nov 10; PRCM code is > byte-identical in v7, where the no-flag control was not repeated. > Runtime used DT v3 and its dependencies (all four UART v2 patches), > with the PMIC identifier and pinctrl IRQ-map context adapted to the base: > https://lore.kernel.org/r/cover.1794227241.git.enzo.adriano.code@gmail.com I don't think there is any need for those longish test descriptions, especially if they pass. > > drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > index b8f6e8c6e507..f2965daba0d3 100644 > --- a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > @@ -108,7 +108,9 @@ static SUNXI_CCU_DUALDIV_MUX_GATE(r_spi_clk, "r-spi", r_spi_parents, 0x150, > 0); > static SUNXI_CCU_GATE_HW(bus_r_spi_clk, "bus-r-spi", &r_ahb_clk.common.hw, 0x15c, BIT(0), 0); > > -static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, 0x17c, BIT(0), 0); > +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ Please change this comment. Something like the msgbox clock is shared between the E902 core and the Arm APs. > +static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, > + 0x17c, BIT(0), CLK_IS_CRITICAL); > > static SUNXI_CCU_GATE_HW(bus_r_uart0_clk, "bus-r-uart0", &r_apb1_clk.common.hw, 0x18c, BIT(0), 0); > static SUNXI_CCU_GATE_HW(bus_r_uart1_clk, "bus-r-uart1", &r_apb1_clk.common.hw, 0x18c, BIT(1), 0); > @@ -146,8 +148,9 @@ static SUNXI_CCU_MUX_DATA_WITH_GATE(r_riscv_clk, "r-riscv", r_riscv_parents, 0x2 > 24, 2, /* mux */ > BIT(31), /* gate */ > 0); > +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ and this. Just note that the E902 might be running on its own, in a pure firmware role, or even completely separate from the main kernel. Oh, and also please put somewhere that this is based on the linux-sunxi for-next tree, aside from just having the base-commit ID below. Cheers, Andre > static SUNXI_CCU_GATE_HW(bus_r_riscv_clk, "bus-r-riscv", &r_apb0_clk.common.hw, > - 0x21c, BIT(0), 0); > + 0x21c, BIT(0), CLK_IS_CRITICAL); > static SUNXI_CCU_GATE_HW(bus_r_riscv_cfg_clk, "bus-r-riscv-cfg", &r_apb0_clk.common.hw, > 0x21c, BIT(1), 0); > > > base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
On Wed, Nov 18, 2026 at 1:18 AM Andre Przywara <andre.przywara@arm.com> wrote: > > Hi, > > the patch itself looks fine, but the comments and the commit message are > not entirely correct, I think. > > On 11/12/26 22:38, Enzo Adriano wrote: > > The A733 PRCM's bus-r-riscv and bus-r-msgbox gates have no Linux > > consumers, so unused-clock cleanup gates them. With vendor SCP firmware > > running on the E902 as shipped on Cubie A7S, warm reboot then stalls. > > Please note that we don't support "vendor firmware" with mainline Linux. > That was mostly incompatible in the past, and while it might work these > days, this is not something we control and want to endorse. > So we would be quite reluctant (to put it mildly) about merging patches > that are solely needed for BSP firmware bits. > > > Keep both critical until remoteproc/mailbox drivers can claim them. > > I don't think this "until" is an argument. Even if we'd have Linux > driver support, they would be optional to use (not compiled, not > loaded), and would only be needed to *communicate* with the firmware. > > But those clocks are actually there to drive the RISC-V core clock, and > also the "RISC-V side" of the peripherals, due to a lack of separate > clock controls in the SoC in the Allwinner design. So the kernel should > not care about or touch those clocks at all - which is what > CLK_IS_CRITICAL does. No. CLK_IS_CRITICAL also tells the kernel to turn it on, and you then can never turn it off. You get a big warning if you try to defeat the refcounting, but nothing else happens. So what if the *real* remoteproc driver needs to turn the clock off to pause the RISC-V core? It can't So, not a fan of this. If the loaded firmware somehow needs some resources then perhaps the software that loaded it needs to somehow tell the kernel they are needed, like the bootloader patching the DT passed to the kernel. If the firmware needs a piece of DRAM, you don't say in the kernel that this piece of DRAM is off-limits. You let the bootloader tell the kernel. Static DRAM carve outs with reserved-memory nodes in the DT source is also ugly, as you could end up with mismatches if the firmware somehow changed. IMO CLK_IS_CRITICAL should be used for things that the kernel knows it needs but there's nothing to claim it. ChenYu > > This follows A523 bus-r-cpucfg in commit 1dba74abf3e2 ("clk: sunxi-ng: > > Mark A523 bus-r-cpucfg clock as critical") and the temporary SCPI firmware > > clock protection for Meson AXG fclk_div3 in drivers/clk/meson/axg.c. > > > > On Cubie A7S with vendor boot0/BL31/SCP/U-Boot and without > > clk_ignore_unused, warm reboot returns with both clocks critical and > > stalls without them. Vinicius found either flag alone insufficient on > > Cubie A7Z. Power-off, suspend, single flags on A7S, other > > boards/firmware and upstream TF-A were not tested. > > > > Link: https://lore.kernel.org/r/20261005183038.417798-1-vinicius.eduardo.pedrosa@gmail.com > > Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com> > > --- > > Changes in v2: > > - Drop r-timer0, bus-r-timer and bus-msgbox0: A7S warm reboot works with > > these at 0/0. Keep only the two E902/mailbox bus gates after Junhui's > > review, pending remoteproc/mailbox ownership. > > - Rebase on CCU v7; its PRCM clock definitions are unchanged from v6. > > > > v1: > > https://lore.kernel.org/r/20261031020640-263f7b05-a7s-clock@gmail.com > > > > Base: v7.4-rc1. Depends on CCU v7 (all eight patches): > > https://lore.kernel.org/r/20261112-a733-clk-v7-0-db7c5451ffa2@pigmoral.tech > > > > November 12 board test: two RAM boots and warm reboot -f returns on > > Cubie A7S with vendor boot0/BL31/SCP/U-Boot, without clk_ignore_unused. > > Both retained clocks were 1/1; all three dropped clocks were 0/0. > > The no-flag stall was observed with CCU v6 on Nov 10; PRCM code is > > byte-identical in v7, where the no-flag control was not repeated. > > Runtime used DT v3 and its dependencies (all four UART v2 patches), > > with the PMIC identifier and pinctrl IRQ-map context adapted to the base: > > https://lore.kernel.org/r/cover.1794227241.git.enzo.adriano.code@gmail.com > > I don't think there is any need for those longish test descriptions, > especially if they pass. > > > > > drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 7 +++++-- > > 1 file changed, 5 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > > index b8f6e8c6e507..f2965daba0d3 100644 > > --- a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > > +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > > @@ -108,7 +108,9 @@ static SUNXI_CCU_DUALDIV_MUX_GATE(r_spi_clk, "r-spi", r_spi_parents, 0x150, > > 0); > > static SUNXI_CCU_GATE_HW(bus_r_spi_clk, "bus-r-spi", &r_ahb_clk.common.hw, 0x15c, BIT(0), 0); > > > > -static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, 0x17c, BIT(0), 0); > > +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ > > Please change this comment. Something like the msgbox clock is shared > between the E902 core and the Arm APs. > > > +static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, > > + 0x17c, BIT(0), CLK_IS_CRITICAL); > > > > static SUNXI_CCU_GATE_HW(bus_r_uart0_clk, "bus-r-uart0", &r_apb1_clk.common.hw, 0x18c, BIT(0), 0); > > static SUNXI_CCU_GATE_HW(bus_r_uart1_clk, "bus-r-uart1", &r_apb1_clk.common.hw, 0x18c, BIT(1), 0); > > @@ -146,8 +148,9 @@ static SUNXI_CCU_MUX_DATA_WITH_GATE(r_riscv_clk, "r-riscv", r_riscv_parents, 0x2 > > 24, 2, /* mux */ > > BIT(31), /* gate */ > > 0); > > +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ > > and this. Just note that the E902 might be running on its own, in a pure > firmware role, or even completely separate from the main kernel. > > Oh, and also please put somewhere that this is based on the linux-sunxi > for-next tree, aside from just having the base-commit ID below. > > Cheers, > Andre > > > static SUNXI_CCU_GATE_HW(bus_r_riscv_clk, "bus-r-riscv", &r_apb0_clk.common.hw, > > - 0x21c, BIT(0), 0); > > + 0x21c, BIT(0), CLK_IS_CRITICAL); > > static SUNXI_CCU_GATE_HW(bus_r_riscv_cfg_clk, "bus-r-riscv-cfg", &r_apb0_clk.common.hw, > > 0x21c, BIT(1), 0); > > > > > > base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 >
Hi, On 11/18/26 14:41, Chen-Yu Tsai wrote: > On Wed, Nov 18, 2026 at 1:18 AM Andre Przywara <andre.przywara@arm.com> wrote: >> >> Hi, >> >> the patch itself looks fine, but the comments and the commit message are >> not entirely correct, I think. >> >> On 11/12/26 22:38, Enzo Adriano wrote: >>> The A733 PRCM's bus-r-riscv and bus-r-msgbox gates have no Linux >>> consumers, so unused-clock cleanup gates them. With vendor SCP firmware >>> running on the E902 as shipped on Cubie A7S, warm reboot then stalls. >> >> Please note that we don't support "vendor firmware" with mainline Linux. >> That was mostly incompatible in the past, and while it might work these >> days, this is not something we control and want to endorse. >> So we would be quite reluctant (to put it mildly) about merging patches >> that are solely needed for BSP firmware bits. >> >>> Keep both critical until remoteproc/mailbox drivers can claim them. >> >> I don't think this "until" is an argument. Even if we'd have Linux >> driver support, they would be optional to use (not compiled, not >> loaded), and would only be needed to *communicate* with the firmware. >> >> But those clocks are actually there to drive the RISC-V core clock, and >> also the "RISC-V side" of the peripherals, due to a lack of separate >> clock controls in the SoC in the Allwinner design. So the kernel should >> not care about or touch those clocks at all - which is what >> CLK_IS_CRITICAL does. > > No. CLK_IS_CRITICAL also tells the kernel to turn it on, and you then > can never turn it off. You get a big warning if you try to defeat the > refcounting, but nothing else happens. Good point, so is CLK_IGNORE_UNUSED a better flag? As far as I can see, it only prevents turning it off if unclaimed, it doesn't turn it on if it was off initially, and it doesn't disallow turning it off. > So what if the *real* remoteproc driver needs to turn the clock off to > pause the RISC-V core? It can't I guess this depends on the use case, which isn't very well defined. If this E902 is really a remoteproc device entirely controlled by Linux, then sure: Linux should have full control over its clock. But if it's running some kind of firmware component, then the kernel shouldn't mess with it, IMHO. But I think there is still the arisc on the A733, so this would more likely run the management processor (SCP) code? Cheers, Andre > So, not a fan of this. If the loaded firmware somehow needs some resources > then perhaps the software that loaded it needs to somehow tell the kernel > they are needed, like the bootloader patching the DT passed to the kernel. > > If the firmware needs a piece of DRAM, you don't say in the kernel that > this piece of DRAM is off-limits. You let the bootloader tell the kernel. > Static DRAM carve outs with reserved-memory nodes in the DT source is also > ugly, as you could end up with mismatches if the firmware somehow changed. > > IMO CLK_IS_CRITICAL should be used for things that the kernel knows it needs > but there's nothing to claim it. > > > ChenYu > >>> This follows A523 bus-r-cpucfg in commit 1dba74abf3e2 ("clk: sunxi-ng: >>> Mark A523 bus-r-cpucfg clock as critical") and the temporary SCPI firmware >>> clock protection for Meson AXG fclk_div3 in drivers/clk/meson/axg.c. >>> >>> On Cubie A7S with vendor boot0/BL31/SCP/U-Boot and without >>> clk_ignore_unused, warm reboot returns with both clocks critical and >>> stalls without them. Vinicius found either flag alone insufficient on >>> Cubie A7Z. Power-off, suspend, single flags on A7S, other >>> boards/firmware and upstream TF-A were not tested. >>> >>> Link: https://lore.kernel.org/r/20261005183038.417798-1-vinicius.eduardo.pedrosa@gmail.com >>> Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com> >>> --- >>> Changes in v2: >>> - Drop r-timer0, bus-r-timer and bus-msgbox0: A7S warm reboot works with >>> these at 0/0. Keep only the two E902/mailbox bus gates after Junhui's >>> review, pending remoteproc/mailbox ownership. >>> - Rebase on CCU v7; its PRCM clock definitions are unchanged from v6. >>> >>> v1: >>> https://lore.kernel.org/r/20261031020640-263f7b05-a7s-clock@gmail.com >>> >>> Base: v7.4-rc1. Depends on CCU v7 (all eight patches): >>> https://lore.kernel.org/r/20261112-a733-clk-v7-0-db7c5451ffa2@pigmoral.tech >>> >>> November 12 board test: two RAM boots and warm reboot -f returns on >>> Cubie A7S with vendor boot0/BL31/SCP/U-Boot, without clk_ignore_unused. >>> Both retained clocks were 1/1; all three dropped clocks were 0/0. >>> The no-flag stall was observed with CCU v6 on Nov 10; PRCM code is >>> byte-identical in v7, where the no-flag control was not repeated. >>> Runtime used DT v3 and its dependencies (all four UART v2 patches), >>> with the PMIC identifier and pinctrl IRQ-map context adapted to the base: >>> https://lore.kernel.org/r/cover.1794227241.git.enzo.adriano.code@gmail.com >> >> I don't think there is any need for those longish test descriptions, >> especially if they pass. >> >>> >>> drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 7 +++++-- >>> 1 file changed, 5 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c >>> index b8f6e8c6e507..f2965daba0d3 100644 >>> --- a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c >>> +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c >>> @@ -108,7 +108,9 @@ static SUNXI_CCU_DUALDIV_MUX_GATE(r_spi_clk, "r-spi", r_spi_parents, 0x150, >>> 0); >>> static SUNXI_CCU_GATE_HW(bus_r_spi_clk, "bus-r-spi", &r_ahb_clk.common.hw, 0x15c, BIT(0), 0); >>> >>> -static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, 0x17c, BIT(0), 0); >>> +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ >> >> Please change this comment. Something like the msgbox clock is shared >> between the E902 core and the Arm APs. >> >>> +static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, >>> + 0x17c, BIT(0), CLK_IS_CRITICAL); >>> >>> static SUNXI_CCU_GATE_HW(bus_r_uart0_clk, "bus-r-uart0", &r_apb1_clk.common.hw, 0x18c, BIT(0), 0); >>> static SUNXI_CCU_GATE_HW(bus_r_uart1_clk, "bus-r-uart1", &r_apb1_clk.common.hw, 0x18c, BIT(1), 0); >>> @@ -146,8 +148,9 @@ static SUNXI_CCU_MUX_DATA_WITH_GATE(r_riscv_clk, "r-riscv", r_riscv_parents, 0x2 >>> 24, 2, /* mux */ >>> BIT(31), /* gate */ >>> 0); >>> +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ >> >> and this. Just note that the E902 might be running on its own, in a pure >> firmware role, or even completely separate from the main kernel. >> >> Oh, and also please put somewhere that this is based on the linux-sunxi >> for-next tree, aside from just having the base-commit ID below. >> >> Cheers, >> Andre >> >>> static SUNXI_CCU_GATE_HW(bus_r_riscv_clk, "bus-r-riscv", &r_apb0_clk.common.hw, >>> - 0x21c, BIT(0), 0); >>> + 0x21c, BIT(0), CLK_IS_CRITICAL); >>> static SUNXI_CCU_GATE_HW(bus_r_riscv_cfg_clk, "bus-r-riscv-cfg", &r_apb0_clk.common.hw, >>> 0x21c, BIT(1), 0); >>> >>> >>> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 >>
On Wed, Nov 18, 2026 at 10:51 PM Andre Przywara <andre.przywara@arm.com> wrote: > > Hi, > > On 11/18/26 14:41, Chen-Yu Tsai wrote: > > On Wed, Nov 18, 2026 at 1:18 AM Andre Przywara <andre.przywara@arm.com> wrote: > >> > >> Hi, > >> > >> the patch itself looks fine, but the comments and the commit message are > >> not entirely correct, I think. > >> > >> On 11/12/26 22:38, Enzo Adriano wrote: > >>> The A733 PRCM's bus-r-riscv and bus-r-msgbox gates have no Linux > >>> consumers, so unused-clock cleanup gates them. With vendor SCP firmware > >>> running on the E902 as shipped on Cubie A7S, warm reboot then stalls. > >> > >> Please note that we don't support "vendor firmware" with mainline Linux. > >> That was mostly incompatible in the past, and while it might work these > >> days, this is not something we control and want to endorse. > >> So we would be quite reluctant (to put it mildly) about merging patches > >> that are solely needed for BSP firmware bits. > >> > >>> Keep both critical until remoteproc/mailbox drivers can claim them. > >> > >> I don't think this "until" is an argument. Even if we'd have Linux > >> driver support, they would be optional to use (not compiled, not > >> loaded), and would only be needed to *communicate* with the firmware. > >> > >> But those clocks are actually there to drive the RISC-V core clock, and > >> also the "RISC-V side" of the peripherals, due to a lack of separate > >> clock controls in the SoC in the Allwinner design. So the kernel should > >> not care about or touch those clocks at all - which is what > >> CLK_IS_CRITICAL does. > > > > No. CLK_IS_CRITICAL also tells the kernel to turn it on, and you then > > can never turn it off. You get a big warning if you try to defeat the > > refcounting, but nothing else happens. > > Good point, so is CLK_IGNORE_UNUSED a better flag? As far as I can see, > it only prevents turning it off if unclaimed, it doesn't turn it on if > it was off initially, and it doesn't disallow turning it off. Yes. It's like an uncoordinated simplefb? :p > > So what if the *real* remoteproc driver needs to turn the clock off to > > pause the RISC-V core? It can't > > I guess this depends on the use case, which isn't very well defined. If > this E902 is really a remoteproc device entirely controlled by Linux, > then sure: Linux should have full control over its clock. > But if it's running some kind of firmware component, then the kernel > shouldn't mess with it, IMHO. But I think there is still the arisc on > the A733, so this would more likely run the management processor (SCP) code? Even if it had firmware already running, if it provides some interface to the OS (other than PSCI / SCMI), then you'd probably still have a remoteproc driver claiming and somewhat controlling it, plus rpmsg or something else to bridge the firmware interface. OTOH, AFAIK some SCP, such as crust, are pretty much transparent to the OS, i.e. the OS doesn't know about it. The RISC-V core is probably useful beyond just being the SCP. You could offload control of various hardware blocks to it if you wanted, or you could have it be an always on sensor hub. Either way the OS would have some control over it and some defined interface to it. ChenYu > Cheers, > Andre > > > So, not a fan of this. If the loaded firmware somehow needs some resources > > then perhaps the software that loaded it needs to somehow tell the kernel > > they are needed, like the bootloader patching the DT passed to the kernel. > > > > If the firmware needs a piece of DRAM, you don't say in the kernel that > > this piece of DRAM is off-limits. You let the bootloader tell the kernel. > > Static DRAM carve outs with reserved-memory nodes in the DT source is also > > ugly, as you could end up with mismatches if the firmware somehow changed. > > > > IMO CLK_IS_CRITICAL should be used for things that the kernel knows it needs > > but there's nothing to claim it. > > > > > > ChenYu > > > >>> This follows A523 bus-r-cpucfg in commit 1dba74abf3e2 ("clk: sunxi-ng: > >>> Mark A523 bus-r-cpucfg clock as critical") and the temporary SCPI firmware > >>> clock protection for Meson AXG fclk_div3 in drivers/clk/meson/axg.c. > >>> > >>> On Cubie A7S with vendor boot0/BL31/SCP/U-Boot and without > >>> clk_ignore_unused, warm reboot returns with both clocks critical and > >>> stalls without them. Vinicius found either flag alone insufficient on > >>> Cubie A7Z. Power-off, suspend, single flags on A7S, other > >>> boards/firmware and upstream TF-A were not tested. > >>> > >>> Link: https://lore.kernel.org/r/20261005183038.417798-1-vinicius.eduardo.pedrosa@gmail.com > >>> Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com> > >>> --- > >>> Changes in v2: > >>> - Drop r-timer0, bus-r-timer and bus-msgbox0: A7S warm reboot works with > >>> these at 0/0. Keep only the two E902/mailbox bus gates after Junhui's > >>> review, pending remoteproc/mailbox ownership. > >>> - Rebase on CCU v7; its PRCM clock definitions are unchanged from v6. > >>> > >>> v1: > >>> https://lore.kernel.org/r/20261031020640-263f7b05-a7s-clock@gmail.com > >>> > >>> Base: v7.4-rc1. Depends on CCU v7 (all eight patches): > >>> https://lore.kernel.org/r/20261112-a733-clk-v7-0-db7c5451ffa2@pigmoral.tech > >>> > >>> November 12 board test: two RAM boots and warm reboot -f returns on > >>> Cubie A7S with vendor boot0/BL31/SCP/U-Boot, without clk_ignore_unused. > >>> Both retained clocks were 1/1; all three dropped clocks were 0/0. > >>> The no-flag stall was observed with CCU v6 on Nov 10; PRCM code is > >>> byte-identical in v7, where the no-flag control was not repeated. > >>> Runtime used DT v3 and its dependencies (all four UART v2 patches), > >>> with the PMIC identifier and pinctrl IRQ-map context adapted to the base: > >>> https://lore.kernel.org/r/cover.1794227241.git.enzo.adriano.code@gmail.com > >> > >> I don't think there is any need for those longish test descriptions, > >> especially if they pass. > >> > >>> > >>> drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 7 +++++-- > >>> 1 file changed, 5 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > >>> index b8f6e8c6e507..f2965daba0d3 100644 > >>> --- a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > >>> +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c > >>> @@ -108,7 +108,9 @@ static SUNXI_CCU_DUALDIV_MUX_GATE(r_spi_clk, "r-spi", r_spi_parents, 0x150, > >>> 0); > >>> static SUNXI_CCU_GATE_HW(bus_r_spi_clk, "bus-r-spi", &r_ahb_clk.common.hw, 0x15c, BIT(0), 0); > >>> > >>> -static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, 0x17c, BIT(0), 0); > >>> +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ > >> > >> Please change this comment. Something like the msgbox clock is shared > >> between the E902 core and the Arm APs. > >> > >>> +static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, > >>> + 0x17c, BIT(0), CLK_IS_CRITICAL); > >>> > >>> static SUNXI_CCU_GATE_HW(bus_r_uart0_clk, "bus-r-uart0", &r_apb1_clk.common.hw, 0x18c, BIT(0), 0); > >>> static SUNXI_CCU_GATE_HW(bus_r_uart1_clk, "bus-r-uart1", &r_apb1_clk.common.hw, 0x18c, BIT(1), 0); > >>> @@ -146,8 +148,9 @@ static SUNXI_CCU_MUX_DATA_WITH_GATE(r_riscv_clk, "r-riscv", r_riscv_parents, 0x2 > >>> 24, 2, /* mux */ > >>> BIT(31), /* gate */ > >>> 0); > >>> +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ > >> > >> and this. Just note that the E902 might be running on its own, in a pure > >> firmware role, or even completely separate from the main kernel. > >> > >> Oh, and also please put somewhere that this is based on the linux-sunxi > >> for-next tree, aside from just having the base-commit ID below. > >> > >> Cheers, > >> Andre > >> > >>> static SUNXI_CCU_GATE_HW(bus_r_riscv_clk, "bus-r-riscv", &r_apb0_clk.common.hw, > >>> - 0x21c, BIT(0), 0); > >>> + 0x21c, BIT(0), CLK_IS_CRITICAL); > >>> static SUNXI_CCU_GATE_HW(bus_r_riscv_cfg_clk, "bus-r-riscv-cfg", &r_apb0_clk.common.hw, > >>> 0x21c, BIT(1), 0); > >>> > >>> > >>> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 > >> > >
Hi, On 11/18/26 16:15, Chen-Yu Tsai wrote: > On Wed, Nov 18, 2026 at 10:51 PM Andre Przywara <andre.przywara@arm.com> wrote: >> >> Hi, >> >> On 11/18/26 14:41, Chen-Yu Tsai wrote: >>> On Wed, Nov 18, 2026 at 1:18 AM Andre Przywara <andre.przywara@arm.com> wrote: >>>> >>>> Hi, >>>> >>>> the patch itself looks fine, but the comments and the commit message are >>>> not entirely correct, I think. >>>> >>>> On 11/12/26 22:38, Enzo Adriano wrote: >>>>> The A733 PRCM's bus-r-riscv and bus-r-msgbox gates have no Linux >>>>> consumers, so unused-clock cleanup gates them. With vendor SCP firmware >>>>> running on the E902 as shipped on Cubie A7S, warm reboot then stalls. >>>> >>>> Please note that we don't support "vendor firmware" with mainline Linux. >>>> That was mostly incompatible in the past, and while it might work these >>>> days, this is not something we control and want to endorse. >>>> So we would be quite reluctant (to put it mildly) about merging patches >>>> that are solely needed for BSP firmware bits. >>>> >>>>> Keep both critical until remoteproc/mailbox drivers can claim them. >>>> >>>> I don't think this "until" is an argument. Even if we'd have Linux >>>> driver support, they would be optional to use (not compiled, not >>>> loaded), and would only be needed to *communicate* with the firmware. >>>> >>>> But those clocks are actually there to drive the RISC-V core clock, and >>>> also the "RISC-V side" of the peripherals, due to a lack of separate >>>> clock controls in the SoC in the Allwinner design. So the kernel should >>>> not care about or touch those clocks at all - which is what >>>> CLK_IS_CRITICAL does. >>> >>> No. CLK_IS_CRITICAL also tells the kernel to turn it on, and you then >>> can never turn it off. You get a big warning if you try to defeat the >>> refcounting, but nothing else happens. >> >> Good point, so is CLK_IGNORE_UNUSED a better flag? As far as I can see, >> it only prevents turning it off if unclaimed, it doesn't turn it on if >> it was off initially, and it doesn't disallow turning it off. > > Yes. It's like an uncoordinated simplefb? :p I guess you could see it that way, although Linux wouldn't directly know about it. >>> So what if the *real* remoteproc driver needs to turn the clock off to >>> pause the RISC-V core? It can't >> >> I guess this depends on the use case, which isn't very well defined. If >> this E902 is really a remoteproc device entirely controlled by Linux, >> then sure: Linux should have full control over its clock. >> But if it's running some kind of firmware component, then the kernel >> shouldn't mess with it, IMHO. But I think there is still the arisc on >> the A733, so this would more likely run the management processor (SCP) code? > > Even if it had firmware already running, if it provides some interface to > the OS (other than PSCI / SCMI), then you'd probably still have a remoteproc > driver claiming and somewhat controlling it, plus rpmsg or something else > to bridge the firmware interface. > > OTOH, AFAIK some SCP, such as crust, are pretty much transparent to the OS, > i.e. the OS doesn't know about it. The RISC-V core is probably useful beyond > just being the SCP. You could offload control of various hardware blocks to > it if you wanted, or you could have it be an always on sensor hub. Either way > the OS would have some control over it and some defined interface to it. Yes, that is what I mean: there are two distinct use cases: the realtime one, where Linux uses remoteproc to offload timing critical load, and the "SCP" one, where it just runs in the background, and the kernel is not directly involved. For this latter case we would need to not turn off the clocks. The question now is whether this SCP use case is something we deem useful, for mainline. If it's just about to run the BSP firmware, I think we shouldn't bother, we just don't support that. But if we end up running something like crust on the E902, then it's a different story. So I wonder if we should just pragmatically add CLK_IGNORE_UNUSED, to not shut on the door on this SCP use case later. If we ever only want to use remoteproc, I think we don't need this patch. Cheers, Andre >>> So, not a fan of this. If the loaded firmware somehow needs some resources >>> then perhaps the software that loaded it needs to somehow tell the kernel >>> they are needed, like the bootloader patching the DT passed to the kernel. >>> >>> If the firmware needs a piece of DRAM, you don't say in the kernel that >>> this piece of DRAM is off-limits. You let the bootloader tell the kernel. >>> Static DRAM carve outs with reserved-memory nodes in the DT source is also >>> ugly, as you could end up with mismatches if the firmware somehow changed. >>> >>> IMO CLK_IS_CRITICAL should be used for things that the kernel knows it needs >>> but there's nothing to claim it. >>> >>> >>> ChenYu >>> >>>>> This follows A523 bus-r-cpucfg in commit 1dba74abf3e2 ("clk: sunxi-ng: >>>>> Mark A523 bus-r-cpucfg clock as critical") and the temporary SCPI firmware >>>>> clock protection for Meson AXG fclk_div3 in drivers/clk/meson/axg.c. >>>>> >>>>> On Cubie A7S with vendor boot0/BL31/SCP/U-Boot and without >>>>> clk_ignore_unused, warm reboot returns with both clocks critical and >>>>> stalls without them. Vinicius found either flag alone insufficient on >>>>> Cubie A7Z. Power-off, suspend, single flags on A7S, other >>>>> boards/firmware and upstream TF-A were not tested. >>>>> >>>>> Link: https://lore.kernel.org/r/20261005183038.417798-1-vinicius.eduardo.pedrosa@gmail.com >>>>> Signed-off-by: Enzo Adriano <enzo.adriano.code@gmail.com> >>>>> --- >>>>> Changes in v2: >>>>> - Drop r-timer0, bus-r-timer and bus-msgbox0: A7S warm reboot works with >>>>> these at 0/0. Keep only the two E902/mailbox bus gates after Junhui's >>>>> review, pending remoteproc/mailbox ownership. >>>>> - Rebase on CCU v7; its PRCM clock definitions are unchanged from v6. >>>>> >>>>> v1: >>>>> https://lore.kernel.org/r/20261031020640-263f7b05-a7s-clock@gmail.com >>>>> >>>>> Base: v7.4-rc1. Depends on CCU v7 (all eight patches): >>>>> https://lore.kernel.org/r/20261112-a733-clk-v7-0-db7c5451ffa2@pigmoral.tech >>>>> >>>>> November 12 board test: two RAM boots and warm reboot -f returns on >>>>> Cubie A7S with vendor boot0/BL31/SCP/U-Boot, without clk_ignore_unused. >>>>> Both retained clocks were 1/1; all three dropped clocks were 0/0. >>>>> The no-flag stall was observed with CCU v6 on Nov 10; PRCM code is >>>>> byte-identical in v7, where the no-flag control was not repeated. >>>>> Runtime used DT v3 and its dependencies (all four UART v2 patches), >>>>> with the PMIC identifier and pinctrl IRQ-map context adapted to the base: >>>>> https://lore.kernel.org/r/cover.1794227241.git.enzo.adriano.code@gmail.com >>>> >>>> I don't think there is any need for those longish test descriptions, >>>> especially if they pass. >>>> >>>>> >>>>> drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c | 7 +++++-- >>>>> 1 file changed, 5 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c >>>>> index b8f6e8c6e507..f2965daba0d3 100644 >>>>> --- a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c >>>>> +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c >>>>> @@ -108,7 +108,9 @@ static SUNXI_CCU_DUALDIV_MUX_GATE(r_spi_clk, "r-spi", r_spi_parents, 0x150, >>>>> 0); >>>>> static SUNXI_CCU_GATE_HW(bus_r_spi_clk, "bus-r-spi", &r_ahb_clk.common.hw, 0x15c, BIT(0), 0); >>>>> >>>>> -static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, 0x17c, BIT(0), 0); >>>>> +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ >>>> >>>> Please change this comment. Something like the msgbox clock is shared >>>> between the E902 core and the Arm APs. >>>> >>>>> +static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, >>>>> + 0x17c, BIT(0), CLK_IS_CRITICAL); >>>>> >>>>> static SUNXI_CCU_GATE_HW(bus_r_uart0_clk, "bus-r-uart0", &r_apb1_clk.common.hw, 0x18c, BIT(0), 0); >>>>> static SUNXI_CCU_GATE_HW(bus_r_uart1_clk, "bus-r-uart1", &r_apb1_clk.common.hw, 0x18c, BIT(1), 0); >>>>> @@ -146,8 +148,9 @@ static SUNXI_CCU_MUX_DATA_WITH_GATE(r_riscv_clk, "r-riscv", r_riscv_parents, 0x2 >>>>> 24, 2, /* mux */ >>>>> BIT(31), /* gate */ >>>>> 0); >>>>> +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ >>>> >>>> and this. Just note that the E902 might be running on its own, in a pure >>>> firmware role, or even completely separate from the main kernel. >>>> >>>> Oh, and also please put somewhere that this is based on the linux-sunxi >>>> for-next tree, aside from just having the base-commit ID below. >>>> >>>> Cheers, >>>> Andre >>>> >>>>> static SUNXI_CCU_GATE_HW(bus_r_riscv_clk, "bus-r-riscv", &r_apb0_clk.common.hw, >>>>> - 0x21c, BIT(0), 0); >>>>> + 0x21c, BIT(0), CLK_IS_CRITICAL); >>>>> static SUNXI_CCU_GATE_HW(bus_r_riscv_cfg_clk, "bus-r-riscv-cfg", &r_apb0_clk.common.hw, >>>>> 0x21c, BIT(1), 0); >>>>> >>>>> >>>>> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 >>>> >> >> >
Hi Chen-Yu, Andre, >>> But I think there is still the arisc on >>> the A733, so this would more likely run the management processor (SCP) code? The A733 CPUS domain has both an E902 and an OR100 (manual section 1.2, figure 1-1). The vendor SCP firmware Radxa ships for Cubie A7S, called "arisc" by Allwinner, runs on the E902: vendor BL31 writes its entry point to E902_RST_START_ADDR_REG at 0x07032204 (manual section 5.2.3). Radxa's BL31, in its system reset path, sends a reboot request to the E902 through the CPUX-to-CPUS msgbox. Exactly where the no-flag reboot stalls is not known. > The question now is whether this SCP use case is something we deem > useful, for mainline. If it's just about to run the BSP firmware, I > think we shouldn't bother, we just don't support that. But if we end up > running something like crust on the E902, then it's a different story. For me this is only about the vendor BSP firmware; I have no other SCP firmware for the E902 to test with. Upstream Crust has no A733 target, and the A733 TF-A port under review resets through the watchdog, not the msgbox [1]. >>>> So, not a fan of this. If the loaded firmware somehow needs some resources >>>> then perhaps the software that loaded it needs to somehow tell the kernel >>>> they are needed, like the bootloader patching the DT passed to the kernel. Vendor U-Boot already applies DT fixups, but the A733 CCU binding and driver do not accept protected-clocks today. A loader-declared handoff would need a new binding and driver support, plus loader changes. > So I wonder if we should just pragmatically add CLK_IGNORE_UNUSED, to > not shut on the door on this SCP use case later. > If we ever only want to use remoteproc, I think we don't need this patch. CLK_IGNORE_UNUSED would also leave a future remoteproc driver free to gate the core. Chen-Yu, if you are fine with it, I will test it on A7S and send v3 based on linux-sunxi for-next, with Andre's comment wording and a short test note. Otherwise I will drop the patch. [1] https://review.trustedfirmware.org/c/TF-A/trusted-firmware-a/+/55200 Thanks, Enzo
diff --git a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c index b8f6e8c6e507..f2965daba0d3 100644 --- a/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c +++ b/drivers/clk/sunxi-ng/ccu-sun60i-a733-r.c @@ -108,7 +108,9 @@ static SUNXI_CCU_DUALDIV_MUX_GATE(r_spi_clk, "r-spi", r_spi_parents, 0x150, 0); static SUNXI_CCU_GATE_HW(bus_r_spi_clk, "bus-r-spi", &r_ahb_clk.common.hw, 0x15c, BIT(0), 0); -static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, 0x17c, BIT(0), 0); +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ +static SUNXI_CCU_GATE_HW(bus_r_msgbox_clk, "bus-r-msgbox", &r_ahb_clk.common.hw, + 0x17c, BIT(0), CLK_IS_CRITICAL); static SUNXI_CCU_GATE_HW(bus_r_uart0_clk, "bus-r-uart0", &r_apb1_clk.common.hw, 0x18c, BIT(0), 0); static SUNXI_CCU_GATE_HW(bus_r_uart1_clk, "bus-r-uart1", &r_apb1_clk.common.hw, 0x18c, BIT(1), 0); @@ -146,8 +148,9 @@ static SUNXI_CCU_MUX_DATA_WITH_GATE(r_riscv_clk, "r-riscv", r_riscv_parents, 0x2 24, 2, /* mux */ BIT(31), /* gate */ 0); +/* Vendor SCP firmware on E902 needs this until a remoteproc/mailbox driver claims it. */ static SUNXI_CCU_GATE_HW(bus_r_riscv_clk, "bus-r-riscv", &r_apb0_clk.common.hw, - 0x21c, BIT(0), 0); + 0x21c, BIT(0), CLK_IS_CRITICAL); static SUNXI_CCU_GATE_HW(bus_r_riscv_cfg_clk, "bus-r-riscv-cfg", &r_apb0_clk.common.hw, 0x21c, BIT(1), 0);