Fix connex board init routine.
[qemu/mini2440.git] / hw / gumstix.c
blob8247156620389bc4c31ce6351cce78612d8459a2
1 /*
2 * Gumstix Platforms
4 * Copyright (c) 2007 by Thorsten Zitterell <info@bitmux.org>
6 * Code based on spitz platform by Andrzej Zaborowski <balrog@zabor.org>
8 * This code is licensed under the GNU GPL v2.
9 */
11 #include "hw.h"
12 #include "pxa.h"
13 #include "net.h"
14 #include "flash.h"
15 #include "sysemu.h"
16 #include "devices.h"
17 #include "boards.h"
19 /* Board init. */
20 enum gumstix_model_e { connex };
22 static void gumstix_common_init(int ram_size, int vga_ram_size,
23 DisplayState *ds, const char *kernel_filename,
24 const char *kernel_cmdline, const char *initrd_filename,
25 const char *cpu_model, enum gumstix_model_e model)
27 struct pxa2xx_state_s *cpu;
29 uint32_t gumstix_rom = 0x02000000;
30 uint32_t gumstix_ram = 0x08000000;
32 if (ram_size < (gumstix_ram + gumstix_rom + PXA2XX_INTERNAL_SIZE)) {
33 fprintf(stderr, "This platform requires %i bytes of memory\n",
34 gumstix_ram + gumstix_rom + PXA2XX_INTERNAL_SIZE);
35 exit(1);
38 cpu = pxa255_init(gumstix_ram, ds);
40 if (pflash_table[0] == NULL) {
41 fprintf(stderr, "A flash image must be given with the "
42 "'pflash' parameter\n");
43 exit(1);
46 if (!pflash_register(0x00000000, gumstix_ram + PXA2XX_INTERNAL_SIZE,
47 pflash_table[0], 128 * 1024, 128, 2, 0, 0, 0, 0)) {
48 fprintf(stderr, "qemu: Error register flash memory.\n");
49 exit(1);
52 cpu->env->regs[15] = 0x00000000;
54 /* Interrupt line of NIC is connected to GPIO line 36 */
55 smc91c111_init(&nd_table[0], 0x04000300,
56 pxa2xx_gpio_in_get(cpu->gpio)[36]);
59 static void connex_init(int ram_size, int vga_ram_size,
60 const char *boot_device, DisplayState *ds,
61 const char *kernel_filename, const char *kernel_cmdline,
62 const char *initrd_filename, const char *cpu_model)
64 gumstix_common_init(ram_size, vga_ram_size, ds, kernel_filename,
65 kernel_cmdline, initrd_filename, cpu_model, connex);
68 QEMUMachine connex_machine = {
69 "connex",
70 "Gumstix Connex (PXA255)",
71 connex_init,