]>
Commit | Line | Data |
---|---|---|
c64b21d5 DES |
1 | /* |
2 | * SA-1110-based Sharp Zaurus SL-5500 platform. | |
3 | * | |
4 | * Copyright (C) 2011 Dmitry Eremin-Solenikov | |
5 | * | |
6 | * This code is licensed under GNU GPL v2. | |
6b620ca3 PB |
7 | * |
8 | * Contributions after 2012-01-13 are licensed under the terms of the | |
9 | * GNU GPL, version 2 or (at your option) any later version. | |
c64b21d5 | 10 | */ |
12b16722 | 11 | #include "qemu/osdep.h" |
ce14710f | 12 | #include "qemu/units.h" |
00b9829f | 13 | #include "qemu/cutils.h" |
83c9f4ca PB |
14 | #include "hw/sysbus.h" |
15 | #include "hw/boards.h" | |
47b43a1f | 16 | #include "strongarm.h" |
12ec8bd5 | 17 | #include "hw/arm/boot.h" |
0d09e41a | 18 | #include "hw/block/flash.h" |
022c62cb | 19 | #include "exec/address-spaces.h" |
ba1ba5cc | 20 | #include "cpu.h" |
db1015e9 | 21 | #include "qom/object.h" |
c64b21d5 | 22 | |
db1015e9 | 23 | struct CollieMachineState { |
8a2b76ff PM |
24 | MachineState parent; |
25 | ||
26 | StrongARMState *sa1110; | |
db1015e9 | 27 | }; |
8a2b76ff PM |
28 | |
29 | #define TYPE_COLLIE_MACHINE MACHINE_TYPE_NAME("collie") | |
8063396b | 30 | OBJECT_DECLARE_SIMPLE_TYPE(CollieMachineState, COLLIE_MACHINE) |
8a2b76ff | 31 | |
c64b21d5 DES |
32 | static struct arm_boot_info collie_binfo = { |
33 | .loader_start = SA_SDCS0, | |
34 | .ram_size = 0x20000000, | |
35 | }; | |
36 | ||
3ef96221 | 37 | static void collie_init(MachineState *machine) |
c64b21d5 | 38 | { |
c64b21d5 | 39 | DriveInfo *dinfo; |
00b9829f | 40 | MachineClass *mc = MACHINE_GET_CLASS(machine); |
8a2b76ff | 41 | CollieMachineState *cms = COLLIE_MACHINE(machine); |
00b9829f IM |
42 | |
43 | if (machine->ram_size != mc->default_ram_size) { | |
44 | char *sz = size_to_str(mc->default_ram_size); | |
45 | error_report("Invalid RAM size, should be %s", sz); | |
46 | g_free(sz); | |
47 | exit(EXIT_FAILURE); | |
48 | } | |
c64b21d5 | 49 | |
8a2b76ff | 50 | cms->sa1110 = sa1110_init(machine->cpu_type); |
3cd892da | 51 | |
00b9829f | 52 | memory_region_add_subregion(get_system_memory(), SA_SDCS0, machine->ram); |
c64b21d5 | 53 | |
c64b21d5 | 54 | dinfo = drive_get(IF_PFLASH, 0, 0); |
940d5b13 | 55 | pflash_cfi01_register(SA_CS0, "collie.fl1", 0x02000000, |
4be74634 | 56 | dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, |
ce14710f | 57 | 64 * KiB, 4, 0x00, 0x00, 0x00, 0x00, 0); |
c64b21d5 | 58 | |
c64b21d5 | 59 | dinfo = drive_get(IF_PFLASH, 0, 1); |
940d5b13 | 60 | pflash_cfi01_register(SA_CS1, "collie.fl2", 0x02000000, |
4be74634 | 61 | dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, |
ce14710f | 62 | 64 * KiB, 4, 0x00, 0x00, 0x00, 0x00, 0); |
c64b21d5 DES |
63 | |
64 | sysbus_create_simple("scoop", 0x40800000, NULL); | |
65 | ||
c64b21d5 | 66 | collie_binfo.board_id = 0x208; |
8a2b76ff | 67 | arm_load_kernel(cms->sa1110->cpu, machine, &collie_binfo); |
c64b21d5 DES |
68 | } |
69 | ||
8a2b76ff | 70 | static void collie_machine_class_init(ObjectClass *oc, void *data) |
c64b21d5 | 71 | { |
8a2b76ff PM |
72 | MachineClass *mc = MACHINE_CLASS(oc); |
73 | ||
ad1e8db8 | 74 | mc->desc = "Sharp SL-5500 (Collie) PDA (SA-1110)"; |
e264d29d | 75 | mc->init = collie_init; |
4672cbd7 | 76 | mc->ignore_memory_transaction_failures = true; |
ba1ba5cc | 77 | mc->default_cpu_type = ARM_CPU_TYPE_NAME("sa1110"); |
00b9829f IM |
78 | mc->default_ram_size = 0x20000000; |
79 | mc->default_ram_id = "strongarm.sdram"; | |
c64b21d5 DES |
80 | } |
81 | ||
8a2b76ff PM |
82 | static const TypeInfo collie_machine_typeinfo = { |
83 | .name = TYPE_COLLIE_MACHINE, | |
84 | .parent = TYPE_MACHINE, | |
85 | .class_init = collie_machine_class_init, | |
86 | .instance_size = sizeof(CollieMachineState), | |
87 | }; | |
88 | ||
89 | static void collie_machine_register_types(void) | |
90 | { | |
91 | type_register_static(&collie_machine_typeinfo); | |
92 | } | |
93 | type_init(collie_machine_register_types); |