Re: [PATCH 4/4] dt-bindings: bus: Convert ACONNECT doc to json-schema

Sameer Pujar
2020-11-06T06:44:44Z

>> Move ACONNECT documentation to YAML format.
>>
>> Signed-off-by: Sameer Pujar <spujar@nvidia.com>
>> ---
>> .../bindings/bus/nvidia,tegra210-aconnect.txt | 44 -----------
>> .../bindings/bus/nvidia,tegra210-aconnect.yaml | 86 ++++++++++++++++++++++
>> 2 files changed, 86 insertions(+), 44 deletions(-)
>> delete mode 100644 Documentation/devicetree/bindings/bus/nvidia,tegra210-aconnect.txt
>> create mode 100644 Documentation/devicetree/bindings/bus/nvidia,tegra210-aconnect.yaml
>>

...

>> diff --git a/Documentation/devicetree/bindings/bus/nvidia,tegra210-aconnect.yaml b/Documentation/devicetree/bindings/bus/nvidia,tegra210-aconnect.yaml
>> new file mode 100644
>> index 0000000..f0161bc
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/bus/nvidia,tegra210-aconnect.yaml
>> @@ -0,0 +1,86 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/bus/nvidia,tegra210-aconnect.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: NVIDIA Tegra ACONNECT Bus
>> +
>> +description: |
>> + The Tegra ACONNECT bus is an AXI switch which is used to connnect various
>> + components inside the Audio Processing Engine (APE). All CPU accesses to
>> + the APE subsystem go through the ACONNECT via an APB to AXI wrapper. All
>> + devices accessed via the ACONNNECT are described by child-nodes.
>> +

...

>> +
>> +patternProperties:
>> + "^dma-controller(@[0-9a-f]+)?$":
>> + $ref: /schemas/dma/nvidia,tegra210-adma.yaml#
>> + "^interrupt-controller(@[0-9a-f]+)?$":
>> + $ref: /schemas/interrupt-controller/arm,gic.yaml#
>> + "^ahub(@[0-9a-f]+)?$":
>> + $ref: /schemas/sound/nvidia,tegra210-ahub.yaml#
> These all get applied already since they match on compatible strings. So
> having them here means the schema is applied twice. There's maybe some
> value to this if it's always going to be these 3 nodes.

1) May be this could be dropped with "additionalProperties = true", but
that allows any arbitary property to be added for the device. Without
this 'make dtbs_check' complains about not matching properties in DT files.

2) These may not be the final list of nodes this device can have. In
future if any new device support gets added under this, above needs to
be updated. But it will be limited number of devices.

So is [2] fine or you would suggest [1] would be good enough?

>
> Also, the unit-addresses shouldn't be optional.
>
> I'd just do:
>
> "@[0-9a-f]+$":
> type: object
>
>> +
>> +required:
>> + - compatible
>> + - clocks
>> + - clock-names
>> + - power-domains
>> + - "#address-cells"
>> + - "#size-cells"
>> + - ranges
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + #include<dt-bindings/clock/tegra210-car.h>
>> +
>> + aconnect@702c0000 {
>> + compatible = "nvidia,tegra210-aconnect";
>> + clocks = <&tegra_car TEGRA210_CLK_APE>,
>> + <&tegra_car TEGRA210_CLK_APB2APE>;
>> + clock-names = "ape", "apb2ape";
>> + power-domains = <&pd_audio>;
>> +
>> + #address-cells = <1>;
>> + #size-cells = <1>;
>> + ranges = <0x702c0000 0x702c0000 0x00040000>;
>> +
>> + // Child device nodes follow ...
>> + };
>> +
>> +...
>> --
>> 2.7.4
>>