The NXP i.MX95 CPU has five GPIO ports. The number of GPIOs that each port can generate and control varies:

  • GPIO1: 16 signals

  • GPIO2: 32 signals

  • GPIO3: 32 signals

  • GPIO4: 30 signals

  • GPIO5: 18 signals

GPIOs on the ConnectCore 95 platforms

  • On the ConnectCore 95 system-on-module:

    • Many of the i.MX95 GPIOs are available at the system-on-module, multiplexed with other functions (labeled GPIOx_IO_BITy where x is the port and y is the GPIO pin). See Hardware reference manuals for information about GPIO pins and their multiplexed functionality.

  • On the ConnectCore 95 Development Kit, the expansion connectors allow direct access to some of the i.MX95 GPIOs.

GPIOs on the SOM and carrier board are used for many purposes, such as:

  • Power enable line for transceivers

  • Reset line for controllers

  • Interrupt line

  • User LED

  • User button

Kernel configuration

Support for i.MX95 GPIOs is automatically provided through the non-visible option CONFIG_GPIO_VF610.

Kernel driver

The driver for the i.MX95 GPIO is located at:

File Description

drivers/gpio/gpio-vf610.c

i.MX95 GPIO driver

Device tree bindings and customization

The i.MX95 GPIO device tree binding is documented at Documentation/devicetree/bindings/gpio/gpio-vf610.yaml.

One GPIO controller is defined for each i.MX95 GPIO port in the common i.MX95 device tree file:

i.MX95 device tree
		gpio4: gpio@43840000 {
			compatible = "fsl,imx95-gpio", "fsl,imx8ulp-gpio";
			reg = <0x0 0x43840000 0x0 0x1000>;
			gpio-controller;
			#gpio-cells = <2>;
			interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>,
				     <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
			interrupt-controller;
			#interrupt-cells = <2>;
			clocks = <&scmi_clk IMX95_CLK_BUSWAKEUP>,
				 <&scmi_clk IMX95_CLK_BUSWAKEUP>;
			clock-names = "gpio", "port";
			gpio-ranges = <&scmi_iomuxc 0 46 28>, <&scmi_iomuxc 28 44 2>;
			ngpios = <30>;
		};

For example, on the ConnectCore 95 Development Kit, GPIO5_IO17 is used to reset the camera:

ConnectCore 95 Development Kit device tree
	/* MIPI-CSI camera */
	ov5640_mipi: ov5640_mipi@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mipi>;
		clocks = <&mipi_csi_xtal24m>;
		clock-names = "xclk";
		csi_id = <0>;
		powerdown-gpios = <&gpio5 17 GPIO_ACTIVE_LOW>;
		mclk = <24000000>;
		mclk_source = <0>;
		[...]
	};

IOMUX configuration

You must configure the pads that are to be used as i.MX95 GPIOs. See Pin multiplexing (IOMUX).

For GPIOs that are managed by other drivers, you must configure their pad IOMUX inside the driver node specific pinctrl-0 to work according to the specified interface functionalities. For GPIOs that are not associated with any interface or that can’t be handled by a driver, see Configure independent pin IOMUX and pad control.

  • ULED/BUTTON1 is GPIO5_IO12

  • ULED/BUTTON2 is GPIO4_IO23

GPIO pads power domains

The i.MX95 GPIOs may work at 1.8 V or 3.3 V depending on the power domain of the pad they are on. To determine the working voltage of a given GPIO:

  1. Locate the pad of a given signal on the ConnectCore 95 Development Kit schematics. For instance, on the ConnectCore 95 Development Kit, signal CAN2_STB comes from pad SPI1_SCK (pad AE1) of the ConnectCore 95 SOM:

    dwg gpiopad sch 95dvk

  2. Locate this pad on the IOMUX section of the ConnectCore 95 Hardware Reference Manual. This table lists the associated GPIO of the pad, and the power domain it is on:

    dwg gpiopad hrm som 95dvk

  3. In the example, the power domain is 3V3. If a different power domain applies, locate it on the ConnectCore 95 Development Kit schematics to determine its voltage.

Use the GPIOs

The package libgpiod (added by packagegroup-dey-core) provides a set of tools (such as gpioget, gpioset, etc.) for controlling the GPIOs from user space.

You can still control the GPIOs from the sysfs, but this API is not recommended. See https://www.kernel.org/doc/html/latest/userspace-api/gpio/sysfs.html.

Detect GPIO ports

Use gpiodetect to list the GPIO ports detected by the kernel:

# gpiodetect
gpiochip0 [43810000.gpio] (32 lines)
gpiochip1 [43820000.gpio] (32 lines)
gpiochip2 [43840000.gpio] (30 lines)
gpiochip3 [43850000.gpio] (18 lines)
gpiochip4 [47400000.gpio] (16 lines)

where:

  • Ports gpiochip0 to gpiochip4 are the i.MX95 GPIO ports.

This nomenclature corresponds with GPIO2 to GPIO5 and GPIO1, as shown in the i.MX95 reference manual.

GPIO1 port belongs to the Always-ON (AON) domain and probed last, after ports GPIO2..GPIO5.

Information about a GPIO port

Use gpioinfo to list the lines of a given port:

# gpioinfo gpiochip2
gpiochip2 - 30 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed       unused   input  active-high
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused   input  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed       unused   input  active-high
        line   9:      unnamed       unused   input  active-high
        line  10:      unnamed       unused   input  active-high
        line  11:      unnamed       unused   input  active-high
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
        line  15:      unnamed       unused   input  active-high
        line  16:      unnamed       unused   input  active-high
        line  17:      unnamed       unused   input  active-high
        line  18:      unnamed       unused   input  active-high
        line  19:      unnamed       unused   input  active-high
        line  20:      unnamed       unused   input  active-high
        line  21:      unnamed       unused   input  active-high
        line  22:      unnamed       unused   input  active-high
        line  23:      unnamed       unused   input  active-high
        line  24:      unnamed       unused   input  active-high
        line  25:      unnamed       unused   input  active-high
        line  26:      unnamed       unused   input  active-high
        line  27:      unnamed       unused   input  active-high
        line  28:      unnamed        "hpd"   input  active-high [used]
        line  29:      unnamed       unused   input  active-high

Set an output high/low

Use gpioset to set a i.MX95 GPIO as output, such as GPIO1_IO27. Use =1 to set it high, or =0 to set it low:

# gpioset gpiochip1 27=1
# gpioset gpiochip1 27=0

Read an input

Use gpioget to read the value of a i.MX95 GPIO input, such as GPIO1_IO27:

# gpioget gpiochip1 27
0

Use a GPIO as interrupt

Use gpiomon to wait for an event on a given GPIO, such as GPIO1_IO27:

# gpiomon --num-events 1 --rising-edge gpiochip1 27

See the README of libgpiod for more information on the usage of these tools.

Sample application

An example application called apix-gpio-example is included in the dey-examples-digiapix recipe (part of dey-examples package) of the meta-digi layer. This application shows how to manage GPIO lines using the Digi APIx library on the ConnectCore 95 platform.

By default, the Get Started with ConnectCore Cloud Services demo application seizes the user button. To use the example, stop the cccs-gs-demo with the following command:

# systemctl stop cccs-gs-demo

Go to GitHub to see the application instructions and source code.

See GPIO API for more information about the GPIO APIx.