Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp22919iob; Tue, 3 May 2022 10:49:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIs1GEwyWrROVg8BO24bMc/19VaObt6mJyLLcGHNH9bMfEcPLOPDYIXUgjOlOThOXXgBqa X-Received: by 2002:a17:903:1105:b0:156:3e9d:bb7b with SMTP id n5-20020a170903110500b001563e9dbb7bmr17266958plh.136.1651600147895; Tue, 03 May 2022 10:49:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651600147; cv=none; d=google.com; s=arc-20160816; b=ScJXGl4wW99+m5G85mDiTUJM42+NRwSwQW8rnerlIls3J0PWyA06ulk6/cj26jmnNf CmS7AY8koP3C2Ws9pasAADgRtLjadAqYdOY7NoSoaORA6Lgq7BihcHB1328atykdMy40 lRUMRsHXUbOAhGVH9/qa6d5zYlLGIK396BozXenZZyrABIw+YiI/SmjohBi0+XLTEfXc vFvzz6fqOAQHsv91N+bNhwCBd03+RtVZWnZ5AJSaSgogSSIQywOKD0lVsrBznuJuKwlH 5ptaka350TybvkCXEUrajLkZP5LUlI371lJIcqRUfva0V4cTGykLMb+pCia7wMD+JVBd YUGw== 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=T7KD58LLGLoFWa1xXxvp0DQeF4I0gKOPKSSTJE1ESIQ=; b=tzqdHic0M+OfiEsI+4i6llN7be9Iyvc/eO3q0qIBoHhO+lbKnYbOtS2vCUcPNN/F1d ElmnOECPXT2llIMVAYfBqt9NLg+SC0muOxRhnHx2q9gBTAzTBnvsJewfwwaKs7nbAHV2 XfCRj3dPyjTQCIyJhRFWTeWdAMzcBYViy+3HQDZ9VeaovvkoSJtzHZsF6Bw7EJNxz9M2 0bpdrM2mTbq+4Ztqtgtjk2tJ75k50cTo89YzdkwKyPZREjRzJGFl4CYPtvcQPVTv0JII 1EGFcbRyBRg1/pwqqIHl0u9ZNHO2Tkvr6BiwFWEpbk+vloMk4F+NdZpEeoqY4yxguYL/ zzFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r2joUbDn; 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 w9-20020a170902c78900b0015bd2c5232esi15322880pla.568.2022.05.03.10.48.42; Tue, 03 May 2022 10:49:07 -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=r2joUbDn; 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 S236325AbiECOoF (ORCPT + 99 others); Tue, 3 May 2022 10:44:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237204AbiECOoC (ORCPT ); Tue, 3 May 2022 10:44:02 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 419A32F027 for ; Tue, 3 May 2022 07:40:28 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id n10so16455350ejk.5 for ; Tue, 03 May 2022 07:40:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=T7KD58LLGLoFWa1xXxvp0DQeF4I0gKOPKSSTJE1ESIQ=; b=r2joUbDnOfo04iaxwxKpn34xLPcue03BKA2xcR5i6N7cXrYk8Rp+cHm+ylEj63RZ7g YpFFjyP8UeUmqalv1YTMVlSARi5ZFXr9TbF8X8oeR0NBj4Hhs7smfuO81RHuPMnIXYRf zKzq7mrmCVczsefNa6APBEA52mivnPWENS3N5kqDum5p4JCY0nXPDiIUyRzJmYBZXmz6 LgCZg2m2o2Gg0SRfSigRTbB2pz5oIU3B5PJ/Tu7u7xq1VjIuTRsSjz6VN4cfe3n6X4lg n9DQ1KzazDTcWYkcmCGvMi0FDb1ckLs3KarUQu2Mo0tpSTajVmZuZtMF8kPXPulH/cXC aTkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=T7KD58LLGLoFWa1xXxvp0DQeF4I0gKOPKSSTJE1ESIQ=; b=ioUfjLt5OjFdE+kkmb2OawLi4mEvR/n7yld0IGBJEyRCA7isbSORktwccJ5prlVPQ4 B2GUb42sV3RLG9ioiym4hIGE4c1n7V+C9pljD14sEwusjXKykh4WnIyQkn2lwnCMEtNu isj9zS0bjH5737O83kyE3wXNBl+kp82idR1QwckgOF9UTjI6kml7XIFZbe9vCNHLTJQq Sol+SeoddYpzl8q39cMMVGaD+4szPk9tVDW8iuuVlirQesJxCGl8ugY+cpbGX8IKaX3m fAiAwip8YfJnOd40uciWOfd4/ljOzrgDUPeKey/UkbDr33h9UX8BWyJ56BJYwLOBBxDF xYWg== X-Gm-Message-State: AOAM530KTzR5+8G8AUByF/LIXgx0Yw+Pq4M1rVD9uYXiMpu9a5m4O0cz 6FZfyk6QbpK3OKT4m4m3ZrRUwQ== X-Received: by 2002:a17:907:1c0f:b0:6f3:edd8:85d5 with SMTP id nc15-20020a1709071c0f00b006f3edd885d5mr15468515ejc.397.1651588826696; Tue, 03 May 2022 07:40:26 -0700 (PDT) Received: from [192.168.0.203] (xdsl-188-155-176-92.adslplus.ch. [188.155.176.92]) by smtp.gmail.com with ESMTPSA id gz19-20020a170907a05300b006f3ef214ddasm4612992ejc.64.2022.05.03.07.40.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 May 2022 07:40:26 -0700 (PDT) Message-ID: <10770ff5-c9b1-7364-4276-05fa0c393d3b@linaro.org> Date: Tue, 3 May 2022 16:40:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: Aw: Re: [RFC v1] dt-bindings: net: dsa: convert binding for mediatek switches Content-Language: en-US To: Frank Wunderlich , Greg Ungerer , =?UTF-8?Q?Ren=c3=a9_van_Dorst?= , Mauro Carvalho Chehab Cc: Frank Wunderlich , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Matthias Brugger , Sean Wang , Landen Chao , DENG Qingfang , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20220502153238.85090-1-linux@fw-web.de> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 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 03/05/2022 16:10, Frank Wunderlich wrote: > Hi, > > thank you for first review. > >> Gesendet: Dienstag, 03. Mai 2022 um 14:05 Uhr >> Von: "Krzysztof Kozlowski" >> Betreff: Re: [RFC v1] dt-bindings: net: dsa: convert binding for mediatek switches >> >> On 02/05/2022 17:32, Frank Wunderlich wrote: >>> From: Frank Wunderlich >>> >>> Convert txt binding to yaml binding for Mediatek switches. >>> >>> Signed-off-by: Frank Wunderlich >>> --- >>> .../devicetree/bindings/net/dsa/mediatek.yaml | 435 ++++++++++++++++++ >>> .../devicetree/bindings/net/dsa/mt7530.txt | 327 ------------- >>> 2 files changed, 435 insertions(+), 327 deletions(-) >>> create mode 100644 Documentation/devicetree/bindings/net/dsa/mediatek.yaml >>> delete mode 100644 Documentation/devicetree/bindings/net/dsa/mt7530.txt >>> >>> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek.yaml >>> new file mode 100644 >>> index 000000000000..c1724809d34e >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek.yaml >> >> Specific name please, so previous (with vendor prefix) was better: >> mediatek,mt7530.yaml > > ok, named it mediatek only because mt7530 is only one possible chip and driver handles 3 different "variants". > >>> @@ -0,0 +1,435 @@ >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> >> You should CC previous contributors and get their acks on this. You >> copied here a lot of description. > > added 3 Persons that made commits to txt before to let them know about this change > > and yes, i tried to define at least the phy-mode requirement as yaml-depency, but failed because i cannot match > compatible in subnode. I don't remember such syntax. (...) > >>> if defined, indicates that either MT7530 is the part >>> + on multi-chip module belong to MT7623A has or the remotely standalone >>> + chip as the function MT7623N reference board provided for. >>> + >>> + reset-gpios: >>> + description: | >>> + Should be a gpio specifier for a reset line. >>> + maxItems: 1 >>> + >>> + reset-names: >>> + description: | >>> + Should be set to "mcm". >>> + const: mcm >>> + >>> + resets: >>> + description: | >>> + Phandle pointing to the system reset controller with >>> + line index for the ethsys. >>> + maxItems: 1 >>> + >>> +required: >>> + - compatible >>> + - reg >> >> What about address/size cells? > > you're right even if they are const to a value they need to be set > >>> + >>> +allOf: >>> + - $ref: "dsa.yaml#" >>> + - if: >>> + required: >>> + - mediatek,mcm >> >> Original bindings had this reversed. > > i know, but i think it is better readable and i will drop the else-part later. > Driver supports optional reset ("mediatek,mcm" unset and without reset-gpios) > as this is needed if there is a shared reset-line for gmac and switch like on R2 Pro. > > i left this as separate commit to be posted later to have a nearly 1:1 conversion here. Ah, I missed that actually your syntax is better. No need to reverse/negate and the changes do not have to be strict 1:1. > >>> + then: >>> + required: >>> + - resets >>> + - reset-names >>> + else: >>> + required: >>> + - reset-gpios >>> + >>> + - if: >>> + required: >>> + - interrupt-controller >>> + then: >>> + required: >>> + - "#interrupt-cells" >> >> This should come from dt schema already... > > so i should drop (complete block for interrupt controller)? The interrupts you need. What I mean, you can skip requirement of cells. > >>> + - interrupts >>> + >>> + - if: >>> + properties: >>> + compatible: >>> + items: >>> + - const: mediatek,mt7530 >>> + then: >>> + required: >>> + - core-supply >>> + - io-supply >>> + >>> + >>> +patternProperties: >>> + "^ports$": >> >> It''s not a pattern, so put it under properties, like regular property. > > can i then make the subnodes match? so the full block will move above required between "mediatek,mcm" and "reset-gpios" Yes, subnodes stay with patternProperties. > > ports: > type: object > > patternProperties: > "^port@[0-9]+$": > type: object > description: Ethernet switch ports > > properties: > reg: > description: | > Port address described must be 5 or 6 for CPU port and from 0 to 5 for user ports. > > unevaluatedProperties: false > > allOf: > - $ref: dsa-port.yaml# > - if: > .... > > basicly this "ports"-property should be required too, right? Previous binding did not enforce it, I think, but it is reasonable to require ports. > > >>> + type: object >>> + >>> + patternProperties: >>> + "^port@[0-9]+$": >>> + type: object >>> + description: Ethernet switch ports >>> + >>> + $ref: dsa-port.yaml# >> >> This should go to allOf below. > > see above > >>> + >>> + properties: >>> + reg: >>> + description: | >>> + Port address described must be 6 for CPU port and from 0 to 5 for user ports. >>> + >>> + unevaluatedProperties: false >>> + >>> + allOf: >>> + - if: >>> + properties: >>> + label: >>> + items: >>> + - const: cpu >>> + then: >>> + required: >>> + - reg >>> + - phy-mode >>> + >>> +unevaluatedProperties: false >>> + >>> +examples: >>> + - | >>> + mdio0 { >> >> Just mdio > > ok > >>> + #address-cells = <1>; >>> + #size-cells = <0>; >>> + switch@0 { >>> + compatible = "mediatek,mt7530"; >>> + #address-cells = <1>; >>> + #size-cells = <0>; >>> + reg = <0>; >>> + >>> + core-supply = <&mt6323_vpa_reg>; >>> + io-supply = <&mt6323_vemc3v3_reg>; >>> + reset-gpios = <&pio 33 0>; >> >> Use GPIO flag define/constant. > > this example seems to be taken from bpi-r2 (i had taken it from the txt). In dts for this board there are no > constants too. > > i guess > include/dt-bindings/gpio/gpio.h:14:#define GPIO_ACTIVE_HIGH 0 > > for 33 there seem no constant..all other references to pio node are with numbers too and there seem no binding > header defining the gpio pins (only functions in include/dt-bindings/pinctrl/mt7623-pinfunc.h) ok, then my comment Best regards, Krzysztof