linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Rob Herring <robh@kernel.org>
Cc: Serge Semin <fancer.lancer@gmail.com>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Johan Hovold <johan@kernel.org>,
	Maxime Ripard <mripard@kernel.org>,
	Joao Pinto <jpinto@synopsys.com>, Lars Persson <larper@axis.com>,
	Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
	Pavel Parkhomenko <Pavel.Parkhomenko@baikalelectronics.ru>,
	Vyacheslav Mitrofanov 
	<Vyacheslav.Mitrofanov@baikalelectronics.ru>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	netdev <netdev@vger.kernel.org>,
	"moderated list:ARM/STM32 ARCHITECTURE" 
	<linux-stm32@st-md-mailman.stormreply.com>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	<devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 04/25] dt-bindings: net: dwmac: Refactor snps,*-config properties
Date: Wed, 16 Dec 2020 09:24:58 +0300	[thread overview]
Message-ID: <20201216062458.7oiccf6fc5lvabdc@mobilestation> (raw)
In-Reply-To: <CAL_JsqK2LLGMmVMrmgK-SidhVQ0y=d-6VvrXcuK_FHmQ2ijmjg@mail.gmail.com>

On Tue, Dec 15, 2020 at 08:08:35AM -0600, Rob Herring wrote:
> On Tue, Dec 15, 2020 at 2:54 AM Serge Semin
> <Sergey.Semin@baikalelectronics.ru> wrote:
> >
> > Hello Rob,
> >
> > On Mon, Dec 14, 2020 at 08:30:06AM -0600, Rob Herring wrote:
> > > On Mon, Dec 14, 2020 at 12:15:54PM +0300, Serge Semin wrote:
> > > > Currently the "snps,axi-config", "snps,mtl-rx-config" and
> > > > "snps,mtl-tx-config" properties are declared as a single phandle reference
> > > > to a node with corresponding parameters defined. That's not good for
> > > > several reasons. First of all scattering around a device tree some
> > > > particular device-specific configs with no visual relation to that device
> > > > isn't suitable from maintainability point of view. That leads to a
> > > > disturbed representation of the actual device tree mixing actual device
> > > > nodes and some vendor-specific configs. Secondly using the same configs
> > > > set for several device nodes doesn't represent well the devices structure,
> > > > since the interfaces these configs describe in hardware belong to
> > > > different devices and may actually differ. In the later case having the
> > > > configs node separated from the corresponding device nodes gets to be
> > > > even unjustified.
> > > >
> > > > So instead of having a separate DW *MAC configs nodes we suggest to
> > > > define them as sub-nodes of the device nodes, which interfaces they
> > > > actually describe. By doing so we'll make the DW *MAC nodes visually
> > > > correct describing all the aspects of the IP-core configuration. Thus
> > > > we'll be able to describe the configs sub-nodes bindings right in the
> > > > snps,dwmac.yaml file.
> > > >
> > > > Note the former "snps,axi-config", "snps,mtl-rx-config" and
> > > > "snps,mtl-tx-config" bindings have been marked as deprecated.
> > > >
> > > > Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> > > >
> > > > ---
> > > >
> > > > Note the current DT schema tool requires the vendor-specific properties to be
> > > > defined in accordance with the schema: dtschema/meta-schemas/vendor-props.yaml
> > > > It means the property can be;
> > > > - boolean,
> > > > - string,
> > > > - defined with $ref and additional constraints,
> > > > - defined with allOf: [ $ref ] and additional constraints.
> > > >
> > > > The modification provided by this commit needs to extend that definition to
> > > > make the DT schema tool correctly parse this schema. That is we need to let
> > > > the vendors-specific properties to also accept the oneOf-based combined
> > > > sub-schema. Like this:
> > > >
> > > > --- a/dtschema/meta-schemas/vendor-props.yaml
> > > > +++ b/dtschema/meta-schemas/vendor-props.yaml
> > > > @@ -48,15 +48,24 @@
> > > >        - properties:   # A property with a type and additional constraints
> > > >            $ref:
> > > >              pattern: "types.yaml#[\/]{0,1}definitions\/.*"
> > > > -          allOf:
> > > > -            items:
> > > > -              - properties:
> > > > +
> > > > +        if:
> > > > +          not:
> > > > +            required:
> > > > +              - $ref
> > > > +        then:
> > > > +          patternProperties:
> > > > +            "^(all|one)Of$":
> > > > +              contains:
> > > > +                properties:
> > > >                    $ref:
> > > >                      pattern: "types.yaml#[\/]{0,1}definitions\/.*"
> > > >                  required:
> > > >                    - $ref
> > > > -        oneOf:
> > > > +
> > > > +        anyOf:
> > > >            - required: [ $ref ]
> > > >            - required: [ allOf ]
> > > > +          - required: [ oneOf ]
> > > >
> > > >  ...
> > > > ---
> > > >  .../devicetree/bindings/net/snps,dwmac.yaml   | 380 +++++++++++++-----
> > > >  1 file changed, 288 insertions(+), 92 deletions(-)
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > > > index 0dd543c6c08e..44aa88151cba 100644
> > > > --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > > > +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml
> > > > @@ -150,69 +150,251 @@ properties:
> > > >        in a different mode than the PHY in order to function.
> > > >
> > > >    snps,axi-config:
> > > > -    $ref: /schemas/types.yaml#definitions/phandle
> > > > -    description:
> > > > -      AXI BUS Mode parameters. Phandle to a node that can contain the
> > > > -      following properties
> > > > -        * snps,lpi_en, enable Low Power Interface
> > > > -        * snps,xit_frm, unlock on WoL
> > > > -        * snps,wr_osr_lmt, max write outstanding req. limit
> > > > -        * snps,rd_osr_lmt, max read outstanding req. limit
> > > > -        * snps,kbbe, do not cross 1KiB boundary.
> > > > -        * snps,blen, this is a vector of supported burst length.
> > > > -        * snps,fb, fixed-burst
> > > > -        * snps,mb, mixed-burst
> > > > -        * snps,rb, rebuild INCRx Burst
> > > > +    description: AXI BUS Mode parameters
> > > > +    oneOf:
> > > > +      - deprecated: true
> > > > +        $ref: /schemas/types.yaml#definitions/phandle
> > > > +      - type: object
> > > > +        properties:
> > >
> >
> > > Anywhere have have the same node/property string meaning 2 different
> > > things is a pain, let's not create another one.
> >
> > IIUC you meant that having a node and property with the same name
> > isn't ok. Right? If so could you explain why not? especially seeing
> > the property is expected to be set with phandle reference to that
> > node. That seemed like a perfect solution to me. We wouldn't need to
> > introduce a new property/node name, but just deprecate the
> > corresponding name to be a property.
> 

> Right. It's also a property or node name having 2 different meanings.
> I think your schema above demonstrates the problem in that it
> unnecessarily complicates the schema. It's not such a problem here as
> it is self contained. The worst example is 'ports'. That's a container
> of graph port nodes, ethernet switch nodes or a property pointing to
> DRM graphics pipelines. If there's multiple meanings, then we can't
> apply a schema unconditionally. Or we can only check it matches one of
> the 3 definitions.

It turned out in case of this change having different meaning also luckily
fit with having different types (property vs node). Right, as you called
it's self contained. But in general, of course, having different meaning
of the same node indeed may cause problems with different schema validation.
So ok. Thanks for clarification. I'll just introduce a new sub-node with
the same name but no vendor-prefix.

> 
> > > Just define a new node
> > > 'axi-config'. Or just put all the properties into the node directly.
> > > Grouping them has little purpose.
> >
> > Hm, you suggest to remove the vendor prefix, right?
> 

> Yes, we don't do vendor prefixes on node names either.

Ok.

> 
> > If so what about
> > the rest of the changes introduced here in this patch? They concern
> > "snps,mtl-tx-config" and "snps,mtl-rx-config" properties (please note
> > these changes are a bit more complicated than once connected with
> > "snps,axi-config"). Should I remove the vendor-prefix from them too?
> 

> Yes.

Ok.

-Sergey

> 
> > Anyway that seems a bit questionable, because all the "snps,*-config"
> > properties/nodes seems more vendor-specific than generic. Am I wrong
> > in that matter?
> >
> > If you think they are generic, then the "{axi,mtl-rx,mtl-tx}-config"
> > nodes most likely should be described in the dedicated DT schema...
> >
> > -Sergey
> >

  reply	other threads:[~2020-12-16  6:25 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-14  9:15 [PATCH 00/25] net: stmmac: Fix clocks/reset-related procedures Serge Semin
2020-12-14  9:15 ` [PATCH 01/25] dt-bindings: net: dwmac: Validate PBL for all IP-cores Serge Semin
2020-12-15 17:14   ` Rob Herring
2020-12-14  9:15 ` [PATCH 02/25] dt-bindings: net: dwmac: Extend number of PBL values Serge Semin
2020-12-15 17:14   ` Rob Herring
2020-12-14  9:15 ` [PATCH 03/25] dt-bindings: net: dwmac: Fix the TSO property declaration Serge Semin
2020-12-15 17:22   ` Rob Herring
2020-12-16  8:59     ` Serge Semin
2020-12-14  9:15 ` [PATCH 04/25] dt-bindings: net: dwmac: Refactor snps,*-config properties Serge Semin
2020-12-14 14:30   ` Rob Herring
2020-12-15  8:54     ` Serge Semin
2020-12-15 14:08       ` Rob Herring
2020-12-16  6:24         ` Serge Semin [this message]
2020-12-14  9:15 ` [PATCH 05/25] dt-bindings: net: dwmac: Elaborate stmmaceth/pclk description Serge Semin
2020-12-15 17:30   ` Rob Herring
2020-12-14  9:15 ` [PATCH 06/25] dt-bindings: net: dwmac: Add Tx/Rx clock sources Serge Semin
2020-12-15 17:32   ` Rob Herring
2020-12-16  6:02     ` Serge Semin
2020-12-15 17:32   ` Rob Herring
2020-12-14  9:15 ` [PATCH 07/25] dt-bindings: net: dwmac: Detach Generic DW MAC bindings Serge Semin
2020-12-15 17:50   ` Rob Herring
2020-12-16  9:10     ` Serge Semin
2020-12-14  9:15 ` [PATCH 08/25] net: stmmac: Add snps,*-config sub-nodes support Serge Semin
2020-12-14  9:15 ` [PATCH 09/25] net: stmmac: dwmac-rk: Cleanup STMMAC DT-config in remove cb Serge Semin
2020-12-14  9:16 ` [PATCH 10/25] net: stmmac: dwmac-sti: " Serge Semin
2020-12-14  9:16 ` [PATCH 11/25] net: stmmac: dwmac-stm32: " Serge Semin
2020-12-14  9:16 ` [PATCH 12/25] net: stmmac: Directly call reverse methods in stmmac_probe_config_dt() Serge Semin
2020-12-14  9:16 ` [PATCH 13/25] net: stmmac: Fix clocks left enabled on glue-probes failure Serge Semin
2020-12-14  9:16 ` [PATCH 14/25] net: stmmac: Use optional clock request method to get stmmaceth Serge Semin
2020-12-14  9:16 ` [PATCH 15/25] net: stmmac: Use optional clock request method to get pclk Serge Semin
2020-12-14  9:16 ` [PATCH 16/25] net: stmmac: Use optional clock request method to get ptp_clk Serge Semin
2020-12-14  9:16 ` [PATCH 17/25] net: stmmac: Use optional reset control API to work with stmmaceth Serge Semin
2020-12-14  9:16 ` [PATCH 18/25] net: stmmac: dwc-qos: Cleanup STMMAC platform data clock pointers Serge Semin
2020-12-14  9:16 ` [PATCH 19/25] net: stmmac: dwc-qos: Use dev_err_probe() for probe errors handling Serge Semin
2020-12-14  9:16 ` [PATCH 20/25] net: stmmac: Add Tx/Rx platform clocks support Serge Semin
2020-12-14  9:16 ` [PATCH 21/25] net: stmmac: dwc-qos: Discard Tx/Rx clocks request Serge Semin
2020-12-14  9:16 ` [PATCH 22/25] net: stmmac: dwmac-imx: Discard Tx clock request Serge Semin
2020-12-14  9:16 ` [PATCH 23/25] net: stmmac: Call stmmaceth clock as system clock in warn-message Serge Semin
2020-12-14  9:16 ` [PATCH 24/25] net: stmmac: Use pclk to set MDC clock frequency Serge Semin
2020-12-14  9:16 ` [PATCH 25/25] net: stmmac: dwc-qos: Save master/slave clocks in the plat-data Serge Semin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201216062458.7oiccf6fc5lvabdc@mobilestation \
    --to=sergey.semin@baikalelectronics.ru \
    --cc=Alexey.Malahov@baikalelectronics.ru \
    --cc=Pavel.Parkhomenko@baikalelectronics.ru \
    --cc=Vyacheslav.Mitrofanov@baikalelectronics.ru \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=joabreu@synopsys.com \
    --cc=johan@kernel.org \
    --cc=jpinto@synopsys.com \
    --cc=kuba@kernel.org \
    --cc=larper@axis.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mripard@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).