drivers: spi: nrfx_spim: move maximum frequency parameter to DT

Devicetree is the natural place to describe hardware, so move the
maximum frequency the SPI can work with to Devicetree instead of relying
on values from HAL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-06-20 15:26:23 +02:00 committed by Marti Bolivar
commit 4ad3a96059
14 changed files with 38 additions and 1 deletions

View file

@ -568,7 +568,7 @@ static int spim_nrfx_pm_action(const struct device *dev,
static const struct spi_nrfx_config spi_##idx##z_config = { \
.spim = NRFX_SPIM_INSTANCE(idx), \
.max_chunk_len = (1 << SPIM##idx##_EASYDMA_MAXCNT_SIZE) - 1, \
.max_freq = SPIM##idx##_MAX_DATARATE * 1000000, \
.max_freq = SPIM_PROP(idx, max_frequency), \
.def_config = { \
SPI_NRFX_SPIM_PIN_CFG(idx) \
.ss_pin = NRFX_SPIM_PIN_NOT_USED, \

View file

@ -79,6 +79,7 @@
#size-cells = <0>;
reg = <0x40003000 0x1000>;
interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};
@ -106,6 +107,7 @@
#size-cells = <0>;
reg = <0x40004000 0x1000>;
interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_1";
};

View file

@ -111,6 +111,7 @@
#size-cells = <0>;
reg = <0x40004000 0x1000>;
interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};

View file

@ -115,6 +115,7 @@
#size-cells = <0>;
reg = <0x40004000 0x1000>;
interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};

View file

@ -123,6 +123,7 @@
#size-cells = <0>;
reg = <0x40003000 0x1000>;
interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_1";
};
@ -140,6 +141,7 @@
#size-cells = <0>;
reg = <0x40004000 0x1000>;
interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};

View file

@ -117,6 +117,7 @@
#size-cells = <0>;
reg = <0x40003000 0x1000>;
interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};
@ -152,6 +153,7 @@
#size-cells = <0>;
reg = <0x40004000 0x1000>;
interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_1";
};

View file

@ -115,6 +115,7 @@
#size-cells = <0>;
reg = <0x40003000 0x1000>;
interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};
@ -150,6 +151,7 @@
#size-cells = <0>;
reg = <0x40004000 0x1000>;
interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_1";
};
@ -431,6 +433,7 @@
#size-cells = <0>;
reg = <0x40023000 0x1000>;
interrupts = <35 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_2";
};

View file

@ -117,6 +117,7 @@
#size-cells = <0>;
reg = <0x40003000 0x1000>;
interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};
@ -152,6 +153,7 @@
#size-cells = <0>;
reg = <0x40004000 0x1000>;
interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_1";
};
@ -440,6 +442,7 @@
#size-cells = <0>;
reg = <0x40023000 0x1000>;
interrupts = <35 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_2";
};
@ -501,6 +504,7 @@
#size-cells = <0>;
reg = <0x4002f000 0x1000>;
interrupts = <47 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(32)>;
status = "disabled";
label = "SPI_3";
};

View file

@ -112,6 +112,7 @@
#size-cells = <0>;
reg = <0x40003000 0x1000>;
interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};
@ -147,6 +148,7 @@
#size-cells = <0>;
reg = <0x40004000 0x1000>;
interrupts = <4 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_1";
};
@ -435,6 +437,7 @@
#size-cells = <0>;
reg = <0x40023000 0x1000>;
interrupts = <35 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_2";
};
@ -507,6 +510,7 @@
#size-cells = <0>;
reg = <0x4002f000 0x1000>;
interrupts = <47 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(32)>;
status = "disabled";
label = "SPI_3";
};

View file

@ -77,6 +77,7 @@ spi0: spi@8000 {
#size-cells = <0>;
reg = <0x8000 0x1000>;
interrupts = <8 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};
@ -118,6 +119,7 @@ spi1: spi@9000 {
#size-cells = <0>;
reg = <0x9000 0x1000>;
interrupts = <9 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_1";
};
@ -136,6 +138,7 @@ spi4: spi@a000 {
#size-cells = <0>;
reg = <0xa000 0x1000>;
interrupts = <10 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(32)>;
status = "disabled";
label = "SPI_4";
};
@ -169,6 +172,7 @@ spi2: spi@b000 {
#size-cells = <0>;
reg = <0xb000 0x1000>;
interrupts = <11 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_2";
};
@ -210,6 +214,7 @@ spi3: spi@c000 {
#size-cells = <0>;
reg = <0xc000 0x1000>;
interrupts = <12 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_3";
};

View file

@ -192,6 +192,7 @@
#size-cells = <0>;
reg = <0x41013000 0x1000>;
interrupts = <19 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};

View file

@ -232,6 +232,7 @@ spi0: spi@8000 {
#size-cells = <0>;
reg = <0x8000 0x1000>;
interrupts = <8 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_0";
};
@ -247,6 +248,7 @@ spi1: spi@9000 {
#size-cells = <0>;
reg = <0x9000 0x1000>;
interrupts = <9 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_1";
};
@ -262,6 +264,7 @@ spi2: spi@a000 {
#size-cells = <0>;
reg = <0xa000 0x1000>;
interrupts = <10 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_2";
};
@ -277,6 +280,7 @@ spi3: spi@b000 {
#size-cells = <0>;
reg = <0xb000 0x1000>;
interrupts = <11 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
label = "SPI_3";
};

View file

@ -11,6 +11,7 @@
#include <zephyr/dt-bindings/pinctrl/nrf-pinctrl.h>
#include <zephyr/dt-bindings/pwm/pwm.h>
#include <freq.h>
#include <arm/nordic/override.dtsi>
/*
* This value can be overridden at the board level or in an application specific

View file

@ -12,6 +12,13 @@ properties:
interrupts:
required: true
max-frequency:
type: int
required: true
description: |
Maximum data rate the SPI peripheral can be driven at, in Hz. This
property must be set at SoC level DTS files.
sck-pin:
type: int
deprecated: true