Some questions about DT-schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[Q1] Order of reset-names, clock-names, etc.

I have nodes that describe multiple reset lines:

It looks like this:

    reset-names = "host", "bridge";
    resets = <&rst 0>, <&rst 1>;


I looks into some existing schema files
to figure out how to describe this.

We typically do this.

reset-names:
  - items:
    - const: host
    - const: bridge


Since 'items' checks each item against the corresponding index,
it is order-sensitive.


So, the following DT passes the schema.

    reset-names = "host", "bridge";
    resets = <&rst 0>, <&rst 1>;


However, the following DT fails in the schema checking.

    reset-names = "bridge", "host";
    resets = <&rst 1>, <&rst 0>;

The latter is as correct as the former,
and should work equivalently.

If we are always required to write the "host", "bridge", in this order,
there is no point of 'reset-names'.
So, this is a restriction we should not impose.


So, if we want to accept both cases,
we need to write like this:

reset-names:
  - oneOf:
    - items:
      - const: host
      - const: bridge
    - items:
      - const: bridge
      - const: host


If we have 3 reset singles, we end up with listing 6 patterns.
Is there a good way to describe this?

Or, the policy is,
there is only one way to do one thing ?


[Q2] Tupling reg, range, etc.

In the context of dt-schema,
'reg' is essentially, array of array,
and it is important to how you tuple values.

    reg = <1 2>, <3 4>;

    reg = <1>, <2>, <3>, <4>;

    reg = <1 2 3 4>;

All of the three are compiled into the equivalent DTB,
but in the context of schema checking,
the number of items is, 2, 4, 1, respectively.

So, we need to care about tuple values correctly
based on #address-cells and #size-cells.


In some DT, I previously wrote ranges like this

   ranges = <1 0x00000000 0x42000000 0x02000000,
             5 0x00000000 0x46000000 0x01000000>;

But, now probably more correct way is:

   ranges = <1 0x00000000 0x42000000 0x02000000>,
            <5 0x00000000 0x46000000 0x01000000>;


This is a new restriction, and it also means
we cannot perform schema checking against
dis-assembled DT  (dtb->dts).

Is this correct?


-- 
Best Regards
Masahiro Yamada



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux