]>
Commit | Line | Data |
---|---|---|
05ee37eb AZ |
1 | /* |
2 | * Gumstix Platforms | |
3 | * | |
4 | * Copyright (c) 2007 by Thorsten Zitterell <[email protected]> | |
5 | * | |
6 | * Code based on spitz platform by Andrzej Zaborowski <[email protected]> | |
7 | * | |
8 | * This code is licensed under the GNU GPL v2. | |
6b620ca3 PB |
9 | * |
10 | * Contributions after 2012-01-13 are licensed under the terms of the | |
11 | * GNU GPL, version 2 or (at your option) any later version. | |
05ee37eb | 12 | */ |
3e3f6754 AZ |
13 | |
14 | /* | |
15 | * Example usage: | |
16 | * | |
17 | * connex: | |
18 | * ======= | |
19 | * create image: | |
20 | * # dd of=flash bs=1k count=16k if=/dev/zero | |
21 | * # dd of=flash bs=1k conv=notrunc if=u-boot.bin | |
22 | * # dd of=flash bs=1k conv=notrunc seek=256 if=rootfs.arm_nofpu.jffs2 | |
23 | * start it: | |
24 | * # qemu-system-arm -M connex -pflash flash -monitor null -nographic | |
25 | * | |
26 | * verdex: | |
27 | * ======= | |
28 | * create image: | |
29 | * # dd of=flash bs=1k count=32k if=/dev/zero | |
30 | * # dd of=flash bs=1k conv=notrunc if=u-boot.bin | |
31 | * # dd of=flash bs=1k conv=notrunc seek=256 if=rootfs.arm_nofpu.jffs2 | |
32 | * # dd of=flash bs=1k conv=notrunc seek=31744 if=uImage | |
33 | * start it: | |
34 | * # qemu-system-arm -M verdex -pflash flash -monitor null -nographic -m 289 | |
35 | */ | |
05ee37eb | 36 | |
83c9f4ca | 37 | #include "hw/hw.h" |
0d09e41a | 38 | #include "hw/arm/pxa.h" |
1422e32d | 39 | #include "net/net.h" |
0d09e41a | 40 | #include "hw/block/flash.h" |
bd2be150 | 41 | #include "hw/devices.h" |
83c9f4ca | 42 | #include "hw/boards.h" |
9c17d615 | 43 | #include "sysemu/blockdev.h" |
022c62cb | 44 | #include "exec/address-spaces.h" |
bdf921d6 | 45 | #include "sysemu/qtest.h" |
05ee37eb | 46 | |
1fc678cc AZ |
47 | static const int sector_len = 128 * 1024; |
48 | ||
5f072e1f | 49 | static void connex_init(QEMUMachineInitArgs *args) |
05ee37eb | 50 | { |
bc24a225 | 51 | PXA2xxState *cpu; |
751c6a17 | 52 | DriveInfo *dinfo; |
01e0451a | 53 | int be; |
a6dc4c2d | 54 | MemoryRegion *address_space_mem = get_system_memory(); |
05ee37eb | 55 | |
3e3f6754 AZ |
56 | uint32_t connex_rom = 0x01000000; |
57 | uint32_t connex_ram = 0x04000000; | |
05ee37eb | 58 | |
a6dc4c2d | 59 | cpu = pxa255_init(address_space_mem, connex_ram); |
05ee37eb | 60 | |
751c6a17 | 61 | dinfo = drive_get(IF_PFLASH, 0, 0); |
bdf921d6 | 62 | if (!dinfo && !qtest_enabled()) { |
05ee37eb AZ |
63 | fprintf(stderr, "A flash image must be given with the " |
64 | "'pflash' parameter\n"); | |
65 | exit(1); | |
66 | } | |
67 | ||
3d08ff69 | 68 | #ifdef TARGET_WORDS_BIGENDIAN |
01e0451a | 69 | be = 1; |
3d08ff69 | 70 | #else |
01e0451a | 71 | be = 0; |
3d08ff69 | 72 | #endif |
cfe5f011 | 73 | if (!pflash_cfi01_register(0x00000000, NULL, "connext.rom", connex_rom, |
bdf921d6 AF |
74 | dinfo ? dinfo->bdrv : NULL, |
75 | sector_len, connex_rom / sector_len, | |
01e0451a | 76 | 2, 0, 0, 0, 0, be)) { |
3e3f6754 | 77 | fprintf(stderr, "qemu: Error registering flash memory.\n"); |
05ee37eb AZ |
78 | exit(1); |
79 | } | |
80 | ||
5697ff6b | 81 | /* Interrupt line of NIC is connected to GPIO line 36 */ |
38641a52 | 82 | smc91c111_init(&nd_table[0], 0x04000300, |
0bb53337 | 83 | qdev_get_gpio_in(cpu->gpio, 36)); |
05ee37eb AZ |
84 | } |
85 | ||
5f072e1f | 86 | static void verdex_init(QEMUMachineInitArgs *args) |
05ee37eb | 87 | { |
5f072e1f | 88 | const char *cpu_model = args->cpu_model; |
bc24a225 | 89 | PXA2xxState *cpu; |
751c6a17 | 90 | DriveInfo *dinfo; |
01e0451a | 91 | int be; |
a6dc4c2d | 92 | MemoryRegion *address_space_mem = get_system_memory(); |
3e3f6754 AZ |
93 | |
94 | uint32_t verdex_rom = 0x02000000; | |
95 | uint32_t verdex_ram = 0x10000000; | |
96 | ||
a6dc4c2d | 97 | cpu = pxa270_init(address_space_mem, verdex_ram, cpu_model ?: "pxa270-c0"); |
3e3f6754 | 98 | |
751c6a17 | 99 | dinfo = drive_get(IF_PFLASH, 0, 0); |
bdf921d6 | 100 | if (!dinfo && !qtest_enabled()) { |
3e3f6754 AZ |
101 | fprintf(stderr, "A flash image must be given with the " |
102 | "'pflash' parameter\n"); | |
103 | exit(1); | |
104 | } | |
105 | ||
3d08ff69 | 106 | #ifdef TARGET_WORDS_BIGENDIAN |
01e0451a | 107 | be = 1; |
3d08ff69 | 108 | #else |
01e0451a | 109 | be = 0; |
3d08ff69 | 110 | #endif |
cfe5f011 | 111 | if (!pflash_cfi01_register(0x00000000, NULL, "verdex.rom", verdex_rom, |
bdf921d6 AF |
112 | dinfo ? dinfo->bdrv : NULL, |
113 | sector_len, verdex_rom / sector_len, | |
01e0451a | 114 | 2, 0, 0, 0, 0, be)) { |
3e3f6754 AZ |
115 | fprintf(stderr, "qemu: Error registering flash memory.\n"); |
116 | exit(1); | |
117 | } | |
118 | ||
3e3f6754 AZ |
119 | /* Interrupt line of NIC is connected to GPIO line 99 */ |
120 | smc91c111_init(&nd_table[0], 0x04000300, | |
0bb53337 | 121 | qdev_get_gpio_in(cpu->gpio, 99)); |
05ee37eb AZ |
122 | } |
123 | ||
f80f9ec9 | 124 | static QEMUMachine connex_machine = { |
4b32e168 AL |
125 | .name = "connex", |
126 | .desc = "Gumstix Connex (PXA255)", | |
127 | .init = connex_init, | |
05ee37eb | 128 | }; |
3e3f6754 | 129 | |
f80f9ec9 | 130 | static QEMUMachine verdex_machine = { |
4b32e168 AL |
131 | .name = "verdex", |
132 | .desc = "Gumstix Verdex (PXA270)", | |
133 | .init = verdex_init, | |
3e3f6754 | 134 | }; |
f80f9ec9 AL |
135 | |
136 | static void gumstix_machine_init(void) | |
137 | { | |
138 | qemu_register_machine(&connex_machine); | |
139 | qemu_register_machine(&verdex_machine); | |
140 | } | |
141 | ||
142 | machine_init(gumstix_machine_init); |