dts: arm: add new gpiote instances definition

Added GPIOTE0, GPIOTE1 instances for legacy devices,
GPIOTE20, GPIOTE30 for Moonlight and GPIOTE130,
GPIOTE131 instances for Haltium.

Signed-off-by: Jakub Zymelka <jakub.zymelka@nordicsemi.no>
This commit is contained in:
Jakub Zymelka 2024-01-04 16:06:15 +01:00 committed by Carles Cufí
commit dfbcc8911a
25 changed files with 221 additions and 73 deletions

View file

@ -131,11 +131,12 @@
status = "disabled";
};
gpiote: gpiote@40006000 {
gpiote: gpiote0: gpiote@40006000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40006000 0x1000>;
interrupts = <6 NRF_DEFAULT_IRQ_PRIORITY>;
status = "disabled";
instance = <0>;
};
adc: adc@40007000 {
@ -316,6 +317,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
};
};

View file

@ -132,11 +132,12 @@
status = "disabled";
};
gpiote: gpiote@40006000 {
gpiote: gpiote0: gpiote@40006000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40006000 0x1000>;
interrupts = <6 5>;
status = "disabled";
instance = <0>;
};
adc: adc@40007000 {
@ -311,6 +312,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
};
};

View file

@ -136,11 +136,12 @@
status = "disabled";
};
gpiote: gpiote@40006000 {
gpiote: gpiote0: gpiote@40006000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40006000 0x1000>;
interrupts = <6 5>;
status = "disabled";
instance = <0>;
};
adc: adc@40007000 {
@ -337,6 +338,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
};
};

View file

@ -167,11 +167,12 @@
status = "disabled";
};
gpiote: gpiote@40006000 {
gpiote: gpiote0: gpiote@40006000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40006000 0x1000>;
interrupts = <6 5>;
status = "disabled";
instance = <0>;
};
adc: adc@40007000 {
@ -372,6 +373,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
};
};

View file

@ -180,11 +180,12 @@
status = "disabled";
};
gpiote: gpiote@40006000 {
gpiote: gpiote0: gpiote@40006000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40006000 0x1000>;
interrupts = <6 5>;
status = "disabled";
instance = <0>;
};
timer0: timer@40008000 {
@ -389,6 +390,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
};
};

View file

@ -179,11 +179,12 @@
status = "okay";
};
gpiote: gpiote@40006000 {
gpiote: gpiote0: gpiote@40006000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40006000 0x1000>;
interrupts = <6 5>;
status = "disabled";
instance = <0>;
};
adc: adc@40007000 {
@ -465,6 +466,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
};
};

View file

@ -186,11 +186,12 @@
status = "okay";
};
gpiote: gpiote@40006000 {
gpiote: gpiote0: gpiote@40006000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40006000 0x1000>;
interrupts = <6 5>;
status = "disabled";
instance = <0>;
};
adc: adc@40007000 {
@ -521,6 +522,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
gpio1: gpio@50000300 {
@ -532,6 +534,7 @@
ngpios = <10>;
status = "disabled";
port = <1>;
gpiote-instance = <&gpiote>;
};
};
};

View file

@ -181,11 +181,12 @@
status = "okay";
};
gpiote: gpiote@40006000 {
gpiote: gpiote0: gpiote@40006000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40006000 0x1000>;
interrupts = <6 5>;
status = "disabled";
instance = <0>;
};
adc: adc@40007000 {
@ -525,6 +526,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
gpio1: gpio@50000300 {
@ -536,6 +538,7 @@
ngpios = <16>;
status = "disabled";
port = <1>;
gpiote-instance = <&gpiote>;
};
cryptocell: crypto@5002a000 {

View file

@ -84,6 +84,16 @@
reg = <0x5000d000 0x1000>;
interrupts = <13 5>;
status = "disabled";
instance = <0>;
};
/* Additional Non-Secure GPIOTE instance */
gpiote1: gpiote@4002f000 {
compatible = "nordic,nrf-gpiote";
reg = <0x4002f000 0x1000>;
interrupts = <47 5>;
status = "disabled";
instance = <1>;
};
cryptocell: crypto@50844000 {
@ -104,10 +114,3 @@
&nvic {
arm,num-irq-priority-bits = <3>;
};
/*
* Include the non-secure peripherals file here since
* it expects to be at the root level. This provides
* a node for GPIOTE1.
*/
#include "nrf5340_cpuapp_peripherals_ns.dtsi"

View file

@ -527,6 +527,7 @@ gpio0: gpio@842500 {
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
gpio1: gpio@842800 {
@ -537,6 +538,7 @@ gpio1: gpio@842800 {
ngpios = <16>;
status = "disabled";
port = <1>;
gpiote-instance = <&gpiote>;
};
ieee802154: ieee802154 {

View file

@ -1,20 +0,0 @@
/*
* Copyright (c) 2019 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: Apache-2.0
*/
/*
* GPIOTE1 is always accessible as a non-secure peripheral.
*/
/ {
soc {
gpiote1: gpiote@4002f000 {
compatible = "nordic,nrf-gpiote";
reg = <0x4002f000 0x1000>;
interrupts = <47 5>;
status = "disabled";
};
};
};

View file

@ -48,6 +48,19 @@
*/
#include "nrf5340_cpuapp_peripherals.dtsi"
};
/*
* GPIOTE1 is always accessible as a non-secure peripheral,
* so we give it the 'gpiote' label for use when building
* code for this target.
*/
gpiote: gpiote1: gpiote@4002f000 {
compatible = "nordic,nrf-gpiote";
reg = <0x4002f000 0x1000>;
interrupts = <47 5>;
status = "disabled";
instance = <1>;
};
};
/* Default IPC description */
@ -64,12 +77,3 @@
&nvic {
arm,num-irq-priority-bits = <3>;
};
/*
* Include the non-secure peripherals file here since
* it expects to be at the root level, adding a 'gpiote' label
* for the GPIOTE1 peripheral defined in that file which is
* always accessible as a non-secure peripheral.
*/
#include "nrf5340_cpuapp_peripherals_ns.dtsi"
gpiote: &gpiote1 {};

View file

@ -108,11 +108,12 @@
status = "okay";
};
gpiote: gpiote@4100a000 {
gpiote: gpiote0: gpiote@4100a000 {
compatible = "nordic,nrf-gpiote";
reg = <0x4100a000 0x1000>;
interrupts = <10 5>;
status = "disabled";
instance = <0>;
};
wdt: wdt0: watchdog@4100b000 {
@ -317,6 +318,7 @@
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
gpio1: gpio@418c0800 {
@ -327,6 +329,7 @@
ngpios = <16>;
status = "disabled";
port = <1>;
gpiote-instance = <&gpiote>;
};
};

View file

@ -59,11 +59,26 @@
status = "okay";
};
gpiote: gpiote@5000d000 {
/*
* GPIOTE0 is always accessible as a secure peripheral,
* so we give it the 'gpiote' label for use when building
* code for this target.
*/
gpiote: gpiote0: gpiote@5000d000 {
compatible = "nordic,nrf-gpiote";
reg = <0x5000d000 0x1000>;
interrupts = <13 5>;
status = "disabled";
instance = <0>;
};
/* Additional Non-Secure GPIOTE instance */
gpiote1: gpiote@40031000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40031000 0x1000>;
interrupts = <49 5>;
status = "disabled";
instance = <1>;
};
spu: spu@50003000 {

View file

@ -313,6 +313,7 @@ gpio0: gpio@842500 {
#gpio-cells = <2>;
status = "disabled";
port = <0>;
gpiote-instance = <&gpiote>;
};
rtc0: rtc@14000 {

View file

@ -45,12 +45,17 @@
#include "nrf91_peripherals.dtsi"
};
/* Additional Non-Secure peripherals */
gpiote: gpiote@40031000 {
/*
* GPIOTE1 is always accessible as a non-secure peripheral,
* so we give it the 'gpiote' label for use when building
* code for this target.
*/
gpiote: gpiote1: gpiote@40031000 {
compatible = "nordic,nrf-gpiote";
reg = <0x40031000 0x1000>;
interrupts = <49 5>;
status = "disabled";
instance = <1>;
};
};

View file

@ -11,6 +11,11 @@ properties:
reg:
required: true
gpiote-instance:
type: phandle
description: |
GPIOTE instance that can be used with this GPIO port.
"#gpio-cells":
const: 2

View file

@ -13,3 +13,15 @@ properties:
interrupts:
required: true
instance:
type: int
required: true
description: |
The GPIOTE instance number. GPIOTE instance GPIOTE0 has:
instance = <0>;
And GPIOTE1 has:
instance = <1>;

View file

@ -63,8 +63,37 @@ config NRFX_EGU5
select NRFX_EGU
config NRFX_GPIOTE
bool "GPIOTE driver"
depends on $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
bool
config NRFX_GPIOTE0
bool "GPIOTE0 driver instance"
depends on $(dt_nodelabel_has_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
select NRFX_GPIOTE
config NRFX_GPIOTE1
bool "GPIOTE1 driver instance"
depends on $(dt_nodelabel_has_compat,gpiote1,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
select NRFX_GPIOTE
config NRFX_GPIOTE20
bool "NRFX_GPIOTE20 driver instance"
depends on $(dt_nodelabel_has_compat,gpiote20,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
select NRFX_GPIOTE
config NRFX_GPIOTE30
bool "NRFX_GPIOTE30 driver instance"
depends on $(dt_nodelabel_has_compat,gpiote30,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
select NRFX_GPIOTE
config NRFX_GPIOTE130
bool "NRFX_GPIOTE130 driver instance"
depends on $(dt_nodelabel_has_compat,gpiote130,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
select NRFX_GPIOTE
config NRFX_GPIOTE131
bool "NRFX_GPIOTE131 driver instance"
depends on $(dt_nodelabel_has_compat,gpiote131,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
select NRFX_GPIOTE
config NRFX_GPIOTE_NUM_OF_EVT_HANDLERS
int "Number of event handlers"

View file

@ -117,15 +117,24 @@
#ifdef CONFIG_NRFX_GPIOTE
#define NRFX_GPIOTE_ENABLED 1
#if (defined(CONFIG_SOC_SERIES_NRF91X) || defined(CONFIG_SOC_SERIES_NRF53X)) \
&& defined(NRF_TRUSTZONE_NONSECURE)
#define NRFX_GPIOTE1_ENABLED 1
#else
#endif
#ifdef CONFIG_NRFX_GPIOTE0
#define NRFX_GPIOTE0_ENABLED 1
#endif
#ifdef CONFIG_NRFX_GPIOTE1
#define NRFX_GPIOTE1_ENABLED 1
#endif
#ifdef CONFIG_NRFX_GPIOTE_LOG
#define NRFX_GPIOTE_CONFIG_LOG_ENABLED 1
#ifdef CONFIG_NRFX_GPIOTE20
#define NRFX_GPIOTE20_ENABLED 1
#endif
#ifdef CONFIG_NRFX_GPIOTE30
#define NRFX_GPIOTE30_ENABLED 1
#endif
#ifdef CONFIG_NRFX_GPIOTE130
#define NRFX_GPIOTE130_ENABLED 1
#endif
#ifdef CONFIG_NRFX_GPIOTE131
#define NRFX_GPIOTE131_ENABLED 1
#endif
#ifdef CONFIG_NRFX_GPIOTE_NUM_OF_EVT_HANDLERS

View file

@ -83,6 +83,7 @@
* between secure and non-secure mapping.
*/
#if defined(NRF_TRUSTZONE_NONSECURE)
#define NRF_GPIOTE NRF_GPIOTE1
#define NRF_GPIOTE1 NRF_GPIOTE1_NS
#else
#define NRF_CACHE NRF_CACHE_S
@ -91,20 +92,14 @@
#define NRF_CRYPTOCELL NRF_CRYPTOCELL_S
#define NRF_CTI NRF_CTI_S
#define NRF_FICR NRF_FICR_S
#define NRF_GPIOTE NRF_GPIOTE0
#define NRF_GPIOTE0 NRF_GPIOTE0_S
#define NRF_GPIOTE1 NRF_GPIOTE1_NS
#define NRF_SPU NRF_SPU_S
#define NRF_TAD NRF_TAD_S
#define NRF_UICR NRF_UICR_S
#endif
/* Fixups for the GPIOTE driver. */
#if defined(NRF_TRUSTZONE_NONSECURE)
#define NRF_GPIOTE NRF_GPIOTE1
#else
#define NRF_GPIOTE NRF_GPIOTE0
#endif
/**
* @brief NRFX_DEFAULT_IRQ_PRIORITY
*

View file

@ -67,25 +67,21 @@
* between secure and non-secure mapping.
*/
#if defined(NRF_TRUSTZONE_NONSECURE)
#define NRF_GPIOTE NRF_GPIOTE1
#define NRF_GPIOTE1 NRF_GPIOTE1_NS
#else
#define NRF_CC_HOST_RGF NRF_CC_HOST_RGF_S
#define NRF_CRYPTOCELL NRF_CRYPTOCELL_S
#define NRF_CTRL_AP_PERI NRF_CTRL_AP_PERI_S
#define NRF_FICR NRF_FICR_S
#define NRF_GPIOTE NRF_GPIOTE0
#define NRF_GPIOTE0 NRF_GPIOTE0_S
#define NRF_GPIOTE1 NRF_GPIOTE1_NS
#define NRF_SPU NRF_SPU_S
#define NRF_TAD NRF_TAD_S
#define NRF_UICR NRF_UICR_S
#endif
/* Fixups for the GPIOTE driver. */
#if defined(NRF_TRUSTZONE_NONSECURE)
#define NRF_GPIOTE NRF_GPIOTE1
#else
#define NRF_GPIOTE NRF_GPIOTE0
#endif
/**
* @brief NRFX_DEFAULT_IRQ_PRIORITY
*

View file

@ -69,8 +69,23 @@ config HAS_HW_NRF_GPIO0
config HAS_HW_NRF_GPIO1
def_bool $(dt_nodelabel_enabled_with_compat,gpio1,$(DT_COMPAT_NORDIC_NRF_GPIO))
config HAS_HW_NRF_GPIOTE
def_bool $(dt_compat_enabled,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
config HAS_HW_NRF_GPIOTE0
def_bool $(dt_nodelabel_enabled_with_compat,gpiote0,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
config HAS_HW_NRF_GPIOTE1
def_bool $(dt_nodelabel_enabled_with_compat,gpiote1,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
config HAS_HW_NRF_GPIOTE20
def_bool $(dt_nodelabel_enabled_with_compat,gpiote20,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
config HAS_HW_NRF_GPIOTE30
def_bool $(dt_nodelabel_enabled_with_compat,gpiote30,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
config HAS_HW_NRF_GPIOTE130
def_bool $(dt_nodelabel_enabled_with_compat,gpiote130,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
config HAS_HW_NRF_GPIOTE131
def_bool $(dt_nodelabel_enabled_with_compat,gpiote131,$(DT_COMPAT_NORDIC_NRF_GPIOTE))
config HAS_HW_NRF_I2S0
def_bool $(dt_nodelabel_enabled_with_compat,i2s0,$(DT_COMPAT_NORDIC_NRF_I2S))

View file

@ -149,6 +149,52 @@
(NRF_DT_GPIOS_TO_PSEL(node_id, prop)), \
(default_value))
/**
* @brief Convert a devicetree GPIO phandle+specifier to GPIOTE instance number.
*
* Some of nRF SoCs may have more instances of GPIOTE.
* To handle this, we use the "gpiote-instance" property of the GPIO node.
*
* This macro converts a devicetree GPIO phandle array value
* "<&gpioX pin ...>" to a GPIOTE instance number.
*
* Examples:
*
* &gpiote0 {
* instance = <0>;
* };
*
* &gpiote20 {
* instance = <20>;
* };
*
* &gpio0 {
* gpiote-instance = <&gpiote0>;
* }
*
* &gpio1 {
* gpiote-instance = <&gpiote20>;
* }
*
* foo: my-node {
* tx-gpios = <&gpio0 4 ...>;
* rx-gpios = <&gpio0 5 ...>, <&gpio1 5 ...>;
* };
*
* NRF_DT_GPIOTE_INST_BY_IDX(DT_NODELABEL(foo), tx_gpios, 0) // = 0
* NRF_DT_GPIOTE_INST_BY_IDX(DT_NODELABEL(foo), rx_gpios, 1) // = 20
*/
#define NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, idx) \
DT_PROP(DT_PHANDLE(DT_GPIO_CTLR_BY_IDX(node_id, prop, idx), \
gpiote_instance), \
instance)
/**
* @brief Equivalent to NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, 0)
*/
#define NRF_DT_GPIOTE_INST(node_id, prop) \
NRF_DT_GPIOTE_INST_BY_IDX(node_id, prop, 0)
/**
* Error out the build if 'prop' is set on node 'node_id' and
* DT_GPIO_CTLR(node_id, prop) is not an SoC GPIO controller,

View file

@ -16,6 +16,10 @@
#define NRF_CTRLAP NRF_CTRL_AP_PERI
#endif
#if !defined(NRF_GPIOTE0) && defined(NRF_GPIOTE)
#define NRF_GPIOTE0 NRF_GPIOTE
#endif
#if !defined(NRF_I2S0) && defined(NRF_I2S)
#define NRF_I2S0 NRF_I2S
#endif
@ -141,6 +145,12 @@ CHECK_DT_REG(flash_controller, NRF_NVMC);
CHECK_DT_REG(gpio0, NRF_P0);
CHECK_DT_REG(gpio1, NRF_P1);
CHECK_DT_REG(gpiote, NRF_GPIOTE);
CHECK_DT_REG(gpiote0, NRF_GPIOTE0);
CHECK_DT_REG(gpiote1, NRF_GPIOTE1);
CHECK_DT_REG(gpiote20, NRF_GPIOTE20);
CHECK_DT_REG(gpiote30, NRF_GPIOTE30);
CHECK_DT_REG(gpiote130, NRF_GPIOTE130);
CHECK_DT_REG(gpiote131, NRF_GPIOTE131);
CHECK_I2C_REG(i2c0, 0);
CHECK_I2C_REG(i2c1, 1);
CHECK_DT_REG(i2c2, NRF_TWIM2);