drivers: spi: nrfx_spim: max chunk length is SoC specific
The maximum transfer chunk length is SoC specific, not instance specific. This patch defines MAX_CHUNK_LEN at driver level in a SoC specific manner instead of using HAL values that are instance specific but that always take the same value depending on the SoC. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
3c6649f631
commit
72cc583dc9
1 changed files with 5 additions and 4 deletions
|
@ -26,6 +26,9 @@ LOG_MODULE_REGISTER(spi_nrfx_spim, CONFIG_SPI_LOG_LEVEL);
|
||||||
#define SPI_BUFFER_IN_RAM 1
|
#define SPI_BUFFER_IN_RAM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Maximum chunk length (depends on the EasyDMA bits, equal for all instances) */
|
||||||
|
#define MAX_CHUNK_LEN BIT_MASK(SPIM0_EASYDMA_MAXCNT_SIZE)
|
||||||
|
|
||||||
struct spi_nrfx_data {
|
struct spi_nrfx_data {
|
||||||
struct spi_context ctx;
|
struct spi_context ctx;
|
||||||
const struct device *dev;
|
const struct device *dev;
|
||||||
|
@ -44,7 +47,6 @@ struct spi_nrfx_data {
|
||||||
|
|
||||||
struct spi_nrfx_config {
|
struct spi_nrfx_config {
|
||||||
nrfx_spim_t spim;
|
nrfx_spim_t spim;
|
||||||
size_t max_chunk_len;
|
|
||||||
uint32_t max_freq;
|
uint32_t max_freq;
|
||||||
nrfx_spim_config_t def_config;
|
nrfx_spim_config_t def_config;
|
||||||
#ifdef CONFIG_PINCTRL
|
#ifdef CONFIG_PINCTRL
|
||||||
|
@ -304,8 +306,8 @@ static void transfer_next_chunk(const struct device *dev)
|
||||||
tx_buf = dev_data->buffer;
|
tx_buf = dev_data->buffer;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (chunk_len > dev_config->max_chunk_len) {
|
if (chunk_len > MAX_CHUNK_LEN) {
|
||||||
chunk_len = dev_config->max_chunk_len;
|
chunk_len = MAX_CHUNK_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_data->chunk_len = chunk_len;
|
dev_data->chunk_len = chunk_len;
|
||||||
|
@ -567,7 +569,6 @@ static int spim_nrfx_pm_action(const struct device *dev,
|
||||||
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(SPIM(idx)))); \
|
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(SPIM(idx)))); \
|
||||||
static const struct spi_nrfx_config spi_##idx##z_config = { \
|
static const struct spi_nrfx_config spi_##idx##z_config = { \
|
||||||
.spim = NRFX_SPIM_INSTANCE(idx), \
|
.spim = NRFX_SPIM_INSTANCE(idx), \
|
||||||
.max_chunk_len = (1 << SPIM##idx##_EASYDMA_MAXCNT_SIZE) - 1, \
|
|
||||||
.max_freq = SPIM_PROP(idx, max_frequency), \
|
.max_freq = SPIM_PROP(idx, max_frequency), \
|
||||||
.def_config = { \
|
.def_config = { \
|
||||||
SPI_NRFX_SPIM_PIN_CFG(idx) \
|
SPI_NRFX_SPIM_PIN_CFG(idx) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue