ARM: dts: AM3XXX: Use preprocessor for device trees
Subsystems (2)
v2 cover ARM: dts: AM3XXX: Use preprocessor for device trees
Hello,
Following my series for OMAP2+, this series makes use of the C preprocessor when compiling AM3xxx DT files, and accomplishes some improvements to improve overall readability.
The .dtb files were diff-tested before and after applying the series to guarantee identity for all targets.
To enable pullup/down on the pad, the bit should be cleared on AM33xx, where it should be set on OMAP3. This was wrong in my first version.
This series is based on Benoit's 'for_3.11/dts' branch.
Regards,
Florian
Quoted 1 line
From v2:
- Rebased on Benoit's 'for_3.11/dts'
- Fixed inversed bit to enable pullups ('1' on OMAP, but '0' on AM33xx)
Florian Vaussard (4):
ARM: dts: AM3XXX: Use #include for all device trees
ARM: dts: AM33XX: Use existing constants for GPIOs
ARM: dts: AM33XX: Specific pinctrl header
ARM: dts: AM33XX: Use pinctrl constants
arch/arm/boot/dts/am335x-bone.dts | 28 ++++++------ arch/arm/boot/dts/am335x-evm.dts | 76 +++++++++++++++--------------- arch/arm/boot/dts/am335x-evmsk.dts | 46 +++++++++--------- arch/arm/boot/dts/am33xx.dtsi | 5 ++- arch/arm/boot/dts/am3517-evm.dts | 2 +- arch/arm/boot/dts/am3517_mt_ventoux.dts | 2 +- include/dt-bindings/pinctrl/am33xx.h | 37 +++++++++++++++ 7 files changed, 118 insertions(+), 78 deletions(-) create mode 100644 include/dt-bindings/pinctrl/am33xx.h
Signature · 1 line
1.7.5.4
PATCH v2 1/4 ARM: dts: AM3XXX: Use #include for all device trees
Replace /include/ by #include for AM33XX and AM35XX device tree files, in order to use the C pre-processor, making use of #define features possible.
--- arch/arm/boot/dts/am335x-bone.dts | 2 +- arch/arm/boot/dts/am335x-evm.dts | 4 ++-- arch/arm/boot/dts/am335x-evmsk.dts | 4 ++-- arch/arm/boot/dts/am33xx.dtsi | 2 +- arch/arm/boot/dts/am3517-evm.dts | 2 +- arch/arm/boot/dts/am3517_mt_ventoux.dts | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/boot/dts/am335x-bone.dts +1 -1
@@ -7,7 +7,7 @@ */ /dts-v1/; -/include/ "am33xx.dtsi" +#include "am33xx.dtsi" / { model = "TI AM335x BeagleBone";
arch/arm/boot/dts/am335x-evm.dts +2 -2
@@ -7,7 +7,7 @@ */ /dts-v1/; -/include/ "am33xx.dtsi" +#include "am33xx.dtsi" / { model = "TI AM335x EVM";
@@ -301,7 +301,7 @@ }; }; -/include/ "tps65910.dtsi" +#include "tps65910.dtsi" &tps { vcc1-supply = <&vbat>;
arch/arm/boot/dts/am335x-evmsk.dts +2 -2
@@ -13,7 +13,7 @@ /dts-v1/; -/include/ "am33xx.dtsi" +#include "am33xx.dtsi" / { model = "TI AM335x EVM-SK";
@@ -201,7 +201,7 @@ }; }; -/include/ "tps65910.dtsi" +#include "tps65910.dtsi" &tps { vcc1-supply = <&vbat>;
arch/arm/boot/dts/am33xx.dtsi +1 -1
@@ -8,7 +8,7 @@ * kind, whether express or implied. */ -/include/ "skeleton.dtsi" +#include "skeleton.dtsi" / { compatible = "ti,am33xx";
arch/arm/boot/dts/am3517-evm.dts +1 -1
@@ -7,7 +7,7 @@ */ /dts-v1/; -/include/ "omap34xx.dtsi" +#include "omap34xx.dtsi" / { model = "TI AM3517 EVM (AM3517/05)";
arch/arm/boot/dts/am3517_mt_ventoux.dts +1 -1
@@ -7,7 +7,7 @@ */ /dts-v1/; -/include/ "omap34xx.dtsi" +#include "omap34xx.dtsi" / { model = "TeeJet Mt.Ventoux";
Signature · 1 line
1.7.5.4
PATCH v2 2/4 ARM: dts: AM33XX: Use existing constants for GPIOs
In reply to Florian VaussardUse standard GPIO constants to enhance the readability of DT GPIOs.
--- arch/arm/boot/dts/am335x-bone.dts | 8 ++++---- arch/arm/boot/dts/am335x-evm.dts | 14 +++++++------- arch/arm/boot/dts/am335x-evmsk.dts | 16 ++++++++-------- arch/arm/boot/dts/am33xx.dtsi | 2 ++ 4 files changed, 21 insertions(+), 19 deletions(-)
arch/arm/boot/dts/am335x-bone.dts +4 -4
@@ -88,27 +88,27 @@ led at 2 { label = "beaglebone:green:heartbeat"; - gpios = <&gpio1 21 0>; + gpios = <&gpio1 21 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; default-state = "off"; }; led at 3 { label = "beaglebone:green:mmc0"; - gpios = <&gpio1 22 0>; + gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>; linux,default-trigger = "mmc0"; default-state = "off"; }; led at 4 { label = "beaglebone:green:usr2"; - gpios = <&gpio1 23 0>; + gpios = <&gpio1 23 GPIO_ACTIVE_HIGH>; default-state = "off"; }; led at 5 { label = "beaglebone:green:usr3"; - gpios = <&gpio1 24 0>; + gpios = <&gpio1 24 GPIO_ACTIVE_HIGH>; default-state = "off"; }; };
arch/arm/boot/dts/am335x-evm.dts +7 -7
@@ -264,12 +264,12 @@ debounce-delay-ms = <5>; col-scan-delay-us = <2>; - row-gpios = <&gpio1 25 0 /* Bank1, pin25 */ - &gpio1 26 0 /* Bank1, pin26 */ - &gpio1 27 0>; /* Bank1, pin27 */ + row-gpios = <&gpio1 25 GPIO_ACTIVE_HIGH /* Bank1, pin25 */ + &gpio1 26 GPIO_ACTIVE_HIGH /* Bank1, pin26 */ + &gpio1 27 GPIO_ACTIVE_HIGH>; /* Bank1, pin27 */ - col-gpios = <&gpio1 21 0 /* Bank1, pin21 */ - &gpio1 22 0>; /* Bank1, pin22 */ + col-gpios = <&gpio1 21 GPIO_ACTIVE_HIGH /* Bank1, pin21 */ + &gpio1 22 GPIO_ACTIVE_HIGH>; /* Bank1, pin22 */ linux,keymap = <0x0000008b /* MENU */ 0x0100009e /* BACK */
@@ -288,14 +288,14 @@ switch@9 { label = "volume-up"; linux,code = <115>; - gpios = <&gpio0 2 1>; + gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; gpio-key,wakeup; }; switch at 10 { label = "volume-down"; linux,code = <114>; - gpios = <&gpio0 3 1>; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; gpio-key,wakeup; }; };
arch/arm/boot/dts/am335x-evmsk.dts +8 -8
@@ -144,26 +144,26 @@ led at 1 { label = "evmsk:green:usr0"; - gpios = <&gpio1 4 0>; + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; default-state = "off"; }; led at 2 { label = "evmsk:green:usr1"; - gpios = <&gpio1 5 0>; + gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; default-state = "off"; }; led at 3 { label = "evmsk:green:mmc0"; - gpios = <&gpio1 6 0>; + gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; linux,default-trigger = "mmc0"; default-state = "off"; }; led at 4 { label = "evmsk:green:heartbeat"; - gpios = <&gpio1 7 0>; + gpios = <&gpio1 7 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat"; default-state = "off"; };
@@ -177,26 +177,26 @@ switch at 1 { label = "button0"; linux,code = <0x100>; - gpios = <&gpio2 3 0>; + gpios = <&gpio2 3 GPIO_ACTIVE_HIGH>; }; switch at 2 { label = "button1"; linux,code = <0x101>; - gpios = <&gpio2 2 0>; + gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>; }; switch at 3 { label = "button2"; linux,code = <0x102>; - gpios = <&gpio0 30 0>; + gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>; gpio-key,wakeup; }; switch at 4 { label = "button3"; linux,code = <0x103>; - gpios = <&gpio2 5 0>; + gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>; }; }; };
arch/arm/boot/dts/am33xx.dtsi +2 -0
@@ -8,6 +8,8 @@ * kind, whether express or implied. */ +#include <dt-bindings/gpio/gpio.h> + #include "skeleton.dtsi" / {
Signature · 1 line
1.7.5.4
PATCH v2 3/4 ARM: dts: AM33XX: Specific pinctrl header
In reply to Florian VaussardThe pinctrl IP inside the AM33XX family differs slightly from what is found on OMAP2+. Define a specific header to take account of the differences.
--- include/dt-bindings/pinctrl/am33xx.h | 37 ++++++++++++++++++++++++++++++++++ 1 files changed, 37 insertions(+), 0 deletions(-) create mode 100644 include/dt-bindings/pinctrl/am33xx.h
include/dt-bindings/pinctrl/am33xx.h new file +37 -0
@@ -0,0 +1,37 @@ +/* +* This header provides constants specific to AM33XX pinctrl bindings. +*/ + +#include <include/dt-bindings/pinctrl/omap.h> + +/* am33xx specific mux bit defines */ +#undef PULL_ENA +#undef INPUT_EN + +#define PULL_DISABLE (1 << 3) +#define INPUT_EN (1 << 5) +#define SLEWCTRL_FAST (1 << 6) + +/* update macro depending on INPUT_EN and PULL_ENA */ +#undef PIN_OUTPUT +#undef PIN_OUTPUT_PULLUP +#undef PIN_OUTPUT_PULLDOWN +#undef PIN_INPUT +#undef PIN_INPUT_PULLUP +#undef PIN_INPUT_PULLDOWN + +#define PIN_OUTPUT (PULL_DISABLE) +#define PIN_OUTPUT_PULLUP (PULL_UP) +#define PIN_OUTPUT_PULLDOWN 0 +#define PIN_INPUT (INPUT_EN | PULL_DISABLE) +#define PIN_INPUT_PULLUP (INPUT_EN | PULL_UP) +#define PIN_INPUT_PULLDOWN (INPUT_EN) + +/* undef non-existing modes */ +#undef PIN_OFF_NONE +#undef PIN_OFF_OUTPUT_HIGH +#undef PIN_OFF_OUTPUT_LOW +#undef PIN_OFF_INPUT_PULLUP +#undef PIN_OFF_INPUT_PULLDOWN +#undef PIN_OFF_WAKEUPENABLE +
Signature · 1 line
1.7.5.4
PATCH v2 4/4 ARM: dts: AM33XX: Use pinctrl constants
In reply to Florian VaussardUsing constants for pinctrl allows a better readability, and removes redundancy with comments.
--- arch/arm/boot/dts/am335x-bone.dts | 18 +++++----- arch/arm/boot/dts/am335x-evm.dts | 58 ++++++++++++++++++------------------ arch/arm/boot/dts/am335x-evmsk.dts | 26 ++++++++-------- arch/arm/boot/dts/am33xx.dtsi | 1 + 4 files changed, 52 insertions(+), 51 deletions(-)
arch/arm/boot/dts/am335x-bone.dts +9 -9
@@ -30,30 +30,30 @@ user_leds_s0: user_leds_s0 { pinctrl-single,pins = < - 0x54 0x7 /* gpmc_a5.gpio1_21, OUTPUT | MODE7 */ - 0x58 0x17 /* gpmc_a6.gpio1_22, OUTPUT_PULLUP | MODE7 */ - 0x5c 0x7 /* gpmc_a7.gpio1_23, OUTPUT | MODE7 */ - 0x60 0x17 /* gpmc_a8.gpio1_24, OUTPUT_PULLUP | MODE7 */ + 0x54 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a5.gpio1_21 */ + 0x58 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a6.gpio1_22 */ + 0x5c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_a7.gpio1_23 */ + 0x60 (PIN_OUTPUT_PULLUP | MUX_MODE7) /* gpmc_a8.gpio1_24 */ >; }; i2c0_pins: pinmux_i2c0_pins { pinctrl-single,pins = < - 0x188 0x30 /* i2c0_sda.i2c0_sda PULLUP | INPUTENABLE | MODE0 */ - 0x18c 0x30 /* i2c0_scl.i2c0_scl PULLUP | INPUTENABLE | MODE0 */ + 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */ + 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */ >; }; uart0_pins: pinmux_uart0_pins { pinctrl-single,pins = < - 0x170 0x30 /* uart0_rxd.uart0_rxd PULLUP | INPUTENABLE | MODE0 */ - 0x174 0x00 /* uart0_txd.uart0_txd PULLDOWN | MODE0 */ + 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */ + 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */ >; }; clkout2_pin: pinmux_clkout2_pin { pinctrl-single,pins = < - 0x1b4 0x03 /* xdma_event_intr1.clkout2 OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT */ + 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */ >; }; };
arch/arm/boot/dts/am335x-evm.dts +29 -29
94 lines not on this page · raw message
arch/arm/boot/dts/am335x-evmsk.dts +13 -13
@@ -36,39 +36,39 @@ user_leds_s0: user_leds_s0 { pinctrl-single,pins = < - 0x10 0x7 /* gpmc_ad4.gpio1_4, OUTPUT | MODE7 */ - 0x14 0x7 /* gpmc_ad5.gpio1_5, OUTPUT | MODE7 */ - 0x18 0x7 /* gpmc_ad6.gpio1_6, OUTPUT | MODE7 */ - 0x1c 0x7 /* gpmc_ad7.gpio1_7, OUTPUT | MODE7 */ + 0x10 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad4.gpio1_4 */ + 0x14 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad5.gpio1_5 */ + 0x18 (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad6.gpio1_6 */ + 0x1c (PIN_OUTPUT_PULLDOWN | MUX_MODE7) /* gpmc_ad7.gpio1_7 */ >; }; gpio_keys_s0: gpio_keys_s0 { pinctrl-single,pins = < - 0x94 0x27 /* gpmc_oen_ren.gpio2_3, INPUT | MODE7 */ - 0x90 0x27 /* gpmc_advn_ale.gpio2_2, INPUT | MODE7 */ - 0x70 0x27 /* gpmc_wait0.gpio0_30, INPUT | MODE7 */ - 0x9c 0x27 /* gpmc_ben0_cle.gpio2_5, INPUT | MODE7 */ + 0x94 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_oen_ren.gpio2_3 */ + 0x90 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_advn_ale.gpio2_2 */ + 0x70 (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_wait0.gpio0_30 */ + 0x9c (PIN_INPUT_PULLDOWN | MUX_MODE7) /* gpmc_ben0_cle.gpio2_5 */ >; }; i2c0_pins: pinmux_i2c0_pins { pinctrl-single,pins = < - 0x188 0x30 /* i2c0_sda.i2c0_sda PULLUP | INPUTENABLE | MODE0 */ - 0x18c 0x30 /* i2c0_scl.i2c0_scl PULLUP | INPUTENABLE | MODE0 */ + 0x188 (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_sda.i2c0_sda */ + 0x18c (PIN_INPUT_PULLUP | MUX_MODE0) /* i2c0_scl.i2c0_scl */ >; }; uart0_pins: pinmux_uart0_pins { pinctrl-single,pins = < - 0x170 0x30 /* uart0_rxd.uart0_rxd PULLUP | INPUTENABLE | MODE0 */ - 0x174 0x00 /* uart0_txd.uart0_txd PULLDOWN | MODE0 */ + 0x170 (PIN_INPUT_PULLUP | MUX_MODE0) /* uart0_rxd.uart0_rxd */ + 0x174 (PIN_OUTPUT_PULLDOWN | MUX_MODE0) /* uart0_txd.uart0_txd */ >; }; clkout2_pin: pinmux_clkout2_pin { pinctrl-single,pins = < - 0x1b4 0x03 /* xdma_event_intr1.clkout2 OMAP_MUX_MODE3 | AM33XX_PIN_OUTPUT */ + 0x1b4 (PIN_OUTPUT_PULLDOWN | MUX_MODE3) /* xdma_event_intr1.clkout2 */ >; }; };
arch/arm/boot/dts/am33xx.dtsi +1 -0
@@ -9,6 +9,7 @@ */ #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/pinctrl/am33xx.h> #include "skeleton.dtsi"
Signature · 1 line
1.7.5.4
v2 cover ARM: dts: AM3XXX: Use preprocessor for device trees
In reply to Florian Vaussard+ Afzal,
Hi Vaibhav and Afzal,
Can someone test this series before I pull it. I still don't have any AM board to do it myself :-(
In theory, it should be fine since Florian already checked the diff, but just in case.
Thanks,
Benoit
Quoted 38 lines · Florian Vaussard
Hello,
Following my series for OMAP2+, this series makes use of the C preprocessor when compiling AM3xxx DT files, and accomplishes some improvements to improve overall readability.
The .dtb files were diff-tested before and after applying the series to guarantee identity for all targets.
To enable pullup/down on the pad, the bit should be cleared on AM33xx, where it should be set on OMAP3. This was wrong in my first version.
This series is based on Benoit's 'for_3.11/dts' branch.
Regards,
Florian
From v2:
- Rebased on Benoit's 'for_3.11/dts'
- Fixed inversed bit to enable pullups ('1' on OMAP, but '0' on AM33xx)Florian Vaussard (4):
ARM: dts: AM3XXX: Use #include for all device trees
ARM: dts: AM33XX: Use existing constants for GPIOs
ARM: dts: AM33XX: Specific pinctrl header
ARM: dts: AM33XX: Use pinctrl constantsarch/arm/boot/dts/am335x-bone.dts | 28 ++++++------ arch/arm/boot/dts/am335x-evm.dts | 76 +++++++++++++++--------------- arch/arm/boot/dts/am335x-evmsk.dts | 46 +++++++++--------- arch/arm/boot/dts/am33xx.dtsi | 5 ++- arch/arm/boot/dts/am3517-evm.dts | 2 +- arch/arm/boot/dts/am3517_mt_ventoux.dts | 2 +- include/dt-bindings/pinctrl/am33xx.h | 37 +++++++++++++++ 7 files changed, 118 insertions(+), 78 deletions(-) create mode 100644 include/dt-bindings/pinctrl/am33xx.h
v2 cover ARM: dts: AM3XXX: Use preprocessor for device trees
Hi Benoit,
Quoted 6 lines · Benoit
+ Afzal,
Hi Vaibhav and Afzal,
Can someone test this series before I pull it. I still don't have any AM board to do it myself :-(
Regards
Afzal
v2 cover ARM: dts: AM3XXX: Use preprocessor for device trees
Quoted 11 lines · Afzal
Hi Benoit,
Quoted 6 lines · Benoit
+ Afzal,
Hi Vaibhav and Afzal,
Can someone test this series before I pull it. I still don't have any AM board to do it myself :-(
Thanks Afzal.
Florian,
I've just pushed the series including Azal tested-by.
I added as well the Makefile change you have done to add missing target with a slight change in the subject:
ARM: dts: OMAP4/AM35xx: Add missing dtb in the dtbs target
Thanks,
Benoit
v2 cover ARM: dts: AM3XXX: Use preprocessor for device trees
Hello,
Quoted 16 lines · Benoit Cousson
Quoted 11 lines · Afzal
Hi Benoit,
Quoted 6 lines · Benoit
+ Afzal,
Hi Vaibhav and Afzal,
Can someone test this series before I pull it. I still don't have any AM board to do it myself :-(
Thanks Afzal.
Quoted 7 lines
Florian,
I've just pushed the series including Azal tested-by.
I added as well theMakefilechange you have done to add missing target with a slight change in the subject:
ARM: dts: OMAP4/AM35xx: Add missing dtb in the dtbs target
Great, thank you!
Florian