Convert PXA2xx GPIOs and SCOOP GPIOs to a qemu_irq based api (similar to omap, max731...
[qemu] / hw / gumstix.c
1 /*
2  * Gumstix Platforms
3  *
4  * Copyright (c) 2007 by Thorsten Zitterell <info@bitmux.org>
5  *
6  * Code based on spitz platform by Andrzej Zaborowski <balrog@zabor.org>
7  *
8  * This code is licensed under the GNU GPL v2.
9  */
10
11 #include "vl.h"
12
13 /* Board init. */
14 enum gumstix_model_e { connex };
15
16 static void gumstix_common_init(int ram_size, int vga_ram_size,
17                 DisplayState *ds, const char *kernel_filename,
18                 const char *kernel_cmdline, const char *initrd_filename,
19                 const char *cpu_model, enum gumstix_model_e model)
20 {
21     struct pxa2xx_state_s *cpu;
22
23     uint32_t gumstix_rom = 0x02000000;
24     uint32_t gumstix_ram = 0x08000000;
25
26     if (ram_size < (gumstix_ram + gumstix_rom + PXA2XX_INTERNAL_SIZE)) {
27         fprintf(stderr, "This platform requires %i bytes of memory\n",
28                 gumstix_ram + gumstix_rom + PXA2XX_INTERNAL_SIZE);
29         exit(1);
30     }
31
32     cpu = pxa255_init(gumstix_ram, ds);
33
34     if (pflash_table[0] == NULL) {
35         fprintf(stderr, "A flash image must be given with the "
36                 "'pflash' parameter\n");
37         exit(1);
38     }
39
40     if (!pflash_register(0x00000000, gumstix_ram + PXA2XX_INTERNAL_SIZE,
41             pflash_table[0], 128 * 1024, 128, 2, 0, 0, 0, 0)) {
42         fprintf(stderr, "qemu: Error register flash memory.\n");
43         exit(1);
44     }
45
46     cpu->env->regs[15] = 0x00000000;
47
48     /* Interrupt line of NIC is connected to GPIO line 36 */
49     smc91c111_init(&nd_table[0], 0x04000300,
50                     pxa2xx_gpio_in_get(cpu->gpio)[36]);
51 }
52
53 static void connex_init(int ram_size, int vga_ram_size,
54                 const char *boot_device, DisplayState *ds,
55                 const char **fd_filename, int snapshot,
56                 const char *kernel_filename, const char *kernel_cmdline,
57                 const char *initrd_filename, const char *cpu_model)
58 {
59     gumstix_common_init(ram_size, vga_ram_size, ds, kernel_filename,
60                 kernel_cmdline, initrd_filename, cpu_model, connex);
61 }
62
63 QEMUMachine connex_machine = {
64     "connex",
65     "Gumstix Connex (PXA255)",
66     connex_init,
67 };