Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions doc/build/dts/macros.bnf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
; An RFC 7405 ABNF grammar for devicetree macros.

Check warning on line 1 in doc/build/dts/macros.bnf

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

Copyright missing

doc/build/dts/macros.bnf:1 File has no SPDX-FileCopyrightText header, consider adding one.

Check warning on line 1 in doc/build/dts/macros.bnf

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

License missing

doc/build/dts/macros.bnf:1 File has no SPDX-License-Identifier header, consider adding one.
;
; This does *not* cover macros pulled out of DT via Kconfig,
; like CONFIG_SRAM_BASE_ADDRESS, etc. It only describes the
Expand All @@ -22,6 +22,8 @@
node-macro =/ pinctrl-macro
; A macro about the GPIO hog properties in a node.
node-macro =/ gpiohogs-macro
; A macro about the map properties in a node.
node-macro =/ map-macro
; EXISTS macro: node exists in the devicetree
node-macro =/ %s"DT_N" path-id %s"_EXISTS"
; Bus macros: the plain BUS is a way to access a node's bus controller.
Expand Down Expand Up @@ -231,6 +233,71 @@
; #define DT_N_<node-2 path>_GPIO_HOGS_IDX_0_VAL_flags 0x30
gpiohogs-macro =/ %s"DT_N" path-id %s"_GPIO_HOGS_IDX_" DIGIT %s"_VAL_flags"


; --------------------------------------------------------------------
; map-macro: a macro related to map properties
;
; Macros are generated when there is a property ending with '-map' as shown below.
;
; connector {
; ...
; interrupt-map = <0 1 &intc0 2 3>;
; };
;
; The existence of map entry;
;
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_EXISTS 1
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT "_EXISTS"
;
; The child addrsss length, value, and existence.
;
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_CHILD_ADDRESS_LEN 1
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_CHILD_ADDRESS_IDX_0 0
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_CHILD_ADDRESS_IDX_0_EXISTS 1
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_CHILD_ADDRESS_LEN"
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_CHILD_ADDRESS_IDX_" DIGIT
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_CHILD_ADDRESS_IDX_" DIGIT %s"_EXISTS"
;
; The length of child specifiers length, value, and existence.
;
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_CHILD_SPECIFIER_LEN 1
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_CHILD_SPECIFIER_IDX_0_EXISTS 1
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_CHILD_SPECIFIER_IDX_0 0
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_CHILD_SPECIFIER_LEN"
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_CHILD_SPECIFIER_IDX_" DIGIT
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_CHILD_SPECIFIER_IDX_" DIGIT "_EXISTS"
;
; The parent node of this map.
;
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_PARENT DT_N_S_gpio_emul
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_PARENT"
;
; The length of parent addrsss, value, and existence.
;
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_PARENT_ADDRESS_LEN 1
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_PARENT_ADDRESS_IDX_0 2
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_PARENT_ADDRESS_IDX_0_EXISTS 1
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_PARENT_ADDRESS_LEN"
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_PARENT_ADDRESS_IDX_" DIGIT
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_PARENT_ADDRESS_IDX_" DIGIT "_EXISTS"
;
; The length of parent specifiers length, value, and existence.
;
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_PARENT_SPECIFIER_LEN 1
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_PARENT_SPECIFIER_IDX_0_EXISTS 1
; #define DT_N_S_connector_P_interrupt_map_MAP_ENTRY_0_PARENT_SPECIFIER_IDX_0 3
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_PARENT_SPECIFIER_LEN"
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_PARENT_SPECIFIER_IDX_" DIGIT
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_MAP_ENTRY_" DIGIT %s"_PARENT_SPECIFIER_IDX_" DIGIT "_EXISTS"
;
; Iteration helpers for map.
;
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_FOREACH_MAP_ENTRY"
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_FOREACH_MAP_ENTRY_SEP"
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_FOREACH_MAP_ENTRY_VARGS"
map-macro =/ %s"DT_N" path-id %s"_P_" prop-id %s"_FOREACH_MAP_ENTRY_SEP_VARGS"


; --------------------------------------------------------------------
; property-macro: a macro related to a node property
;
Expand Down
18 changes: 1 addition & 17 deletions dts/bindings/adc/arduino,uno-adc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,4 @@ description: |

compatible: "arduino,uno-adc"

include: base.yaml

properties:
io-channel-map:
type: compound
required: true

io-channel-map-mask:
type: compound

io-channel-map-pass-thru:
type: compound

"#io-channel-cells":
type: int
required: true
description: Number of items to expect in an ADC specifier
include: [base.yaml, io-channel-nexus.yaml]
8 changes: 6 additions & 2 deletions dts/bindings/gpio/gpio-nexus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,21 @@
# SPDX-License-Identifier: Apache-2.0

# Common fields for GPIO nexus nodes
#
# see 2.5 Nexus Nodes and Specifier Mapping
# https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#nexus-nodes-and-specifier-mapping
# in the Devicetree Specification

properties:
gpio-map:
type: compound
required: true

gpio-map-mask:
type: compound
type: array

gpio-map-pass-thru:
type: compound
type: array

"#gpio-cells":
type: int
Expand Down
24 changes: 24 additions & 0 deletions dts/bindings/iio/io-channel-nexus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2025 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

# Common fields for io-channel nexus
#
# see 2.5 Nexus Nodes and Specifier Mapping
# https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#nexus-nodes-and-specifier-mapping
# in the Devicetree Specification

properties:
io-channel-map:
type: compound
required: true

io-channel-map-mask:
type: array

io-channel-map-pass-thru:
type: array

"#io-channel-cells":
type: int
required: true
description: Number of items to expect in the io-channel specifier, such as ADC channels.
24 changes: 24 additions & 0 deletions dts/bindings/interrupt-controller/interrupt-nexus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (c) 2025 TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

# Common fields for interrupt nexus nodes
#
# See 2.4 Interrupts and Interrupt Mapping
# https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#interrupts-and-interrupt-mapping
# in the Devicetree Specification

properties:
interrupt-map:
type: compound
required: true

interrupt-map-mask:
type: array

interrupt-map-pass-thru:
type: array

"#interrupt-cells":
type: int
required: true
description: Number of items to expect in a interrupt specifier
8 changes: 1 addition & 7 deletions dts/bindings/pcie/host/pci-host-ecam-generic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: PCIe Controller in ECAM mode

compatible: "pci-host-ecam-generic"

include: pcie-controller.yaml
include: [pcie-controller.yaml, interrupt-nexus.yaml]

properties:
reg:
Expand All @@ -22,11 +22,5 @@ properties:
definition of non-prefetchable memory. One or both of prefetchable Memory
and IO Space may also be provided.

interrupt-map-mask:
type: array

interrupt-map:
type: compound

bus-range:
type: array
4 changes: 4 additions & 0 deletions dts/bindings/pwm/pwm-nexus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# SPDX-License-Identifier: Apache-2.0

# Common fields for PWM nexus nodes
#
# see 2.5 Nexus Nodes and Specifier Mapping
# https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#nexus-nodes-and-specifier-mapping
# in the Devicetree Specification

properties:
pwm-map:
Expand Down
8 changes: 8 additions & 0 deletions dts/bindings/test/vnd,gpio-nexus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2025, TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

description: VND GPIO nexus

include: [gpio-nexus.yaml]

compatible: "vnd,gpio-nexus"
8 changes: 8 additions & 0 deletions dts/bindings/test/vnd,intr-nexus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2025, TOKITA Hiroshi
# SPDX-License-Identifier: Apache-2.0

description: VND interrupt nexus

include: [interrupt-nexus.yaml]

compatible: "vnd,intr-nexus"
1 change: 1 addition & 0 deletions include/zephyr/devicetree.h
Original file line number Diff line number Diff line change
Expand Up @@ -5571,5 +5571,6 @@
#include <zephyr/devicetree/port-endpoint.h>
#include <zephyr/devicetree/display.h>
#include <zephyr/devicetree/hwspinlock.h>
#include <zephyr/devicetree/map.h>

#endif /* ZEPHYR_INCLUDE_DEVICETREE_H_ */
Loading
Loading