From 7899b1f5b67f7ec5f8082a313a98926da60b49c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 24 Jan 2020 16:22:50 +0100 Subject: [PATCH] modules: hal_nordic: Update nrfx to version 2.1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../nrf5340_dk_nrf5340_cpuapp_common.dts | 1 + drivers/spi/Kconfig.nrfx | 55 +++++++---- drivers/spi/spi_nrfx_spim.c | 4 + dts/arm/nordic/nrf5340_cpuapp.dtsi | 7 ++ dts/arm/nordic/nrf5340_cpuapp_common.dtsi | 91 ++++++++++++++++++- dts/arm/nordic/nrf5340_cpuappns.dtsi | 7 ++ modules/Kconfig.nordic | 11 ++- soc/arm/nordic_nrf/Kconfig.peripherals | 6 ++ soc/arm/nordic_nrf/nrf53/Kconfig.soc | 16 +++- soc/arm/nordic_nrf/validate_base_addresses.c | 14 ++- west.yml | 2 +- 11 files changed, 190 insertions(+), 24 deletions(-) diff --git a/boards/arm/nrf5340_dk_nrf5340/nrf5340_dk_nrf5340_cpuapp_common.dts b/boards/arm/nrf5340_dk_nrf5340/nrf5340_dk_nrf5340_cpuapp_common.dts index 41439957e82..857d9fd18f8 100644 --- a/boards/arm/nrf5340_dk_nrf5340/nrf5340_dk_nrf5340_cpuapp_common.dts +++ b/boards/arm/nrf5340_dk_nrf5340/nrf5340_dk_nrf5340_cpuapp_common.dts @@ -108,6 +108,7 @@ }; &spi2 { + compatible = "nordic,nrf-spim"; status = "okay"; sck-pin = <32>; mosi-pin = <32>; diff --git a/drivers/spi/Kconfig.nrfx b/drivers/spi/Kconfig.nrfx index 5964a9dbb44..2fa7896ed3d 100644 --- a/drivers/spi/Kconfig.nrfx +++ b/drivers/spi/Kconfig.nrfx @@ -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 @@ -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 @@ -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 @@ -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) @@ -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 diff --git a/drivers/spi/spi_nrfx_spim.c b/drivers/spi/spi_nrfx_spim.c index 2db9b83133a..1b67788ceef 100644 --- a/drivers/spi/spi_nrfx_spim.c +++ b/drivers/spi/spi_nrfx_spim.c @@ -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 diff --git a/dts/arm/nordic/nrf5340_cpuapp.dtsi b/dts/arm/nordic/nrf5340_cpuapp.dtsi index 7db4504b108..659c4dddf97 100644 --- a/dts/arm/nordic/nrf5340_cpuapp.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp.dtsi @@ -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; @@ -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; diff --git a/dts/arm/nordic/nrf5340_cpuapp_common.dtsi b/dts/arm/nordic/nrf5340_cpuapp_common.dtsi index a4b7d995c4c..eaa35f8904d 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_common.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_common.dtsi @@ -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: @@ -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 = ; + 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 = ; + interrupts = <12 1>; + status = "disabled"; + label = "I2C_3"; +}; + spi0: spi@8000 { /* * This spi node can be either SPIM or SPIS, @@ -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 { @@ -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; diff --git a/dts/arm/nordic/nrf5340_cpuappns.dtsi b/dts/arm/nordic/nrf5340_cpuappns.dtsi index 9a6b9414c3e..951fd64e1ba 100644 --- a/dts/arm/nordic/nrf5340_cpuappns.dtsi +++ b/dts/arm/nordic/nrf5340_cpuappns.dtsi @@ -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; diff --git a/modules/Kconfig.nordic b/modules/Kconfig.nordic index 6d250db73ef..41d73b8d69b 100644 --- a/modules/Kconfig.nordic +++ b/modules/Kconfig.nordic @@ -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" @@ -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 || \ @@ -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 diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index 0f2af7a1c41..bc5606c0b1e 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -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 @@ -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 diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.soc b/soc/arm/nordic_nrf/nrf53/Kconfig.soc index eeaf67bf38f..e3bc3498fd4 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.soc @@ -30,25 +30,39 @@ config SOC_NRF5340_CPUAPP select HAS_HW_NRF_PWM0 select HAS_HW_NRF_PWM1 select HAS_HW_NRF_PWM2 + select HAS_HW_NRF_PWM3 select HAS_HW_NRF_RTC0 select HAS_HW_NRF_RTC1 select HAS_HW_NRF_SAADC select HAS_HW_NRF_SPIM0 select HAS_HW_NRF_SPIM1 select HAS_HW_NRF_SPIM2 + select HAS_HW_NRF_SPIM3 + select HAS_HW_NRF_SPIM4 select HAS_HW_NRF_SPIS0 select HAS_HW_NRF_SPIS1 + select HAS_HW_NRF_SPIS2 + select HAS_HW_NRF_SPIS3 select HAS_HW_NRF_SPU select HAS_HW_NRF_TIMER0 select HAS_HW_NRF_TIMER1 select HAS_HW_NRF_TIMER2 select HAS_HW_NRF_TWIM0 select HAS_HW_NRF_TWIM1 + select HAS_HW_NRF_TWIM2 + select HAS_HW_NRF_TWIM3 select HAS_HW_NRF_TWIS0 select HAS_HW_NRF_TWIS1 + select HAS_HW_NRF_TWIS2 + select HAS_HW_NRF_TWIS3 select HAS_HW_NRF_UARTE0 select HAS_HW_NRF_UARTE1 - select HAS_HW_NRF_WDT + select HAS_HW_NRF_UARTE2 + select HAS_HW_NRF_UARTE3 + select HAS_HW_NRF_USBD + select HAS_HW_NRF_USBREG + select HAS_HW_NRF_WDT0 + select HAS_HW_NRF_WDT1 config SOC_NRF5340_CPUNET depends on SOC_SERIES_NRF53X diff --git a/soc/arm/nordic_nrf/validate_base_addresses.c b/soc/arm/nordic_nrf/validate_base_addresses.c index 6237d85ca3d..5096377082d 100644 --- a/soc/arm/nordic_nrf/validate_base_addresses.c +++ b/soc/arm/nordic_nrf/validate_base_addresses.c @@ -15,8 +15,13 @@ * are missing; the below inclusion fills this gap */ #include - -/* Temporary workaround for missing NRF_WDT0 definition. */ +/* + * Provide translation of symbols for peripherals that for some SoCs got names + * without the index. + */ +#ifndef NRF_PDM0 +#define NRF_PDM0 NRF_PDM +#endif #ifndef NRF_WDT0 #define NRF_WDT0 NRF_WDT #endif @@ -96,7 +101,7 @@ CHECK_ADDRESS(DT_INST_0_NORDIC_NRF91_FLASH_CONTROLLER_BASE_ADDRESS, NRF_NVMC); #endif #if defined(DT_NORDIC_NRF_PDM_PDM_0_BASE_ADDRESS) -CHECK_ADDRESS(DT_NORDIC_NRF_PDM_PDM_0_BASE_ADDRESS, NRF_PDM); +CHECK_ADDRESS(DT_NORDIC_NRF_PDM_PDM_0_BASE_ADDRESS, NRF_PDM0); #endif #if defined(DT_INST_0_NORDIC_NRF_POWER_BASE_ADDRESS) @@ -164,6 +169,9 @@ CHECK_ADDRESS(DT_NORDIC_NRF_SPIM_SPI_2_BASE_ADDRESS, NRF_SPIM2); #if defined(DT_NORDIC_NRF_SPIM_SPI_3_BASE_ADDRESS) CHECK_ADDRESS(DT_NORDIC_NRF_SPIM_SPI_3_BASE_ADDRESS, NRF_SPIM3); #endif +#if defined(DT_NORDIC_NRF_SPIM_SPI_4_BASE_ADDRESS) +CHECK_ADDRESS(DT_NORDIC_NRF_SPIM_SPI_4_BASE_ADDRESS, NRF_SPIM4); +#endif #if defined(DT_NORDIC_NRF_SPIS_SPI_0_BASE_ADDRESS) CHECK_ADDRESS(DT_NORDIC_NRF_SPIS_SPI_0_BASE_ADDRESS, NRF_SPIS0); diff --git a/west.yml b/west.yml index 5fc04c0c4a8..bbb2b1e2cf5 100644 --- a/west.yml +++ b/west.yml @@ -47,7 +47,7 @@ manifest: revision: a12d92816a53a521d79cefcf5c38b9dc8a4fed6e path: modules/hal/cypress - name: hal_nordic - revision: 72a785c1f3c25bc98cb5eb90914d19718b6ae4ee + revision: 4a1401d1e1cae0bc464eeb9b3e091efec50bf6c9 path: modules/hal/nordic - name: hal_openisa revision: 9bfbe35aad79fdf552dbdae47a894e26be7c022c