Skip to contentSkip to conversation

ARM: use C pre-processor with dtc

RFC PATCH New Stephen Warren 5 participants 19 messages Sep 25, 2012 – Sep 27, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover ARM: use C pre-processor with dtc

From: Stephen Warren <[email protected]>

This series adds some build rules to run cpp on *.dts-cpp prior to invoking dtc, and converts Tegra to the new rule as an example. What do people think?

I assume that you've applied the dtc patches I sent yesterday. They aren't in this series. See:

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020182.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020183.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020181.html

Note: those patches are against upstream dtc. If you wish to test this series, apply the dtc patches to upstream dtc, build it, and copy the resultant dtc binary over the top of scripts/dtc/dtc.

Stephen Warren (3):
kbuild: introduce cmd_dtc_cpp
ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb
ARM: tegra: compile all DT files with cpp

 arch/arm/boot/Makefile                             |    3 ++
 arch/arm/boot/dts/skeleton.dtsi-cpp                |   13 +++++++
 ...tegra20-harmony.dts => tegra20-harmony.dts-cpp} |   10 +++---
 ...medcom-wide.dts => tegra20-medcom-wide.dts-cpp} |    4 +-
 .../{tegra20-paz00.dts => tegra20-paz00.dts-cpp}   |   14 ++++----
 .../{tegra20-plutux.dts => tegra20-plutux.dts-cpp} |    4 +-
 ...gra20-seaboard.dts => tegra20-seaboard.dts-cpp} |   22 ++++++------
 ...a20-tamonten.dtsi => tegra20-tamonten.dtsi-cpp} |    8 ++--
 .../dts/{tegra20-tec.dts => tegra20-tec.dts-cpp}   |    4 +-
 ...a20-trimslice.dts => tegra20-trimslice.dts-cpp} |    2 +-
 ...tegra20-ventana.dts => tegra20-ventana.dts-cpp} |   10 +++---
 ...gra20-whistler.dts => tegra20-whistler.dts-cpp} |    8 ++--
 .../boot/dts/{tegra20.dtsi => tegra20.dtsi-cpp}    |   30 +++++++++---------
 ...0-cardhu-a02.dts => tegra30-cardhu-a02.dts-cpp} |    6 ++--
 ...0-cardhu-a04.dts => tegra30-cardhu-a04.dts-cpp} |    6 ++--
 ...tegra30-cardhu.dtsi => tegra30-cardhu.dtsi-cpp} |   12 +++---
 .../boot/dts/{tegra30.dtsi => tegra30.dtsi-cpp}    |   34 ++++++++++----------
 scripts/Makefile.lib                               |    3 ++
 18 files changed, 106 insertions(+), 87 deletions(-)
 create mode 100644 arch/arm/boot/dts/skeleton.dtsi-cpp
 rename arch/arm/boot/dts/{tegra20-harmony.dts => tegra20-harmony.dts-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-medcom-wide.dts => tegra20-medcom-wide.dts-cpp} (95%)
 rename arch/arm/boot/dts/{tegra20-paz00.dts => tegra20-paz00.dts-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-plutux.dts => tegra20-plutux.dts-cpp} (94%)
 rename arch/arm/boot/dts/{tegra20-seaboard.dts => tegra20-seaboard.dts-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-tamonten.dtsi => tegra20-tamonten.dtsi-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-tec.dts => tegra20-tec.dts-cpp} (94%)
 rename arch/arm/boot/dts/{tegra20-trimslice.dts => tegra20-trimslice.dts-cpp} (99%)
 rename arch/arm/boot/dts/{tegra20-ventana.dts => tegra20-ventana.dts-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-whistler.dts => tegra20-whistler.dts-cpp} (99%)
 rename arch/arm/boot/dts/{tegra20.dtsi => tegra20.dtsi-cpp} (93%)
 rename arch/arm/boot/dts/{tegra30-cardhu-a02.dts => tegra30-cardhu-a02.dts-cpp} (96%)
 rename arch/arm/boot/dts/{tegra30-cardhu-a04.dts => tegra30-cardhu-a04.dts-cpp} (96%)
 rename arch/arm/boot/dts/{tegra30-cardhu.dtsi => tegra30-cardhu.dtsi-cpp} (98%)
 rename arch/arm/boot/dts/{tegra30.dtsi => tegra30.dtsi-cpp} (93%)
#1 lore raw

RFC PATCH 1/3 kbuild: introduce cmd_dtc_cpp

From: Stephen Warren <[email protected]>

cmd_dtc_cpp runs the C pre-processor on the input .dts file before passing it to dtc for final compilation. This allows used of #define within the .dts file.

---
 scripts/Makefile.lib |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
scripts/Makefile.lib +3 -0
index 0be6f11..e3a149e 100644
@@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
 quiet_cmd_dtc = DTC     $@
 cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
 
+quiet_cmd_dtc_cpp = DTC+CPP $@
+cmd_dtc_cpp = $(CC) -E -Wp,-MD,$(depfile) -xc $< | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -
+
 # Bzip2
 # ---------------------------------------------------------------------------
 
Signature · 1 line
1.7.0.4
#2 lore raw

RFC PATCH 1/3 kbuild: introduce cmd_dtc_cpp

Quoted 16 lines · Stephen Warren

From: Stephen Warren <[email protected]>

cmd_dtc_cpp runs the C pre-processor on the input .dts file before passing it to dtc for final compilation. This allows used of #define within the .dts file.

---
 scripts/Makefile.lib |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
scripts/Makefile.lib +0 -0
index 0be6f11..e3a149e 100644

scripts/Makefile.lib $(obj)/%.dtb.S: $(obj)/%.dtb · line 270

Quoted 5 lines
scripts/Makefile.lib +2 -0
@@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
 quiet_cmd_dtc = DTC     $@
 cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
 
+quiet_cmd_dtc_cpp = DTC+CPP $@
+cmd_dtc_cpp = $(CC) -E -Wp,-MD,$(depfile) -xc $< | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -

this should go to Makefile.build

and we should keep the same nomecalture as lds with lds.S

here dts.S

and is it possible to cmd with it

Best Regards,
J.

#3 lore raw

RFC PATCH 1/3 kbuild: introduce cmd_dtc_cpp

Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 19 lines · Stephen Warren

From: Stephen Warren <[email protected]>

cmd_dtc_cpp runs the C pre-processor on the input .dts file before passing it to dtc for final compilation. This allows used of #define within the .dts file.

---
 scripts/Makefile.lib |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
scripts/Makefile.lib +0 -0
index 0be6f11..e3a149e 100644
@@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
 quiet_cmd_dtc = DTC     $@
 cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
 
Quoted 4 lines

scripts/Makefile.lib $(obj)/%.dtb.S: $(obj)/%.dtb · line 270

Quoted 2 lines
scripts/Makefile.lib +2 -0
+quiet_cmd_dtc_cpp = DTC+CPP $@
+cmd_dtc_cpp = $(CC) -E -Wp,-MD,$(depfile) -xc $< | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -

this should go to Makefile.build

Hmm. Consistency with the existing cmd_dtc right above would dictate otherwise.

Quoted 3 lines

and we should keep the same nomecalture as lds with lds.S

here dts.S

I don't agree; see my previous response to the same assertion.

Quoted 1 line

and is it possible to cmd with it

I don't understand the question.

#4 lore raw

RFC PATCH 1/3 kbuild: introduce cmd_dtc_cpp

Quoted 21 lines · Stephen Warren
Quoted 20 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 19 lines · Stephen Warren

From: Stephen Warren <[email protected]>

cmd_dtc_cpp runs the C pre-processor on the input .dts file before passing it to dtc for final compilation. This allows used of #define within the .dts file.

---
 scripts/Makefile.lib |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
scripts/Makefile.lib +0 -0
index 0be6f11..e3a149e 100644
@@ -266,6 +266,9 @@ $(obj)/%.dtb.S: $(obj)/%.dtb
 quiet_cmd_dtc = DTC     $@
 cmd_dtc = $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -d $(depfile) $<
 
Quoted 7 lines
Quoted 4 lines

scripts/Makefile.lib $(obj)/%.dtb.S: $(obj)/%.dtb · line 270

Quoted 2 lines
scripts/Makefile.lib +2 -0
+quiet_cmd_dtc_cpp = DTC+CPP $@
+cmd_dtc_cpp = $(CC) -E -Wp,-MD,$(depfile) -xc $< | $(objtree)/scripts/dtc/dtc -O dtb -o $@ -b 0 $(DTC_FLAGS) -

this should go to Makefile.build

Hmm. Consistency with the existing cmd_dtc right above would dictate otherwise.

no build command go to Makefile.build aside with makefile target

Best Regards,
J.

#5 lore raw

RFC PATCH 2/3 ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

This allows DT source files to use the C pre-processor. A new file extension is introduced for this purpose, since use of the pre-processor must be optional; any property or node name that starts with "#" must be escaped to prevent the pre-processor attempting to interpret it as a directive. For this reason, skeleton.dtsi-cpp is introduced for *.dts-cpp to include.

---
 arch/arm/boot/Makefile              |    3 +++
 arch/arm/boot/dts/skeleton.dtsi-cpp |   13 +++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/skeleton.dtsi-cpp
arch/arm/boot/Makefile +3 -0
index 3fdab01..c5d7fca 100644
@@ -65,6 +65,9 @@ targets += $(dtb-y)
 $(obj)/%.dtb: $(src)/dts/%.dts FORCE
 	$(call if_changed_dep,dtc)
 
+$(obj)/%.dtb: $(src)/dts/%.dts-cpp FORCE
+	$(call if_changed_dep,dtc_cpp)
+
 $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
 
 clean-files := *.dtb
arch/arm/boot/dts/skeleton.dtsi-cpp new file +13 -0
new file mode 100644
index 0000000..8bf6729
@@ -0,0 +1,13 @@
+/*
+ * Skeleton device tree; the bare minimum needed to boot; just include and
+ * add a compatible value.  The bootloader will typically populate the memory
+ * node.
+ */
+
+/ {
+	\#address-cells = <1>;
+	\#size-cells = <1>;
+	chosen { };
+	aliases { };
+	memory { device_type = "memory"; reg = <0 0>; };
+};
Signature · 1 line
1.7.0.4
#6 lore raw

RFC PATCH 2/3 ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb

Quoted 21 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This allows DT source files to use the C pre-processor. A new file extension is introduced for this purpose, since use of the pre-processor must be optional; any property or node name that starts with "#" must be escaped to prevent the pre-processor attempting to interpret it as a directive. For this reason, skeleton.dtsi-cpp is introduced for *.dts-cpp to include.

---
 arch/arm/boot/Makefile              |    3 +++
 arch/arm/boot/dts/skeleton.dtsi-cpp |   13 +++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/skeleton.dtsi-cpp
arch/arm/boot/Makefile +0 -0
index 3fdab01..c5d7fca 100644

arch/arm/boot/Makefile targets += $(dtb-y) · line 70

Quoted 6 lines
arch/arm/boot/Makefile +3 -0
@@ -65,6 +65,9 @@ targets += $(dtb-y)
 $(obj)/%.dtb: $(src)/dts/%.dts FORCE
 	$(call if_changed_dep,dtc)
 
+$(obj)/%.dtb: $(src)/dts/%.dts-cpp FORCE
+	$(call if_changed_dep,dtc_cpp)
+

move this to Makefile.build so we wan use it acroos arch

Best Regards,
J.

#7 lore raw

RFC PATCH 2/3 ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb

Quoted 25 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 24 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This allows DT source files to use the C pre-processor. A new file extension is introduced for this purpose, since use of the pre-processor must be optional; any property or node name that starts with "#" must be escaped to prevent the pre-processor attempting to interpret it as a directive. For this reason, skeleton.dtsi-cpp is introduced for *.dts-cpp to include.

---
 arch/arm/boot/Makefile              |    3 +++
 arch/arm/boot/dts/skeleton.dtsi-cpp |   13 +++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/skeleton.dtsi-cpp
arch/arm/boot/Makefile +0 -0
index 3fdab01..c5d7fca 100644
@@ -65,6 +65,9 @@ targets += $(dtb-y)
 $(obj)/%.dtb: $(src)/dts/%.dts FORCE
 	$(call if_changed_dep,dtc)
 
Quoted 5 lines

arch/arm/boot/Makefile targets += $(dtb-y) · line 70

Quoted 3 lines
arch/arm/boot/Makefile +3 -0
+$(obj)/%.dtb: $(src)/dts/%.dts-cpp FORCE
+	$(call if_changed_dep,dtc_cpp)
+

move this to Makefile.build so we wan use it acroos arch

That would be an unrelated cleanup patch; the existing *.dts->*.dtb rule is not there.

#8 lore raw

RFC PATCH 3/3 ARM: tegra: compile all DT files with cpp

In reply to Stephen Warren

From: Stephen Warren <[email protected]>

We perform the minimum set of changes to convert the Tegra *.dts to compile using the C pre-processor before dtc:

* Rename all the files to trigger the new build rule.
* Escape all property names that start with a # so they aren't seen as C pre-processor directives.

---
 ...tegra20-harmony.dts => tegra20-harmony.dts-cpp} |   10 +++---
 ...medcom-wide.dts => tegra20-medcom-wide.dts-cpp} |    4 +-
 .../{tegra20-paz00.dts => tegra20-paz00.dts-cpp}   |   14 ++++----
 .../{tegra20-plutux.dts => tegra20-plutux.dts-cpp} |    4 +-
 ...gra20-seaboard.dts => tegra20-seaboard.dts-cpp} |   22 ++++++------
 ...a20-tamonten.dtsi => tegra20-tamonten.dtsi-cpp} |    8 ++--
 .../dts/{tegra20-tec.dts => tegra20-tec.dts-cpp}   |    4 +-
 ...a20-trimslice.dts => tegra20-trimslice.dts-cpp} |    2 +-
 ...tegra20-ventana.dts => tegra20-ventana.dts-cpp} |   10 +++---
 ...gra20-whistler.dts => tegra20-whistler.dts-cpp} |    8 ++--
 .../boot/dts/{tegra20.dtsi => tegra20.dtsi-cpp}    |   30 +++++++++---------
 ...0-cardhu-a02.dts => tegra30-cardhu-a02.dts-cpp} |    6 ++--
 ...0-cardhu-a04.dts => tegra30-cardhu-a04.dts-cpp} |    6 ++--
 ...tegra30-cardhu.dtsi => tegra30-cardhu.dtsi-cpp} |   12 +++---
 .../boot/dts/{tegra30.dtsi => tegra30.dtsi-cpp}    |   34 ++++++++++----------
 15 files changed, 87 insertions(+), 87 deletions(-)
 rename arch/arm/boot/dts/{tegra20-harmony.dts => tegra20-harmony.dts-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-medcom-wide.dts => tegra20-medcom-wide.dts-cpp} (95%)
 rename arch/arm/boot/dts/{tegra20-paz00.dts => tegra20-paz00.dts-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-plutux.dts => tegra20-plutux.dts-cpp} (94%)
 rename arch/arm/boot/dts/{tegra20-seaboard.dts => tegra20-seaboard.dts-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-tamonten.dtsi => tegra20-tamonten.dtsi-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-tec.dts => tegra20-tec.dts-cpp} (94%)
 rename arch/arm/boot/dts/{tegra20-trimslice.dts => tegra20-trimslice.dts-cpp} (99%)
 rename arch/arm/boot/dts/{tegra20-ventana.dts => tegra20-ventana.dts-cpp} (98%)
 rename arch/arm/boot/dts/{tegra20-whistler.dts => tegra20-whistler.dts-cpp} (99%)
 rename arch/arm/boot/dts/{tegra20.dtsi => tegra20.dtsi-cpp} (93%)
 rename arch/arm/boot/dts/{tegra30-cardhu-a02.dts => tegra30-cardhu-a02.dts-cpp} (96%)
 rename arch/arm/boot/dts/{tegra30-cardhu-a04.dts => tegra30-cardhu-a04.dts-cpp} (96%)
 rename arch/arm/boot/dts/{tegra30-cardhu.dtsi => tegra30-cardhu.dtsi-cpp} (98%)
 rename arch/arm/boot/dts/{tegra30.dtsi => tegra30.dtsi-cpp} (93%)
arch/arm/boot/dts/tegra20-harmony.dts-cpp renamed from arch/arm/boot/dts/tegra20-harmony.dts +5 -5
similarity index 98%
rename from arch/arm/boot/dts/tegra20-harmony.dts
rename to arch/arm/boot/dts/tegra20-harmony.dts-cpp
index 74b8a47..b956919 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20.dtsi"
+#include "tegra20.dtsi-cpp"
 
 / {
 	model = "NVIDIA Tegra2 Harmony evaluation board";
@@ -254,7 +254,7 @@
 			interrupts = <187 0x04>;
 
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 
 			micdet-cfg = <0>;
 			micdet-delay = <100>;
@@ -283,7 +283,7 @@
 
 			ti,system-power-controller;
 
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 			gpio-controller;
 
 			sys-supply = <&vdd_5v0_reg>;
@@ -433,8 +433,8 @@
 
 	regulators {
 		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		vdd_5v0_reg: regulator at 0 {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra20-medcom-wide.dts-cpp renamed from arch/arm/boot/dts/tegra20-medcom-wide.dts +2 -2
similarity index 95%
rename from arch/arm/boot/dts/tegra20-medcom-wide.dts
rename to arch/arm/boot/dts/tegra20-medcom-wide.dts-cpp
index a2d6d65..087c547 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20-tamonten.dtsi"
+#include "tegra20-tamonten.dtsi-cpp"
 
 / {
 	model = "Avionic Design Medcom-Wide board";
@@ -14,7 +14,7 @@
 			interrupts = <187 0x04>;
 
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 
 			micdet-cfg = <0>;
 			micdet-delay = <100>;
arch/arm/boot/dts/tegra20-paz00.dts-cpp renamed from arch/arm/boot/dts/tegra20-paz00.dts +7 -7
similarity index 98%
rename from arch/arm/boot/dts/tegra20-paz00.dts
rename to arch/arm/boot/dts/tegra20-paz00.dts-cpp
index 6a93d14..9df43c0 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20.dtsi"
+#include "tegra20.dtsi-cpp"
 
 / {
 	model = "Toshiba AC100 / Dynabook AZ";
@@ -248,7 +248,7 @@
 			compatible = "realtek,alc5632";
 			reg = <0x1e>;
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 		};
 	};
 
@@ -261,8 +261,8 @@
 		compatible = "nvidia,nvec";
 		reg = <0x7000c500 0x100>;
 		interrupts = <0 92 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		clock-frequency = <80000>;
 		request-gpios = <&gpio 170 0>; /* gpio PV2 */
 		slave-addr = <138>;
@@ -277,7 +277,7 @@
 			reg = <0x34>;
 			interrupts = <0 86 0x4>;
 
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 			gpio-controller;
 
 			sys-supply = <&p5valw_reg>;
@@ -454,8 +454,8 @@
 
 	regulators {
 		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		p5valw_reg: regulator at 0 {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra20-plutux.dts-cpp renamed from arch/arm/boot/dts/tegra20-plutux.dts +2 -2
similarity index 94%
rename from arch/arm/boot/dts/tegra20-plutux.dts
rename to arch/arm/boot/dts/tegra20-plutux.dts-cpp
index 331a3ef..67045ab 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20-tamonten.dtsi"
+#include "tegra20-tamonten.dtsi-cpp"
 
 / {
 	model = "Avionic Design Plutux board";
@@ -14,7 +14,7 @@
 			interrupts = <187 0x04>;
 
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 
 			micdet-cfg = <0>;
 			micdet-delay = <100>;
arch/arm/boot/dts/tegra20-seaboard.dts-cpp renamed from arch/arm/boot/dts/tegra20-seaboard.dts +11 -11
similarity index 98%
rename from arch/arm/boot/dts/tegra20-seaboard.dts
rename to arch/arm/boot/dts/tegra20-seaboard.dts-cpp
index 33ae813..2f7f039 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20.dtsi"
+#include "tegra20.dtsi-cpp"
 
 / {
 	model = "NVIDIA Seaboard";
@@ -305,7 +305,7 @@
 			interrupts = <187 0x04>;
 
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 
 			micdet-cfg = <0>;
 			micdet-delay = <100>;
@@ -335,8 +335,8 @@
 
 	i2cmux {
 		compatible = "i2c-mux-pinctrl";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		i2c-parent = <&{/i2c@7000c400}>;
 
@@ -347,14 +347,14 @@
 
 		i2c at 0 {
 			reg = <0>;
-			#address-cells = <1>;
-			#size-cells = <0>;
+			\#address-cells = <1>;
+			\#size-cells = <0>;
 		};
 
 		i2c at 1 {
 			reg = <1>;
-			#address-cells = <1>;
-			#size-cells = <0>;
+			\#address-cells = <1>;
+			\#size-cells = <0>;
 
 			smart-battery at b {
 				compatible = "ti,bq20z75", "smart-battery-1.1";
@@ -381,7 +381,7 @@
 
 			ti,system-power-controller;
 
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 			gpio-controller;
 
 			sys-supply = <&vdd_5v0_reg>;
@@ -596,8 +596,8 @@
 
 	regulators {
 		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		vdd_5v0_reg: regulator at 0 {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra20-tamonten.dtsi-cpp renamed from arch/arm/boot/dts/tegra20-tamonten.dtsi +4 -4
similarity index 98%
rename from arch/arm/boot/dts/tegra20-tamonten.dtsi
rename to arch/arm/boot/dts/tegra20-tamonten.dtsi-cpp
index 5b3d8b1..2e964f0 100644
@@ -1,4 +1,4 @@
-/include/ "tegra20.dtsi"
+#include "tegra20.dtsi-cpp"
 
 / {
 	model = "Avionic Design Tamonten SOM";
@@ -257,7 +257,7 @@
 
 			ti,system-power-controller;
 
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 			gpio-controller;
 
 			sys-supply = <&vdd_5v0_reg>;
@@ -401,8 +401,8 @@
 	regulators {
 		compatible = "simple-bus";
 
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		vdd_5v0_reg: regulator at 0 {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra20-tec.dts-cpp renamed from arch/arm/boot/dts/tegra20-tec.dts +2 -2
similarity index 94%
rename from arch/arm/boot/dts/tegra20-tec.dts
rename to arch/arm/boot/dts/tegra20-tec.dts-cpp
index 9aff31b..a84ac4d 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20-tamonten.dtsi"
+#include "tegra20-tamonten.dtsi-cpp"
 
 / {
 	model = "Avionic Design Tamonten Evaluation Carrier";
@@ -17,7 +17,7 @@
 			interrupts = <187 0x04>;
 
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 
 			micdet-cfg = <0>;
 			micdet-delay = <100>;
arch/arm/boot/dts/tegra20-trimslice.dts-cpp renamed from arch/arm/boot/dts/tegra20-trimslice.dts +1 -1
similarity index 99%
rename from arch/arm/boot/dts/tegra20-trimslice.dts
rename to arch/arm/boot/dts/tegra20-trimslice.dts-cpp
index 27fb8a6..de0bef8 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20.dtsi"
+#include "tegra20.dtsi-cpp"
 
 / {
 	model = "Compulab TrimSlice board";
arch/arm/boot/dts/tegra20-ventana.dts-cpp renamed from arch/arm/boot/dts/tegra20-ventana.dts +5 -5
similarity index 98%
rename from arch/arm/boot/dts/tegra20-ventana.dts
rename to arch/arm/boot/dts/tegra20-ventana.dts-cpp
index 86854f1..6cff59d 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20.dtsi"
+#include "tegra20.dtsi-cpp"
 
 / {
 	model = "NVIDIA Tegra2 Ventana evaluation board";
@@ -260,7 +260,7 @@
 			interrupts = <187 0x04>;
 
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 
 			micdet-cfg = <0>;
 			micdet-delay = <100>;
@@ -297,7 +297,7 @@
 
 			ti,system-power-controller;
 
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 			gpio-controller;
 
 			sys-supply = <&vdd_5v0_reg>;
@@ -440,8 +440,8 @@
 
 	regulators {
 		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		vdd_5v0_reg: regulator at 0 {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra20-whistler.dts-cpp renamed from arch/arm/boot/dts/tegra20-whistler.dts +4 -4
similarity index 99%
rename from arch/arm/boot/dts/tegra20-whistler.dts
rename to arch/arm/boot/dts/tegra20-whistler.dts-cpp
index 94a71c9..8657151 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra20.dtsi"
+#include "tegra20.dtsi-cpp"
 
 / {
 	model = "NVIDIA Tegra2 Whistler evaluation board";
@@ -259,7 +259,7 @@
 			compatible = "ti,tca6416";
 			reg = <0x20>;
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 		};
 
 		max8907 at 3c {
@@ -505,8 +505,8 @@
 
 	regulators {
 		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		usb0_vbus_reg: regulator {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra20.dtsi-cpp renamed from arch/arm/boot/dts/tegra20.dtsi +15 -15
similarity index 93%
rename from arch/arm/boot/dts/tegra20.dtsi
rename to arch/arm/boot/dts/tegra20.dtsi-cpp
index 6934bca..729d0f6 100644
@@ -1,4 +1,4 @@
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi-cpp"
 
 / {
 	compatible = "nvidia,tegra20";
@@ -15,7 +15,7 @@
 		reg = <0x50041000 0x1000
 		       0x50040100 0x0100>;
 		interrupt-controller;
-		#interrupt-cells = <3>;
+		\#interrupt-cells = <3>;
 	};
 
 	timer at 60005000 {
@@ -63,9 +63,9 @@
 			      0 55 0x04
 			      0 87 0x04
 			      0 89 0x04>;
-		#gpio-cells = <2>;
+		\#gpio-cells = <2>;
 		gpio-controller;
-		#interrupt-cells = <2>;
+		\#interrupt-cells = <2>;
 		interrupt-controller;
 	};
 
@@ -141,7 +141,7 @@
 	pwm: pwm {
 		compatible = "nvidia,tegra20-pwm";
 		reg = <0x7000a000 0x100>;
-		#pwm-cells = <2>;
+		\#pwm-cells = <2>;
 	};
 
 	rtc {
@@ -154,8 +154,8 @@
 		compatible = "nvidia,tegra20-i2c";
 		reg = <0x7000c000 0x100>;
 		interrupts = <0 38 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -163,8 +163,8 @@
 		compatible = "nvidia,tegra20-i2c";
 		reg = <0x7000c400 0x100>;
 		interrupts = <0 84 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -172,8 +172,8 @@
 		compatible = "nvidia,tegra20-i2c";
 		reg = <0x7000c500 0x100>;
 		interrupts = <0 92 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -181,8 +181,8 @@
 		compatible = "nvidia,tegra20-i2c-dvc";
 		reg = <0x7000d000 0x200>;
 		interrupts = <0 53 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -207,8 +207,8 @@
 	memory-controller at 7000f400 {
 		compatible = "nvidia,tegra20-emc";
 		reg = <0x7000f400 0x200>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 	};
 
 	usb at c5000000 {
arch/arm/boot/dts/tegra30-cardhu-a02.dts-cpp renamed from arch/arm/boot/dts/tegra30-cardhu-a02.dts +3 -3
similarity index 96%
rename from arch/arm/boot/dts/tegra30-cardhu-a02.dts
rename to arch/arm/boot/dts/tegra30-cardhu-a02.dts-cpp
index dd4222f..e5285c8 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra30-cardhu.dtsi"
+#include "tegra30-cardhu.dtsi-cpp"
 
 /* This dts file support the cardhu A02 version of board */
 
@@ -10,8 +10,8 @@
 
 	regulators {
 		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		ddr_reg: regulator at 100 {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra30-cardhu-a04.dts-cpp renamed from arch/arm/boot/dts/tegra30-cardhu-a04.dts +3 -3
similarity index 96%
rename from arch/arm/boot/dts/tegra30-cardhu-a04.dts
rename to arch/arm/boot/dts/tegra30-cardhu-a04.dts-cpp
index 0828f09..2f10bfb 100644
@@ -1,6 +1,6 @@
 /dts-v1/;
 
-/include/ "tegra30-cardhu.dtsi"
+#include "tegra30-cardhu.dtsi-cpp"
 
 /* This dts file support the cardhu A04 and later versions of board */
 
@@ -10,8 +10,8 @@
 
 	regulators {
 		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		ddr_reg: regulator at 100 {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra30-cardhu.dtsi-cpp renamed from arch/arm/boot/dts/tegra30-cardhu.dtsi +6 -6
similarity index 98%
rename from arch/arm/boot/dts/tegra30-cardhu.dtsi
rename to arch/arm/boot/dts/tegra30-cardhu.dtsi-cpp
index b1271a8..45017b3 100644
@@ -1,4 +1,4 @@
-/include/ "tegra30.dtsi"
+#include "tegra30.dtsi-cpp"
 
 /**
  * This file contains common DT entry for all fab version of Cardhu.
@@ -128,7 +128,7 @@
 			interrupts = <179 0x04>; /* gpio PW3 */
 
 			gpio-controller;
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 
 			micdet-cfg = <0>;
 			micdet-delay = <100>;
@@ -153,12 +153,12 @@
 			reg = <0x2d>;
 
 			interrupts = <0 86 0x4>;
-			#interrupt-cells = <2>;
+			\#interrupt-cells = <2>;
 			interrupt-controller;
 
 			ti,system-power-controller;
 
-			#gpio-cells = <2>;
+			\#gpio-cells = <2>;
 			gpio-controller;
 
 			vcc1-supply = <&vdd_ac_bat_reg>;
@@ -276,8 +276,8 @@
 
 	regulators {
 		compatible = "simple-bus";
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 
 		vdd_ac_bat_reg: regulator at 0 {
 			compatible = "regulator-fixed";
arch/arm/boot/dts/tegra30.dtsi-cpp renamed from arch/arm/boot/dts/tegra30.dtsi +17 -17
similarity index 93%
rename from arch/arm/boot/dts/tegra30.dtsi
rename to arch/arm/boot/dts/tegra30.dtsi-cpp
index 81f5df4..6f44e59 100644
@@ -1,4 +1,4 @@
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi-cpp"
 
 / {
 	compatible = "nvidia,tegra30";
@@ -15,7 +15,7 @@
 		reg = <0x50041000 0x1000
 		       0x50040100 0x0100>;
 		interrupt-controller;
-		#interrupt-cells = <3>;
+		\#interrupt-cells = <3>;
 	};
 
 	timer at 60005000 {
@@ -82,9 +82,9 @@
 			      0 87 0x04
 			      0 89 0x04
 			      0 125 0x04>;
-		#gpio-cells = <2>;
+		\#gpio-cells = <2>;
 		gpio-controller;
-		#interrupt-cells = <2>;
+		\#interrupt-cells = <2>;
 		interrupt-controller;
 	};
 
@@ -137,7 +137,7 @@
 	pwm: pwm {
 		compatible = "nvidia,tegra30-pwm", "nvidia,tegra20-pwm";
 		reg = <0x7000a000 0x100>;
-		#pwm-cells = <2>;
+		\#pwm-cells = <2>;
 	};
 
 	rtc {
@@ -150,8 +150,8 @@
 		compatible =  "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
 		reg = <0x7000c000 0x100>;
 		interrupts = <0 38 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -159,8 +159,8 @@
 		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
 		reg = <0x7000c400 0x100>;
 		interrupts = <0 84 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -168,8 +168,8 @@
 		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
 		reg = <0x7000c500 0x100>;
 		interrupts = <0 92 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -177,8 +177,8 @@
 		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
 		reg = <0x7000c700 0x100>;
 		interrupts = <0 120 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -186,8 +186,8 @@
 		compatible = "nvidia,tegra30-i2c", "nvidia,tegra20-i2c";
 		reg = <0x7000d000 0x100>;
 		interrupts = <0 53 0x04>;
-		#address-cells = <1>;
-		#size-cells = <0>;
+		\#address-cells = <1>;
+		\#size-cells = <0>;
 		status = "disabled";
 	};
 
@@ -223,8 +223,8 @@
 		nvidia,dma-request-selector = <&apbdma 1>;
 
 		ranges;
-		#address-cells = <1>;
-		#size-cells = <1>;
+		\#address-cells = <1>;
+		\#size-cells = <1>;
 
 		tegra_i2s0: i2s at 70080300 {
 			compatible = "nvidia,tegra30-i2s";
Signature · 1 line
1.7.0.4
#9 lore raw

cover ARM: use C pre-processor with dtc

In reply to Stephen Warren
Quoted 14 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This series adds some build rules to run cpp on *.dts-cpp prior to invoking dtc, and converts Tegra to the new rule as an example. What do
people think?

I assume that you've applied the dtc patches I sent yesterday. They aren't in this series. See:

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020182.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020183.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020181.html

Quoted 8 lines

Note: those patches are against upstream dtc. If you wish to test this series, apply the dtc patches to upstream dtc, build it, and copy the resultant dtc binary over the top of scripts/dtc/dtc.

Stephen Warren (3):
kbuild: introduce cmd_dtc_cpp
ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb
ARM: tegra: compile all DT files with cpp

Do you have an example of where you'd actually benefit from this? I'd think most things could either be done reasonably well with what's built into DTC (see what we've done in arch/powerpc/boot/dts/fsl), or would need math expression support in DTC (or has that been added?).

-Scott

#10 lore raw

cover ARM: use C pre-processor with dtc

Quoted 5 lines · Scott Wood

Do you have an example of where you'd actually benefit from this? I'd think most things could either be done reasonably well with what's built into DTC (see what we've done in arch/powerpc/boot/dts/fsl), or would need math expression support in DTC (or has that been added?).

The constant example is the magic numbers we need to embed into DTs for things like interrupt modes, making them human readable would be a real win.

#11 lore raw

cover ARM: use C pre-processor with dtc

Quoted 8 lines · Mark Brown
Quoted 5 lines · Scott Wood

Do you have an example of where you'd actually benefit from this? I'd think most things could either be done reasonably well with what's built into DTC (see what we've done in arch/powerpc/boot/dts/fsl), or would need math expression support in DTC (or has that been added?).

Quoted 5 lines

The constant example is the magic numbers we need to embed into DTs for
things like interrupt modes, making them human readable would be a real
win.

Wasn't there a patch for named constant support in dtc a while back? Hmm:
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-January/011184.html

I'm not sure that going down the CPP path is better than the possibility of named constants having a different syntax from macros/functions. It would be one thing if someone were actively working on the latter, but this paralysis seems to be a case of the perfect being the enemy of the good.

-Scott

#12 lore raw

cover ARM: use C pre-processor with dtc

Quoted 8 lines · Scott Wood
Quoted 5 lines · Mark Brown

The constant example is the magic numbers we need to embed into DTs for
things like interrupt modes, making them human readable would be a real
win.

Quoted 8 lines

Wasn't there a patch for named constant support in dtc a while back?
Hmm: https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-January/011184.html

I'm not sure that going down the CPP path is better than the possibility of named constants having a different syntax from macros/functions. It would be one thing if someone were actively working on the latter, but this paralysis seems to be a case of the perfect being the enemy of the good.

I don't know, it doesn't appear to have been integrated (and we still need to be able to or things together).

#13 lore raw

cover ARM: use C pre-processor with dtc

In reply to Scott Wood
Quoted 9 lines · Scott Wood
Quoted 8 lines · Mark Brown
Quoted 5 lines · Scott Wood

Do you have an example of where you'd actually benefit from this? I'd think most things could either be done reasonably well with what's built into DTC (see what we've done in arch/powerpc/boot/dts/fsl), or would need math expression support in DTC (or has that been added?).

Quoted 7 lines
Quoted 3 lines

The constant example is the magic numbers we need to embed into DTs for things like interrupt modes, making them human readable would be a real win.

Wasn't there a patch for named constant support in dtc a while back? Hmm:
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-January/011184.html

Yes. There has basically been zero traction on that front. I'm trying to push a scheme that requires minimal changes to dtc itself in the hope that will move /something/ forward at greater than zero speed.

Quoted 2 lines

I'm not sure that going down the CPP path is better than the possibility of named constants having a different syntax from macros/functions.

I've come around to thinking that using something external to dtc is actually very advantageous. The main benefit here is that a C-syntax (well, cpp-syntax) header file can be included by both DT code and C code, and hence there's no need to duplicate the constant definitions. Equally, this way, anyone is free to go ahead and use whatever tools they want for the pre-processing; as long as a valid DT comes out the end of it, dtc can eat it. This gives us flexibility to change solutions without having to change dtc. Plus, we don't all have to be language-lawyers and invent yet another language inside dtc; all the parts are already written for us, except for a tiny amount of glue.

#14 lore raw

cover ARM: use C pre-processor with dtc

In reply to Scott Wood
Quoted 26 lines · Scott Wood
Quoted 16 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This series adds some build rules to run cpp on *.dts-cpp prior to invoking dtc, and converts Tegra to the new rule as an example. What do people think?

I assume that you've applied the dtc patches I sent yesterday. They aren't in this series. See:

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020182.html

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020183.html

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020181.html

Quoted 8 lines

Note: those patches are against upstream dtc. If you wish to test this series, apply the dtc patches to upstream dtc, build it, and copy the resultant dtc binary over the top of scripts/dtc/dtc.

Stephen Warren (3):
kbuild: introduce cmd_dtc_cpp
ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb
ARM: tegra: compile all DT files with cpp

Quoted 4 lines

Do you have an example of where you'd actually benefit from this? I'd think most things could either be done reasonably well with what's built into DTC (see what we've done in arch/powerpc/boot/dts/fsl), or would need math expression support in DTC (or has that been added?).

Yes, support for basic integer math in cell values has indeed been recently added to upstream dtc. I don't believe this has been ported into the in-kernel dtc yet though.

The primary motivation here is probably naming constants and associated readability. For example, instead of:

nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */

You could write:

nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO_PV1 0>;

No more opaque numbers!

Equally, a number of recent bindings have tended towards using strings rather than integers solely in order to make the DT readable without having to know 10000 numbers off the top of your head:

pinmux {
...

    state_default: pinmux {
...
        atb {
            nvidia,pins = "atb", "gma", "gme";
            nvidia,function = "sdio4";

could be:

    state_default: pinmux {
...
        atb {
            nvidia,pins = <TEGRA_PIN_ATB, TEGRA_PIN_GMA, TEGRA_PIN_GME>;
            nvidia,function = <TEGRA_FUNCTION_SDIO4>;

This would improve parsing speed (eliminate strcmps), perhaps reduce DT size (assuming average string length > 4 characters), eliminate the possibility of typos in strings, and allow .dts and drivers to include the same header file to define those constants, thus guaranteeing they be in sync.

Equally, there has been some discussion of using named constants with the math expression feature e.g.:

interrupts = <0 104 0x03>;

could be:

interrupts = <BANK_FOO INT_GPIO5 (INT_EDGE_RISING | INT_EDGE_FALLING)>;

I believe many many users of this feature would come out of the woodwork once it's available.

#15 lore raw

cover ARM: use C pre-processor with dtc

Quoted 14 lines · Stephen Warren
Quoted 5 lines · Scott Wood

Do you have an example of where you'd actually benefit from this? I'd think most things could either be done reasonably well with what's built into DTC (see what we've done in arch/powerpc/boot/dts/fsl), or would need math expression support in DTC (or has that been added?).

Yes, support for basic integer math in cell values has indeed been recently added to upstream dtc. I don't believe this has been ported into the in-kernel dtc yet though.

The primary motivation here is probably naming constants and associated readability. For example, instead of:

Quoted 7 lines

nvidia,phy-reset-gpio = <&gpio 169 0>; /* gpio PV1 */

You could write:

nvidia,phy-reset-gpio = <&gpio TEGRA_GPIO_PV1 0>;

No more opaque numbers!

This would be nice indeed.

Regards,

Tony

#16 lore raw

cover ARM: use C pre-processor with dtc

In reply to Stephen Warren
Quoted 13 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This series adds some build rules to run cpp on *.dts-cpp prior to invoking dtc, and converts Tegra to the new rule as an example. What do people think?

I assume that you've applied the dtc patches I sent yesterday. They aren't in this series. See:

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020182.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020183.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020181.html

Quoted 8 lines

Note: those patches are against upstream dtc. If you wish to test this series, apply the dtc patches to upstream dtc, build it, and copy the resultant dtc binary over the top of scripts/dtc/dtc.

Stephen Warren (3):
kbuild: introduce cmd_dtc_cpp
ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb
ARM: tegra: compile all DT files with cpp

I do not like the extention

can we run gcc everytime?

or just do as done for lds

*.dts.S

Best Regards,
J.

#17 lore raw

cover ARM: use C pre-processor with dtc

Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This series adds some build rules to run cpp on *.dts-cpp prior to invoking dtc, and converts Tegra to the new rule as an example. What do people think?

I assume that you've applied the dtc patches I sent yesterday. They aren't in this series. See:

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020182.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020183.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020181.html

Note: those patches are against upstream dtc. If you wish to test this series, apply the dtc patches to upstream dtc, build it, and copy the resultant dtc binary over the top of scripts/dtc/dtc.

Quoted 6 lines
Quoted 4 lines

Stephen Warren (3):
kbuild: introduce cmd_dtc_cpp
ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb
ARM: tegra: compile all DT files with cpp

I do not like the extention

It is a bit unwieldy. Perhaps *.dtsp, *.dtsip would be better.

Quoted 1 line

can we run gcc everytime?

Not without editing all the device tree files; any property (or node) name the starts with a # must be escaped; changed from "#foo" to "\#foo" to avoid cpp attempting to interpret it as a pre-processor directive.

Quoted 3 lines

or just do as done for lds

*.dts.S

.S means assembly. (that's why I went with .dts-cpp rather than .dts.cpp).

#18 lore raw

cover ARM: use C pre-processor with dtc

Quoted 34 lines · Stephen Warren
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Stephen Warren

From: Stephen Warren <[email protected]>

This series adds some build rules to run cpp on *.dts-cpp prior to invoking dtc, and converts Tegra to the new rule as an example. What do people think?

I assume that you've applied the dtc patches I sent yesterday. They aren't in this series. See:

https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020182.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020183.html
https://lists.ozlabs.org/pipermail/devicetree-discuss/2012-September/020181.html

Note: those patches are against upstream dtc. If you wish to test this series, apply the dtc patches to upstream dtc, build it, and copy the resultant dtc binary over the top of scripts/dtc/dtc.

Quoted 6 lines
Quoted 4 lines

Stephen Warren (3):
kbuild: introduce cmd_dtc_cpp
ARM: use cmd_dtc_cpp for compilation of *.dts-cpp to *.dtb
ARM: tegra: compile all DT files with cpp

I do not like the extention

It is a bit unwieldy. Perhaps *.dtsp, *.dtsip would be better.

Quoted 1 line

can we run gcc everytime?

Not without editing all the device tree files; any property (or node) name the starts with a # must be escaped; changed from "#foo" to "\#foo" to avoid cpp attempting to interpret it as a pre-processor directive.

Quoted 5 lines
Quoted 3 lines

or just do as done for lds

*.dts.S

.S means assembly. (that's why I went with .dts-cpp rather than .dts.cpp).

on lds we do this way lds.S => lds

Best Regards,
J.