Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2694573rdb; Wed, 4 Oct 2023 08:44:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFugFOtry0ZUuohhRa3+UYCFJQVzEonxMWCPa/t/KwQ+mjg2Wjn6e6Q/HHe5fPRDmqVvHlx X-Received: by 2002:a05:6358:440e:b0:142:fb84:92e6 with SMTP id z14-20020a056358440e00b00142fb8492e6mr2881556rwc.9.1696434251757; Wed, 04 Oct 2023 08:44:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696434251; cv=none; d=google.com; s=arc-20160816; b=wi+weFq2BggKl2OWnEPS8yuxYWPtg4Td5DNhDtkroK65l/uMaZ6YuolZt6FuqUQQpM 5A0PQezthRY2oLUUC21Vy+sRUqyTYVc59Vi5awT+uzzlA6eCudjS65u+CgjOQW/t3670 mYkkEGsX8j8mJWa3Wb1bNRlx11IbfjULsDr2rUYqtZa9S3PpOm6G1VTlnTHw9os3Aa2V htJrfqi1Zl9UTIuI4nb742wQIEP+0pUnsybZfKmJMWAS+ukTTGLkqPlm3nFxt2poEM1S DoF8oRDg2bJb6NesKvQSsfayWQzbYxhY3z28Hf5HmvOoaeqFfDHWf97RXpbDroWS0pIq RHgQ== 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=s2EWhyzfVF0SlezT75W8p2BMfVzvHlK5TEMrrV+47aA=; fh=EIbGMYK7K8arOJ5zPHlUa3rnNXCb4Zyo8/EeMCoNiak=; b=WpbTdEFGgWvv30l6xaAVwPX8PLnndBm9YqF2dgg9vIHqEBQx22RQ2F578f4r2pqCF7 SuGfsUZiW00SnK8DZkURfRUA1R13/9AGYLcwIMtHf2IBUPCz7uNbbled/YyQ+CZkDymz HIMUWbl+VPu5GZ99KZJSQbY8YzPeHbxcKXeLYAMUOlCfaLZoOY0m+jR0YGcbSoDNVmt9 O3m7wJV5ZBFa8z3p7UaAg/1dGLW1dlUlGp9siKHpyBLogyfuT0nYM9HdipR+5/hBYcoB SMndAc1eHkGvtgyGBnoNThlyOGjYQkTb6r/VzfWNZSzIuvLQBWZu7HjDyS1o6k27ATDU QAHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MjxyCQxw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id s190-20020a632cc7000000b00577960a815csi3937004pgs.188.2023.10.04.08.44.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 08:44:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=MjxyCQxw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (Postfix) with ESMTP id 71984826A053; Wed, 4 Oct 2023 08:44:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243113AbjJDPn7 (ORCPT + 99 others); Wed, 4 Oct 2023 11:43:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233616AbjJDPn6 (ORCPT ); Wed, 4 Oct 2023 11:43:58 -0400 Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 761EABD; Wed, 4 Oct 2023 08:43:55 -0700 (PDT) Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3af5fda8f6fso1506294b6e.3; Wed, 04 Oct 2023 08:43:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696434235; x=1697039035; 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=s2EWhyzfVF0SlezT75W8p2BMfVzvHlK5TEMrrV+47aA=; b=MjxyCQxwEcFAAyRNO1QPHonIpp3UW393FmR724nIzEbV/9m+ReOiCIE2n621QJHKfS KPgLRl8FLlQUcdD+oAhazJozqpqDJKCn5fR5zIUPc+KS2Fs+7xDhkcljHWqWwGxA6GUe 9G9cXIuT4uTyfv7bjjnndCjpUwfHKMMYm+J8XW9qLIyC76d6w1AknKnzi0zlanZ7ac1L 9NlcpTEkmMIF8SWxl76bLVhdoj02EuxCqgN6dHGo3oVkkbmPKuKZxzmfN+7FCvgRJf7t HAQj8sjObXzg9izh4sWlyWiT3BHs5AkLexl7p0IcxVl39RN3paI0uHQRBeCGij9lkA+x LYHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696434235; x=1697039035; 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=s2EWhyzfVF0SlezT75W8p2BMfVzvHlK5TEMrrV+47aA=; b=j6f7utBMKTfP7DdPGNnlpeuqn8Ko/PO6Y6Jf3BzviwjdUHNd/jbgd860SvkMQWP9o8 q2YWSVnBBJhB/hc5ay2HI/7g+VW2BZfCousaBI5ud6mZkh0XBFcz/MGBBAAT9c6SkMi2 ARQUbCyrUrEbb4X8lBJs5Nq13cgwI3zA4JDw2oVWH1nlrDdaf5US6ZLRpjqxvzUfg4HP GyWiedcrhyZURC6wmzgpKiiB2gEdg+KxKN/sJevhs+/QJgnAmBjdU0PU4TZafjLFwUVY mSKRIy0JYSJX1xBrpetJoBqgfU2iKz0fimJ05SCxfeoUq2Q/0NyMXCQOnadjcHs6US57 sOGw== X-Gm-Message-State: AOJu0YxyOHLICfeOfIusPAwBgrN5mKaJGGUzlES7sg/4a5f903blkpa3 Ic4+MEPPxxskwEwMNMFT0no= X-Received: by 2002:a05:6808:9a2:b0:3ad:f6ad:b9d2 with SMTP id e2-20020a05680809a200b003adf6adb9d2mr2679866oig.16.1696434234754; Wed, 04 Oct 2023 08:43:54 -0700 (PDT) Received: from localhost.localdomain ([122.8.183.87]) by smtp.gmail.com with ESMTPSA id s14-20020a05680810ce00b003af5f6e40d7sm537597ois.15.2023.10.04.08.43.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 08:43:54 -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 Subject: [PATCH v4 07/10] dt-bindings: interrupt-controller: Add Sophgo sg2042 CLINT mswi Date: Wed, 4 Oct 2023 23:43:47 +0800 Message-Id: <1f6b82a1864477a51db33d3f295889ff985b497b.1696433229.git.unicorn_wang@outlook.com> 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=-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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.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 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 08:44:08 -0700 (PDT) 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 mswi of sg2042 clint. Signed-off-by: Inochi Amaoto Signed-off-by: Chen Wang --- .../thead,c900-aclint-mswi.yaml | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-mswi.yaml diff --git a/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-mswi.yaml b/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-mswi.yaml new file mode 100644 index 000000000000..065f2544b63b --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/thead,c900-aclint-mswi.yaml @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/interrupt-controller/thead,c900-aclint-mswi.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Sophgo sg2042 CLINT Machine-level Software Interrupt Device + +maintainers: + - Inochi Amaoto + +properties: + compatible: + items: + - enum: + - sophgo,sg2042-aclint-mswi + - const: thead,c900-aclint-mswi + + reg: + maxItems: 1 + + interrupts-extended: + minItems: 1 + maxItems: 4095 + +additionalProperties: false + +required: + - compatible + - reg + - interrupts-extended + +examples: + - | + interrupt-controller@94000000 { + compatible = "sophgo,sg2042-aclint-mswi", "thead,c900-aclint-mswi"; + interrupts-extended = <&cpu1intc 3>, + <&cpu2intc 3>, + <&cpu3intc 3>, + <&cpu4intc 3>; + reg = <0x94000000 0x00010000>; + }; +... -- 2.25.1