[v4,1/2] dt-bindings: timer: thead,c900-aclint-mtimer: separate mtime and mtimecmp regs
Message ID | IA1PR20MB4953F9D77FFC76A9D236922DBBB6A@IA1PR20MB4953.namprd20.prod.outlook.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp1031899vqn; Fri, 17 Nov 2023 23:10:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2mx64yAXuIbD7HZSRC7h8Z2hQvS1X91N9xrWF1+3O/sJSfUxspSsXcyePug2bWAIYYqZo X-Received: by 2002:a17:90b:2dc3:b0:280:47ba:767a with SMTP id sk3-20020a17090b2dc300b0028047ba767amr9833138pjb.16.1700291408841; Fri, 17 Nov 2023 23:10:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1700291408; cv=pass; d=google.com; s=arc-20160816; b=nmDzj5wYTd/BAi+c/DSWsMzbna0q6tmJvTIrMtUX11J27WL705WCDNCjPWBuzmCenP UmxhEK/ycnAIGWGZ672hZj2QckqJ6/2KUOQXhl7jSZDaraBUA0c8AYOB6ozs+XlVUPLq 1tYWUGSt0j9SDyGuzvj1L+znqxucP9pfcI8ouUC0pB9v2FvnCx7O4nbPqgOMIZqUjPGl RwG6FJzdWK2Ndi+0dMaXdghR4SS8KZvuodj3q79p3DUkczHeAinxgxgSR/pLy0Pfywqt ro2FaO3BVApqGFvMEA3o72vuoHigmltyjWaAK5J7wi1RjdF8UoZxF1DBNCXLhR/uCoHL ojzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7xt5wP1JZCLwAmUG7yCxzVydhc1wyn961JTwC0k3QEw=; fh=0lHf+QhZFUhpbRlZzusDT5V/JEtNc/cLPjjc/InoTiE=; b=izY1LDGadIuM55WU7HWNlV3dGmsVydxPcvWDf2wTIX+mfLI7STGbhrmQvtC9GW+O1/ gs1jnzx7Yi30LvcJ1ErzIBwFEEyY0E+jbjjoSyR9Ssmdp7q3SKEscUMQk4lDyLoXlEvw czh36mv7HGoyiJp5TpHwaCngBcsWKy1CqxL9puvOcONsE8v1FL/3lxK5huV1LWIG27iU t42GcNeH8okOLtx6uLOEoI2AM1WV3m9aAOu997vMk4AODQ/Zp/+ON7+Y9cR+KclaNW56 H4eCHFp/+QxrsdHbg4Rl8CD4eA7jaV+H5sZ9yczTQFhuseDgfb1STnk1ahDfWL+jUl0m IHNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b="KHaBws/r"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id t21-20020a17090a449500b00283a1123a02si2030744pjg.96.2023.11.17.23.10.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 23:10:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b="KHaBws/r"; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id F3D6C809679B; Fri, 17 Nov 2023 23:10:05 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231366AbjKRHJo (ORCPT <rfc822;jaysivo@gmail.com> + 29 others); Sat, 18 Nov 2023 02:09:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbjKRHJn (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 18 Nov 2023 02:09:43 -0500 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10olkn2054.outbound.protection.outlook.com [40.92.40.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24252D75; Fri, 17 Nov 2023 23:09:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aefKmjY1G7dDqraigFWFBn23YoMNXW+wklzR3/n4eAvrLHBUI25XXgarJajtbO04RrY6T2qVoU444IgGYf14m+MArLADB0Z8rBC/2JicQwT1tJX9GWhEc7bHeYREY+Mk8bYq42NiFwETIqa2Jt79ZJDET2bvvbtphuLL6RskrB8SqAMpvnXVSpQARBB4HACzr7ANppvKHmADzBB0JgA5pduocO5BX9nW9eKtH48wSIRCiv86kCJiBhknczENizQ7UtwU9cP5njNTqbi2A/AgpR+AdYYOj4QzkRKSOmkVOabos15bQjrAOOHbtCHtmAgSqoRdrDxBzHmSn6qvBywulA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7xt5wP1JZCLwAmUG7yCxzVydhc1wyn961JTwC0k3QEw=; b=femc118Zp0xgk2f8MEM6XQppw3/fLNnQHh5EP3uzlwgAGbdNHpLXVK+pwLFkiMuy/iN/w5m7xZf1Zc45EFcGFH4M7yZAmxZ4i4DLi/V1dzZ26rPUuvMjXoyq+MVK6F8MmqKEexouohNRULlKgdGnLHo6M2GziHNULPzxJ6Zg3cwnLXTMvpfFPaeXFSbE91GHhhdRH8x0nBB8RK+vyOjiwoOPsI2/A0wL9HEPz17ovwNnz5M5Bk4b44pMHdOcbRlakdzSAUBIJgZLyPAn1/yeGb+8r1wlLOskk5XZ36hNqtx0PE8Bq/BDefGdZSkP3Dg854Kjn9UcTOuiGf5iIu4CPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7xt5wP1JZCLwAmUG7yCxzVydhc1wyn961JTwC0k3QEw=; b=KHaBws/rKgUFPg37sbyll/M9xaKKY8LTOWz5IMCb3hmODJ/Gq/Mj9Vi0S+8zgQbhpra4wj/opCKPSJjcX02aGUn5Gz6G5suPeZJddQ01U9972LIWIdwpLUkfFS0hx/rRS6TAsn0y1+jSKAlJqD5P3Iz8i1igGOaYhHLne/wDnP/l6AUuO3ETdRRK6jsrs0AEvsj9l9nehjiL7fDzZI0zAQqlDWktTbML152QRr0bC+ZpLYP/zw6XArt6se/mpuYSOes0C2nKsILg3comxojWE+Zto3mVdlsx0KdhMiaU5IcjG9xOlw5eIQBxz1OB/tMso5XADcTGTBST/pkf7ESsyQ== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by DS0PR20MB5788.namprd20.prod.outlook.com (2603:10b6:8:148::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6977.29; Sat, 18 Nov 2023 07:09:38 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::55b:c350:980:ad8]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::55b:c350:980:ad8%6]) with mapi id 15.20.7002.025; Sat, 18 Nov 2023 07:09:38 +0000 From: Inochi Amaoto <inochiama@outlook.com> To: Daniel Lezcano <daniel.lezcano@linaro.org>, Thomas Gleixner <tglx@linutronix.de>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Inochi Amaoto <inochiama@outlook.com>, Chen Wang <unicorn_wang@outlook.com> Cc: Anup Patel <anup@brainfault.org>, Samuel Holland <samuel.holland@sifive.com>, Guo Ren <guoren@kernel.org>, Jisheng Zhang <jszhang@kernel.org>, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org Subject: [PATCH v4 1/2] dt-bindings: timer: thead,c900-aclint-mtimer: separate mtime and mtimecmp regs Date: Sat, 18 Nov 2023 15:10:26 +0800 Message-ID: <IA1PR20MB4953F9D77FFC76A9D236922DBBB6A@IA1PR20MB4953.namprd20.prod.outlook.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <IA1PR20MB4953C82499C5D81D2C6A020BBBB6A@IA1PR20MB4953.namprd20.prod.outlook.com> References: <IA1PR20MB4953C82499C5D81D2C6A020BBBB6A@IA1PR20MB4953.namprd20.prod.outlook.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-TMN: [7Wn98kPZzhlqDRSnPBsFClfz/5h4pgUfVZrY+WH2EXQ=] X-ClientProxiedBy: BYAPR05CA0056.namprd05.prod.outlook.com (2603:10b6:a03:74::33) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20231118071028.248483-1-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|DS0PR20MB5788:EE_ X-MS-Office365-Filtering-Correlation-Id: b0079e89-d4c2-4cb5-071a-08dbe8055384 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yUbWmAMfiMdNMed2PAjU9Qyb7WECmUDB7nd1q8JOFHJJ999XvHnWY9Sld2WlRzJwnMlj6SLjvjCexoWjTLnt8eQiDPcdi9wqyPrjjxKmZByKhrXaf7oI7VOofpVhA+tyRSbU5fU+qlqWyuY241XfeFwn9ahh2TCe0zrGz8LeyTghKa7MC/XjofMZM2tNfjgBEaKwZB3zOblbFLBcKDgATIw7fDMdy538QGUMf4jzw8PB5TY9m5aBOKZ8QHwGVWkr5LEp/vXBkflwU0dH5H0MAHFLSV+t1B51f3IqovAKQiiujIAm81555vBj4wf+nKJ035fmM/nI+LkaYht43q7I78sC4z4QorgXGLh71Aqj5B98JuROylQGC5OSfAi/mSaJLDi7oyIFGi+7oNc/v5UFHzHePhJwiNZmfkS6gkdd/AYXlIwRec1AXJVv+n203NaOSyDIu4uWRFCyPs4g64wWYQMw0oAvGqoIPlVnFPEYKxmzbNIOGaRL1ZiZHIVelTpS2/D+NjaV6AeSiJZGzasA1Ovb3wVfTMysAnSU/w5VbCgcJGkZ4PIc4MTscimgMJ0BpHq2uD19VXSQAOJe/6av3byL8myprP55TOFG4hO4VXctXKKy2SnkcSXIbzeeJeD2k1OY8ndKgYNDL+aLNpLMjlIra75mZzYeuhqScGf0JO4= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: J8z5kcswpejLk3xYcVFf7tf+buMYMCQYJDXWEYjw90m+qf5RURzeUghNopsmsy4RhFboBvGQUVt9LWXMyiBqKKSYCCucTR56zONUJJB7qz6K4mMeWW3Wj/B1Bj5gfHLfMLcpxFdgutZOYQxc1cRUKudJ9acFrDXrD9Eps0+xEQGAEspACoLCisBDmNTKGPrswItFQ8DmpZdrjAq/8vvIZRF7DzVu+aCKme5IMh+kCrbsdHoCKKcTngSYX4JWfhamZBxbwIOFtoVOSlq3I29FgplbhpJ+VwFC9+fYCqvCMUkao/MRcGt/YUhnSKN1JSZOU1DGPUja0n/p23skFxbgMt3jR9Pl33fCN88eEwwYz7+PzaJwJmFz5RbiFft5hHsVSnDblLgG9X4Hus6Z7kuQvdtOBExoca01CUtjvu7fcyI6jX9rPr3aNffY/aUR0Z6y57XAu0NbeXlowOvIyPcty75JhNHydFJKfjyjwKeIE12HTCaOed3mrg6fVckomBi+k55huvd3I6FsbFI2S3fO3nzWie0He7QUVGLDmDtgCVhHKqc3QDgR6b30Lkuf5K8UO+as20sBaQdVrRgDzDIglyBQrTHMFmrNznEqewtf4nYsuAmDk6PF0wQh3mQIoYRlMK7qRFak/uNbrsqykk1yccTG9gijDurepxNR+xE+mR9NUN5GM0D1r350KbINKQSXXMANr+iTBIsxtY9GcAREtlBnfBO6CSOo/ouJxjONBnyhTfLAaC/l1DDKdIqo1JV3GLpKz0LZX+x8RtYoy8htWEuH7RjerrFglvmQXfaVbrcXr5O8N9kU/+IYiX4/NA8SOymyQvJYA0WCclYRqsZJk/WO8md+gS33lsyHRSuociBPGzzS5MVA6jZ0miL6N0TWJCUJ4kJZU8NUqLP26ag5kwHaUR8szFXwDIV5P2tCuRgwvmG/7vC8h7OuuDCkdbgkXH45BZjPsQ1ed1+mENpmrl1ebPFVC0+JkZWXve8FXzTYghRR9uXnN4F8Iz1xTFHEmUwz5T8NwF9BabtytBvHZpV8lzUzWxPlN+7molfcgnt1TtxWrNyAldEimKyn4sAEni09bDPRfGqVuMqaIH8lbY0nhYv95QFvBi4x4xPoDaaD51mxA9CmZNsDGojdPAZlWlSyLy2Z7pD3bxRC6l6BQ2raeVyLhQkK7eNDl+lmA+a2GIx2hrdGKDne0ATf4ITWjr6SJEKW8wby9pz3hPI1C/cbQLnITZABDMxUFJYmFYI= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0079e89-d4c2-4cb5-071a-08dbe8055384 X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Nov 2023 07:09:37.9176 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR20MB5788 X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 17 Nov 2023 23:10:06 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782884763854479689 X-GMAIL-MSGID: 1782884763854479689 |
Series |
Change the sg2042 timer layout to fit aclint format
|
|
Commit Message
Inochi Amaoto
Nov. 18, 2023, 7:10 a.m. UTC
The timer registers of aclint don't follow the clint layout and can
be mapped on any different offset. As sg2042 uses separated timer
and mswi for its clint, it should follow the aclint spec and have
separated registers.
The previous patch introduced a new type of T-HEAD aclint timer which
has clint timer layout. Although it has the clint timer layout, it
should follow the aclint spec and uses the separated mtime and mtimecmp
regs. So a ABI change is needed to make the timer fit the aclint spec.
To make T-HEAD aclint timer more closer to the aclint spec, use
regs-names to represent the mtimecmp register, which can avoid hack
for unsupport mtime register of T-HEAD aclint timer.
Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer")
Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html
Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc
---
.../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
--
2.42.1
Comments
Yo, On Sat, Nov 18, 2023 at 03:10:26PM +0800, Inochi Amaoto wrote: > The timer registers of aclint don't follow the clint layout and can > be mapped on any different offset. As sg2042 uses separated timer > and mswi for its clint, it should follow the aclint spec and have > separated registers. > > The previous patch introduced a new type of T-HEAD aclint timer which > has clint timer layout. Although it has the clint timer layout, it > should follow the aclint spec and uses the separated mtime and mtimecmp > regs. So a ABI change is needed to make the timer fit the aclint spec. > > To make T-HEAD aclint timer more closer to the aclint spec, use > regs-names to represent the mtimecmp register, which can avoid hack > for unsupport mtime register of T-HEAD aclint timer. > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") > Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html > Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc > --- > .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > index fbd235650e52..053488fb1286 100644 > --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > @@ -17,7 +17,20 @@ properties: > - const: thead,c900-aclint-mtimer > > reg: > - maxItems: 1 > + oneOf: > + - items: > + - description: MTIME Registers > + - description: MTIMECMP Registers > + - items: > + - description: MTIMECMP Registers > + > + reg-names: > + oneOf: > + - items: > + - const: mtime > + - const: mtimecmp > + - items: > + - const: mtimecmp > > interrupts-extended: > minItems: 1 > @@ -28,8 +41,34 @@ additionalProperties: false > required: > - compatible > - reg > + - reg-names > - interrupts-extended > > +allOf: > + - if: > + properties: > + compatible: > + contains: > + const: thead,c900-aclint-mtimer Is this being the c900 compatible correct? You mention in your commit message that this split is done on the sg2042, but the rule is applied here for any c900 series "aclint". Do we know if this is a sophgo specific thing (or even sg2042 specific), or if it applies generally? > + then: > + properties: > + reg: > + items: > + - description: MTIMECMP Registers > + reg-names: > + items: > + - const: mtimecmp > + else: > + properties: > + reg: > + items: > + - description: MTIME Registers > + - description: MTIMECMP Registers > + reg-names: > + items: > + - const: mtime > + - const: mtimecmp If it applies generally, I would probably just delete this, but unless someone can confirm this to be general, I'd probably leave the else clause and swap for the specific sg2042 compatible above. Otherwise, this looks like a better fix than you had proposed before :) Thanks, Conor.
>Yo, > >On Sat, Nov 18, 2023 at 03:10:26PM +0800, Inochi Amaoto wrote: >> The timer registers of aclint don't follow the clint layout and can >> be mapped on any different offset. As sg2042 uses separated timer >> and mswi for its clint, it should follow the aclint spec and have >> separated registers. >> >> The previous patch introduced a new type of T-HEAD aclint timer which >> has clint timer layout. Although it has the clint timer layout, it >> should follow the aclint spec and uses the separated mtime and mtimecmp >> regs. So a ABI change is needed to make the timer fit the aclint spec. >> >> To make T-HEAD aclint timer more closer to the aclint spec, use >> regs-names to represent the mtimecmp register, which can avoid hack >> for unsupport mtime register of T-HEAD aclint timer. >> >> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> >> Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") >> Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html >> Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc >> --- >> .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- >> 1 file changed, 41 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >> index fbd235650e52..053488fb1286 100644 >> --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >> +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >> @@ -17,7 +17,20 @@ properties: >> - const: thead,c900-aclint-mtimer >> >> reg: >> - maxItems: 1 >> + oneOf: >> + - items: >> + - description: MTIME Registers >> + - description: MTIMECMP Registers >> + - items: >> + - description: MTIMECMP Registers >> + >> + reg-names: >> + oneOf: >> + - items: >> + - const: mtime >> + - const: mtimecmp >> + - items: >> + - const: mtimecmp >> >> interrupts-extended: >> minItems: 1 >> @@ -28,8 +41,34 @@ additionalProperties: false >> required: >> - compatible >> - reg >> + - reg-names >> - interrupts-extended >> >> +allOf: >> + - if: >> + properties: >> + compatible: >> + contains: >> + const: thead,c900-aclint-mtimer > >Is this being the c900 compatible correct? You mention in your commit >message that this split is done on the sg2042, but the rule is applied >here for any c900 series "aclint". Do we know if this is a sophgo >specific thing (or even sg2042 specific), or if it applies generally? > This can be confirmed. The thead c900 series have no mtime support and there is no evidence that they will implement it. So I think it is OK to applied this restriction for the whole c900 series. >> + then: >> + properties: >> + reg: >> + items: >> + - description: MTIMECMP Registers >> + reg-names: >> + items: >> + - const: mtimecmp > >> + else: >> + properties: >> + reg: >> + items: >> + - description: MTIME Registers >> + - description: MTIMECMP Registers >> + reg-names: >> + items: >> + - const: mtime >> + - const: mtimecmp > >If it applies generally, I would probably just delete this, but unless >someone can confirm this to be general, I'd probably leave the else >clause and swap for the specific sg2042 compatible above. > I suggest keeping this. By taking your advice, this binding has actually become the binding for aclint draft. So I think it is better to preserve this path, otherwise adding the mtime register seems meaningless. But if you think it is OK to add this when adding new compatible or converting it to a generic binding. Feel free to remove it. >Otherwise, this looks like a better fix than you had proposed before :) > Thanks. >Thanks, >Conor. > >
On 2023/11/18 15:10, Inochi Amaoto wrote: > The timer registers of aclint don't follow the clint layout and can > be mapped on any different offset. As sg2042 uses separated timer > and mswi for its clint, it should follow the aclint spec and have > separated registers. > > The previous patch introduced a new type of T-HEAD aclint timer which > has clint timer layout. Although it has the clint timer layout, it > should follow the aclint spec and uses the separated mtime and mtimecmp > regs. So a ABI change is needed to make the timer fit the aclint spec. > > To make T-HEAD aclint timer more closer to the aclint spec, use > regs-names to represent the mtimecmp register, which can avoid hack > for unsupport mtime register of T-HEAD aclint timer. > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") > Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html > Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc > --- > .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > index fbd235650e52..053488fb1286 100644 > --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > @@ -17,7 +17,20 @@ properties: > - const: thead,c900-aclint-mtimer > > reg: > - maxItems: 1 > + oneOf: > + - items: > + - description: MTIME Registers > + - description: MTIMECMP Registers > + - items: > + - description: MTIMECMP Registers > + > + reg-names: > + oneOf: > + - items: > + - const: mtime > + - const: mtimecmp > + - items: > + - const: mtimecmp > > interrupts-extended: > minItems: 1 > @@ -28,8 +41,34 @@ additionalProperties: false > required: > - compatible > - reg > + - reg-names > - interrupts-extended > > +allOf: > + - if: > + properties: > + compatible: > + contains: > + const: thead,c900-aclint-mtimer > + then: > + properties: > + reg: > + items: > + - description: MTIMECMP Registers > + reg-names: > + items: > + - const: mtimecmp > + else: > + properties: > + reg: > + items: > + - description: MTIME Registers > + - description: MTIMECMP Registers > + reg-names: > + items: > + - const: mtime > + - const: mtimecmp > + > examples: > - | > timer@ac000000 { > @@ -39,5 +78,6 @@ examples: > <&cpu3intc 7>, > <&cpu4intc 7>; > reg = <0xac000000 0x00010000>; > + reg-names = "mtimecmp"; > }; > ... Reviewed-by: Chen Wang <unicorn_wang@outlook.com> > -- > 2.42.1 >
On Tue, Nov 21, 2023 at 09:12:12AM +0800, Inochi Amaoto wrote: > >Yo, > > > >On Sat, Nov 18, 2023 at 03:10:26PM +0800, Inochi Amaoto wrote: > >> The timer registers of aclint don't follow the clint layout and can > >> be mapped on any different offset. As sg2042 uses separated timer > >> and mswi for its clint, it should follow the aclint spec and have > >> separated registers. > >> > >> The previous patch introduced a new type of T-HEAD aclint timer which > >> has clint timer layout. Although it has the clint timer layout, it > >> should follow the aclint spec and uses the separated mtime and mtimecmp > >> regs. So a ABI change is needed to make the timer fit the aclint spec. > >> > >> To make T-HEAD aclint timer more closer to the aclint spec, use > >> regs-names to represent the mtimecmp register, which can avoid hack > >> for unsupport mtime register of T-HEAD aclint timer. > >> > >> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > >> Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") > >> Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html > >> Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc > >> --- > >> .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- > >> 1 file changed, 41 insertions(+), 1 deletion(-) > >> > >> diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > >> index fbd235650e52..053488fb1286 100644 > >> --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > >> +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > >> @@ -17,7 +17,20 @@ properties: > >> - const: thead,c900-aclint-mtimer > >> > >> reg: > >> - maxItems: 1 > >> + oneOf: > >> + - items: > >> + - description: MTIME Registers > >> + - description: MTIMECMP Registers > >> + - items: > >> + - description: MTIMECMP Registers > >> + > >> + reg-names: > >> + oneOf: > >> + - items: > >> + - const: mtime > >> + - const: mtimecmp > >> + - items: > >> + - const: mtimecmp > >> > >> interrupts-extended: > >> minItems: 1 > >> @@ -28,8 +41,34 @@ additionalProperties: false > >> required: > >> - compatible > >> - reg > >> + - reg-names > >> - interrupts-extended > >> > >> +allOf: > >> + - if: > >> + properties: > >> + compatible: > >> + contains: > >> + const: thead,c900-aclint-mtimer > > > >Is this being the c900 compatible correct? You mention in your commit > >message that this split is done on the sg2042, but the rule is applied > >here for any c900 series "aclint". Do we know if this is a sophgo > >specific thing (or even sg2042 specific), or if it applies generally? > > > > This can be confirmed. The thead c900 series have no mtime support and > there is no evidence that they will implement it. So I think it is OK > to applied this restriction for the whole c900 series. Okay, great. > >> + then: > >> + properties: > >> + reg: > >> + items: > >> + - description: MTIMECMP Registers > >> + reg-names: > >> + items: > >> + - const: mtimecmp > > > >> + else: > >> + properties: > >> + reg: > >> + items: > >> + - description: MTIME Registers > >> + - description: MTIMECMP Registers > >> + reg-names: > >> + items: > >> + - const: mtime > >> + - const: mtimecmp > > > >If it applies generally, I would probably just delete this, but unless > >someone can confirm this to be general, I'd probably leave the else > >clause and swap for the specific sg2042 compatible above. > > > > I suggest keeping this. By taking your advice, this binding has actually > become the binding for aclint draft. Right. It seemed to me from the reports (and the commit message) that this was a configuration choice made by sophgo for the IP. > So I think it is better to preserve > this path, otherwise adding the mtime register seems meaningless. Yeah, I mistakenly thought that there were cases where we actually had systems with mtime and mtimecmp registers. I don't know if that was an assumption I made due to previous commit messages or from reading the opensbi threads, but clearly that is not the case. > But if > you think it is OK to add this when adding new compatible or converting it > to a generic binding. I'm a bit conflicted. Since this is c900 specific one part of me says leave it with only one "reg" entry as that is what the only hardware actually has & add "reg-names" to make lives easier when someone else implements the unratified spec (or it gets ratified for some reason). > Feel free to remove it. I might've applied the other binding as it was in a series adding initial support for the SoC, but usually these things go via the subsystem maintainers with a DT maintainer ack/review.
>On Tue, Nov 21, 2023 at 09:12:12AM +0800, Inochi Amaoto wrote: >>> Yo, >>> >>> On Sat, Nov 18, 2023 at 03:10:26PM +0800, Inochi Amaoto wrote: >>>> The timer registers of aclint don't follow the clint layout and can >>>> be mapped on any different offset. As sg2042 uses separated timer >>>> and mswi for its clint, it should follow the aclint spec and have >>>> separated registers. >>>> >>>> The previous patch introduced a new type of T-HEAD aclint timer which >>>> has clint timer layout. Although it has the clint timer layout, it >>>> should follow the aclint spec and uses the separated mtime and mtimecmp >>>> regs. So a ABI change is needed to make the timer fit the aclint spec. >>>> >>>> To make T-HEAD aclint timer more closer to the aclint spec, use >>>> regs-names to represent the mtimecmp register, which can avoid hack >>>> for unsupport mtime register of T-HEAD aclint timer. >>>> >>>> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> >>>> Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") >>>> Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html >>>> Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc >>>> --- >>>> .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- >>>> 1 file changed, 41 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >>>> index fbd235650e52..053488fb1286 100644 >>>> --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >>>> +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >>>> @@ -17,7 +17,20 @@ properties: >>>> - const: thead,c900-aclint-mtimer >>>> >>>> reg: >>>> - maxItems: 1 >>>> + oneOf: >>>> + - items: >>>> + - description: MTIME Registers >>>> + - description: MTIMECMP Registers >>>> + - items: >>>> + - description: MTIMECMP Registers >>>> + >>>> + reg-names: >>>> + oneOf: >>>> + - items: >>>> + - const: mtime >>>> + - const: mtimecmp >>>> + - items: >>>> + - const: mtimecmp >>>> >>>> interrupts-extended: >>>> minItems: 1 >>>> @@ -28,8 +41,34 @@ additionalProperties: false >>>> required: >>>> - compatible >>>> - reg >>>> + - reg-names >>>> - interrupts-extended >>>> >>>> +allOf: >>>> + - if: >>>> + properties: >>>> + compatible: >>>> + contains: >>>> + const: thead,c900-aclint-mtimer >>> >>> Is this being the c900 compatible correct? You mention in your commit >>> message that this split is done on the sg2042, but the rule is applied >>> here for any c900 series "aclint". Do we know if this is a sophgo >>> specific thing (or even sg2042 specific), or if it applies generally? >>> >> >> This can be confirmed. The thead c900 series have no mtime support and >> there is no evidence that they will implement it. So I think it is OK >> to applied this restriction for the whole c900 series. > >Okay, great. > >>>> + then: >>>> + properties: >>>> + reg: >>>> + items: >>>> + - description: MTIMECMP Registers >>>> + reg-names: >>>> + items: >>>> + - const: mtimecmp >>> >>>> + else: >>>> + properties: >>>> + reg: >>>> + items: >>>> + - description: MTIME Registers >>>> + - description: MTIMECMP Registers >>>> + reg-names: >>>> + items: >>>> + - const: mtime >>>> + - const: mtimecmp >>> >>> If it applies generally, I would probably just delete this, but unless >>> someone can confirm this to be general, I'd probably leave the else >>> clause and swap for the specific sg2042 compatible above. >>> >> >> I suggest keeping this. By taking your advice, this binding has actually >> become the binding for aclint draft. > >Right. It seemed to me from the reports (and the commit message) that this >was a configuration choice made by sophgo for the IP. > Yes, that's true. >> So I think it is better to preserve >> this path, otherwise adding the mtime register seems meaningless. > >Yeah, I mistakenly thought that there were cases where we actually had >systems with mtime and mtimecmp registers. I don't know if that was an >assumption I made due to previous commit messages or from reading the >opensbi threads, but clearly that is not the case. > >> But if >> you think it is OK to add this when adding new compatible or converting it >> to a generic binding. > >I'm a bit conflicted. Since this is c900 specific one part of me says >leave it with only one "reg" entry as that is what the only hardware >actually has & add "reg-names" to make lives easier when someone else >implements the unratified spec (or it gets ratified for some reason). > Adding "reg-names" is necessary and does make live easier. It gives a clear way to avoid hack on skipping mtime register in the ACLINT timer definition. Now I think the only problem is whether the "mtime" register should exist in this binding. IMHO, adding "mtime" seems to be too much to keep this binding vendor specific. It is better to remove it to achieve minimum change. >> Feel free to remove it. > >I might've applied the other binding as it was in a series adding >initial support for the SoC, but usually these things go via the >subsystem maintainers with a DT maintainer ack/review. > Thanks, I will also wait for feedback from the subsystem maintainers.
> >> On Tue, Nov 21, 2023 at 09:12:12AM +0800, Inochi Amaoto wrote: >>>> Yo, >>>> >>>> On Sat, Nov 18, 2023 at 03:10:26PM +0800, Inochi Amaoto wrote: >>>>> The timer registers of aclint don't follow the clint layout and can >>>>> be mapped on any different offset. As sg2042 uses separated timer >>>>> and mswi for its clint, it should follow the aclint spec and have >>>>> separated registers. >>>>> >>>>> The previous patch introduced a new type of T-HEAD aclint timer which >>>>> has clint timer layout. Although it has the clint timer layout, it >>>>> should follow the aclint spec and uses the separated mtime and mtimecmp >>>>> regs. So a ABI change is needed to make the timer fit the aclint spec. >>>>> >>>>> To make T-HEAD aclint timer more closer to the aclint spec, use >>>>> regs-names to represent the mtimecmp register, which can avoid hack >>>>> for unsupport mtime register of T-HEAD aclint timer. >>>>> >>>>> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> >>>>> Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") >>>>> Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html >>>>> Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc >>>>> --- >>>>> .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- >>>>> 1 file changed, 41 insertions(+), 1 deletion(-) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >>>>> index fbd235650e52..053488fb1286 100644 >>>>> --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >>>>> +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml >>>>> @@ -17,7 +17,20 @@ properties: >>>>> - const: thead,c900-aclint-mtimer >>>>> >>>>> reg: >>>>> - maxItems: 1 >>>>> + oneOf: >>>>> + - items: >>>>> + - description: MTIME Registers >>>>> + - description: MTIMECMP Registers >>>>> + - items: >>>>> + - description: MTIMECMP Registers >>>>> + >>>>> + reg-names: >>>>> + oneOf: >>>>> + - items: >>>>> + - const: mtime >>>>> + - const: mtimecmp >>>>> + - items: >>>>> + - const: mtimecmp >>>>> >>>>> interrupts-extended: >>>>> minItems: 1 >>>>> @@ -28,8 +41,34 @@ additionalProperties: false >>>>> required: >>>>> - compatible >>>>> - reg >>>>> + - reg-names >>>>> - interrupts-extended >>>>> >>>>> +allOf: >>>>> + - if: >>>>> + properties: >>>>> + compatible: >>>>> + contains: >>>>> + const: thead,c900-aclint-mtimer >>>> >>>> Is this being the c900 compatible correct? You mention in your commit >>>> message that this split is done on the sg2042, but the rule is applied >>>> here for any c900 series "aclint". Do we know if this is a sophgo >>>> specific thing (or even sg2042 specific), or if it applies generally? >>>> >>> >>> This can be confirmed. The thead c900 series have no mtime support and >>> there is no evidence that they will implement it. So I think it is OK >>> to applied this restriction for the whole c900 series. >> >> Okay, great. >> >>>>> + then: >>>>> + properties: >>>>> + reg: >>>>> + items: >>>>> + - description: MTIMECMP Registers >>>>> + reg-names: >>>>> + items: >>>>> + - const: mtimecmp >>>> >>>>> + else: >>>>> + properties: >>>>> + reg: >>>>> + items: >>>>> + - description: MTIME Registers >>>>> + - description: MTIMECMP Registers >>>>> + reg-names: >>>>> + items: >>>>> + - const: mtime >>>>> + - const: mtimecmp >>>> >>>> If it applies generally, I would probably just delete this, but unless >>>> someone can confirm this to be general, I'd probably leave the else >>>> clause and swap for the specific sg2042 compatible above. >>>> >>> >>> I suggest keeping this. By taking your advice, this binding has actually >>> become the binding for aclint draft. >> >> Right. It seemed to me from the reports (and the commit message) that this >> was a configuration choice made by sophgo for the IP. >> > >Yes, that's true. > >>> So I think it is better to preserve >>> this path, otherwise adding the mtime register seems meaningless. >> >> Yeah, I mistakenly thought that there were cases where we actually had >> systems with mtime and mtimecmp registers. I don't know if that was an >> assumption I made due to previous commit messages or from reading the >> opensbi threads, but clearly that is not the case. >> >>> But if >>> you think it is OK to add this when adding new compatible or converting it >>> to a generic binding. >> >> I'm a bit conflicted. Since this is c900 specific one part of me says >> leave it with only one "reg" entry as that is what the only hardware >> actually has & add "reg-names" to make lives easier when someone else >> implements the unratified spec (or it gets ratified for some reason). >> > >Adding "reg-names" is necessary and does make live easier. It gives a >clear way to avoid hack on skipping mtime register in the ACLINT timer >definition. > >Now I think the only problem is whether the "mtime" register should >exist in this binding. IMHO, adding "mtime" seems to be too much to >keep this binding vendor specific. It is better to remove it to achieve >minimum change. > >>> Feel free to remove it. >> >> I might've applied the other binding as it was in a series adding >> initial support for the SoC, but usually these things go via the >> subsystem maintainers with a DT maintainer ack/review. >> > >Thanks, I will also wait for feedback from the subsystem maintainers. > Hi, Daniel and Thomas, Could you share your suggestion about this ABI change?
On Sat, Nov 18, 2023 at 12:39 PM Inochi Amaoto <inochiama@outlook.com> wrote: > > The timer registers of aclint don't follow the clint layout and can > be mapped on any different offset. As sg2042 uses separated timer > and mswi for its clint, it should follow the aclint spec and have > separated registers. > > The previous patch introduced a new type of T-HEAD aclint timer which > has clint timer layout. Although it has the clint timer layout, it > should follow the aclint spec and uses the separated mtime and mtimecmp > regs. So a ABI change is needed to make the timer fit the aclint spec. > > To make T-HEAD aclint timer more closer to the aclint spec, use > regs-names to represent the mtimecmp register, which can avoid hack > for unsupport mtime register of T-HEAD aclint timer. > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") > Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html > Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc The ratified Priv v1.12 specification defines platform specific M-mode timer registers without defining any layout of mtime and mtimecmp registers. (Refer, "3.2.1 Machine Timer Registers (mtime and mtimecmp)") The "thead,c900-aclint-mtimer" can be thought of as is one possible implementation of "riscv,mtimer" defined by the Priv v1.12 specificaiton. If it is not too late then I suggest making this binding into generic "riscv,mtimer" binding. Regards, Anup > --- > .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > > diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > index fbd235650e52..053488fb1286 100644 > --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > @@ -17,7 +17,20 @@ properties: > - const: thead,c900-aclint-mtimer > > reg: > - maxItems: 1 > + oneOf: > + - items: > + - description: MTIME Registers > + - description: MTIMECMP Registers > + - items: > + - description: MTIMECMP Registers > + > + reg-names: > + oneOf: > + - items: > + - const: mtime > + - const: mtimecmp > + - items: > + - const: mtimecmp > > interrupts-extended: > minItems: 1 > @@ -28,8 +41,34 @@ additionalProperties: false > required: > - compatible > - reg > + - reg-names > - interrupts-extended > > +allOf: > + - if: > + properties: > + compatible: > + contains: > + const: thead,c900-aclint-mtimer > + then: > + properties: > + reg: > + items: > + - description: MTIMECMP Registers > + reg-names: > + items: > + - const: mtimecmp > + else: > + properties: > + reg: > + items: > + - description: MTIME Registers > + - description: MTIMECMP Registers > + reg-names: > + items: > + - const: mtime > + - const: mtimecmp > + > examples: > - | > timer@ac000000 { > @@ -39,5 +78,6 @@ examples: > <&cpu3intc 7>, > <&cpu4intc 7>; > reg = <0xac000000 0x00010000>; > + reg-names = "mtimecmp"; > }; > ... > -- > 2.42.1 > >
On Thu, Nov 30, 2023 at 03:01:24PM +0530, Anup Patel wrote: > On Sat, Nov 18, 2023 at 12:39 PM Inochi Amaoto <inochiama@outlook.com> wrote: > > > > The timer registers of aclint don't follow the clint layout and can > > be mapped on any different offset. As sg2042 uses separated timer > > and mswi for its clint, it should follow the aclint spec and have > > separated registers. > > > > The previous patch introduced a new type of T-HEAD aclint timer which > > has clint timer layout. Although it has the clint timer layout, it > > should follow the aclint spec and uses the separated mtime and mtimecmp > > regs. So a ABI change is needed to make the timer fit the aclint spec. > > > > To make T-HEAD aclint timer more closer to the aclint spec, use > > regs-names to represent the mtimecmp register, which can avoid hack > > for unsupport mtime register of T-HEAD aclint timer. > > > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > > Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") > > Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html > > Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc > > The ratified Priv v1.12 specification defines platform specific M-mode timer > registers without defining any layout of mtime and mtimecmp registers. > (Refer, "3.2.1 Machine Timer Registers (mtime and mtimecmp)") > > The "thead,c900-aclint-mtimer" can be thought of as is one possible > implementation of "riscv,mtimer" defined by the Priv v1.12 specificaiton. > > If it is not too late then I suggest making this binding into generic > "riscv,mtimer" binding. We could definitely reorganise things, it's not too late for that as implementation specific compatibles would be needed regardless, so software that would've matched on those will continue to do so. That said, does this platform actually implement the 1.12 priv spec if there is no mtime register? The section you reference says: "Platforms provide a real-time counter, exposed as a memory-mapped machine-mode read-write register, mtime." It seems to me like this hardware is not suitable for a generic "riscv,mtimer" fallback. Am I missing something there Anup? It doesn't even implement the draft aclint spec, given that that says: "The MTIMER device provides machine-level timer functionality for a set of HARTs on a RISC-V platform. It has a single fixed-frequency monotonic time counter (MTIME) register and a time compare register (MTIMECMP) for each HART connected to the MTIMER device." But I already said no to having a generic, "riscv" prefixed, compatible for that, given it is in draft form. Cheers, Conor. > > --- > > .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- > > 1 file changed, 41 insertions(+), 1 deletion(-) > > > > diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > > index fbd235650e52..053488fb1286 100644 > > --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > > +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > > @@ -17,7 +17,20 @@ properties: > > - const: thead,c900-aclint-mtimer > > > > reg: > > - maxItems: 1 > > + oneOf: > > + - items: > > + - description: MTIME Registers > > + - description: MTIMECMP Registers > > + - items: > > + - description: MTIMECMP Registers > > + > > + reg-names: > > + oneOf: > > + - items: > > + - const: mtime > > + - const: mtimecmp > > + - items: > > + - const: mtimecmp > > > > interrupts-extended: > > minItems: 1 > > @@ -28,8 +41,34 @@ additionalProperties: false > > required: > > - compatible > > - reg > > + - reg-names > > - interrupts-extended > > > > +allOf: > > + - if: > > + properties: > > + compatible: > > + contains: > > + const: thead,c900-aclint-mtimer > > + then: > > + properties: > > + reg: > > + items: > > + - description: MTIMECMP Registers > > + reg-names: > > + items: > > + - const: mtimecmp > > + else: > > + properties: > > + reg: > > + items: > > + - description: MTIME Registers > > + - description: MTIMECMP Registers > > + reg-names: > > + items: > > + - const: mtime > > + - const: mtimecmp > > + > > examples: > > - | > > timer@ac000000 { > > @@ -39,5 +78,6 @@ examples: > > <&cpu3intc 7>, > > <&cpu4intc 7>; > > reg = <0xac000000 0x00010000>; > > + reg-names = "mtimecmp"; > > }; > > ... > > -- > > 2.42.1 > > > >
On Thu, Nov 30, 2023 at 3:27 PM Conor Dooley <conor@kernel.org> wrote: > > On Thu, Nov 30, 2023 at 03:01:24PM +0530, Anup Patel wrote: > > On Sat, Nov 18, 2023 at 12:39 PM Inochi Amaoto <inochiama@outlook.com> wrote: > > > > > > The timer registers of aclint don't follow the clint layout and can > > > be mapped on any different offset. As sg2042 uses separated timer > > > and mswi for its clint, it should follow the aclint spec and have > > > separated registers. > > > > > > The previous patch introduced a new type of T-HEAD aclint timer which > > > has clint timer layout. Although it has the clint timer layout, it > > > should follow the aclint spec and uses the separated mtime and mtimecmp > > > regs. So a ABI change is needed to make the timer fit the aclint spec. > > > > > > To make T-HEAD aclint timer more closer to the aclint spec, use > > > regs-names to represent the mtimecmp register, which can avoid hack > > > for unsupport mtime register of T-HEAD aclint timer. > > > > > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > > > Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") > > > Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html > > > Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc > > > > The ratified Priv v1.12 specification defines platform specific M-mode timer > > registers without defining any layout of mtime and mtimecmp registers. > > (Refer, "3.2.1 Machine Timer Registers (mtime and mtimecmp)") > > > > The "thead,c900-aclint-mtimer" can be thought of as is one possible > > implementation of "riscv,mtimer" defined by the Priv v1.12 specificaiton. > > > > If it is not too late then I suggest making this binding into generic > > "riscv,mtimer" binding. > > We could definitely reorganise things, it's not too late for that as > implementation specific compatibles would be needed regardless, so > software that would've matched on those will continue to do so. > > That said, does this platform actually implement the 1.12 priv spec if > there is no mtime register? The section you reference says: > "Platforms provide a real-time counter, exposed as a memory-mapped > machine-mode read-write register, mtime." It seems to me like this > hardware is not suitable for a generic "riscv,mtimer" fallback. Yes, the T-Head mtimer does not implement both mtime and mtimecmp so technically it only implements a portion of the ratified RISC-V mtimer chapter. > > Am I missing something there Anup? > > It doesn't even implement the draft aclint spec, given that that says: > "The MTIMER device provides machine-level timer functionality for a set > of HARTs on a RISC-V platform. It has a single fixed-frequency monotonic > time counter (MTIME) register and a time compare register (MTIMECMP) for > each HART connected to the MTIMER device." > > But I already said no to having a generic, "riscv" prefixed, compatible > for that, given it is in draft form. I am not suggesting T-Head timer implements aclint spec. Also, since aclint spec is in draft state it is out of the question. My suggestion is to treat "3.2.1 Machine Timer Registers (mtime and mtimecmp)" as RISC-V mtimer defined by the RISC-V privileged specification and define "riscv" prefixed DT binding for this. This binding defines two possible values for "reg" property: 1) contains two items: a) mtime register address and, b) base address of mtimecmp registers 2) contain one item: a) base address of mtimecmp registers The t-head mtimer seems to implement #2 whereas the RISC-V mtimer (Priv spec) aligns with #1. If we want to keep this DT binding t-head specific then we should remove option #1 (above) from this DT binding and add separate "riscv" prefixed DT binding for RISC-V mtimer. Regards, Anup > > Cheers, > Conor. > > > > --- > > > .../timer/thead,c900-aclint-mtimer.yaml | 42 ++++++++++++++++++- > > > 1 file changed, 41 insertions(+), 1 deletion(-) > > > > > > diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > > > index fbd235650e52..053488fb1286 100644 > > > --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > > > +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml > > > @@ -17,7 +17,20 @@ properties: > > > - const: thead,c900-aclint-mtimer > > > > > > reg: > > > - maxItems: 1 > > > + oneOf: > > > + - items: > > > + - description: MTIME Registers > > > + - description: MTIMECMP Registers > > > + - items: > > > + - description: MTIMECMP Registers > > > + > > > + reg-names: > > > + oneOf: > > > + - items: > > > + - const: mtime > > > + - const: mtimecmp > > > + - items: > > > + - const: mtimecmp > > > > > > interrupts-extended: > > > minItems: 1 > > > @@ -28,8 +41,34 @@ additionalProperties: false > > > required: > > > - compatible > > > - reg > > > + - reg-names > > > - interrupts-extended > > > > > > +allOf: > > > + - if: > > > + properties: > > > + compatible: > > > + contains: > > > + const: thead,c900-aclint-mtimer > > > + then: > > > + properties: > > > + reg: > > > + items: > > > + - description: MTIMECMP Registers > > > + reg-names: > > > + items: > > > + - const: mtimecmp > > > + else: > > > + properties: > > > + reg: > > > + items: > > > + - description: MTIME Registers > > > + - description: MTIMECMP Registers > > > + reg-names: > > > + items: > > > + - const: mtime > > > + - const: mtimecmp > > > + > > > examples: > > > - | > > > timer@ac000000 { > > > @@ -39,5 +78,6 @@ examples: > > > <&cpu3intc 7>, > > > <&cpu4intc 7>; > > > reg = <0xac000000 0x00010000>; > > > + reg-names = "mtimecmp"; > > > }; > > > ... > > > -- > > > 2.42.1 > > > > > >
On Thu, Nov 30, 2023 at 04:51:32PM +0530, Anup Patel wrote: > On Thu, Nov 30, 2023 at 3:27 PM Conor Dooley <conor@kernel.org> wrote: > > > > On Thu, Nov 30, 2023 at 03:01:24PM +0530, Anup Patel wrote: > > > On Sat, Nov 18, 2023 at 12:39 PM Inochi Amaoto <inochiama@outlook.com> wrote: > > > > > > > > The timer registers of aclint don't follow the clint layout and can > > > > be mapped on any different offset. As sg2042 uses separated timer > > > > and mswi for its clint, it should follow the aclint spec and have > > > > separated registers. > > > > > > > > The previous patch introduced a new type of T-HEAD aclint timer which > > > > has clint timer layout. Although it has the clint timer layout, it > > > > should follow the aclint spec and uses the separated mtime and mtimecmp > > > > regs. So a ABI change is needed to make the timer fit the aclint spec. > > > > > > > > To make T-HEAD aclint timer more closer to the aclint spec, use > > > > regs-names to represent the mtimecmp register, which can avoid hack > > > > for unsupport mtime register of T-HEAD aclint timer. > > > > > > > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > > > > Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") > > > > Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html > > > > Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc > > > > > > The ratified Priv v1.12 specification defines platform specific M-mode timer > > > registers without defining any layout of mtime and mtimecmp registers. > > > (Refer, "3.2.1 Machine Timer Registers (mtime and mtimecmp)") > > > > > > The "thead,c900-aclint-mtimer" can be thought of as is one possible > > > implementation of "riscv,mtimer" defined by the Priv v1.12 specificaiton. > > > > > > If it is not too late then I suggest making this binding into generic > > > "riscv,mtimer" binding. > > > > We could definitely reorganise things, it's not too late for that as > > implementation specific compatibles would be needed regardless, so > > software that would've matched on those will continue to do so. > > > > That said, does this platform actually implement the 1.12 priv spec if > > there is no mtime register? The section you reference says: > > "Platforms provide a real-time counter, exposed as a memory-mapped > > machine-mode read-write register, mtime." It seems to me like this > > hardware is not suitable for a generic "riscv,mtimer" fallback. > > Yes, the T-Head mtimer does not implement both mtime and mtimecmp > so technically it only implements a portion of the ratified RISC-V mtimer > chapter. > > > > > Am I missing something there Anup? > > > > It doesn't even implement the draft aclint spec, given that that says: > > "The MTIMER device provides machine-level timer functionality for a set > > of HARTs on a RISC-V platform. It has a single fixed-frequency monotonic > > time counter (MTIME) register and a time compare register (MTIMECMP) for > > each HART connected to the MTIMER device." > > > > But I already said no to having a generic, "riscv" prefixed, compatible > > for that, given it is in draft form. > > I am not suggesting T-Head timer implements aclint spec. Also, > since aclint spec is in draft state it is out of the question. I did not intend to imply that you were suggesting that there should be one. I was just trying to clarify that I was not trying to bring back the topic of a generic aclint binding applying here. > My suggestion is to treat "3.2.1 Machine Timer Registers (mtime > and mtimecmp)" as RISC-V mtimer defined by the RISC-V privileged > specification and define "riscv" prefixed DT binding for this. I'm not against a binding for that at all. > This binding defines two possible values for "reg" property: > 1) contains two items: a) mtime register address and, > b) base address of mtimecmp registers > 2) contain one item: a) base address of mtimecmp registers > > The t-head mtimer seems to implement #2 whereas the RISC-V > mtimer (Priv spec) aligns with #1. > > If we want to keep this DT binding t-head specific then > we should remove option #1 (above) from this DT binding This part is already the conclusion of one of the other "branches" of this thread and is (AFAIU) Inochi's plan for the next version. > and add separate "riscv" prefixed DT binding for RISC-V mtimer. Do you know of any users for a "riscv,mtimer" binding that are not covered by existing bindings for the clint? Cheers, Conor.
On Thu, Nov 30, 2023 at 5:15 PM Conor Dooley <conor@kernel.org> wrote: > > On Thu, Nov 30, 2023 at 04:51:32PM +0530, Anup Patel wrote: > > On Thu, Nov 30, 2023 at 3:27 PM Conor Dooley <conor@kernel.org> wrote: > > > > > > On Thu, Nov 30, 2023 at 03:01:24PM +0530, Anup Patel wrote: > > > > On Sat, Nov 18, 2023 at 12:39 PM Inochi Amaoto <inochiama@outlook.com> wrote: > > > > > > > > > > The timer registers of aclint don't follow the clint layout and can > > > > > be mapped on any different offset. As sg2042 uses separated timer > > > > > and mswi for its clint, it should follow the aclint spec and have > > > > > separated registers. > > > > > > > > > > The previous patch introduced a new type of T-HEAD aclint timer which > > > > > has clint timer layout. Although it has the clint timer layout, it > > > > > should follow the aclint spec and uses the separated mtime and mtimecmp > > > > > regs. So a ABI change is needed to make the timer fit the aclint spec. > > > > > > > > > > To make T-HEAD aclint timer more closer to the aclint spec, use > > > > > regs-names to represent the mtimecmp register, which can avoid hack > > > > > for unsupport mtime register of T-HEAD aclint timer. > > > > > > > > > > Signed-off-by: Inochi Amaoto <inochiama@outlook.com> > > > > > Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") > > > > > Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html > > > > > Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc > > > > > > > > The ratified Priv v1.12 specification defines platform specific M-mode timer > > > > registers without defining any layout of mtime and mtimecmp registers. > > > > (Refer, "3.2.1 Machine Timer Registers (mtime and mtimecmp)") > > > > > > > > The "thead,c900-aclint-mtimer" can be thought of as is one possible > > > > implementation of "riscv,mtimer" defined by the Priv v1.12 specificaiton. > > > > > > > > If it is not too late then I suggest making this binding into generic > > > > "riscv,mtimer" binding. > > > > > > We could definitely reorganise things, it's not too late for that as > > > implementation specific compatibles would be needed regardless, so > > > software that would've matched on those will continue to do so. > > > > > > That said, does this platform actually implement the 1.12 priv spec if > > > there is no mtime register? The section you reference says: > > > "Platforms provide a real-time counter, exposed as a memory-mapped > > > machine-mode read-write register, mtime." It seems to me like this > > > hardware is not suitable for a generic "riscv,mtimer" fallback. > > > > Yes, the T-Head mtimer does not implement both mtime and mtimecmp > > so technically it only implements a portion of the ratified RISC-V mtimer > > chapter. > > > > > > > > Am I missing something there Anup? > > > > > > It doesn't even implement the draft aclint spec, given that that says: > > > "The MTIMER device provides machine-level timer functionality for a set > > > of HARTs on a RISC-V platform. It has a single fixed-frequency monotonic > > > time counter (MTIME) register and a time compare register (MTIMECMP) for > > > each HART connected to the MTIMER device." > > > > > > But I already said no to having a generic, "riscv" prefixed, compatible > > > for that, given it is in draft form. > > > > I am not suggesting T-Head timer implements aclint spec. Also, > > since aclint spec is in draft state it is out of the question. > > I did not intend to imply that you were suggesting that there should be > one. I was just trying to clarify that I was not trying to bring back > the topic of a generic aclint binding applying here. > > > My suggestion is to treat "3.2.1 Machine Timer Registers (mtime > > and mtimecmp)" as RISC-V mtimer defined by the RISC-V privileged > > specification and define "riscv" prefixed DT binding for this. > > I'm not against a binding for that at all. Thanks. > > > This binding defines two possible values for "reg" property: > > 1) contains two items: a) mtime register address and, > > b) base address of mtimecmp registers > > 2) contain one item: a) base address of mtimecmp registers > > > > The t-head mtimer seems to implement #2 whereas the RISC-V > > mtimer (Priv spec) aligns with #1. > > > > If we want to keep this DT binding t-head specific then > > we should remove option #1 (above) from this DT binding > > This part is already the conclusion of one of the other "branches" of > this thread and is (AFAIU) Inochi's plan for the next version. Sounds good. > > > and add separate "riscv" prefixed DT binding for RISC-V mtimer. > > Do you know of any users for a "riscv,mtimer" binding that are not > covered by existing bindings for the clint? Ventana Veyron-v1 implements a mtimer per-cluster (or chiplet) which is compatible to "riscv,mtimer" (i.e. we have both mtime and mtimecmp MMIO registers). Regards, Anup
On Thu, Nov 30, 2023 at 05:18:15PM +0530, Anup Patel wrote: > On Thu, Nov 30, 2023 at 5:15 PM Conor Dooley <conor@kernel.org> wrote: > > > and add separate "riscv" prefixed DT binding for RISC-V mtimer. > > > > Do you know of any users for a "riscv,mtimer" binding that are not > > covered by existing bindings for the clint? > > Ventana Veyron-v1 implements a mtimer per-cluster (or chiplet) > which is compatible to "riscv,mtimer" (i.e. we have both mtime > and mtimecmp MMIO registers). Okay, thanks. I guess iff veyron-v1 DT support shows up (or other similar devices) we can go ahead with a "riscv,mtimer" binding then. I had thought that you guys were going to be using ACPI though, so I guess the "other similar devices" applies.
> >On Thu, Nov 30, 2023 at 04:51:32PM +0530, Anup Patel wrote: >> On Thu, Nov 30, 2023 at 3:27 PM Conor Dooley <conor@kernel.org> wrote: >>> >>> On Thu, Nov 30, 2023 at 03:01:24PM +0530, Anup Patel wrote: >>>> On Sat, Nov 18, 2023 at 12:39 PM Inochi Amaoto <inochiama@outlook.com> wrote: >>>>> >>>>> The timer registers of aclint don't follow the clint layout and can >>>>> be mapped on any different offset. As sg2042 uses separated timer >>>>> and mswi for its clint, it should follow the aclint spec and have >>>>> separated registers. >>>>> >>>>> The previous patch introduced a new type of T-HEAD aclint timer which >>>>> has clint timer layout. Although it has the clint timer layout, it >>>>> should follow the aclint spec and uses the separated mtime and mtimecmp >>>>> regs. So a ABI change is needed to make the timer fit the aclint spec. >>>>> >>>>> To make T-HEAD aclint timer more closer to the aclint spec, use >>>>> regs-names to represent the mtimecmp register, which can avoid hack >>>>> for unsupport mtime register of T-HEAD aclint timer. >>>>> >>>>> Signed-off-by: Inochi Amaoto <inochiama@outlook.com> >>>>> Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") >>>>> Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html >>>>> Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc >>>> >>>> The ratified Priv v1.12 specification defines platform specific M-mode timer >>>> registers without defining any layout of mtime and mtimecmp registers. >>>> (Refer, "3.2.1 Machine Timer Registers (mtime and mtimecmp)") >>>> >>>> The "thead,c900-aclint-mtimer" can be thought of as is one possible >>>> implementation of "riscv,mtimer" defined by the Priv v1.12 specificaiton. >>>> >>>> If it is not too late then I suggest making this binding into generic >>>> "riscv,mtimer" binding. >>> >>> We could definitely reorganise things, it's not too late for that as >>> implementation specific compatibles would be needed regardless, so >>> software that would've matched on those will continue to do so. >>> >>> That said, does this platform actually implement the 1.12 priv spec if >>> there is no mtime register? The section you reference says: >>> "Platforms provide a real-time counter, exposed as a memory-mapped >>> machine-mode read-write register, mtime." It seems to me like this >>> hardware is not suitable for a generic "riscv,mtimer" fallback. >> >> Yes, the T-Head mtimer does not implement both mtime and mtimecmp >> so technically it only implements a portion of the ratified RISC-V mtimer >> chapter. >> >>> >>> Am I missing something there Anup? >>> >>> It doesn't even implement the draft aclint spec, given that that says: >>> "The MTIMER device provides machine-level timer functionality for a set >>> of HARTs on a RISC-V platform. It has a single fixed-frequency monotonic >>> time counter (MTIME) register and a time compare register (MTIMECMP) for >>> each HART connected to the MTIMER device." >>> >>> But I already said no to having a generic, "riscv" prefixed, compatible >>> for that, given it is in draft form. >> >> I am not suggesting T-Head timer implements aclint spec. Also, >> since aclint spec is in draft state it is out of the question. > >I did not intend to imply that you were suggesting that there should be >one. I was just trying to clarify that I was not trying to bring back >the topic of a generic aclint binding applying here. > >> My suggestion is to treat "3.2.1 Machine Timer Registers (mtime >> and mtimecmp)" as RISC-V mtimer defined by the RISC-V privileged >> specification and define "riscv" prefixed DT binding for this. > >I'm not against a binding for that at all. > >> This binding defines two possible values for "reg" property: >> 1) contains two items: a) mtime register address and, >> b) base address of mtimecmp registers >> 2) contain one item: a) base address of mtimecmp registers >> >> The t-head mtimer seems to implement #2 whereas the RISC-V >> mtimer (Priv spec) aligns with #1. >> >> If we want to keep this DT binding t-head specific then >> we should remove option #1 (above) from this DT binding > >This part is already the conclusion of one of the other "branches" of >this thread and is (AFAIU) Inochi's plan for the next version. > Yes, I have already made a new version for this. But in fact, that is just the V3 version of this patch. This is why now I still wait for some advice. The V3 version is just T-HEAD specific: https://lore.kernel.org/all/IA1PR20MB4953B8AC5CB8F8165A09D118BBB7A@IA1PR20MB4953.namprd20.prod.outlook.com/ >> and add separate "riscv" prefixed DT binding for RISC-V mtimer. > >Do you know of any users for a "riscv,mtimer" binding that are not >covered by existing bindings for the clint? > >Cheers, >Conor. > >
On Thu, Nov 30, 2023 at 5:40 PM Conor Dooley <conor@kernel.org> wrote: > > On Thu, Nov 30, 2023 at 05:18:15PM +0530, Anup Patel wrote: > > On Thu, Nov 30, 2023 at 5:15 PM Conor Dooley <conor@kernel.org> wrote: > > > > > and add separate "riscv" prefixed DT binding for RISC-V mtimer. > > > > > > Do you know of any users for a "riscv,mtimer" binding that are not > > > covered by existing bindings for the clint? > > > > Ventana Veyron-v1 implements a mtimer per-cluster (or chiplet) > > which is compatible to "riscv,mtimer" (i.e. we have both mtime > > and mtimecmp MMIO registers). > > Okay, thanks. I guess iff veyron-v1 DT support shows up (or other > similar devices) we can go ahead with a "riscv,mtimer" binding then. > I had thought that you guys were going to be using ACPI though, so > I guess the "other similar devices" applies. We use ACPI from EDK2 onwards in our boot-flow. The booting stages prior to EDK2 (such as OpenSBI) use DT. In fact, EDK2 also uses information in DT to populate static parts of the ACPI table. Regards, Anup
>On Thu, Nov 30, 2023 at 5:40 PM Conor Dooley <conor@kernel.org> wrote: >> >> On Thu, Nov 30, 2023 at 05:18:15PM +0530, Anup Patel wrote: >>> On Thu, Nov 30, 2023 at 5:15 PM Conor Dooley <conor@kernel.org> wrote: >> >>>>> and add separate "riscv" prefixed DT binding for RISC-V mtimer. >>>> >>>> Do you know of any users for a "riscv,mtimer" binding that are not >>>> covered by existing bindings for the clint? >>> >>> Ventana Veyron-v1 implements a mtimer per-cluster (or chiplet) >>> which is compatible to "riscv,mtimer" (i.e. we have both mtime >>> and mtimecmp MMIO registers). >> >> Okay, thanks. I guess iff veyron-v1 DT support shows up (or other >> similar devices) we can go ahead with a "riscv,mtimer" binding then. >> I had thought that you guys were going to be using ACPI though, so >> I guess the "other similar devices" applies. > >We use ACPI from EDK2 onwards in our boot-flow. The booting >stages prior to EDK2 (such as OpenSBI) use DT. In fact, EDK2 >also uses information in DT to populate static parts of the ACPI >table. > Yes, And the EDK2 implement of sg2042 shares the same boot flow, which is already in the mainline EDK2 repo. >Regards, >Anup >
diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml index fbd235650e52..053488fb1286 100644 --- a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml @@ -17,7 +17,20 @@ properties: - const: thead,c900-aclint-mtimer reg: - maxItems: 1 + oneOf: + - items: + - description: MTIME Registers + - description: MTIMECMP Registers + - items: + - description: MTIMECMP Registers + + reg-names: + oneOf: + - items: + - const: mtime + - const: mtimecmp + - items: + - const: mtimecmp interrupts-extended: minItems: 1 @@ -28,8 +41,34 @@ additionalProperties: false required: - compatible - reg + - reg-names - interrupts-extended +allOf: + - if: + properties: + compatible: + contains: + const: thead,c900-aclint-mtimer + then: + properties: + reg: + items: + - description: MTIMECMP Registers + reg-names: + items: + - const: mtimecmp + else: + properties: + reg: + items: + - description: MTIME Registers + - description: MTIMECMP Registers + reg-names: + items: + - const: mtime + - const: mtimecmp + examples: - | timer@ac000000 { @@ -39,5 +78,6 @@ examples: <&cpu3intc 7>, <&cpu4intc 7>; reg = <0xac000000 0x00010000>; + reg-names = "mtimecmp"; }; ...