From c1ad91405d1991135c19472ccbd81613adf0fc28 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 17 Mar 2022 19:54:43 +0100 Subject: [PATCH] drivers: pinctrl: nrf: fix nordic,nrf-twi handling on nRF51/52 The NRF_TWI_Type struct doesn't have an homogeneous layout between nRF51/52 series. This patch tries to select the right layout based on selected SoC. Signed-off-by: Gerard Marull-Paretas --- drivers/pinctrl/pinctrl_nrf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/pinctrl/pinctrl_nrf.c b/drivers/pinctrl/pinctrl_nrf.c index 7625b2cd627..55f1c7fedd5 100644 --- a/drivers/pinctrl/pinctrl_nrf.c +++ b/drivers/pinctrl/pinctrl_nrf.c @@ -48,7 +48,11 @@ BUILD_ASSERT(((NRF_DRIVE_S0S1 == NRF_GPIO_PIN_S0S1) && #endif /* DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_spis) */ #if DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_twi) +#if !defined(TWI_PSEL_SCL_CONNECT_Pos) #define NRF_PSEL_TWIM(reg, line) ((NRF_TWI_Type *)reg)->PSEL##line +#else +#define NRF_PSEL_TWIM(reg, line) ((NRF_TWI_Type *)reg)->PSEL.line +#endif #elif DT_HAS_COMPAT_STATUS_OKAY(nordic_nrf_twim) #define NRF_PSEL_TWIM(reg, line) ((NRF_TWIM_Type *)reg)->PSEL.line #endif