Skip to content

Commit 5d39cc1

Browse files
ebmmykartben
authored andcommitted
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 <[email protected]>
1 parent 379eb7a commit 5d39cc1

File tree

3 files changed

+70
-1
lines changed

3 files changed

+70
-1
lines changed

drivers/pinctrl/pinctrl_rpi_pico.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ static void pinctrl_configure_pin(const pinctrl_soc_pin_t *pin)
2020
gpio_set_input_hysteresis_enabled(pin->pin_num, pin->schmitt_enable);
2121
gpio_set_input_enabled(pin->pin_num, pin->input_enable);
2222
gpio_set_oeover(pin->pin_num, pin->oe_override);
23+
gpio_set_outover(pin->pin_num, pin->out_override);
24+
gpio_set_inover(pin->pin_num, pin->in_override);
25+
gpio_set_irqover(pin->pin_num, pin->irq_override);
2326
}
2427

2528
int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt,

dts/bindings/pinctrl/raspberrypi,pico-pinctrl.yaml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,61 @@ child-binding:
139139
- 2 (RP2_GPIO_OVERRIDE_LOW) - disable output.
140140
- 3 (RP2_GPIO_OVERRIDE_HIGH) - enable output.
141141
142+
The default value is 0, as this is the power on reset value.
143+
raspberrypi,out-override:
144+
type: int
145+
enum:
146+
- 0
147+
- 1
148+
- 2
149+
- 3
150+
default: 0
151+
description: |
152+
Override output for a pin.
153+
154+
- 0 (RP2_GPIO_OVERRIDE_NORMAL) - drive output from selected
155+
peripheral signal.
156+
- 1 (RP2_GPIO_OVERRIDE_INVERT) - drive output from inverse of
157+
selected peripheral signal.
158+
- 2 (RP2_GPIO_OVERRIDE_LOW) - drive output low.
159+
- 3 (RP2_GPIO_OVERRIDE_HIGH) - drive output high.
160+
161+
The default value is 0, as this is the power on reset value.
162+
raspberrypi,in-override:
163+
type: int
164+
enum:
165+
- 0
166+
- 1
167+
- 2
168+
- 3
169+
default: 0
170+
description: |
171+
Override input for a pin.
172+
173+
- 0 (RP2_GPIO_OVERRIDE_NORMAL) - drive input from selected
174+
pin.
175+
- 1 (RP2_GPIO_OVERRIDE_INVERT) - drive input from inverse of
176+
selected pin.
177+
- 2 (RP2_GPIO_OVERRIDE_LOW) - drive input low.
178+
- 3 (RP2_GPIO_OVERRIDE_HIGH) - drive input high.
179+
180+
The default value is 0, as this is the power on reset value.
181+
raspberrypi,irq-override:
182+
type: int
183+
enum:
184+
- 0
185+
- 1
186+
- 2
187+
- 3
188+
default: 0
189+
description: |
190+
Override interrupt signal for a pin.
191+
192+
- 0 (RP2_GPIO_OVERRIDE_NORMAL) - drive interrupt signal to selected
193+
peripheral.
194+
- 1 (RP2_GPIO_OVERRIDE_INVERT) - drive interrupt signal from inverse to
195+
selected peripheral.
196+
- 2 (RP2_GPIO_OVERRIDE_LOW) - drive interrupt signal low.
197+
- 3 (RP2_GPIO_OVERRIDE_HIGH) - drive interrupt signal high.
198+
142199
The default value is 0, as this is the power on reset value.

soc/raspberrypi/rpi_pico/common/pinctrl_soc.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ struct rpi_pinctrl_soc_pin {
3131
uint32_t schmitt_enable : 1;
3232
/** Output-enable override */
3333
uint32_t oe_override : 2;
34+
/** Output override */
35+
uint32_t out_override : 2;
36+
/** Input override */
37+
uint32_t in_override : 2;
38+
/** Interrupt override */
39+
uint32_t irq_override : 2;
3440
};
3541

3642
typedef struct rpi_pinctrl_soc_pin pinctrl_soc_pin_t;
@@ -52,7 +58,10 @@ typedef struct rpi_pinctrl_soc_pin pinctrl_soc_pin_t;
5258
DT_PROP(node_id, bias_pull_down), \
5359
DT_PROP(node_id, input_enable), \
5460
DT_PROP(node_id, input_schmitt_enable), \
55-
DT_PROP(node_id, raspberrypi_oe_override), \
61+
DT_PROP(node_id, raspberrypi_oe_override), \
62+
DT_PROP(node_id, raspberrypi_out_override), \
63+
DT_PROP(node_id, raspberrypi_in_override), \
64+
DT_PROP(node_id, raspberrypi_irq_override), \
5665
},
5766

5867
/**

0 commit comments

Comments
 (0)