On 19/5/26 19:56, Gaurav Sharma wrote:
From: Bernhard Beschow <[email protected]>
Add emulation of the i.MX8MP System Reset Controller (SRC).
The SRC manages reset control for various subsystems on the i.MX8MP SoC.
SRC registers are used to start/stop/poll the M7 core, hence needed for
AMP boot.
Signed-off-by: Bernhard Beschow <[email protected]>
---
docs/system/arm/imx8m.rst | 1 +
hw/arm/Kconfig | 1 +
hw/arm/fsl-imx8mp.c | 10 +
hw/misc/Kconfig | 3 +
hw/misc/imx8mp_src.c | 431 +++++++++++++++++++++++++++++++++++
hw/misc/meson.build | 1 +
hw/misc/trace-events | 5 +
include/hw/arm/fsl-imx8mp.h | 2 +
include/hw/misc/imx8mp_src.h | 32 +++
9 files changed, 486 insertions(+)
create mode 100644 hw/misc/imx8mp_src.c
create mode 100644 include/hw/misc/imx8mp_src.h
+void imx8mp_src_start_cpu(FslImx8mpSrcState *s, int cpuid)
+{
+ switch (cpuid) {
+ case 0:
+ arm_set_cpu_on(0, s->regs[R_SRC_GPR2] << 2, 0, 3, true);
+ break;
+ case 1:
+ arm_set_cpu_on(1, s->regs[R_SRC_GPR4] << 2, 0, 3, true);
+ break;
+ case 2:
+ arm_set_cpu_on(2, s->regs[R_SRC_GPR6] << 2, 0, 3, true);
+ break;
+ case 3:
+ arm_set_cpu_on(3, s->regs[R_SRC_GPR8] << 2, 0, 3, true);
+ break;
Confirming my thoughts on patch #6, this SoC really need to start with
no less than '-smp 4' :)
+ default:
+ g_assert_not_reached();
+ break;
+ }
+}
+static void imx8mp_src_class_init(ObjectClass *klass, const void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(klass);
+
+ device_class_set_legacy_reset(dc, imx8mp_src_reset);
Please do not use this legacy interface.
+ dc->realize = imx8mp_src_realize;
+ dc->vmsd = &imx8mp_src_vmstate;
+ device_class_set_props(dc, imx8mp_src_properties);
+ dc->desc = "i.MX 8M Plus System Reset Controller";
+}