Re: [PATCH v3 1/6] dt-bindings: PCI: dwc: rockchip: Add mandatory atu reg

Niklas Cassel
2023-10-28T12:11:09Z

On Fri, Oct 27, 2023 at 12:03:15PM -0500, Rob Herring wrote:
> On Fri, Oct 27, 2023 at 11:15 AM Niklas Cassel <Niklas.Cassel@wdc.com> wrote:
> >
> > Hello Rob,
> >
> > On Fri, Oct 27, 2023 at 10:58:28AM -0500, Rob Herring wrote:
> > > On Fri, Oct 27, 2023 at 9:56 AM Niklas Cassel <nks@flawful.org> wrote:
> > > >
> > > > From: Niklas Cassel <niklas.cassel@wdc.com>
> > > >
> > > > Even though rockchip-dw-pcie.yaml inherits snps,dw-pcie.yaml
> > > > using:
> > > >
> > > > allOf:
> > > > - $ref: /schemas/pci/snps,dw-pcie.yaml#
> > > >
> > > > and snps,dw-pcie.yaml does have the atu reg defined, in order to be
> > > > able to use this reg, while still making sure 'make CHECK_DTBS=y'
> > > > pass, we need to add this reg to rockchip-dw-pcie.yaml.
> > > >
> > > > All compatible strings (rockchip,rk3568-pcie and rockchip,rk3588-pcie)
> > > > should have this reg.
> > > >
> > > > The regs in the example are updated to actually match pcie3x2 on rk3568.
> > >
> > > Breaking compatibility on these platforms is okay because ...?
> >
> > I don't follow, could you please elaborate?
>
> A DT which was valid without 'atu' region is now not valid with this
> change. If I'm reading this schema with the change, then not having
> 'atu' is an error and the OS can treat it as an error. If it does,
> then it wouldn't work with existing DTs. You cannot add new required
> properties or required entries.
>
> If you can say no users of the affected platforms care (e.g. only you
> have a board) or the binding is not yet in use, then it's fine. But
> you have to state that justification. I suspect that is not the case
> here.

FWIW, I had "atu" as optional in v2 of this series.

Since I made the effort in v3 to add "atu" to all the existing users of the
rockchip binding, I thought that marking it required in the rockchip binding
would help ensure that any future rockchip platform does not forget to add
"atu".

I know that DT has to be backwards compatible, but the device driver works
fine with a DT that lacks "atu" (even though you will not be able to detect
all iATUs), so an old DT would still work.

But yes, running make CHECK_DTBS=y with the new binding, would not pass for
an old DT.

I get your point, you can never add a required property or entries to an
existing compatible (this is in use).

If we look at snps,dw-pcie.yaml, "atu" is optional, so that correlates to
the device driver being able to work without "atu" specified.

Since the rockchip driver doesn't get "atu" itself, but relies on the common
code to get it, it should obviously be optional also for the rockchip binding.

I guess my problem is that I just want to inherit the entry from the common
binding...

Is there no DT keyword to extend an existing binding, so that you inherit all
the properties/entries from that common binding, while still allowing you to
define (or overload) additional properties/entries?

Even if there is no way to inherit all properties/entries from a common binding,
it would be nice to be able to inherit a specific property/entry using a
"inherit" keyword, such that you get the same definition (optional/required) as
the parent binding.

Kind regards,
Niklas