devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sam Edwards <cfsworks@gmail.com>
To: Rob Herring <robh@kernel.org>
Cc: "Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Rafał Miłecki" <rafal@milecki.pl>,
	"William Zhang" <william.zhang@broadcom.com>,
	"Anand Gore" <anand.gore@broadcom.com>,
	"Kursad Oney" <kursad.oney@broadcom.com>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] dt-bindings: mtd: Relax BCM4908 partition schema
Date: Wed, 9 Oct 2024 20:37:29 -0700	[thread overview]
Message-ID: <CAH5Ym4iASexWJat4zhOpAFhwmWWFpZeioFACjY86KA7D3FB5=g@mail.gmail.com> (raw)
In-Reply-To: <20241010023844.GA968160-robh@kernel.org>

On Wed, Oct 9, 2024 at 7:38 PM Rob Herring <robh@kernel.org> wrote:
>
> On Wed, Oct 09, 2024 at 02:50:44PM -0700, Sam Edwards wrote:
> > The BCM4908 partition "parser" is really just a fixed partitions table,
> > with a special partition compatible (`brcm,bcm4908-firmware`) that
> > automatically labels the partition as "firmware" or "backup" depending
> > on what CFE is communicating as the selected active partition.
> >
> > The bcm4908-partitions schema is currently too restrictive, requiring
> > that all child nodes use this special compatible or none at all. This
> > not only contracits what is allowed by the "parser" but also causes
> > warnings for an existing file ("bcm4908-asus-gt-ac5300.dts").
> >
> > Modify the schema to be strict only for child partitions that use the
> > -firmware compatible. Also update the child name regex to agree with
> > fixed-partitions, so that these differences apply consistently.
> >
> > Signed-off-by: Sam Edwards <CFSworks@gmail.com>
> > ---
> >  .../mtd/partitions/brcm,bcm4908-partitions.yaml | 17 +++++++++++------
> >  1 file changed, 11 insertions(+), 6 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
> > index 94f0742b375c..aed37922a5fc 100644
> > --- a/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
> > +++ b/Documentation/devicetree/bindings/mtd/partitions/brcm,bcm4908-partitions.yaml
> > @@ -30,12 +30,17 @@ properties:
> >      enum: [ 1, 2 ]
> >
> >  patternProperties:
> > -  "^partition@[0-9a-f]+$":
> > -    $ref: partition.yaml#
> > -    properties:
> > -      compatible:
> > -        const: brcm,bcm4908-firmware
> > -    unevaluatedProperties: false
> > +  "^partition(-.+|@[0-9a-f]+)$":
> > +    type: object
> > +    if:
> > +      properties:
> > +        compatible:
> > +          const: brcm,bcm4908-firmware

Hi Rob,

Thanks for your attention on this one! This is an odd case where I'm
not sure what else could be done, and I'm a newbie to modifying DT
schemata, so I'm glad to be receiving your feedback. :)

> What schema applies to the node if this is not true? That needs to be
> addressed. You should be able to use oneOf here rather than if/then
> schema.

The schema that should apply "in general" is partition.yaml, though
moving the '$ref:' outside of 'then:' made the 'unevaluatedProperties:
false' disallow everything. The if block here is just trying to
memorialize bcm4908-firmware as a valid compatible at this level, and
(ideally) disallow unevaluated properties if so.

Could that be done with a oneOf? I would think if one of the arms of
the oneOf was "unmodified $partition.yaml, unevaluated allowed" it
would always match, rendering the "unevaluated disallowed when
compatible=bcm4908-firmware" arm unused.

Best,
Sam

>
> > +    then:
> > +      $ref: partition.yaml#
> > +      properties:
> > +        compatible: true
> > +      unevaluatedProperties: false
> >
> >  required:
> >    - "#address-cells"
> > --
> > 2.44.2
> >

  reply	other threads:[~2024-10-10  3:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09 21:50 [PATCH 0/3] Resolve BCMBCA DT validation errors Sam Edwards
2024-10-09 21:50 ` [PATCH 1/3] dt-bindings: mtd: Relax BCM4908 partition schema Sam Edwards
2024-10-10  2:06   ` Rob Herring (Arm)
2024-10-10  2:38   ` Rob Herring
2024-10-10  3:37     ` Sam Edwards [this message]
2024-10-09 21:50 ` [PATCH 2/3] arm64: dts: broadcom: bcmbca: bcm4908: Fix Asus GT-AC5300's cferom partition Sam Edwards
2024-10-09 21:50 ` [PATCH 3/3] arm64: dts: broadcom: bcmbca: bcm4908: Fix Netgear R8000P partitioning Sam Edwards

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='CAH5Ym4iASexWJat4zhOpAFhwmWWFpZeioFACjY86KA7D3FB5=g@mail.gmail.com' \
    --to=cfsworks@gmail.com \
    --cc=anand.gore@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=krzk+dt@kernel.org \
    --cc=kursad.oney@broadcom.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafal@milecki.pl \
    --cc=robh@kernel.org \
    --cc=william.zhang@broadcom.com \
    /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).