Skip to contentSkip to conversation

Add Axiado SoC AX3000 and EVK board

PATCH Superseded Kuan-Jui Chiu 2 participants 13 messages Jun 22 – Jul 6

Subsystems (2)

v6 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v6 cover Add Axiado SoC AX3000 and EVK board

This patchset introduces Axiado SoC AX3000 and a EVK SCM3003 for emulation The model for Axiado SoC AX3000 supports
4 Cortex-A53 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY
8 Cadence GPIOs

Verified the machine "axiado-scm3003" with following command

qemu-system-aarch64 \
    -m 4G \
    -machine axiado-scm3003 \
    -device loader,file=u-boot.bin,addr=0x3C000000,cpu-num=0 \
    -nographic \
    -serial null \
    -serial null \
    -serial null \
    -serial mon:stdio \
    -drive if=sd,file=obmc-phosphor-image-evk-axiado-qemu.wic,format=raw

Refer Axiado website for more product information
https://axiado.com/products/

Changes in v6:
1. Add qemu_log_mask(LOG_UNIMP) into axiado_clk and axiado_sdhci for unimplemented registers
2. Revise header of axiado_sdhci
3. Add "const" to temporary data structures

Changes in v5:
1. Include Reviewed-by tag in reviewed patches
2. Add arm_load_kernel() in ax3000-boards
3. Add axiado_clk to support AXIADO_CLK

Changes in v4:
1. Remove ERRP_GUARD from axiado_sdhci
2. Optimize ISR update function of cadence gpio with logical operation

Changes in v3:
1. Add a new patch for Axiado SD host controller
2. Fill in valid/impl parameters of MemoryRegionOps in ax3000-soc/cadence_gpio/axiado_sdhci
3. Follow C99 standard to declare variable in for-loop
4. Remove comment "TBD" from empty function
5. Define marco for bit definition in axiado_sdhci
6. Move object_initialize_child() to instance_init() from realize() in axiado_sdhci
7. Remove callback of get_default_cpu_type() from ax3000-soc and set type of CPU to A53
8. Update the command to run "axiado-scm3003" in QEMU

Changes in v2:
1. Move axiado-* to ax3000-* in hw/arm and include/hw/arm
2. Add axiado_sdhci to support AXIADO_SDHCI
3. Move implementation for eMMC PHY device to axiado_sdhci
4. Use UNIMP to create dummy device "timerctrl"
5. Add cadence_gpio to support CADENCE_GPIO
6. Enable Cadence GPIO controllers on AX3000 SoC

Kuan-Jui Chiu (8):
hw/arm: Add Axiado SoC AX3000
hw/misc: Add AX3000 clock control
hw/arm: ax3000-soc: Enable Ax3000 clock control hw/sd: Add Axiado SD host controller with eMMC PHY hw/arm: ax3000-soc: Enable Axiado SD host controller hw/arm: Add Axiado EVK SCM3003
hw/gpio: Add Cadence GPIO controller hw/arm: ax3000-soc: Enable Cadence GPIO controllers

 MAINTAINERS                    |   9 +
 hw/arm/Kconfig                 |  15 ++
 hw/arm/ax3000-boards.c         |  56 +++++++
 hw/arm/ax3000-evk.c            |  27 +++
 hw/arm/ax3000-soc.c            | 238 +++++++++++++++++++++++++++
 hw/arm/meson.build             |   6 +
 hw/gpio/Kconfig                |   3 +
 hw/gpio/cadence_gpio.c         | 292 +++++++++++++++++++++++++++++++++
 hw/gpio/meson.build            |   1 +
 hw/gpio/trace-events           |   5 +
 hw/misc/Kconfig                |   3 +
 hw/misc/axiado_clk.c           |  77 +++++++++
 hw/misc/meson.build            |   3 +
 hw/sd/Kconfig                  |   4 +
 hw/sd/axiado_sdhci.c           | 117 +++++++++++++
 hw/sd/meson.build              |   1 +
 include/hw/arm/ax3000-boards.h |  28 ++++
 include/hw/arm/ax3000-soc.h    |  98 +++++++++++
 include/hw/gpio/cadence_gpio.h |  55 +++++++
 include/hw/misc/axiado_clk.h   |  26 +++
 include/hw/sd/axiado_sdhci.h   |  21 +++
 21 files changed, 1085 insertions(+)
 create mode 100644 hw/arm/ax3000-boards.c
 create mode 100644 hw/arm/ax3000-evk.c
 create mode 100644 hw/arm/ax3000-soc.c
 create mode 100644 hw/gpio/cadence_gpio.c
 create mode 100644 hw/misc/axiado_clk.c
 create mode 100644 hw/sd/axiado_sdhci.c
 create mode 100644 include/hw/arm/ax3000-boards.h
 create mode 100644 include/hw/arm/ax3000-soc.h
 create mode 100644 include/hw/gpio/cadence_gpio.h
 create mode 100644 include/hw/misc/axiado_clk.h
 create mode 100644 include/hw/sd/axiado_sdhci.h
Signature · 1 line
2.34.1
#1 lore raw

PATCH v6 1/8 hw/arm: Add Axiado SoC AX3000

This patch adds new model for Axiado SoC AX3000 which supports
4 Cortex-A53 ARM64 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs

---
 MAINTAINERS                 |   7 ++
 hw/arm/Kconfig              |   7 ++
 hw/arm/ax3000-soc.c         | 182 ++++++++++++++++++++++++++++++++++++
 hw/arm/meson.build          |   3 +
 include/hw/arm/ax3000-soc.h |  68 ++++++++++++++
 5 files changed, 267 insertions(+)
 create mode 100644 hw/arm/ax3000-soc.c
 create mode 100644 include/hw/arm/ax3000-soc.h
MAINTAINERS +7 -0
index 93df53d87f6..9707a71137b 100644
@@ -1294,6 +1294,13 @@ M: Manos Pitsidianakis <[email protected]>
 S: Maintained
 F: rust/hw/char/pl011/
 
+Axiado SoCs and EVKs
+M: Kuan-Jui Chiu <[email protected]>
+L: [email protected]
+S: Maintained
+F: hw/arm/ax3000*.c
+F: include/hw/arm/ax3000*.h
+
 AVR Machines
 -------------
 
hw/arm/Kconfig +7 -0
index 500bfdfe2aa..d4e5df69066 100644
@@ -722,3 +722,10 @@ config ARMSSE
     select UNIMP
     select SSE_COUNTER
     select SSE_TIMER
+
+config AXIADO_SOC
+    bool
+    depends on ARM
+    select ARM_GIC
+    select CADENCE # UART
+    select UNIMP
hw/arm/ax3000-soc.c new file +182 -0

182 lines not on this page · raw message

hw/arm/meson.build +3 -0
index 4233a800be2..0254b82df1a 100644
@@ -110,6 +110,9 @@ arm_common_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
 arm_common_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
 arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
 
+arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
+  'ax3000-soc.c'))
+
 arm_common_ss.add(files('boot.c'))
 
 hw_common_arch += {'arm': arm_common_ss}
include/hw/arm/ax3000-soc.h new file +68 -0

68 lines not on this page · raw message

Signature · 1 line
2.34.1
#2 lore raw

PATCH v6 2/8 hw/misc: Add AX3000 clock control

In reply to Kuan-Jui Chiu

This patch adds a new model for Axiado AX3000 clock control which supports to read ID and status

---
 hw/misc/Kconfig              |  3 ++
 hw/misc/axiado_clk.c         | 77 ++++++++++++++++++++++++++++++++++++
 hw/misc/meson.build          |  3 ++
 include/hw/misc/axiado_clk.h | 26 ++++++++++++
 4 files changed, 109 insertions(+)
 create mode 100644 hw/misc/axiado_clk.c
 create mode 100644 include/hw/misc/axiado_clk.h
hw/misc/Kconfig +3 -0
index 1543ee66531..b8860dd3e77 100644
@@ -257,4 +257,7 @@ config XLNX_VERSAL_TRNG
 config XLNX_ZYNQ_DDRC
     bool
 
+config AXIADO_CLK
+    bool
+
 source macio/Kconfig
hw/misc/axiado_clk.c new file +77 -0

77 lines not on this page · raw message

hw/misc/meson.build +3 -0
index 23265f6035b..e86d9ad6b39 100644
@@ -1,4 +1,5 @@
 system_ss.add(when: 'CONFIG_APPLESMC', if_true: files('applesmc.c'))
+
 system_ss.add(when: 'CONFIG_EDU', if_true: files('edu.c'))
 system_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('vmcoreinfo.c'))
 system_ss.add(when: 'CONFIG_ISA_DEBUG', if_true: files('debugexit.c'))
@@ -168,3 +169,5 @@ system_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa_ec.c'))
 
 # HPPA devices
 system_ss.add(when: 'CONFIG_LASI', if_true: files('lasi.c'))
+
+system_ss.add(when: 'CONFIG_AXIADO_CLK', if_true: files('axiado_clk.c'))
include/hw/misc/axiado_clk.h new file +26 -0
new file mode 100644
index 00000000000..6e12a509d72
@@ -0,0 +1,26 @@
+/*
+ * Axiado AX3000 Clock Control
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef AXIADO_AX3000_CLK_H
+#define AXIADO_AX3000_CLK_H
+
+#include "hw/core/sysbus.h"
+#include "qom/object.h"
+
+#define TYPE_AX3000_CLK "ax3000-clk"
+OBJECT_DECLARE_SIMPLE_TYPE(Ax3000ClkState, AX3000_CLK)
+
+#define AX3000_CLK_PLL_CTRL_SIZE    0x1000
+
+typedef struct Ax3000ClkState {
+    SysBusDevice        parent;
+
+    MemoryRegion        pll_ctrl;
+} Ax3000ClkState;
+
+#endif /* AXIADO_AX3000_CLK_H */
Signature · 1 line
2.34.1
#3 lore raw

PATCH v6 3/8 hw/arm: ax3000-soc: Enable Ax3000 clock control

In reply to Kuan-Jui Chiu
---
 hw/arm/Kconfig              | 1 +
 hw/arm/ax3000-soc.c         | 8 ++++++++
 include/hw/arm/ax3000-soc.h | 2 ++
 3 files changed, 11 insertions(+)
hw/arm/Kconfig +1 -0
index d4e5df69066..63fa8869317 100644
@@ -728,4 +728,5 @@ config AXIADO_SOC
     depends on ARM
     select ARM_GIC
     select CADENCE # UART
+    select AXIADO_CLK
     select UNIMP
hw/arm/ax3000-soc.c +8 -0
index b528f8af532..aaeae110747 100644
@@ -33,6 +33,8 @@ static void ax3000_init(Object *obj)
         g_autofree char *name = g_strdup_printf("uart%d", i);
         object_initialize_child(obj, name, &s->uart[i], TYPE_CADENCE_UART);
     }
+
+    object_initialize_child(obj, "clk", &s->ax3000_clk, TYPE_AX3000_CLK);
 }
 
 static void ax3000_realize(DeviceState *dev, Error **errp)
@@ -157,6 +159,12 @@ static void ax3000_realize(DeviceState *dev, Error **errp)
 
     /* Timer control */
     create_unimplemented_device("ax3000.timerctrl", AX3000_TIMER_CTRL, 32);
+
+    /* Clock control */
+    if (!sysbus_realize(SYS_BUS_DEVICE(&s->ax3000_clk), errp)) {
+        return;
+    }
+    sysbus_mmio_map(SYS_BUS_DEVICE(&s->ax3000_clk), 0, AX3000_PLL_BASE);
 }
 
 static void ax3000_class_init(ObjectClass *oc, const void *data)
include/hw/arm/ax3000-soc.h +2 -0
index b984d7a8ec3..329aa4e7698 100644
@@ -12,6 +12,7 @@
 #include "cpu.h"
 #include "hw/intc/arm_gicv3_common.h"
 #include "hw/char/cadence_uart.h"
+#include "hw/misc/axiado_clk.h"
 #include "hw/core/sysbus.h"
 #include "qemu/units.h"
 
@@ -49,6 +50,7 @@ typedef struct Ax3000SoCState {
     ARMCPU              cpu[AX3000_NUM_CPUS];
     GICv3State          gic;
     MemoryRegion        dram[AX3000_NUM_BANKS];
+    Ax3000ClkState      ax3000_clk;
     CadenceUARTState    uart[AX3000_NUM_UARTS];
 } Ax3000SoCState;
 
Signature · 1 line
2.34.1
#4 lore raw

PATCH v6 4/8 hw/sd: Add Axiado SD host controller with eMMC PHY

In reply to Kuan-Jui Chiu

This patch add a new model for Axiado SD host controller which is compatible with SDHCI 3.0 spec

This device model also includes a eMMC PHY which helps to control SD/eMMC

---
 MAINTAINERS                  |   2 +
 hw/sd/Kconfig                |   4 ++
 hw/sd/axiado_sdhci.c         | 117 +++++++++++++++++++++++++++++++++++
 hw/sd/meson.build            |   1 +
 include/hw/sd/axiado_sdhci.h |  21 +++++++
 5 files changed, 145 insertions(+)
 create mode 100644 hw/sd/axiado_sdhci.c
 create mode 100644 include/hw/sd/axiado_sdhci.h
MAINTAINERS +2 -0
index 9707a71137b..f3a3034f27b 100644
@@ -1299,7 +1299,9 @@ M: Kuan-Jui Chiu <[email protected]>
 L: [email protected]
 S: Maintained
 F: hw/arm/ax3000*.c
+F: hw/*/axiado*.c
 F: include/hw/arm/ax3000*.h
+F: include/hw/*/axiado*.h
 
 AVR Machines
 -------------
hw/sd/Kconfig +4 -0
index 633b9afec91..c69bf24f8de 100644
@@ -23,3 +23,7 @@ config SDHCI_PCI
 config CADENCE_SDHCI
     bool
     select SDHCI
+
+config AXIADO_SDHCI
+    bool
+    select SDHCI
hw/sd/axiado_sdhci.c new file +117 -0

117 lines not on this page · raw message

hw/sd/meson.build +1 -0
index b43d45bc564..ebf09e30a48 100644
@@ -10,3 +10,4 @@ system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_sdhci.c'))
 system_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-sdhost.c'))
 system_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_sdhci.c'))
 system_ss.add(when: 'CONFIG_CADENCE_SDHCI', if_true: files('cadence_sdhci.c'))
+system_ss.add(when: 'CONFIG_AXIADO_SDHCI', if_true: files('axiado_sdhci.c'))
include/hw/sd/axiado_sdhci.h new file +21 -0
new file mode 100644
index 00000000000..85afebad931
@@ -0,0 +1,21 @@
+/*
+ * Axiado SD Host Controller
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "hw/sd/sdhci.h"
+#include "qom/object.h"
+
+#define TYPE_AXIADO_SDHCI "axiado-sdhci"
+OBJECT_DECLARE_SIMPLE_TYPE(AxiadoSDHCIState, AXIADO_SDHCI)
+
+typedef struct AxiadoSDHCIState {
+    SysBusDevice parent;
+
+    SDHCIState sdhci;
+    MemoryRegion emmc_phy;
+    BusState *sd_bus;
+} AxiadoSDHCIState;
Signature · 1 line
2.34.1
#5 lore raw

PATCH v6 5/8 hw/arm: ax3000-soc: Enable Axiado SD host controller

In reply to Kuan-Jui Chiu

Enable SD host controller into Axiado AX3000 SoC to load kernel and rootfs from eMMC.

---
 hw/arm/Kconfig              |  1 +
 hw/arm/ax3000-soc.c         | 18 ++++++++++++++++++
 include/hw/arm/ax3000-soc.h |  7 +++++++
 3 files changed, 26 insertions(+)
hw/arm/Kconfig +1 -0
index 63fa8869317..4a201dc8236 100644
@@ -729,4 +729,5 @@ config AXIADO_SOC
     select ARM_GIC
     select CADENCE # UART
     select AXIADO_CLK
+    select AXIADO_SDHCI
     select UNIMP
hw/arm/ax3000-soc.c +18 -0
index aaeae110747..3a882dd4673 100644
@@ -35,6 +35,7 @@ static void ax3000_init(Object *obj)
     }
 
     object_initialize_child(obj, "clk", &s->ax3000_clk, TYPE_AX3000_CLK);
+    object_initialize_child(obj, "sdhci0", &s->sdhci0, TYPE_AXIADO_SDHCI);
 }
 
 static void ax3000_realize(DeviceState *dev, Error **errp)
@@ -165,6 +166,23 @@ static void ax3000_realize(DeviceState *dev, Error **errp)
         return;
     }
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->ax3000_clk), 0, AX3000_PLL_BASE);
+
+    /* SDHCI */
+    sdhci0_sbd = SYS_BUS_DEVICE(&s->sdhci0);
+    if (!sysbus_realize(sdhci0_sbd, errp)) {
+        return;
+    }
+
+    sysbus_mmio_map(sdhci0_sbd, 0, AX3000_SDHCI0_BASE);
+    sysbus_mmio_map(sdhci0_sbd, 1, AX3000_EMMC_PHY_BASE);
+    sysbus_connect_irq(sdhci0_sbd, 0,
+                       qdev_get_gpio_in(gic_dev, AX3000_SDHCI0_IRQ));
+
+    card = qdev_new(TYPE_SD_CARD);
+    qdev_prop_set_drive_err(card, "drive",
+                            blk_by_legacy_dinfo((drive_get(IF_SD, 0, 0))),
+                            &error_fatal);
+    qdev_realize_and_unref(card, s->sdhci0.sd_bus, &error_fatal);
 }
 
 static void ax3000_class_init(ObjectClass *oc, const void *data)
include/hw/arm/ax3000-soc.h +7 -0
index 329aa4e7698..52b47aa8294 100644
@@ -13,6 +13,7 @@
 #include "hw/intc/arm_gicv3_common.h"
 #include "hw/char/cadence_uart.h"
 #include "hw/misc/axiado_clk.h"
+#include "hw/sd/axiado_sdhci.h"
 #include "hw/core/sysbus.h"
 #include "qemu/units.h"
 
@@ -34,6 +35,9 @@ OBJECT_DECLARE_TYPE(Ax3000SoCState, Ax3000SoCClass, AX3000_SOC)
 #define AX3000_UART2_BASE       0x80620000
 #define AX3000_UART3_BASE       0x80520800
 
+#define AX3000_SDHCI0_BASE      0x86000000
+#define AX3000_EMMC_PHY_BASE    0x80801C00
+
 #define AX3000_TIMER_CTRL       0x8A020000
 #define AX3000_PLL_BASE         0x80000000
 
@@ -52,6 +56,7 @@ typedef struct Ax3000SoCState {
     MemoryRegion        dram[AX3000_NUM_BANKS];
     Ax3000ClkState      ax3000_clk;
     CadenceUARTState    uart[AX3000_NUM_UARTS];
+    AxiadoSDHCIState    sdhci0;
 } Ax3000SoCState;
 
 typedef struct Ax3000SoCClass {
@@ -65,6 +70,8 @@ enum Ax3000Irqs {
     AX3000_UART1_IRQ    = 113,
     AX3000_UART2_IRQ    = 114,
     AX3000_UART3_IRQ    = 170,
+
+    AX3000_SDHCI0_IRQ   = 123,
 };
 
 #endif /* AXIADO_AX3000_H */
Signature · 1 line
2.34.1
#6 lore raw

PATCH v6 6/8 hw/arm: Add Axiado EVK SCM3003

In reply to Kuan-Jui Chiu

Add EVK axiado-scm3003 built with AX3000 SoC

---
 hw/arm/Kconfig                 |  5 +++
 hw/arm/ax3000-boards.c         | 56 ++++++++++++++++++++++++++++++++++
 hw/arm/ax3000-evk.c            | 27 ++++++++++++++++
 hw/arm/meson.build             |  3 ++
 include/hw/arm/ax3000-boards.h | 28 +++++++++++++++++
 5 files changed, 119 insertions(+)
 create mode 100644 hw/arm/ax3000-boards.c
 create mode 100644 hw/arm/ax3000-evk.c
 create mode 100644 include/hw/arm/ax3000-boards.h
hw/arm/Kconfig +5 -0
index 4a201dc8236..c63c57fd18d 100644
@@ -731,3 +731,8 @@ config AXIADO_SOC
     select AXIADO_CLK
     select AXIADO_SDHCI
     select UNIMP
+
+config AXIADO_EVK
+    bool
+    default y
+    select AXIADO_SOC
hw/arm/ax3000-boards.c new file +56 -0

56 lines not on this page · raw message

hw/arm/ax3000-evk.c new file +27 -0
new file mode 100644
index 00000000000..a1708488710
@@ -0,0 +1,27 @@
+/*
+ * Axiado Evaluation Kit Emulation
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/arm/ax3000-boards.h"
+
+static void axiado_scm3003_class_init(ObjectClass *oc, const void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->desc = "Axiado SCM3003 EVK Board";
+}
+
+static const TypeInfo ax3000_evk_types[] = {
+    {
+        .name          = MACHINE_TYPE_NAME("axiado-scm3003"),
+        .parent        = TYPE_AX3000_MACHINE,
+        .class_init    = axiado_scm3003_class_init,
+    }
+};
+
+DEFINE_TYPES(ax3000_evk_types)
hw/arm/meson.build +3 -0
index 0254b82df1a..8ee5307a919 100644
@@ -112,6 +112,9 @@ arm_common_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
 
 arm_common_ss.add(when: ['CONFIG_AXIADO_SOC', 'TARGET_AARCH64'], if_true: files(
   'ax3000-soc.c'))
+arm_common_ss.add(when: ['CONFIG_AXIADO_EVK', 'TARGET_AARCH64'], if_true: files(
+  'ax3000-boards.c',
+  'ax3000-evk.c'))
 
 arm_common_ss.add(files('boot.c'))
 
include/hw/arm/ax3000-boards.h new file +28 -0
new file mode 100644
index 00000000000..4a632661e1e
@@ -0,0 +1,28 @@
+/*
+ * Axiado Boards
+ *
+ * Author: Kuan-Jui Chiu <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef AXIADO_BOARD_H
+#define AXIADO_BOARD_H
+
+#include "hw/core/boards.h"
+#include "hw/arm/ax3000-soc.h"
+
+#define TYPE_AX3000_MACHINE       MACHINE_TYPE_NAME("ax3000")
+OBJECT_DECLARE_TYPE(Ax3000MachineState, Ax3000MachineClass, AX3000_MACHINE)
+
+typedef struct Ax3000MachineState {
+    MachineState parent;
+
+    Ax3000SoCState *soc;
+} Ax3000MachineState;
+
+typedef struct Ax3000MachineClass {
+    MachineClass parent;
+
+} Ax3000MachineClass;
+#endif
Signature · 1 line
2.34.1
#7 lore raw

PATCH v6 7/8 hw/gpio: Add Cadence GPIO controller

In reply to Kuan-Jui Chiu

This patch add a new model for Cadence GPIO controller which supports 32 pins and interrupts for level-triggered/edge-triggered type on input pins.

Also define new trace functions for analysis purpose and new configuration to enable this model.

---
 hw/gpio/Kconfig                |   3 +
 hw/gpio/cadence_gpio.c         | 292 +++++++++++++++++++++++++++++++++
 hw/gpio/meson.build            |   1 +
 hw/gpio/trace-events           |   5 +
 include/hw/gpio/cadence_gpio.h |  55 +++++++
 5 files changed, 356 insertions(+)
 create mode 100644 hw/gpio/cadence_gpio.c
 create mode 100644 include/hw/gpio/cadence_gpio.h
hw/gpio/Kconfig +3 -0
index a209294c20c..fcc7c70bd50 100644
@@ -30,3 +30,6 @@ config PCF8574
 
 config ZAURUS_SCOOP
     bool
+
+config CADENCE_GPIO
+    bool
hw/gpio/cadence_gpio.c new file +292 -0

292 lines not on this page · raw message

hw/gpio/meson.build +1 -0
index 6a67ee958fa..0555f44b6a7 100644
@@ -19,3 +19,4 @@ system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_gpio.c'))
 system_ss.add(when: 'CONFIG_ASPEED_SOC', if_true: files('aspeed_sgpio.c'))
 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'))
hw/gpio/trace-events +5 -0
index cea896b28f6..80ca783a039 100644
@@ -46,3 +46,8 @@ stm32l4x5_gpio_read(char *gpio, uint64_t addr) "GPIO%s addr: 0x%" PRIx64 " "
 stm32l4x5_gpio_write(char *gpio, uint64_t addr, uint64_t data) "GPIO%s addr: 0x%" PRIx64 " val: 0x%" PRIx64 ""
 stm32l4x5_gpio_update_idr(char *gpio, uint32_t old_idr, uint32_t new_idr) "GPIO%s from: 0x%x to: 0x%x"
 stm32l4x5_gpio_pins(char *gpio, uint16_t disconnected, uint16_t high) "GPIO%s disconnected pins: 0x%x levels: 0x%x"
+
+# cadence_gpio.c
+cdns_gpio_read(const char *path, uint64_t offset, uint32_t value) "%s:reg[0x%04" PRIx64 "] -> 0x%" PRIx32
+cdns_gpio_write(const char *path, uint64_t offset, uint64_t value) "%s:reg[0x%04" PRIx64 "] <- 0x%04" PRIx64
+cdns_gpio_set(const char *path, int line, int level) "%s:[%d] <- %d"
include/hw/gpio/cadence_gpio.h new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
2.34.1
#8 lore raw

PATCH v6 8/8 hw/arm: ax3000-soc: Enable Cadence GPIO controllers

In reply to Kuan-Jui Chiu

Enable 8 Cadence GPIO controllers into Axiado AX3000 SoC

---
 hw/arm/Kconfig              |  1 +
 hw/arm/ax3000-soc.c         | 30 ++++++++++++++++++++++++++++++
 include/hw/arm/ax3000-soc.h | 21 +++++++++++++++++++++
 3 files changed, 52 insertions(+)
hw/arm/Kconfig +1 -0
index c63c57fd18d..749de848b7a 100644
@@ -729,6 +729,7 @@ config AXIADO_SOC
     select ARM_GIC
     select CADENCE # UART
     select AXIADO_CLK
+    select CADENCE_GPIO
     select AXIADO_SDHCI
     select UNIMP
 
hw/arm/ax3000-soc.c +30 -0
index 3a882dd4673..58d167d0fa7 100644
@@ -36,6 +36,11 @@ static void ax3000_init(Object *obj)
 
     object_initialize_child(obj, "clk", &s->ax3000_clk, TYPE_AX3000_CLK);
     object_initialize_child(obj, "sdhci0", &s->sdhci0, TYPE_AXIADO_SDHCI);
+
+    for (int i = 0; i < AX3000_NUM_GPIOS; i++) {
+        g_autofree char *name = g_strdup_printf("gpio%d", i);
+        object_initialize_child(obj, name, &s->gpio[i], TYPE_CADENCE_GPIO);
+    }
 }
 
 static void ax3000_realize(DeviceState *dev, Error **errp)
@@ -183,6 +188,31 @@ static void ax3000_realize(DeviceState *dev, Error **errp)
                             blk_by_legacy_dinfo((drive_get(IF_SD, 0, 0))),
                             &error_fatal);
     qdev_realize_and_unref(card, s->sdhci0.sd_bus, &error_fatal);
+
+    /* GPIOs */
+    const struct {
+        hwaddr addr;
+        unsigned int irq;
+    } gpio_table[] = {
+        { AX3000_GPIO0_BASE, AX3000_GPIO0_IRQ },
+        { AX3000_GPIO1_BASE, AX3000_GPIO1_IRQ },
+        { AX3000_GPIO2_BASE, AX3000_GPIO2_IRQ },
+        { AX3000_GPIO3_BASE, AX3000_GPIO3_IRQ },
+        { AX3000_GPIO4_BASE, AX3000_GPIO4_IRQ },
+        { AX3000_GPIO5_BASE, AX3000_GPIO5_IRQ },
+        { AX3000_GPIO6_BASE, AX3000_GPIO6_IRQ },
+        { AX3000_GPIO7_BASE, AX3000_GPIO7_IRQ }
+    };
+
+    for (int i = 0; i < AX3000_NUM_GPIOS; i++) {
+        if (!sysbus_realize(SYS_BUS_DEVICE(&s->gpio[i]), errp)) {
+            return;
+        }
+
+        sysbus_mmio_map(SYS_BUS_DEVICE(&s->gpio[i]), 0, gpio_table[i].addr);
+        sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio[i]), 0,
+                           qdev_get_gpio_in(gic_dev, gpio_table[i].irq));
+    }
 }
 
 static void ax3000_class_init(ObjectClass *oc, const void *data)
include/hw/arm/ax3000-soc.h +21 -0
index 52b47aa8294..344fcb6f3c2 100644
@@ -13,6 +13,7 @@
 #include "hw/intc/arm_gicv3_common.h"
 #include "hw/char/cadence_uart.h"
 #include "hw/misc/axiado_clk.h"
+#include "hw/gpio/cadence_gpio.h"
 #include "hw/sd/axiado_sdhci.h"
 #include "hw/core/sysbus.h"
 #include "qemu/units.h"
@@ -38,6 +39,15 @@ OBJECT_DECLARE_TYPE(Ax3000SoCState, Ax3000SoCClass, AX3000_SOC)
 #define AX3000_SDHCI0_BASE      0x86000000
 #define AX3000_EMMC_PHY_BASE    0x80801C00
 
+#define AX3000_GPIO0_BASE       0x80500000
+#define AX3000_GPIO1_BASE       0x80580000
+#define AX3000_GPIO2_BASE       0x80600000
+#define AX3000_GPIO3_BASE       0x80680000
+#define AX3000_GPIO4_BASE       0x80700000
+#define AX3000_GPIO5_BASE       0x80780000
+#define AX3000_GPIO6_BASE       0x80800000
+#define AX3000_GPIO7_BASE       0x80880000
+
 #define AX3000_TIMER_CTRL       0x8A020000
 #define AX3000_PLL_BASE         0x80000000
 
@@ -46,6 +56,7 @@ enum Ax3000Configuration {
     AX3000_NUM_IRQS     = 224,
     AX3000_NUM_BANKS    = 2,
     AX3000_NUM_UARTS    = 4,
+    AX3000_NUM_GPIOS    = 8,
 };
 
 typedef struct Ax3000SoCState {
@@ -56,6 +67,7 @@ typedef struct Ax3000SoCState {
     MemoryRegion        dram[AX3000_NUM_BANKS];
     Ax3000ClkState      ax3000_clk;
     CadenceUARTState    uart[AX3000_NUM_UARTS];
+    CadenceGPIOState    gpio[AX3000_NUM_GPIOS];
     AxiadoSDHCIState    sdhci0;
 } Ax3000SoCState;
 
@@ -72,6 +84,15 @@ enum Ax3000Irqs {
     AX3000_UART3_IRQ    = 170,
 
     AX3000_SDHCI0_IRQ   = 123,
+
+    AX3000_GPIO0_IRQ    = 183,
+    AX3000_GPIO1_IRQ    = 184,
+    AX3000_GPIO2_IRQ    = 185,
+    AX3000_GPIO3_IRQ    = 186,
+    AX3000_GPIO4_IRQ    = 187,
+    AX3000_GPIO5_IRQ    = 188,
+    AX3000_GPIO6_IRQ    = 189,
+    AX3000_GPIO7_IRQ    = 190,
 };
 
 #endif /* AXIADO_AX3000_H */
Signature · 1 line
2.34.1
#9 lore raw
In reply to Kuan-Jui Chiu
Quoted 8 lines · Kuan-Jui Chiu

This patchset introduces Axiado SoC AX3000 and a EVK SCM3003 for emulation The model for Axiado SoC AX3000 supports
4 Cortex-A53 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY
8 Cadence GPIOs

This causes 'make check' to fail. Please test this kind of thing before submission.

Hint: running QEMU without any other arguments crashes:
qemu-system-aarch64 -machine axiado-scm3003

thanks
-- PMM

#10 lore raw

Peter Maydell 於 2026/7/3 下午 07:38 寫道:

Quoted 11 lines

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 7 lines · Kuan-Jui Chiu

This patchset introduces Axiado SoC AX3000 and a EVK SCM3003 for emulation The model for Axiado SoC AX3000 supports
4 Cortex-A53 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY
8 Cadence GPIOs

Quoted 5 lines

This causes 'make check' to fail. Please test this kind of thing before submission.

Hint: running QEMU without any other arguments crashes:
qemu-system-aarch64 -machine axiado-scm3003

Hi PMM

Does you mean this patch set is not buildable or it must be passed without any other arguments?

QEMU would crash without -drive argument which SoC created an eMMC device by default

If the machine must be able to run without any other argument, I will fix it in v7

Quoted 2 lines

thanks
-- PMM

#11 lore raw
Quoted 17 lines · Kuan-Jui Chiu

Peter Maydell 於 2026/7/3 下午 07:38 寫道:

Quoted 14 lines

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 7 lines · Kuan-Jui Chiu

This patchset introduces Axiado SoC AX3000 and a EVK SCM3003 for emulation The model for Axiado SoC AX3000 supports
4 Cortex-A53 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY
8 Cadence GPIOs

This causes 'make check' to fail. Please test this kind of thing before submission.

Quoted 7 lines
Quoted 2 lines

Hint: running QEMU without any other arguments crashes:
qemu-system-aarch64 -machine axiado-scm3003

Hi PMM

Does you mean this patch set is not buildable or it must be passed without any other arguments?

I mean that the code you add must not cause our standard test suite (which you can run with "make check" and "make check-functional") to fail. One of the things it does involves running every board model with no extra arguments.

More generally, regardless of what command line arguments the user gives, QEMU should not crash. If the arguments don't make sense, report an error message.

-- PMM

#12 lore raw

Peter Maydell 於 2026/7/6 下午 05:23 寫道:

Quoted 31 lines

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 16 lines · Kuan-Jui Chiu

Peter Maydell 於 2026/7/3 下午 07:38 寫道:

Quoted 14 lines

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

Quoted 7 lines · Kuan-Jui Chiu

This patchset introduces Axiado SoC AX3000 and a EVK SCM3003 for emulation The model for Axiado SoC AX3000 supports
4 Cortex-A53 CPUs
Arm Generic Interrupt Controller v3
4 Cadence UARTs
1 SDHCI controller with PHY
8 Cadence GPIOs

This causes 'make check' to fail. Please test this kind of thing before submission.

Quoted 6 lines
Quoted 2 lines

Hint: running QEMU without any other arguments crashes:
qemu-system-aarch64 -machine axiado-scm3003

Hi PMM

Does you mean this patch set is not buildable or it must be passed without any other arguments?

I mean that the code you add must not cause our standard test suite (which you can run with "make check" and "make check-functional") to fail. One of the things it does involves running every board model with no extra arguments.

Quoted 5 lines

More generally, regardless of what command line arguments the user gives, QEMU should not crash. If the arguments don't make sense, report an error message.

-- PMM

Got it.
I will run the "make check" and "make check-functional" then fix all of the problems in v7 to pass the test