Configure GPIO in devicetree as "nordic,nrf-gpio" and not as "gpio-leds"

I would like to configure GPIOs as compatible = "nordic,nrf-gpio"; in devicetree file. 

I did check this topic, but I think that this kind of configuration defeats the whole purpose of .dts file.

I did not find any example for compatible = "nordic,nrf-gpio"; but only for compatible = "gpio-leds";.

 

The Zephyr documentation for nordic,nrf-gpio doesn't help me much.


Could you please provide some example?


/ {
    boardGpios {
        compatible = "nordic,nrf-gpio";
        output1: output1 {
            ...
        }
    };
};

  • Hi 

    bzgec said:
    It is bothering me because I don't know if gpio-keys and gpio-leds are using GPIO or GPIOTE (for current project I don't need GPIOTE).

    They are using GPIO, not GPIOTE. 

    Correction: Whenever you use the GPIO_INT_EDGE flag on an input pin it will use a dedicated GPIOTE IN channel. If this flag is not used you will only use GPIO. 

    GPIOTE OUT channels are only supported by using the nrfx_gpiote driver directly. 

    bzgec said:
    I would like to have an option to select when to use GPIO and when GPIOTE.
    Could something like st,stm32-pinctrl be created for nordic?

    This was designed for the ST devices, which has a different GPIO architecture than we have in the nRF devices. 

    In other words it doesn't make sense to implement a similar driver for Nordic. 

    The higher level Zephyr API's are still similar, so that you can write code that will run on either ST or Nordic (or any other supported MCU's). 
    It is just the DTS configuration that will have to be different. 

    Best regards
    Torbjørn

Related