2 * Status and system control registers for ARM RealView/Versatile boards.
4 * Copyright (c) 2006 CodeSourcery.
5 * Written by Paul Brook
7 * This code is licenced under the GPL.
13 #define LOCK_VALUE 0xa05f
27 static uint32_t arm_sysctl_read(void *opaque
, target_phys_addr_t offset
)
29 arm_sysctl_state
*s
= (arm_sysctl_state
*)opaque
;
36 /* General purpose hardware switches.
37 We don't have a useful way of exposing these to the user. */
48 case 0x24: /* 100HZ */
49 /* ??? Implement these. */
51 case 0x28: /* CFGDATA1 */
53 case 0x2c: /* CFGDATA2 */
55 case 0x30: /* FLAGS */
57 case 0x38: /* NVFLAGS */
59 case 0x40: /* RESETCTL */
61 case 0x44: /* PCICTL */
65 case 0x4c: /* FLASH */
69 case 0x54: /* CLCDSER */
71 case 0x58: /* BOOTCS */
73 case 0x5c: /* 24MHz */
74 /* ??? not implemented. */
78 case 0x84: /* PROCID0 */
79 /* ??? Don't know what the proper value for the core tile ID is. */
81 case 0x88: /* PROCID1 */
83 case 0x64: /* DMAPSR0 */
84 case 0x68: /* DMAPSR1 */
85 case 0x6c: /* DMAPSR2 */
86 case 0x70: /* IOSEL */
87 case 0x74: /* PLDCTL */
88 case 0x80: /* BUSID */
89 case 0x8c: /* OSCRESET0 */
90 case 0x90: /* OSCRESET1 */
91 case 0x94: /* OSCRESET2 */
92 case 0x98: /* OSCRESET3 */
93 case 0x9c: /* OSCRESET4 */
94 case 0xc0: /* SYS_TEST_OSC0 */
95 case 0xc4: /* SYS_TEST_OSC1 */
96 case 0xc8: /* SYS_TEST_OSC2 */
97 case 0xcc: /* SYS_TEST_OSC3 */
98 case 0xd0: /* SYS_TEST_OSC4 */
101 printf ("arm_sysctl_read: Bad register offset 0x%x\n", (int)offset
);
106 static void arm_sysctl_write(void *opaque
, target_phys_addr_t offset
,
109 arm_sysctl_state
*s
= (arm_sysctl_state
*)opaque
;
115 case 0x0c: /* OSC0 */
116 case 0x10: /* OSC1 */
117 case 0x14: /* OSC2 */
118 case 0x18: /* OSC3 */
119 case 0x1c: /* OSC4 */
122 case 0x20: /* LOCK */
123 if (val
== LOCK_VALUE
)
126 s
->lockval
= val
& 0x7fff;
128 case 0x28: /* CFGDATA1 */
129 /* ??? Need to implement this. */
132 case 0x2c: /* CFGDATA2 */
133 /* ??? Need to implement this. */
136 case 0x30: /* FLAGSSET */
139 case 0x34: /* FLAGSCLR */
142 case 0x38: /* NVFLAGSSET */
145 case 0x3c: /* NVFLAGSCLR */
148 case 0x40: /* RESETCTL */
149 if (s
->lockval
== LOCK_VALUE
) {
152 cpu_abort(cpu_single_env
, "Board reset\n");
155 case 0x44: /* PCICTL */
158 case 0x4c: /* FLASH */
159 case 0x50: /* CLCD */
160 case 0x54: /* CLCDSER */
161 case 0x64: /* DMAPSR0 */
162 case 0x68: /* DMAPSR1 */
163 case 0x6c: /* DMAPSR2 */
164 case 0x70: /* IOSEL */
165 case 0x74: /* PLDCTL */
166 case 0x80: /* BUSID */
167 case 0x84: /* PROCID0 */
168 case 0x88: /* PROCID1 */
169 case 0x8c: /* OSCRESET0 */
170 case 0x90: /* OSCRESET1 */
171 case 0x94: /* OSCRESET2 */
172 case 0x98: /* OSCRESET3 */
173 case 0x9c: /* OSCRESET4 */
176 printf ("arm_sysctl_write: Bad register offset 0x%x\n", (int)offset
);
181 static CPUReadMemoryFunc
*arm_sysctl_readfn
[] = {
187 static CPUWriteMemoryFunc
*arm_sysctl_writefn
[] = {
193 void arm_sysctl_init(uint32_t base
, uint32_t sys_id
)
198 s
= (arm_sysctl_state
*)qemu_mallocz(sizeof(arm_sysctl_state
));
203 iomemtype
= cpu_register_io_memory(0, arm_sysctl_readfn
,
204 arm_sysctl_writefn
, s
);
205 cpu_register_physical_memory(base
, 0x00000fff, iomemtype
);
206 /* ??? Save/restore. */