Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3360785iog; Mon, 27 Jun 2022 14:30:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u63XTdo9zyb7tKSNLn+np84hrh8vZuFsCygBpC9f+ZaL6bOgAMnd1EtCF1ZzLys+6kAwAg X-Received: by 2002:aa7:814b:0:b0:525:1ada:329b with SMTP id d11-20020aa7814b000000b005251ada329bmr33923pfn.34.1656365424337; Mon, 27 Jun 2022 14:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656365424; cv=none; d=google.com; s=arc-20160816; b=OAB96mg3MHGdTaOyBwgU626rl+8VheLdOOWvTjIO7PJJ3J4WHWhejYuASE+A12BxHF /ELHG3WvFXGPCueXQQrW10AwtSUWvTGNc+WOQUonPuwzhcLlq/furObpZG8R//MIa/Hj 0PzKc3ZTc3IogNDmbzKpCOQoAA5qTF6+yXGzvTOqJ8uhczMmm7dLhmVz2L0edsksE6bc /2o1nYQ6iqsAdsz38UgtmbqclUUViuU/8b3B1/LOdqYbiE4dTUIj0qVvG82lAf3oVsRi xFhiax0b05Mz2c8vMwnNIQKD149o/SwAvVaZkowPV6utRWjfo6b3yUh/AbLdveYXsq+h vWfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Apd1Cl8iWlr7VPj1iuOe666SC1Q2pQo9qEBUCr9vf6Q=; b=pDpRr4PyASbuQSBeCbGe2wnG7U6+VeJfLsNgV7Sf5gWLPtfWz/BhZ3d480c7mpjTWd IbvYozSCI9q4xRu+bRGB44LRriK6WWqvztKEXFZCYV7tE4taYaY+yVVaY50U2OKzC+zm A9JbCWKDksHuMk4/APKZrx1NNPFvjXlN/MZyvDlpP3Syzw59YdzrwR9pLOwbwlmZrDfX wZAe9MmgyXlYnElgm+Y2o7lnQWpTdPR5HCbsbjj7EsprjL61RwWgDBEGeqId742/j0Bh +Mj41bYG69gefxLAilAjpfnt/kVYZuM4bn0edSuOMhH7EdVUQICiXGLug7+wD7Z+3th8 KpSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ilyEOtv0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z20-20020a17090ab11400b001e32ffeec30si14068036pjq.41.2022.06.27.14.30.11; Mon, 27 Jun 2022 14:30:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ilyEOtv0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240942AbiF0VNW (ORCPT + 99 others); Mon, 27 Jun 2022 17:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234920AbiF0VNU (ORCPT ); Mon, 27 Jun 2022 17:13:20 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFBBD167C7; Mon, 27 Jun 2022 14:13:18 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id by38so12468809ljb.10; Mon, 27 Jun 2022 14:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Apd1Cl8iWlr7VPj1iuOe666SC1Q2pQo9qEBUCr9vf6Q=; b=ilyEOtv07N3ArdjBB7bMKwAqjb/e0wlxydgdur1zOwDRqzH4IPqX2FlQxVaGAXw6Kc Gc0VmznO21rzcUs44XvprgCJ41kZL5S9X1gx6kQ+guwTI6uiSc4zItEWOnsDW3kNAVlF sfGw15jYmTuWW1FxW/Lb57dg0O1NF3p/fPa5o15TUnzZIQmB98u2AvQRL0iesgljp0tc xc9//5AKa4Iw3dQz5Ksx+KmaP7act61c7ia75qFkgn5dlsfLCparb572EaPCLMdTHnjX 0Dp5EEprtNhtw/ZXAV6oYcWZi6HDJptcetDIzhKexpPO7ZBBmv8UMK0X2PqLjPdeMC7b JSUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Apd1Cl8iWlr7VPj1iuOe666SC1Q2pQo9qEBUCr9vf6Q=; b=mejYong5MDR9uk8cJkLhT9piKk/avBZg1NnjCyyJLI1w8IqYqtuZXdmFKTGpFnUE9L 6wpzwHvuQHobi2lKX5psMS5rd9sqwdikDtaVC4mzhRPMYGVpz/mBwH5xunDxZ7mJevXt 31OXPmaOD+zfRIuYsupecxqirhsSe8TYDzWpqekcg3Ehr5Lab8uwtELugCNaph06LKRn XmNFQLDuG2xa3HjSTN5dwwPYFaVhMnpv3o/EGJ5hO/uGyaEoNZn2vB1GZfXWBvNx0hQC L0c2vea+rNYYBe93efkQ03+VhxG0LraqvfPMk2XP68GnXCSvSzpgX0D7WFW8aU+ikot2 3MUQ== X-Gm-Message-State: AJIora9cx/8Rx4rvJkmOdWvHW2YfW1998uzcAwHZCZpoIMfuX6CiOWoQ tLyU9mtRRpDfN6WLf3V4g6M= X-Received: by 2002:a2e:9191:0:b0:25a:8858:f60d with SMTP id f17-20020a2e9191000000b0025a8858f60dmr7495670ljg.423.1656364397334; Mon, 27 Jun 2022 14:13:17 -0700 (PDT) Received: from mobilestation ([95.79.140.178]) by smtp.gmail.com with ESMTPSA id z9-20020a2eb529000000b0025bc79181b4sm358400ljm.36.2022.06.27.14.13.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 14:13:16 -0700 (PDT) Date: Tue, 28 Jun 2022 00:13:14 +0300 From: Serge Semin To: Conor Dooley Cc: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding , Sam Ravnborg , Eugeniy Paltsev , Vinod Koul , Liam Girdwood , Mark Brown , Daniel Lezcano , Palmer Dabbelt , Palmer Dabbelt , Thomas Gleixner , Paul Walmsley , Albert Ou , Conor Dooley , Masahiro Yamada , Damien Le Moal , Geert Uytterhoeven , Niklas Cassel , Dillon Min , Heng Sia , Jose Abreu , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, alsa-devel@alsa-project.org, linux-spi@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v2 06/16] dt-bindings: timer: add Canaan k210 to Synopsys DesignWare timer Message-ID: <20220627211314.dc2hempelyl5ayjg@mobilestation> References: <20220627194003.2395484-1-mail@conchuod.ie> <20220627194003.2395484-7-mail@conchuod.ie> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220627194003.2395484-7-mail@conchuod.ie> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 27, 2022 at 08:39:54PM +0100, Conor Dooley wrote: > From: Conor Dooley > > The Canaan k210 apparently has a Sysnopsys Designware timer but > according to the documentation & devicetree it has 2 interrupts rather > than the standard one. Add a custom compatible that supports the 2 > interrupt configuration and falls back to the standard binding (which > is currently the one in use in the devicetree entry). > > Link: https://canaan-creative.com/wp-content/uploads/2020/03/kendryte_standalone_programming_guide_20190311144158_en.pdf #Page 58 Firstly, it's page 51 in the framework of the document pages enumeration. Judging by the comment in the document above and what the HW reference manual says regarding the IRQ signals, what you really have on K210 is the DW APB Timer IP-cores each configured with two embedded timers. It's done by the IP-core synthesize parameter NUM_TIMERS={1..8}, which in your case equals to 2. A similar situation is on our SoC and, for instance, here: arch/arm/boot/dts/berlin2q.dtsi arch/arm/boot/dts/berlin2.dtsi arch/arm/boot/dts/berlin2cd.dtsi (Though the Berlin2 APB Timer have been configured with 8 timers.) So the correct modification would be: 1. Split up the nodes into two ones with one IRQ per each node. 2. Make sure I was right by testing the new dts out. 3. Update the DT-node only and leave the DT-bindings as is. -Sergey > Signed-off-by: Conor Dooley > --- > .../bindings/timer/snps,dw-apb-timer.yaml | 28 +++++++++++++++---- > 1 file changed, 22 insertions(+), 6 deletions(-) > > diff --git a/Documentation/devicetree/bindings/timer/snps,dw-apb-timer.yaml b/Documentation/devicetree/bindings/timer/snps,dw-apb-timer.yaml > index d33c9205a909..9a76acc7a66f 100644 > --- a/Documentation/devicetree/bindings/timer/snps,dw-apb-timer.yaml > +++ b/Documentation/devicetree/bindings/timer/snps,dw-apb-timer.yaml > @@ -12,6 +12,9 @@ maintainers: > properties: > compatible: > oneOf: > + - items: > + - const: canaan,k210-apb-timer > + - const: snps,dw-apb-timer > - const: snps,dw-apb-timer > - enum: > - snps,dw-apb-timer-sp > @@ -21,9 +24,6 @@ properties: > reg: > maxItems: 1 > > - interrupts: > - maxItems: 1 > - > resets: > maxItems: 1 > > @@ -41,7 +41,23 @@ properties: > > clock-frequency: true > > -additionalProperties: false > +unevaluatedProperties: false > + > +if: > + properties: > + compatible: > + contains: > + const: canaan,k210-apb-timer > + > +then: > + properties: > + interrupts: > + maxItems: 2 > + > +else: > + properties: > + interrupts: > + maxItems: 1 > > required: > - compatible > @@ -60,8 +76,8 @@ oneOf: > examples: > - | > timer@ffe00000 { > - compatible = "snps,dw-apb-timer"; > - interrupts = <0 170 4>; > + compatible = "canaan,k210-apb-timer", "snps,dw-apb-timer"; > + interrupts = <0 170 4>, <0 170 4>; > reg = <0xffe00000 0x1000>; > clocks = <&timer_clk>, <&timer_pclk>; > clock-names = "timer", "pclk"; > -- > 2.36.1 >