drivers: pinctrl: rp2040: extend pin override config

Add a device-tree property to configure the override
functionalities of RP2040 GPIO pins.

Signed-off-by: Martin Meyer <meyer.m90@gmail.com>
This commit is contained in:
Martin Meyer 2025-04-14 22:15:16 +02:00 committed by Benjamin Cabé
commit 5d39cc1eea
3 changed files with 70 additions and 1 deletions

View file

@ -20,6 +20,9 @@ static void pinctrl_configure_pin(const pinctrl_soc_pin_t *pin)
gpio_set_input_hysteresis_enabled(pin->pin_num, pin->schmitt_enable); gpio_set_input_hysteresis_enabled(pin->pin_num, pin->schmitt_enable);
gpio_set_input_enabled(pin->pin_num, pin->input_enable); gpio_set_input_enabled(pin->pin_num, pin->input_enable);
gpio_set_oeover(pin->pin_num, pin->oe_override); gpio_set_oeover(pin->pin_num, pin->oe_override);
gpio_set_outover(pin->pin_num, pin->out_override);
gpio_set_inover(pin->pin_num, pin->in_override);
gpio_set_irqover(pin->pin_num, pin->irq_override);
} }
int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,

View file

@ -139,4 +139,61 @@ child-binding:
- 2 (RP2_GPIO_OVERRIDE_LOW) - disable output. - 2 (RP2_GPIO_OVERRIDE_LOW) - disable output.
- 3 (RP2_GPIO_OVERRIDE_HIGH) - enable output. - 3 (RP2_GPIO_OVERRIDE_HIGH) - enable output.
The default value is 0, as this is the power on reset value.
raspberrypi,out-override:
type: int
enum:
- 0
- 1
- 2
- 3
default: 0
description: |
Override output for a pin.
- 0 (RP2_GPIO_OVERRIDE_NORMAL) - drive output from selected
peripheral signal.
- 1 (RP2_GPIO_OVERRIDE_INVERT) - drive output from inverse of
selected peripheral signal.
- 2 (RP2_GPIO_OVERRIDE_LOW) - drive output low.
- 3 (RP2_GPIO_OVERRIDE_HIGH) - drive output high.
The default value is 0, as this is the power on reset value.
raspberrypi,in-override:
type: int
enum:
- 0
- 1
- 2
- 3
default: 0
description: |
Override input for a pin.
- 0 (RP2_GPIO_OVERRIDE_NORMAL) - drive input from selected
pin.
- 1 (RP2_GPIO_OVERRIDE_INVERT) - drive input from inverse of
selected pin.
- 2 (RP2_GPIO_OVERRIDE_LOW) - drive input low.
- 3 (RP2_GPIO_OVERRIDE_HIGH) - drive input high.
The default value is 0, as this is the power on reset value.
raspberrypi,irq-override:
type: int
enum:
- 0
- 1
- 2
- 3
default: 0
description: |
Override interrupt signal for a pin.
- 0 (RP2_GPIO_OVERRIDE_NORMAL) - drive interrupt signal to selected
peripheral.
- 1 (RP2_GPIO_OVERRIDE_INVERT) - drive interrupt signal from inverse to
selected peripheral.
- 2 (RP2_GPIO_OVERRIDE_LOW) - drive interrupt signal low.
- 3 (RP2_GPIO_OVERRIDE_HIGH) - drive interrupt signal high.
The default value is 0, as this is the power on reset value. The default value is 0, as this is the power on reset value.

View file

@ -31,6 +31,12 @@ struct rpi_pinctrl_soc_pin {
uint32_t schmitt_enable : 1; uint32_t schmitt_enable : 1;
/** Output-enable override */ /** Output-enable override */
uint32_t oe_override : 2; uint32_t oe_override : 2;
/** Output override */
uint32_t out_override : 2;
/** Input override */
uint32_t in_override : 2;
/** Interrupt override */
uint32_t irq_override : 2;
}; };
typedef struct rpi_pinctrl_soc_pin pinctrl_soc_pin_t; typedef struct rpi_pinctrl_soc_pin pinctrl_soc_pin_t;
@ -52,7 +58,10 @@ typedef struct rpi_pinctrl_soc_pin pinctrl_soc_pin_t;
DT_PROP(node_id, bias_pull_down), \ DT_PROP(node_id, bias_pull_down), \
DT_PROP(node_id, input_enable), \ DT_PROP(node_id, input_enable), \
DT_PROP(node_id, input_schmitt_enable), \ DT_PROP(node_id, input_schmitt_enable), \
DT_PROP(node_id, raspberrypi_oe_override), \ DT_PROP(node_id, raspberrypi_oe_override), \
DT_PROP(node_id, raspberrypi_out_override), \
DT_PROP(node_id, raspberrypi_in_override), \
DT_PROP(node_id, raspberrypi_irq_override), \
}, },
/** /**