On Thu, Sep 19, 2019 at 02:33:58PM -0500, Rob Herring wrote: > On Thu, Sep 19, 2019 at 10:10 AM Simon Horman <horms@xxxxxxxxxxxx> wrote: > > > > On Tue, Sep 17, 2019 at 07:12:16AM -0500, Rob Herring wrote: > > > On Mon, Sep 16, 2019 at 10:35 AM Simon Horman > > > <horms+renesas@xxxxxxxxxxxx> wrote: ... > > > > + > > > > + power-domains: > > > > + # Required if clocks is absent, optional otherwise > > > > + minItems: 1 > > > > + > > > > +required: > > > > + - compatible > > > > + - '#address-cells' > > > > + - '#size-cells' > > > > + - ranges > > > > > > This will capture what you commented above: > > > > > > oneOf: > > > - required: > > > - clocks > > > - required: > > > - power-domains > > > > Thanks. Unfortunately dtbs_check does not seem happy > > if both clocks and power-domains are present. > > I was thinking it was either or. Use 'anyOf' instead. Thanks, perhaps the tooling needs updating to handle this. I now have: required: - compatible - '#address-cells' - '#size-cells' - ranges anyOf: - required: - clocks - required: - power-domains And see: # cr make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/bus/simple-pm-bus.yaml ... Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/dtschema/lib.py", line 429, in process_schema DTValidator.check_schema(schema) File "/usr/local/lib/python3.7/dist-packages/dtschema/lib.py", line 575, in check_schema raise jsonschema.SchemaError.create_from(error) jsonschema.exceptions.SchemaError: Additional properties are not allowed ('anyOf' was unexpected) Failed validating 'additionalProperties' in metaschema['allOf'][0]: {'$id': 'http://devicetree.org/meta-schemas/base.yaml#', '$schema': 'http://json-schema.org/draft-07/schema#', 'additionalProperties': False, 'allOf': [{'$ref': 'http://json-schema.org/draft-07/schema#'}], 'description': 'Metaschema for devicetree binding documentation', 'properties': {'$id': {'pattern': 'http://devicetree.org/schemas/.*\\.yaml#'}, '$schema': {'enum': ['http://devicetree.org/meta-schemas/core.yaml#', 'http://devicetree.org/meta-schemas/base.yaml#']}, 'additionalProperties': {'type': 'boolean'}, 'allOf': {'items': {'propertyNames': {'enum': ['$ref', 'if', 'then', 'else']}}}, 'definitions': True, 'dependencies': True, 'description': True, 'else': True, 'examples': {'items': {'type': 'string'}, 'type': 'array'}, 'if': True, 'maintainers': {'items': {'format': 'email', 'type': 'string'}, 'type': 'array'}, 'oneOf': True, 'patternProperties': True, 'properties': True, 'required': True, 'select': {'allOf': [{'$ref': 'http://json-schema.org/draft-07/schema#'}, {'oneOf': [{'properties': {'properties': True, 'required': True}, 'type': 'object'}, {'type': 'boolean'}]}]}, 'then': True, 'title': {'maxLength': 100}, 'unevaluatedProperties': {'type': 'boolean'}}, 'required': ['$id', '$schema', 'title', 'maintainers']} On schema: {'$id': 'http://devicetree.org/schemas/bus/simple-pm-bus.yaml#', '$schema': 'http://devicetree.org/meta-schemas/core.yaml#', 'anyOf': [{'required': ['clocks']}, {'required': ['power-domains']}], 'description': 'A Simple Power-Managed Bus is a transparent bus that ' "doesn't need a real\n" "driver, as it's typically initialized by the boot " 'loader.\n' '\n' 'However, its bus controller is part of a PM domain, ' 'or under the control\n' "of a functional clock. Hence, the bus controller's " 'PM domain and/or\n' 'clock must be enabled for child devices connected to ' 'the bus (either\n' 'on-SoC or externally) to function.\n' '\n' 'While "simple-pm-bus" follows the "simple-bus" set of ' 'properties, as\n' 'specified in the Devicetree Specification, it is not ' 'an extension of\n' '"simple-bus".\n', 'examples': ['#include <dt-bindings/clock/qcom,gcc-msm8996.h>\n' '#include <dt-bindings/interrupt-controller/irq.h>\n' '\n' 'bus@0 {\n' ' power-domains = <&gcc AGGRE0_NOC_GDSC>;\n' ' compatible = "simple-pm-bus";\n' ' #address-cells = <1>;\n' ' #size-cells = <1>;\n' ' ranges;\n' '};\n'], 'maintainers': ['Geert Uytterhoeven <geert+renesas@xxxxxxxxx>'], 'properties': {'#address-cells': {'const': 1}, '#size-cells': {'enum': [1, 2]}, '$nodename': {'pattern': '^bus@[0-9a-f]+$'}, 'clocks': True, 'compatible': {'contains': {'const': 'simple-pm-bus'}, 'description': 'Shall contain ' '"simple-pm-bus" in ' 'addition to a optional ' 'bus-specific compatible ' 'strings defined in ' 'individual pm-bus ' 'bindings.'}, 'power-domains': {'minItems': 1}, 'ranges': True}, 'required': ['compatible', '#address-cells', '#size-cells', 'ranges'], 'title': 'Simple Power-Managed Bus'} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/bin/dt-mk-schema", line 32, in <module> schemas = dtschema.process_schemas(args.schemas, core_schema=(not args.useronly)) File "/usr/local/lib/python3.7/dist-packages/dtschema/lib.py", line 470, in process_schemas sch = process_schema(os.path.abspath(filename)) File "/usr/local/lib/python3.7/dist-packages/dtschema/lib.py", line 431, in process_schema print(filename + ": ignoring, error in schema '%s'" % exc.path[-1]) IndexError: deque index out of range