drivers: spi: nrfx_spi(m|s): drop NRFX_SPI(S|M)_INSTANCE usage

Stop using NRFX_SPI(S|M)_INSTANCE helper so that peripheral address from
Devicetree is used. We should not rely on HAL for hardware description
but Devicetree.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-06-20 18:02:27 +02:00 committed by Marti Bolivar
commit e5ba80733a
3 changed files with 16 additions and 6 deletions

View file

@ -319,7 +319,8 @@ static int spi_nrfx_pm_action(const struct device *dev,
/*
* Current factors requiring use of DT_NODELABEL:
*
* - NRFX_SPI_INSTANCE() requires an SoC instance number
* - HAL design (requirement of drv_inst_idx in nrfx_spi_t)
* - Name-based HAL IRQ handlers, e.g. nrfx_spi_0_irq_handler
*/
#define SPI(idx) DT_NODELABEL(spi##idx)
@ -383,7 +384,10 @@ static int spi_nrfx_pm_action(const struct device *dev,
}; \
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(SPI(idx)))); \
static const struct spi_nrfx_config spi_##idx##z_config = { \
.spi = NRFX_SPI_INSTANCE(idx), \
.spi = { \
.p_reg = (NRF_SPI_Type *)DT_REG_ADDR(SPI(idx)), \
.drv_inst_idx = NRFX_SPI##idx##_INST_IDX, \
}, \
.def_config = { \
SPI_NRFX_SPI_PIN_CFG(idx) \
.ss_pin = NRFX_SPI_PIN_NOT_USED, \

View file

@ -569,7 +569,10 @@ static int spim_nrfx_pm_action(const struct device *dev,
}; \
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(SPIM(idx)))); \
static const struct spi_nrfx_config spi_##idx##z_config = { \
.spim = NRFX_SPIM_INSTANCE(idx), \
.spim = { \
.p_reg = (NRF_SPIM_Type *)DT_REG_ADDR(SPIM(idx)), \
.drv_inst_idx = NRFX_SPIM##idx##_INST_IDX, \
}, \
.max_freq = SPIM_PROP(idx, max_frequency), \
.def_config = { \
SPI_NRFX_SPIM_PIN_CFG(idx) \

View file

@ -252,8 +252,8 @@ static int init_spis(const struct device *dev,
/*
* Current factors requiring use of DT_NODELABEL:
*
* - NRFX_SPIS_INSTANCE() requires an SoC instance number
* - soc-instance-numbered kconfig enables
* - HAL design (requirement of drv_inst_idx in nrfx_spis_t)
* - Name-based HAL IRQ handlers, e.g. nrfx_spis_0_irq_handler
*/
#define SPIS(idx) DT_NODELABEL(spi##idx)
@ -302,7 +302,10 @@ static int init_spis(const struct device *dev,
}; \
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(SPIS(idx)))); \
static const struct spi_nrfx_config spi_##idx##z_config = { \
.spis = NRFX_SPIS_INSTANCE(idx), \
.spis = { \
.p_reg = (NRF_SPIS_Type *)DT_REG_ADDR(SPIS(idx)), \
.drv_inst_idx = NRFX_SPIS##idx##_INST_IDX, \
}, \
IF_ENABLED(CONFIG_PINCTRL, \
(.pcfg = PINCTRL_DT_DEV_CONFIG_GET(SPIS(idx)),)) \
}; \