Skip to content

Commit 99957e1

Browse files
gellhaardanieldegrasse
authored andcommitted
drivers: pinctrl: silabs: Fix multiple analogue bus allocation on same port
Fix ABUS allocation if both EVEN and ODD busses are used for the same port. The initialisation loop would incorrectly overwrite entire GPIO_nBUSALLOC when iterating the pinctrl array, must do a read/mask/update/write sequence. Signed-off-by: Jonny Gellhaar <jonny.gellhaar@prevas.se>
1 parent 533fcc9 commit 99957e1

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/pinctrl/pinctrl_silabs_dbus.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintp
2424
if (pins[i].en_bit == SILABS_PINCTRL_ANALOG) {
2525
enable_reg = DT_INST_REG_ADDR_BY_NAME(0, abus) +
2626
(pins[i].base_offset * sizeof(mem_addr_t));
27-
sys_write32(FIELD_PREP(ABUS_MASK(pins[i].mode), pins[i].route_offset),
28-
enable_reg);
27+
/* Read-modify-write. */
28+
uint32_t reg_val = sys_read32(enable_reg);
29+
30+
reg_val &= ~ABUS_MASK(pins[i].mode);
31+
reg_val |= FIELD_PREP(ABUS_MASK(pins[i].mode), pins[i].route_offset);
32+
sys_write32(reg_val, enable_reg);
2933
continue;
3034
}
3135

0 commit comments

Comments
 (0)