root / hw / misc / zynq_slcr.c @ cba933b2
History | View | Annotate | Download (14.8 kB)
1 | e3260506 | Peter A. G. Crosthwaite | /*
|
---|---|---|---|
2 | e3260506 | Peter A. G. Crosthwaite | * Status and system control registers for Xilinx Zynq Platform
|
3 | e3260506 | Peter A. G. Crosthwaite | *
|
4 | e3260506 | Peter A. G. Crosthwaite | * Copyright (c) 2011 Michal Simek <monstr@monstr.eu>
|
5 | e3260506 | Peter A. G. Crosthwaite | * Copyright (c) 2012 PetaLogix Pty Ltd.
|
6 | e3260506 | Peter A. G. Crosthwaite | * Based on hw/arm_sysctl.c, written by Paul Brook
|
7 | e3260506 | Peter A. G. Crosthwaite | *
|
8 | e3260506 | Peter A. G. Crosthwaite | * This program is free software; you can redistribute it and/or
|
9 | e3260506 | Peter A. G. Crosthwaite | * modify it under the terms of the GNU General Public License
|
10 | e3260506 | Peter A. G. Crosthwaite | * as published by the Free Software Foundation; either version
|
11 | e3260506 | Peter A. G. Crosthwaite | * 2 of the License, or (at your option) any later version.
|
12 | e3260506 | Peter A. G. Crosthwaite | *
|
13 | e3260506 | Peter A. G. Crosthwaite | * You should have received a copy of the GNU General Public License along
|
14 | e3260506 | Peter A. G. Crosthwaite | * with this program; if not, see <http://www.gnu.org/licenses/>.
|
15 | e3260506 | Peter A. G. Crosthwaite | */
|
16 | e3260506 | Peter A. G. Crosthwaite | |
17 | 83c9f4ca | Paolo Bonzini | #include "hw/hw.h" |
18 | 1de7afc9 | Paolo Bonzini | #include "qemu/timer.h" |
19 | 83c9f4ca | Paolo Bonzini | #include "hw/sysbus.h" |
20 | 9c17d615 | Paolo Bonzini | #include "sysemu/sysemu.h" |
21 | e3260506 | Peter A. G. Crosthwaite | |
22 | e3260506 | Peter A. G. Crosthwaite | #ifdef ZYNQ_ARM_SLCR_ERR_DEBUG
|
23 | e3260506 | Peter A. G. Crosthwaite | #define DB_PRINT(...) do { \ |
24 | e3260506 | Peter A. G. Crosthwaite | fprintf(stderr, ": %s: ", __func__); \
|
25 | e3260506 | Peter A. G. Crosthwaite | fprintf(stderr, ## __VA_ARGS__); \ |
26 | e3260506 | Peter A. G. Crosthwaite | } while (0); |
27 | e3260506 | Peter A. G. Crosthwaite | #else
|
28 | e3260506 | Peter A. G. Crosthwaite | #define DB_PRINT(...)
|
29 | e3260506 | Peter A. G. Crosthwaite | #endif
|
30 | e3260506 | Peter A. G. Crosthwaite | |
31 | e3260506 | Peter A. G. Crosthwaite | #define XILINX_LOCK_KEY 0x767b |
32 | e3260506 | Peter A. G. Crosthwaite | #define XILINX_UNLOCK_KEY 0xdf0d |
33 | e3260506 | Peter A. G. Crosthwaite | |
34 | 69991d7d | Sebastian Huber | #define R_PSS_RST_CTRL_SOFT_RST 0x1 |
35 | 69991d7d | Sebastian Huber | |
36 | e3260506 | Peter A. G. Crosthwaite | typedef enum { |
37 | e3260506 | Peter A. G. Crosthwaite | ARM_PLL_CTRL, |
38 | e3260506 | Peter A. G. Crosthwaite | DDR_PLL_CTRL, |
39 | e3260506 | Peter A. G. Crosthwaite | IO_PLL_CTRL, |
40 | e3260506 | Peter A. G. Crosthwaite | PLL_STATUS, |
41 | e3260506 | Peter A. G. Crosthwaite | ARM_PPL_CFG, |
42 | e3260506 | Peter A. G. Crosthwaite | DDR_PLL_CFG, |
43 | e3260506 | Peter A. G. Crosthwaite | IO_PLL_CFG, |
44 | e3260506 | Peter A. G. Crosthwaite | PLL_BG_CTRL, |
45 | e3260506 | Peter A. G. Crosthwaite | PLL_MAX |
46 | e3260506 | Peter A. G. Crosthwaite | } PLLValues; |
47 | e3260506 | Peter A. G. Crosthwaite | |
48 | e3260506 | Peter A. G. Crosthwaite | typedef enum { |
49 | e3260506 | Peter A. G. Crosthwaite | ARM_CLK_CTRL, |
50 | e3260506 | Peter A. G. Crosthwaite | DDR_CLK_CTRL, |
51 | e3260506 | Peter A. G. Crosthwaite | DCI_CLK_CTRL, |
52 | e3260506 | Peter A. G. Crosthwaite | APER_CLK_CTRL, |
53 | e3260506 | Peter A. G. Crosthwaite | USB0_CLK_CTRL, |
54 | e3260506 | Peter A. G. Crosthwaite | USB1_CLK_CTRL, |
55 | e3260506 | Peter A. G. Crosthwaite | GEM0_RCLK_CTRL, |
56 | e3260506 | Peter A. G. Crosthwaite | GEM1_RCLK_CTRL, |
57 | e3260506 | Peter A. G. Crosthwaite | GEM0_CLK_CTRL, |
58 | e3260506 | Peter A. G. Crosthwaite | GEM1_CLK_CTRL, |
59 | e3260506 | Peter A. G. Crosthwaite | SMC_CLK_CTRL, |
60 | e3260506 | Peter A. G. Crosthwaite | LQSPI_CLK_CTRL, |
61 | e3260506 | Peter A. G. Crosthwaite | SDIO_CLK_CTRL, |
62 | e3260506 | Peter A. G. Crosthwaite | UART_CLK_CTRL, |
63 | e3260506 | Peter A. G. Crosthwaite | SPI_CLK_CTRL, |
64 | e3260506 | Peter A. G. Crosthwaite | CAN_CLK_CTRL, |
65 | e3260506 | Peter A. G. Crosthwaite | CAN_MIOCLK_CTRL, |
66 | e3260506 | Peter A. G. Crosthwaite | DBG_CLK_CTRL, |
67 | e3260506 | Peter A. G. Crosthwaite | PCAP_CLK_CTRL, |
68 | e3260506 | Peter A. G. Crosthwaite | TOPSW_CLK_CTRL, |
69 | e3260506 | Peter A. G. Crosthwaite | CLK_MAX |
70 | e3260506 | Peter A. G. Crosthwaite | } ClkValues; |
71 | e3260506 | Peter A. G. Crosthwaite | |
72 | e3260506 | Peter A. G. Crosthwaite | typedef enum { |
73 | e3260506 | Peter A. G. Crosthwaite | CLK_CTRL, |
74 | e3260506 | Peter A. G. Crosthwaite | THR_CTRL, |
75 | e3260506 | Peter A. G. Crosthwaite | THR_CNT, |
76 | e3260506 | Peter A. G. Crosthwaite | THR_STA, |
77 | e3260506 | Peter A. G. Crosthwaite | FPGA_MAX |
78 | e3260506 | Peter A. G. Crosthwaite | } FPGAValues; |
79 | e3260506 | Peter A. G. Crosthwaite | |
80 | e3260506 | Peter A. G. Crosthwaite | typedef enum { |
81 | e3260506 | Peter A. G. Crosthwaite | SYNC_CTRL, |
82 | e3260506 | Peter A. G. Crosthwaite | SYNC_STATUS, |
83 | e3260506 | Peter A. G. Crosthwaite | BANDGAP_TRIP, |
84 | e3260506 | Peter A. G. Crosthwaite | CC_TEST, |
85 | e3260506 | Peter A. G. Crosthwaite | PLL_PREDIVISOR, |
86 | e3260506 | Peter A. G. Crosthwaite | CLK_621_TRUE, |
87 | e3260506 | Peter A. G. Crosthwaite | PICTURE_DBG, |
88 | e3260506 | Peter A. G. Crosthwaite | PICTURE_DBG_UCNT, |
89 | e3260506 | Peter A. G. Crosthwaite | PICTURE_DBG_LCNT, |
90 | e3260506 | Peter A. G. Crosthwaite | MISC_MAX |
91 | e3260506 | Peter A. G. Crosthwaite | } MiscValues; |
92 | e3260506 | Peter A. G. Crosthwaite | |
93 | e3260506 | Peter A. G. Crosthwaite | typedef enum { |
94 | e3260506 | Peter A. G. Crosthwaite | PSS, |
95 | e3260506 | Peter A. G. Crosthwaite | DDDR, |
96 | fa2ddcb4 | Peter A. G. Crosthwaite | DMAC = 3,
|
97 | e3260506 | Peter A. G. Crosthwaite | USB, |
98 | e3260506 | Peter A. G. Crosthwaite | GEM, |
99 | e3260506 | Peter A. G. Crosthwaite | SDIO, |
100 | e3260506 | Peter A. G. Crosthwaite | SPI, |
101 | e3260506 | Peter A. G. Crosthwaite | CAN, |
102 | e3260506 | Peter A. G. Crosthwaite | I2C, |
103 | e3260506 | Peter A. G. Crosthwaite | UART, |
104 | e3260506 | Peter A. G. Crosthwaite | GPIO, |
105 | e3260506 | Peter A. G. Crosthwaite | LQSPI, |
106 | e3260506 | Peter A. G. Crosthwaite | SMC, |
107 | e3260506 | Peter A. G. Crosthwaite | OCM, |
108 | e3260506 | Peter A. G. Crosthwaite | DEVCI, |
109 | e3260506 | Peter A. G. Crosthwaite | FPGA, |
110 | e3260506 | Peter A. G. Crosthwaite | A9_CPU, |
111 | e3260506 | Peter A. G. Crosthwaite | RS_AWDT, |
112 | e3260506 | Peter A. G. Crosthwaite | RST_REASON, |
113 | e3260506 | Peter A. G. Crosthwaite | RST_REASON_CLR, |
114 | e3260506 | Peter A. G. Crosthwaite | REBOOT_STATUS, |
115 | e3260506 | Peter A. G. Crosthwaite | BOOT_MODE, |
116 | e3260506 | Peter A. G. Crosthwaite | RESET_MAX |
117 | e3260506 | Peter A. G. Crosthwaite | } ResetValues; |
118 | e3260506 | Peter A. G. Crosthwaite | |
119 | a054e2c2 | Andreas Färber | #define TYPE_ZYNQ_SLCR "xilinx,zynq_slcr" |
120 | a054e2c2 | Andreas Färber | #define ZYNQ_SLCR(obj) OBJECT_CHECK(ZynqSLCRState, (obj), TYPE_ZYNQ_SLCR)
|
121 | a054e2c2 | Andreas Färber | |
122 | a054e2c2 | Andreas Färber | typedef struct ZynqSLCRState { |
123 | a054e2c2 | Andreas Färber | SysBusDevice parent_obj; |
124 | a054e2c2 | Andreas Färber | |
125 | e3260506 | Peter A. G. Crosthwaite | MemoryRegion iomem; |
126 | e3260506 | Peter A. G. Crosthwaite | |
127 | e3260506 | Peter A. G. Crosthwaite | union {
|
128 | e3260506 | Peter A. G. Crosthwaite | struct {
|
129 | e3260506 | Peter A. G. Crosthwaite | uint16_t scl; |
130 | e3260506 | Peter A. G. Crosthwaite | uint16_t lockval; |
131 | e3260506 | Peter A. G. Crosthwaite | uint32_t pll[PLL_MAX]; /* 0x100 - 0x11C */
|
132 | e3260506 | Peter A. G. Crosthwaite | uint32_t clk[CLK_MAX]; /* 0x120 - 0x16C */
|
133 | e3260506 | Peter A. G. Crosthwaite | uint32_t fpga[4][FPGA_MAX]; /* 0x170 - 0x1AC */ |
134 | e3260506 | Peter A. G. Crosthwaite | uint32_t misc[MISC_MAX]; /* 0x1B0 - 0x1D8 */
|
135 | e3260506 | Peter A. G. Crosthwaite | uint32_t reset[RESET_MAX]; /* 0x200 - 0x25C */
|
136 | e3260506 | Peter A. G. Crosthwaite | uint32_t apu_ctrl; /* 0x300 */
|
137 | e3260506 | Peter A. G. Crosthwaite | uint32_t wdt_clk_sel; /* 0x304 */
|
138 | e3260506 | Peter A. G. Crosthwaite | uint32_t tz_ocm[3]; /* 0x400 - 0x408 */ |
139 | e3260506 | Peter A. G. Crosthwaite | uint32_t tz_ddr; /* 0x430 */
|
140 | e3260506 | Peter A. G. Crosthwaite | uint32_t tz_dma[3]; /* 0x440 - 0x448 */ |
141 | e3260506 | Peter A. G. Crosthwaite | uint32_t tz_misc[3]; /* 0x450 - 0x458 */ |
142 | e3260506 | Peter A. G. Crosthwaite | uint32_t tz_fpga[2]; /* 0x484 - 0x488 */ |
143 | e3260506 | Peter A. G. Crosthwaite | uint32_t dbg_ctrl; /* 0x500 */
|
144 | e3260506 | Peter A. G. Crosthwaite | uint32_t pss_idcode; /* 0x530 */
|
145 | e3260506 | Peter A. G. Crosthwaite | uint32_t ddr[8]; /* 0x600 - 0x620 - 0x604-missing */ |
146 | e3260506 | Peter A. G. Crosthwaite | uint32_t mio[54]; /* 0x700 - 0x7D4 */ |
147 | e3260506 | Peter A. G. Crosthwaite | uint32_t mio_func[4]; /* 0x800 - 0x810 */ |
148 | e3260506 | Peter A. G. Crosthwaite | uint32_t sd[2]; /* 0x830 - 0x834 */ |
149 | e3260506 | Peter A. G. Crosthwaite | uint32_t lvl_shftr_en; /* 0x900 */
|
150 | e3260506 | Peter A. G. Crosthwaite | uint32_t ocm_cfg; /* 0x910 */
|
151 | e3260506 | Peter A. G. Crosthwaite | uint32_t cpu_ram[8]; /* 0xA00 - 0xA1C */ |
152 | e3260506 | Peter A. G. Crosthwaite | uint32_t iou[7]; /* 0xA30 - 0xA48 */ |
153 | e3260506 | Peter A. G. Crosthwaite | uint32_t dmac_ram; /* 0xA50 */
|
154 | e3260506 | Peter A. G. Crosthwaite | uint32_t afi[4][3]; /* 0xA60 - 0xA8C */ |
155 | e3260506 | Peter A. G. Crosthwaite | uint32_t ocm[3]; /* 0xA90 - 0xA98 */ |
156 | e3260506 | Peter A. G. Crosthwaite | uint32_t devci_ram; /* 0xAA0 */
|
157 | e3260506 | Peter A. G. Crosthwaite | uint32_t csg_ram; /* 0xAB0 */
|
158 | e3260506 | Peter A. G. Crosthwaite | uint32_t gpiob[12]; /* 0xB00 - 0xB2C */ |
159 | e3260506 | Peter A. G. Crosthwaite | uint32_t ddriob[14]; /* 0xB40 - 0xB74 */ |
160 | e3260506 | Peter A. G. Crosthwaite | }; |
161 | e3260506 | Peter A. G. Crosthwaite | uint8_t data[0x1000];
|
162 | e3260506 | Peter A. G. Crosthwaite | }; |
163 | e3260506 | Peter A. G. Crosthwaite | } ZynqSLCRState; |
164 | e3260506 | Peter A. G. Crosthwaite | |
165 | e3260506 | Peter A. G. Crosthwaite | static void zynq_slcr_reset(DeviceState *d) |
166 | e3260506 | Peter A. G. Crosthwaite | { |
167 | a054e2c2 | Andreas Färber | ZynqSLCRState *s = ZYNQ_SLCR(d); |
168 | e3260506 | Peter A. G. Crosthwaite | int i;
|
169 | e3260506 | Peter A. G. Crosthwaite | |
170 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("RESET\n");
|
171 | e3260506 | Peter A. G. Crosthwaite | |
172 | e3260506 | Peter A. G. Crosthwaite | s->lockval = 1;
|
173 | e3260506 | Peter A. G. Crosthwaite | /* 0x100 - 0x11C */
|
174 | e3260506 | Peter A. G. Crosthwaite | s->pll[ARM_PLL_CTRL] = 0x0001A008;
|
175 | e3260506 | Peter A. G. Crosthwaite | s->pll[DDR_PLL_CTRL] = 0x0001A008;
|
176 | e3260506 | Peter A. G. Crosthwaite | s->pll[IO_PLL_CTRL] = 0x0001A008;
|
177 | e3260506 | Peter A. G. Crosthwaite | s->pll[PLL_STATUS] = 0x0000003F;
|
178 | e3260506 | Peter A. G. Crosthwaite | s->pll[ARM_PPL_CFG] = 0x00014000;
|
179 | e3260506 | Peter A. G. Crosthwaite | s->pll[DDR_PLL_CFG] = 0x00014000;
|
180 | e3260506 | Peter A. G. Crosthwaite | s->pll[IO_PLL_CFG] = 0x00014000;
|
181 | e3260506 | Peter A. G. Crosthwaite | |
182 | e3260506 | Peter A. G. Crosthwaite | /* 0x120 - 0x16C */
|
183 | e3260506 | Peter A. G. Crosthwaite | s->clk[ARM_CLK_CTRL] = 0x1F000400;
|
184 | e3260506 | Peter A. G. Crosthwaite | s->clk[DDR_CLK_CTRL] = 0x18400003;
|
185 | e3260506 | Peter A. G. Crosthwaite | s->clk[DCI_CLK_CTRL] = 0x01E03201;
|
186 | e3260506 | Peter A. G. Crosthwaite | s->clk[APER_CLK_CTRL] = 0x01FFCCCD;
|
187 | e3260506 | Peter A. G. Crosthwaite | s->clk[USB0_CLK_CTRL] = s->clk[USB1_CLK_CTRL] = 0x00101941;
|
188 | e3260506 | Peter A. G. Crosthwaite | s->clk[GEM0_RCLK_CTRL] = s->clk[GEM1_RCLK_CTRL] = 0x00000001;
|
189 | e3260506 | Peter A. G. Crosthwaite | s->clk[GEM0_CLK_CTRL] = s->clk[GEM1_CLK_CTRL] = 0x00003C01;
|
190 | e3260506 | Peter A. G. Crosthwaite | s->clk[SMC_CLK_CTRL] = 0x00003C01;
|
191 | e3260506 | Peter A. G. Crosthwaite | s->clk[LQSPI_CLK_CTRL] = 0x00002821;
|
192 | e3260506 | Peter A. G. Crosthwaite | s->clk[SDIO_CLK_CTRL] = 0x00001E03;
|
193 | e3260506 | Peter A. G. Crosthwaite | s->clk[UART_CLK_CTRL] = 0x00003F03;
|
194 | e3260506 | Peter A. G. Crosthwaite | s->clk[SPI_CLK_CTRL] = 0x00003F03;
|
195 | e3260506 | Peter A. G. Crosthwaite | s->clk[CAN_CLK_CTRL] = 0x00501903;
|
196 | e3260506 | Peter A. G. Crosthwaite | s->clk[DBG_CLK_CTRL] = 0x00000F03;
|
197 | e3260506 | Peter A. G. Crosthwaite | s->clk[PCAP_CLK_CTRL] = 0x00000F01;
|
198 | e3260506 | Peter A. G. Crosthwaite | |
199 | e3260506 | Peter A. G. Crosthwaite | /* 0x170 - 0x1AC */
|
200 | e3260506 | Peter A. G. Crosthwaite | s->fpga[0][CLK_CTRL] = s->fpga[1][CLK_CTRL] = s->fpga[2][CLK_CTRL] = |
201 | e3260506 | Peter A. G. Crosthwaite | s->fpga[3][CLK_CTRL] = 0x00101800; |
202 | e3260506 | Peter A. G. Crosthwaite | s->fpga[0][THR_STA] = s->fpga[1][THR_STA] = s->fpga[2][THR_STA] = |
203 | e3260506 | Peter A. G. Crosthwaite | s->fpga[3][THR_STA] = 0x00010000; |
204 | e3260506 | Peter A. G. Crosthwaite | |
205 | e3260506 | Peter A. G. Crosthwaite | /* 0x1B0 - 0x1D8 */
|
206 | e3260506 | Peter A. G. Crosthwaite | s->misc[BANDGAP_TRIP] = 0x0000001F;
|
207 | e3260506 | Peter A. G. Crosthwaite | s->misc[PLL_PREDIVISOR] = 0x00000001;
|
208 | e3260506 | Peter A. G. Crosthwaite | s->misc[CLK_621_TRUE] = 0x00000001;
|
209 | e3260506 | Peter A. G. Crosthwaite | |
210 | e3260506 | Peter A. G. Crosthwaite | /* 0x200 - 0x25C */
|
211 | e3260506 | Peter A. G. Crosthwaite | s->reset[FPGA] = 0x01F33F0F;
|
212 | e3260506 | Peter A. G. Crosthwaite | s->reset[RST_REASON] = 0x00000040;
|
213 | e3260506 | Peter A. G. Crosthwaite | |
214 | e3260506 | Peter A. G. Crosthwaite | /* 0x700 - 0x7D4 */
|
215 | e3260506 | Peter A. G. Crosthwaite | for (i = 0; i < 54; i++) { |
216 | e3260506 | Peter A. G. Crosthwaite | s->mio[i] = 0x00001601;
|
217 | e3260506 | Peter A. G. Crosthwaite | } |
218 | e3260506 | Peter A. G. Crosthwaite | for (i = 2; i <= 8; i++) { |
219 | e3260506 | Peter A. G. Crosthwaite | s->mio[i] = 0x00000601;
|
220 | e3260506 | Peter A. G. Crosthwaite | } |
221 | e3260506 | Peter A. G. Crosthwaite | |
222 | e3260506 | Peter A. G. Crosthwaite | /* MIO_MST_TRI0, MIO_MST_TRI1 */
|
223 | e3260506 | Peter A. G. Crosthwaite | s->mio_func[2] = s->mio_func[3] = 0xFFFFFFFF; |
224 | e3260506 | Peter A. G. Crosthwaite | |
225 | e3260506 | Peter A. G. Crosthwaite | s->cpu_ram[0] = s->cpu_ram[1] = s->cpu_ram[3] = |
226 | e3260506 | Peter A. G. Crosthwaite | s->cpu_ram[4] = s->cpu_ram[7] = 0x00010101; |
227 | e3260506 | Peter A. G. Crosthwaite | s->cpu_ram[2] = s->cpu_ram[5] = 0x01010101; |
228 | e3260506 | Peter A. G. Crosthwaite | s->cpu_ram[6] = 0x00000001; |
229 | e3260506 | Peter A. G. Crosthwaite | |
230 | e3260506 | Peter A. G. Crosthwaite | s->iou[0] = s->iou[1] = s->iou[2] = s->iou[3] = 0x09090909; |
231 | e3260506 | Peter A. G. Crosthwaite | s->iou[4] = s->iou[5] = 0x00090909; |
232 | e3260506 | Peter A. G. Crosthwaite | s->iou[6] = 0x00000909; |
233 | e3260506 | Peter A. G. Crosthwaite | |
234 | e3260506 | Peter A. G. Crosthwaite | s->dmac_ram = 0x00000009;
|
235 | e3260506 | Peter A. G. Crosthwaite | |
236 | e3260506 | Peter A. G. Crosthwaite | s->afi[0][0] = s->afi[0][1] = 0x09090909; |
237 | e3260506 | Peter A. G. Crosthwaite | s->afi[1][0] = s->afi[1][1] = 0x09090909; |
238 | e3260506 | Peter A. G. Crosthwaite | s->afi[2][0] = s->afi[2][1] = 0x09090909; |
239 | e3260506 | Peter A. G. Crosthwaite | s->afi[3][0] = s->afi[3][1] = 0x09090909; |
240 | e3260506 | Peter A. G. Crosthwaite | s->afi[0][2] = s->afi[1][2] = s->afi[2][2] = s->afi[3][2] = 0x00000909; |
241 | e3260506 | Peter A. G. Crosthwaite | |
242 | e3260506 | Peter A. G. Crosthwaite | s->ocm[0] = 0x01010101; |
243 | e3260506 | Peter A. G. Crosthwaite | s->ocm[1] = s->ocm[2] = 0x09090909; |
244 | e3260506 | Peter A. G. Crosthwaite | |
245 | e3260506 | Peter A. G. Crosthwaite | s->devci_ram = 0x00000909;
|
246 | e3260506 | Peter A. G. Crosthwaite | s->csg_ram = 0x00000001;
|
247 | e3260506 | Peter A. G. Crosthwaite | |
248 | e3260506 | Peter A. G. Crosthwaite | s->ddriob[0] = s->ddriob[1] = s->ddriob[2] = s->ddriob[3] = 0x00000e00; |
249 | e3260506 | Peter A. G. Crosthwaite | s->ddriob[4] = s->ddriob[5] = s->ddriob[6] = 0x00000e00; |
250 | e3260506 | Peter A. G. Crosthwaite | s->ddriob[12] = 0x00000021; |
251 | e3260506 | Peter A. G. Crosthwaite | } |
252 | e3260506 | Peter A. G. Crosthwaite | |
253 | e3260506 | Peter A. G. Crosthwaite | static inline uint32_t zynq_slcr_read_imp(void *opaque, |
254 | a8170e5e | Avi Kivity | hwaddr offset) |
255 | e3260506 | Peter A. G. Crosthwaite | { |
256 | e3260506 | Peter A. G. Crosthwaite | ZynqSLCRState *s = (ZynqSLCRState *)opaque; |
257 | e3260506 | Peter A. G. Crosthwaite | |
258 | e3260506 | Peter A. G. Crosthwaite | switch (offset) {
|
259 | e3260506 | Peter A. G. Crosthwaite | case 0x0: /* SCL */ |
260 | e3260506 | Peter A. G. Crosthwaite | return s->scl;
|
261 | e3260506 | Peter A. G. Crosthwaite | case 0x4: /* LOCK */ |
262 | e3260506 | Peter A. G. Crosthwaite | case 0x8: /* UNLOCK */ |
263 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("Reading SCLR_LOCK/UNLOCK is not enabled\n");
|
264 | e3260506 | Peter A. G. Crosthwaite | return 0; |
265 | e3260506 | Peter A. G. Crosthwaite | case 0x0C: /* LOCKSTA */ |
266 | e3260506 | Peter A. G. Crosthwaite | return s->lockval;
|
267 | e3260506 | Peter A. G. Crosthwaite | case 0x100 ... 0x11C: |
268 | e3260506 | Peter A. G. Crosthwaite | return s->pll[(offset - 0x100) / 4]; |
269 | e3260506 | Peter A. G. Crosthwaite | case 0x120 ... 0x16C: |
270 | e3260506 | Peter A. G. Crosthwaite | return s->clk[(offset - 0x120) / 4]; |
271 | e3260506 | Peter A. G. Crosthwaite | case 0x170 ... 0x1AC: |
272 | e3260506 | Peter A. G. Crosthwaite | return s->fpga[0][(offset - 0x170) / 4]; |
273 | e3260506 | Peter A. G. Crosthwaite | case 0x1B0 ... 0x1D8: |
274 | e3260506 | Peter A. G. Crosthwaite | return s->misc[(offset - 0x1B0) / 4]; |
275 | e3260506 | Peter A. G. Crosthwaite | case 0x200 ... 0x258: |
276 | e3260506 | Peter A. G. Crosthwaite | return s->reset[(offset - 0x200) / 4]; |
277 | e3260506 | Peter A. G. Crosthwaite | case 0x25c: |
278 | e3260506 | Peter A. G. Crosthwaite | return 1; |
279 | e3260506 | Peter A. G. Crosthwaite | case 0x300: |
280 | e3260506 | Peter A. G. Crosthwaite | return s->apu_ctrl;
|
281 | e3260506 | Peter A. G. Crosthwaite | case 0x304: |
282 | e3260506 | Peter A. G. Crosthwaite | return s->wdt_clk_sel;
|
283 | e3260506 | Peter A. G. Crosthwaite | case 0x400 ... 0x408: |
284 | e3260506 | Peter A. G. Crosthwaite | return s->tz_ocm[(offset - 0x400) / 4]; |
285 | e3260506 | Peter A. G. Crosthwaite | case 0x430: |
286 | e3260506 | Peter A. G. Crosthwaite | return s->tz_ddr;
|
287 | e3260506 | Peter A. G. Crosthwaite | case 0x440 ... 0x448: |
288 | e3260506 | Peter A. G. Crosthwaite | return s->tz_dma[(offset - 0x440) / 4]; |
289 | e3260506 | Peter A. G. Crosthwaite | case 0x450 ... 0x458: |
290 | e3260506 | Peter A. G. Crosthwaite | return s->tz_misc[(offset - 0x450) / 4]; |
291 | e3260506 | Peter A. G. Crosthwaite | case 0x484 ... 0x488: |
292 | e3260506 | Peter A. G. Crosthwaite | return s->tz_fpga[(offset - 0x484) / 4]; |
293 | e3260506 | Peter A. G. Crosthwaite | case 0x500: |
294 | e3260506 | Peter A. G. Crosthwaite | return s->dbg_ctrl;
|
295 | e3260506 | Peter A. G. Crosthwaite | case 0x530: |
296 | e3260506 | Peter A. G. Crosthwaite | return s->pss_idcode;
|
297 | e3260506 | Peter A. G. Crosthwaite | case 0x600 ... 0x620: |
298 | e3260506 | Peter A. G. Crosthwaite | if (offset == 0x604) { |
299 | e3260506 | Peter A. G. Crosthwaite | goto bad_reg;
|
300 | e3260506 | Peter A. G. Crosthwaite | } |
301 | e3260506 | Peter A. G. Crosthwaite | return s->ddr[(offset - 0x600) / 4]; |
302 | e3260506 | Peter A. G. Crosthwaite | case 0x700 ... 0x7D4: |
303 | e3260506 | Peter A. G. Crosthwaite | return s->mio[(offset - 0x700) / 4]; |
304 | e3260506 | Peter A. G. Crosthwaite | case 0x800 ... 0x810: |
305 | e3260506 | Peter A. G. Crosthwaite | return s->mio_func[(offset - 0x800) / 4]; |
306 | e3260506 | Peter A. G. Crosthwaite | case 0x830 ... 0x834: |
307 | e3260506 | Peter A. G. Crosthwaite | return s->sd[(offset - 0x830) / 4]; |
308 | e3260506 | Peter A. G. Crosthwaite | case 0x900: |
309 | e3260506 | Peter A. G. Crosthwaite | return s->lvl_shftr_en;
|
310 | e3260506 | Peter A. G. Crosthwaite | case 0x910: |
311 | e3260506 | Peter A. G. Crosthwaite | return s->ocm_cfg;
|
312 | e3260506 | Peter A. G. Crosthwaite | case 0xA00 ... 0xA1C: |
313 | e3260506 | Peter A. G. Crosthwaite | return s->cpu_ram[(offset - 0xA00) / 4]; |
314 | e3260506 | Peter A. G. Crosthwaite | case 0xA30 ... 0xA48: |
315 | e3260506 | Peter A. G. Crosthwaite | return s->iou[(offset - 0xA30) / 4]; |
316 | e3260506 | Peter A. G. Crosthwaite | case 0xA50: |
317 | e3260506 | Peter A. G. Crosthwaite | return s->dmac_ram;
|
318 | e3260506 | Peter A. G. Crosthwaite | case 0xA60 ... 0xA8C: |
319 | 0d10f627 | Anthony Liguori | return s->afi[0][(offset - 0xA60) / 4]; |
320 | e3260506 | Peter A. G. Crosthwaite | case 0xA90 ... 0xA98: |
321 | e3260506 | Peter A. G. Crosthwaite | return s->ocm[(offset - 0xA90) / 4]; |
322 | e3260506 | Peter A. G. Crosthwaite | case 0xAA0: |
323 | e3260506 | Peter A. G. Crosthwaite | return s->devci_ram;
|
324 | e3260506 | Peter A. G. Crosthwaite | case 0xAB0: |
325 | e3260506 | Peter A. G. Crosthwaite | return s->csg_ram;
|
326 | e3260506 | Peter A. G. Crosthwaite | case 0xB00 ... 0xB2C: |
327 | e3260506 | Peter A. G. Crosthwaite | return s->gpiob[(offset - 0xB00) / 4]; |
328 | e3260506 | Peter A. G. Crosthwaite | case 0xB40 ... 0xB74: |
329 | e3260506 | Peter A. G. Crosthwaite | return s->ddriob[(offset - 0xB40) / 4]; |
330 | e3260506 | Peter A. G. Crosthwaite | default:
|
331 | e3260506 | Peter A. G. Crosthwaite | bad_reg:
|
332 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("Bad register offset 0x%x\n", (int)offset); |
333 | e3260506 | Peter A. G. Crosthwaite | return 0; |
334 | e3260506 | Peter A. G. Crosthwaite | } |
335 | e3260506 | Peter A. G. Crosthwaite | } |
336 | e3260506 | Peter A. G. Crosthwaite | |
337 | a8170e5e | Avi Kivity | static uint64_t zynq_slcr_read(void *opaque, hwaddr offset, |
338 | e3260506 | Peter A. G. Crosthwaite | unsigned size)
|
339 | e3260506 | Peter A. G. Crosthwaite | { |
340 | e3260506 | Peter A. G. Crosthwaite | uint32_t ret = zynq_slcr_read_imp(opaque, offset); |
341 | e3260506 | Peter A. G. Crosthwaite | |
342 | 8f603800 | Peter Crosthwaite | DB_PRINT("addr: %08x data: %08x\n", (unsigned)offset, (unsigned)ret); |
343 | e3260506 | Peter A. G. Crosthwaite | return ret;
|
344 | e3260506 | Peter A. G. Crosthwaite | } |
345 | e3260506 | Peter A. G. Crosthwaite | |
346 | a8170e5e | Avi Kivity | static void zynq_slcr_write(void *opaque, hwaddr offset, |
347 | e3260506 | Peter A. G. Crosthwaite | uint64_t val, unsigned size)
|
348 | e3260506 | Peter A. G. Crosthwaite | { |
349 | e3260506 | Peter A. G. Crosthwaite | ZynqSLCRState *s = (ZynqSLCRState *)opaque; |
350 | e3260506 | Peter A. G. Crosthwaite | |
351 | 8f603800 | Peter Crosthwaite | DB_PRINT("offset: %08x data: %08x\n", (unsigned)offset, (unsigned)val); |
352 | e3260506 | Peter A. G. Crosthwaite | |
353 | e3260506 | Peter A. G. Crosthwaite | switch (offset) {
|
354 | e3260506 | Peter A. G. Crosthwaite | case 0x00: /* SCL */ |
355 | e3260506 | Peter A. G. Crosthwaite | s->scl = val & 0x1;
|
356 | e3260506 | Peter A. G. Crosthwaite | return;
|
357 | e3260506 | Peter A. G. Crosthwaite | case 0x4: /* SLCR_LOCK */ |
358 | e3260506 | Peter A. G. Crosthwaite | if ((val & 0xFFFF) == XILINX_LOCK_KEY) { |
359 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("XILINX LOCK 0xF8000000 + 0x%x <= 0x%x\n", (int)offset, |
360 | e3260506 | Peter A. G. Crosthwaite | (unsigned)val & 0xFFFF); |
361 | e3260506 | Peter A. G. Crosthwaite | s->lockval = 1;
|
362 | e3260506 | Peter A. G. Crosthwaite | } else {
|
363 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("WRONG XILINX LOCK KEY 0xF8000000 + 0x%x <= 0x%x\n",
|
364 | e3260506 | Peter A. G. Crosthwaite | (int)offset, (unsigned)val & 0xFFFF); |
365 | e3260506 | Peter A. G. Crosthwaite | } |
366 | e3260506 | Peter A. G. Crosthwaite | return;
|
367 | e3260506 | Peter A. G. Crosthwaite | case 0x8: /* SLCR_UNLOCK */ |
368 | e3260506 | Peter A. G. Crosthwaite | if ((val & 0xFFFF) == XILINX_UNLOCK_KEY) { |
369 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("XILINX UNLOCK 0xF8000000 + 0x%x <= 0x%x\n", (int)offset, |
370 | e3260506 | Peter A. G. Crosthwaite | (unsigned)val & 0xFFFF); |
371 | e3260506 | Peter A. G. Crosthwaite | s->lockval = 0;
|
372 | e3260506 | Peter A. G. Crosthwaite | } else {
|
373 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("WRONG XILINX UNLOCK KEY 0xF8000000 + 0x%x <= 0x%x\n",
|
374 | e3260506 | Peter A. G. Crosthwaite | (int)offset, (unsigned)val & 0xFFFF); |
375 | e3260506 | Peter A. G. Crosthwaite | } |
376 | e3260506 | Peter A. G. Crosthwaite | return;
|
377 | e3260506 | Peter A. G. Crosthwaite | case 0xc: /* LOCKSTA */ |
378 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("Writing SCLR_LOCKSTA is not enabled\n");
|
379 | e3260506 | Peter A. G. Crosthwaite | return;
|
380 | e3260506 | Peter A. G. Crosthwaite | } |
381 | e3260506 | Peter A. G. Crosthwaite | |
382 | e3260506 | Peter A. G. Crosthwaite | if (!s->lockval) {
|
383 | e3260506 | Peter A. G. Crosthwaite | switch (offset) {
|
384 | e3260506 | Peter A. G. Crosthwaite | case 0x100 ... 0x11C: |
385 | e3260506 | Peter A. G. Crosthwaite | if (offset == 0x10C) { |
386 | e3260506 | Peter A. G. Crosthwaite | goto bad_reg;
|
387 | e3260506 | Peter A. G. Crosthwaite | } |
388 | e3260506 | Peter A. G. Crosthwaite | s->pll[(offset - 0x100) / 4] = val; |
389 | e3260506 | Peter A. G. Crosthwaite | break;
|
390 | e3260506 | Peter A. G. Crosthwaite | case 0x120 ... 0x16C: |
391 | e3260506 | Peter A. G. Crosthwaite | s->clk[(offset - 0x120) / 4] = val; |
392 | e3260506 | Peter A. G. Crosthwaite | break;
|
393 | e3260506 | Peter A. G. Crosthwaite | case 0x170 ... 0x1AC: |
394 | e3260506 | Peter A. G. Crosthwaite | s->fpga[0][(offset - 0x170) / 4] = val; |
395 | e3260506 | Peter A. G. Crosthwaite | break;
|
396 | e3260506 | Peter A. G. Crosthwaite | case 0x1B0 ... 0x1D8: |
397 | e3260506 | Peter A. G. Crosthwaite | s->misc[(offset - 0x1B0) / 4] = val; |
398 | e3260506 | Peter A. G. Crosthwaite | break;
|
399 | e3260506 | Peter A. G. Crosthwaite | case 0x200 ... 0x25C: |
400 | e3260506 | Peter A. G. Crosthwaite | if (offset == 0x250) { |
401 | e3260506 | Peter A. G. Crosthwaite | goto bad_reg;
|
402 | e3260506 | Peter A. G. Crosthwaite | } |
403 | e3260506 | Peter A. G. Crosthwaite | s->reset[(offset - 0x200) / 4] = val; |
404 | 69991d7d | Sebastian Huber | if (offset == 0x200 && (val & R_PSS_RST_CTRL_SOFT_RST)) { |
405 | 69991d7d | Sebastian Huber | qemu_system_reset_request(); |
406 | 69991d7d | Sebastian Huber | } |
407 | e3260506 | Peter A. G. Crosthwaite | break;
|
408 | e3260506 | Peter A. G. Crosthwaite | case 0x300: |
409 | e3260506 | Peter A. G. Crosthwaite | s->apu_ctrl = val; |
410 | e3260506 | Peter A. G. Crosthwaite | break;
|
411 | e3260506 | Peter A. G. Crosthwaite | case 0x304: |
412 | e3260506 | Peter A. G. Crosthwaite | s->wdt_clk_sel = val; |
413 | e3260506 | Peter A. G. Crosthwaite | break;
|
414 | e3260506 | Peter A. G. Crosthwaite | case 0x400 ... 0x408: |
415 | e3260506 | Peter A. G. Crosthwaite | s->tz_ocm[(offset - 0x400) / 4] = val; |
416 | e3260506 | Peter A. G. Crosthwaite | break;
|
417 | e3260506 | Peter A. G. Crosthwaite | case 0x430: |
418 | e3260506 | Peter A. G. Crosthwaite | s->tz_ddr = val; |
419 | e3260506 | Peter A. G. Crosthwaite | break;
|
420 | e3260506 | Peter A. G. Crosthwaite | case 0x440 ... 0x448: |
421 | e3260506 | Peter A. G. Crosthwaite | s->tz_dma[(offset - 0x440) / 4] = val; |
422 | e3260506 | Peter A. G. Crosthwaite | break;
|
423 | e3260506 | Peter A. G. Crosthwaite | case 0x450 ... 0x458: |
424 | e3260506 | Peter A. G. Crosthwaite | s->tz_misc[(offset - 0x450) / 4] = val; |
425 | e3260506 | Peter A. G. Crosthwaite | break;
|
426 | e3260506 | Peter A. G. Crosthwaite | case 0x484 ... 0x488: |
427 | e3260506 | Peter A. G. Crosthwaite | s->tz_fpga[(offset - 0x484) / 4] = val; |
428 | e3260506 | Peter A. G. Crosthwaite | break;
|
429 | e3260506 | Peter A. G. Crosthwaite | case 0x500: |
430 | e3260506 | Peter A. G. Crosthwaite | s->dbg_ctrl = val; |
431 | e3260506 | Peter A. G. Crosthwaite | break;
|
432 | e3260506 | Peter A. G. Crosthwaite | case 0x530: |
433 | e3260506 | Peter A. G. Crosthwaite | s->pss_idcode = val; |
434 | e3260506 | Peter A. G. Crosthwaite | break;
|
435 | e3260506 | Peter A. G. Crosthwaite | case 0x600 ... 0x620: |
436 | e3260506 | Peter A. G. Crosthwaite | if (offset == 0x604) { |
437 | e3260506 | Peter A. G. Crosthwaite | goto bad_reg;
|
438 | e3260506 | Peter A. G. Crosthwaite | } |
439 | e3260506 | Peter A. G. Crosthwaite | s->ddr[(offset - 0x600) / 4] = val; |
440 | e3260506 | Peter A. G. Crosthwaite | break;
|
441 | e3260506 | Peter A. G. Crosthwaite | case 0x700 ... 0x7D4: |
442 | e3260506 | Peter A. G. Crosthwaite | s->mio[(offset - 0x700) / 4] = val; |
443 | e3260506 | Peter A. G. Crosthwaite | break;
|
444 | e3260506 | Peter A. G. Crosthwaite | case 0x800 ... 0x810: |
445 | e3260506 | Peter A. G. Crosthwaite | s->mio_func[(offset - 0x800) / 4] = val; |
446 | e3260506 | Peter A. G. Crosthwaite | break;
|
447 | e3260506 | Peter A. G. Crosthwaite | case 0x830 ... 0x834: |
448 | e3260506 | Peter A. G. Crosthwaite | s->sd[(offset - 0x830) / 4] = val; |
449 | e3260506 | Peter A. G. Crosthwaite | break;
|
450 | e3260506 | Peter A. G. Crosthwaite | case 0x900: |
451 | e3260506 | Peter A. G. Crosthwaite | s->lvl_shftr_en = val; |
452 | e3260506 | Peter A. G. Crosthwaite | break;
|
453 | e3260506 | Peter A. G. Crosthwaite | case 0x910: |
454 | e3260506 | Peter A. G. Crosthwaite | break;
|
455 | e3260506 | Peter A. G. Crosthwaite | case 0xA00 ... 0xA1C: |
456 | e3260506 | Peter A. G. Crosthwaite | s->cpu_ram[(offset - 0xA00) / 4] = val; |
457 | e3260506 | Peter A. G. Crosthwaite | break;
|
458 | e3260506 | Peter A. G. Crosthwaite | case 0xA30 ... 0xA48: |
459 | e3260506 | Peter A. G. Crosthwaite | s->iou[(offset - 0xA30) / 4] = val; |
460 | e3260506 | Peter A. G. Crosthwaite | break;
|
461 | e3260506 | Peter A. G. Crosthwaite | case 0xA50: |
462 | e3260506 | Peter A. G. Crosthwaite | s->dmac_ram = val; |
463 | e3260506 | Peter A. G. Crosthwaite | break;
|
464 | e3260506 | Peter A. G. Crosthwaite | case 0xA60 ... 0xA8C: |
465 | 0d10f627 | Anthony Liguori | s->afi[0][(offset - 0xA60) / 4] = val; |
466 | e3260506 | Peter A. G. Crosthwaite | break;
|
467 | e3260506 | Peter A. G. Crosthwaite | case 0xA90: |
468 | e3260506 | Peter A. G. Crosthwaite | s->ocm[0] = val;
|
469 | e3260506 | Peter A. G. Crosthwaite | break;
|
470 | e3260506 | Peter A. G. Crosthwaite | case 0xAA0: |
471 | e3260506 | Peter A. G. Crosthwaite | s->devci_ram = val; |
472 | e3260506 | Peter A. G. Crosthwaite | break;
|
473 | e3260506 | Peter A. G. Crosthwaite | case 0xAB0: |
474 | e3260506 | Peter A. G. Crosthwaite | s->csg_ram = val; |
475 | e3260506 | Peter A. G. Crosthwaite | break;
|
476 | e3260506 | Peter A. G. Crosthwaite | case 0xB00 ... 0xB2C: |
477 | e3260506 | Peter A. G. Crosthwaite | if (offset == 0xB20 || offset == 0xB2C) { |
478 | e3260506 | Peter A. G. Crosthwaite | goto bad_reg;
|
479 | e3260506 | Peter A. G. Crosthwaite | } |
480 | e3260506 | Peter A. G. Crosthwaite | s->gpiob[(offset - 0xB00) / 4] = val; |
481 | e3260506 | Peter A. G. Crosthwaite | break;
|
482 | e3260506 | Peter A. G. Crosthwaite | case 0xB40 ... 0xB74: |
483 | e3260506 | Peter A. G. Crosthwaite | s->ddriob[(offset - 0xB40) / 4] = val; |
484 | e3260506 | Peter A. G. Crosthwaite | break;
|
485 | e3260506 | Peter A. G. Crosthwaite | default:
|
486 | e3260506 | Peter A. G. Crosthwaite | bad_reg:
|
487 | 8f603800 | Peter Crosthwaite | DB_PRINT("Bad register write %x <= %08x\n", (int)offset, |
488 | 8f603800 | Peter Crosthwaite | (unsigned)val);
|
489 | e3260506 | Peter A. G. Crosthwaite | } |
490 | e3260506 | Peter A. G. Crosthwaite | } else {
|
491 | e3260506 | Peter A. G. Crosthwaite | DB_PRINT("SCLR registers are locked. Unlock them first\n");
|
492 | e3260506 | Peter A. G. Crosthwaite | } |
493 | e3260506 | Peter A. G. Crosthwaite | } |
494 | e3260506 | Peter A. G. Crosthwaite | |
495 | e3260506 | Peter A. G. Crosthwaite | static const MemoryRegionOps slcr_ops = { |
496 | e3260506 | Peter A. G. Crosthwaite | .read = zynq_slcr_read, |
497 | e3260506 | Peter A. G. Crosthwaite | .write = zynq_slcr_write, |
498 | e3260506 | Peter A. G. Crosthwaite | .endianness = DEVICE_NATIVE_ENDIAN, |
499 | e3260506 | Peter A. G. Crosthwaite | }; |
500 | e3260506 | Peter A. G. Crosthwaite | |
501 | e3260506 | Peter A. G. Crosthwaite | static int zynq_slcr_init(SysBusDevice *dev) |
502 | e3260506 | Peter A. G. Crosthwaite | { |
503 | a054e2c2 | Andreas Färber | ZynqSLCRState *s = ZYNQ_SLCR(dev); |
504 | e3260506 | Peter A. G. Crosthwaite | |
505 | 3c161542 | Paolo Bonzini | memory_region_init_io(&s->iomem, OBJECT(s), &slcr_ops, s, "slcr", 0x1000); |
506 | e3260506 | Peter A. G. Crosthwaite | sysbus_init_mmio(dev, &s->iomem); |
507 | e3260506 | Peter A. G. Crosthwaite | |
508 | e3260506 | Peter A. G. Crosthwaite | return 0; |
509 | e3260506 | Peter A. G. Crosthwaite | } |
510 | e3260506 | Peter A. G. Crosthwaite | |
511 | e3260506 | Peter A. G. Crosthwaite | static const VMStateDescription vmstate_zynq_slcr = { |
512 | e3260506 | Peter A. G. Crosthwaite | .name = "zynq_slcr",
|
513 | e3260506 | Peter A. G. Crosthwaite | .version_id = 1,
|
514 | e3260506 | Peter A. G. Crosthwaite | .minimum_version_id = 1,
|
515 | e3260506 | Peter A. G. Crosthwaite | .minimum_version_id_old = 1,
|
516 | e3260506 | Peter A. G. Crosthwaite | .fields = (VMStateField[]) { |
517 | e3260506 | Peter A. G. Crosthwaite | VMSTATE_UINT8_ARRAY(data, ZynqSLCRState, 0x1000),
|
518 | e3260506 | Peter A. G. Crosthwaite | VMSTATE_END_OF_LIST() |
519 | e3260506 | Peter A. G. Crosthwaite | } |
520 | e3260506 | Peter A. G. Crosthwaite | }; |
521 | e3260506 | Peter A. G. Crosthwaite | |
522 | e3260506 | Peter A. G. Crosthwaite | static void zynq_slcr_class_init(ObjectClass *klass, void *data) |
523 | e3260506 | Peter A. G. Crosthwaite | { |
524 | e3260506 | Peter A. G. Crosthwaite | DeviceClass *dc = DEVICE_CLASS(klass); |
525 | e3260506 | Peter A. G. Crosthwaite | SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass); |
526 | e3260506 | Peter A. G. Crosthwaite | |
527 | e3260506 | Peter A. G. Crosthwaite | sdc->init = zynq_slcr_init; |
528 | e3260506 | Peter A. G. Crosthwaite | dc->vmsd = &vmstate_zynq_slcr; |
529 | e3260506 | Peter A. G. Crosthwaite | dc->reset = zynq_slcr_reset; |
530 | e3260506 | Peter A. G. Crosthwaite | } |
531 | e3260506 | Peter A. G. Crosthwaite | |
532 | 8c43a6f0 | Andreas Färber | static const TypeInfo zynq_slcr_info = { |
533 | e3260506 | Peter A. G. Crosthwaite | .class_init = zynq_slcr_class_init, |
534 | a054e2c2 | Andreas Färber | .name = TYPE_ZYNQ_SLCR, |
535 | e3260506 | Peter A. G. Crosthwaite | .parent = TYPE_SYS_BUS_DEVICE, |
536 | e3260506 | Peter A. G. Crosthwaite | .instance_size = sizeof(ZynqSLCRState),
|
537 | e3260506 | Peter A. G. Crosthwaite | }; |
538 | e3260506 | Peter A. G. Crosthwaite | |
539 | e3260506 | Peter A. G. Crosthwaite | static void zynq_slcr_register_types(void) |
540 | e3260506 | Peter A. G. Crosthwaite | { |
541 | e3260506 | Peter A. G. Crosthwaite | type_register_static(&zynq_slcr_info); |
542 | e3260506 | Peter A. G. Crosthwaite | } |
543 | e3260506 | Peter A. G. Crosthwaite | |
544 | e3260506 | Peter A. G. Crosthwaite | type_init(zynq_slcr_register_types) |