linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu
@ 2021-06-20  5:21 Magnus Damm
  2021-06-20  5:21 ` [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support Magnus Damm
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Magnus Damm @ 2021-06-20  5:21 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm, geert+renesas

SoftSW DIP switch support for Draak, Eagle and Ebisu

[PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support
[PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support
[PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support

These patches add support for on-board SoftSW DIP switches to the
Draak, Eagle and Ebisu boards via board specific DTS changes. 

The GPIOs connecting the DIP switches to the SoC are board specific. There
are no on-board pull-ups mounted so internal resistors need to be enabled as
pull-ups for these boards. As expected 2k resistors are used to tie the
signals to ground for the case the DIP switch is set to ON.

All keys have been tested by toggling each DIP switch and making sure the
interrupt count in /proc/interrupts is changing as expected. The voltage level
of each signal has not been measured at this point so there is a small risk
that the internal pull-up isn't enabled and the signal is floating.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 Developed on top of renesas-drivers-2021-06-08-v5.13-rc5

 arch/arm64/boot/dts/renesas/r8a77970-eagle.dts |   43 ++++++++++++++++++++++++
 arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts |   42 +++++++++++++++++++++++
 arch/arm64/boot/dts/renesas/r8a77995-draak.dts |   42 +++++++++++++++++++++++
 3 files changed, 127 insertions(+)
    

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support
  2021-06-20  5:21 [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu Magnus Damm
@ 2021-06-20  5:21 ` Magnus Damm
  2021-06-21 10:46   ` Geert Uytterhoeven
  2021-06-20  5:21 ` [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support Magnus Damm
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Magnus Damm @ 2021-06-20  5:21 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm, geert+renesas

From: Magnus Damm <damm+renesas@opensource.se>

Add support for SW56 via "gpio-keys" on the R-Car D3 Draak board.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a77995-draak.dts |   42 ++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

--- 0001/arch/arm64/boot/dts/renesas/r8a77995-draak.dts
+++ work/arch/arm64/boot/dts/renesas/r8a77995-draak.dts	2021-06-19 19:14:36.138670038 +0900
@@ -9,6 +9,7 @@
 /dts-v1/;
 #include "r8a77995.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
 	model = "Renesas Draak board based on r8a77995";
@@ -67,6 +68,42 @@
 		};
 	};
 
+	keys {
+		compatible = "gpio-keys";
+
+		pinctrl-0 = <&keys_pins>;
+		pinctrl-names = "default";
+
+		key-1 {
+			gpios = <&gpio4 12 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_1>;
+			label = "SW56-1";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-2 {
+			gpios = <&gpio4 13 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_2>;
+			label = "SW56-2";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-3 {
+			gpios = <&gpio4 14 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_3>;
+			label = "SW56-3";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-4 {
+			gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_4>;
+			label = "SW56-4";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+	};
+
 	lvds-decoder {
 		compatible = "thine,thc63lvd1024";
 		vcc-supply = <&reg_3p3v>;
@@ -422,6 +459,11 @@
 		function = "i2c1";
 	};
 
+	keys_pins: keys {
+		pins = "GP_4_12", "GP_4_13", "GP_4_14", "GP_4_15";
+		bias-pull-up;
+	};
+
 	pwm0_pins: pwm0 {
 		groups = "pwm0_c";
 		function = "pwm0";

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support
  2021-06-20  5:21 [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu Magnus Damm
  2021-06-20  5:21 ` [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support Magnus Damm
@ 2021-06-20  5:21 ` Magnus Damm
  2021-06-21 11:03   ` Geert Uytterhoeven
  2021-06-20  5:21 ` [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support Magnus Damm
  2021-06-21 11:12 ` [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu Geert Uytterhoeven
  3 siblings, 1 reply; 8+ messages in thread
From: Magnus Damm @ 2021-06-20  5:21 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm, geert+renesas

From: Magnus Damm <damm+renesas@opensource.se>

Add support for SW2 via "gpio-keys" on the R-Car V3M Eagle board.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a77970-eagle.dts |   43 ++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

--- 0001/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
+++ work/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts	2021-06-19 19:26:28.399714892 +0900
@@ -8,6 +8,8 @@
 
 /dts-v1/;
 #include "r8a77970.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
 	model = "Renesas Eagle board based on r8a77970";
@@ -43,6 +45,42 @@
 		};
 	};
 
+	keys {
+		compatible = "gpio-keys";
+
+		pinctrl-0 = <&keys_pins>;
+		pinctrl-names = "default";
+
+		key-1 {
+			gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_1>;
+			label = "SW2-1";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-2 {
+			gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_2>;
+			label = "SW2-2";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-3 {
+			gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_3>;
+			label = "SW2-3";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-4 {
+			gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_4>;
+			label = "SW2-4";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+	};
+
 	lvds-decoder {
 		compatible = "thine,thc63lvd1024";
 
@@ -196,6 +234,11 @@
 		function = "i2c0";
 	};
 
+	keys_pins: keys {
+		pins = "GP_1_21", "GP_1_22", "GP_1_23", "GP_1_24";
+		bias-pull-up;
+	};
+
 	qspi0_pins: qspi0 {
 		groups = "qspi0_ctrl", "qspi0_data4";
 		function = "qspi0";

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support
  2021-06-20  5:21 [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu Magnus Damm
  2021-06-20  5:21 ` [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support Magnus Damm
  2021-06-20  5:21 ` [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support Magnus Damm
@ 2021-06-20  5:21 ` Magnus Damm
  2021-06-21 11:09   ` Geert Uytterhoeven
  2021-06-21 11:12 ` [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu Geert Uytterhoeven
  3 siblings, 1 reply; 8+ messages in thread
From: Magnus Damm @ 2021-06-20  5:21 UTC (permalink / raw)
  To: linux-renesas-soc; +Cc: Magnus Damm, geert+renesas

From: Magnus Damm <damm+renesas@opensource.se>

Add support for SW4 via "gpio-keys" on the R-Car E3 Ebisu board.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts |   42 ++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

--- 0001/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts
+++ work/arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts	2021-06-19 19:08:07.927645590 +0900
@@ -8,6 +8,7 @@
 /dts-v1/;
 #include "r8a77990.dtsi"
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
 	model = "Renesas Ebisu board based on r8a77990";
@@ -80,6 +81,42 @@
 		};
 	};
 
+	keys {
+		compatible = "gpio-keys";
+
+		pinctrl-0 = <&keys_pins>;
+		pinctrl-names = "default";
+
+		key-1 {
+			gpios = <&gpio5 10 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_1>;
+			label = "SW4-1";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-2 {
+			gpios = <&gpio5 11 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_2>;
+			label = "SW4-2";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-3 {
+			gpios = <&gpio5 12 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_3>;
+			label = "SW4-3";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-4 {
+			gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_4>;
+			label = "SW4-4";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+	};
+
 	lvds-decoder {
 		compatible = "thine,thc63lvd1024";
 		vcc-supply = <&reg_3p3v>;
@@ -540,6 +577,11 @@
 		function = "intc_ex";
 	};
 
+	keys_pins: keys {
+		pins = "GP_5_10", "GP_5_11", "GP_5_12", "GP_5_13";
+		bias-pull-up;
+	};
+
 	pwm3_pins: pwm3 {
 		groups = "pwm3_b";
 		function = "pwm3";

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support
  2021-06-20  5:21 ` [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support Magnus Damm
@ 2021-06-21 10:46   ` Geert Uytterhoeven
  0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2021-06-21 10:46 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Linux-Renesas

On Sun, Jun 20, 2021 at 8:01 AM Magnus Damm <damm@opensource.se> wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> Add support for SW56 via "gpio-keys" on the R-Car D3 Draak board.
>
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v5.15.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support
  2021-06-20  5:21 ` [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support Magnus Damm
@ 2021-06-21 11:03   ` Geert Uytterhoeven
  0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2021-06-21 11:03 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Linux-Renesas

Hi Magnus,

On Sun, Jun 20, 2021 at 8:01 AM Magnus Damm <damm@opensource.se> wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> Add support for SW2 via "gpio-keys" on the R-Car V3M Eagle board.
>
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>

Thanks for your patch!

> --- 0001/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
> +++ work/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts 2021-06-19 19:26:28.399714892 +0900
> @@ -8,6 +8,8 @@
>
>  /dts-v1/;
>  #include "r8a77970.dtsi"
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
>
>  / {
>         model = "Renesas Eagle board based on r8a77970";
> @@ -43,6 +45,42 @@
>                 };
>         };
>
> +       keys {
> +               compatible = "gpio-keys";
> +
> +               pinctrl-0 = <&keys_pins>;
> +               pinctrl-names = "default";
> +
> +               key-1 {
> +                       gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_1>;
> +                       label = "SW2-1";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +               key-2 {
> +                       gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_2>;
> +                       label = "SW2-2";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +               key-3 {
> +                       gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_3>;
> +                       label = "SW2-3";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +               key-4 {
> +                       gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_4>;
> +                       label = "SW2-4";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +       };
> +
>         lvds-decoder {
>                 compatible = "thine,thc63lvd1024";
>
> @@ -196,6 +234,11 @@

>                 function = "i2c0";
>         };
>
> +       keys_pins: keys {
> +               pins = "GP_1_21", "GP_1_22", "GP_1_23", "GP_1_24";

While Section 2.11 ("GPIO Interfaces for Debugging") of the "R-CarV3M
System Evaluation Board / Eagle Hardware Manual" (Rev 0.08) says:

    When using the software switches, enable the internal pull-up
    functions of GP1_21, GP1_22, GP1_23, and GP1_24.

I think GP_1_21 should be dropped, as it's already pulled-up by R427.

Furthermore, as the Eagle DTS has CANFD enabled, SW2-1 and SW2-2
are not available, so both should be dropped.

Presumably you have SW32=on, so SW2-2 works, and CANFD doesn't?
Probably we should document this in the DTS.

> +               bias-pull-up;
> +       };
> +
>         qspi0_pins: qspi0 {
>                 groups = "qspi0_ctrl", "qspi0_data4";
>                 function = "qspi0";

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support
  2021-06-20  5:21 ` [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support Magnus Damm
@ 2021-06-21 11:09   ` Geert Uytterhoeven
  0 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2021-06-21 11:09 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Linux-Renesas

On Sun, Jun 20, 2021 at 8:01 AM Magnus Damm <damm@opensource.se> wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> Add support for SW4 via "gpio-keys" on the R-Car E3 Ebisu board.
>
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v5.15.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu
  2021-06-20  5:21 [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu Magnus Damm
                   ` (2 preceding siblings ...)
  2021-06-20  5:21 ` [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support Magnus Damm
@ 2021-06-21 11:12 ` Geert Uytterhoeven
  3 siblings, 0 replies; 8+ messages in thread
From: Geert Uytterhoeven @ 2021-06-21 11:12 UTC (permalink / raw)
  To: Magnus Damm; +Cc: Linux-Renesas

Hi Magnus,

On Sun, Jun 20, 2021 at 8:01 AM Magnus Damm <damm@opensource.se> wrote:
> SoftSW DIP switch support for Draak, Eagle and Ebisu
>
> [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support
> [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support
> [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support
>
> These patches add support for on-board SoftSW DIP switches to the
> Draak, Eagle and Ebisu boards via board specific DTS changes.

Thanks for your series!

> The GPIOs connecting the DIP switches to the SoC are board specific. There
> are no on-board pull-ups mounted so internal resistors need to be enabled as
> pull-ups for these boards. As expected 2k resistors are used to tie the
> signals to ground for the case the DIP switch is set to ON.
>
> All keys have been tested by toggling each DIP switch and making sure the
> interrupt count in /proc/interrupts is changing as expected. The voltage level
> of each signal has not been measured at this point so there is a small risk
> that the internal pull-up isn't enabled and the signal is floating.

Fortunately the reset state of the PUEN/PUD registers has all pull-ups
enabled for all GPIO lines connected to these DIP switches.
To make sure Linux enforces this configuration, you need to apply
"[PATCH 00/12] pinctrl: renesas: Add more bias pinconf support"
https://lore.kernel.org/linux-gpio/cover.1619785375.git.geert+renesas@glider.be/

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-06-21 11:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20  5:21 [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu Magnus Damm
2021-06-20  5:21 ` [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support Magnus Damm
2021-06-21 10:46   ` Geert Uytterhoeven
2021-06-20  5:21 ` [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support Magnus Damm
2021-06-21 11:03   ` Geert Uytterhoeven
2021-06-20  5:21 ` [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support Magnus Damm
2021-06-21 11:09   ` Geert Uytterhoeven
2021-06-21 11:12 ` [PATCH 0/3] SoftSW DIP switch support for Draak, Eagle and Ebisu Geert Uytterhoeven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).