diff mbox series

[RFC] dt-bindings: renesas: Document preferred compatible naming

Message ID 20231123190612.2427668-1-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Superseded
Delegated to: Geert Uytterhoeven
Headers show
Series [RFC] dt-bindings: renesas: Document preferred compatible naming | expand

Commit Message

Niklas Söderlund Nov. 23, 2023, 7:06 p.m. UTC
Compatibles can come in two formats. Either "vendor,ip-soc" or
"vendor,soc-ip". Add a DT schema file documenting Renesas preferred
policy and enforcing it for all new compatibles, except few existing
patterns.

Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
Hello,

I have mixed up the order of soc and ip a few times. The last time I did 
Krzysztof suggested a schema could help catch this, and this is my  
attempt to create one.

One thing to note is that the select clause matches on all renesas 
related bindings, including ones that are SoC agnostic and a few that 
are Renesas IP that are not related to a SoC e.g. a Renesas regulator.

For this reason these two classes of compatibles have been added to this 
schema. An alternative solution would be to change the select clause to 
"^renesas,.+-.+$" and drop these two classes from the schema.

I have tested this schema with all DTBs built for ARM using the in tree 
shmobile_defconfig and ARM64 using the renesas_defconfig found in 
Geert's renesas-drivers tree [1].

1.  https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git

---
 .../devicetree/bindings/arm/renesas-soc.yaml  | 85 +++++++++++++++++++
 1 file changed, 85 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/arm/renesas-soc.yaml

Comments

Rob Herring (Arm) Nov. 23, 2023, 8:18 p.m. UTC | #1
On Thu, 23 Nov 2023 20:06:12 +0100, Niklas Söderlund wrote:
> Compatibles can come in two formats. Either "vendor,ip-soc" or
> "vendor,soc-ip". Add a DT schema file documenting Renesas preferred
> policy and enforcing it for all new compatibles, except few existing
> patterns.
> 
> Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> ---
> Hello,
> 
> I have mixed up the order of soc and ip a few times. The last time I did
> Krzysztof suggested a schema could help catch this, and this is my
> attempt to create one.
> 
> One thing to note is that the select clause matches on all renesas
> related bindings, including ones that are SoC agnostic and a few that
> are Renesas IP that are not related to a SoC e.g. a Renesas regulator.
> 
> For this reason these two classes of compatibles have been added to this
> schema. An alternative solution would be to change the select clause to
> "^renesas,.+-.+$" and drop these two classes from the schema.
> 
> I have tested this schema with all DTBs built for ARM using the in tree
> shmobile_defconfig and ARM64 using the renesas_defconfig found in
> Geert's renesas-drivers tree [1].
> 
> 1.  https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git
> 
> ---
>  .../devicetree/bindings/arm/renesas-soc.yaml  | 85 +++++++++++++++++++
>  1 file changed, 85 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/arm/renesas-soc.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/remoteproc/renesas,rcar-rproc.example.dtb: cr7: compatible: 'oneOf' conditional failed, one must be fixed:
	'renesas,rcar-cr7' does not match '^renesas,emev2-[a-z0-9-]+$'
	'renesas,rcar-cr7' does not match '^renesas,r7s[0-9]+-[a-z0-9-]+$'
	'renesas,rcar-cr7' does not match '^renesas,r8a[a-z0-9]+-[a-z0-9-]+$'
	'renesas,rcar-cr7' does not match '^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$'
	'renesas,rcar-cr7' does not match '^renesas,rzn1-[a-z0-9-]+$'
	'renesas,rcar-cr7' does not match '^renesas,rzv2m-[a-z0-9-]+$'
	'renesas,rcar-cr7' does not match '^renesas,sh73a0-[a-z0-9-]+$'
	'renesas,rcar-cr7' is not one of ['renesas,bsid', 'renesas,fcpf', 'renesas,fcpv', 'renesas,fdp1', 'renesas,prr', 'renesas,smp-sram', 'renesas,vsp1', 'renesas,vsp2']
	'renesas,rcar-cr7' does not match '^renesas,du-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,ether-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,gether-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,ipmmu-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,pfc-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,sata-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,scif-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,sdhi-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,thermal-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,usb2-phy-[a-z0-9]+$'
	'renesas,rcar-cr7' does not match '^renesas,vin-[a-z0-9]+$'
	'renesas,rcar-cr7' is not one of ['renesas,dbsc-r8a73a4', 'renesas,dbsc3-r8a7740', 'renesas,em-gio', 'renesas,em-sti', 'renesas,em-uart', 'renesas,iic-emev2', 'renesas,sbsc-sh73a0', 'renesas,sdhi-mmc-r8a77470']
	'renesas,rcar-cr7' is not one of ['renesas,5p35023', 'renesas,r2a11302ft', 'renesas,raa215300']
	from schema $id: http://devicetree.org/schemas/arm/renesas-soc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/potentiometer/renesas,x9250.example.dtb: potentiometer@0: compatible: 'oneOf' conditional failed, one must be fixed:
	'renesas,x9250t' does not match '^renesas,emev2-[a-z0-9-]+$'
	'renesas,x9250t' does not match '^renesas,r7s[0-9]+-[a-z0-9-]+$'
	'renesas,x9250t' does not match '^renesas,r8a[a-z0-9]+-[a-z0-9-]+$'
	'renesas,x9250t' does not match '^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$'
	'renesas,x9250t' does not match '^renesas,rzn1-[a-z0-9-]+$'
	'renesas,x9250t' does not match '^renesas,rzv2m-[a-z0-9-]+$'
	'renesas,x9250t' does not match '^renesas,sh73a0-[a-z0-9-]+$'
	'renesas,x9250t' is not one of ['renesas,bsid', 'renesas,fcpf', 'renesas,fcpv', 'renesas,fdp1', 'renesas,prr', 'renesas,smp-sram', 'renesas,vsp1', 'renesas,vsp2']
	'renesas,x9250t' does not match '^renesas,du-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,ether-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,gether-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,ipmmu-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,pfc-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,sata-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,scif-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,sdhi-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,thermal-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,usb2-phy-[a-z0-9]+$'
	'renesas,x9250t' does not match '^renesas,vin-[a-z0-9]+$'
	'renesas,x9250t' is not one of ['renesas,dbsc-r8a73a4', 'renesas,dbsc3-r8a7740', 'renesas,em-gio', 'renesas,em-sti', 'renesas,em-uart', 'renesas,iic-emev2', 'renesas,sbsc-sh73a0', 'renesas,sdhi-mmc-r8a77470']
	'renesas,x9250t' is not one of ['renesas,5p35023', 'renesas,r2a11302ft', 'renesas,raa215300']
	from schema $id: http://devicetree.org/schemas/arm/renesas-soc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/timer/renesas,tpu.example.dtb: tpu@ffffe0: compatible: 'oneOf' conditional failed, one must be fixed:
	'renesas,tpu' does not match '^renesas,emev2-[a-z0-9-]+$'
	'renesas,tpu' does not match '^renesas,r7s[0-9]+-[a-z0-9-]+$'
	'renesas,tpu' does not match '^renesas,r8a[a-z0-9]+-[a-z0-9-]+$'
	'renesas,tpu' does not match '^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$'
	'renesas,tpu' does not match '^renesas,rzn1-[a-z0-9-]+$'
	'renesas,tpu' does not match '^renesas,rzv2m-[a-z0-9-]+$'
	'renesas,tpu' does not match '^renesas,sh73a0-[a-z0-9-]+$'
	'renesas,tpu' is not one of ['renesas,bsid', 'renesas,fcpf', 'renesas,fcpv', 'renesas,fdp1', 'renesas,prr', 'renesas,smp-sram', 'renesas,vsp1', 'renesas,vsp2']
	'renesas,tpu' does not match '^renesas,du-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,ether-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,gether-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,ipmmu-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,pfc-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,sata-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,scif-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,sdhi-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,thermal-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,usb2-phy-[a-z0-9]+$'
	'renesas,tpu' does not match '^renesas,vin-[a-z0-9]+$'
	'renesas,tpu' is not one of ['renesas,dbsc-r8a73a4', 'renesas,dbsc3-r8a7740', 'renesas,em-gio', 'renesas,em-sti', 'renesas,em-uart', 'renesas,iic-emev2', 'renesas,sbsc-sh73a0', 'renesas,sdhi-mmc-r8a77470']
	'renesas,tpu' is not one of ['renesas,5p35023', 'renesas,r2a11302ft', 'renesas,raa215300']
	from schema $id: http://devicetree.org/schemas/arm/renesas-soc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/renesas,9series.example.dtb: clock-generator@6a: compatible: 'oneOf' conditional failed, one must be fixed:
	'renesas,9fgv0241' does not match '^renesas,emev2-[a-z0-9-]+$'
	'renesas,9fgv0241' does not match '^renesas,r7s[0-9]+-[a-z0-9-]+$'
	'renesas,9fgv0241' does not match '^renesas,r8a[a-z0-9]+-[a-z0-9-]+$'
	'renesas,9fgv0241' does not match '^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$'
	'renesas,9fgv0241' does not match '^renesas,rzn1-[a-z0-9-]+$'
	'renesas,9fgv0241' does not match '^renesas,rzv2m-[a-z0-9-]+$'
	'renesas,9fgv0241' does not match '^renesas,sh73a0-[a-z0-9-]+$'
	'renesas,9fgv0241' is not one of ['renesas,bsid', 'renesas,fcpf', 'renesas,fcpv', 'renesas,fdp1', 'renesas,prr', 'renesas,smp-sram', 'renesas,vsp1', 'renesas,vsp2']
	'renesas,9fgv0241' does not match '^renesas,du-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,ether-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,gether-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,ipmmu-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,pfc-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,sata-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,scif-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,sdhi-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,thermal-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,usb2-phy-[a-z0-9]+$'
	'renesas,9fgv0241' does not match '^renesas,vin-[a-z0-9]+$'
	'renesas,9fgv0241' is not one of ['renesas,dbsc-r8a73a4', 'renesas,dbsc3-r8a7740', 'renesas,em-gio', 'renesas,em-sti', 'renesas,em-uart', 'renesas,iic-emev2', 'renesas,sbsc-sh73a0', 'renesas,sdhi-mmc-r8a77470']
	'renesas,9fgv0241' is not one of ['renesas,5p35023', 'renesas,r2a11302ft', 'renesas,raa215300']
	from schema $id: http://devicetree.org/schemas/arm/renesas-soc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/clock/renesas,versaclock7.example.dtb: clock-controller@9: compatible: 'oneOf' conditional failed, one must be fixed:
	'renesas,rc21008a' does not match '^renesas,emev2-[a-z0-9-]+$'
	'renesas,rc21008a' does not match '^renesas,r7s[0-9]+-[a-z0-9-]+$'
	'renesas,rc21008a' does not match '^renesas,r8a[a-z0-9]+-[a-z0-9-]+$'
	'renesas,rc21008a' does not match '^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$'
	'renesas,rc21008a' does not match '^renesas,rzn1-[a-z0-9-]+$'
	'renesas,rc21008a' does not match '^renesas,rzv2m-[a-z0-9-]+$'
	'renesas,rc21008a' does not match '^renesas,sh73a0-[a-z0-9-]+$'
	'renesas,rc21008a' is not one of ['renesas,bsid', 'renesas,fcpf', 'renesas,fcpv', 'renesas,fdp1', 'renesas,prr', 'renesas,smp-sram', 'renesas,vsp1', 'renesas,vsp2']
	'renesas,rc21008a' does not match '^renesas,du-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,ether-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,gether-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,ipmmu-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,pfc-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,sata-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,scif-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,sdhi-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,thermal-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,usb2-phy-[a-z0-9]+$'
	'renesas,rc21008a' does not match '^renesas,vin-[a-z0-9]+$'
	'renesas,rc21008a' is not one of ['renesas,dbsc-r8a73a4', 'renesas,dbsc3-r8a7740', 'renesas,em-gio', 'renesas,em-sti', 'renesas,em-uart', 'renesas,iic-emev2', 'renesas,sbsc-sh73a0', 'renesas,sdhi-mmc-r8a77470']
	'renesas,rc21008a' is not one of ['renesas,5p35023', 'renesas,r2a11302ft', 'renesas,raa215300']
	from schema $id: http://devicetree.org/schemas/arm/renesas-soc.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/sound/renesas,idt821034.example.dtb: audio-codec@0: compatible: 'oneOf' conditional failed, one must be fixed:
	'renesas,idt821034' does not match '^renesas,emev2-[a-z0-9-]+$'
	'renesas,idt821034' does not match '^renesas,r7s[0-9]+-[a-z0-9-]+$'
	'renesas,idt821034' does not match '^renesas,r8a[a-z0-9]+-[a-z0-9-]+$'
	'renesas,idt821034' does not match '^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$'
	'renesas,idt821034' does not match '^renesas,rzn1-[a-z0-9-]+$'
	'renesas,idt821034' does not match '^renesas,rzv2m-[a-z0-9-]+$'
	'renesas,idt821034' does not match '^renesas,sh73a0-[a-z0-9-]+$'
	'renesas,idt821034' is not one of ['renesas,bsid', 'renesas,fcpf', 'renesas,fcpv', 'renesas,fdp1', 'renesas,prr', 'renesas,smp-sram', 'renesas,vsp1', 'renesas,vsp2']
	'renesas,idt821034' does not match '^renesas,du-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,ether-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,gether-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,ipmmu-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,pfc-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,sata-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,scif-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,sdhi-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,thermal-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,usb2-phy-[a-z0-9]+$'
	'renesas,idt821034' does not match '^renesas,vin-[a-z0-9]+$'
	'renesas,idt821034' is not one of ['renesas,dbsc-r8a73a4', 'renesas,dbsc3-r8a7740', 'renesas,em-gio', 'renesas,em-sti', 'renesas,em-uart', 'renesas,iic-emev2', 'renesas,sbsc-sh73a0', 'renesas,sdhi-mmc-r8a77470']
	'renesas,idt821034' is not one of ['renesas,5p35023', 'renesas,r2a11302ft', 'renesas,raa215300']
	from schema $id: http://devicetree.org/schemas/arm/renesas-soc.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20231123190612.2427668-1-niklas.soderlund+renesas@ragnatech.se

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Geert Uytterhoeven Nov. 24, 2023, 8:02 a.m. UTC | #2
Hi Niklas,

On Thu, Nov 23, 2023 at 8:07 PM Niklas Söderlund
<niklas.soderlund+renesas@ragnatech.se> wrote:
> Compatibles can come in two formats. Either "vendor,ip-soc" or
> "vendor,soc-ip". Add a DT schema file documenting Renesas preferred
> policy and enforcing it for all new compatibles, except few existing
> patterns.
>
> Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Thanks for your patch!

> --- /dev/null
> +++ b/Documentation/devicetree/bindings/arm/renesas-soc.yaml

s/arm/soc/

> @@ -0,0 +1,85 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/arm/renesas-soc.yaml#

s/arm/soc/

> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Renesas SoC compatibles naming convention
> +
> +maintainers:
> +  - Geert Uytterhoeven <geert+renesas@glider.be>
> +  - Niklas Söderlund <niklas.soderlund@ragnatech.se>

+renesas?

> +
> +description: |
> +  Guidelines for new compatibles for SoC blocks/components.
> +  When adding new compatibles in new bindings, use the format::
> +    renesas,SoC-IP
> +
> +  For example::
> +   renesas,r8a77965-csi2
> +
> +  When adding new compatibles to existing bindings, use the format in the
> +  existing binding, even if it contradicts the above.
> +
> +select:
> +  properties:
> +    compatible:
> +      pattern: "^renesas,.*$"
> +  required:
> +    - compatible
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      # Preferred naming style for compatibles of SoC components:
> +      - pattern: "^renesas,emev2-[a-z0-9-]+$"
> +      - pattern: "^renesas,r7s[0-9]+-[a-z0-9-]+$"
> +      - pattern: "^renesas,r8a[a-z0-9]+-[a-z0-9-]+$"
> +      - pattern: "^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$"

Missing renesas,rcar-* families.

> +      - pattern: "^renesas,rzn1-[a-z0-9-]+$"

Missing renesas,rzg2l-* (there may be more).

> +      - pattern: "^renesas,rzv2m-[a-z0-9-]+$"
> +      - pattern: "^renesas,sh73a0-[a-z0-9-]+$"

We'll get more sh7* soon ;-)

> +
> +      # SoC agnostic compatibles - new compatibles are OK:
> +      - enum:
> +          - renesas,bsid
> +          - renesas,fcpf
> +          - renesas,fcpv
> +          - renesas,fdp1
> +          - renesas,prr
> +          - renesas,smp-sram

Missing renesas,tmu (there may be more).

> +          - renesas,vsp1
> +          - renesas,vsp2
> +
> +      # Legacy namings - variations of existing patterns/compatibles are OK,
> +      # but do not add completely new entries to these:
> +      - pattern: "^renesas,du-[a-z0-9]+$"
> +      - pattern: "^renesas,ether-[a-z0-9]+$"
> +      - pattern: "^renesas,gether-[a-z0-9]+$"
> +      - pattern: "^renesas,ipmmu-[a-z0-9]+$"
> +      - pattern: "^renesas,pfc-[a-z0-9]+$"
> +      - pattern: "^renesas,sata-[a-z0-9]+$"
> +      - pattern: "^renesas,scif-[a-z0-9]+$"
> +      - pattern: "^renesas,sdhi-[a-z0-9]+$"
> +      - pattern: "^renesas,thermal-[a-z0-9]+$"
> +      - pattern: "^renesas,usb2-phy-[a-z0-9]+$"
> +      - pattern: "^renesas,vin-[a-z0-9]+$"

This list also looks incomplete, e.g. hscif and scif[ab] are missing.
I guess you created it based on the error output of "make dtbs_check",
which ignores all nodes that are disabled?  Although that can't explain
everything, as some boards use scifa for the console...

Gr{oetje,eeting}s,

                        Geert
Niklas Söderlund Nov. 25, 2023, 11:15 p.m. UTC | #3
Hi Geert,

Thanks for your feedback.

On 2023-11-24 09:02:28 +0100, Geert Uytterhoeven wrote:
> Hi Niklas,
> 
> On Thu, Nov 23, 2023 at 8:07 PM Niklas Söderlund
> <niklas.soderlund+renesas@ragnatech.se> wrote:
> > Compatibles can come in two formats. Either "vendor,ip-soc" or
> > "vendor,soc-ip". Add a DT schema file documenting Renesas preferred
> > policy and enforcing it for all new compatibles, except few existing
> > patterns.
> >
> > Suggested-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> 
> Thanks for your patch!
> 
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/arm/renesas-soc.yaml
> 
> s/arm/soc/

I opted to put this in soc/renesas/renesas-soc.yaml.

> 
> > @@ -0,0 +1,85 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/arm/renesas-soc.yaml#
> 
> s/arm/soc/
> 
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Renesas SoC compatibles naming convention
> > +
> > +maintainers:
> > +  - Geert Uytterhoeven <geert+renesas@glider.be>
> > +  - Niklas Söderlund <niklas.soderlund@ragnatech.se>
> 
> +renesas?

Nope, I don't record the +renesas part in files. I fear the day Gmail
drops support for the feature or I need to switch mail provider.

> 
> > +
> > +description: |
> > +  Guidelines for new compatibles for SoC blocks/components.
> > +  When adding new compatibles in new bindings, use the format::
> > +    renesas,SoC-IP
> > +
> > +  For example::
> > +   renesas,r8a77965-csi2
> > +
> > +  When adding new compatibles to existing bindings, use the format in the
> > +  existing binding, even if it contradicts the above.
> > +
> > +select:
> > +  properties:
> > +    compatible:
> > +      pattern: "^renesas,.*$"
> > +  required:
> > +    - compatible
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      # Preferred naming style for compatibles of SoC components:
> > +      - pattern: "^renesas,emev2-[a-z0-9-]+$"
> > +      - pattern: "^renesas,r7s[0-9]+-[a-z0-9-]+$"
> > +      - pattern: "^renesas,r8a[a-z0-9]+-[a-z0-9-]+$"
> > +      - pattern: "^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$"
> 
> Missing renesas,rcar-* families.
> 
> > +      - pattern: "^renesas,rzn1-[a-z0-9-]+$"
> 
> Missing renesas,rzg2l-* (there may be more).

There where a few more, added.

> 
> > +      - pattern: "^renesas,rzv2m-[a-z0-9-]+$"
> > +      - pattern: "^renesas,sh73a0-[a-z0-9-]+$"
> 
> We'll get more sh7* soon ;-)

I adapted the regexp to prepare for this.


> 
> > +
> > +      # SoC agnostic compatibles - new compatibles are OK:
> > +      - enum:
> > +          - renesas,bsid
> > +          - renesas,fcpf
> > +          - renesas,fcpv
> > +          - renesas,fdp1
> > +          - renesas,prr
> > +          - renesas,smp-sram
> 
> Missing renesas,tmu (there may be more).

As discussed offline I will change the pattern in the initial select to 
only match on .*-.* so most of these will be gone.

> 
> > +          - renesas,vsp1
> > +          - renesas,vsp2
> > +
> > +      # Legacy namings - variations of existing patterns/compatibles are OK,
> > +      # but do not add completely new entries to these:
> > +      - pattern: "^renesas,du-[a-z0-9]+$"
> > +      - pattern: "^renesas,ether-[a-z0-9]+$"
> > +      - pattern: "^renesas,gether-[a-z0-9]+$"
> > +      - pattern: "^renesas,ipmmu-[a-z0-9]+$"
> > +      - pattern: "^renesas,pfc-[a-z0-9]+$"
> > +      - pattern: "^renesas,sata-[a-z0-9]+$"
> > +      - pattern: "^renesas,scif-[a-z0-9]+$"
> > +      - pattern: "^renesas,sdhi-[a-z0-9]+$"
> > +      - pattern: "^renesas,thermal-[a-z0-9]+$"
> > +      - pattern: "^renesas,usb2-phy-[a-z0-9]+$"
> > +      - pattern: "^renesas,vin-[a-z0-9]+$"
> 
> This list also looks incomplete, e.g. hscif and scif[ab] are missing.
> I guess you created it based on the error output of "make dtbs_check",
> which ignores all nodes that are disabled?  Although that can't explain
> everything, as some boards use scifa for the console...

Not sure how my tests missed so much. For next version I have extracted 
all compatible variables and created a test dts file with every 
available value. There where quiet a lot missing in this RFC.

> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> -- 
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
>                                 -- Linus Torvalds
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/arm/renesas-soc.yaml b/Documentation/devicetree/bindings/arm/renesas-soc.yaml
new file mode 100644
index 000000000000..be7cdb00607d
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/renesas-soc.yaml
@@ -0,0 +1,85 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/arm/renesas-soc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SoC compatibles naming convention
+
+maintainers:
+  - Geert Uytterhoeven <geert+renesas@glider.be>
+  - Niklas Söderlund <niklas.soderlund@ragnatech.se>
+
+description: |
+  Guidelines for new compatibles for SoC blocks/components.
+  When adding new compatibles in new bindings, use the format::
+    renesas,SoC-IP
+
+  For example::
+   renesas,r8a77965-csi2
+
+  When adding new compatibles to existing bindings, use the format in the
+  existing binding, even if it contradicts the above.
+
+select:
+  properties:
+    compatible:
+      pattern: "^renesas,.*$"
+  required:
+    - compatible
+
+properties:
+  compatible:
+    oneOf:
+      # Preferred naming style for compatibles of SoC components:
+      - pattern: "^renesas,emev2-[a-z0-9-]+$"
+      - pattern: "^renesas,r7s[0-9]+-[a-z0-9-]+$"
+      - pattern: "^renesas,r8a[a-z0-9]+-[a-z0-9-]+$"
+      - pattern: "^renesas,r9a[0-9]+g[0-9]+-[a-z0-9-]+$"
+      - pattern: "^renesas,rzn1-[a-z0-9-]+$"
+      - pattern: "^renesas,rzv2m-[a-z0-9-]+$"
+      - pattern: "^renesas,sh73a0-[a-z0-9-]+$"
+
+      # SoC agnostic compatibles - new compatibles are OK:
+      - enum:
+          - renesas,bsid
+          - renesas,fcpf
+          - renesas,fcpv
+          - renesas,fdp1
+          - renesas,prr
+          - renesas,smp-sram
+          - renesas,vsp1
+          - renesas,vsp2
+
+      # Legacy namings - variations of existing patterns/compatibles are OK,
+      # but do not add completely new entries to these:
+      - pattern: "^renesas,du-[a-z0-9]+$"
+      - pattern: "^renesas,ether-[a-z0-9]+$"
+      - pattern: "^renesas,gether-[a-z0-9]+$"
+      - pattern: "^renesas,ipmmu-[a-z0-9]+$"
+      - pattern: "^renesas,pfc-[a-z0-9]+$"
+      - pattern: "^renesas,sata-[a-z0-9]+$"
+      - pattern: "^renesas,scif-[a-z0-9]+$"
+      - pattern: "^renesas,sdhi-[a-z0-9]+$"
+      - pattern: "^renesas,thermal-[a-z0-9]+$"
+      - pattern: "^renesas,usb2-phy-[a-z0-9]+$"
+      - pattern: "^renesas,vin-[a-z0-9]+$"
+
+      # Legacy compatibles - list cannot grow with new bindings:
+      - enum:
+          - renesas,dbsc-r8a73a4
+          - renesas,dbsc3-r8a7740
+          - renesas,em-gio
+          - renesas,em-sti
+          - renesas,em-uart
+          - renesas,iic-emev2
+          - renesas,sbsc-sh73a0
+          - renesas,sdhi-mmc-r8a77470
+
+      # None SoC related compatibles - new compatibles are OK:
+      - enum:
+          - renesas,5p35023
+          - renesas,r2a11302ft
+          - renesas,raa215300
+
+additionalProperties: true