r8a77995 Draak SCIF0 LED and KEY Serdev prototype V2
Subsystems (4)
PATCH 1/1 r8a77995 Draak SCIF0 LED and KEY Serdev prototype V2
From: Magnus Damm <[email protected]>
Here's V2 of a work-in-progress patch for shared pin LED and KEY functionality:
- UART TX Serdev LED driver prototype (functional)
- UART RX Serdev KEY driver prototype (functional)
- r8a77995 Draak DTS modifications to use above drivers with SCIF0 and SCIF1
The Draak board has been extended with an external SN74HC05 circuit to make a wired-OR circuit for LED control and push switch detection using UART loopback via on-chip SCIF functionality.
For this version the hardware has been slightly modified from using SCIF0 for both TX and RX to using SCIF0 for TX and SCIF1 for RX. With this change the LED driver and the KEY driver can coexist with serdev without any issues. This made it possible to remove the #ifdefs in the DTS file. Also the DTS changes have been modified to remove the baudrate configuration.
This version depends on the following serdev error notification patch:
[PATCH/RFC] serdev: BREAK/FRAME/PARITY/OVERRUN notification prototype
To silence the SCIF driver the following patch is recommended as well:
[PATCH] serial: sh-sci: Remove BREAK/FRAME/PARITY/OVERRUN printouts
This prototype on r8a77995 Draak makes use of 3 pins:
- LED13/SW59/GP4_07 <-> EXIO_A:10 (CN46)
- SCIF_RX1/GP4_23 <- 17 (CN50)
- SCIF_TX0/GP4_21 -> EXIO_A:36 (CN46)
The prototype LED driver allows user space to turn on/off the LED using:
# echo 1 > /sys/class/leds/serial0-0/brightness # echo 0 > /sys/class/leds/serial0-0/brightness
The prototype KEY driver may be tested using:
# evtest /dev/input/event0
---
Applies to 5.16-rc4
arch/arm64/boot/dts/renesas/draak.dtsi | 45 ++++++++++++ drivers/tty/serdev/Makefile | 2 drivers/tty/serdev/barfoo.c | 109 +++++++++++++++++++++++++++++ drivers/tty/serdev/foobar.c | 119 ++++++++++++++++++++++++++++++++ 4 files changed, 274 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/renesas/draak.dtsi +45 -0
@@ -15,6 +15,8 @@ aliases { serial0 = &scif2; + serial1 = &scif0; /* SCIF_TX0 on GP4_21 */ + serial2 = &scif1; /* SCIF_RX1 on GP4_23 */ ethernet0 = &avb; };
@@ -301,6 +303,15 @@ clock-frequency = <48000000>; }; +&gpio4 { + gp4_07_led13_sw59 { + gpio-hog; + gpios = <7 GPIO_ACTIVE_HIGH>; + input; + line-name = "gp4_07"; + }; +}; + &hsusb { dr_mode = "host"; status = "okay";
@@ -541,6 +552,16 @@ function = "pwm1"; }; + scif0_pins: scif0 { + groups = "scif0_data_a"; + function = "scif0"; + }; + + scif1_pins: scif1 { + groups = "scif1_data_a"; + function = "scif1"; + }; + scif2_pins: scif2 { groups = "scif2_data"; function = "scif2";
@@ -635,6 +656,30 @@ status = "okay"; }; +&scif0 { + pinctrl-0 = <&scif0_pins>; + pinctrl-names = "default"; + + status = "okay"; + + led { + compatible = "serdev,led"; + }; +}; + +&scif1 { + pinctrl-0 = <&scif1_pins>; + pinctrl-names = "default"; + + status = "okay"; + + key { + compatible = "serdev,key"; + label = "SW59"; + linux,keycodes = <KEY_ENTER>; + }; +}; + &scif2 { pinctrl-0 = <&scif2_pins>; pinctrl-names = "default";
drivers/tty/serdev/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -serdev-objs := core.o +serdev-objs := core.o foobar.o barfoo.o obj-$(CONFIG_SERIAL_DEV_BUS) += serdev.o
drivers/tty/serdev/barfoo.c new file +109 -0
109 lines not on this page · raw message
drivers/tty/serdev/foobar.c new file +119 -0
119 lines not on this page · raw message