2 * KZM Board System emulation.
4 * Copyright (c) 2008 OKL and 2011 NICTA
5 * Written by Hans at OK-Labs
6 * Updated by Peter Chubb.
8 * This code is licensed under the GPL, version 2 or later.
9 * See the file `COPYING' in the top level directory.
11 * It (partially) emulates a Kyoto Microcomputer
12 * KZM-ARM11-01 evaluation board, with a Freescale
17 #include "exec-memory.h"
24 #include "pc.h" /* for the FPGA UART that emulates a 16550 */
27 /* Memory map for Kzm Emulation Baseboard:
28 * 0x00000000-0x00003fff 16k secure ROM IGNORED
29 * 0x00004000-0x00407fff Reserved IGNORED
30 * 0x00404000-0x00407fff ROM IGNORED
31 * 0x00408000-0x0fffffff Reserved IGNORED
32 * 0x10000000-0x1fffbfff RAM aliasing IGNORED
33 * 0x1fffc000-0x1fffffff RAM EMULATED
34 * 0x20000000-0x2fffffff Reserved IGNORED
35 * 0x30000000-0x7fffffff I.MX31 Internal Register Space
37 * 0x43f90000 UART1 EMULATED
38 * 0x43f94000 UART2 EMULATED
39 * 0x68000000 AVIC EMULATED
40 * 0x53f80000 CCM EMULATED
41 * 0x53f94000 PIT 1 EMULATED
42 * 0x53f98000 PIT 2 EMULATED
43 * 0x53f90000 GPT EMULATED
44 * 0x80000000-0x87ffffff RAM EMULATED
45 * 0x88000000-0x8fffffff RAM Aliasing EMULATED
46 * 0xa0000000-0xafffffff NAND Flash IGNORED
47 * 0xb0000000-0xb3ffffff Unavailable IGNORED
48 * 0xb4000000-0xb4000fff 8-bit free space IGNORED
49 * 0xb4001000-0xb400100f Board control IGNORED
50 * 0xb4001003 DIP switch
51 * 0xb4001010-0xb400101f 7-segment LED IGNORED
52 * 0xb4001020-0xb400102f LED IGNORED
53 * 0xb4001030-0xb400103f LED IGNORED
54 * 0xb4001040-0xb400104f FPGA, UART EMULATED
55 * 0xb4001050-0xb400105f FPGA, UART EMULATED
56 * 0xb4001060-0xb40fffff FPGA IGNORED
57 * 0xb6000000-0xb61fffff LAN controller EMULATED
58 * 0xb6200000-0xb62fffff FPGA NAND Controller IGNORED
59 * 0xb6300000-0xb7ffffff Free IGNORED
60 * 0xb8000000-0xb8004fff Memory control registers IGNORED
61 * 0xc0000000-0xc3ffffff PCMCIA/CF IGNORED
62 * 0xc4000000-0xffffffff Reserved IGNORED
65 #define KZM_RAMADDRESS (0x80000000)
66 #define KZM_FPGA (0xb4001040)
68 static struct arm_boot_info kzm_binfo
= {
69 .loader_start
= KZM_RAMADDRESS
,
73 static void kzm_init(ram_addr_t ram_size
,
74 const char *boot_device
,
75 const char *kernel_filename
, const char *kernel_cmdline
,
76 const char *initrd_filename
, const char *cpu_model
)
79 MemoryRegion
*address_space_mem
= get_system_memory();
80 MemoryRegion
*ram
= g_new(MemoryRegion
, 1);
81 MemoryRegion
*sram
= g_new(MemoryRegion
, 1);
82 MemoryRegion
*ram_alias
= g_new(MemoryRegion
, 1);
88 cpu_model
= "arm1136";
91 cpu
= cpu_arm_init(cpu_model
);
93 fprintf(stderr
, "Unable to find CPU definition\n");
97 /* On a real system, the first 16k is a `secure boot rom' */
99 memory_region_init_ram(ram
, "kzm.ram", ram_size
);
100 vmstate_register_ram_global(ram
);
101 memory_region_add_subregion(address_space_mem
, KZM_RAMADDRESS
, ram
);
103 memory_region_init_alias(ram_alias
, "ram.alias", ram
, 0, ram_size
);
104 memory_region_add_subregion(address_space_mem
, 0x88000000, ram_alias
);
106 memory_region_init_ram(sram
, "kzm.sram", 0x4000);
107 memory_region_add_subregion(address_space_mem
, 0x1FFFC000, sram
);
109 cpu_pic
= arm_pic_init_cpu(cpu
);
110 dev
= sysbus_create_varargs("imx_avic", 0x68000000,
111 cpu_pic
[ARM_PIC_CPU_IRQ
],
112 cpu_pic
[ARM_PIC_CPU_FIQ
], NULL
);
115 imx_serial_create(0, 0x43f90000, qdev_get_gpio_in(dev
, 45));
116 imx_serial_create(1, 0x43f94000, qdev_get_gpio_in(dev
, 32));
118 ccm
= sysbus_create_simple("imx_ccm", 0x53f80000, NULL
);
120 imx_timerp_create(0x53f94000, qdev_get_gpio_in(dev
, 28), ccm
);
121 imx_timerp_create(0x53f98000, qdev_get_gpio_in(dev
, 27), ccm
);
122 imx_timerg_create(0x53f90000, qdev_get_gpio_in(dev
, 29), ccm
);
124 if (nd_table
[0].used
) {
125 lan9118_init(&nd_table
[0], 0xb6000000, qdev_get_gpio_in(dev
, 52));
128 if (serial_hds
[2]) { /* touchscreen */
129 serial_mm_init(address_space_mem
, KZM_FPGA
+0x10, 0,
130 qdev_get_gpio_in(dev
, 52),
131 14745600, serial_hds
[2],
132 DEVICE_NATIVE_ENDIAN
);
135 kzm_binfo
.ram_size
= ram_size
;
136 kzm_binfo
.kernel_filename
= kernel_filename
;
137 kzm_binfo
.kernel_cmdline
= kernel_cmdline
;
138 kzm_binfo
.initrd_filename
= initrd_filename
;
139 kzm_binfo
.nb_cpus
= 1;
140 arm_load_kernel(cpu
, &kzm_binfo
);
143 static QEMUMachine kzm_machine
= {
145 .desc
= "ARM KZM Emulation Baseboard (ARM1136)",
149 static void kzm_machine_init(void)
151 qemu_register_machine(&kzm_machine
);
154 machine_init(kzm_machine_init
)