Skip to content

Commit afca374

Browse files
committed
drivers: gpio: rcar: Add R-Car Gen4 support
Renesas Gen4 SoCs GPIO IPs are using one more register comparing to Gen3 SoCs. The new "INEN" register is used to enable general input. Signed-off-by: Aymeric Aillet <[email protected]>
1 parent dca33a1 commit afca374

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/gpio/gpio_rcar.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020 IoT.bzh
2+
* Copyright (c) 2020-2023 IoT.bzh
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -47,6 +47,7 @@ struct gpio_rcar_data {
4747
#define FILONOFF 0x28 /* Chattering Prevention On/Off Register */
4848
#define OUTDTSEL 0x40 /* Output Data Select Register */
4949
#define BOTHEDGE 0x4c /* One Edge/Both Edge Select Register */
50+
#define INEN 0x50 /* General Input Enable Register */
5051

5152
static inline uint32_t gpio_rcar_read(const struct gpio_rcar_cfg *config,
5253
uint32_t offs)
@@ -104,6 +105,11 @@ static void gpio_rcar_config_general_input_output_mode(
104105
/* Configure positive logic in POSNEG */
105106
gpio_rcar_modify_bit(config, POSNEG, gpio, false);
106107

108+
/* Select "Input Enable/Disable" in INEN for Gen4 SoCs */
109+
#ifdef CONFIG_SOC_SERIES_RCAR_GEN4
110+
gpio_rcar_modify_bit(config, INEN, gpio, !output);
111+
#endif
112+
107113
/* Select "General Input/Output Mode" in IOINTSEL */
108114
gpio_rcar_modify_bit(config, IOINTSEL, gpio, false);
109115

@@ -231,6 +237,11 @@ static int gpio_rcar_pin_interrupt_configure(const struct device *dev,
231237
gpio_rcar_modify_bit(config, BOTHEDGE, pin, true);
232238
}
233239

240+
/* Select "Input Enable" in INEN for Gen4 SoCs */
241+
#ifdef CONFIG_SOC_SERIES_RCAR_GEN4
242+
gpio_rcar_modify_bit(config, INEN, pin, true);
243+
#endif
244+
234245
gpio_rcar_modify_bit(config, IOINTSEL, pin, true);
235246

236247
if (mode == GPIO_INT_MODE_EDGE) {

0 commit comments

Comments
 (0)