Skip to content

Commit 1278fd0

Browse files
ioannis-karachalioscfriedt
authored andcommitted
drivers: gpio: smartbond: Fix PDC GPIO port selection
The GPIO block instance is based on the instance number during the device driver initialization. This is not correct as instance numbers in now way reflect any numbering scheme. Therefore, a DTS property is introduced so that the block instance numbering is indicated explicitly. Signed-off-by: Ioannis Karachalios <[email protected]>
1 parent 34c3ccf commit 1278fd0

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

drivers/gpio/gpio_smartbond.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,12 @@ struct gpio_smartbond_config {
7777
volatile uint32_t *mode_regs;
7878
volatile struct gpio_smartbond_latch_regs *latch_regs;
7979
volatile struct gpio_smartbond_wkup_regs *wkup_regs;
80-
/* Value of TRIG_SELECT for PDC_CTRLx_REG entry */
81-
uint8_t wkup_trig_select;
8280
#if CONFIG_PM_DEVICE
8381
uint8_t ngpios;
8482
#endif
83+
#if CONFIG_PM
84+
uint8_t port;
85+
#endif
8586
};
8687

8788
static void gpio_smartbond_wkup_init(void)
@@ -226,7 +227,7 @@ static int gpio_smartbond_pin_interrupt_configure(const struct device *dev,
226227
struct gpio_smartbond_data *data = dev->data;
227228
uint32_t pin_mask = BIT(pin);
228229
#if CONFIG_PM
229-
int trig_select_id = (config->wkup_trig_select << 5) | pin;
230+
int trig_select_id = (config->port << 5) | pin;
230231
int pdc_ix;
231232
#endif
232233

@@ -410,7 +411,7 @@ static DEVICE_API(gpio, gpio_smartbond_drv_api_funcs) = {
410411
DT_INST_REG_ADDR_BY_NAME(id, latch), \
411412
.wkup_regs = (volatile struct gpio_smartbond_wkup_regs *) \
412413
DT_INST_REG_ADDR_BY_NAME(id, wkup), \
413-
.wkup_trig_select = id, \
414+
IF_ENABLED(CONFIG_PM, (.port = DT_INST_PROP(id, port),)) \
414415
GPIO_PM_DEVICE_CFG(.ngpios, DT_INST_PROP(id, ngpios)) \
415416
}; \
416417
\

dts/arm/renesas/smartbond/da1469x.dtsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
compatible = "renesas,smartbond-gpio";
202202
gpio-controller;
203203
#gpio-cells = <2>;
204+
port = <0>;
204205
ngpios = <32>;
205206
reg = <0x50020a00 20
206207
0x50020a18 128
@@ -214,6 +215,7 @@
214215
compatible = "renesas,smartbond-gpio";
215216
gpio-controller;
216217
#gpio-cells = <2>;
218+
port = <1>;
217219
ngpios = <23>;
218220
reg = <0x50020a04 20
219221
0x50020a98 92

dts/bindings/gpio/renesas,smartbond-gpio.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ properties:
1111
reg:
1212
required: true
1313

14+
port:
15+
type: int
16+
required: true
17+
1418
"#gpio-cells":
1519
const: 2
1620

0 commit comments

Comments
 (0)