root / hw / gumstix.c @ 8cb310e1
History | View | Annotate | Download (3.5 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 | 05ee37eb | balrog | */
|
10 | 3e3f6754 | balrog | |
11 | 3e3f6754 | balrog | /*
|
12 | 3e3f6754 | balrog | * Example usage:
|
13 | 3e3f6754 | balrog | *
|
14 | 3e3f6754 | balrog | * connex:
|
15 | 3e3f6754 | balrog | * =======
|
16 | 3e3f6754 | balrog | * create image:
|
17 | 3e3f6754 | balrog | * # dd of=flash bs=1k count=16k if=/dev/zero
|
18 | 3e3f6754 | balrog | * # dd of=flash bs=1k conv=notrunc if=u-boot.bin
|
19 | 3e3f6754 | balrog | * # dd of=flash bs=1k conv=notrunc seek=256 if=rootfs.arm_nofpu.jffs2
|
20 | 3e3f6754 | balrog | * start it:
|
21 | 3e3f6754 | balrog | * # qemu-system-arm -M connex -pflash flash -monitor null -nographic
|
22 | 3e3f6754 | balrog | *
|
23 | 3e3f6754 | balrog | * verdex:
|
24 | 3e3f6754 | balrog | * =======
|
25 | 3e3f6754 | balrog | * create image:
|
26 | 3e3f6754 | balrog | * # dd of=flash bs=1k count=32k if=/dev/zero
|
27 | 3e3f6754 | balrog | * # dd of=flash bs=1k conv=notrunc if=u-boot.bin
|
28 | 3e3f6754 | balrog | * # dd of=flash bs=1k conv=notrunc seek=256 if=rootfs.arm_nofpu.jffs2
|
29 | 3e3f6754 | balrog | * # dd of=flash bs=1k conv=notrunc seek=31744 if=uImage
|
30 | 3e3f6754 | balrog | * start it:
|
31 | 3e3f6754 | balrog | * # qemu-system-arm -M verdex -pflash flash -monitor null -nographic -m 289
|
32 | 3e3f6754 | balrog | */
|
33 | 05ee37eb | balrog | |
34 | 87ecb68b | pbrook | #include "hw.h" |
35 | 87ecb68b | pbrook | #include "pxa.h" |
36 | 87ecb68b | pbrook | #include "net.h" |
37 | 87ecb68b | pbrook | #include "flash.h" |
38 | 87ecb68b | pbrook | #include "sysemu.h" |
39 | 87ecb68b | pbrook | #include "devices.h" |
40 | 87ecb68b | pbrook | #include "boards.h" |
41 | 05ee37eb | balrog | |
42 | 1fc678cc | balrog | static const int sector_len = 128 * 1024; |
43 | 1fc678cc | balrog | |
44 | c227f099 | Anthony Liguori | static void connex_init(ram_addr_t ram_size, |
45 | 3023f332 | aliguori | const char *boot_device, |
46 | 3e3f6754 | balrog | const char *kernel_filename, const char *kernel_cmdline, |
47 | 3e3f6754 | balrog | const char *initrd_filename, const char *cpu_model) |
48 | 05ee37eb | balrog | { |
49 | bc24a225 | Paul Brook | PXA2xxState *cpu; |
50 | 751c6a17 | Gerd Hoffmann | DriveInfo *dinfo; |
51 | 05ee37eb | balrog | |
52 | 3e3f6754 | balrog | uint32_t connex_rom = 0x01000000;
|
53 | 3e3f6754 | balrog | uint32_t connex_ram = 0x04000000;
|
54 | 05ee37eb | balrog | |
55 | 3023f332 | aliguori | cpu = pxa255_init(connex_ram); |
56 | 05ee37eb | balrog | |
57 | 751c6a17 | Gerd Hoffmann | dinfo = drive_get(IF_PFLASH, 0, 0); |
58 | 751c6a17 | Gerd Hoffmann | if (!dinfo) {
|
59 | 05ee37eb | balrog | fprintf(stderr, "A flash image must be given with the "
|
60 | 05ee37eb | balrog | "'pflash' parameter\n");
|
61 | 05ee37eb | balrog | exit(1);
|
62 | 05ee37eb | balrog | } |
63 | 05ee37eb | balrog | |
64 | 88eeee0a | balrog | if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(connex_rom), |
65 | 751c6a17 | Gerd Hoffmann | dinfo->bdrv, sector_len, connex_rom / sector_len, |
66 | 1fc678cc | balrog | 2, 0, 0, 0, 0)) { |
67 | 3e3f6754 | balrog | fprintf(stderr, "qemu: Error registering flash memory.\n");
|
68 | 05ee37eb | balrog | exit(1);
|
69 | 05ee37eb | balrog | } |
70 | 05ee37eb | balrog | |
71 | 05ee37eb | balrog | cpu->env->regs[15] = 0x00000000; |
72 | 05ee37eb | balrog | |
73 | 5697ff6b | balrog | /* Interrupt line of NIC is connected to GPIO line 36 */
|
74 | 38641a52 | balrog | smc91c111_init(&nd_table[0], 0x04000300, |
75 | 38641a52 | balrog | pxa2xx_gpio_in_get(cpu->gpio)[36]);
|
76 | 05ee37eb | balrog | } |
77 | 05ee37eb | balrog | |
78 | c227f099 | Anthony Liguori | static void verdex_init(ram_addr_t ram_size, |
79 | 3023f332 | aliguori | const char *boot_device, |
80 | 05ee37eb | balrog | const char *kernel_filename, const char *kernel_cmdline, |
81 | 05ee37eb | balrog | const char *initrd_filename, const char *cpu_model) |
82 | 05ee37eb | balrog | { |
83 | bc24a225 | Paul Brook | PXA2xxState *cpu; |
84 | 751c6a17 | Gerd Hoffmann | DriveInfo *dinfo; |
85 | 3e3f6754 | balrog | |
86 | 3e3f6754 | balrog | uint32_t verdex_rom = 0x02000000;
|
87 | 3e3f6754 | balrog | uint32_t verdex_ram = 0x10000000;
|
88 | 3e3f6754 | balrog | |
89 | 3023f332 | aliguori | cpu = pxa270_init(verdex_ram, cpu_model ?: "pxa270-c0");
|
90 | 3e3f6754 | balrog | |
91 | 751c6a17 | Gerd Hoffmann | dinfo = drive_get(IF_PFLASH, 0, 0); |
92 | 751c6a17 | Gerd Hoffmann | if (!dinfo) {
|
93 | 3e3f6754 | balrog | fprintf(stderr, "A flash image must be given with the "
|
94 | 3e3f6754 | balrog | "'pflash' parameter\n");
|
95 | 3e3f6754 | balrog | exit(1);
|
96 | 3e3f6754 | balrog | } |
97 | 3e3f6754 | balrog | |
98 | 88eeee0a | balrog | if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(verdex_rom), |
99 | 751c6a17 | Gerd Hoffmann | dinfo->bdrv, sector_len, verdex_rom / sector_len, |
100 | 1fc678cc | balrog | 2, 0, 0, 0, 0)) { |
101 | 3e3f6754 | balrog | fprintf(stderr, "qemu: Error registering flash memory.\n");
|
102 | 3e3f6754 | balrog | exit(1);
|
103 | 3e3f6754 | balrog | } |
104 | 3e3f6754 | balrog | |
105 | 3e3f6754 | balrog | cpu->env->regs[15] = 0x00000000; |
106 | 3e3f6754 | balrog | |
107 | 3e3f6754 | balrog | /* Interrupt line of NIC is connected to GPIO line 99 */
|
108 | 3e3f6754 | balrog | smc91c111_init(&nd_table[0], 0x04000300, |
109 | 3e3f6754 | balrog | pxa2xx_gpio_in_get(cpu->gpio)[99]);
|
110 | 05ee37eb | balrog | } |
111 | 05ee37eb | balrog | |
112 | f80f9ec9 | Anthony Liguori | static QEMUMachine connex_machine = {
|
113 | 4b32e168 | aliguori | .name = "connex",
|
114 | 4b32e168 | aliguori | .desc = "Gumstix Connex (PXA255)",
|
115 | 4b32e168 | aliguori | .init = connex_init, |
116 | 05ee37eb | balrog | }; |
117 | 3e3f6754 | balrog | |
118 | f80f9ec9 | Anthony Liguori | static QEMUMachine verdex_machine = {
|
119 | 4b32e168 | aliguori | .name = "verdex",
|
120 | 4b32e168 | aliguori | .desc = "Gumstix Verdex (PXA270)",
|
121 | 4b32e168 | aliguori | .init = verdex_init, |
122 | 3e3f6754 | balrog | }; |
123 | f80f9ec9 | Anthony Liguori | |
124 | f80f9ec9 | Anthony Liguori | static void gumstix_machine_init(void) |
125 | f80f9ec9 | Anthony Liguori | { |
126 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&connex_machine); |
127 | f80f9ec9 | Anthony Liguori | qemu_register_machine(&verdex_machine); |
128 | f80f9ec9 | Anthony Liguori | } |
129 | f80f9ec9 | Anthony Liguori | |
130 | f80f9ec9 | Anthony Liguori | machine_init(gumstix_machine_init); |