hw/arm: add Beckhoff CX7200 board
Subsystems (2)
v7 cover hw/arm: add Beckhoff CX7200 board
From: Corvin Köhne <[email protected]>
Hi,
Beckhoff has build a board, called CX7200, based on the Xilinx Zynq A9 platform. This commit series adds the Beckhoff CX7200 as new board variant to QEMU.
The emulation is able to successfully boot an CX7200 image. The image includes some self tests executed on every boot. Only the cache self test fails due to QEMU emulating the cache as always being coherent. The self tests include f.e.:
* Network
* Flash
* CCAT DMA + EEPROM [1]
* TwinCAT (Beckhoff's automation control software [2])
[1] https://github.com/beckhoff/ccat
[2] https://www.beckhoff.com/en-us/products/automation/
YannickV (16):
hw/dma/zynq-devcfg: Handle bitstream loading via DMA to 0xffffffff hw/arm/zynq-devcfg: Prevent unintended unlock during initialization hw/dma/zynq: Ensure PCFG_DONE bit remains set to indicate PL is in
user mode
hw/dma/zynq-devcfg: Simulate dummy PL reset hw/dma/zynq-devcfg: Indicate power-up status of PL hw/misc: Add dummy ZYNQ DDR controller
hw/misc/zynq_slcr: Add logic for DCI configuration hw/misc: Add Beckhoff CCAT device
hw/block/m25p80: Add HAS_SR_TB flag for is25lp016d hw/arm/xilinx_zynq: Split xilinx_zynq into header and implementation
files
hw/arm/xilinx_zynq: Add flash type as machine class property hw/misc/zynq_slcr: Add CPU clock outputs and ratios hw/timer,cpu: Add Clock API support to A9MPCore timers hw/arm/xilinx_zynq: Make PS frequency configurable hw/arm: Add new machine based on xilinx-zynq-a9 for Beckhoff CX7200 docs/system/arm: Add support for Beckhoff CX7200
MAINTAINERS | 11 + docs/system/arm/beckhoff-cx7200.rst | 62 ++++ docs/system/target-arm.rst | 1 + hw/arm/Kconfig | 8 + hw/arm/beckhoff_CX7200.c | 80 ++++++ hw/arm/meson.build | 1 + hw/arm/xilinx_zynq.c | 54 ++-- hw/block/m25p80.c | 3 +- hw/cpu/a9mpcore.c | 12 + hw/dma/xlnx-zynq-devcfg.c | 27 +- hw/misc/Kconfig | 6 + hw/misc/beckhoff_ccat.c | 339 ++++++++++++++++++++++ hw/misc/meson.build | 2 + hw/misc/xlnx-zynq-ddrc.c | 421 ++++++++++++++++++++++++++++ hw/misc/zynq_slcr.c | 71 +++++ hw/timer/a9gtimer.c | 18 +- hw/timer/arm_mptimer.c | 20 +- include/hw/arm/xilinx_zynq.h | 38 +++ include/hw/cpu/a9mpcore.h | 1 + include/hw/misc/xlnx-zynq-ddrc.h | 147 ++++++++++ include/hw/timer/a9gtimer.h | 1 + include/hw/timer/arm_mptimer.h | 2 + 22 files changed, 1292 insertions(+), 33 deletions(-) create mode 100644 docs/system/arm/beckhoff-cx7200.rst create mode 100644 hw/arm/beckhoff_CX7200.c create mode 100644 hw/misc/beckhoff_ccat.c create mode 100644 hw/misc/xlnx-zynq-ddrc.c create mode 100644 include/hw/arm/xilinx_zynq.h create mode 100644 include/hw/misc/xlnx-zynq-ddrc.h
Signature · 1 line
2.47.3
PATCH v7 1/16 hw/dma/zynq-devcfg: Handle bitstream loading via DMA to 0xffffffff
From: YannickV <[email protected]>
A DMA transfer to destination address 0xffffffff should trigger a bitstream load via the PCAP interface. Currently, this case is not intercepted, causing loaders to enter an infinite loop when polling the status register.
This commit adds a check for 0xffffffff as the destination address. If detected, the relevant status register bits (DMA_DONE, DMA_P_DONE, and PCFG_DONE) are set to indicate a successful bitstream load. If the address is different, the DMA transfer proceeds as usual. A successful load is indicated but nothing is actually done. Guests relying on FPGA functions are still known to fail.
This feature is required for the integration of the Beckhoff CX7200 model.
--- hw/dma/xlnx-zynq-devcfg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
hw/dma/xlnx-zynq-devcfg.c +8 -1
@@ -247,7 +247,14 @@ static uint64_t r_lock_pre_write(RegisterInfo *reg, uint64_t val)static void r_dma_dst_len_post_write (RegisterInfo *reg,uint64_t val) {XlnxZynqDevcfg *s =XLNX_ZYNQ_DEVCFG (reg->opaque); - +if ((s->regs[R_DMA_DST_ADDR ]) ==0xffffffff ) { +DB_PRINT ("bitstream loading detected\n" ); + s->regs[R_INT_STS ] |=R_INT_STS_DMA_DONE_MASK | +R_INT_STS_DMA_P_DONE_MASK | +R_INT_STS_PCFG_DONE_MASK ; +xlnx_zynq_devcfg_update_ixr (s); +return ; + } s->dma_cmd_fifo[s->dma_cmd_fifo_num] = (XlnxZynqDevcfgDMACmd ) { .src_addr = s->regs[R_DMA_SRC_ADDR ] & ~0x3UL , .dest_addr = s->regs[R_DMA_DST_ADDR ] & ~0x3UL ,
Signature · 1 line
2.47.3
PATCH v7 2/16 hw/arm/zynq-devcfg: Prevent unintended unlock during initialization
In reply to Corvin KöhneFrom: YannickV <[email protected]>
During the emulation startup, all registers are reset, which triggers the r_unlock_post_write function with a value of 0. This led to an unintended memory access disable, making the devcfg unusable.
During startup, the memory space no longer gets locked.
--- hw/dma/xlnx-zynq-devcfg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
hw/dma/xlnx-zynq-devcfg.c +3 -1
@@ -221,7 +221,9 @@ static void r_unlock_post_write(RegisterInfo *reg, uint64_t val) {XlnxZynqDevcfg *s =XLNX_ZYNQ_DEVCFG (reg->opaque);const char *device_prefix =object_get_typename (OBJECT (s)); - +if (device_is_in_reset (DEVICE (s))) { +return ; + }if (val ==R_UNLOCK_MAGIC ) {DB_PRINT ("successful unlock\n" ); s->regs[R_CTRL ] |=R_CTRL_PCAP_PR_MASK ;
Signature · 1 line
2.47.3
PATCH v7 3/16 hw/dma/zynq: Ensure PCFG_DONE bit remains set to indicate PL is in user mode
In reply to Corvin KöhneFrom: YannickV <[email protected]>
All register bits are clear on write by writing 1s to those bits, however the register bits will only be cleared if the condition that sets the interrupt flag is no longer true. Since we can assume that programming is always done, the PCFG_DONE flag is always set to 1, so it will not never be cleared.
--- hw/dma/xlnx-zynq-devcfg.c | 2 ++ 1 file changed, 2 insertions(+)
hw/dma/xlnx-zynq-devcfg.c +2 -0
@@ -188,6 +188,8 @@ static void r_ixr_post_write(RegisterInfo *reg, uint64_t val) {XlnxZynqDevcfg *s =XLNX_ZYNQ_DEVCFG (reg->opaque); + s->regs[R_INT_STS ] |=R_INT_STS_PCFG_DONE_MASK ; +xlnx_zynq_devcfg_update_ixr (s); }
Signature · 1 line
2.47.3
PATCH v7 4/16 hw/dma/zynq-devcfg: Simulate dummy PL reset
In reply to Corvin KöhneFrom: YannickV <[email protected]>
Setting PCFG_PROG_B should reset the PL. After a reset PCFG_INIT should indicate that the reset is finished successfully.
In order to add a MMIO-Device as part of the PL in the Zynq, the reset logic must succeed. The PCFG_INIT flag is now set when the PL reset is triggered by PCFG_PROG_B. Indicating the reset was successful.
--- hw/dma/xlnx-zynq-devcfg.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/dma/xlnx-zynq-devcfg.c +9 -0
@@ -49,6 +49,7 @@ REG32(CTRL, 0x00) FIELD(CTRL, FORCE_RST, 31, 1) /* Not supported, wr ignored */ + FIELD(CTRL, PCFG_PROG_B, 30, 1) FIELD(CTRL, PCAP_PR, 27, 1) /* Forced to 0 on bad unlock */ FIELD(CTRL, PCAP_MODE, 26, 1)FIELD (CTRL ,MULTIBOOT_EN ,24 ,1 )
@@ -116,6 +117,7 @@ REG32(STATUS, 0x14) FIELD(STATUS, PSS_GTS_USR_B, 11, 1) FIELD(STATUS, PSS_FST_CFG_B, 10, 1) FIELD(STATUS, PSS_CFG_RESET_B, 5, 1) + FIELD(STATUS, PCFG_INIT, 4, 1) REG32(DMA_SRC_ADDR, 0x18)REG32 (DMA_DST_ADDR ,0x1C )
@@ -204,6 +206,13 @@ static uint64_t r_ctrl_pre_write(RegisterInfo *reg, uint64_t val) val |= lock_ctrl_map[i] & s->regs[R_CTRL ]; } } + +if (FIELD_EX32 (val,CTRL ,PCFG_PROG_B )) { + s->regs[R_STATUS ] |=R_STATUS_PCFG_INIT_MASK ; + }else { + s->regs[R_STATUS ] &= ~R_STATUS_PCFG_INIT_MASK ; + } +return val; }
Signature · 1 line
2.47.3
PATCH v7 5/16 hw/dma/zynq-devcfg: Indicate power-up status of PL
In reply to Corvin KöhneFrom: YannickV <[email protected]>
It is assumed, that the programmable logic (PL) is always powered during emulation. Therefor the PCFG_POR_B bit in the MCTRL register is set.
--- hw/dma/xlnx-zynq-devcfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/dma/xlnx-zynq-devcfg.c +2 -1
@@ -333,7 +333,8 @@ static const RegisterAccessInfo xlnx_zynq_devcfg_regs_info[] = {/* Silicon 3.0 for version field, the mysterious reserved bit 23 * and QEMU platform identifier. */ - .reset = 0x2 << R_MCTRL_PS_VERSION_SHIFT | 1 << 23 | R_MCTRL_QEMU_MASK, + .reset = 0x2 << R_MCTRL_PS_VERSION_SHIFT | 1 << 23 | + R_MCTRL_PCFG_POR_B_MASK | R_MCTRL_QEMU_MASK, .ro = ~R_MCTRL_INT_PCAP_LPBK_MASK, .rsvd = 0x00f00303, },
Signature · 1 line
2.47.3
PATCH v7 6/16 hw/misc: Add dummy ZYNQ DDR controller
In reply to Corvin KöhneFrom: YannickV <[email protected]>
A dummy DDR controller for ZYNQ has been added. While all registers are present, not all are functional. Read and write access is validated, and the user mode can be set. This provides a basic DDR controller initialization, preventing system hangs due to endless polling or similar issues.
--- MAINTAINERS | 2 + hw/arm/Kconfig | 1 + hw/arm/xilinx_zynq.c | 16 +- hw/misc/Kconfig | 3 + hw/misc/meson.build | 1 + hw/misc/xlnx-zynq-ddrc.c | 421 +++++++++++++++++++++++++++++++ include/hw/misc/xlnx-zynq-ddrc.h | 147 +++++++++++ 7 files changed, 588 insertions(+), 3 deletions(-) create mode 100644 hw/misc/xlnx-zynq-ddrc.c create mode 100644 include/hw/misc/xlnx-zynq-ddrc.h
MAINTAINERS +2 -0
@@ -1150,8 +1150,10 @@ L: [email protected] S: Maintained F: hw/*/xilinx_* F: hw/*/cadence_* +F: hw/misc/xlnx-zynq-ddrc.c F: hw/misc/zynq_slcr.c F: hw/adc/zynq-xadc.c +F: include/hw/misc/xlnx-zynq-ddrc.h F: include/hw/misc/zynq_slcr.h F: include/hw/adc/zynq-xadc.h X: hw/ssi/xilinx_*
hw/arm/Kconfig +1 -0
@@ -289,6 +289,7 @@ config ZYNQ select XILINX_AXI select XILINX_SPI select XILINX_SPIPS + select XLNX_ZYNQ_DDRC select ZYNQ_DEVCFG config ARM_V7M
hw/arm/xilinx_zynq.c +13 -3
@@ -201,6 +201,17 @@ static void zynq_set_boot_mode(Object *obj, const char *str, m->boot_mode = mode; } +static void ddr_ctrl_init (uint32_t base) +{ +DeviceState *dev; +SysBusDevice *busdev; + + dev =qdev_new ("zynq.ddr-ctlr" ); + busdev =SYS_BUS_DEVICE (dev); +sysbus_realize_and_unref (busdev, &error_fatal); +sysbus_mmio_map (busdev,0 , base); +} +static void zynq_init (MachineState *machine) {ZynqMachineState *zynq_machine =ZYNQ_MACHINE (machine);
@@ -312,6 +323,8 @@ static void zynq_init(MachineState *machine)sysbus_create_varargs ("cadence_ttc" ,0xF8002000 , pic[69 -GIC_INTERNAL ], pic[70 -GIC_INTERNAL ], pic[71 -GIC_INTERNAL ],NULL ); +ddr_ctrl_init (0xF8006000 ); +gem_init (0xE000B000 , pic[54 -GIC_INTERNAL ]);gem_init (0xE000C000 , pic[77 -GIC_INTERNAL ]);
@@ -393,9 +406,6 @@ static void zynq_init(MachineState *machine)/* System Watchdog Timer Registers */ create_unimplemented_device ("zynq.swdt" ,0xF8005000 ,4 * KiB); -/* DDR memory controller */ -create_unimplemented_device ("zynq.ddrc" ,0xF8006000 ,4 * KiB); -/* AXI_HP Interface (AFI) */ create_unimplemented_device ("zynq.axi_hp0" ,0xF8008000 ,0x28 );create_unimplemented_device ("zynq.axi_hp1" ,0xF8009000 ,0x28 );
hw/misc/Kconfig +3 -0
@@ -254,4 +254,7 @@ config IOSB config XLNX_VERSAL_TRNG bool +config XLNX_ZYNQ_DDRC + bool + source macio/Kconfig
hw/misc/meson.build +1 -0
@@ -97,6 +97,7 @@ system_ss.add(when: 'CONFIG_RASPI', if_true: files( )) system_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c')) system_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c')) +system_ss.add(when: 'CONFIG_XLNX_ZYNQ_DDRC', if_true: files('xlnx-zynq-ddrc.c')) system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c')) system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c')) system_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files(
hw/misc/xlnx-zynq-ddrc.c new file +421 -0
421 lines not on this page · raw message
include/hw/misc/xlnx-zynq-ddrc.h new file +147 -0
147 lines not on this page · raw message
Signature · 1 line
2.47.3
Re: [PATCH v7 06/16] hw/misc: Add dummy ZYNQ DDR controller
Quoted 10 lines · Corvin Köhne
From: YannickV <[email protected]>
A dummy DDR controller for ZYNQ has been added. While all registers are present, not all are functional. Read and write access is validated, and the user mode can be set. This provides a basic DDR controller initialization, preventing system hangs due to endless polling or similar issues.
Signed-off-by YannickV <[email protected]>---
thanks
-- PMM
PATCH v7 7/16 hw/misc/zynq_slcr: Add logic for DCI configuration
In reply to Corvin KöhneFrom: YannickV <[email protected]>
The registers for the digitally controlled impedance (DCI) clock are part of the system level control registers (SLCR). The DONE bit in the status register indicates a successfull DCI calibration. An description of the calibration process can be found here:
https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM/DDR-IOB-Impedance-Calibration
The DCI control register and status register have been added. As soon as the ENABLE and RESET bit are set, the RESET bit has also been toggled to 0 before and the UPDATE_CONTROL is not set, the DONE bit in the status register is set. If these bits change the DONE bit is reset. Note that the option bits are not taken into consideration.
--- hw/misc/zynq_slcr.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
hw/misc/zynq_slcr.c +31 -0
@@ -180,6 +180,12 @@ REG32(GPIOB_CFG_HSTL, 0xb14) REG32(GPIOB_DRVR_BIAS_CTRL, 0xb18) REG32(DDRIOB, 0xb40) +REG32(DDRIOB_DCI_CTRL, 0xb70) + FIELD(DDRIOB_DCI_CTRL, RESET, 0, 1) + FIELD(DDRIOB_DCI_CTRL, ENABLE, 1, 1) + FIELD(DDRIOB_DCI_CTRL, UPDATE_CONTROL, 20, 1) +REG32(DDRIOB_DCI_STATUS, 0xb74) + FIELD(DDRIOB_DCI_STATUS, DONE, 13, 1)#define DDRIOB_LENGTH 14#define ZYNQ_SLCR_MMIO_SIZE 0x1000
@@ -193,6 +199,8 @@ struct ZynqSLCRState {MemoryRegion iomem; +bool ddriob_dci_ctrl_reset_toggled; +uint32_t regs[ZYNQ_SLCR_NUM_REGS ];Clock *ps_clk;
@@ -331,6 +339,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType type)DB_PRINT ("RESET\n" ); + s->ddriob_dci_ctrl_reset_toggled = false; + s->regs[R_LOCKSTA ] =1 ;/* 0x100 - 0x11C */ s->regs[R_ARM_PLL_CTRL ] =0x0001A008 ;
@@ -418,6 +428,8 @@ static void zynq_slcr_reset_init(Object *obj, ResetType type) s->regs[R_DDRIOB +4 ] = s->regs[R_DDRIOB +5 ] = s->regs[R_DDRIOB +6 ] =0x00000e00 ; s->regs[R_DDRIOB +12 ] =0x00000021 ; + + s->regs[R_DDRIOB_DCI_CTRL ] =0x00000020 ; }static void zynq_slcr_reset_hold (Object *obj,ResetType type)
@@ -554,6 +566,25 @@ static void zynq_slcr_write(void *opaque, hwaddr offset, (int)offset, (unsigned)val & 0xFFFF); }return ; + +case R_DDRIOB_DCI_CTRL : +if (!FIELD_EX32 (val,DDRIOB_DCI_CTRL ,RESET ) && +FIELD_EX32 (s->regs[R_DDRIOB_DCI_CTRL ],DDRIOB_DCI_CTRL ,RESET )) { + + s->ddriob_dci_ctrl_reset_toggled = true; +DB_PRINT ("DDRIOB DCI CTRL RESET was toggled\n" ); + } + +if (FIELD_EX32 (val,DDRIOB_DCI_CTRL ,ENABLE ) && +FIELD_EX32 (val,DDRIOB_DCI_CTRL ,RESET ) && + !FIELD_EX32 (val,DDRIOB_DCI_CTRL ,UPDATE_CONTROL ) && + s->ddriob_dci_ctrl_reset_toggled) { + + s->regs[R_DDRIOB_DCI_STATUS ] |=R_DDRIOB_DCI_STATUS_DONE_MASK ; + }else { + s->regs[R_DDRIOB_DCI_STATUS ] &= ~R_DDRIOB_DCI_STATUS_DONE_MASK ; + } +break ; }if (s->regs[R_LOCKSTA ]) {
Signature · 1 line
2.47.3
PATCH v7 8/16 hw/misc: Add Beckhoff CCAT device
In reply to Corvin KöhneFrom: YannickV <[email protected]>
This adds the Beckhoff Communication Controller (CCAT). The information block, EEPROM interface and DMA controller are currently implemented.
The EEPROM provides production information for Beckhoff Devices. An EEPORM binary must therefor be handed over. It should be aligned to a power of two. If no EEPROM binary is handed over an empty EEPROM of size 4096 is initialized.
This device is needed for the Beckhoff CX7200 board emulation.
--- hw/misc/Kconfig | 3 + hw/misc/beckhoff_ccat.c | 339 ++++++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 343 insertions(+) create mode 100644 hw/misc/beckhoff_ccat.c
hw/misc/Kconfig +3 -0
@@ -257,4 +257,7 @@ config XLNX_VERSAL_TRNG config XLNX_ZYNQ_DDRC bool +config BECKHOFF_CCAT + bool + source macio/Kconfig
hw/misc/beckhoff_ccat.c new file +339 -0
339 lines not on this page · raw message
hw/misc/meson.build +1 -0
@@ -15,6 +15,7 @@ system_ss.add(when: 'CONFIG_PL310', if_true: files('arm_l2x0.c')) system_ss.add(when: 'CONFIG_INTEGRATOR_DEBUG', if_true: files('arm_integrator_debug.c')) system_ss.add(when: 'CONFIG_A9SCU', if_true: files('a9scu.c')) system_ss.add(when: 'CONFIG_ARM11SCU', if_true: files('arm11scu.c')) +system_ss.add(when: 'CONFIG_BECKHOFF_CCAT', if_true: files('beckhoff_ccat.c')) system_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m_ras.c'))
Signature · 1 line
2.47.3
Re: [PATCH v7 08/16] hw/misc: Add Beckhoff CCAT device
Quoted 90 lines · Corvin Köhne
From: YannickV <[email protected]>
This adds the Beckhoff Communication Controller (CCAT). The information block, EEPROM interface and DMA controller are currently implemented.
The EEPROM provides production information for Beckhoff Devices. An EEPORM binary must therefor be handed over. It should be aligned to a power of two. If no EEPROM binary is handed over an empty EEPROM of size 4096 is initialized.
This device is needed for the Beckhoff CX7200 board emulation.
Signed-off-by YannickV <[email protected]>--- hw/misc/Kconfig | 3 + hw/misc/beckhoff_ccat.c | 339 ++++++++++++++++++++++++++++++++++++++++ hw/misc/meson.build | 1 + 3 files changed, 343 insertions(+) create mode 100644 hw/misc/beckhoff_ccat.chw/misc/Kconfig +3
-0@@ -257,4 +257,7 @@ config XLNX_VERSAL_TRNG config XLNX_ZYNQ_DDRC bool +config BECKHOFF_CCAT + bool + source macio/Kconfighw/misc/beckhoff_ccat.c new file +51
-0@@ -0,0 +1,339 @@ +/* +* Beckhoff Communication Controller Emulation +* +* Copyright (c) Beckhoff Automation GmbH. & Co. KG +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#include "qemu/osdep.h" +#include "hw/core/sysbus.h" +#include "qemu/units.h" +#include "hw/core/register.h" +#include "qemu/bitops.h" +#include "qemu/log.h" +#include "qapi/error.h" +#include "system/block-backend.h" +#include "system/address-spaces.h" +#include "system/memory.h" +#include "system/dma.h" +#include "qemu/error-report.h" +#include "block/block.h" +#include "block/block_int.h" +#include "block/qdict.h" +#include "hw/block/block.h" +#include "migration/vmstate.h" +#include "qemu/bswap.h" + +#ifndef CCAT_ERR_DEBUG +#define CCAT_ERR_DEBUG 0 +#endif + +#define TYPE_BECKHOFF_CCAT "beckhoff-ccat" +OBJECT_DECLARE_SIMPLE_TYPE(BeckhoffCcat, BECKHOFF_CCAT) + +#define MAX_NUM_SLOTS 32 +#define CCAT_FUNCTION_BLOCK_SIZE 16 + +#define CCAT_EEPROM_OFFSET 0x100 +#define CCAT_DMA_OFFSET 0x8000 + +#define CCAT_MEM_SIZE (64 * KiB) +#define CCAT_DMA_SIZE 0x800 +#define CCAT_EEPROM_SIZE 0x20 + +#define EEPROM_MEMORY_SIZE 0x1000 + +#define EEPROM_CMD_OFFSET (CCAT_EEPROM_OFFSET + 0x00) +#define EEPROM_CMD_WRITE_MASK 0x2 +#define EEPROM_CMD_READ_MASK 0x1 +#define EEPROM_ADR_OFFSET (CCAT_EEPROM_OFFSET + 0x04) +#define EEPROM_DATA_OFFSET (CCAT_EEPROM_OFFSET + 0x08)
hw/misc/beckhoff_ccat.c line 61
Quoted 10 lines
hw/misc/beckhoff_ccat.c new file +10
-0+ +#define DMA_BUFFER_OFFSET (CCAT_DMA_OFFSET + 0x00) +#define DMA_DIRECTION_OFFSET (CCAT_DMA_OFFSET + 0x7c0) +#define DMA_DIRECTION_MASK 1 +#define DMA_TRANSFER_OFFSET (CCAT_DMA_OFFSET + 0x7c4) +#define DMA_HOST_ADR_OFFSET (CCAT_DMA_OFFSET + 0x7c8) +#define DMA_TRANSFER_LENGTH_OFFSET (CCAT_DMA_OFFSET + 0x7cc) + +/* +* The informationblock is always located at address 0x0.
"information block is"
hw/misc/beckhoff_ccat.c line 62
Quoted 1 line
hw/misc/beckhoff_ccat.c new file +1
-0+* Address and size are therefor replaced by two identifiers.
"therefore"
hw/misc/beckhoff_ccat.c line 63
Quoted 1 line
hw/misc/beckhoff_ccat.c new file +1
-0+* The Parameter give information about the maximal number of
"parameters give"
Quoted 51 lines
hw/misc/beckhoff_ccat.c new file +51
-0+* function slots and the creation date (in this case 01.01.2001) +*/ +#define CCAT_ID_1 0x88a4 +#define CCAT_ID_2 0x54414343 +#define CCAT_INFO_BLOCK_PARAMS ((MAX_NUM_SLOTS << 0) | (0x1 << 8) | \ + (0x1 << 16) | (0x1 << 24)) + +#define CCAT_FUN_TYPE_ENTRY 0x0001 +#define CCAT_FUN_TYPE_EEPROM 0x0012 +#define CCAT_FUN_TYPE_DMA 0x0013 + +typedef struct BeckhoffCcat { +SysBusDevice parent_obj; + +MemoryRegion iomem; + +uint8_t mem[CCAT_MEM_SIZE ]; + +BlockBackend *eeprom_blk; +uint8_t *eeprom_storage; +uint32_t eeprom_size; +}BeckhoffCcat ; + +static void sync_eeprom (BeckhoffCcat *s) +{ +if (!s->eeprom_blk) { +return ; + } +blk_pwrite (s->eeprom_blk,0 , s->eeprom_size, s->eeprom_storage,0 ); +} + +static uint64_t beckhoff_ccat_eeprom_read (void *opaque,hwaddr addr, +unsigned size) +{ +BeckhoffCcat *s = opaque; +return ldn_le_p (&s->mem[addr], size); +} + +static void beckhoff_ccat_eeprom_write (void *opaque,hwaddr addr,uint64_t val, +unsigned size) +{ +BeckhoffCcat *s = opaque; +uint64_t eeprom_adr; +uint64_t buf; +uint32_t bytes_to_read; + +switch (addr) { +case EEPROM_CMD_OFFSET : + eeprom_adr =ldl_le_p (&s->mem[EEPROM_ADR_OFFSET ]); + eeprom_adr = (eeprom_adr *2 ) % s->eeprom_size; +if (val &EEPROM_CMD_READ_MASK ) {
hw/misc/beckhoff_ccat.c line 124
Quoted 10 lines
hw/misc/beckhoff_ccat.c new file +10
-0+ buf =0 ; + bytes_to_read =8 ; +if (eeprom_adr > s->eeprom_size -8 ) { + bytes_to_read = s->eeprom_size - eeprom_adr; + } + buf =ldn_le_p (s->eeprom_storage + eeprom_adr, bytes_to_read); +stq_le_p (&s->mem[EEPROM_DATA_OFFSET ], buf); + }else if (val &EEPROM_CMD_WRITE_MASK ) { + buf =ldl_le_p (&s->mem[EEPROM_DATA_OFFSET ]); +stw_le_p ((uint16_t *)(s->eeprom_storage + eeprom_adr), buf);
stw_le_p() takes a void* for the address, so you don't need the cast here.
Quoted 6 lines
hw/misc/beckhoff_ccat.c new file +6
-0+sync_eeprom (s); + } +break ; +default : +stn_le_p (&s->mem[addr], size, val); + }
hw/misc/beckhoff_ccat.c line 140
Quoted 10 lines
hw/misc/beckhoff_ccat.c new file +10
-0+} + +static uint64_t beckhoff_ccat_dma_read (void *opaque,hwaddr addr,unsigned size) +{ +BeckhoffCcat *s = opaque; + +switch (addr) { +case DMA_TRANSFER_OFFSET : +if (s->mem[DMA_TRANSFER_OFFSET ] &0x1 ) { + s->mem[DMA_TRANSFER_OFFSET ] =0 ;
I'm guessing this is some kind of "read-to-clear" behaviour, but it would be helpful to have a comment, especially as there is no datasheet that readers can refer to.
hw/misc/beckhoff_ccat.c line 151
Quoted 11 lines
hw/misc/beckhoff_ccat.c new file +11
-0+ } +break ; + } +return ldn_le_p (&s->mem[addr], size); +} + +static void beckhoff_ccat_dma_write (void *opaque,hwaddr addr,uint64_t val, +unsigned size) +{ +BeckhoffCcat *s = opaque; +dma_addr_t dmaAddr;
QEMU convention for variable names is lowercase, not camelCase.
hw/misc/beckhoff_ccat.c line 324
Quoted 11 lines
hw/misc/beckhoff_ccat.c new file +10
-0+uint8_t len; +uint8_t *mem_buf; +static void beckhoff_ccat_class_init (ObjectClass *klass,const void *data) +{ +DeviceClass *dc =DEVICE_CLASS (klass); + dc->realize = beckhoff_ccat_realize; +device_class_set_legacy_reset (dc, beckhoff_ccat_reset); + dc->vmsd = &vmstate_beckhoff_ccat; +device_class_set_props (dc, beckhoff_ccat_properties); +}
It would be preferable I think to use the newer reset API rather than device_class_set_legacy_reset(), since this is new code. Setting rc->phases.hold is the equivalent in the new API to the old legacy reset.
thanks
-- PMM
PATCH v7 9/16 hw/block/m25p80: Add HAS_SR_TB flag for is25lp016d
In reply to Corvin KöhneFrom: YannickV <[email protected]>
The is25lp016d has 4 Block Write Protect Bits. BP3 specifies whether the upper or lower range should be protected. Therefore, we add the HAS_SR_TB flag to the is25lp016d flags.
--- hw/block/m25p80.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/block/m25p80.c +2 -1
@@ -217,7 +217,8 @@ static const FlashPartInfo known_devices[] = {/* ISSI */ { INFO("is25lq040b", 0x9d4013, 0, 64 << 10, 8, ER_4K) }, { INFO("is25lp080d", 0x9d6014, 0, 64 << 10, 16, ER_4K) }, - { INFO("is25lp016d", 0x9d6015, 0, 64 << 10, 32, ER_4K) }, + { INFO("is25lp016d", 0x9d6015, 0, 64 << 10, 32, + ER_4K | HAS_SR_TB) }, { INFO("is25lp032", 0x9d6016, 0, 64 << 10, 64, ER_4K) }, { INFO("is25lp064", 0x9d6017, 0, 64 << 10, 128, ER_4K) }, { INFO("is25lp128", 0x9d6018, 0, 64 << 10, 256, ER_4K) },
Signature · 1 line
2.47.3
PATCH v7 10/16 hw/arm/xilinx_zynq: Split xilinx_zynq into header and implementation files
In reply to Corvin KöhneFrom: YannickV <[email protected]>
Create xilinx_zynq.h header file to expose ZynqMachineState and related definitions for machine inheritance. This enables creation of derived machines based on the Zynq platform.
--- hw/arm/xilinx_zynq.c | 13 +------------ include/hw/arm/xilinx_zynq.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 12 deletions(-) create mode 100644 include/hw/arm/xilinx_zynq.h
hw/arm/xilinx_zynq.c +1 -12
@@ -41,9 +41,7 @@#include "exec/tswap.h" #include "target/arm/cpu-qom.h" #include "qapi/visitor.h" - -#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") -OBJECT_DECLARE_SIMPLE_TYPE (ZynqMachineState,ZYNQ_MACHINE ) +#include "hw/arm/xilinx_zynq.h" /* board base frequency: 33.333333 MHz */ #define PS_CLK_FREQUENCY (100 * 1000 * 1000 / 3)
@@ -87,15 +85,6 @@ static const int dma_irqs[8] = {0xe3401000 +ARMV7_IMM16 (extract32 ((val),16 ,16 )),/* movt r1 ... */ \0xe5801000 + (addr ) -#define ZYNQ_MAX_CPUS 2 - -struct ZynqMachineState { -MachineState parent; -Clock *ps_clk; -ARMCPU *cpu[ZYNQ_MAX_CPUS ]; -uint8_t boot_mode; -}; - static void zynq_write_board_setup(ARMCPU *cpu,const struct arm_boot_info *info) {
include/hw/arm/xilinx_zynq.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* Xilinx Zynq Baseboard System emulation. +* +* Copyright (c) 2010 Xilinx. +* Copyright (c) 2012 Peter A.G. Crosthwaite ([email protected]) +* Copyright (c) 2012 Petalogix Pty Ltd. +* Written by Haibing Ma +* +* SPDX-License-Identifier: GPL-2.0-or-later +*/ + +#ifndef QEMU_ARM_ZYNQ_H +#define QEMU_ARM_ZYNQ_H + +#include "target/arm/cpu-qom.h" +#include "hw/core/qdev-clock.h" + +#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") +OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE) + +#define ZYNQ_MAX_CPUS 2 + +struct ZynqMachineState { +MachineState parent; +Clock *ps_clk; +ARMCPU *cpu[ZYNQ_MAX_CPUS ]; +uint8_t boot_mode; +}; + +#endif /* QEMU_ARM_ZYNQ_H */
Signature · 1 line
2.47.3
PATCH v7 11/16 hw/arm/xilinx_zynq: Add flash type as machine class property
In reply to Corvin KöhneFrom: YannickV <[email protected]>
Introduce ZynqMachineClass with qspi_flash_type field to allow different Zynq-based machines to specify their flash device type. The base Zynq machine defaults to n25q128.
--- hw/arm/xilinx_zynq.c | 21 ++++++++++++++++----- include/hw/arm/xilinx_zynq.h | 8 +++++++- 2 files changed, 23 insertions(+), 6 deletions(-)
hw/arm/xilinx_zynq.c +16 -5
@@ -120,7 +120,8 @@ static void gem_init(uint32_t base, qemu_irq irq) }static inline int zynq_init_spi_flashes (uint32_t base_addr,qemu_irq irq, -bool is_qspi,int unit0) +bool is_qspi,int unit0, +const char *flash_type) {int unit = unit0;DeviceState *dev;
@@ -152,7 +153,11 @@ static inline int zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq,for (j =0 ; j < num_ss; ++j) {DriveInfo *dinfo =drive_get (IF_MTD ,0 , unit++); - flash_dev =qdev_new ("n25q128" ); + +if (!flash_type || !flash_type[0 ]) { + flash_type ="n25q128" ; + } + flash_dev =qdev_new (flash_type);if (dinfo) { qdev_prop_set_drive_err(flash_dev, "drive", blk_by_legacy_dinfo(dinfo),
@@ -204,6 +209,7 @@ static void ddr_ctrl_init(uint32_t base)static void zynq_init (MachineState *machine) {ZynqMachineState *zynq_machine =ZYNQ_MACHINE (machine); +ZynqMachineClass *zmc =ZYNQ_MACHINE_GET_CLASS (machine);MemoryRegion *address_space_mem =get_system_memory ();MemoryRegion *ocm_ram =g_new (MemoryRegion,1 );DeviceState *dev, *slcr;
@@ -283,9 +289,12 @@ static void zynq_init(MachineState *machine) pic[n] =qdev_get_gpio_in (dev, n); } - n =zynq_init_spi_flashes (0xE0006000 , pic[58 -GIC_INTERNAL ], false,0 ); - n =zynq_init_spi_flashes (0xE0007000 , pic[81 -GIC_INTERNAL ], false, n); - n =zynq_init_spi_flashes (0xE000D000 , pic[51 -GIC_INTERNAL ], true, n); + n =zynq_init_spi_flashes (0xE0006000 , pic[58 -GIC_INTERNAL ], false,0 , + zmc->qspi_flash_type); + n =zynq_init_spi_flashes (0xE0007000 , pic[81 -GIC_INTERNAL ], false, n, + zmc->qspi_flash_type); + n =zynq_init_spi_flashes (0xE000D000 , pic[51 -GIC_INTERNAL ], true, n, + zmc->qspi_flash_type);sysbus_create_simple (TYPE_CHIPIDEA ,0xE0002000 , pic[53 -GIC_INTERNAL ]);sysbus_create_simple (TYPE_CHIPIDEA ,0xE0003000 , pic[76 -GIC_INTERNAL ]);
@@ -460,6 +469,7 @@ static void zynq_machine_class_init(ObjectClass *oc, const void *data) NULL };MachineClass *mc =MACHINE_CLASS (oc); +ZynqMachineClass *zmc =ZYNQ_MACHINE_CLASS (oc);ObjectProperty *prop; mc->desc ="Xilinx Zynq 7000 Platform Baseboard for Cortex-A9" ; mc->init = zynq_init;
@@ -473,6 +483,7 @@ static void zynq_machine_class_init(ObjectClass *oc, const void *data)"Supported boot modes:" " jtag qspi sd nor");object_property_set_default_str (prop,"qspi" ); + zmc->qspi_flash_type ="n25q128" ; }static const TypeInfo zynq_machine_type = {
include/hw/arm/xilinx_zynq.h +7 -1
@@ -12,11 +12,12 @@#ifndef QEMU_ARM_ZYNQ_H #define QEMU_ARM_ZYNQ_H +#include "hw/core/boards.h" #include "target/arm/cpu-qom.h" #include "hw/core/qdev-clock.h" #define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9") -OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE) +OBJECT_DECLARE_TYPE(ZynqMachineState, ZynqMachineClass, ZYNQ_MACHINE)#define ZYNQ_MAX_CPUS 2
@@ -27,4 +28,9 @@ struct ZynqMachineState { uint8_t boot_mode; }; +struct ZynqMachineClass { +MachineClass parent_class; +const char *qspi_flash_type; +}; +#endif /* QEMU_ARM_ZYNQ_H */
Signature · 1 line
2.47.3
Re: [PATCH v7 11/16] hw/arm/xilinx_zynq: Add flash type as machine class property
Quoted 10 lines · Corvin Köhne
From: YannickV <[email protected]>
Introduce ZynqMachineClass with
qspi_flash_typefield to allow different Zynq-based machines to specify their flash device type. The base Zynq machine defaults to n25q128.Signed-off-by YannickV <[email protected]>
hw/arm/xilinx_zynq.c static inline int zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq, · line 159
Quoted 8 lines
hw/arm/xilinx_zynq.c +4
-1@@ -152,7 +153,11 @@ static inline int zynq_init_spi_flashes(uint32_t base_addr, qemu_irq irq,for (j =0 ; j < num_ss; ++j) {DriveInfo *dinfo =drive_get (IF_MTD ,0 , unit++); - flash_dev =qdev_new ("n25q128" ); + +if (!flash_type || !flash_type[0 ]) { + flash_type ="n25q128" ; + }
This seems a bit unnecessary -- we always pass in zmc->qspi_flash_type at all the callsites, and that should never be NULL or an empty string, because we've already done the "what should the default type be?" handling in zynq_machine_class_init().
If we do get NULL or an empty string here, that's a QEMU bug in either this class or its subclasses, which will be fairly quickly detected when we pass the bogus value to qdev_new(). I would just drop this if().
include/hw/arm/xilinx_zynq.h struct ZynqMachineState { · line 34
Quoted 4 lines
include/hw/arm/xilinx_zynq.h +4
-0+struct ZynqMachineClass { +MachineClass parent_class; +const char *qspi_flash_type; +};
Because we've now given this class its own class struct, we need to add to the zynq_machine_type TypeInfo:
.class_size = sizeof(ZynqMachineClass),
Otherwise the QOM machinery won't allocate enough space for it.
thanks
-- PMM
PATCH v7 12/16 hw/misc/zynq_slcr: Add CPU clock outputs and ratios
In reply to Corvin KöhneFrom: YannickV <[email protected]>
Add CPU clock outs und derive the related domains from the base CPU clock ration. This makes the CPU clock domains visible and keeps their ratios consistent with the hardware clock tree.
We also need to set the reset values during realization to ensure CPU clocks are properly enabled at startup. Without this, CPU clocks would have a frequency of 0 Hz, which causes problems in the a9mpcore timer implementations.
--- hw/misc/zynq_slcr.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
hw/misc/zynq_slcr.c +40 -0
@@ -61,6 +61,13 @@ REG32(DDR_PLL_CFG, 0x114) REG32(IO_PLL_CFG, 0x118) REG32(ARM_CLK_CTRL, 0x120) +FIELD (ARM_CLK_CTRL ,CPU_PERI_CLKACT ,28 ,1 ); +FIELD (ARM_CLK_CTRL ,CPU_1XCLKACT ,27 ,1 ); +FIELD (ARM_CLK_CTRL ,CPU_2XCLKACT ,26 ,1 ); +FIELD (ARM_CLK_CTRL ,CPU_3OR2XCLKACT ,25 ,1 ); +FIELD (ARM_CLK_CTRL ,CPU_6OR4XCLKACT ,24 ,1 ); +FIELD (ARM_CLK_CTRL ,DIVISOR ,8 ,6 ); +FIELD (ARM_CLK_CTRL ,SRCSEL ,4 ,2 ); REG32(DDR_CLK_CTRL, 0x124) REG32(DCI_CLK_CTRL, 0x128)REG32 (APER_CLK_CTRL ,0x12c )
@@ -98,6 +105,7 @@ FPGA_CTRL_REGS(3, 0x1a0) REG32(BANDGAP_TRIP, 0x1b8) REG32(PLL_PREDIVISOR, 0x1c0) REG32(CLK_621_TRUE, 0x1c4) + FIELD(CLK_621_TRUE, CLK_621_TRUE, 0, 1) REG32(PSS_RST_CTRL, 0x200)FIELD (PSS_RST_CTRL ,SOFT_RST ,0 ,1 )
@@ -206,6 +214,10 @@ struct ZynqSLCRState {Clock *ps_clk;Clock *uart0_ref_clk;Clock *uart1_ref_clk; +Clock *cpu_1x; +Clock *cpu_2x; +Clock *cpu_3x2x; +Clock *cpu_6x4x;uint8_t boot_mode; };
@@ -286,14 +298,31 @@ static void zynq_slcr_compute_clocks_internal(ZynqSLCRState *s, uint64_t ps_clk)uint64_t io_pll =zynq_slcr_compute_pll (ps_clk, s->regs[R_IO_PLL_CTRL ]);uint64_t arm_pll =zynq_slcr_compute_pll (ps_clk, s->regs[R_ARM_PLL_CTRL ]);uint64_t ddr_pll =zynq_slcr_compute_pll (ps_clk, s->regs[R_DDR_PLL_CTRL ]); +uint64_t cpu_base;uint64_t uart_mux[4 ] = {io_pll, io_pll, arm_pll, ddr_pll}; +uint64_t cpu_mux[4 ] = {arm_pll, arm_pll, ddr_pll, io_pll}; + +bool use_621 =FIELD_EX32 (s->regs[R_CLK_621_TRUE ],CLK_621_TRUE , +CLK_621_TRUE ); +/* Select 6:2:1 (true) or 4:2:1 (false) CPU clock ratios. */ +uint32_t ratio_6x4x = use_621 ?6 :4 ; +uint32_t ratio_3x2x = use_621 ?3 :2 ; +/* compute uartX reference clocks */ clock_set (s->uart0_ref_clk,ZYNQ_COMPUTE_CLK (s, uart_mux,R_UART_CLK_CTRL ,CLKACT0 ));clock_set (s->uart1_ref_clk,ZYNQ_COMPUTE_CLK (s, uart_mux,R_UART_CLK_CTRL ,CLKACT1 )); + +/* Base is CPU clock (6x/4x domain). Derive other CPU domains via ratios. */ + cpu_base =ZYNQ_COMPUTE_CLK (s, cpu_mux,R_ARM_CLK_CTRL ,CPU_6OR4XCLKACT ); + +clock_set (s->cpu_6x4x, cpu_base); +clock_set (s->cpu_3x2x, cpu_base * ratio_6x4x / ratio_3x2x); +clock_set (s->cpu_2x, cpu_base * ratio_6x4x /2 ); +clock_set (s->cpu_1x, cpu_base * ratio_6x4x); }/**
@@ -322,6 +351,10 @@ static void zynq_slcr_propagate_clocks(ZynqSLCRState *s) {clock_propagate (s->uart0_ref_clk);clock_propagate (s->uart1_ref_clk); +clock_propagate (s->cpu_1x); +clock_propagate (s->cpu_2x); +clock_propagate (s->cpu_3x2x); +clock_propagate (s->cpu_6x4x); }static void zynq_slcr_ps_clk_callback (void *opaque,ClockEvent event)
@@ -620,6 +653,10 @@ static const ClockPortInitArray zynq_slcr_clocks = {QDEV_CLOCK_IN (ZynqSLCRState, ps_clk, zynq_slcr_ps_clk_callback, ClockUpdate),QDEV_CLOCK_OUT (ZynqSLCRState, uart0_ref_clk),QDEV_CLOCK_OUT (ZynqSLCRState, uart1_ref_clk), +QDEV_CLOCK_OUT (ZynqSLCRState, cpu_1x), +QDEV_CLOCK_OUT (ZynqSLCRState, cpu_2x), +QDEV_CLOCK_OUT (ZynqSLCRState, cpu_3x2x), +QDEV_CLOCK_OUT (ZynqSLCRState, cpu_6x4x), QDEV_CLOCK_END };
@@ -630,6 +667,9 @@ static void zynq_slcr_realize(DeviceState *dev, Error **errp)if (s->boot_mode >0xF ) {error_setg (errp,"Invalid boot mode %d specified" , s->boot_mode); } + +zynq_slcr_reset_init (OBJECT (s),0 ); +zynq_slcr_compute_clocks_internal (s,clock_get (s->ps_clk)); }static void zynq_slcr_init (Object *obj)
Signature · 1 line
2.47.3
Re: [PATCH v7 12/16] hw/misc/zynq_slcr: Add CPU clock outputs and ratios
Quoted 15 lines · Corvin Köhne
From: YannickV <[email protected]>
Add CPU clock outs und derive the related domains from the base CPU clock ration. This makes the CPU clock domains visible and keeps their ratios consistent with the hardware clock tree.
We also need to set the reset values during realization to ensure CPU clocks are properly enabled at startup. Without this, CPU clocks would have a frequency of 0 Hz, which causes problems in the a9mpcore timer implementations.
hw/misc/zynq_slcr.c static void zynq_slcr_realize(DeviceState *dev, Error **errp) · line 673
Quoted 7 lines
hw/misc/zynq_slcr.c +3
-0@@ -630,6 +667,9 @@ static void zynq_slcr_realize(DeviceState *dev, Error **errp)if (s->boot_mode >0xF ) {error_setg (errp,"Invalid boot mode %d specified" , s->boot_mode); } + +zynq_slcr_reset_init (OBJECT (s),0 ); +zynq_slcr_compute_clocks_internal (s,clock_get (s->ps_clk)); }
This doesn't seem right -- devices should not reset themselves in their realize methods. What exactly goes wrong without this? This device's reset method's exit phase handler computes the clock state and propagates it, so devices consuming the clocks should get the approrpriate information ath that point.
thanks
-- PMM
PATCH v7 13/16 hw/timer, cpu: Add Clock API support to A9MPCore timers
In reply to Corvin KöhneFrom: YannickV <[email protected]>
Add a clock input to a9gtimer, arm_mptimer and a9mpcore. a9mpcore distributes the clock to the other timers. If no clock is connected, falls back to 100 MHz for backward compatibility with existing machine types.
Frequency calculation now uses the input clock and prescaler values according to ARM Cortex-A9 MPCore Technical Reference Manual.
More information about the A9MPCore timers can be found here:
https://developer.arm.com/documentation/ddi0407/c/timers-and-watchdog-registers?lang=en
--- hw/arm/xilinx_zynq.c | 1 + hw/cpu/a9mpcore.c | 12 ++++++++++++ hw/timer/a9gtimer.c | 18 +++++++++++++++--- hw/timer/arm_mptimer.c | 20 +++++++++++++++----- include/hw/cpu/a9mpcore.h | 1 + include/hw/timer/a9gtimer.h | 1 + include/hw/timer/arm_mptimer.h | 2 ++ 7 files changed, 47 insertions(+), 8 deletions(-)
hw/arm/xilinx_zynq.c +1 -0
@@ -271,6 +271,7 @@ static void zynq_init(MachineState *machine) dev =qdev_new (TYPE_A9MPCORE_PRIV );qdev_prop_set_uint32 (dev,"num-cpu" , smp_cpus);qdev_prop_set_uint32 (dev,"num-irq" ,GIC_EXT_IRQS +GIC_INTERNAL ); +qdev_connect_clock_in (dev,"clk" ,qdev_get_clock_out (slcr,"cpu_3x2x" )); busdev =SYS_BUS_DEVICE (dev);sysbus_realize_and_unref (busdev, &error_fatal);sysbus_mmio_map (busdev,0 ,MPCORE_PERIPHBASE );
hw/cpu/a9mpcore.c +12 -0
@@ -14,6 +14,8 @@#include "hw/cpu/a9mpcore.h" #include "hw/core/irq.h" #include "hw/core/qdev-properties.h" +#include "hw/core/qdev-clock.h" +#include "hw/core/clock.h" #include "hw/core/cpu.h" #include "target/arm/cpu-qom.h"
@@ -42,6 +44,13 @@ static void a9mp_priv_initfn(Object *obj)object_initialize_child (obj,"mptimer" , &s->mptimer,TYPE_ARM_MPTIMER );object_initialize_child (obj,"wdt" , &s->wdt,TYPE_ARM_MPTIMER ); + +/* +* Register a clock input. If no clock is connected the +* frequency falls back to 100 MHz for backward compatibility. +*/ + s->clk =qdev_init_clock_in (DEVICE (obj),"clk" ,NULL ,NULL ,0 ); +clock_set_ns (s->clk,10 ); }static void a9mp_priv_realize (DeviceState *dev,Error **errp)
@@ -103,6 +112,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) gtimerdev =DEVICE (&s->gtimer);qdev_prop_set_uint32 (gtimerdev,"num-cpu" , s->num_cpu); +qdev_connect_clock_in (gtimerdev,"clk" , s->clk);if (!sysbus_realize (SYS_BUS_DEVICE (&s->gtimer), errp)) {return ; }
@@ -110,6 +120,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) mptimerdev =DEVICE (&s->mptimer);qdev_prop_set_uint32 (mptimerdev,"num-cpu" , s->num_cpu); +qdev_connect_clock_in (mptimerdev,"clk" , s->clk);if (!sysbus_realize (SYS_BUS_DEVICE (&s->mptimer), errp)) {return ; }
@@ -117,6 +128,7 @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp) wdtdev =DEVICE (&s->wdt);qdev_prop_set_uint32 (wdtdev,"num-cpu" , s->num_cpu); +qdev_connect_clock_in (wdtdev,"clk" , s->clk);if (!sysbus_realize (SYS_BUS_DEVICE (&s->wdt), errp)) {return ; }
hw/timer/a9gtimer.c +15 -3
@@ -24,6 +24,9 @@#include "hw/core/hw-error.h" #include "hw/core/irq.h" #include "hw/core/qdev-properties.h" +#include "hw/core/qdev-properties-system.h" +#include "hw/core/qdev-clock.h" +#include "hw/core/clock.h" #include "hw/timer/a9gtimer.h" #include "migration/vmstate.h" #include "qapi/error.h"
@@ -63,9 +66,10 @@ static inline int a9_gtimer_get_current_cpu(A9GTimerState *s)static inline uint64_t a9_gtimer_get_conv (A9GTimerState *s) {uint64_t prescale =extract32 (s->control,R_CONTROL_PRESCALER_SHIFT , -R_CONTROL_PRESCALER_LEN ); - -return (prescale +1 ) *10 ; +R_CONTROL_PRESCALER_LEN ) +1 ; +uint64_t clk_hz =clock_get_hz (s->clk); +assert (clk_hz !=0 ); +return muldiv64 (prescale,NANOSECONDS_PER_SECOND , clk_hz); }static A9GTimerUpdate a9_gtimer_get_update (A9GTimerState *s)
@@ -295,6 +299,13 @@ static void a9_gtimer_reset(DeviceState *dev)a9_gtimer_update (s, false); } +static void a9_gtimer_init (Object *obj) +{ +A9GTimerState *s =A9_GTIMER (obj); + + s->clk =qdev_init_clock_in (DEVICE (obj),"clk" ,NULL ,NULL ,0 ); +} +static void a9_gtimer_realize (DeviceState *dev,Error **errp) {A9GTimerState *s =A9_GTIMER (dev);
@@ -391,6 +402,7 @@ static const TypeInfo a9_gtimer_info = { .name = TYPE_A9_GTIMER, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(A9GTimerState), + .instance_init = a9_gtimer_init, .class_init = a9_gtimer_class_init, };
hw/timer/arm_mptimer.c +15 -5
@@ -24,9 +24,13 @@#include "hw/core/irq.h" #include "hw/core/ptimer.h" #include "hw/core/qdev-properties.h" +#include "hw/core/qdev-properties-system.h" +#include "hw/core/qdev-clock.h" +#include "hw/core/clock.h" #include "hw/timer/arm_mptimer.h" #include "migration/vmstate.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/module.h" #include "hw/core/cpu.h"
@@ -58,10 +62,12 @@ static inline void timerblock_update_irq(TimerBlock *tb)qemu_set_irq (tb->irq, tb->status && (tb->control &4 )); } -/* Return conversion factor from mpcore timer ticks to qemu timer ticks. */ -static inline uint32_t timerblock_scale (uint32_t control) +static inline uint32_t timerblock_scale (TimerBlock *tb,uint32_t control) { -return (((control >>8 ) &0xff ) +1 ) *10 ; +uint64_t prescale = (((control >>8 ) &0xff ) +1 ); +uint64_t clk_hz =clock_get_hz (tb->clk); +assert (clk_hz !=0 ); +return muldiv64 (prescale,NANOSECONDS_PER_SECOND , clk_hz); }/* Must be called within a ptimer transaction block */
@@ -155,7 +161,7 @@ static void timerblock_write(void *opaque, hwaddr addr,ptimer_stop (tb->timer); }if ((control &0xff00 ) != (value &0xff00 )) { -ptimer_set_period (tb->timer,timerblock_scale (value)); +ptimer_set_period (tb->timer,timerblock_scale (tb, value)); }if (value &1 ) {uint64_t count =ptimer_get_count (tb->timer);
@@ -222,7 +228,8 @@ static void timerblock_reset(TimerBlock *tb)ptimer_transaction_begin (tb->timer);ptimer_stop (tb->timer);ptimer_set_limit (tb->timer,0 ,1 ); -ptimer_set_period (tb->timer,timerblock_scale (0 )); +ptimer_set_period (tb->timer, +timerblock_scale (tb,0 ));ptimer_transaction_commit (tb->timer); } }
@@ -244,6 +251,8 @@ static void arm_mptimer_init(Object *obj)memory_region_init_io (&s->iomem, obj, &arm_thistimer_ops, s,"arm_mptimer_timer" ,0x20 );sysbus_init_mmio (SYS_BUS_DEVICE (obj), &s->iomem); + + s->clk =qdev_init_clock_in (DEVICE (obj),"clk" ,NULL ,NULL ,0 ); }static void arm_mptimer_realize (DeviceState *dev,Error **errp)
@@ -269,6 +278,7 @@ static void arm_mptimer_realize(DeviceState *dev, Error **errp)*/ for (i =0 ; i < s->num_cpu; i++) {TimerBlock *tb = &s->timerblock[i]; + tb->clk = s->clk; tb->timer =ptimer_init (timerblock_tick, tb,PTIMER_POLICY );sysbus_init_irq (sbd, &tb->irq); memory_region_init_io(&tb->iomem, OBJECT(s), &timerblock_ops, tb,
include/hw/cpu/a9mpcore.h +1 -0
@@ -34,6 +34,7 @@ struct A9MPPrivState {A9GTimerState gtimer;ARMMPTimerState mptimer;ARMMPTimerState wdt; + Clock *clk; };#endif
include/hw/timer/a9gtimer.h +1 -0
@@ -87,6 +87,7 @@ struct A9GTimerState {uint32_t control;/* only non per cpu banked bits valid */ A9GTimerPerCPU per_cpu[A9_GTIMER_MAX_CPUS ]; +Clock *clk; }; typedef struct A9GTimerUpdate {
include/hw/timer/arm_mptimer.h +2 -0
@@ -33,6 +33,7 @@ typedef struct {struct ptimer_state *timer;qemu_irq irq;MemoryRegion iomem; +Clock *clk; } TimerBlock;#define TYPE_ARM_MPTIMER "arm_mptimer"
@@ -44,6 +45,7 @@ struct ARMMPTimerState {/*< public >*/ uint32_t num_cpu; +Clock *clk;TimerBlock timerblock[ARM_MPTIMER_MAX_CPUS ];MemoryRegion iomem; };
Signature · 1 line
2.47.3
Re: [PATCH v7 13/16] hw/timer, cpu: Add Clock API support to A9MPCore timers
Quoted 16 lines · Corvin Köhne
From: YannickV <[email protected]>
Add a clock input to a9gtimer,
arm_mptimerand a9mpcore. a9mpcore distributes the clock to the other timers. If no clock is connected, falls back to 100 MHz for backward compatibility with existing machine types.Frequency calculation now uses the input clock and prescaler values according to ARM Cortex-A9 MPCore Technical Reference Manual.
More information about the A9MPCore timers can be found here:
https://developer.arm.com/documentation/ddi0407/c/timers-and-watchdog-registers?lang=enSigned-off-by YannickV <[email protected]>
hw/timer/arm_mptimer.c static inline void timerblock_update_irq(TimerBlock *tb) · line 71
Quoted 10 lines
hw/timer/arm_mptimer.c +5
-3-/* Return conversion factor from mpcore timer ticks to qemu timer ticks. */ -static inline uint32_t timerblock_scale (uint32_t control) +static inline uint32_t timerblock_scale (TimerBlock *tb,uint32_t control) { -return (((control >>8 ) &0xff ) +1 ) *10 ; +uint64_t prescale = (((control >>8 ) &0xff ) +1 ); +uint64_t clk_hz =clock_get_hz (tb->clk); +assert (clk_hz !=0 ); +return muldiv64 (prescale,NANOSECONDS_PER_SECOND , clk_hz); }
This causes "make check" to fail, because we hit the assertion in various of the qtests. Could you investigate, please, and make sure you have a clean pass of "make check" and "make check-functional"?
thanks
-- PMM
PATCH v7 14/16 hw/arm/xilinx_zynq: Make PS frequency configurable
In reply to Corvin KöhneFrom: YannickV <[email protected]>
Add ps_clk_freq to ZynqMachineClass so derived machine types can set their own PS clock frequency instead of using the hardcoded default.
--- hw/arm/xilinx_zynq.c | 3 ++- include/hw/arm/xilinx_zynq.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
hw/arm/xilinx_zynq.c +2 -1
@@ -259,7 +259,7 @@ static void zynq_init(MachineState *machine)object_property_add_child (OBJECT (zynq_machine),"ps_clk" ,OBJECT (zynq_machine->ps_clk));object_unref (OBJECT (zynq_machine->ps_clk)); -clock_set_hz (zynq_machine->ps_clk,PS_CLK_FREQUENCY ); +clock_set_hz (zynq_machine->ps_clk, zmc->ps_clk_freq);/* Create slcr, keep a pointer to connect clocks */ slcr =qdev_new ("xilinx-zynq_slcr" );
@@ -485,6 +485,7 @@ static void zynq_machine_class_init(ObjectClass *oc, const void *data) " jtag qspi sd nor");object_property_set_default_str (prop,"qspi" ); zmc->qspi_flash_type ="n25q128" ; + zmc->ps_clk_freq =PS_CLK_FREQUENCY ; }static const TypeInfo zynq_machine_type = {
include/hw/arm/xilinx_zynq.h +2 -0
@@ -24,6 +24,7 @@ OBJECT_DECLARE_TYPE(ZynqMachineState, ZynqMachineClass, ZYNQ_MACHINE)struct ZynqMachineState {MachineState parent;Clock *ps_clk; +Clock *mpcore_clk;ARMCPU *cpu[ZYNQ_MAX_CPUS ];uint8_t boot_mode; };
@@ -31,6 +32,7 @@ struct ZynqMachineState {struct ZynqMachineClass {MachineClass parent_class;const char *qspi_flash_type; +uint64_t ps_clk_freq; };#endif /* QEMU_ARM_ZYNQ_H */
Signature · 1 line
2.47.3
Re: [PATCH v7 14/16] hw/arm/xilinx_zynq: Make PS frequency configurable
Quoted 14 lines · Corvin Köhne
From: YannickV <[email protected]>
Add
ps_clk_freqto ZynqMachineClass so derived machine types can set their own PS clock frequency instead of using the hardcoded default.Signed-off-by YannickV <[email protected]>static const TypeInfo
zynq_machine_type= {include/hw/arm/xilinx_zynq.h +0
-0
include/hw/arm/xilinx_zynq.h OBJECT_DECLARE_TYPE(ZynqMachineState, ZynqMachineClass, ZYNQ_MACHINE) · line 30
Quoted 7 lines
include/hw/arm/xilinx_zynq.h +1
-0@@ -24,6 +24,7 @@ OBJECT_DECLARE_TYPE(ZynqMachineState, ZynqMachineClass, ZYNQ_MACHINE)struct ZynqMachineState {MachineState parent;Clock *ps_clk; +Clock *mpcore_clk;ARMCPU *cpu[ZYNQ_MAX_CPUS ];uint8_t boot_mode; };
This part looks like it should have been in some other patch.
thanks
-- PMM
PATCH v7 15/16 hw/arm: Add new machine based on xilinx-zynq-a9 for Beckhoff CX7200
In reply to Corvin KöhneFrom: 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.
--- 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
MAINTAINERS +9 -0
@@ -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]>
hw/arm/Kconfig +7 -0
@@ -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
hw/arm/beckhoff_CX7200.c new file +80 -0
80 lines not on this page · raw message
hw/arm/meson.build +1 -0
@@ -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'))
Signature · 1 line
2.47.3
Re: [PATCH v7 15/16] hw/arm: Add new machine based on xilinx-zynq-a9 for Beckhoff CX7200
Quoted 18 lines · Corvin Köhne
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]>hw/arm/beckhoff_CX7200.c new file +0
-0
hw/arm/beckhoff_CX7200.c line 1
Quoted 1 line
hw/arm/beckhoff_CX7200.c new file +1
-0@@ -0,0 +1,80 @@ +
Stray blank line at top of file.
hw/arm/beckhoff_CX7200.c line 8
Quoted 7 lines
hw/arm/beckhoff_CX7200.c new file +7
-0+/* +* 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 +*/
Otherwise
thanks
-- PMM
PATCH v7 16/16 docs/system/arm: Add support for Beckhoff CX7200
In reply to Corvin KöhneFrom: YannickV <[email protected]>
This commit offers some documentation on the Beckhoff CX7200 qemu emulation.
--- docs/system/arm/beckhoff-cx7200.rst | 62 +++++++++++++++++++++++++++++ docs/system/target-arm.rst | 1 + 2 files changed, 63 insertions(+) create mode 100644 docs/system/arm/beckhoff-cx7200.rst
docs/system/arm/beckhoff-cx7200.rst new file +62 -0
@@ -0,0 +1,62 @@ +Beckhoff CX7200 (``beckhoff-cx7200``) +====================================== +The Beckhoff CX7200 is based on the same architecture as the Xilinx Zynq A9. +The Zynq 7000 family is based on the AMD SoC architecture. These products +integrate a feature-rich dual or single-core Arm Cortex-A9 MPCore based +processing system (PS) and AMD programmable logic (PL) in a single device. +The Beckhoff Communication Controller (CCAT) can be found in the PL of Zynq. + +You can find more detail about this board on +`the manufacturer's product page <https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx7000-arm-r-cortex-r/cx7293.html?>`__. +The SoC is documented in the +`Zynq 7000 Technical Reference manual <https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM>`__. + +The CX7200 supports the following: + +- Arm Cortex-A9 MPCore CPU + + - Cortex-A9 CPUs + - GIC v1 interrupt controller + - Generic timer + - Watchdog timer + +- OCM 256KB +- SMC SRAM 64MB +- Zynq SLCR +- SPI x2 +- QSPI +- UART +- TTC x2 +- Gigabit Ethernet Controller x2 +- SD Controller x2 +- XADC +- Arm PrimeCell DMA Controller +- DDR Memory +- USB 2.0 x2 +- DDR Controller +- Beckhoff Communication Controller (CCAT) + + - EEPROM Interface + - DMA Controller + +The following is not supported: + - I2C + +Running +""""""" +Directly loading an ELF file to the CPU of the CX7200 to run f.e. TC/RTOS (based on FreeRTOS): + +.. code-block:: bash + + $ qemu-system-arm -M beckhoff-cx7200 \ + -device loader,file=CX7200_Zynq_Fsbl.elf \ + -display none + + +For setting the EEPROM content of the CCAT provide the following on the command line: + +.. code-block:: bash + + -drive file=eeprom.bin,format=raw,id=ccat-eeprom + +The size of eeprom.bin must be aligned to a power of 2 and bigger than 256 bytes.
docs/system/target-arm.rst +1 -0
@@ -82,6 +82,7 @@ Board-specific documentation arm/aspeed arm/bananapi_m2u.rst arm/b-l475e-iot01a.rst + arm/beckhoff-cx7200 arm/sabrelite arm/digic arm/cubieboard
Signature · 1 line
2.47.3
Re: [PATCH v7 16/16] docs/system/arm: Add support for Beckhoff CX7200
docs/system/arm/beckhoff-cx7200.rst
Quoted 20 lines · Corvin Köhne
From: YannickV <[email protected]>
This commit offers some documentation on the Beckhoff CX7200 qemu emulation.
Signed-off-by YannickV <[email protected]>Reviewed-by Alex Bennée <[email protected]>--- docs/system/arm/beckhoff-cx7200.rst | 62 +++++++++++++++++++++++++++++ docs/system/target-arm.rst | 1 + 2 files changed, 63 insertions(+) create mode 100644 docs/system/arm/beckhoff-cx7200.rstdocs/system/arm/beckhoff-cx7200.rst new file +0
-0@@ -0,0 +1,62 @@
Checkpatch will complain about the lack of an SPDX tag here. For documentation, the syntax to put this in a comment is to start the line with ".. ", like this:
.. SPDX-License-Identifier: GPL-2.0-or-later
docs/system/arm/beckhoff-cx7200.rst line 2
Quoted 2 lines
docs/system/arm/beckhoff-cx7200.rst new file +2
-0+Beckhoff CX7200 (``beckhoff-cx7200``) +======================================
One "=" too many. The title underlining needs to match the title string (some Sphinx versions will complain about this, but not all).
Quoted 28 lines
docs/system/arm/beckhoff-cx7200.rst new file +28
-0+The Beckhoff CX7200 is based on the same architecture as the Xilinx Zynq A9. +The Zynq 7000 family is based on the AMD SoC architecture. These products +integrate a feature-rich dual or single-core Arm Cortex-A9 MPCore based +processing system (PS) and AMD programmable logic (PL) in a single device. +The Beckhoff Communication Controller (CCAT) can be found in the PL of Zynq. + +You can find more detail about this board on +`the manufacturer's product page <https://www.beckhoff.com/en-en/products/ipc/embedded-pcs/cx7000-arm-r-cortex-r/cx7293.html?>`__. +The SoC is documented in the +`Zynq 7000 Technical Reference manual <https://docs.amd.com/r/en-US/ug585-zynq-7000-SoC-TRM>`__. + +The CX7200 supports the following: + +- Arm Cortex-A9 MPCore CPU + + - Cortex-A9 CPUs + - GIC v1 interrupt controller + - Generic timer + - Watchdog timer + +- OCM 256KB +- SMC SRAM 64MB +- Zynq SLCR +- SPI x2 +- QSPI +- UART +- TTC x2 +- Gigabit Ethernet Controller x2
docs/system/arm/beckhoff-cx7200.rst line 40
Quoted 10 lines
docs/system/arm/beckhoff-cx7200.rst new file +10
-0+- SD Controller x2 +- XADC +- Arm PrimeCell DMA Controller +- DDR Memory +- USB 2.0 x2 +- DDR Controller +- Beckhoff Communication Controller (CCAT) + + - EEPROM Interface + - DMA Controller
Just to check, are these indented because they're
sub-features of the CCAT ?
docs/system/arm/beckhoff-cx7200.rst line 43
Quoted 3 lines
docs/system/arm/beckhoff-cx7200.rst new file +3
-0+ +The following is not supported: + - I2C
You need to have this with the bullet point not indented, and with a newline in front of it:
The following is not supported:
- I2C
Otherwise it will be interpreted as an RST definition list, and rendered oddly.
docs/system/arm/beckhoff-cx7200.rst line 47
Quoted 1 line
docs/system/arm/beckhoff-cx7200.rst new file +1
-0+Directly loading an ELF file to the CPU of the CX7200 to run f.e. TC/RTOS (based on FreeRTOS):
I would drop "f.e." which is a slightly nonstandard abbreviation.
Also this line is a bit overlong -- generally worth breaking lines at about 70-75 chars.
Otherwise
thanks
-- PMM
Quoted 31 lines · Corvin Köhne
From: Corvin Köhne <[email protected]>
Hi,
Beckhoff has build a board, called CX7200, based on the Xilinx Zynq A9 platform. This commit series adds the Beckhoff CX7200 as new board variant to QEMU.
The emulation is able to successfully boot an CX7200 image. The image includes some self tests executed on every boot. Only the cache self test fails due to QEMU emulating the cache as always being coherent. The self tests include f.e.:
* Network
* Flash
* CCAT DMA + EEPROM [1]
* TwinCAT (Beckhoff's automation control software [2])[1] https://github.com/beckhoff/ccat
[2] https://www.beckhoff.com/en-us/products/automation/YannickV (16):
hw/dma/zynq-devcfg: Handle bitstream loading via DMA to0xffffffffhw/arm/zynq-devcfg: Prevent unintended unlock during initialization hw/dma/zynq: EnsurePCFG_DONEbit remains set to indicate PL is in
user mode
hw/dma/zynq-devcfg: Simulate dummy PL reset hw/dma/zynq-devcfg: Indicate power-up status of PL hw/misc: Add dummy ZYNQ DDR controller hw/misc/zynq_slcr: Add logic for DCI configuration
Quoted 3 lines
hw/block/m25p80: Add
HAS_SR_TBflag for is25lp016d hw/arm/xilinx_zynq: Splitxilinx_zynqinto header and implementation
files
I'm taking these patches into target-arm.next, since they've been reviewed and most of them are bugfixes to the existing zynq code. That should make this patchseries a bit smaller for the next round.
I've left code review comments on the others.
thanks
-- PMM