From 28fba61880bd0d4c28b32aa08ed78bb336cea8f5 Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Fri, 12 Feb 2021 15:44:06 +0100 Subject: [PATCH 1/3] soc: arm: nrf5340: add QDEC capability in nRF5340 SoC definition Add Kconfig options to signify that the nRF5340 HW has support for QDEC instances. Select the options in the nRF5340 Application core definition. Signed-off-by: Ioannis Glaropoulos --- soc/arm/nordic_nrf/Kconfig.peripherals | 6 ++++++ soc/arm/nordic_nrf/nrf53/Kconfig.soc | 2 ++ 2 files changed, 8 insertions(+) diff --git a/soc/arm/nordic_nrf/Kconfig.peripherals b/soc/arm/nordic_nrf/Kconfig.peripherals index c5b8fa9dcb254..5692b9692ad0e 100644 --- a/soc/arm/nordic_nrf/Kconfig.peripherals +++ b/soc/arm/nordic_nrf/Kconfig.peripherals @@ -109,6 +109,12 @@ config HAS_HW_NRF_PWM3 config HAS_HW_NRF_QDEC bool +config HAS_HW_NRF_QDEC0 + bool + +config HAS_HW_NRF_QDEC1 + bool + config HAS_HW_NRF_QSPI bool diff --git a/soc/arm/nordic_nrf/nrf53/Kconfig.soc b/soc/arm/nordic_nrf/nrf53/Kconfig.soc index 405656166224b..54315b93c4374 100644 --- a/soc/arm/nordic_nrf/nrf53/Kconfig.soc +++ b/soc/arm/nordic_nrf/nrf53/Kconfig.soc @@ -31,6 +31,8 @@ config SOC_NRF5340_CPUAPP select HAS_HW_NRF_PWM1 select HAS_HW_NRF_PWM2 select HAS_HW_NRF_PWM3 + select HAS_HW_NRF_QDEC0 + select HAS_HW_NRF_QDEC1 select HAS_HW_NRF_QSPI select HAS_HW_NRF_RTC0 select HAS_HW_NRF_RTC1 From 23951a51c0a0f8d54aca102e7c811a0f3bcf143f Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Fri, 12 Feb 2021 16:34:46 +0100 Subject: [PATCH 2/3] dts: arm: nordic: add QDEC nodes for nrf5340 Add device tree nodes for QDEC peripheral instances for nRF5340 Application core. Signed-off-by: Ioannis Glaropoulos --- dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi | 16 ++++++++++++++++ modules/hal_nordic/nrfx/Kconfig | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi index f1c8017cc0828..ef0bd1f497ed6 100644 --- a/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi +++ b/dts/arm/nordic/nrf5340_cpuapp_peripherals.dtsi @@ -112,6 +112,22 @@ pdm0: pdm@26000 { label = "PDM_0"; }; +qdec0: qdec@33000 { + compatible = "nordic,nrf-qdec"; + reg = <0x33000 0x1000>; + interrupts = <51 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + label = "QDEC_0"; +}; + +qdec1: qdec@34000 { + compatible = "nordic,nrf-qdec"; + reg = <0x34000 0x1000>; + interrupts = <52 NRF_DEFAULT_IRQ_PRIORITY>; + status = "disabled"; + label = "QDEC_1"; +}; + regulators: regulator@4000 { compatible = "nordic,nrf-regulators"; reg = <0x4000 0x1000>; diff --git a/modules/hal_nordic/nrfx/Kconfig b/modules/hal_nordic/nrfx/Kconfig index 7a9016d8b5c36..4d34f6c73a230 100644 --- a/modules/hal_nordic/nrfx/Kconfig +++ b/modules/hal_nordic/nrfx/Kconfig @@ -129,7 +129,7 @@ config NRFX_PWM3 config NRFX_QDEC bool "Enable QDEC driver" - depends on HAS_HW_NRF_QDEC + depends on HAS_HW_NRF_QDEC || HAS_HW_NRF_QDEC0 config NRFX_QSPI bool "Enable QSPI driver" From 852b60a1066d8feb981553c3b54d704b6b0476f7 Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Fri, 12 Feb 2021 16:54:52 +0100 Subject: [PATCH 3/3] drivers: sensor: nrf: fix dependencies for QDEC_NRFX QDEC_NRFX shall depend on either HAS_HW_NRF_QDEC, or HAS_HW_NRF_QDEC0, since in the nRF5340 Application core definition we select HAS_HW_NRF_QDEC0 instead of HAS_HW_NRF_QDEC. Signed-off-by: Ioannis Glaropoulos --- drivers/sensor/qdec_nrfx/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/sensor/qdec_nrfx/Kconfig b/drivers/sensor/qdec_nrfx/Kconfig index 92e40a939e844..753b2158d7ff2 100644 --- a/drivers/sensor/qdec_nrfx/Kconfig +++ b/drivers/sensor/qdec_nrfx/Kconfig @@ -3,7 +3,7 @@ config QDEC_NRFX bool "Nordic QDEC nrfx driver" - depends on HAS_HW_NRF_QDEC + depends on HAS_HW_NRF_QDEC || HAS_HW_NRF_QDEC0 select NRFX_QDEC help Enable support for nrfx QDEC driver for nRF MCU series.