Add Axiado SoC AX3000 and EVK board
Subsystems (2)
v7 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
Refer Axiado website for more product information
https://axiado.com/products/
Test plan:
1. 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=raw2. Run QEMU test suite
make check
Ok: 326 Fail: 0 Skipped: 20
make check-functional
Ok: 26 Fail: 0 Skipped: 8
Changes in v7:
1. Create SD device only if -drive argument is present
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 | 242 +++++++++++++++++++++++++++ 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, 1089 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
PATCH v7 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
@@ -1298,6 +1298,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
@@ -723,3 +723,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
@@ -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
PATCH v7 2/8 hw/misc: Add AX3000 clock control
In reply to Kuan-Jui ChiuThis 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
@@ -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
@@ -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
@@ -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
PATCH v7 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
@@ -729,4 +729,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
@@ -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
@@ -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
PATCH v7 4/8 hw/sd: Add Axiado SD host controller with eMMC PHY
In reply to Kuan-Jui ChiuThis 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
@@ -1303,7 +1303,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
@@ -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
@@ -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
@@ -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
PATCH v7 5/8 hw/arm: ax3000-soc: Enable Axiado SD host controller
In reply to Kuan-Jui ChiuEnable SD host controller into Axiado AX3000 SoC to load kernel and rootfs from eMMC.
--- hw/arm/Kconfig | 1 + hw/arm/ax3000-soc.c | 22 ++++++++++++++++++++++ include/hw/arm/ax3000-soc.h | 7 +++++++ 3 files changed, 30 insertions(+)
hw/arm/Kconfig +1 -0
@@ -730,4 +730,5 @@ config AXIADO_SOC select ARM_GIC select CADENCE # UART select AXIADO_CLK + select AXIADO_SDHCI select UNIMP
hw/arm/ax3000-soc.c +22 -0
@@ -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)
@@ -46,6 +47,7 @@ static void ax3000_realize(DeviceState *dev, Error **errp)QList *redist_region_count;SysBusDevice *sdhci0_sbd;DeviceState *card; +DriveInfo *dinfo;/* CPUs */ for (int i =0 ; i < sc->num_cpus; i++) {
@@ -165,6 +167,26 @@ 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 )); + + dinfo =drive_get (IF_SD ,0 ,0 ); +if (dinfo) { + card =qdev_new (TYPE_SD_CARD ); +qdev_prop_set_drive_err (card,"drive" , +blk_by_legacy_dinfo (dinfo), + &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
@@ -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
PATCH v7 6/8 hw/arm: Add Axiado EVK SCM3003
In reply to Kuan-Jui ChiuAdd 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
@@ -732,3 +732,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
@@ -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
@@ -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
@@ -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
PATCH v7 7/8 hw/gpio: Add Cadence GPIO controller
In reply to Kuan-Jui ChiuThis 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
@@ -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
@@ -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
@@ -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
PATCH v7 8/8 hw/arm: ax3000-soc: Enable Cadence GPIO controllers
In reply to Kuan-Jui ChiuEnable 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
@@ -730,6 +730,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
@@ -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)
@@ -187,6 +192,31 @@ static void ax3000_realize(DeviceState *dev, Error **errp) &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
@@ -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
Hi reviewers
This is a reminder ping
________________________________
寄件者: Kuan-Jui Chiu <[email protected]>
寄件日期: 2026年7月13日 下午 03:30
收件者: [email protected] <[email protected]>; [email protected] <[email protected]>; [email protected] <[email protected]> 副本: Kuan-Jui Chiu <[email protected]>
主旨: [PATCH v7 0/8] 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
Refer Axiado website for more product information
https://axiado.com/products/
Test plan:
1. 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=raw2. Run QEMU test suite
make check
Ok: 326 Fail: 0 Skipped: 20
make check-functional
Ok: 26 Fail: 0 Skipped: 8
Changes in v7:
1. Create SD device only if -drive argument is present
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 | 242 +++++++++++++++++++++++++++ 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, 1089 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
--
2.34.1
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
Thanks; I've applied this to target-arm.next ready for when the tree reopens for 11.2.
I made a couple of minor fixes to save you doing another respin:
(1) you can't use %lx in logging printf format strings for printing a variable of type 'hwaddr' (it isn't a "long" on all hosts, and this won't compile on some systems) -- you need HWADDR_PRIx . I fixed some cases of this in patches 2 and 4.
(2) we don't require the "<public>" and "<private>" marker comments any more, so I removed them from patch 7.
-- PMM
Quoted 16 lines · Peter Maydell
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 GPIOsThanks; I've applied this to target-arm.next ready for when the tree reopens for 11.2.
I made a couple of minor fixes to save you doing another respin:
Quoted 7 lines
(1) you can't use %lx in logging printf format strings for printing a variable of type 'hwaddr' (it isn't a "long" on all hosts, and this won't compile on some systems) -- you need
HWADDR_PRIx. I fixed some cases of this in patches 2 and 4.(2) we don't require the "<public>" and "<private>" marker comments any more, so I removed them from patch 7.
I also found that an issue with the Kconfig info caused a build failure when any non-arm target is enabled in configure. This fixes it (and makes the kconfig match how we do other board and SoC kconfig stanzas in hw/arm/Kconfig):
hw/arm/Kconfig +1 -1
@@ -728,7 +728,6 @@ config ARMSSE config AXIADO_SOC bool - depends on ARM select ARM_GIC select CADENCE # UART select AXIADO_CLK
@@ -739,4 +738,5 @@ config AXIADO_SOC config AXIADO_EVK bool default y + depends on TCG && ARM select AXIADO_SOC
so I am squashing that in accordingly.
-- PMM
Thanks a lot for your help
________________________________
寄件者: Peter Maydell <[email protected]>
寄件日期: 2026年8月12日 下午 06:43
收件者: Kuan-Jui Chiu <[email protected]>
副本: [email protected] <[email protected]>; [email protected] <[email protected]> 主旨: Re: [PATCH v7 0/8] Add Axiado SoC AX3000 and EVK board
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 · Peter Maydell
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 GPIOsThanks; I've applied this to target-arm.next ready for when the tree reopens for 11.2.
I made a couple of minor fixes to save you doing another respin:
Quoted 7 lines
(1) you can't use %lx in logging printf format strings for printing a variable of type 'hwaddr' (it isn't a "long" on all hosts, and this won't compile on some systems) -- you need
HWADDR_PRIx. I fixed some cases of this in patches 2 and 4.(2) we don't require the "<public>" and "<private>" marker comments any more, so I removed them from patch 7.
I also found that an issue with the Kconfig info caused a build failure when any non-arm target is enabled in configure. This fixes it (and makes the kconfig match how we do other board and SoC kconfig stanzas in hw/arm/Kconfig):
hw/arm/Kconfig +1 -1
@@ -728,7 +728,6 @@ config ARMSSE config AXIADO_SOC bool - depends on ARM select ARM_GIC select CADENCE # UART select AXIADO_CLK
@@ -739,4 +738,5 @@ config AXIADO_SOC config AXIADO_EVK bool default y + depends on TCG && ARM select AXIADO_SOC
so I am squashing that in accordingly.
-- PMM