From: YannickV <[email protected]> Introduce a new machine type 'beckhoff-cx7200' that inherits from the xilinx-zynq-a9 machine. The CX7200 is an industrial PC based on the Xilinx Zynq-7000 SoC. The machine preserves all standard Zynq features (boot-mode selection, SPI, UART, Ethernet, etc.) while adding CX7200-specific hardware components.
Signed-off-by: YannickV <[email protected]> --- MAINTAINERS | 9 +++++ hw/arm/Kconfig | 7 ++++ hw/arm/beckhoff_CX7200.c | 80 ++++++++++++++++++++++++++++++++++++++++ hw/arm/meson.build | 1 + 4 files changed, 97 insertions(+) create mode 100644 hw/arm/beckhoff_CX7200.c diff --git a/MAINTAINERS b/MAINTAINERS index 788b815501..c0a9531bf1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1159,6 +1159,15 @@ F: include/hw/adc/zynq-xadc.h X: hw/ssi/xilinx_* F: docs/system/arm/xlnx-zynq.rst +Beckhoff CX7200 +M: Yannick Vossen <[email protected]> +M: Corvin Koehne <[email protected]> +L: [email protected] +S: Maintained +F: hw/arm/beckhoff_CX7200.c +F: hw/misc/beckhoff_ccat.c +F: include/hw/misc/beckhoff_ccat.h + Xilinx ZynqMP and Versal M: Alistair Francis <[email protected]> M: Edgar E. Iglesias <[email protected]> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig index fb798ccbee..be500186ca 100644 --- a/hw/arm/Kconfig +++ b/hw/arm/Kconfig @@ -292,6 +292,13 @@ config ZYNQ select XLNX_ZYNQ_DDRC select ZYNQ_DEVCFG +config BECKHOFF_CX7200 + bool + default y + depends on TCG && ARM + select ZYNQ + select BECKHOFF_CCAT + config ARM_V7M bool # currently v7M must be included in a TCG build due to translate.c diff --git a/hw/arm/beckhoff_CX7200.c b/hw/arm/beckhoff_CX7200.c new file mode 100644 index 0000000000..6e27515886 --- /dev/null +++ b/hw/arm/beckhoff_CX7200.c @@ -0,0 +1,80 @@ + +/* + * Modified Xilinx Zynq Baseboard System emulation for Beckhoff CX7200. + * + * Copyright (c) 2026 Beckhoff Automation GmbH & Co. KG + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include "qemu/osdep.h" +#include "qapi/error.h" +#include "hw/core/boards.h" +#include "hw/block/block.h" +#include "hw/core/loader.h" +#include "hw/core/qdev-properties.h" +#include "hw/core/clock.h" +#include "qemu/error-report.h" +#include "hw/arm/xilinx_zynq.h" /* For ZynqMachineState */ +#include "hw/cpu/a9mpcore.h" +#include "hw/timer/a9gtimer.h" +#include "qom/object.h" + +#define TYPE_CX7200_MACHINE MACHINE_TYPE_NAME("beckhoff-cx7200") + +#define CX7200_PS_CLK_FREQUENCY (40 * 1000 * 1000) + +static void ccat_init(uint32_t base, BlockBackend *eeprom_blk) +{ + DeviceState *dev; + SysBusDevice *busdev; + + dev = qdev_new("beckhoff-ccat"); + if (eeprom_blk) { + qdev_prop_set_drive_err(dev, "eeprom", eeprom_blk, &error_fatal); + } + busdev = SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(busdev, &error_fatal); + sysbus_mmio_map(busdev, 0, base); +} + +static void beckhoff_cx7200_init(MachineState *machine) +{ + DriveInfo *di; + BlockBackend *blk; + MachineClass *parent_mc; + + parent_mc = MACHINE_CLASS(object_class_get_parent( + object_get_class(OBJECT(machine)))); + parent_mc->init(machine); + + di = drive_get(IF_NONE, 0, 0); + blk = di ? blk_by_legacy_dinfo(di) : NULL; + ccat_init(0x40000000, blk); +} + +static void beckhoff_cx7200_machine_class_init(ObjectClass *oc, + const void *data) +{ + MachineClass *mc = MACHINE_CLASS(oc); + ZynqMachineClass *zmc = ZYNQ_MACHINE_CLASS(oc); + + mc->desc = "Beckhoff CX7200 Industrial PC (Zynq-based)"; + mc->init = beckhoff_cx7200_init; + zmc->qspi_flash_type = "is25lp016d"; + zmc->ps_clk_freq = CX7200_PS_CLK_FREQUENCY; +} + +static const TypeInfo beckhoff_cx7200_machine_type = { + .name = TYPE_CX7200_MACHINE, + .parent = TYPE_ZYNQ_MACHINE, + .class_init = beckhoff_cx7200_machine_class_init, + .instance_size = sizeof(ZynqMachineState), +}; + +static void beckhoff_cx7200_machine_register_types(void) +{ + type_register_static(&beckhoff_cx7200_machine_type); +} + +type_init(beckhoff_cx7200_machine_register_types) diff --git a/hw/arm/meson.build b/hw/arm/meson.build index 80068f70bb..46e77cb49b 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -2,6 +2,7 @@ arm_ss = ss.source_set() arm_common_ss = ss.source_set() arm_common_ss.add(when: 'CONFIG_ARM_VIRT', if_true: files('virt.c')) arm_common_ss.add(when: 'CONFIG_ACPI', if_true: files('virt-acpi-build.c')) +arm_common_ss.add(when: 'CONFIG_BECKHOFF_CX7200', if_true: files('beckhoff_CX7200.c')) arm_common_ss.add(when: 'CONFIG_DIGIC', if_true: files('digic_boards.c')) arm_common_ss.add(when: 'CONFIG_EMCRAFT_SF2', if_true: files('msf2-som.c')) arm_common_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c')) -- 2.47.3
