Zephyr AXI GPIO Driver Support

This page gives an overview of the AXI GPIO Zephyr driver which is available as part of the zephyr-amd repo.

HW Features

  • Support Dual channel

  • 32 max pins per each channel

Design Notes

  • To run testcase(tests/drivers/gpio/gpio_basic_api/) we need specific loopback design as shown in the following figure,

Vivado block-design excerpt showing the AXI GPIO loopback wiring used by the gpio_basic_api Zephyr testcase: axi_gpio_1 drives gpio_io_o[1:0] / gpio_io_t[1:0] back into a Slice and Concat that loop the bits to gpio_io_i[1:0], with a Constant tying the unused GND input.

AXI GPIO loopback wiring required by the gpio_basic_api test.

Implementation

Features Supported

  • Input/output interrupt support

  • Input/output polled support

  • Separate call back configuration for each pin

  • Support level interrupt

Missing Features

  • Does not support reading all pin direction in a port

  • Does not support reading pin configuration (input, output, pull-down, pull-up, active-Low, active-High etc)

Known Issues

  • N/A

Limitations

  • N/A

Kernel Configuration

CONFIG_GPIO=y
CONFIG_GPIO_XLNX_AXI=y

Other configuration options:

CONFIG_GPIO_GET_DIRECTION (not supported)
CONFIG_GPIO_GET_CONFIG (not supported)
CONFIG_GPIO_ENABLE_DISABLE_INTERRUPT

Device Tree

AXI GPIO DUAL CHANNEL node

axi_gpio: gpio@81000000 {
        compatible = "xlnx,xps-gpio-1.00.a";
        status = "okay";
        interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
        reg = <0x81000000 0x1000>;
        gpio-controller;
        #gpio-cells = <2>;
        interrupt-parent = <&gic>;
        xlnx,all-inputs = <0x1>;
        xlnx,all-inputs-2 = <0x0>;
        xlnx,all-outputs = <0x0>;
        xlnx,all-outputs-2 = <0x1>;
        xlnx,dout-default = <0x0>;
        xlnx,dout-default-2 = <0x0>;
        xlnx,gpio-width = <0x20>;
        xlnx,gpio2-width = <0x20>;
        xlnx,is-dual = <0x1>;
        xlnx,tri-default = <0xffffffff>;
        xlnx,tri-default-2 = <0xffffffff>;

        axigpio2: gpio2 {
                compatible = "xlnx,xps-gpio-1.00.a-gpio2";
                status = "okay";
                gpio-controller;
                #gpio-cells = <2>;
        };
};
  • channel 2 node must be a child node of channel 1 nodes.

AXI GPIO SINGLE CHANNEL node

axi_gpio: gpio@81000000 {
        compatible = "xlnx,xps-gpio-1.00.a";
        status = "okay";
        interrupts = <GIC_SPI 90 IRQ_TYPE_LEVEL IRQ_DEFAULT_PRIORITY>;
        reg = <0x81000000 0x1000>;
        gpio-controller;
        #gpio-cells = <2>;
        interrupt-parent = <&gic>;
        xlnx,all-inputs = <0x1>;
        xlnx,all-outputs = <0x0>;
        xlnx,dout-default = <0x0>;
        xlnx,gpio-width = <0x20>;
        xlnx,is-dual = <0x0>;
        xlnx,tri-default = <0xffffffff>;

};

Driver Stack Size

  • 2.9 KB

    • txt - 1.9 KB, data - 1 KB

Example Tests

Test Name

Example Source

Description

AXI GPIO API

tests/drivers/gpio/gpio_basic_api/

functionality check and performs interrupt-based test in loopback configuration

Driver code coverage with gpio_basic_api - 93.8%

Performance Metric

  • TBA

Mainline Status

  • Mainlined

Driver Source Path

  • drivers/gpio/gpio_xlnx_axi.c

Misra C Report

  • Per coding guidelines of zephyr

Misra-c

driver file

kernel utility

Actual violation

4.6

16

16

0

4.8

2

2

0

4.9

21

21

0

1.2

6

6

0

10.1

24

0

24

10.4

29

0

29

11.5

18

0

18

11.9

1

0

1

12.2

10

2

8

14.4

6

0

6

15.5

6

0

6

15.7

1

0

1

2.5

4

0

4

20.10

2

2

0

21.2

24

24

0

8.13

1

0

1

8.7

8

8

0

Total

179

81

98