hw/gpio: Add Xilinx AXI GPIO device and petalogix_s3adsp1800 integration
cover hw/gpio: Add Xilinx AXI GPIO device and petalogix_s3adsp1800 integration
This patch series adds an emulation model for the Xilinx AXI GPIO IP core (PG144), connects it to the petalogix-s3adsp1800 MicroBlaze board, and adds a QTest test suite.
Summary of changes:
- Patch 1: Implement Xilinx AXI GPIO IP core (PG144) supporting dual channels, configurable data width (1 to 32 bits), per-channel 3-state direction control, global interrupt enable, and per-channel interrupt generation on input transitions.
- Patch 2: Connect the xlnx-axi-gpio device to the petalogix-s3adsp1800 board, replacing the previous unimplemented stub at 0x81400000 and wiring IRQ 2 to the Xilinx interrupt controller.
- Patch 3: Add QTest test suite covering reset state, input/output propagation, direction mask filtering, edge-triggered interrupt generation and clearing, unmapped register boundary reads, mixed I/O multiplexing, channel 1 & 2 physical output isolation, reset, and QOM object introspection via QMP.
All patches pass scripts/checkpatch.pl with 0 errors and 0 warnings, build cleanly, and pass the full test suite.
Pufan Jin (3):
hw/gpio: Add Xilinx AXI GPIO device hw/microblaze/petalogix_s3adsp1800: Connect xlnx-axi-gpio tests/qtest: Add Xilinx AXI GPIO test
MAINTAINERS | 3 + hw/gpio/Kconfig | 3 + hw/gpio/meson.build | 1 + hw/gpio/trace-events | 7 + hw/gpio/xlnx-axi-gpio.c | 282 +++++++++++++++++ hw/microblaze/Kconfig | 1 + hw/microblaze/petalogix_s3adsp1800_mmu.c | 8 +- include/hw/gpio/xlnx-axi-gpio.h | 59 ++++ tests/qtest/meson.build | 3 +- tests/qtest/xlnx-axi-gpio-test.c | 372 +++++++++++++++++++++++ 10 files changed, 737 insertions(+), 2 deletions(-) create mode 100644 hw/gpio/xlnx-axi-gpio.c create mode 100644 include/hw/gpio/xlnx-axi-gpio.h create mode 100644 tests/qtest/xlnx-axi-gpio-test.c
Signature · 1 line
2.56.0
PATCH 1/3 hw/gpio: Add Xilinx AXI GPIO device
Add an emulation model for the Xilinx AXI GPIO IP core (PG144).
The core provides general purpose input/output interface to the AXI bus. It supports up to two channels, configurable data width (1 to 32 bits), per-channel 3-state direction control, global interrupt enable, and per-channel interrupt generation on input transition.
--- MAINTAINERS | 2 + hw/gpio/Kconfig | 3 + hw/gpio/meson.build | 1 + hw/gpio/trace-events | 7 + hw/gpio/xlnx-axi-gpio.c | 282 ++++++++++++++++++++++++++++++++ include/hw/gpio/xlnx-axi-gpio.h | 59 +++++++ 6 files changed, 354 insertions(+) create mode 100644 hw/gpio/xlnx-axi-gpio.c create mode 100644 include/hw/gpio/xlnx-axi-gpio.h
MAINTAINERS +2 -0
@@ -1483,6 +1483,8 @@ M: Edgar E. Iglesias <[email protected]> S: Maintained F: hw/microblaze/petalogix_s3adsp1800_mmu.c F: include/hw/char/xilinx_uartlite.h +F: hw/gpio/xlnx-axi-gpio.c +F: include/hw/gpio/xlnx-axi-gpio.h F: tests/functional/microblaze/test_s3adsp1800.py petalogix_ml605
hw/gpio/Kconfig +3 -0
@@ -36,3 +36,6 @@ config CADENCE_GPIO config ALLWINNER_GPIO bool + +config XLNX_AXI_GPIO + bool
hw/gpio/meson.build +1 -0
@@ -21,3 +21,4 @@ system_ss.add(when: 'CONFIG_SIFIVE_GPIO', if_true: files('sifive_gpio.c')) system_ss.add(when: 'CONFIG_PCF8574', if_true: files('pcf8574.c')) system_ss.add(when: 'CONFIG_CADENCE_GPIO', if_true: files('cadence_gpio.c')) system_ss.add(when: 'CONFIG_ALLWINNER_GPIO', if_true: files('allwinner-gpio.c')) +system_ss.add(when: 'CONFIG_XLNX_AXI_GPIO', if_true: files('xlnx-axi-gpio.c'))
hw/gpio/trace-events +7 -0
@@ -57,3 +57,10 @@ allwinner_gpio_set(const char *port, int line, int level) "[%s:%d] <- %d" allwinner_gpio_read(const char *reg, uint32_t value) "[%s] -> 0x%" PRIx32 allwinner_gpio_write(const char *reg, uint32_t value) "[%s] <- 0x%" PRIx32 allwinner_gpio_out_pin(const char *reg, uint32_t pin, uint32_t value) "[%s.%d] <- 0x%" PRIx32 + +# xlnx-axi-gpio.c +xlnx_axi_gpio_read(uint64_t addr, uint64_t val) "addr: 0x%" PRIx64 " val: 0x%" PRIx64 +xlnx_axi_gpio_write(uint64_t addr, uint64_t val) "addr: 0x%" PRIx64 " val: 0x%" PRIx64 +xlnx_axi_gpio_set_input(int ch, int line, int level) "ch: %d line: %d level: %d" +xlnx_axi_gpio_set_output(int ch, int line, int level) "ch: %d line: %d level: %d" +xlnx_axi_gpio_update_irq(int level) "irq level: %d"
hw/gpio/xlnx-axi-gpio.c new file +282 -0
282 lines not on this page · raw message
include/hw/gpio/xlnx-axi-gpio.h new file +59 -0
59 lines not on this page · raw message
Signature · 1 line
2.56.0
PATCH 2/3 hw/microblaze/petalogix_s3adsp1800: Connect xlnx-axi-gpio
In reply to Pufan JinConnect the Xilinx AXI GPIO device to the petalogix-s3adsp1800 machine, replacing the unimplemented device stub at 0x81400000 and wiring IRQ 2 to the interrupt controller as specified in the reference DTS.
--- hw/microblaze/Kconfig | 1 + hw/microblaze/petalogix_s3adsp1800_mmu.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-)
hw/microblaze/Kconfig +1 -0
@@ -6,6 +6,7 @@ config PETALOGIX_S3ADSP1800 select XILINX select XILINX_AXI select XILINX_ETHLITE + select XLNX_AXI_GPIO select UNIMP config PETALOGIX_ML605
hw/microblaze/petalogix_s3adsp1800_mmu.c +7 -1
@@ -36,6 +36,7 @@#include "hw/misc/unimp.h" #include "system/address-spaces.h" #include "hw/char/xilinx_uartlite.h" +#include "hw/gpio/xlnx-axi-gpio.h" #include "boot.h"
@@ -54,6 +55,7 @@#define TIMER_IRQ 0#define ETHLITE_IRQ 1 +#define GPIO_IRQ 2#define UARTLITE_IRQ 3#define TYPE_PETALOGIX_S3ADSP1800_MACHINE \
@@ -144,7 +146,11 @@ petalogix_s3adsp1800_init(MachineState *machine)sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,ETHLITE_BASEADDR );sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , irq[ETHLITE_IRQ ]); -create_unimplemented_device ("xps_gpio" ,GPIO_BASEADDR ,0x10000 ); + dev =qdev_new (TYPE_XLNX_AXI_GPIO ); +qdev_prop_set_enum (dev,"endianness" , endianness); +sysbus_realize_and_unref (SYS_BUS_DEVICE (dev), &error_fatal); +sysbus_mmio_map (SYS_BUS_DEVICE (dev),0 ,GPIO_BASEADDR ); +sysbus_connect_irq (SYS_BUS_DEVICE (dev),0 , irq[GPIO_IRQ ]); microblaze_load_kernel(cpu, endianness == ENDIAN_MODE_LITTLE, ddr_base, ram_size, machine->initrd_filename,
Signature · 1 line
2.56.0
PATCH 3/3 tests/qtest: Add Xilinx AXI GPIO test
In reply to Pufan JinAdd a QTest test suite for the Xilinx AXI GPIO IP core covering:
- Reset state verification
- GPIO 3-state direction register configuration
- GPIO data register output across both channels
- Pin input and edge-triggered interrupt assertion and W1C clearing
--- MAINTAINERS | 1 + tests/qtest/meson.build | 3 +- tests/qtest/xlnx-axi-gpio-test.c | 372 +++++++++++++++++++++++++++++++ 3 files changed, 375 insertions(+), 1 deletion(-) create mode 100644 tests/qtest/xlnx-axi-gpio-test.c
MAINTAINERS +1 -0
@@ -1486,6 +1486,7 @@ F: include/hw/char/xilinx_uartlite.h F: hw/gpio/xlnx-axi-gpio.c F: include/hw/gpio/xlnx-axi-gpio.h F: tests/functional/microblaze/test_s3adsp1800.py +F: tests/qtest/xlnx-axi-gpio-test.c petalogix_ml605 M: Edgar E. Iglesias <[email protected]>
tests/qtest/meson.build +2 -1
@@ -172,7 +172,8 @@ qtests_m68k = ['boot-serial-test'] + \ qtests_filter qtests_microblaze = ['boot-serial-test'] + \ - qtests_filter + qtests_filter + \ + (config_all_devices.has_key('CONFIG_XLNX_AXI_GPIO') ? ['xlnx-axi-gpio-test'] : []) qtests_mips = \ qtests_filter + \
tests/qtest/xlnx-axi-gpio-test.c new file +372 -0
372 lines not on this page · raw message
Signature · 1 line
2.56.0