Received: by 2002:a05:7412:40d:b0:e2:908c:2ebd with SMTP id 13csp932721rdf; Wed, 22 Nov 2023 00:21:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEz/xM/9Kg03JJXaZQ/mFY6rbvzA5PW1iMUXkFxDVG7IzwNE+MbOgeqhsMo8OnbFSPsDBd1 X-Received: by 2002:a05:6808:1905:b0:3b5:663c:9b91 with SMTP id bf5-20020a056808190500b003b5663c9b91mr2671621oib.12.1700641312809; Wed, 22 Nov 2023 00:21:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700641312; cv=none; d=google.com; s=arc-20160816; b=DROk+JdKzyLfoCiop49CDdxR9crtgzrFRMB2jtA28tGMTGwQLsY1Bev0xXWoeJvQyy vhVSWI/OZYEYAoZINKeC/h7WImhk33W4sEgjPUQ7ArBTnhtfC6c7XrgjZ4jHsaM/lTwK XYdUnMivC8Q+xCz0SlGo2O98Lw9mZ6jbkFlKCP3gARAwLWAaNQjEb3Fqnv04cvmtRkv9 quy5/bU1qc8XvrBf2GLHAX11Dq+yhBBkPj27uQSEKc2TCBvLNz/UxDWia6AxgEEkqal0 X81NEMC1rK7xRmcVTjJhNEVmZEsosSOmyZNCyYSynnEYzp/ZLomO2eQA/pDVE1QP0HVh xaVw== 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:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=dWZXWR10yN3RjItd4uVERoZZUJiKuZqt9/puLFdDo8c=; fh=ArOruH+nycwEWI87XVbY8RyOuW+7ZM2QTB5MBPjoMfg=; b=RhGqmOnD6FuD++QQeB2YcoBf446a4tYuO31+HKYPXiqxnMek/MfBOpe1TiT43wDctm lKBbAy6YcH2HGCYafE7NkDEdntuRfETckVcBWYZoX4SlM2C3ePYLZgRoGsWnFKf7IjCW gPNCyfwtmHs3+6WH9CLn0/2ZKUTmA58L7TvgE0B0p1s7EyBy4BtiHoVygy0Dx5/JpdoH dwA4j9gWps/xmfF6trMKXPC/ChJ5wZHfwzrr8ZpFXzZ+3WDqp7WMg73MqSRefynO0aWo bKA6qgWTWbg5BBoLitPotDQqXRHURZ2qWLb2WaP6e38GMINwokHGldrUK+wugH2i0P1V mgxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JSqqO722; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id 24-20020a631658000000b0055be9543340si11812656pgw.872.2023.11.22.00.21.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Nov 2023 00:21:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JSqqO722; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 12F6B802998C; Wed, 22 Nov 2023 00:21:50 -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 S234976AbjKVIVj (ORCPT + 99 others); Wed, 22 Nov 2023 03:21:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231239AbjKVIVh (ORCPT ); Wed, 22 Nov 2023 03:21:37 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2368D6F for ; Wed, 22 Nov 2023 00:21:32 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a02ba1f500fso191876666b.0 for ; Wed, 22 Nov 2023 00:21:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700641291; x=1701246091; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=dWZXWR10yN3RjItd4uVERoZZUJiKuZqt9/puLFdDo8c=; b=JSqqO722RoBe67gbrpVw40PsQvkcZTEtACghpfz5m2+NvgwryhCpmFhy8edWH8hTiG sGtJf7GmLvqtC1qEGlFQLgFz0qnBuxSYAoqRehzZgnW8ckP2lNFYCwQTImZY8Aem3LuY 57Tls+ytMT+VMI6vaWP7YGDUoW8g08sX21rbhFRLiB3J5XTIktOL6bSlXFAPMWavMadc 8c7iCR5NaEiCO0YB3XTwMPkmcrQ0EE1UVuDL/JAKf8AFWsdTLLrd90AarlhHfqmdIR49 uJkvF/1oMdh4HX0b76Y5N/MwFAhz2/7r0WOAS7cLUf1shyMdi6DsIzTqGZOqMzt7wCyI szFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700641291; x=1701246091; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=dWZXWR10yN3RjItd4uVERoZZUJiKuZqt9/puLFdDo8c=; b=pT8kUoutT4t9t7M4aU6fQ8ckVeK7hm5IWTPmcsZB7ZuDZkJGaVsjBA6h1d/gmWDfqw wgPo+KUp3H32d5Vf3ecBFtQYNNOuHQvbArHQBk7uAVTXwBXZY8H5Y+HVZPzGr+elMBX2 2IKUElxizse1rwlhiOaTLebVZNgRQoazd++uzg0JyF8mUdGPlqEi402mUz7bzXBYfsi7 /IHC1j+19+Xewh/l5eWuYOOAmEgO8YcnoskB+ijoN1QElu7uVaWgbGvl3B1NOSzhqFaM BMoJX7/EPAFTur3hk2JlL4WkRA+GwJ4pGRsb3hk58bJPV1tZYJpxQsOtvESZbwBG9MJk nUIg== X-Gm-Message-State: AOJu0YziUC4Qc4Jr0wy2IWJSyseCf7KEvzUmI+ByaNVR7PwI8/m+AU8E GDY0g8OzkI6x80uasyz5dwEIlQ== X-Received: by 2002:a17:907:cbc9:b0:a00:1c9a:a472 with SMTP id vk9-20020a170907cbc900b00a001c9aa472mr1438483ejc.7.1700641291154; Wed, 22 Nov 2023 00:21:31 -0800 (PST) Received: from [192.168.1.20] ([178.197.218.100]) by smtp.gmail.com with ESMTPSA id g1-20020a170906538100b009fef7d22c98sm3269289ejo.35.2023.11.22.00.21.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Nov 2023 00:21:30 -0800 (PST) Message-ID: <7232a48b-b9ad-44b5-ae6a-d12dad70b3c4@linaro.org> Date: Wed, 22 Nov 2023 09:21:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] docs: dt-bindings: add DTS Coding Style document Content-Language: en-US To: wens@kernel.org Cc: =?UTF-8?B?UmFmYcWCIE1pxYJlY2tp?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Andrew Davis , Arnd Bergmann , Bjorn Andersson , Geert Uytterhoeven , Heiko Stuebner , Konrad Dybcio , Michal Simek , Neil Armstrong , Nishanth Menon , Olof Johansson , linux-rockchip@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-msm@vger.kernel.org References: <20231120084044.23838-1-krzysztof.kozlowski@linaro.org> <6b288a2e-d147-4bd3-b1d4-daf56295d939@gmail.com> <01f9ce3b-e6e5-4b05-bf7f-0b3a5f74910a@linaro.org> From: Krzysztof Kozlowski Autocrypt: addr=krzysztof.kozlowski@linaro.org; keydata= xsFNBFVDQq4BEAC6KeLOfFsAvFMBsrCrJ2bCalhPv5+KQF2PS2+iwZI8BpRZoV+Bd5kWvN79 cFgcqTTuNHjAvxtUG8pQgGTHAObYs6xeYJtjUH0ZX6ndJ33FJYf5V3yXqqjcZ30FgHzJCFUu JMp7PSyMPzpUXfU12yfcRYVEMQrmplNZssmYhiTeVicuOOypWugZKVLGNm0IweVCaZ/DJDIH gNbpvVwjcKYrx85m9cBVEBUGaQP6AT7qlVCkrf50v8bofSIyVa2xmubbAwwFA1oxoOusjPIE J3iadrwpFvsZjF5uHAKS+7wHLoW9hVzOnLbX6ajk5Hf8Pb1m+VH/E8bPBNNYKkfTtypTDUCj NYcd27tjnXfG+SDs/EXNUAIRefCyvaRG7oRYF3Ec+2RgQDRnmmjCjoQNbFrJvJkFHlPeHaeS BosGY+XWKydnmsfY7SSnjAzLUGAFhLd/XDVpb1Een2XucPpKvt9ORF+48gy12FA5GduRLhQU vK4tU7ojoem/G23PcowM1CwPurC8sAVsQb9KmwTGh7rVz3ks3w/zfGBy3+WmLg++C2Wct6nM Pd8/6CBVjEWqD06/RjI2AnjIq5fSEH/BIfXXfC68nMp9BZoy3So4ZsbOlBmtAPvMYX6U8VwD TNeBxJu5Ex0Izf1NV9CzC3nNaFUYOY8KfN01X5SExAoVTr09ewARAQABzTRLcnp5c3p0b2Yg S296bG93c2tpIDxrcnp5c3p0b2Yua296bG93c2tpQGxpbmFyby5vcmc+wsGUBBMBCgA+FiEE m9B+DgxR+NWWd7dUG5NDfTtBYpsFAmI+BxMCGwM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bblD8ZLkz1EVZL6djImH5zc5x8qpVxlA0A0i23v5QvN00m6G9NFF0Le D2GYIS41Kv4Isx2dEFh+/Q== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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: 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]); Wed, 22 Nov 2023 00:21:50 -0800 (PST) On 22/11/2023 09:09, Chen-Yu Tsai wrote: > On Wed, Nov 22, 2023 at 4:05 PM Krzysztof Kozlowski > wrote: >> >> On 21/11/2023 14:50, Rafał Miłecki wrote: >>>> +Order of Nodes >>>> +-------------- >>>> + >>>> +1. Nodes within any bus, thus using unit addresses for children, shall be >>>> + ordered incrementally by unit address. >>>> + Alternatively for some sub-architectures, nodes of the same type can be >>>> + grouped together (e.g. all I2C controllers one after another even if this >>>> + breaks unit address ordering). >>>> + >>>> +2. Nodes without unit addresses should be ordered alpha-numerically by the node >>>> + name. For a few types of nodes, they can be ordered by the main property >>>> + (e.g. pin configuration states ordered by value of "pins" property). >>>> + >>>> +3. When extending nodes in the board DTS via &label, the entries should be >>>> + ordered alpha-numerically. >>> >>> Just an idea. Would that make (more) sense to make &label-like entries >>> match order of nodes in included .dts(i)? >>> >>> Adventages: >>> 1. We keep unit address incremental order that is unlikely to change >>> >>> Disadventages: >>> 1. More difficult to verify >> >> Rob also proposed this and I believe above disadvantage here is crucial. >> If you add new SoC with board DTS you are fine. But if you add only new >> board, the order of entries look random in the diff hunk. Reviewer must >> open SoC DTSI to be able to review the patch with board DTS. >> >> If review is tricky and we do not have tool to perform it automatically, >> I am sure submissions will have disordered board DTS. >> >>> >>> >>>> +Example:: >>>> + >>>> + // SoC DTSI >>>> + >>>> + / { >>>> + cpus { >>>> + // ... >>>> + }; >>>> + >>>> + psci { >>>> + // ... >>>> + }; >>>> + >>>> + soc@ { >>>> + dma: dma-controller@10000 { >>>> + // ... >>>> + }; >>>> + >>>> + clk: clock-controller@80000 { >>>> + // ... >>>> + }; >>>> + }; >>>> + }; >>>> + >>>> + // Board DTS >>>> + >>>> + &clk { >>>> + // ... >>>> + }; >>>> + >>>> + &dma { >>>> + // ... >>>> + }; >>>> + >>>> + >>>> +Order of Properties in Device Node >>>> +---------------------------------- >>>> + >>>> +Following order of properties in device nodes is preferred: >>>> + >>>> +1. compatible >>>> +2. reg >>>> +3. ranges >>>> +4. Standard/common properties (defined by common bindings, e.g. without >>>> + vendor-prefixes) >>>> +5. Vendor-specific properties >>>> +6. status (if applicable) >>>> +7. Child nodes, where each node is preceded with a blank line >>>> + >>>> +The "status" property is by default "okay", thus it can be omitted. >>> >>> I think it would really help to include position of #address-cells and >>> #size-cells here. In some files I saw them above "compatible" that seems >>> unintuitive. Some prefer putting them at end which I think makes sense >>> as they affect children nodes. >>> >>> Whatever you choose it'd be just nice to have things consistent. >> >> This is a standard/common property, thus it goes to (4) above. > > It's probably a mix, but AFAIK a lot of the device trees in tree have > #*-cells after "status". In some cases they are added in the board > .dts files, not the chip/module .dtsi files. Existing DTS is not a good example :) > > +1 that it makes sense at the end as they affect child nodes. I still insist that status must be the last, because: 1. Many SoC nodes have address/size cells but do not have any children (I2C, SPI), so we put useless information at the end. 2. Status should be the final information to say whether the node is ready or is not. I read the node, check properties and then look at the end: a. Lack of status means it is ready. b. status=disabled means device still needs board resources/customization Best regards, Krzysztof