| Message ID | 20260927025626.69614-4-tien.nguyenminh@embeddedlinux.blog (mailing list archive) |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-sunxi+bounces-26309-sunxi=pue.re@lists.linux.dev>
X-Original-To: noreply@patchwork.local
Delivered-To: noreply@patchwork.local
Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
by mxe881.netcup.net (Postfix) with ESMTPS id 5A0B51C1D46
for <noreply@patchwork.local>; Sun, 27 Sep 2026 04:58:48 +0200 (CEST)
Authentication-Results: mxe881;
dkim=temperror header.d=embeddedlinux.blog;
spf=pass (sender IP is 172.105.105.114)
smtp.mailfrom=linux-sunxi+bounces-26309-noreply=patchwork.local@lists.linux.dev
smtp.helo=tor.lore.kernel.org
Received-SPF: pass (mxe881: domain of lists.linux.dev designates
172.105.105.114 as permitted sender) client-ip=172.105.105.114;
envelope-from=linux-sunxi+bounces-26309-noreply=patchwork.local@lists.linux.dev;
helo=tor.lore.kernel.org;
Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org
[100.90.174.1])
by tor.lore.kernel.org (Postfix) with ESMTP id D7A0229914
for <noreply@patchwork.local>; Sun, 27 Sep 2026 02:56:57 +0000 (UTC)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 1C33C3B5E08;
Sun, 27 Sep 2026 02:56:57 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=embeddedlinux.blog
header.i=@embeddedlinux.blog header.b="WsfKJuW2"
X-Original-To: linux-sunxi@lists.linux.dev
Received: from mail-pj2-f12.google.com (mail-pj2-f12.google.com
[74.125.227.140])
(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C2403B52E2
for <linux-sunxi@lists.linux.dev>; Sun, 27 Sep 2026 02:56:55 +0000 (UTC)
Authentication-Results: smtp.subspace.kernel.org;
arc=none smtp.client-ip=74.125.227.140
ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;
t=1790477817; cv=none;
b=UIK5Yjk8rclSwn0Parosfy+28l/66HwLv3hl0DaYG8dmP0hGcA0xgSM4dWTwLbvEtLZgfVSAu3Cub8a2DL1jkYH8VsdZjmgHb4H9GMiH+y4SmwTtO+qOr3+IeMgOOii+NMhbf6EIUZi5bzIiempSyjXXkDF460/nYLmCfsyvpkk=
ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org;
s=arc-20240116; t=1790477817; c=relaxed/simple;
bh=JLLY8202AFqPiR7IQZMFqT+Np/Pbs4qmrHh6nwqETJ0=;
h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:
MIME-Version;
b=Oy9zHUdl3blBJXyhhdu8v3CHDAnYaR6sn4LosSZfU0WTDl435edmnDtCZgQFf8nB1kRwaj0EVQtnZnpuz/HpZkzoa/qJUn1O7+MGcX9haGPBjAjqKRB6rhXxJrd2e47kxmh4feoW1Q9FFl47rksUqeTBsgYBZzXmWPWEhrmRM4g=
ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass (p=none dis=none) header.from=embeddedlinux.blog;
spf=pass smtp.mailfrom=embeddedlinux.blog;
dkim=pass (2048-bit key) header.d=embeddedlinux.blog
header.i=@embeddedlinux.blog header.b=WsfKJuW2;
arc=none smtp.client-ip=74.125.227.140
Authentication-Results: smtp.subspace.kernel.org;
dmarc=pass (p=none dis=none) header.from=embeddedlinux.blog
Authentication-Results: smtp.subspace.kernel.org;
spf=pass smtp.mailfrom=embeddedlinux.blog
Received: by mail-pj2-f12.google.com with SMTP id
d9443c01a7336-2d747ec6188so8740975ad.3
for <linux-sunxi@lists.linux.dev>;
Sat, 26 Sep 2026 19:56:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=embeddedlinux.blog; s=google; t=1790477815; x=1791082615;
darn=lists.linux.dev;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=Zx161GO4leyejnwa92HDTsrJTQOft6nH8qorocIvjzU=;
b=WsfKJuW2LxLByuWf7bStv8q6FZ5GEKJQETBSqB7fu8EbXECWwFvZqg5xImrUUqK5fH
P2NKwljJRqzYJBPxhnt609wSytZ53vFEehdJZfUZhaYfbVmDhNgkOaUDPX6sO0ro2qQQ
lThxrWyZ3qrGKuZc3MFhyTS1X8dUVWY3iQUFNVnbxyV48Z/T/my69CnP8aeXT+1Amuxp
90THj+xXTOeIbRllsJmYoDru7ghPsZwqHKOkGcVIgLPlRI6SgM6b619quoXXu663ZB2E
srOHcMi1S2b1sKXa3Nt/eYnRctdbl4HYQkiQDzrOWcg8GY8NnMWdFW7bU2HOmsgBuqak
3nXg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1790477815; x=1791082615;
h=content-transfer-encoding:mime-version:references:in-reply-to
: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=Zx161GO4leyejnwa92HDTsrJTQOft6nH8qorocIvjzU=;
b=n0IsuuwpbpSoiojHhqU0+89AdzO/7s4iuu2gnCiETKSy3rEU8juKxzAutfyPbkBAyE
8DZI43O27AWuUnFkZy4I2ZWxnMVyyqfIyeb+5gXiBywPI/ljUkNpr32Id/pp1GQhNHfq
RjZZOhKuYOU+05jyroasGxy8txkAOjWp3JgXcSx6VAtp4Su5OELgdmgFpRo99ZC1RbMU
Xlbry4zUzaT2Y+3TuQaKKnbQtCRD8uw2v7KeYGaREz1WFnfGYcmWN3F25f28R8e8cumz
aIvii7h1RsIewW7uOyHJVUzG/yy90d4ubjeWLjdIH9gKWzrY0GC7HVj6fMa4TdFuV7ef
zE8w==
X-Forwarded-Encrypted: i=1;
AKwUvBzZLAWx04f1fIryoQQ3TMMiuTIG0OPsnDJNtoJpwf6xr7PLKCA3vMkLMy7Vf6MQ+C+sfVtfhyeEiyyksg==@lists.linux.dev
X-Gm-Message-State: AFq9FYJrFXqmM4tT4orpHvV5ZozXRddP19VJmlB/hkPEsU1DXdGVzY+A
tKLoRa1hRtFQ0IQbA73hMVoyhLanLVsB5JEUq4bbS9nCLup7AD2YgtNdYyO9HFQHZcqe
X-Gm-Gg: AYBFou2DaBnXhP1vyxDRUSsqhUlWOhfJC/YYWijnh1sglR9DVLNZw9d26C2zPmFne94
OtWGX9VONI8R4cyDXlTHkz+zPETGLmczT+sPcxvuqJoDtq81jKGATYbshbqeE07cW6Q/U1BvzIP
3zbv9N8ZZEbQQeWXBJ0IEX9BEUWYY7rvyY++X4BSeoLtK9Tih/4sVIQN0zuybWGngdN4sbndRz3
qOWTfaFuxMfhm9NetSRjwC84MW++5UQVfbYhY21gsALYGk2LcHwDXUHH1hB6sUCF3IZ2xRhW8vd
HD3+D+so0aubueFwp6GWyyFNOpOYgxAa/qkulgLtO5WOMMkoneITYBWpRNFyf5DflGNLImWgBc8
kZMSxQX1YWXpF4F5+EJr5r7MgFHuuupS2TejH4IQhHY/cB3f4v0BoCKPH74i+yscDYIUtrkiVRQ
aU7ryF3BX8vAXkb1aJHGPZqBwtRkliP9vyq7XOq15gkFcGDCENPxrQ3k4WH8AQuahS4xV4ajr3t
X8A
X-Received: by 2002:a17:903:984:b0:2dd:c100:4246 with SMTP id
d9443c01a7336-2df7e13c585mr80615525ad.42.1790477814644;
Sat, 26 Sep 2026 19:56:54 -0700 (PDT)
Received: from ltu.. ([171.245.4.151])
by smtp.gmail.com with ESMTPSA id
d9443c01a7336-2df9142bfd4sm25512285ad.52.2026.09.26.19.56.47
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Sat, 26 Sep 2026 19:56:52 -0700 (PDT)
From: Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog>
To: Wilken Gottwalt <wilken.gottwalt@posteo.net>,
Bjorn Andersson <andersson@kernel.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.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>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
Philipp Zabel <p.zabel@pengutronix.de>,
Andre Przywara <andre.przywara@arm.com>,
Bastian Germann <bage@debian.org>,
linux-remoteproc@vger.kernel.org,
devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev,
linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org,
tien.nguyenminh@embeddedlinux.blog
Subject: [PATCH 3/3] riscv: dts: allwinner: d1-t113: Add the hardware spinlock
Date: Sun, 27 Sep 2026 09:56:26 +0700
Message-Id: <20260927025626.69614-4-tien.nguyenminh@embeddedlinux.blog>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20260927025626.69614-1-tien.nguyenminh@embeddedlinux.blog>
References: <20260927025626.69614-1-tien.nguyenminh@embeddedlinux.blog>
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-Transfer-Encoding: 8bit
X-Rspamd-Server: rspamd-worker-8404
X-Spamd-Result: default: False [-0.66 / 15.00];
BAYES_HAM(-5.50)[100.00%];
RBL_SENDERSCORE(2.00)[172.105.105.114:from];
SUSPICIOUS_RECIPS(1.50)[];
MID_CONTAINS_FROM(1.00)[];
R_MISSING_CHARSET(0.50)[];
MAILLIST(-0.15)[generic];
MIME_GOOD(-0.10)[text/plain];
BAD_REP_POLICIES(0.10)[];
HAS_LIST_UNSUB(-0.01)[];
DMARC_NA(0.00)[embeddedlinux.blog];
RCPT_COUNT_TWELVE(0.00)[23];
TAGGED_RCPT(0.00)[dt];
DBL_PROHIBIT(0.00)[0.25.242.48:email];
FREEMAIL_CC(0.00)[linux.alibaba.com,kernel.org,gmail.com,sholland.org,dabbelt.com,eecs.berkeley.edu,ghiti.fr,pengutronix.de,arm.com,debian.org,vger.kernel.org,lists.infradead.org,lists.linux.dev,embeddedlinux.blog];
DBL_BLOCKED_OPENRESOLVER(0.00)[tor.lore.kernel.org:rdns,tor.lore.kernel.org:helo,embeddedlinux.blog:email,0.45.218.72:email];
PRECEDENCE_BULK(0.00)[];
FROM_HAS_DN(0.00)[];
RCVD_COUNT_FIVE(0.00)[6];
FORGED_RECIPIENTS_MAILLIST(0.00)[];
MIME_TRACE(0.00)[0:+];
R_SPF_ALLOW(0.00)[+ip4:172.105.105.114];
TO_DN_SOME(0.00)[];
FORGED_SENDER_MAILLIST(0.00)[];
RCVD_TLS_LAST(0.00)[];
TAGGED_FROM(0.00)[bounces-26309-noreply=patchwork.local];
ASN(0.00)[asn:63949, ipnet:172.105.96.0/20, country:SG];
FROM_NEQ_ENVFROM(0.00)[tien.nguyenminh@embeddedlinux.blog,linux-sunxi@lists.linux.dev];
ARC_ALLOW(0.00)[subspace.kernel.org:s=arc-20240116:i=1];
RCVD_VIA_SMTP_AUTH(0.00)[]
X-Rspamd-Queue-Id: 5A0B51C1D46
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 |
hwspinlock: sun6i: Allwinner D1 and T113 support
|
|
Commit Message
Nguyen Minh Tien
Sept. 27, 2026, 2:56 a.m. UTC
Add the hardware spinlock of the D1 and T113. It goes in
sunxi-d1-t113.dtsi rather than sunxi-d1s-t113.dtsi, as the D1s manual
has no spinlock in its memory map.
Signed-off-by: Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog>
---
arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)
Comments
On Sun, 27 Sep 2026 09:56:26 +0700 Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog> wrote: > Add the hardware spinlock of the D1 and T113. It goes in > sunxi-d1-t113.dtsi rather than sunxi-d1s-t113.dtsi, as the D1s manual > has no spinlock in its memory map. > > Signed-off-by: Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog> > --- > arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi > b/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi index 3b077dc086..228cc5c074 100644 > --- a/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi > +++ b/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi > @@ -11,5 +11,14 @@ dsp_wdt: watchdog@1700400 { > clock-names = "hosc", "losc"; > status = "reserved"; > }; > + > + hwlock: hwlock@3005000 { > + compatible = "allwinner,sun20i-d1-hwspinlock", > + "allwinner,sun6i-a31-hwspinlock"; > + reg = <0x3005000 0x1000>; > + clocks = <&ccu CLK_BUS_SPINLOCK>; > + resets = <&ccu RST_BUS_SPINLOCK>; > + #hwlock-cells = <1>; > + }; > }; > }; Wouldn't it make more sense to add the "allwinner,sun20i-d1-hwspinlock" line to the driver in the sun6i_hwspinlock_ids struct, drop "allwinner,sun6i-a31-hwspinlock" here in the D1 device tree and update the yaml file accordingly? Hmm, there are actually a lot more devices, which support that spinlock (H2, H2+, H3, H5, H6...). A31 was the first one introducing that IP core, but newer reference manuals removed the spinlock section completely. There it is an unnamed 4k block in the memory map. Bjorn, what do you think? Just stay with the "allwinner,sun6i-a31-hwspinlock" string or add all the possible combinations like "allwinner,sun8i-h2-plus-hwspinlock" or "allwinner,sun8i-a83t-hwspinlock". I mean, it is just a naming game and there are 10+ SoCs supporting this spinlock register file. Oh, and I may be able to test it against the D1, I own a Sipeed Nezha. Though, setting that one up for kernel + FreeRTOS testing is really, uhm, annoying. greetings, Wilken
Hi Wilken, > Wouldn't it make more sense to add the "allwinner,sun20i-d1-hwspinlock" line to > the driver in the sun6i_hwspinlock_ids struct, drop > "allwinner,sun6i-a31-hwspinlock" here in the D1 device tree and update the yaml > file accordingly? Thanks for looking at it. Bjorn hasn't replied yet, so I looked a bit more at the naming. I'd like to keep the A31 fallback: it's the usual pattern, other blocks in this dtsi do the same (timer, I2S, LED controller), and Conor already acked the binding in 2/3. If Bjorn prefers a driver entry instead, I'm fine to change it. > Oh, and I may be able to test it against the D1, I own a Sipeed Nezha. That would be great. You don't need FreeRTOS for it: I tested with a small Linux module that takes each lock and checks the status register. I can clean it up for the single-core D1 and send it. Thanks, Tien
On Wed, 30 Sep 2026 20:02:21 +0700 Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog> wrote: > Hi Wilken, > > > Wouldn't it make more sense to add the "allwinner,sun20i-d1-hwspinlock" line to > > the driver in the sun6i_hwspinlock_ids struct, drop > > "allwinner,sun6i-a31-hwspinlock" here in the D1 device tree and update the yaml > > file accordingly? > > Thanks for looking at it. Bjorn hasn't replied yet, so I looked a bit > more at the naming. I'd like to keep the A31 fallback: it's the usual > pattern, other blocks in this dtsi do the same (timer, I2S, LED > controller), and Conor already acked the binding in 2/3. If Bjorn > prefers a driver entry instead, I'm fine to change it. Yeah, Conor was a bit quick to act here, such things happen often with patchsets made out of documentation/devicetrees and code. Though, the get clock and resets patch is fine. The driver could use some modernization. > > Oh, and I may be able to test it against the D1, I own a Sipeed Nezha. > > That would be great. You don't need FreeRTOS for it: I tested with a > small Linux module that takes each lock and checks the status > register. I can clean it up for the single-core D1 and send it. Uhm, the Linux-only test doesn't work as a hwspinlock test, it misses the entire point of the primitive. A hwspinlock arbitrates between two independent agents, in this case, Linux running on the C906 core and FreeRTOS running on the HiFi DSP, both sharing the same memory bus and other hardware. If Linux is the only one who ever takes the locks, it is simultaneously writer and reader of the status register, so the test cannot fail even for a broken (or fake) implementation. That would basically test nothing at all, well, maybe it would be some kind of bring-up test, but overall quite useless. greetings, Wilken
On Wed, Sep 30, 2026 at 02:05:47PM +0000, Wilken Gottwalt wrote: > On Wed, 30 Sep 2026 20:02:21 +0700 > Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog> wrote: > > > Hi Wilken, > > > > > Wouldn't it make more sense to add the "allwinner,sun20i-d1-hwspinlock" line to > > > the driver in the sun6i_hwspinlock_ids struct, drop > > > "allwinner,sun6i-a31-hwspinlock" here in the D1 device tree and update the yaml > > > file accordingly? > > > > Thanks for looking at it. Bjorn hasn't replied yet, so I looked a bit > > more at the naming. I'd like to keep the A31 fallback: it's the usual > > pattern, other blocks in this dtsi do the same (timer, I2S, LED > > controller), and Conor already acked the binding in 2/3. If Bjorn > > prefers a driver entry instead, I'm fine to change it. > > Yeah, Conor was a bit quick to act here, such things happen often with patchsets > made out of documentation/devicetrees and code. Though, the get clock and resets > patch is fine. The driver could use some modernization. I dunno, was I too quick to act? The patched looked correct to me, since it was using a fallback to a device that it appears to be compatible with. Had the series done what you're suggesting, my review feedback would have been to tell the Tien to add a fallback. > > Bjorn, what do you think? Just stay with the "allwinner,sun6i-a31-hwspinlock" > > string or add all the possible combinations like > > "allwinner,sun8i-h2-plus-hwspinlock" or "allwinner,sun8i-a83t-hwspinlock". > > I mean, it is just a naming game and there are 10+ SoCs supporting this > > spinlock register file All devices compatible with the a31 should use the a31 as a fallback. > > > > Oh, and I may be able to test it against the D1, I own a Sipeed Nezha. > > > > That would be great. You don't need FreeRTOS for it: I tested with a > > small Linux module that takes each lock and checks the status > > register. I can clean it up for the single-core D1 and send it. > > Uhm, the Linux-only test doesn't work as a hwspinlock test, it misses the entire > point of the primitive. A hwspinlock arbitrates between two independent agents, > in this case, Linux running on the C906 core and FreeRTOS running on the HiFi > DSP, both sharing the same memory bus and other hardware. If Linux is the only > one who ever takes the locks, it is simultaneously writer and reader of the status > register, so the test cannot fail even for a broken (or fake) implementation. That > would basically test nothing at all, well, maybe it would be some kind of bring-up > test, but overall quite useless. > > greetings, > Wilken
On Fri, 2 Oct 2026 08:32:51 +0100 Conor Dooley <conor.dooley@microchip.com> wrote: > On Wed, Sep 30, 2026 at 02:05:47PM +0000, Wilken Gottwalt wrote: > > On Wed, 30 Sep 2026 20:02:21 +0700 > > Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog> wrote: > > > > > Hi Wilken, > > > > > > > Wouldn't it make more sense to add the "allwinner,sun20i-d1-hwspinlock" line to > > > > the driver in the sun6i_hwspinlock_ids struct, drop > > > > "allwinner,sun6i-a31-hwspinlock" here in the D1 device tree and update the yaml > > > > file accordingly? > > > > > > Thanks for looking at it. Bjorn hasn't replied yet, so I looked a bit > > > more at the naming. I'd like to keep the A31 fallback: it's the usual > > > pattern, other blocks in this dtsi do the same (timer, I2S, LED > > > controller), and Conor already acked the binding in 2/3. If Bjorn > > > prefers a driver entry instead, I'm fine to change it. > > > > Yeah, Conor was a bit quick to act here, such things happen often with patchsets > > made out of documentation/devicetrees and code. Though, the get clock and resets > > patch is fine. The driver could use some modernization. > > I dunno, was I too quick to act? The patched looked correct to me, since > it was using a fallback to a device that it appears to be compatible > with. Had the series done what you're suggesting, my review feedback > would have been to tell the Tien to add a fallback. I'm just not sure how to actually do it right, because so many SoCs include that feature. That is why I asked how you would do it having more insight as a subsystem maintainer. It just looks incomplete to me. In the past I actually verified it working with H2, H2+ and H3, none of them being "allwinner,sun6i-a31-hwspinlock". > > > Bjorn, what do you think? Just stay with the "allwinner,sun6i-a31-hwspinlock" > > > string or add all the possible combinations like > > > "allwinner,sun8i-h2-plus-hwspinlock" or "allwinner,sun8i-a83t-hwspinlock". > > > I mean, it is just a naming game and there are 10+ SoCs supporting this > > > spinlock register file > > All devices compatible with the a31 should use the a31 as a fallback. > > > > > > > Oh, and I may be able to test it against the D1, I own a Sipeed Nezha. > > > > > > That would be great. You don't need FreeRTOS for it: I tested with a > > > small Linux module that takes each lock and checks the status > > > register. I can clean it up for the single-core D1 and send it. > > > > Uhm, the Linux-only test doesn't work as a hwspinlock test, it misses the entire > > point of the primitive. A hwspinlock arbitrates between two independent agents, > > in this case, Linux running on the C906 core and FreeRTOS running on the HiFi > > DSP, both sharing the same memory bus and other hardware. If Linux is the only > > one who ever takes the locks, it is simultaneously writer and reader of the status > > register, so the test cannot fail even for a broken (or fake) implementation. That > > would basically test nothing at all, well, maybe it would be some kind of bring-up > > test, but overall quite useless.
On Fri, Oct 2, 2026 at 3:34 PM Conor Dooley <conor.dooley@microchip.com> wrote: > > On Wed, Sep 30, 2026 at 02:05:47PM +0000, Wilken Gottwalt wrote: > > On Wed, 30 Sep 2026 20:02:21 +0700 > > Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog> wrote: > > > > > Hi Wilken, > > > > > > > Wouldn't it make more sense to add the "allwinner,sun20i-d1-hwspinlock" line to > > > > the driver in the sun6i_hwspinlock_ids struct, drop > > > > "allwinner,sun6i-a31-hwspinlock" here in the D1 device tree and update the yaml > > > > file accordingly? > > > > > > Thanks for looking at it. Bjorn hasn't replied yet, so I looked a bit > > > more at the naming. I'd like to keep the A31 fallback: it's the usual > > > pattern, other blocks in this dtsi do the same (timer, I2S, LED > > > controller), and Conor already acked the binding in 2/3. If Bjorn > > > prefers a driver entry instead, I'm fine to change it. > > > > Yeah, Conor was a bit quick to act here, such things happen often with patchsets > > made out of documentation/devicetrees and code. Though, the get clock and resets > > patch is fine. The driver could use some modernization. > > I dunno, was I too quick to act? The patched looked correct to me, since > it was using a fallback to a device that it appears to be compatible > with. Had the series done what you're suggesting, my review feedback > would have been to tell the Tien to add a fallback. > > > > Bjorn, what do you think? Just stay with the "allwinner,sun6i-a31-hwspinlock" > > > string or add all the possible combinations like > > > "allwinner,sun8i-h2-plus-hwspinlock" or "allwinner,sun8i-a83t-hwspinlock". > > > I mean, it is just a naming game and there are 10+ SoCs supporting this > > > spinlock register file > > All devices compatible with the a31 should use the a31 as a fallback. +1. If the hardware is backward compatible, then with the fallback compatible everything works. We ask folks to always add SoC-specific compatibles just in case. ChenYu > > > > > > Oh, and I may be able to test it against the D1, I own a Sipeed Nezha. > > > > > > That would be great. You don't need FreeRTOS for it: I tested with a > > > small Linux module that takes each lock and checks the status > > > register. I can clean it up for the single-core D1 and send it. > > > > Uhm, the Linux-only test doesn't work as a hwspinlock test, it misses the entire > > point of the primitive. A hwspinlock arbitrates between two independent agents, > > in this case, Linux running on the C906 core and FreeRTOS running on the HiFi > > DSP, both sharing the same memory bus and other hardware. If Linux is the only > > one who ever takes the locks, it is simultaneously writer and reader of the status > > register, so the test cannot fail even for a broken (or fake) implementation. That > > would basically test nothing at all, well, maybe it would be some kind of bring-up > > test, but overall quite useless. > > > > greetings, > > Wilken
On Fri, Oct 2, 2026 at 3:48 PM Wilken Gottwalt <wilken.gottwalt@posteo.net> wrote: > > On Fri, 2 Oct 2026 08:32:51 +0100 > Conor Dooley <conor.dooley@microchip.com> wrote: > > > On Wed, Sep 30, 2026 at 02:05:47PM +0000, Wilken Gottwalt wrote: > > > On Wed, 30 Sep 2026 20:02:21 +0700 > > > Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog> wrote: > > > > > > > Hi Wilken, > > > > > > > > > Wouldn't it make more sense to add the "allwinner,sun20i-d1-hwspinlock" line to > > > > > the driver in the sun6i_hwspinlock_ids struct, drop > > > > > "allwinner,sun6i-a31-hwspinlock" here in the D1 device tree and update the yaml > > > > > file accordingly? > > > > > > > > Thanks for looking at it. Bjorn hasn't replied yet, so I looked a bit > > > > more at the naming. I'd like to keep the A31 fallback: it's the usual > > > > pattern, other blocks in this dtsi do the same (timer, I2S, LED > > > > controller), and Conor already acked the binding in 2/3. If Bjorn > > > > prefers a driver entry instead, I'm fine to change it. > > > > > > Yeah, Conor was a bit quick to act here, such things happen often with patchsets > > > made out of documentation/devicetrees and code. Though, the get clock and resets > > > patch is fine. The driver could use some modernization. > > > > I dunno, was I too quick to act? The patched looked correct to me, since > > it was using a fallback to a device that it appears to be compatible > > with. Had the series done what you're suggesting, my review feedback > > would have been to tell the Tien to add a fallback. > > I'm just not sure how to actually do it right, because so many SoCs include that > feature. That is why I asked how you would do it having more insight as a > subsystem maintainer. It just looks incomplete to me. In the past I actually > verified it working with H2, H2+ and H3, none of them being > "allwinner,sun6i-a31-hwspinlock". Even if all the SoCs had them, if no one enabled and tested them, then they wouldn't have entries in the binding or dtsi files. > > > > Bjorn, what do you think? Just stay with the "allwinner,sun6i-a31-hwspinlock" > > > > string or add all the possible combinations like > > > > "allwinner,sun8i-h2-plus-hwspinlock" or "allwinner,sun8i-a83t-hwspinlock". > > > > I mean, it is just a naming game and there are 10+ SoCs supporting this > > > > spinlock register file > > > > All devices compatible with the a31 should use the a31 as a fallback. > > > > > > > > > > Oh, and I may be able to test it against the D1, I own a Sipeed Nezha. > > > > > > > > That would be great. You don't need FreeRTOS for it: I tested with a > > > > small Linux module that takes each lock and checks the status > > > > register. I can clean it up for the single-core D1 and send it. > > > > > > Uhm, the Linux-only test doesn't work as a hwspinlock test, it misses the entire > > > point of the primitive. A hwspinlock arbitrates between two independent agents, > > > in this case, Linux running on the C906 core and FreeRTOS running on the HiFi > > > DSP, both sharing the same memory bus and other hardware. If Linux is the only > > > one who ever takes the locks, it is simultaneously writer and reader of the status > > > register, so the test cannot fail even for a broken (or fake) implementation. That > > > would basically test nothing at all, well, maybe it would be some kind of bring-up > > > test, but overall quite useless.
On Fri, Oct 02, 2026 at 07:48:21AM +0000, Wilken Gottwalt wrote: > On Fri, 2 Oct 2026 08:32:51 +0100 > Conor Dooley <conor.dooley@microchip.com> wrote: > > > On Wed, Sep 30, 2026 at 02:05:47PM +0000, Wilken Gottwalt wrote: > > > On Wed, 30 Sep 2026 20:02:21 +0700 > > > Nguyen Minh Tien <tien.nguyenminh@embeddedlinux.blog> wrote: > > > > > > > Hi Wilken, > > > > > > > > > Wouldn't it make more sense to add the "allwinner,sun20i-d1-hwspinlock" line to > > > > > the driver in the sun6i_hwspinlock_ids struct, drop > > > > > "allwinner,sun6i-a31-hwspinlock" here in the D1 device tree and update the yaml > > > > > file accordingly? > > > > > > > > Thanks for looking at it. Bjorn hasn't replied yet, so I looked a bit > > > > more at the naming. I'd like to keep the A31 fallback: it's the usual > > > > pattern, other blocks in this dtsi do the same (timer, I2S, LED > > > > controller), and Conor already acked the binding in 2/3. If Bjorn > > > > prefers a driver entry instead, I'm fine to change it. > > > > > > Yeah, Conor was a bit quick to act here, such things happen often with patchsets > > > made out of documentation/devicetrees and code. Though, the get clock and resets > > > patch is fine. The driver could use some modernization. > > > > I dunno, was I too quick to act? The patched looked correct to me, since > > it was using a fallback to a device that it appears to be compatible > > with. Had the series done what you're suggesting, my review feedback > > would have been to tell the Tien to add a fallback. > > I'm just not sure how to actually do it right, because so many SoCs include that > feature. If devices share a programming model with existing devices or have a programming model that's a functional superset of existing devices (so a new optional feature etc) they should use the existing device as a fallback compatible. > That is why I asked how you would do it having more insight as a > subsystem maintainer. > It just looks incomplete to me. In the past I actually > verified it working with H2, H2+ and H3, none of them being > "allwinner,sun6i-a31-hwspinlock". Then probably there should be a patch adding all of these to the enum alongside the new d1 compatible. Cheers, Conor.
diff --git a/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi b/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi index 3b077dc086..228cc5c074 100644 --- a/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi +++ b/arch/riscv/boot/dts/allwinner/sunxi-d1-t113.dtsi @@ -11,5 +11,14 @@ dsp_wdt: watchdog@1700400 { clock-names = "hosc", "losc"; status = "reserved"; }; + + hwlock: hwlock@3005000 { + compatible = "allwinner,sun20i-d1-hwspinlock", + "allwinner,sun6i-a31-hwspinlock"; + reg = <0x3005000 0x1000>; + clocks = <&ccu CLK_BUS_SPINLOCK>; + resets = <&ccu RST_BUS_SPINLOCK>; + #hwlock-cells = <1>; + }; }; };