Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp836177rdb; Sat, 7 Oct 2023 00:56:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGv/u8wSPFNT3QcsDHYrfo9fcBSr6lFF61XzswHmSAVzEd77LcL09s857xwKoc/24hVAIEr X-Received: by 2002:a17:902:da83:b0:1c6:e1d:8be0 with SMTP id j3-20020a170902da8300b001c60e1d8be0mr13210929plx.2.1696665399244; Sat, 07 Oct 2023 00:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696665399; cv=none; d=google.com; s=arc-20160816; b=w80eMFUA9vx8h/Lt6gXWCA/JiBA9ahDPaDlux4/uuYDOXt8pcBhfQO6rb+q9urQSfF hNDP2NZgVNfCuK7rajr5oeWQGlU10UbB1hy8cR59jN2u20CcoDYh39fc7xfaH0J+Prn/ ZCO6DYLTZlalbti49130QD+TuEomxmfY+DkOYOh2xyBJCIA5IdyzX7MjBsy5BYAJv63R a1WM/X/JJssgxRXO6N9NzEe6YBxAKIHvXDHvb0bVBCGwBiHgYfA4BdxlLG14OtDVrySV q5kgyxN2lCrYiA80YGYmy7Ps8m+AlnIU0iPpzJ4LpGRr3UGAMnmtUbrtXOk4MmtKvZfa XWmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=F0VngE6BdDwFZLAlGMzCM3wLTc/iiRqiIMV99Spu1cQ=; fh=MeH0H44ksJ3WoHmZEV5UsfmF3Hfwm6BQ69xoKweq1Eg=; b=QKfpTG9cBemEyaOAWmZ94qVOOqBEwFjhOn8FNWI1AtIS41lc92mHUTebVRrmzNOU58 017EbiGDBnqOvFIEuXr62bYleUXy+/Zd6I8SQNnEXDqboyT23JJ5F4ljWqUlkUVWsmEb TqOiZWPH2owz1tZLUnRV8HvWtPMcdyW8r2qsVvbXsKAAbYsMvohlWjMnzYXRL0x67Vy/ KiavTvZX473n6Gy7UbX2qx/wZWEdzjH6WJ/mS7i4WrJGpNxfH+h7ggpK5X84B/30BLs5 AJRoMEVDUg5ap/9HcIXzPsxVQBzxXetvebQkC0V/gAjZxuTTRWiHgGUaWfRoqeFbuLt6 XZeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KKqNYXnR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id r12-20020a170902c60c00b001c58ac5b753si5159447plr.120.2023.10.07.00.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 00:56:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=KKqNYXnR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 3BEBA81D55D9; Sat, 7 Oct 2023 00:56:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343794AbjJGH4T (ORCPT + 99 others); Sat, 7 Oct 2023 03:56:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343762AbjJGH4P (ORCPT ); Sat, 7 Oct 2023 03:56:15 -0400 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B8E3A6; Sat, 7 Oct 2023 00:56:13 -0700 (PDT) Received: by mail-oi1-x22b.google.com with SMTP id 5614622812f47-3afc38cbdbcso1094775b6e.1; Sat, 07 Oct 2023 00:56:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696665372; x=1697270172; darn=vger.kernel.org; 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; bh=F0VngE6BdDwFZLAlGMzCM3wLTc/iiRqiIMV99Spu1cQ=; b=KKqNYXnRBqzx8ryNMN/8VUFc3ZQUfMrlYdY62u7RK9Wto4DLZqzqY6MkHH05EIgixy tDNF2yKMf/8CHRIogqR7S2gtVoVCDSMntxAfnIP7nfSlZ4D78rAOEuc3wj0HzBFZJ4vQ gpHKXx5Ll3QnCnFoIRhpFK8uML/6MU58p1DRR1zQqxq1uiAVJ+3kjc7s0OcCrGDlCj3z 5XM5rzKv6mxCC1xY91hqFrxA4VuWAQgCgPzLqKEh/YWNO7n6Zn4cy+trxcB22W8+640R uP0CSZ8xUpg9mObcr0oVh5dYjyNSq+xTc7psExvWnzvYKxndYJ4vQACx8FHdMqTC8eiu WxIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696665372; x=1697270172; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F0VngE6BdDwFZLAlGMzCM3wLTc/iiRqiIMV99Spu1cQ=; b=uLwLmU4TxBBQN0AMVXjwu2aoI93qW2JNy1ZLLZZTk9fQyS+S59h/FB3pGkqcWD2Yja un1sAEUWHP7s5c7OGVaJ+wwtRiMksL7yC90eY6j1XplvekI4L3x/ShiQwNNf/Oxpl6cE wA7Nr8MtsSIQGysJXFPqgVpvTT0qJgq1i3gA2N/k+FWdQsLDPip3ZeAGyJG0Mg4XmM6A a1tt+Or9IOkgvjcb6Ff1f+jIGPHZdlJWf3xc/xTtsZq0ANAMIn1jEAMWQsGJ/Yfh2bwc GbtzANkuSbSchoffZEYyZNfO5Tlxyc7iB1KflPkv4wB10hZc6Tc9+D2qH4fJAEN94Cwj uh9Q== X-Gm-Message-State: AOJu0YwiWGzv+LkLqVW5pIwxnog0vVwDykVLJZxd6PVXEZRsasAIE5tH iAUllITMFHH+6CoNs6rWw9k= X-Received: by 2002:a05:6808:18a0:b0:3ae:1359:b51c with SMTP id bi32-20020a05680818a000b003ae1359b51cmr4051929oib.29.1696665372397; Sat, 07 Oct 2023 00:56:12 -0700 (PDT) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id t64-20020a4a5443000000b0057346742d82sm702048ooa.6.2023.10.07.00.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Oct 2023 00:56:11 -0700 (PDT) From: Chen Wang To: aou@eecs.berkeley.edu, chao.wei@sophgo.com, conor@kernel.org, devicetree@vger.kernel.org, guoren@kernel.org, jszhang@kernel.org, krzysztof.kozlowski+dt@linaro.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, palmer@dabbelt.com, paul.walmsley@sifive.com, robh+dt@kernel.org, xiaoguang.xing@sophgo.com, apatel@ventanamicro.com Cc: Inochi Amaoto , Chen Wang , Conor Dooley Subject: [PATCH v5 06/10] dt-bindings: timer: Add Sophgo sg2042 CLINT timer Date: Sat, 7 Oct 2023 15:56:03 +0800 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Sat, 07 Oct 2023 00:56:34 -0700 (PDT) X-Spam-Level: ** From: Inochi Amaoto The clint of Sophgo's sg2042 is based off IP designed by T-HEAD, but Sophgo changes this IP layout to fit its cpu design and is incompatible with the standard sifive clint. The timer and ipi device are on the different address, and can not be handled by the sifive,clint dt-bindings. If we use the same compatible string for mswi and timer of the sg2042 clint like sifive,clint, the DT may be like this: mswi: interrupt-controller@94000000 { compatible = "sophgo,sg2042-clint", "thead,c900-clint"; interrupts-extended = <&cpu1intc 3>; reg = <0x94000000 0x00010000>; }; timer: timer@ac000000 { compatible = "sophgo,sg2042-clint", "thead,c900-clint"; interrupts-extended = <&cpu1intc 7>; reg = <0xac000000 0x00010000>; }; Since the address of mswi and timer are different, it is hard to merge them directly. So we need two DT nodes to handle both devices. If we use this DT for SBI, it will parse the mswi device in the timer initialization as the compatible string is the same, so will mswi. As they are different devices, this incorrect initialization will cause the system unusable. There is a more robust ACLINT spec. can handle this situation, but the spec. seems to be abandoned and will not be frozen in the predictable future. So it is not the time to add ACLINT spec in the kernel bindings. Instead, using vendor bindings is more acceptable. Add new vendor specific compatible strings to identify timer of sg2042 clint. Signed-off-by: Inochi Amaoto Signed-off-by: Chen Wang Signed-off-by: Conor Dooley --- .../timer/thead,c900-aclint-mtimer.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml diff --git a/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml new file mode 100644 index 000000000000..fbd235650e52 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/thead,c900-aclint-mtimer.yaml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/timer/thead,c900-aclint-mtimer.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo CLINT Timer + +maintainers: + - Inochi Amaoto + +properties: + compatible: + items: + - enum: + - sophgo,sg2042-aclint-mtimer + - const: thead,c900-aclint-mtimer + + reg: + maxItems: 1 + + interrupts-extended: + minItems: 1 + maxItems: 4095 + +additionalProperties: false + +required: + - compatible + - reg + - interrupts-extended + +examples: + - | + timer@ac000000 { + compatible = "sophgo,sg2042-aclint-mtimer", "thead,c900-aclint-mtimer"; + interrupts-extended = <&cpu1intc 7>, + <&cpu2intc 7>, + <&cpu3intc 7>, + <&cpu4intc 7>; + reg = <0xac000000 0x00010000>; + }; +... -- 2.25.1