2a5ee4e18d
The MPS2 SCC device is broadly the same for all FPGA images, but has minor differences in the behaviour of the CFG registers depending on the image. In many cases we don't really care about the functionality controlled by these registers and a reads-as-written or similar behaviour is sufficient for the moment. For the AN536 the required behaviour is: * A_CFG0 has CPU reset and halt bits - implement as reads-as-written for the moment * A_CFG1 has flash or ATCM address 0 remap handling - QEMU doesn't model this; implement as reads-as-written * A_CFG2 has QSPI select (like AN524) - implemented (no behaviour, as with AN524) * A_CFG3 is MCC_MSB_ADDR "additional MCC addressing bits" - QEMU doesn't care about these, so use the existing RAZ behaviour for convenience * A_CFG4 is board rev (like all other images) - no change needed * A_CFG5 is ACLK frq in hz (like AN524) - implemented as reads-as-written, as for other boards * A_CFG6 is core 0 vector table base address - implemented as reads-as-written for the moment * A_CFG7 is core 1 vector table base address - implemented as reads-as-written for the moment Make the changes necessary for this; leave TODO comments where appropriate to indicate where we might want to come back and implement things like CPU reset. The other aspects of the device specific to this FPGA image (like the values of the board ID and similar registers) will be set via the device's qdev properties. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240206132931.38376-8-peter.maydell@linaro.org
71 lines
1.9 KiB
C
71 lines
1.9 KiB
C
/*
|
|
* ARM MPS2 SCC emulation
|
|
*
|
|
* Copyright (c) 2017 Linaro Limited
|
|
* Written by Peter Maydell
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
/*
|
|
* This is a model of the Serial Communication Controller (SCC)
|
|
* block found in most MPS FPGA images.
|
|
*
|
|
* QEMU interface:
|
|
* + sysbus MMIO region 0: the register bank
|
|
* + QOM property "scc-cfg4": value of the read-only CFG4 register
|
|
* + QOM property "scc-aid": value of the read-only SCC_AID register
|
|
* + QOM property "scc-id": value of the read-only SCC_ID register
|
|
* + QOM property "scc-cfg0": reset value of the CFG0 register
|
|
* + QOM property array "oscclk": reset values of the OSCCLK registers
|
|
* (which are accessed via the SYS_CFG channel provided by this device)
|
|
* + named GPIO output "remap": this tracks the value of CFG0 register
|
|
* bit 0. Boards where this bit controls memory remapping should
|
|
* connect this GPIO line to a function performing that mapping.
|
|
* Boards where bit 0 has no special function should leave the GPIO
|
|
* output disconnected.
|
|
*/
|
|
#ifndef MPS2_SCC_H
|
|
#define MPS2_SCC_H
|
|
|
|
#include "hw/sysbus.h"
|
|
#include "hw/misc/led.h"
|
|
#include "qom/object.h"
|
|
|
|
#define TYPE_MPS2_SCC "mps2-scc"
|
|
OBJECT_DECLARE_SIMPLE_TYPE(MPS2SCC, MPS2_SCC)
|
|
|
|
struct MPS2SCC {
|
|
/*< private >*/
|
|
SysBusDevice parent_obj;
|
|
|
|
/*< public >*/
|
|
MemoryRegion iomem;
|
|
LEDState *led[8];
|
|
|
|
uint32_t cfg0;
|
|
uint32_t cfg1;
|
|
uint32_t cfg2;
|
|
uint32_t cfg4;
|
|
uint32_t cfg5;
|
|
uint32_t cfg6;
|
|
uint32_t cfg7;
|
|
uint32_t cfgdata_rtn;
|
|
uint32_t cfgdata_out;
|
|
uint32_t cfgctrl;
|
|
uint32_t cfgstat;
|
|
uint32_t dll;
|
|
uint32_t aid;
|
|
uint32_t id;
|
|
uint32_t num_oscclk;
|
|
uint32_t *oscclk;
|
|
uint32_t *oscclk_reset;
|
|
uint32_t cfg0_reset;
|
|
|
|
qemu_irq remap;
|
|
};
|
|
|
|
#endif
|