Skip to contentSkip to conversation

ARM: dts: OMAP2+: use preprocessor for device trees

PATCH Superseded Florian Vaussard 3 participants 15 messages May 22, 2013

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover ARM: dts: OMAP2+: use preprocessor for device trees

Hello,

Following a similar proposal by Stephen Warren for tegra [1], this series makes use of the C preprocessor when compiling OMAP DT files, and accomplishes some improvements to improve overall readability.

Patch 2 creates a header file to define the OMAP_GPIO() macro, used by patch 3 to make GPIOs more readable.
Likewise patch 5 uses the existing constants to make IRQs more readable. Patch 4 is a small random fix.

This series was boot-tested on omap3-tobi. For other targets, the decompiled .dtb were diff'ed before and after applying the series to guarantee identity.

Best regards,

Florian

[1] https://patchwork.kernel.org/patch/2560091/

Florian Vaussard (5):
ARM: dts: OMAP2+: use #include for all device trees
ARM: dts: OMAP2+: create a DT header for GPIO
ARM: dts: OMAP2+: convert DT files to use the new OMAP_GPIO macro
ARM: dts: OMAP3: fix incorrect notation for musb-hdrc interrupt
ARM: dts: OMAP4/5: use existing constants for IRQs

 arch/arm/boot/dts/omap2.dtsi              |    4 +-
 arch/arm/boot/dts/omap2420-h4.dts         |    2 +-
 arch/arm/boot/dts/omap2420.dtsi           |    2 +-
 arch/arm/boot/dts/omap2430.dtsi           |    2 +-
 arch/arm/boot/dts/omap3-beagle-xm.dts     |    8 +-
 arch/arm/boot/dts/omap3-beagle.dts        |   10 +-
 arch/arm/boot/dts/omap3-devkit8000.dts    |   10 +-
 arch/arm/boot/dts/omap3-evm.dts           |    4 +-
 arch/arm/boot/dts/omap3-igep.dtsi         |    4 +-
 arch/arm/boot/dts/omap3-igep0020.dts      |    8 +-
 arch/arm/boot/dts/omap3-igep0030.dts      |    4 +-
 arch/arm/boot/dts/omap3-overo.dtsi        |    4 +-
 arch/arm/boot/dts/omap3-tobi.dts          |    4 +-
 arch/arm/boot/dts/omap3.dtsi              |    6 +-
 arch/arm/boot/dts/omap3430-sdp.dts        |    4 +-
 arch/arm/boot/dts/omap34xx.dtsi           |    2 +-
 arch/arm/boot/dts/omap36xx.dtsi           |    2 +-
 arch/arm/boot/dts/omap4-panda-a4.dts      |    4 +-
 arch/arm/boot/dts/omap4-panda-common.dtsi |   18 +-
 arch/arm/boot/dts/omap4-panda-es.dts      |    4 +-
 arch/arm/boot/dts/omap4-panda.dts         |    4 +-
 arch/arm/boot/dts/omap4-sdp-es23plus.dts  |    2 +-
 arch/arm/boot/dts/omap4-sdp.dts           |   32 ++--
 arch/arm/boot/dts/omap4-var-som.dts       |    8 +-
 arch/arm/boot/dts/omap4.dtsi              |  117 ++++++------
 arch/arm/boot/dts/omap443x.dtsi           |    2 +-
 arch/arm/boot/dts/omap4460.dtsi           |    6 +-
 arch/arm/boot/dts/omap5-evm.dts           |    4 +-
 arch/arm/boot/dts/omap5.dtsi              |  125 +++++++------
 include/dt-bindings/gpio/omap-gpio.h      |  289 +++++++++++++++++++++++++++++
 30 files changed, 497 insertions(+), 198 deletions(-)
 create mode 100644 include/dt-bindings/gpio/omap-gpio.h
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/5 ARM: dts: OMAP2+: use #include for all device trees

Replace /include/ by #include for OMAP2+ DT, in order to use the C pre-processor, making use of #define features possible.

---
 arch/arm/boot/dts/omap2.dtsi              |    2 +-
 arch/arm/boot/dts/omap2420-h4.dts         |    2 +-
 arch/arm/boot/dts/omap2420.dtsi           |    2 +-
 arch/arm/boot/dts/omap2430.dtsi           |    2 +-
 arch/arm/boot/dts/omap3-beagle-xm.dts     |    4 ++--
 arch/arm/boot/dts/omap3-beagle.dts        |    4 ++--
 arch/arm/boot/dts/omap3-devkit8000.dts    |    4 ++--
 arch/arm/boot/dts/omap3-evm.dts           |    4 ++--
 arch/arm/boot/dts/omap3-igep.dtsi         |    4 ++--
 arch/arm/boot/dts/omap3-igep0020.dts      |    2 +-
 arch/arm/boot/dts/omap3-igep0030.dts      |    2 +-
 arch/arm/boot/dts/omap3-overo.dtsi        |    4 ++--
 arch/arm/boot/dts/omap3-tobi.dts          |    2 +-
 arch/arm/boot/dts/omap3.dtsi              |    2 +-
 arch/arm/boot/dts/omap3430-sdp.dts        |    4 ++--
 arch/arm/boot/dts/omap34xx.dtsi           |    2 +-
 arch/arm/boot/dts/omap36xx.dtsi           |    2 +-
 arch/arm/boot/dts/omap4-panda-a4.dts      |    4 ++--
 arch/arm/boot/dts/omap4-panda-common.dtsi |    4 ++--
 arch/arm/boot/dts/omap4-panda-es.dts      |    4 ++--
 arch/arm/boot/dts/omap4-panda.dts         |    4 ++--
 arch/arm/boot/dts/omap4-sdp-es23plus.dts  |    2 +-
 arch/arm/boot/dts/omap4-sdp.dts           |    6 +++---
 arch/arm/boot/dts/omap4-var-som.dts       |    4 ++--
 arch/arm/boot/dts/omap4.dtsi              |    2 +-
 arch/arm/boot/dts/omap443x.dtsi           |    2 +-
 arch/arm/boot/dts/omap4460.dtsi           |    2 +-
 arch/arm/boot/dts/omap5-evm.dts           |    4 ++--
 arch/arm/boot/dts/omap5.dtsi              |    2 +-
 29 files changed, 44 insertions(+), 44 deletions(-)
arch/arm/boot/dts/omap2.dtsi +1 -1
index 37aa748..e6e4587 100644
@@ -8,7 +8,7 @@
  * kind, whether express or implied.
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	compatible = "ti,omap2430", "ti,omap2420", "ti,omap2";
arch/arm/boot/dts/omap2420-h4.dts +1 -1
index 68282ee..224c08f 100644
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-/include/ "omap2420.dtsi"
+#include "omap2420.dtsi"
 
 / {
 	model = "TI OMAP2420 H4 board";
arch/arm/boot/dts/omap2420.dtsi +1 -1
index da5b285..c8f9c55 100644
@@ -8,7 +8,7 @@
  * kind, whether express or implied.
  */
 
-/include/ "omap2.dtsi"
+#include "omap2.dtsi"
 
 / {
 	compatible = "ti,omap2420", "ti,omap2";
arch/arm/boot/dts/omap2430.dtsi +1 -1
index 054bc44..c535a5a 100644
@@ -8,7 +8,7 @@
  * kind, whether express or implied.
  */
 
-/include/ "omap2.dtsi"
+#include "omap2.dtsi"
 
 / {
 	compatible = "ti,omap2430", "ti,omap2";
arch/arm/boot/dts/omap3-beagle-xm.dts +2 -2
index 3046d1f..e0ce823 100644
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-/include/ "omap36xx.dtsi"
+#include "omap36xx.dtsi"
 
 / {
 	model = "TI OMAP3 BeagleBoard xM";
@@ -75,7 +75,7 @@
 	};
 };
 
-/include/ "twl4030.dtsi"
+#include "twl4030.dtsi"
 
 &i2c2 {
 	clock-frequency = <400000>;
arch/arm/boot/dts/omap3-beagle.dts +2 -2
index 6eec699..fcac96a 100644
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-/include/ "omap34xx.dtsi"
+#include "omap34xx.dtsi"
 
 / {
 	model = "TI OMAP3 BeagleBoard";
@@ -107,7 +107,7 @@
 	};
 };
 
-/include/ "twl4030.dtsi"
+#include "twl4030.dtsi"
 
 &mmc1 {
 	vmmc-supply = <&vmmc1>;
arch/arm/boot/dts/omap3-devkit8000.dts +2 -2
index 8a5cdcc..8d0f5e4 100644
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-/include/ "omap34xx.dtsi"
+#include "omap34xx.dtsi"
 / {
 	model = "TimLL OMAP3 Devkit8000";
 	compatible = "timll,omap3-devkit8000", "ti,omap3";
@@ -80,7 +80,7 @@
 	status = "disabled";
 };
 
-/include/ "twl4030.dtsi"
+#include "twl4030.dtsi"
 
 &mmc1 {
 	vmmc-supply = <&vmmc1>;
arch/arm/boot/dts/omap3-evm.dts +2 -2
index 96d1c20..d75759b 100644
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-/include/ "omap34xx.dtsi"
+#include "omap34xx.dtsi"
 
 / {
 	model = "TI OMAP3 EVM (OMAP3530, AM/DM37x)";
@@ -44,7 +44,7 @@
 	};
 };
 
-/include/ "twl4030.dtsi"
+#include "twl4030.dtsi"
 
 &i2c2 {
 	clock-frequency = <400000>;
arch/arm/boot/dts/omap3-igep.dtsi +2 -2
index f8fe3b7..54588b0 100644
@@ -10,7 +10,7 @@
  */
 /dts-v1/;
 
-/include/ "omap34xx.dtsi"
+#include "omap34xx.dtsi"
 
 / {
 	memory {
@@ -80,7 +80,7 @@
 	};
 };
 
-/include/ "twl4030.dtsi"
+#include "twl4030.dtsi"
 
 &i2c2 {
 	clock-frequency = <400000>;
arch/arm/boot/dts/omap3-igep0020.dts +1 -1
index e2b9849..2f96a5c 100644
@@ -9,7 +9,7 @@
  * published by the Free Software Foundation.
  */
 
-/include/ "omap3-igep.dtsi"
+#include "omap3-igep.dtsi"
 
 / {
 	model = "IGEPv2";
arch/arm/boot/dts/omap3-igep0030.dts +1 -1
index 9dc48d2..f3a1bf0 100644
@@ -9,7 +9,7 @@
  * published by the Free Software Foundation.
  */
 
-/include/ "omap3-igep.dtsi"
+#include "omap3-igep.dtsi"
 
 / {
 	model = "IGEP COM Module";
arch/arm/boot/dts/omap3-overo.dtsi +2 -2
index a626c50..e112a42 100644
@@ -11,7 +11,7 @@
  */
 /dts-v1/;
 
-/include/ "omap34xx.dtsi"
+#include "omap34xx.dtsi"
 
 / {
 	pwmleds {
@@ -49,7 +49,7 @@
 	};
 };
 
-/include/ "twl4030.dtsi"
+#include "twl4030.dtsi"
 
 /* i2c2 pins are used for gpio */
 &i2c2 {
arch/arm/boot/dts/omap3-tobi.dts +1 -1
index a13d12d..5df894f 100644
@@ -10,7 +10,7 @@
  * Tobi expansion board is manufactured by Gumstix Inc.
  */
 
-/include/ "omap3-overo.dtsi"
+#include "omap3-overo.dtsi"
 
 / {
 	model = "TI OMAP3 Gumstix Overo on Tobi";
arch/arm/boot/dts/omap3.dtsi +1 -1
index 82a404d..7c7d494 100644
@@ -8,7 +8,7 @@
  * kind, whether express or implied.
  */
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	compatible = "ti,omap3430", "ti,omap3";
arch/arm/boot/dts/omap3430-sdp.dts +2 -2
index 144ae43..2a725a0 100644
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-/include/ "omap34xx.dtsi"
+#include "omap34xx.dtsi"
 
 / {
 	model = "TI OMAP3430 SDP";
@@ -28,7 +28,7 @@
 	};
 };
 
-/include/ "twl4030.dtsi"
+#include "twl4030.dtsi"
 
 &mmc1 {
 	vmmc-supply = <&vmmc1>;
arch/arm/boot/dts/omap34xx.dtsi +1 -1
index 75ed4ae..5355d61 100644
@@ -8,7 +8,7 @@
  * kind, whether express or implied.
  */
 
-/include/ "omap3.dtsi"
+#include "omap3.dtsi"
 
 / {
 	cpus {
arch/arm/boot/dts/omap36xx.dtsi +1 -1
index f3447bc..f8b3765 100644
@@ -8,7 +8,7 @@
  * kind, whether express or implied.
  */
 
-/include/ "omap3.dtsi"
+#include "omap3.dtsi"
 
 / {
 	aliases {
arch/arm/boot/dts/omap4-panda-a4.dts +2 -2
index e30cdf0..f18fb5c 100644
@@ -7,8 +7,8 @@
  */
 /dts-v1/;
 
-/include/ "omap443x.dtsi"
-/include/ "omap4-panda-common.dtsi"
+#include "omap443x.dtsi"
+#include "omap4-panda-common.dtsi"
 
 /* Pandaboard Rev A4+ have external pullups on SCL & SDA */
 &dss_hdmi_pins {
arch/arm/boot/dts/omap4-panda-common.dtsi +2 -2
index 03bd60d..63148d1 100644
@@ -5,7 +5,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-/include/ "elpida_ecb240abacn.dtsi"
+#include "elpida_ecb240abacn.dtsi"
 
 / {
 	model = "TI OMAP4 PandaBoard";
@@ -164,7 +164,7 @@
 	};
 };
 
-/include/ "twl6030.dtsi"
+#include "twl6030.dtsi"
 
 &i2c2 {
 	pinctrl-names = "default";
arch/arm/boot/dts/omap4-panda-es.dts +2 -2
index f1d8c21..c6f012e 100644
@@ -7,8 +7,8 @@
  */
 /dts-v1/;
 
-/include/ "omap4460.dtsi"
-/include/ "omap4-panda-common.dtsi"
+#include "omap4460.dtsi"
+#include "omap4-panda-common.dtsi"
 
 /* Audio routing is differnet between PandaBoard4430 and PandaBoardES */
 &sound {
arch/arm/boot/dts/omap4-panda.dts +2 -2
index f8b221f..6189a8b 100644
@@ -7,5 +7,5 @@
  */
 /dts-v1/;
 
-/include/ "omap443x.dtsi"
-/include/ "omap4-panda-common.dtsi"
+#include "omap443x.dtsi"
+#include "omap4-panda-common.dtsi"
arch/arm/boot/dts/omap4-sdp-es23plus.dts +1 -1
index b4a40ff..4f26355 100644
@@ -5,7 +5,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-/include/ "omap4-sdp.dts"
+#include "omap4-sdp.dts"
 
 /* SDP boards with 4430 ES2.3+ or 4460 have external pullups on SCL & SDA */
 &dss_hdmi_pins {
arch/arm/boot/dts/omap4-sdp.dts +3 -3
index a35d9cd..5edd08e 100644
@@ -7,8 +7,8 @@
  */
 /dts-v1/;
 
-/include/ "omap443x.dtsi"
-/include/ "elpida_ecb240abacn.dtsi"
+#include "omap443x.dtsi"
+#include "elpida_ecb240abacn.dtsi"
 
 / {
 	model = "TI OMAP4 SDP board";
@@ -316,7 +316,7 @@
 	};
 };
 
-/include/ "twl6030.dtsi"
+#include "twl6030.dtsi"
 
 &i2c2 {
 	pinctrl-names = "default";
arch/arm/boot/dts/omap4-var-som.dts +2 -2
index 7e04103..6593607 100644
@@ -7,7 +7,7 @@
  */
 /dts-v1/;
 
-/include/ "omap443x.dtsi"
+#include "omap443x.dtsi"
 
 / {
 	model = "Variscite OMAP4 SOM";
@@ -39,7 +39,7 @@
 	};
 };
 
-/include/ "twl6030.dtsi"
+#include "twl6030.dtsi"
 
 &i2c2 {
 	clock-frequency = <400000>;
arch/arm/boot/dts/omap4.dtsi +1 -1
index 2a56428..53d80aa 100644
@@ -14,7 +14,7 @@
  */
 /memreserve/ 0x9d000000 0x03000000;
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	compatible = "ti,omap4430", "ti,omap4";
arch/arm/boot/dts/omap443x.dtsi +1 -1
index cccf39a..a81f8df 100644
@@ -8,7 +8,7 @@
  * kind, whether express or implied.
  */
 
-/include/ "omap4.dtsi"
+#include "omap4.dtsi"
 
 / {
 	cpus {
arch/arm/boot/dts/omap4460.dtsi +1 -1
index 2cf227c..41762c2 100644
@@ -7,7 +7,7 @@
  * version 2.  This program is licensed "as is" without any warranty of any
  * kind, whether express or implied.
  */
-/include/ "omap4.dtsi"
+#include "omap4.dtsi"
 
 / {
 	cpus {
arch/arm/boot/dts/omap5-evm.dts +2 -2
index 982acd1..f5f55d1 100644
@@ -7,8 +7,8 @@
  */
 /dts-v1/;
 
-/include/ "omap5.dtsi"
-/include/ "samsung_k3pe0e000b.dtsi"
+#include "omap5.dtsi"
+#include "samsung_k3pe0e000b.dtsi"
 
 / {
 	model = "TI OMAP5 EVM board";
arch/arm/boot/dts/omap5.dtsi +1 -1
index 3dd7ff8..e8e6653 100644
@@ -15,7 +15,7 @@
  */
 /memreserve/ 0x9d000000 0x03000000;
 
-/include/ "skeleton.dtsi"
+#include "skeleton.dtsi"
 
 / {
 	#address-cells = <1>;
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 1/5 ARM: dts: OMAP2+: use #include for all device trees

Quoted 2 lines · Florian Vaussard

Replace /include/ by #include for OMAP2+ DT, in order to use the C pre-processor, making use of #define features possible.

This is good, but let's use it with case. Probably the best use for this right now is to add defines for the mux modes from mach-omap2/mux.h as that makes the raw values readable without comments.

Regards,

Tony

#3 lore raw

PATCH 1/5 ARM: dts: OMAP2+: use #include for all device trees

Hi Tony,

Quoted 9 lines · Tony Lindgren
Quoted 2 lines · Florian Vaussard

Replace /include/ by #include for OMAP2+ DT, in order to use the C pre-processor, making use of #define features possible.

This is good, but let's use it with case. Probably the best use for this right now is to add defines for the mux modes from mach-omap2/mux.h as that makes the raw values readable without comments.

I think that one first good case is the IRQs in patch 5. But I agree, adding defines for the mux modes would be great. I can have a look at it for a v2.

Regards,

Florian

#4 lore raw

PATCH 2/5 ARM: dts: OMAP2+: create a DT header for GPIO

In reply to Florian Vaussard

Define the OMAP_GPIO macro to conveniently use GPIO inside OMAP DT. For example:

	gpios = <&gpio6 3 0>;  /* GPIO 163 */

can be replaced by

	gpios = OMAP_GPIO(163, 0);
---
 include/dt-bindings/gpio/omap-gpio.h |  289 ++++++++++++++++++++++++++++++++++
 1 files changed, 289 insertions(+), 0 deletions(-)
 create mode 100644 include/dt-bindings/gpio/omap-gpio.h
include/dt-bindings/gpio/omap-gpio.h new file +289 -0
new file mode 100644
index 0000000..64f2686
@@ -0,0 +1,289 @@
+/*
+ * This header provides macros and constants for binding ti,omap*-gpio
+ *
+ * Compatible with OMAP2, OMAP3, OMAP4 and OMAP5.
+ */
+
+#ifndef _DT_BINDINGS_GPIO_OMAP_GPIO_H
+#define _DT_BINDINGS_GPIO_OMAP_GPIO_H
+
+#include <dt-bindings/gpio/gpio.h>
+
+#define OMAP_GPIO_0_BANK        gpio1
+#define OMAP_GPIO_1_BANK        gpio1
+#define OMAP_GPIO_2_BANK        gpio1
+#define OMAP_GPIO_3_BANK        gpio1
+#define OMAP_GPIO_4_BANK        gpio1
+#define OMAP_GPIO_5_BANK        gpio1
+#define OMAP_GPIO_6_BANK        gpio1
+#define OMAP_GPIO_7_BANK        gpio1
+#define OMAP_GPIO_8_BANK        gpio1
+#define OMAP_GPIO_9_BANK        gpio1
+#define OMAP_GPIO_10_BANK       gpio1
+#define OMAP_GPIO_11_BANK       gpio1
+#define OMAP_GPIO_12_BANK       gpio1
+#define OMAP_GPIO_13_BANK       gpio1
+#define OMAP_GPIO_14_BANK       gpio1
+#define OMAP_GPIO_15_BANK       gpio1
+#define OMAP_GPIO_16_BANK       gpio1
+#define OMAP_GPIO_17_BANK       gpio1
+#define OMAP_GPIO_18_BANK       gpio1
+#define OMAP_GPIO_19_BANK       gpio1
+#define OMAP_GPIO_20_BANK       gpio1
+#define OMAP_GPIO_21_BANK       gpio1
+#define OMAP_GPIO_22_BANK       gpio1
+#define OMAP_GPIO_23_BANK       gpio1
+#define OMAP_GPIO_24_BANK       gpio1
+#define OMAP_GPIO_25_BANK       gpio1
+#define OMAP_GPIO_26_BANK       gpio1
+#define OMAP_GPIO_27_BANK       gpio1
+#define OMAP_GPIO_28_BANK       gpio1
+#define OMAP_GPIO_29_BANK       gpio1
+#define OMAP_GPIO_30_BANK       gpio1
+#define OMAP_GPIO_31_BANK       gpio1
+
+#define OMAP_GPIO_32_BANK       gpio2
+#define OMAP_GPIO_33_BANK       gpio2
+#define OMAP_GPIO_34_BANK       gpio2
+#define OMAP_GPIO_35_BANK       gpio2
+#define OMAP_GPIO_36_BANK       gpio2
+#define OMAP_GPIO_37_BANK       gpio2
+#define OMAP_GPIO_38_BANK       gpio2
+#define OMAP_GPIO_39_BANK       gpio2
+#define OMAP_GPIO_40_BANK       gpio2
+#define OMAP_GPIO_41_BANK       gpio2
+#define OMAP_GPIO_42_BANK       gpio2
+#define OMAP_GPIO_43_BANK       gpio2
+#define OMAP_GPIO_44_BANK       gpio2
+#define OMAP_GPIO_45_BANK       gpio2
+#define OMAP_GPIO_46_BANK       gpio2
+#define OMAP_GPIO_47_BANK       gpio2
+#define OMAP_GPIO_48_BANK       gpio2
+#define OMAP_GPIO_49_BANK       gpio2
+#define OMAP_GPIO_50_BANK       gpio2
+#define OMAP_GPIO_51_BANK       gpio2
+#define OMAP_GPIO_52_BANK       gpio2
+#define OMAP_GPIO_53_BANK       gpio2
+#define OMAP_GPIO_54_BANK       gpio2
+#define OMAP_GPIO_55_BANK       gpio2
+#define OMAP_GPIO_56_BANK       gpio2
+#define OMAP_GPIO_57_BANK       gpio2
+#define OMAP_GPIO_58_BANK       gpio2
+#define OMAP_GPIO_59_BANK       gpio2
+#define OMAP_GPIO_60_BANK       gpio2
+#define OMAP_GPIO_61_BANK       gpio2
+#define OMAP_GPIO_62_BANK       gpio2
+#define OMAP_GPIO_63_BANK       gpio2
+
+#define OMAP_GPIO_64_BANK       gpio3
+#define OMAP_GPIO_65_BANK       gpio3
+#define OMAP_GPIO_66_BANK       gpio3
+#define OMAP_GPIO_67_BANK       gpio3
+#define OMAP_GPIO_68_BANK       gpio3
+#define OMAP_GPIO_69_BANK       gpio3
+#define OMAP_GPIO_70_BANK       gpio3
+#define OMAP_GPIO_71_BANK       gpio3
+#define OMAP_GPIO_72_BANK       gpio3
+#define OMAP_GPIO_73_BANK       gpio3
+#define OMAP_GPIO_74_BANK       gpio3
+#define OMAP_GPIO_75_BANK       gpio3
+#define OMAP_GPIO_76_BANK       gpio3
+#define OMAP_GPIO_77_BANK       gpio3
+#define OMAP_GPIO_78_BANK       gpio3
+#define OMAP_GPIO_79_BANK       gpio3
+#define OMAP_GPIO_80_BANK       gpio3
+#define OMAP_GPIO_81_BANK       gpio3
+#define OMAP_GPIO_82_BANK       gpio3
+#define OMAP_GPIO_83_BANK       gpio3
+#define OMAP_GPIO_84_BANK       gpio3
+#define OMAP_GPIO_85_BANK       gpio3
+#define OMAP_GPIO_86_BANK       gpio3
+#define OMAP_GPIO_87_BANK       gpio3
+#define OMAP_GPIO_88_BANK       gpio3
+#define OMAP_GPIO_89_BANK       gpio3
+#define OMAP_GPIO_90_BANK       gpio3
+#define OMAP_GPIO_91_BANK       gpio3
+#define OMAP_GPIO_92_BANK       gpio3
+#define OMAP_GPIO_93_BANK       gpio3
+#define OMAP_GPIO_94_BANK       gpio3
+#define OMAP_GPIO_95_BANK       gpio3
+
+#define OMAP_GPIO_96_BANK       gpio4
+#define OMAP_GPIO_97_BANK       gpio4
+#define OMAP_GPIO_98_BANK       gpio4
+#define OMAP_GPIO_99_BANK       gpio4
+#define OMAP_GPIO_100_BANK      gpio4
+#define OMAP_GPIO_101_BANK      gpio4
+#define OMAP_GPIO_102_BANK      gpio4
+#define OMAP_GPIO_103_BANK      gpio4
+#define OMAP_GPIO_104_BANK      gpio4
+#define OMAP_GPIO_105_BANK      gpio4
+#define OMAP_GPIO_106_BANK      gpio4
+#define OMAP_GPIO_107_BANK      gpio4
+#define OMAP_GPIO_108_BANK      gpio4
+#define OMAP_GPIO_109_BANK      gpio4
+#define OMAP_GPIO_110_BANK      gpio4
+#define OMAP_GPIO_111_BANK      gpio4
+#define OMAP_GPIO_112_BANK      gpio4
+#define OMAP_GPIO_113_BANK      gpio4
+#define OMAP_GPIO_114_BANK      gpio4
+#define OMAP_GPIO_115_BANK      gpio4
+#define OMAP_GPIO_116_BANK      gpio4
+#define OMAP_GPIO_117_BANK      gpio4
+#define OMAP_GPIO_118_BANK      gpio4
+#define OMAP_GPIO_119_BANK      gpio4
+#define OMAP_GPIO_120_BANK      gpio4
+#define OMAP_GPIO_121_BANK      gpio4
+#define OMAP_GPIO_122_BANK      gpio4
+#define OMAP_GPIO_123_BANK      gpio4
+#define OMAP_GPIO_124_BANK      gpio4
+#define OMAP_GPIO_125_BANK      gpio4
+#define OMAP_GPIO_126_BANK      gpio4
+#define OMAP_GPIO_127_BANK      gpio4
+
+/* Not available on OMAP2420 */
+#define OMAP_GPIO_128_BANK      gpio5
+#define OMAP_GPIO_129_BANK      gpio5
+#define OMAP_GPIO_130_BANK      gpio5
+#define OMAP_GPIO_131_BANK      gpio5
+#define OMAP_GPIO_132_BANK      gpio5
+#define OMAP_GPIO_133_BANK      gpio5
+#define OMAP_GPIO_134_BANK      gpio5
+#define OMAP_GPIO_135_BANK      gpio5
+#define OMAP_GPIO_136_BANK      gpio5
+#define OMAP_GPIO_137_BANK      gpio5
+#define OMAP_GPIO_138_BANK      gpio5
+#define OMAP_GPIO_139_BANK      gpio5
+#define OMAP_GPIO_140_BANK      gpio5
+#define OMAP_GPIO_141_BANK      gpio5
+#define OMAP_GPIO_142_BANK      gpio5
+#define OMAP_GPIO_143_BANK      gpio5
+#define OMAP_GPIO_144_BANK      gpio5
+#define OMAP_GPIO_145_BANK      gpio5
+#define OMAP_GPIO_146_BANK      gpio5
+#define OMAP_GPIO_147_BANK      gpio5
+#define OMAP_GPIO_148_BANK      gpio5
+#define OMAP_GPIO_149_BANK      gpio5
+#define OMAP_GPIO_150_BANK      gpio5
+#define OMAP_GPIO_151_BANK      gpio5
+#define OMAP_GPIO_152_BANK      gpio5
+#define OMAP_GPIO_153_BANK      gpio5
+#define OMAP_GPIO_154_BANK      gpio5
+#define OMAP_GPIO_155_BANK      gpio5
+#define OMAP_GPIO_156_BANK      gpio5
+#define OMAP_GPIO_157_BANK      gpio5
+#define OMAP_GPIO_158_BANK      gpio5
+#define OMAP_GPIO_159_BANK      gpio5
+
+/* Not available on OMAP2 */
+#define OMAP_GPIO_160_BANK      gpio6
+#define OMAP_GPIO_161_BANK      gpio6
+#define OMAP_GPIO_162_BANK      gpio6
+#define OMAP_GPIO_163_BANK      gpio6
+#define OMAP_GPIO_164_BANK      gpio6
+#define OMAP_GPIO_165_BANK      gpio6
+#define OMAP_GPIO_166_BANK      gpio6
+#define OMAP_GPIO_167_BANK      gpio6
+#define OMAP_GPIO_168_BANK      gpio6
+#define OMAP_GPIO_169_BANK      gpio6
+#define OMAP_GPIO_170_BANK      gpio6
+#define OMAP_GPIO_171_BANK      gpio6
+#define OMAP_GPIO_172_BANK      gpio6
+#define OMAP_GPIO_173_BANK      gpio6
+#define OMAP_GPIO_174_BANK      gpio6
+#define OMAP_GPIO_175_BANK      gpio6
+#define OMAP_GPIO_176_BANK      gpio6
+#define OMAP_GPIO_177_BANK      gpio6
+#define OMAP_GPIO_178_BANK      gpio6
+#define OMAP_GPIO_179_BANK      gpio6
+#define OMAP_GPIO_180_BANK      gpio6
+#define OMAP_GPIO_181_BANK      gpio6
+#define OMAP_GPIO_182_BANK      gpio6
+#define OMAP_GPIO_183_BANK      gpio6
+#define OMAP_GPIO_184_BANK      gpio6
+#define OMAP_GPIO_185_BANK      gpio6
+#define OMAP_GPIO_186_BANK      gpio6
+#define OMAP_GPIO_187_BANK      gpio6
+#define OMAP_GPIO_188_BANK      gpio6
+#define OMAP_GPIO_189_BANK      gpio6
+#define OMAP_GPIO_190_BANK      gpio6
+#define OMAP_GPIO_191_BANK      gpio6
+
+/* Only available on OMAP5 */
+#define OMAP_GPIO_192_BANK      gpio7
+#define OMAP_GPIO_193_BANK      gpio7
+#define OMAP_GPIO_194_BANK      gpio7
+#define OMAP_GPIO_195_BANK      gpio7
+#define OMAP_GPIO_196_BANK      gpio7
+#define OMAP_GPIO_197_BANK      gpio7
+#define OMAP_GPIO_198_BANK      gpio7
+#define OMAP_GPIO_199_BANK      gpio7
+#define OMAP_GPIO_200_BANK      gpio7
+#define OMAP_GPIO_201_BANK      gpio7
+#define OMAP_GPIO_202_BANK      gpio7
+#define OMAP_GPIO_203_BANK      gpio7
+#define OMAP_GPIO_204_BANK      gpio7
+#define OMAP_GPIO_205_BANK      gpio7
+#define OMAP_GPIO_206_BANK      gpio7
+#define OMAP_GPIO_207_BANK      gpio7
+#define OMAP_GPIO_208_BANK      gpio7
+#define OMAP_GPIO_209_BANK      gpio7
+#define OMAP_GPIO_210_BANK      gpio7
+#define OMAP_GPIO_211_BANK      gpio7
+#define OMAP_GPIO_212_BANK      gpio7
+#define OMAP_GPIO_213_BANK      gpio7
+#define OMAP_GPIO_214_BANK      gpio7
+#define OMAP_GPIO_215_BANK      gpio7
+#define OMAP_GPIO_216_BANK      gpio7
+#define OMAP_GPIO_217_BANK      gpio7
+#define OMAP_GPIO_218_BANK      gpio7
+#define OMAP_GPIO_219_BANK      gpio7
+#define OMAP_GPIO_220_BANK      gpio7
+#define OMAP_GPIO_221_BANK      gpio7
+#define OMAP_GPIO_222_BANK      gpio7
+#define OMAP_GPIO_223_BANK      gpio7
+
+/* Only available on OMAP5 */
+#define OMAP_GPIO_224_BANK      gpio8
+#define OMAP_GPIO_225_BANK      gpio8
+#define OMAP_GPIO_226_BANK      gpio8
+#define OMAP_GPIO_227_BANK      gpio8
+#define OMAP_GPIO_228_BANK      gpio8
+#define OMAP_GPIO_229_BANK      gpio8
+#define OMAP_GPIO_230_BANK      gpio8
+#define OMAP_GPIO_231_BANK      gpio8
+#define OMAP_GPIO_232_BANK      gpio8
+#define OMAP_GPIO_233_BANK      gpio8
+#define OMAP_GPIO_234_BANK      gpio8
+#define OMAP_GPIO_235_BANK      gpio8
+#define OMAP_GPIO_236_BANK      gpio8
+#define OMAP_GPIO_237_BANK      gpio8
+#define OMAP_GPIO_238_BANK      gpio8
+#define OMAP_GPIO_239_BANK      gpio8
+#define OMAP_GPIO_240_BANK      gpio8
+#define OMAP_GPIO_241_BANK      gpio8
+#define OMAP_GPIO_242_BANK      gpio8
+#define OMAP_GPIO_243_BANK      gpio8
+#define OMAP_GPIO_244_BANK      gpio8
+#define OMAP_GPIO_245_BANK      gpio8
+#define OMAP_GPIO_246_BANK      gpio8
+#define OMAP_GPIO_247_BANK      gpio8
+#define OMAP_GPIO_248_BANK      gpio8
+#define OMAP_GPIO_249_BANK      gpio8
+#define OMAP_GPIO_250_BANK      gpio8
+#define OMAP_GPIO_251_BANK      gpio8
+#define OMAP_GPIO_252_BANK      gpio8
+#define OMAP_GPIO_253_BANK      gpio8
+#define OMAP_GPIO_254_BANK      gpio8
+#define OMAP_GPIO_255_BANK      gpio8
+
+
+#define _OMAP_GPIO_OFFSET(gpio) \
+	(gpio & 0x1F)
+
+
+/* Declare a reference to an OMAP GPIO */
+#define OMAP_GPIO(gpio, level) \
+	<&OMAP_GPIO_##gpio##_BANK _OMAP_GPIO_OFFSET(gpio) level>
+
+#endif
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH 2/5 ARM: dts: OMAP2+: create a DT header for GPIO

Quoted 10 lines · Florian Vaussard

Define the OMAP_GPIO macro to conveniently use GPIO inside OMAP DT. For example:

	gpios = <&gpio6 3 0>;  /* GPIO 163 */

can be replaced by

	gpios = OMAP_GPIO(163, 0);

include/dt-bindings/gpio/omap-gpio.h line 15

Quoted 5 lines
include/dt-bindings/gpio/omap-gpio.h +4 -0
 
+#define OMAP_GPIO_0_BANK        gpio1
+#define OMAP_GPIO_1_BANK        gpio1
+#define OMAP_GPIO_2_BANK        gpio1
+#define OMAP_GPIO_3_BANK        gpio1

There are a /lot/ of those. Is this really worth it?

If the OMAP GPIO HW is already represented as a bunch of separate DT nodes which represent separate GPIO blocks, then I would have thought the syntax <&gpioN M 0> more directly represents what would be found in the HW manual? If not, surely the DT should have a single node to represent a single GPIO controller, which just happens to internally support a bunch of register arrays.

#6 lore raw

PATCH 2/5 ARM: dts: OMAP2+: create a DT header for GPIO

Quoted 19 lines · Stephen Warren
Quoted 10 lines · Florian Vaussard

Define the OMAP_GPIO macro to conveniently use GPIO inside OMAP DT. For example:

	gpios = <&gpio6 3 0>;  /* GPIO 163 */

can be replaced by

	gpios = OMAP_GPIO(163, 0);

include/dt-bindings/gpio/omap-gpio.h line 15

Quoted 5 lines
include/dt-bindings/gpio/omap-gpio.h +4 -0
 
+#define OMAP_GPIO_0_BANK        gpio1
+#define OMAP_GPIO_1_BANK        gpio1
+#define OMAP_GPIO_2_BANK        gpio1
+#define OMAP_GPIO_3_BANK        gpio1

There are a /lot/ of those. Is this really worth it?

Quoted 6 lines

If the OMAP GPIO HW is already represented as a bunch of separate DT nodes which represent separate GPIO blocks, then I would have thought the syntax <&gpioN M 0> more directly represents what would be found in the HW manual? If not, surely the DT should have a single node to represent a single GPIO controller, which just happens to internally support a bunch of register arrays.

Yes I agree, let's not go back to numbering anything except within the a single instance. If anything, we can put the gpio number into comments.

Regards,

Tony

#7 lore raw

PATCH 2/5 ARM: dts: OMAP2+: create a DT header for GPIO

Hello Stephan, Tony,

Thank you for your reviews.

Quoted 27 lines · Tony Lindgren
Quoted 19 lines · Stephen Warren
Quoted 10 lines · Florian Vaussard

Define the OMAP_GPIO macro to conveniently use GPIO inside OMAP DT. For example:

	gpios = <&gpio6 3 0>;  /* GPIO 163 */

can be replaced by

	gpios = OMAP_GPIO(163, 0);

include/dt-bindings/gpio/omap-gpio.h line 15

Quoted 5 lines
include/dt-bindings/gpio/omap-gpio.h +4 -0
 
+#define OMAP_GPIO_0_BANK        gpio1
+#define OMAP_GPIO_1_BANK        gpio1
+#define OMAP_GPIO_2_BANK        gpio1
+#define OMAP_GPIO_3_BANK        gpio1

There are a /lot/ of those. Is this really worth it?

Quoted 6 lines

If the OMAP GPIO HW is already represented as a bunch of separate DT nodes which represent separate GPIO blocks, then I would have thought the syntax <&gpioN M 0> more directly represents what would be found in the HW manual? If not, surely the DT should have a single node to represent a single GPIO controller, which just happens to internally support a bunch of register arrays.

Quoted 3 lines

Yes I agree, let's not go back to numbering anything except within the a single instance. If anything, we can put the gpio number into comments.

From a board point a view, I consider this macro as being easier to use,
than having to perform the necessary arithmetic to get the bank + offset for each GPIO when converting existing boards or developing new ones.

But I also agree with you, and I was sad not to find a more elegant way. Maybe someone with better preprocessor skills could come up with a better solution?

Regards,

Florian

#8 lore raw

PATCH 2/5 ARM: dts: OMAP2+: create a DT header for GPIO

Quoted 25 lines · Florian Vaussard

Hello Stephan, Tony,

Thank you for your reviews.

Quoted 20 lines · Tony Lindgren
Quoted 19 lines · Stephen Warren
Quoted 11 lines · Florian Vaussard

Define the OMAP_GPIO macro to conveniently use GPIO inside OMAP DT. For example:

    gpios = <&gpio6 3 0>;  /* GPIO 163 */

can be replaced by

    gpios = OMAP_GPIO(163, 0);

include/dt-bindings/gpio/omap-gpio.h line 15

Quoted 5 lines
include/dt-bindings/gpio/omap-gpio.h +4 -0
 
+#define OMAP_GPIO_0_BANK        gpio1
+#define OMAP_GPIO_1_BANK        gpio1
+#define OMAP_GPIO_2_BANK        gpio1
+#define OMAP_GPIO_3_BANK        gpio1

There are a /lot/ of those. Is this really worth it?

...

Quoted 7 lines

From a board point a view, I consider this macro as being easier to use, than having to perform the necessary arithmetic to get the bank + offset for each GPIO when converting existing boards or developing new ones.

But I also agree with you, and I was sad not to find a more elegant way. Maybe someone with better preprocessor skills could come up with a better solution?

I did a quick bit of searching before, and while cpp is certainly capable of doing the shifting/masking required to calculate the bank ID directly, I don't think it's capable of constructing the symbol gpio1 as opposed to the string "gpio1":-( I'd love to be proven wrong though, but the torture e.g. cpp "99 bottles of beer on the wall" goes through to stuff implies it isn't possible.

#9 lore raw

PATCH 3/5 ARM: dts: OMAP2+: convert DT files to use the new OMAP_GPIO macro

In reply to Florian Vaussard

Use OMAP_GPIO(), in conjunction with standard GPIO flags, to enhance the readability of DT GPIOs.

---
 arch/arm/boot/dts/omap2.dtsi              |    2 ++
 arch/arm/boot/dts/omap3-beagle-xm.dts     |    4 ++--
 arch/arm/boot/dts/omap3-beagle.dts        |    6 +++---
 arch/arm/boot/dts/omap3-devkit8000.dts    |    6 +++---
 arch/arm/boot/dts/omap3-igep0020.dts      |    6 +++---
 arch/arm/boot/dts/omap3-igep0030.dts      |    2 +-
 arch/arm/boot/dts/omap3-tobi.dts          |    2 +-
 arch/arm/boot/dts/omap3.dtsi              |    2 ++
 arch/arm/boot/dts/omap4-panda-common.dtsi |    6 +++---
 arch/arm/boot/dts/omap4-sdp.dts           |   20 ++++++++++----------
 arch/arm/boot/dts/omap4.dtsi              |    2 ++
 arch/arm/boot/dts/omap5.dtsi              |    2 ++
 12 files changed, 34 insertions(+), 26 deletions(-)
arch/arm/boot/dts/omap2.dtsi +2 -0
index e6e4587..7ea5df4 100644
@@ -8,6 +8,8 @@
  * kind, whether express or implied.
  */
 
+#include <dt-bindings/gpio/omap-gpio.h>
+
 #include "skeleton.dtsi"
 
 / {
arch/arm/boot/dts/omap3-beagle-xm.dts +2 -2
index e0ce823..e773a5e 100644
@@ -29,13 +29,13 @@
 
 		heartbeat {
 			label = "beagleboard::usr0";
-			gpios = <&gpio5 22 0>; /* 150 -> D6 LED */
+			gpios = OMAP_GPIO(150, GPIO_ACTIVE_HIGH); /* 150 -> D6 LED */
 			linux,default-trigger = "heartbeat";
 		};
 
 		mmc {
 			label = "beagleboard::usr1";
-			gpios = <&gpio5 21 0>; /* 149 -> D7 LED */
+			gpios = OMAP_GPIO(149, GPIO_ACTIVE_HIGH); /* 149 -> D7 LED */
 			linux,default-trigger = "mmc0";
 		};
 	};
arch/arm/boot/dts/omap3-beagle.dts +3 -3
index fcac96a..f1fd002 100644
@@ -33,13 +33,13 @@
 
 		heartbeat {
 			label = "beagleboard::usr0";
-			gpios = <&gpio5 22 0>; /* 150 -> D6 LED */
+			gpios = OMAP_GPIO(150, GPIO_ACTIVE_HIGH); /* 150 -> D6 LED */
 			linux,default-trigger = "heartbeat";
 		};
 
 		mmc {
 			label = "beagleboard::usr1";
-			gpios = <&gpio5 21 0>; /* 149 -> D7 LED */
+			gpios = OMAP_GPIO(149, GPIO_ACTIVE_HIGH); /* 149 -> D7 LED */
 			linux,default-trigger = "mmc0";
 		};
 	};
@@ -50,7 +50,7 @@
 		regulator-name = "hsusb2_reset";
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
-		gpio = <&gpio5 19 0>;	/* gpio_147 */
+		gpio = OMAP_GPIO(147, GPIO_ACTIVE_HIGH);
 		startup-delay-us = <70000>;
 		enable-active-high;
 	};
arch/arm/boot/dts/omap3-devkit8000.dts +3 -3
index 8d0f5e4..fecb5ac 100644
@@ -22,21 +22,21 @@
 
 		heartbeat {
 			label = "devkit8000::led1";
-			gpios = <&gpio6 26 0>;	/* 186 -> LED1 */
+			gpios = OMAP_GPIO(186, GPIO_ACTIVE_HIGH);	/* 186 -> LED1 */
 			default-state = "on";
 			linux,default-trigger = "heartbeat";
 		};
 
 		mmc {
 			label = "devkit8000::led2";
-			gpios = <&gpio6 3 0>;	/* 163 -> LED2 */
+			gpios = OMAP_GPIO(163, GPIO_ACTIVE_HIGH);	/* 163 -> LED2 */
 			default-state = "on";
 			linux,default-trigger = "none";
 		};
 
 		usr {
 			label = "devkit8000::led3";
-			gpios = <&gpio6 4 0>;	/* 164 -> LED3 */
+			gpios = OMAP_GPIO(164, GPIO_ACTIVE_HIGH);	/* 164 -> LED3 */
 			default-state = "on";
 			linux,default-trigger = "usr";
                 };
arch/arm/boot/dts/omap3-igep0020.dts +3 -3
index 2f96a5c..4be8ba1 100644
@@ -19,19 +19,19 @@
 		compatible = "gpio-leds";
 		boot {
 			 label = "omap3:green:boot";
-			 gpios = <&gpio1 26 0>;
+			 gpios = OMAP_GPIO(26, GPIO_ACTIVE_HIGH);
 			 default-state = "on";
 		};
 
 		user0 {
 			 label = "omap3:red:user0";
-			 gpios = <&gpio1 27 0>;
+			 gpios = OMAP_GPIO(27, GPIO_ACTIVE_HIGH);
 			 default-state = "off";
 		};
 
 		user1 {
 			 label = "omap3:red:user1";
-			 gpios = <&gpio1 28 0>;
+			 gpios = OMAP_GPIO(28, GPIO_ACTIVE_HIGH);
 			 default-state = "off";
 		};
 
arch/arm/boot/dts/omap3-igep0030.dts +1 -1
index f3a1bf0..5a2c7a6 100644
@@ -37,7 +37,7 @@
 
 		user2 {
 			 label = "omap3:red:user1";
-			 gpios = <&gpio1 16 1>;
+			 gpios = OMAP_GPIO(16, GPIO_ACTIVE_LOW);
 			 default-state = "off";
 		};
 	};
arch/arm/boot/dts/omap3-tobi.dts +1 -1
index 5df894f..8390c8b 100644
@@ -20,7 +20,7 @@
 		compatible = "gpio-leds";
 		heartbeat {
 			label = "overo:red:gpio21";
-			gpios = <&gpio1 21 0>;
+			gpios = OMAP_GPIO(21, GPIO_ACTIVE_HIGH);
 			linux,default-trigger = "heartbeat";
 		};
 	};
arch/arm/boot/dts/omap3.dtsi +2 -0
index 7c7d494..15049b8 100644
@@ -8,6 +8,8 @@
  * kind, whether express or implied.
  */
 
+#include <dt-bindings/gpio/omap-gpio.h>
+
 #include "skeleton.dtsi"
 
 / {
arch/arm/boot/dts/omap4-panda-common.dtsi +3 -3
index 63148d1..b71f5cd 100644
@@ -20,13 +20,13 @@
 		compatible = "gpio-leds";
 		heartbeat {
 			label = "pandaboard::status1";
-			gpios = <&gpio1 7 0>;
+			gpios = OMAP_GPIO(7, GPIO_ACTIVE_HIGH);
 			linux,default-trigger = "heartbeat";
 		};
 
 		mmc {
 			label = "pandaboard::status2";
-			gpios = <&gpio1 8 0>;
+			gpios = OMAP_GPIO(8, GPIO_ACTIVE_HIGH);
 			linux,default-trigger = "mmc0";
 		};
 	};
@@ -156,7 +156,7 @@
 		/* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */
 		interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */
 		interrupt-parent = <&gic>;
-		ti,audpwron-gpio = <&gpio4 31 0>;  /* gpio line 127 */
+		ti,audpwron-gpio = OMAP_GPIO(127, GPIO_ACTIVE_HIGH);
 
 		vio-supply = <&v1v8>;
 		v2v1-supply = <&v2v1>;
arch/arm/boot/dts/omap4-sdp.dts +10 -10
index 5edd08e..f55bb68 100644
@@ -24,7 +24,7 @@
 		regulator-name = "VDD_ETH";
 		regulator-min-microvolt = <3300000>;
 		regulator-max-microvolt = <3300000>;
-		gpio = <&gpio2 16 0>;  /* gpio line 48 */
+		gpio = OMAP_GPIO(48, GPIO_ACTIVE_HIGH);
 		enable-active-high;
 		regulator-boot-on;
 	};
@@ -41,42 +41,42 @@
 		compatible = "gpio-leds";
 		debug0 {
 			label = "omap4:green:debug0";
-			gpios = <&gpio2 29 0>; /* 61 */
+			gpios = OMAP_GPIO(61, GPIO_ACTIVE_HIGH);
 		};
 
 		debug1 {
 			label = "omap4:green:debug1";
-			gpios = <&gpio1 30 0>; /* 30 */
+			gpios = OMAP_GPIO(30, GPIO_ACTIVE_HIGH);
 		};
 
 		debug2 {
 			label = "omap4:green:debug2";
-			gpios = <&gpio1 7 0>; /* 7 */
+			gpios = OMAP_GPIO(7, GPIO_ACTIVE_HIGH);
 		};
 
 		debug3 {
 			label = "omap4:green:debug3";
-			gpios = <&gpio1 8 0>; /* 8 */
+			gpios = OMAP_GPIO(8, GPIO_ACTIVE_HIGH);
 		};
 
 		debug4 {
 			label = "omap4:green:debug4";
-			gpios = <&gpio2 18 0>; /* 50 */
+			gpios = OMAP_GPIO(50, GPIO_ACTIVE_HIGH);
 		};
 
 		user1 {
 			label = "omap4:blue:user";
-			gpios = <&gpio6 9 0>; /* 169 */
+			gpios = OMAP_GPIO(169, GPIO_ACTIVE_HIGH);
 		};
 
 		user2 {
 			label = "omap4:red:user";
-			gpios = <&gpio6 10 0>; /* 170 */
+			gpios = OMAP_GPIO(170, GPIO_ACTIVE_HIGH);
 		};
 
 		user3 {
 			label = "omap4:green:user";
-			gpios = <&gpio5 11 0>; /* 139 */
+			gpios = OMAP_GPIO(139, GPIO_ACTIVE_HIGH);
 		};
 	};
 
@@ -296,7 +296,7 @@
 		/* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */
 		interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */
 		interrupt-parent = <&gic>;
-		ti,audpwron-gpio = <&gpio4 31 0>;  /* gpio line 127 */
+		ti,audpwron-gpio = OMAP_GPIO(127, GPIO_ACTIVE_HIGH);
 
 		vio-supply = <&v1v8>;
 		v2v1-supply = <&v2v1>;
arch/arm/boot/dts/omap4.dtsi +2 -0
index 53d80aa..3c00b72 100644
@@ -14,6 +14,8 @@
  */
 /memreserve/ 0x9d000000 0x03000000;
 
+#include <dt-bindings/gpio/omap-gpio.h>
+
 #include "skeleton.dtsi"
 
 / {
arch/arm/boot/dts/omap5.dtsi +2 -0
index e8e6653..af849e6 100644
@@ -15,6 +15,8 @@
  */
 /memreserve/ 0x9d000000 0x03000000;
 
+#include <dt-bindings/gpio/omap-gpio.h>
+
 #include "skeleton.dtsi"
 
 / {
Signature · 1 line
1.7.5.4
#10 lore raw

PATCH 3/5 ARM: dts: OMAP2+: convert DT files to use the new OMAP_GPIO macro

arch/arm/boot/dts/omap3-beagle-xm.dts line 32

Quoted 13 lines · Florian Vaussard

Use OMAP_GPIO(), in conjunction with standard GPIO flags, to enhance the readability of DT GPIOs.

arch/arm/boot/dts/omap3-beagle-xm.dts +1 -1
index e0ce823..e773a5e 100644
@@ -29,13 +29,13 @@
 
 		heartbeat {
 			label = "beagleboard::usr0";
-			gpios = <&gpio5 22 0>; /* 150 -> D6 LED */
+			gpios = OMAP_GPIO(150, GPIO_ACTIVE_HIGH); /* 150 -> D6 LED */

One of the advantages of cpp support for me is the ability to remove the redundant part of the command. In other words, perhaps remove the "150 ->" since that information is part of the OMAP_GPIO() "call", leaving just /* D6 LED */. I might have expected "D6" to be the label too, thus removing any need for the comment.

#11 lore raw

PATCH 3/5 ARM: dts: OMAP2+: convert DT files to use the new OMAP_GPIO macro

Hi Stepen,

Thank you for your review,

Quoted 10 lines · Stephen Warren
Quoted 9 lines · Florian Vaussard

Use OMAP_GPIO(), in conjunction with standard GPIO flags, to enhance the readability of DT GPIOs.

arch/arm/boot/dts/omap3-beagle-xm.dts +0 -0
index e0ce823..e773a5e 100644
@@ -29,13 +29,13 @@
 
Quoted 11 lines

arch/arm/boot/dts/omap3-beagle-xm.dts line 32

Quoted 4 lines
arch/arm/boot/dts/omap3-beagle-xm.dts +1 -1
  		heartbeat {
  			label = "beagleboard::usr0";
-			gpios = <&gpio5 22 0>; /* 150 -> D6 LED */
+			gpios = OMAP_GPIO(150, GPIO_ACTIVE_HIGH); /* 150 -> D6 LED */

One of the advantages of cpp support for me is the ability to remove the redundant part of the command. In other words, perhaps remove the "150 ->" since that information is part of the OMAP_GPIO() "call", leaving just /* D6 LED */. I might have expected "D6" to be the label too, thus removing any need for the comment.

I agree. I removed almost all the comments from the other files. For here, I would
leave /* D6 LED */ as you suggest.

Regards,

Florian

#12 lore raw

PATCH 4/5 ARM: dts: OMAP3: fix incorrect notation for musb-hdrc interrupt

In reply to Florian Vaussard

On OMAP3, the INTC interrupt controller has only 1 cell.

---
 arch/arm/boot/dts/omap3.dtsi |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/boot/dts/omap3.dtsi +1 -1
index 15049b8..0f3be20 100644
@@ -518,7 +518,7 @@
 		usb_otg_hs: usb_otg_hs at 480ab000 {
 			compatible = "ti,omap3-musb";
 			reg = <0x480ab000 0x1000>;
-			interrupts = <0 92 0x4>, <0 93 0x4>;
+			interrupts = <92>, <93>;
 			interrupt-names = "mc", "dma";
 			ti,hwmods = "usb_otg_hs";
 			multipoint = <1>;
Signature · 1 line
1.7.5.4
#13 lore raw

PATCH 4/5 ARM: dts: OMAP3: fix incorrect notation for musb-hdrc interrupt

Quoted 3 lines · Florian Vaussard

On OMAP3, the INTC interrupt controller has only 1 cell.

Thanks a similar fix is already queued up and on it's way to mainline tree.

Regards,

Tony

Quoted 20 lines
---
 arch/arm/boot/dts/omap3.dtsi |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/boot/dts/omap3.dtsi +1 -1
index 15049b8..0f3be20 100644
@@ -518,7 +518,7 @@
 		usb_otg_hs: usb_otg_hs at 480ab000 {
 			compatible = "ti,omap3-musb";
 			reg = <0x480ab000 0x1000>;
-			interrupts = <0 92 0x4>, <0 93 0x4>;
+			interrupts = <92>, <93>;
 			interrupt-names = "mc", "dma";
 			ti,hwmods = "usb_otg_hs";
 			multipoint = <1>;
Signature · 1 line
1.7.5.4
#14 lore raw

PATCH 5/5 ARM: dts: OMAP4/5: use existing constants for IRQs

In reply to Florian Vaussard

Use the constants defined in include/dt-bindings/interrupt-controller/ to enhance readability.

---
 arch/arm/boot/dts/omap4-panda-common.dtsi |    8 +-
 arch/arm/boot/dts/omap4-sdp.dts           |    6 +-
 arch/arm/boot/dts/omap4-var-som.dts       |    4 +-
 arch/arm/boot/dts/omap4.dtsi              |  113 ++++++++++++++-------------
 arch/arm/boot/dts/omap4460.dtsi           |    4 +-
 arch/arm/boot/dts/omap5.dtsi              |  121 +++++++++++++++--------------
 6 files changed, 129 insertions(+), 127 deletions(-)
arch/arm/boot/dts/omap4-panda-common.dtsi +4 -4
index b71f5cd..c2354c9 100644
@@ -145,16 +145,16 @@
 
 	twl: twl at 48 {
 		reg = <0x48>;
-		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
-		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		/* IRQ# = 7 */
+		interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
 		interrupt-parent = <&gic>;
 	};
 
 	twl6040: twl at 4b {
 		compatible = "ti,twl6040";
 		reg = <0x4b>;
-		/* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */
-		interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */
+		/* IRQ# = 119 */
+		interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_2N cascaded to gic */
 		interrupt-parent = <&gic>;
 		ti,audpwron-gpio = OMAP_GPIO(127, GPIO_ACTIVE_HIGH);
 
arch/arm/boot/dts/omap4-sdp.dts +3 -3
index f55bb68..3ce4987 100644
@@ -286,7 +286,7 @@
 	twl: twl at 48 {
 		reg = <0x48>;
 		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
-		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
 		interrupt-parent = <&gic>;
 	};
 
@@ -294,7 +294,7 @@
 		compatible = "ti,twl6040";
 		reg = <0x4b>;
 		/* SPI = 0, IRQ# = 119, 4 = active high level-sensitive */
-		interrupts = <0 119 4>; /* IRQ_SYS_2N cascaded to gic */
+		interrupts = <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_2N cascaded to gic */
 		interrupt-parent = <&gic>;
 		ti,audpwron-gpio = OMAP_GPIO(127, GPIO_ACTIVE_HIGH);
 
@@ -375,7 +375,7 @@
 		spi-max-frequency = <24000000>;
 		reg = <0>;
 		interrupt-parent = <&gpio2>;
-		interrupts = <2 8>; /* gpio line 34, low triggered */
+		interrupts = <2 IRQ_TYPE_LEVEL_LOW>; /* gpio line 34, low triggered */
 		vdd-supply = <&vdd_eth>;
 	};
 };
arch/arm/boot/dts/omap4-var-som.dts +2 -2
index 6593607..135ba45 100644
@@ -34,7 +34,7 @@
 	twl: twl at 48 {
 		reg = <0x48>;
 		/* SPI = 0, IRQ# = 7, 4 = active high level-sensitive */
-		interrupts = <0 7 4>; /* IRQ_SYS_1N cascaded to gic */
+		interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>; /* IRQ_SYS_1N cascaded to gic */
 		interrupt-parent = <&gic>;
 	};
 };
@@ -68,7 +68,7 @@
 		spi-max-frequency = <24000000>;
 		reg = <0>;
 		interrupt-parent = <&gpio6>;
-		interrupts = <11 8>; /* gpio line 171, low triggered */
+		interrupts = <11 IRQ_TYPE_LEVEL_LOW>; /* gpio line 171, low triggered */
 		vdd-supply = <&vdd_eth>;
 	};
 };
arch/arm/boot/dts/omap4.dtsi +57 -56

431 lines not on this page · raw message

arch/arm/boot/dts/omap4460.dtsi +2 -2
index 41762c2..19628b1 100644
@@ -25,8 +25,8 @@
 
 	pmu {
 		compatible = "arm,cortex-a9-pmu";
-		interrupts = <0 54 0x4>,
-			     <0 55 0x4>;
+		interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>,
+			     <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
 		ti,hwmods = "debugss";
 	};
 };
arch/arm/boot/dts/omap5.dtsi +61 -60

445 lines not on this page · raw message

Signature · 1 line
1.7.5.4