Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp823557rwn; Thu, 8 Sep 2022 09:13:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR5tZjKJ09VOC/39c57IMeDW1/mpf9+wfXn0WH0bV9c6zLqkVlQ7R5vahj+jfSWF/zcrzh9/ X-Received: by 2002:a63:d1f:0:b0:422:7774:1969 with SMTP id c31-20020a630d1f000000b0042277741969mr8385325pgl.88.1662653611976; Thu, 08 Sep 2022 09:13:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662653611; cv=none; d=google.com; s=arc-20160816; b=rkQdkkGzKGAGo8EVVoOEvElWQ7M+JuMAWNfc58d7YrshvDbv3mOruafpIOyk8kgBG2 vl5ZHroz7p1T1IU5JQjYWC0B6pYmJB0Rrcf0o36KnyM72XbM0iY7kLvQbeEtHZvzg4qJ SPKdikByCcwtQFxoL+OXjeT36G3/EJ9XQbnNFRef0Fj+LnOMSawpmiq3vrhQzH4qwPyC YhHitIpGFro39rHjlG3a0S/lYHrXBjYetl5PKFC8P3Qh19aNm+/d5Qupa8C4jQzQcDBq 3oK+XFaN0Z3rdbZ6KxdHN2JKdpR1Z5w+YnGjUVN33sqRBAJEzz5mSL9Iyw40Zi2sTk9a eZEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=GLjz+jpxG6Z7GkqektuPsextgrhLY3boxm/7UAEJFuA=; b=i76HyLKZA+1w3r0aRz5AbJOKXPayqQgKbHGP3js4UCAOVlYgV7kSU+8TlyKqClGZnY WSH2jwRWSP78tg/kMHy1NEztFnGD9l9ZF7iBu5bEzHgXcgFCNcpLEJzP1Qu8FC17Iemj PyR6DSfkQiKlR7bRXGNdJjtSodgqTcHX3wtiPVuMdRSGczfXFl09792gpFxktt+KrrnW LfaAzvBhhbtxWmzA3WQgFBQr5FnjUNK8sZJcMD7jQJHBP81o4I88o66sLc+SZwaYMCGX 4hRVWaEBxWRQM609oIjPsZKhTS4cccl3w7c3GGXpcw/kw1BpaQtaqL+QPA24uJF/JFjg mkwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QHTpkOmq; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 128-20020a630086000000b0040cf84add25si19274594pga.878.2022.09.08.09.13.19; Thu, 08 Sep 2022 09:13:31 -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=@linaro.org header.s=google header.b=QHTpkOmq; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230497AbiIHP3M (ORCPT + 99 others); Thu, 8 Sep 2022 11:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232834AbiIHP2i (ORCPT ); Thu, 8 Sep 2022 11:28:38 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DBB21203DE for ; Thu, 8 Sep 2022 08:27:35 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id i26so12580339lfp.11 for ; Thu, 08 Sep 2022 08:27:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=GLjz+jpxG6Z7GkqektuPsextgrhLY3boxm/7UAEJFuA=; b=QHTpkOmqk5aefGB0YRTIi1kYEfHygKIBs0Yc0X5PRfk+F3aMYgR+Pa/PYZVi3IKxNC wA0nD8KdZhrW+a2eZIL3W1eqa8kVZiHJARMivg5dCKezawXBx92F0hhWYufzZQ9M5+kc Itefl9kO7mj1vCLme/vnSERV0H75w8AM0/i4Hi9sRvQD9ta+s3Rz4qTF/c2vp2f67YeR s94NUHl15tkuaoJP1QHxP6q5n2AjEoUuj9PfjxAWMV+k5897FsRwPK+o9Wd1iF/47ZMw gpZfEGXW0n9r7V3NiuM3fHDbP8snko9defPl9omZFkasYj+Oa+cwi5lR4DISYPmIpPCF Tflw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=GLjz+jpxG6Z7GkqektuPsextgrhLY3boxm/7UAEJFuA=; b=qy7qNNEtWuSYHnnt5rwzZv0McV+n0S/z+eyfXfzmCDby7LxjOgBudi0OjoHtJ4GdDx sIE5D+KT5DUCFJD5NuFQxL6A0JxRkpCE4Ql+Pw9HAv/CmXIwJixD/rlbBtjyfOSu+k35 f96rjfo+g7SWAd5I6gYER5jpEEXp6CRTfQf6SlmNmR+KyLhHDzlQ4tnsLIDn4TEWzAPJ aWL73oTXgk8MHzl9JrzJMT2tiiygim+8ewRcOdPgV8wF0gdn4xwIk7rguxmZSd9vIHwL 2wlPeYp27SsjyqG3M1Wg+ry658Uk8lySoHMCKW+C/EVZvufr9fOC5N7LS2g9wo57EJUj CcNQ== X-Gm-Message-State: ACgBeo0/P0h4Zuquz9Yk7yo3dBGFChlhag3RHcxB1qwAxNvCcZU83UwS TFnWWVMmt+BlvJ1kUlN6i64guw== X-Received: by 2002:a05:6512:10c1:b0:492:a27d:ff44 with SMTP id k1-20020a05651210c100b00492a27dff44mr2706443lfg.405.1662650851914; Thu, 08 Sep 2022 08:27:31 -0700 (PDT) Received: from [192.168.0.21] (78-11-189-27.static.ip.netia.com.pl. [78.11.189.27]) by smtp.gmail.com with ESMTPSA id v23-20020ac258f7000000b00497a5a91763sm1178497lfo.12.2022.09.08.08.27.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Sep 2022 08:27:31 -0700 (PDT) Message-ID: Date: Thu, 8 Sep 2022 17:27:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.0 Subject: Re: [PATCH 02/13] dt-bindings: memory: snps: Add Baikal-T1 DDRC support Content-Language: en-US To: Serge Semin Cc: Serge Semin , Michal Simek , Borislav Petkov , Mauro Carvalho Chehab , Tony Luck , Rob Herring , Manish Narani , Alexey Malahov , Michail Ivanov , Pavel Parkhomenko , Punnaiah Choudary Kalluri , Dinh Nguyen , James Morse , Robert Richter , Krzysztof Kozlowski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220822191957.28546-1-Sergey.Semin@baikalelectronics.ru> <20220822191957.28546-3-Sergey.Semin@baikalelectronics.ru> <0bda4ff9-fc08-77f2-0e06-7469dcaec6d8@linaro.org> <20220826095447.qxfvty6xq4tufe75@mobilestation> <36b2b6d9-9ab4-a4bc-6476-bd5b5d3ef77e@linaro.org> <20220908094307.civtqiwxadas3ys3@mobilestation> <20220908150806.oj7d5inifofvtiqk@mobilestation> From: Krzysztof Kozlowski In-Reply-To: <20220908150806.oj7d5inifofvtiqk@mobilestation> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/09/2022 17:08, Serge Semin wrote: > On Thu, Sep 08, 2022 at 11:58:50AM +0200, Krzysztof Kozlowski wrote: >> On 08/09/2022 11:46, Serge Semin wrote: >>> On Mon, Sep 05, 2022 at 12:14:21PM +0200, Krzysztof Kozlowski wrote: >>>> On 26/08/2022 11:54, Serge Semin wrote: >>>>> On Tue, Aug 23, 2022 at 11:12:28AM +0300, Krzysztof Kozlowski wrote: >>>>>> On 22/08/2022 22:19, Serge Semin wrote: >>>>>>> Baikal-T1 DDR controller is based on the DW uMCTL2 DDRC IP-core v2.51a >>>>>>> with up to DDR3 protocol capability and 32-bit data bus + 8-bit ECC. There >>>>>>> are individual IRQs for each ECC and DFI events.The dedicated scrubber >>>>>> >>>>> >>>>>> Missing space before "The". >>>>> >>>>> Ok. Thanks. >>>>> >>>>>> >>>>>>> clock source is absent since it's fully synchronous to the core clock. >>>>>> >>>>> >>>>>> You need allOf:if-then restricting this per variant. >>>>> >>>>> I really don't like the allOf-if-if-etc pattern because it gets to be >>>>> very bulky if all the vendor-specific and generic platform >>>>> peculiarities are placed in there. I am more keen of having a >>>>> generic DT-schema which would be then allOf-ed by the vendor-specific >>>>> device bindings. What do you think I'd provide such design in this >>>>> case too? >>>> >>>> Sure, it would work. >>>> >>>>> >>>>> But I'll need to move the compatible property definition to the >>>>> "select" property. Like this: >>>>> >>>>> Documentation/devicetree/bindings/memory-controllers/snps,dw-umctl2-ddrc.yaml: >>>>> +[...] >>>>> +# Please create a separate DT-schema for your DW uMCTL2 DDR controller >>>>> +# and make sure it's assigned with the vendor-specific compatible string. >>>>> +select: >>>>> + properties: >>>>> + compatible: >>>>> + oneOf: >>>>> + - deprecated: true >>>>> + description: Synopsys DW uMCTL2 DDR controller v3.80a >>>>> + const: snps,ddrc-3.80a >>>>> + - description: Synopsys DW uMCTL2 DDR controller >>>>> + const: snps,dw-umctl2-ddrc >>>>> + - description: Xilinx ZynqMP DDR controller v2.40a >>>>> + const: xlnx,zynqmp-ddrc-2.40a >>>>> + required: >>>>> + - compatible >>>> >>> >>>> Not entirely. If you need select, then add it with compatibles, but all >>>> descriptions and deprecated are staying in properties. >>> >>> Ok. But note in such case the compatible string constraints will get >>> to be opened for any non-common string. Like this: >>> >>> + properties: >>> + compatible: >>> + oneOf: >>> + - const: snps,ddrc-3.80a >>> + - {} >> >> Not really. If you define here specific device compatibles in select, >> they must be here as well. >> >>> >>> It's required for the DT-schemas referencing the common one, otherwise >>> they will fail DT-nodes evaluation due to the "compatible" property >>> missing the vendor-specific string. >> > >> o you probably mix here purposes. Either you define common schema or >> device specific one. If you define common, usually it does not enforce >> any compatibles. You do not need select, no need for compatibles either, >> although you can add above syntax if it is valid. If you write here >> specific device bindings, then compatibles should be listed. Judging >> from what you wrote it's neither this nor that... > > My idea was to provide both the common DT-schema and the > vendor-specific ones. But the later one would refer to the common > schema in the framework of the "allOf:" composition. Like this: > > snps,dw-umctl2-ddrc.yaml: > + [...] > + select: > + properties: > + compatible: > + enum: > + - snps,ddrc-3.80a > + [...] > + properties: > + compatible: > + oneOf: > + - const: snps,ddrc-3.80a > + - {} This is not the approach snps,dwc3.yaml is doing. It is closer to snps,dw-pcie.yaml, but that one ends with additionalProperties:true so it is expected to be constrained by something else. You can choose either way, but what you wrote before looked different - basically loosing the compatibles documentation. > + interrupts: > + [...] > + interrupt-names: > + [...] > + additionalProperties: false > + [...] > > baikal,bt1-ddrc.yaml: > + [...] > + allOf: > + - "schemas/memory-controllers/snps,dw-umctl2-ddrc.yaml:#" > + [...] > + unevaluateProperties: false > + [...] > > Thus the common schema as before would provide the widest set of the > properties and their constraints, while the vendor-specific one would > be !obligated! to follow the common schema conventions, but provide a > more specific set of the properties and constraints. A similar > approach is implemented for instance in the DW USB3 DT-schemas, but > with the generic compatible string fallback. In this case we don't > need the fallback string, but in order for the common schema being > applicable for both the common and vendor-specific DT-nodes the > compatible property constraints need to be designed as is provided in > the example above. Anyway, it's getting complicated so I am not sure about which option now we discuss. You cannot have deprecated entries in select and compatibles described there, without describing them in properties. > > Alternatively we can split the snps,dw-umctl2-ddrc.yaml schema up into > the two ones: > snps,dw-umctl2-ddrc-common.yaml > and > snps,dw-umctl2-ddrc.yaml > So the first schema would contain all the common properties definition > and would be only used for being referenced in the particular device > DT-bindings (select: false). The snps,dw-umctl2-ddrc.yaml and > vendor-specific DT-schemas would just have it "allOf:"ed. > > Personally I'd prefer the design pattern with the always-true > compatible property constraint as in the example above since it seems > easier to maintain than having the common and generic device > DT-schemas. > > Note having a common DT-schema and a vendor-specific one referencing > the common schema is very much useful practice for the devices based > on the same IP-core. Vendor-device driver authors tend to create their > own bindings for the same clocks/resets/phys/etc thus making the > drivers much harder to maintain (for a bright example see what has > been done for the DW PCIe RP/EP IP-core). The worst part of it is that > ones the DT-bindings interface is implemented it can't be changed > since the kernel needs to be backward compatible with the DT-sources > compiled before. So the main goal of the common DT-schema is to fix > the common DT interface and make sure the new vendor-specific device > drivers would at least consider either to follow the IP-core DT > convention or to widen it up if required. Best regards, Krzysztof