Skip to content

Commit

Permalink
modules: hal_nordic: Update nrfx to version 2.1.0
Browse files Browse the repository at this point in the history
Update the hal_nordic module revision, to switch to nrfx 2.1.0.

Because the list of peripherals for nRF5340 has changed as follows:
- SPIM2 has been renamed to SPIM4
- SPIM2-3, SPIS2-3, TWIM2-3, TWIS2-3, and UARTE2-3 have been added
a couple of related corrections needed to be applied in dts and Kconfig
files, plus the spi_nrfx_spim driver has been extended with the support
for SPIM4.

Signed-off-by: Andrzej Głąbek <[email protected]>
  • Loading branch information
anangl authored and carlescufi committed Jan 29, 2020
1 parent d852159 commit 7899b1f
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
};

&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
sck-pin = <32>;
mosi-pin = <32>;
Expand Down
55 changes: 39 additions & 16 deletions drivers/spi/Kconfig.nrfx
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,15 @@ config SPI_0_NRF_SPIS

endchoice

if SPI_0_NRF_SPI || SPI_0_NRF_SPIM || SPI_0_NRF_SPIS

config SPI_0_NRF_ORC
hex "SPI Port 0 over-read character"
depends on SPI_0_NRF_SPI || SPI_0_NRF_SPIM || SPI_0_NRF_SPIS
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.

endif # SPI_0_NRF_SPI || SPI_0_NRF_SPIM || SPI_0_NRF_SPIS

endif # SPI_0 && (SOC_NRF52810 || ...

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
Expand Down Expand Up @@ -118,18 +115,15 @@ config SPI_1_NRF_SPIS

endchoice

if SPI_1_NRF_SPI || SPI_1_NRF_SPIM || SPI_1_NRF_SPIS

config SPI_1_NRF_ORC
hex "SPI Port 1 over-read character"
depends on SPI_1_NRF_SPI || SPI_1_NRF_SPIM || SPI_1_NRF_SPIS
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.

endif # SPI_1_NRF_SPI || SPI_1_NRF_SPIM || SPI_1_NRF_SPIS

endif # SPI_1 && !I2C_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE) && ...

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
Expand Down Expand Up @@ -170,18 +164,15 @@ config SPI_2_NRF_SPIS

endchoice

if SPI_2_NRF_SPI || SPI_2_NRF_SPIM || SPI_2_NRF_SPIS

config SPI_2_NRF_ORC
hex "SPI Port 2 over-read character"
depends on SPI_2_NRF_SPI || SPI_2_NRF_SPIM || SPI_2_NRF_SPIS
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.

endif # SPI_2_NRF_SPI || SPI_2_NRF_SPIM || SPI_2_NRF_SPIS

endif # SPI_2 && !I2C_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE) && ...

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
Expand Down Expand Up @@ -213,18 +204,15 @@ config SPI_3_NRF_SPIS

endchoice

if SPI_3_NRF_SPIM || SPI_3_NRF_SPIS

config SPI_3_NRF_ORC
hex "SPI Port 3 over-read character"
depends on SPI_3_NRF_SPIM || SPI_3_NRF_SPIS
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.

endif # SPI_3_NRF_SPIM || SPI_3_NRF_SPIS

config SPI_3_NRF_RX_DELAY
int "SPIM3 MISO sampling delay"
depends on SPI_3_NRF_SPIM && (SOC_NRF52833 || SOC_NRF52840)
Expand All @@ -237,6 +225,41 @@ config SPI_3_NRF_RX_DELAY

endif # SPI_3 && !I2C_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE) && ...

if SPI_4

choice
prompt "SPI Port 4 Driver type"

config SPI_4_NRF_SPIM
bool "nRF SPIM 4"
depends on HAS_HW_NRF_SPIM4
select NRFX_SPIM4
help
Enable nRF SPI Master with EasyDMA on port 4.

endchoice

config SPI_4_NRF_ORC
hex "SPI Port 4 over-read character"
depends on SPI_4_NRF_SPIM
range 0x00 0xff
default 0xff
help
Over-read character. Character clocked out after an over-read
of the transmit buffer.

config SPI_4_NRF_RX_DELAY
int "SPIM4 MISO sampling delay"
depends on SPI_4_NRF_SPIM && SOC_NRF5340_CPUAPP
range 0 7
default 2
help
Number of 64 MHz clock cycles (15.625 ns) delay from the sampling
edge of SCK (leading or trailing, depending on the CPHA setting used)
until the input serial data on MISO is actually sampled.

endif # SPI_4

if NRFX_SPIM

config SPI_NRFX_RAM_BUFFER_SIZE
Expand Down
4 changes: 4 additions & 0 deletions drivers/spi/spi_nrfx_spim.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,3 +439,7 @@ SPI_NRFX_SPIM_DEVICE(2);
#ifdef CONFIG_SPI_3_NRF_SPIM
SPI_NRFX_SPIM_DEVICE(3);
#endif

#ifdef CONFIG_SPI_4_NRF_SPIM
SPI_NRFX_SPIM_DEVICE(4);
#endif
7 changes: 7 additions & 0 deletions dts/arm/nordic/nrf5340_cpuapp.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
rtc-1 = &rtc1;
uart-0 = &uart0;
uart-1 = &uart1;
uart-2 = &uart2;
uart-3 = &uart3;
adc-0 = &adc;
egu-0 = &egu0;
egu-1 = &egu1;
Expand All @@ -46,14 +48,19 @@
gpiote-0 = &gpiote;
i2c-0 = &i2c0;
i2c-1 = &i2c1;
i2c-2 = &i2c2;
i2c-3 = &i2c3;
ipc-0 = &ipc;
pdm-0 = &pdm0;
spi-0 = &spi0;
spi-1 = &spi1;
spi-2 = &spi2;
spi-3 = &spi3;
spi-4 = &spi4;
pwm-0 = &pwm0;
pwm-1 = &pwm1;
pwm-2 = &pwm2;
pwm-3 = &pwm3;
wdt-0 = &wdt;
timer-0 = &timer0;
timer-1 = &timer1;
Expand Down
91 changes: 89 additions & 2 deletions dts/arm/nordic/nrf5340_cpuapp_common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,22 @@ uart1: uart@9000 {
label = "UART_1";
};

uart2: uart@b000 {
compatible = "nordic,nrf-uarte";
reg = <0xb000 0x1000>;
interrupts = <11 1>;
status = "disabled";
label = "UART_2";
};

uart3: uart@c000 {
compatible = "nordic,nrf-uarte";
reg = <0xc000 0x1000>;
interrupts = <12 1>;
status = "disabled";
label = "UART_3";
};

i2c0: i2c@8000 {
/*
* This i2c node can be either TWIM or TWIS, for the user to pick:
Expand Down Expand Up @@ -171,6 +187,38 @@ i2c1: i2c@9000 {
label = "I2C_1";
};

i2c2: i2c@b000 {
/*
* This i2c node can be TWIM or TWIS,
* for the user to pick:
* compatible = "nordic,nrf-twim" or
* "nordic,nrf-twis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0xb000 0x1000>;
clock-frequency = <I2C_BITRATE_STANDARD>;
interrupts = <11 1>;
status = "disabled";
label = "I2C_2";
};

i2c3: i2c@c000 {
/*
* This i2c node can be TWIM or TWIS,
* for the user to pick:
* compatible = "nordic,nrf-twim" or
* "nordic,nrf-twis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0xc000 0x1000>;
clock-frequency = <I2C_BITRATE_STANDARD>;
interrupts = <12 1>;
status = "disabled";
label = "I2C_3";
};

spi0: spi@8000 {
/*
* This spi node can be either SPIM or SPIS,
Expand Down Expand Up @@ -201,14 +249,44 @@ spi1: spi@9000 {
label = "SPI_1";
};

spi2: spi@a000 {
spi2: spi@b000 {
/*
* This spi node can be either SPIM or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0xb000 0x1000>;
interrupts = <11 1>;
status = "disabled";
label = "SPI_2";
};

spi3: spi@c000 {
/*
* This spi node can be either SPIM or SPIS,
* for the user to pick:
* compatible = "nordic,nrf-spim" or
* "nordic,nrf-spis".
*/
#address-cells = <1>;
#size-cells = <0>;
reg = <0xc000 0x1000>;
interrupts = <12 1>;
status = "disabled";
label = "SPI_3";
};

spi4: spi@a000 {
compatible = "nordic,nrf-spim";
#address-cells = <1>;
#size-cells = <0>;
reg = <0xa000 0x1000>;
interrupts = <10 1>;
status = "disabled";
label = "SPI_2";
label = "SPI_4";
};

pwm0: pwm@21000 {
Expand Down Expand Up @@ -238,6 +316,15 @@ pwm2: pwm@23000 {
#pwm-cells = <1>;
};

pwm3: pwm@24000 {
compatible = "nordic,nrf-pwm";
reg = <0x24000 0x1000>;
interrupts = <36 1>;
status = "disabled";
label = "PWM_3";
#pwm-cells = <1>;
};

gpio0: gpio@842500 {
compatible = "nordic,nrf-gpio";
gpio-controller;
Expand Down
7 changes: 7 additions & 0 deletions dts/arm/nordic/nrf5340_cpuappns.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,25 @@
rtc-1 = &rtc1;
uart-0 = &uart0;
uart-1 = &uart1;
uart-2 = &uart2;
uart-3 = &uart3;
adc-0 = &adc;
gpio-0 = &gpio0;
gpio-1 = &gpio1;
gpiote-0 = &gpiote;
i2c-0 = &i2c0;
i2c-1 = &i2c1;
i2c-2 = &i2c2;
i2c-3 = &i2c3;
spi-0 = &spi0;
spi-1 = &spi1;
spi-2 = &spi2;
spi-3 = &spi3;
spi-4 = &spi4;
pwm-0 = &pwm0;
pwm-1 = &pwm1;
pwm-2 = &pwm2;
pwm-3 = &pwm3;
wdt-0 = &wdt;
timer-0 = &timer0;
timer-1 = &timer1;
Expand Down
11 changes: 10 additions & 1 deletion modules/Kconfig.nordic
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ config NRFX_SPI2
config NRFX_SPIM
bool "Enable SPIM driver"
depends on HAS_HW_NRF_SPIM0 || HAS_HW_NRF_SPIM1 || \
HAS_HW_NRF_SPIM2 || HAS_HW_NRF_SPIM3
HAS_HW_NRF_SPIM2 || HAS_HW_NRF_SPIM3 || HAS_HW_NRF_SPIM4

config NRFX_SPIM0
bool "Enable SPIM0 instance"
Expand All @@ -255,6 +255,11 @@ config NRFX_SPIM3
depends on HAS_HW_NRF_SPIM3
select NRFX_SPIM

config NRFX_SPIM4
bool "Enable SPIM4 instance"
depends on HAS_HW_NRF_SPIM4
select NRFX_SPIM

config NRFX_SPIS
bool "Enable SPIS driver"
depends on HAS_HW_NRF_SPIS0 || HAS_HW_NRF_SPIS1 || \
Expand Down Expand Up @@ -422,6 +427,10 @@ config NRFX_USBD
depends on HAS_HW_NRF_USBD
select NRFX_SYSTICK

config NRFX_USBREG
bool "Enable USBREG driver"
depends on HAS_HW_NRF_USBREG

config NRFX_WDT
bool "Enable WDT driver"
depends on HAS_HW_NRF_WDT || HAS_HW_NRF_WDT0 || HAS_HW_NRF_WDT1
Expand Down
6 changes: 6 additions & 0 deletions soc/arm/nordic_nrf/Kconfig.peripherals
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ config HAS_HW_NRF_SPIM2
config HAS_HW_NRF_SPIM3
bool

config HAS_HW_NRF_SPIM4
bool

config HAS_HW_NRF_SPIS0
bool

Expand Down Expand Up @@ -246,6 +249,9 @@ config HAS_HW_NRF_UARTE3
config HAS_HW_NRF_USBD
bool

config HAS_HW_NRF_USBREG
bool

config HAS_HW_NRF_WDT
bool

Expand Down
Loading

0 comments on commit 7899b1f

Please sign in to comment.