Commit 38b5256375 for qemu.org
commit 38b52563758ec3fe5df2ba8efa86b155ad79649d
Author: Kuan-Jui Chiu <kchiu@axiado.com>
Date: Tue Aug 11 20:14:11 2026 +0100
hw/misc: Add AX3000 clock control
This patch adds a new model for Axiado AX3000 clock control which supports
to read ID and status
Signed-off-by: Kuan-Jui Chiu <kchiu@axiado.com>
Message-id: 20260713073033.3883619-3-kchiu@axiado.com
[PMM: use HWADDR_PRIx]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/hw/misc/Kconfig b/hw/misc/Kconfig
index 1543ee6653..b8860dd3e7 100644
--- a/hw/misc/Kconfig
+++ b/hw/misc/Kconfig
@@ -257,4 +257,7 @@ config XLNX_VERSAL_TRNG
config XLNX_ZYNQ_DDRC
bool
+config AXIADO_CLK
+ bool
+
source macio/Kconfig
diff --git a/hw/misc/axiado_clk.c b/hw/misc/axiado_clk.c
new file mode 100644
index 0000000000..090beb38b5
--- /dev/null
+++ b/hw/misc/axiado_clk.c
@@ -0,0 +1,79 @@
+/*
+ * Axiado Clock Control
+ *
+ * Author: Kuan-Jui Chiu <kchiu@axiado.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/misc/axiado_clk.h"
+#include "qemu/log.h"
+
+#define CLKRST_CPU_PLL_POSTDIV_OFFSET 0x0C
+#define CLKRST_CPU_PLL_STS_OFFSET 0x14
+
+static uint64_t pll_read(void *opaque, hwaddr offset, unsigned size)
+{
+ switch (offset) {
+ case CLKRST_CPU_PLL_POSTDIV_OFFSET:
+ return 0x20891b;
+ case CLKRST_CPU_PLL_STS_OFFSET:
+ return 0x01;
+ default:
+ qemu_log_mask(LOG_UNIMP,
+ "Register 0x%" HWADDR_PRIx " not implemented\n", offset);
+ break;
+ }
+ return 0x00;
+}
+
+static void pll_write(void *opaque, hwaddr offset, uint64_t val, unsigned size)
+{
+ qemu_log_mask(LOG_UNIMP,
+ "Register 0x%" HWADDR_PRIx " not implemented\n", offset);
+}
+
+static const MemoryRegionOps pll_ops = {
+ .read = pll_read,
+ .write = pll_write,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .impl = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ }
+};
+
+static void ax3000_clk_init(Object *obj)
+{
+ Ax3000ClkState *s = AX3000_CLK(obj);
+
+ memory_region_init_io(&s->pll_ctrl, obj, &pll_ops, s,
+ TYPE_AX3000_CLK, AX3000_CLK_PLL_CTRL_SIZE);
+ sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->pll_ctrl);
+}
+
+static void ax3000_clk_class_init(ObjectClass *klass, const void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ dc->desc = "Axiado AX3000 Clock Control";
+}
+
+static const TypeInfo ax3000_clk_info = {
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .name = TYPE_AX3000_CLK,
+ .instance_size = sizeof(Ax3000ClkState),
+ .instance_init = ax3000_clk_init,
+ .class_init = ax3000_clk_class_init,
+};
+
+static void axiado_clk_register_type(void)
+{
+ type_register_static(&ax3000_clk_info);
+}
+type_init(axiado_clk_register_type);
diff --git a/hw/misc/meson.build b/hw/misc/meson.build
index 23265f6035..e86d9ad6b3 100644
--- a/hw/misc/meson.build
+++ b/hw/misc/meson.build
@@ -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'))
diff --git a/include/hw/misc/axiado_clk.h b/include/hw/misc/axiado_clk.h
new file mode 100644
index 0000000000..6e12a509d7
--- /dev/null
+++ b/include/hw/misc/axiado_clk.h
@@ -0,0 +1,26 @@
+/*
+ * Axiado AX3000 Clock Control
+ *
+ * Author: Kuan-Jui Chiu <kchiu@axiado.com>
+ *
+ * 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 */