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

@ -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);