blob: 3b2d13ac9c32f0888713a07df383b2b626b67493 [file] [log] [blame]
Peter Maydelldd731852017-07-17 13:36:08 +01001/*
2 * ARM MPS2 SCC emulation
3 *
4 * Copyright (c) 2017 Linaro Limited
5 * Written by Peter Maydell
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 or
9 * (at your option) any later version.
10 */
11
Peter Maydellc52c2662021-05-04 13:09:10 +010012/*
13 * This is a model of the Serial Communication Controller (SCC)
14 * block found in most MPS FPGA images.
15 *
16 * QEMU interface:
17 * + sysbus MMIO region 0: the register bank
18 * + QOM property "scc-cfg4": value of the read-only CFG4 register
19 * + QOM property "scc-aid": value of the read-only SCC_AID register
20 * + QOM property "scc-id": value of the read-only SCC_ID register
Peter Maydell5bddf922021-05-04 13:09:11 +010021 * + QOM property "scc-cfg0": reset value of the CFG0 register
Peter Maydellc52c2662021-05-04 13:09:10 +010022 * + QOM property array "oscclk": reset values of the OSCCLK registers
23 * (which are accessed via the SYS_CFG channel provided by this device)
Peter Maydell5bddf922021-05-04 13:09:11 +010024 * + named GPIO output "remap": this tracks the value of CFG0 register
25 * bit 0. Boards where this bit controls memory remapping should
26 * connect this GPIO line to a function performing that mapping.
27 * Boards where bit 0 has no special function should leave the GPIO
28 * output disconnected.
Peter Maydellc52c2662021-05-04 13:09:10 +010029 */
Peter Maydelldd731852017-07-17 13:36:08 +010030#ifndef MPS2_SCC_H
31#define MPS2_SCC_H
32
33#include "hw/sysbus.h"
Philippe Mathieu-Daudé435db7e2020-06-15 21:23:59 +020034#include "hw/misc/led.h"
Eduardo Habkostdb1015e2020-09-03 16:43:22 -040035#include "qom/object.h"
Peter Maydelldd731852017-07-17 13:36:08 +010036
37#define TYPE_MPS2_SCC "mps2-scc"
Eduardo Habkost80633962020-09-16 14:25:19 -040038OBJECT_DECLARE_SIMPLE_TYPE(MPS2SCC, MPS2_SCC)
Peter Maydelldd731852017-07-17 13:36:08 +010039
Eduardo Habkostdb1015e2020-09-03 16:43:22 -040040struct MPS2SCC {
Peter Maydelldd731852017-07-17 13:36:08 +010041 /*< private >*/
42 SysBusDevice parent_obj;
43
44 /*< public >*/
45 MemoryRegion iomem;
Philippe Mathieu-Daudé435db7e2020-06-15 21:23:59 +020046 LEDState *led[8];
Peter Maydelldd731852017-07-17 13:36:08 +010047
48 uint32_t cfg0;
49 uint32_t cfg1;
Peter Maydell8e4b4c12021-02-15 11:51:24 +000050 uint32_t cfg2;
Peter Maydelldd731852017-07-17 13:36:08 +010051 uint32_t cfg4;
Peter Maydell8e4b4c12021-02-15 11:51:24 +000052 uint32_t cfg5;
53 uint32_t cfg6;
Peter Maydelldd731852017-07-17 13:36:08 +010054 uint32_t cfgdata_rtn;
55 uint32_t cfgdata_out;
56 uint32_t cfgctrl;
57 uint32_t cfgstat;
58 uint32_t dll;
59 uint32_t aid;
60 uint32_t id;
Peter Maydell4fb013a2021-02-15 11:51:16 +000061 uint32_t num_oscclk;
62 uint32_t *oscclk;
63 uint32_t *oscclk_reset;
Peter Maydell5bddf922021-05-04 13:09:11 +010064 uint32_t cfg0_reset;
65
66 qemu_irq remap;
Eduardo Habkostdb1015e2020-09-03 16:43:22 -040067};
Peter Maydelldd731852017-07-17 13:36:08 +010068
69#endif