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