root / hw / gumstix.c @ eb173de6
History | View | Annotate | Download (4 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 | 00f82b8a | aurel32 | static void connex_init(ram_addr_t ram_size, int vga_ram_size, |
45 | 3e3f6754 | balrog | const char *boot_device, DisplayState *ds, |
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 | 05ee37eb | balrog | struct pxa2xx_state_s *cpu;
|
50 | e4bcb14c | ths | int index;
|
51 | 05ee37eb | balrog | |
52 | 3e3f6754 | balrog | uint32_t connex_rom = 0x01000000;
|
53 | 3e3f6754 | balrog | uint32_t connex_ram = 0x04000000;
|
54 | 05ee37eb | balrog | |
55 | 3e3f6754 | balrog | if (ram_size < (connex_ram + connex_rom + PXA2XX_INTERNAL_SIZE)) {
|
56 | 05ee37eb | balrog | fprintf(stderr, "This platform requires %i bytes of memory\n",
|
57 | 3e3f6754 | balrog | connex_ram + connex_rom + PXA2XX_INTERNAL_SIZE); |
58 | 05ee37eb | balrog | exit(1);
|
59 | 05ee37eb | balrog | } |
60 | 05ee37eb | balrog | |
61 | 3e3f6754 | balrog | cpu = pxa255_init(connex_ram, ds); |
62 | 05ee37eb | balrog | |
63 | e4bcb14c | ths | index = drive_get_index(IF_PFLASH, 0, 0); |
64 | e4bcb14c | ths | if (index == -1) { |
65 | 05ee37eb | balrog | fprintf(stderr, "A flash image must be given with the "
|
66 | 05ee37eb | balrog | "'pflash' parameter\n");
|
67 | 05ee37eb | balrog | exit(1);
|
68 | 05ee37eb | balrog | } |
69 | 05ee37eb | balrog | |
70 | 88eeee0a | balrog | if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(connex_rom), |
71 | e4bcb14c | ths | drives_table[index].bdrv, sector_len, connex_rom / sector_len, |
72 | 1fc678cc | balrog | 2, 0, 0, 0, 0)) { |
73 | 3e3f6754 | balrog | fprintf(stderr, "qemu: Error registering flash memory.\n");
|
74 | 05ee37eb | balrog | exit(1);
|
75 | 05ee37eb | balrog | } |
76 | 05ee37eb | balrog | |
77 | 05ee37eb | balrog | cpu->env->regs[15] = 0x00000000; |
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 | 38641a52 | balrog | pxa2xx_gpio_in_get(cpu->gpio)[36]);
|
82 | 05ee37eb | balrog | } |
83 | 05ee37eb | balrog | |
84 | 00f82b8a | aurel32 | static void verdex_init(ram_addr_t ram_size, int vga_ram_size, |
85 | 05ee37eb | balrog | const char *boot_device, DisplayState *ds, |
86 | 05ee37eb | balrog | const char *kernel_filename, const char *kernel_cmdline, |
87 | 05ee37eb | balrog | const char *initrd_filename, const char *cpu_model) |
88 | 05ee37eb | balrog | { |
89 | 3e3f6754 | balrog | struct pxa2xx_state_s *cpu;
|
90 | e4bcb14c | ths | int index;
|
91 | 3e3f6754 | balrog | |
92 | 3e3f6754 | balrog | uint32_t verdex_rom = 0x02000000;
|
93 | 3e3f6754 | balrog | uint32_t verdex_ram = 0x10000000;
|
94 | 3e3f6754 | balrog | |
95 | 3e3f6754 | balrog | if (ram_size < (verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE)) {
|
96 | 3e3f6754 | balrog | fprintf(stderr, "This platform requires %i bytes of memory\n",
|
97 | 3e3f6754 | balrog | verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE); |
98 | 3e3f6754 | balrog | exit(1);
|
99 | 3e3f6754 | balrog | } |
100 | 3e3f6754 | balrog | |
101 | 1fc678cc | balrog | cpu = pxa270_init(verdex_ram, ds, cpu_model ?: "pxa270-c0");
|
102 | 3e3f6754 | balrog | |
103 | e4bcb14c | ths | index = drive_get_index(IF_PFLASH, 0, 0); |
104 | e4bcb14c | ths | if (index == -1) { |
105 | 3e3f6754 | balrog | fprintf(stderr, "A flash image must be given with the "
|
106 | 3e3f6754 | balrog | "'pflash' parameter\n");
|
107 | 3e3f6754 | balrog | exit(1);
|
108 | 3e3f6754 | balrog | } |
109 | 3e3f6754 | balrog | |
110 | 88eeee0a | balrog | if (!pflash_cfi01_register(0x00000000, qemu_ram_alloc(verdex_rom), |
111 | e4bcb14c | ths | drives_table[index].bdrv, sector_len, verdex_rom / sector_len, |
112 | 1fc678cc | balrog | 2, 0, 0, 0, 0)) { |
113 | 3e3f6754 | balrog | fprintf(stderr, "qemu: Error registering flash memory.\n");
|
114 | 3e3f6754 | balrog | exit(1);
|
115 | 3e3f6754 | balrog | } |
116 | 3e3f6754 | balrog | |
117 | 3e3f6754 | balrog | cpu->env->regs[15] = 0x00000000; |
118 | 3e3f6754 | balrog | |
119 | 3e3f6754 | balrog | /* Interrupt line of NIC is connected to GPIO line 99 */
|
120 | 3e3f6754 | balrog | smc91c111_init(&nd_table[0], 0x04000300, |
121 | 3e3f6754 | balrog | pxa2xx_gpio_in_get(cpu->gpio)[99]);
|
122 | 05ee37eb | balrog | } |
123 | 05ee37eb | balrog | |
124 | 05ee37eb | balrog | QEMUMachine connex_machine = { |
125 | 05ee37eb | balrog | "connex",
|
126 | 05ee37eb | balrog | "Gumstix Connex (PXA255)",
|
127 | 05ee37eb | balrog | connex_init, |
128 | 7fb4fdcf | balrog | (0x05000000 + PXA2XX_INTERNAL_SIZE) | RAMSIZE_FIXED,
|
129 | 05ee37eb | balrog | }; |
130 | 3e3f6754 | balrog | |
131 | 3e3f6754 | balrog | QEMUMachine verdex_machine = { |
132 | 3e3f6754 | balrog | "verdex",
|
133 | 3e3f6754 | balrog | "Gumstix Verdex (PXA270)",
|
134 | 3e3f6754 | balrog | verdex_init, |
135 | 7fb4fdcf | balrog | (0x12000000 + PXA2XX_INTERNAL_SIZE) | RAMSIZE_FIXED,
|
136 | 3e3f6754 | balrog | }; |