Skip to content

Commit 7d9ef7f

Browse files
committed
dt-bindings: riscv: Limit cpus schema to only check RiscV 'cpu' nodes
Matching on the 'cpus' node was a bad choice because the schema is incorrectly applied to non-RiscV cpus nodes. As we now have a common cpus schema which checks the general structure, it is also redundant to do so in the Risc-V CPU schema. The downside is one could conceivably mix different architecture's cpu nodes or have typos in the compatible string. The latter problem pretty much exists for every schema. Acked-by: Paul Walmsley <[email protected]> Signed-off-by: Rob Herring <[email protected]>
1 parent 15ffef1 commit 7d9ef7f

File tree

1 file changed

+61
-82
lines changed
  • Documentation/devicetree/bindings/riscv

1 file changed

+61
-82
lines changed

Documentation/devicetree/bindings/riscv/cpus.yaml

Lines changed: 61 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -10,97 +10,76 @@ maintainers:
1010
- Paul Walmsley <[email protected]>
1111
- Palmer Dabbelt <[email protected]>
1212

13-
allOf:
14-
- $ref: /schemas/cpus.yaml#
15-
1613
properties:
17-
$nodename:
18-
const: cpus
19-
description: Container of cpu nodes
20-
21-
'#address-cells':
22-
const: 1
23-
description: |
24-
A single unsigned 32-bit integer uniquely identifies each RISC-V
25-
hart in a system. (See the "reg" node under the "cpu" node,
26-
below).
27-
28-
'#size-cells':
29-
const: 0
14+
compatible:
15+
items:
16+
- enum:
17+
- sifive,rocket0
18+
- sifive,e5
19+
- sifive,e51
20+
- sifive,u54-mc
21+
- sifive,u54
22+
- sifive,u5
23+
- const: riscv
24+
description:
25+
Identifies that the hart uses the RISC-V instruction set
26+
and identifies the type of the hart.
27+
28+
mmu-type:
29+
allOf:
30+
- $ref: "/schemas/types.yaml#/definitions/string"
31+
- enum:
32+
- riscv,sv32
33+
- riscv,sv39
34+
- riscv,sv48
35+
description:
36+
Identifies the MMU address translation mode used on this
37+
hart. These values originate from the RISC-V Privileged
38+
Specification document, available from
39+
https://riscv.org/specifications/
40+
41+
riscv,isa:
42+
allOf:
43+
- $ref: "/schemas/types.yaml#/definitions/string"
44+
- enum:
45+
- rv64imac
46+
- rv64imafdc
47+
description:
48+
Identifies the specific RISC-V instruction set architecture
49+
supported by the hart. These are documented in the RISC-V
50+
User-Level ISA document, available from
51+
https://riscv.org/specifications/
52+
53+
timebase-frequency:
54+
type: integer
55+
minimum: 1
56+
description:
57+
Specifies the clock frequency of the system timer in Hz.
58+
This value is common to all harts on a single system image.
59+
60+
interrupt-controller:
61+
type: object
62+
description: Describes the CPU's local interrupt controller
3063

31-
patternProperties:
32-
'^cpu@[0-9a-f]+$':
3364
properties:
34-
compatible:
35-
type: array
36-
items:
37-
- enum:
38-
- sifive,rocket0
39-
- sifive,e5
40-
- sifive,e51
41-
- sifive,u54-mc
42-
- sifive,u54
43-
- sifive,u5
44-
- const: riscv
45-
description:
46-
Identifies that the hart uses the RISC-V instruction set
47-
and identifies the type of the hart.
48-
49-
mmu-type:
50-
allOf:
51-
- $ref: "/schemas/types.yaml#/definitions/string"
52-
- enum:
53-
- riscv,sv32
54-
- riscv,sv39
55-
- riscv,sv48
56-
description:
57-
Identifies the MMU address translation mode used on this
58-
hart. These values originate from the RISC-V Privileged
59-
Specification document, available from
60-
https://riscv.org/specifications/
61-
62-
riscv,isa:
63-
allOf:
64-
- $ref: "/schemas/types.yaml#/definitions/string"
65-
- enum:
66-
- rv64imac
67-
- rv64imafdc
68-
description:
69-
Identifies the specific RISC-V instruction set architecture
70-
supported by the hart. These are documented in the RISC-V
71-
User-Level ISA document, available from
72-
https://riscv.org/specifications/
65+
'#interrupt-cells':
66+
const: 1
7367

74-
timebase-frequency:
75-
type: integer
76-
minimum: 1
77-
description:
78-
Specifies the clock frequency of the system timer in Hz.
79-
This value is common to all harts on a single system image.
80-
81-
interrupt-controller:
82-
type: object
83-
description: Describes the CPU's local interrupt controller
84-
85-
properties:
86-
'#interrupt-cells':
87-
const: 1
88-
89-
compatible:
90-
const: riscv,cpu-intc
91-
92-
interrupt-controller: true
68+
compatible:
69+
const: riscv,cpu-intc
9370

94-
required:
95-
- '#interrupt-cells'
96-
- compatible
97-
- interrupt-controller
71+
interrupt-controller: true
9872

9973
required:
100-
- riscv,isa
101-
- timebase-frequency
74+
- '#interrupt-cells'
75+
- compatible
10276
- interrupt-controller
10377

78+
required:
79+
- riscv,isa
80+
- timebase-frequency
81+
- interrupt-controller
82+
10483
examples:
10584
- |
10685
// Example 1: SiFive Freedom U540G Development Kit

0 commit comments

Comments
 (0)