Statistics
| Branch: | Revision:

root / hw / gumstix.c @ 3e3f6754

History | View | Annotate | Download (3.7 kB)

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
/* 
12
 * Example usage:
13
 * 
14
 * connex:
15
 * =======
16
 * create image:
17
 * # dd of=flash bs=1k count=16k if=/dev/zero
18
 * # dd of=flash bs=1k conv=notrunc if=u-boot.bin
19
 * # dd of=flash bs=1k conv=notrunc seek=256 if=rootfs.arm_nofpu.jffs2
20
 * start it:
21
 * # qemu-system-arm -M connex -pflash flash -monitor null -nographic
22
 *
23
 * verdex:
24
 * =======
25
 * create image:
26
 * # dd of=flash bs=1k count=32k if=/dev/zero
27
 * # dd of=flash bs=1k conv=notrunc if=u-boot.bin
28
 * # dd of=flash bs=1k conv=notrunc seek=256 if=rootfs.arm_nofpu.jffs2
29
 * # dd of=flash bs=1k conv=notrunc seek=31744 if=uImage
30
 * start it:
31
 * # qemu-system-arm -M verdex -pflash flash -monitor null -nographic -m 289
32
 */
33

    
34
#include "hw.h"
35
#include "pxa.h"
36
#include "net.h"
37
#include "flash.h"
38
#include "sysemu.h"
39
#include "devices.h"
40
#include "boards.h"
41

    
42
static void connex_init(int ram_size, int vga_ram_size,
43
                const char *boot_device, DisplayState *ds,
44
                const char **fd_filename, int snapshot,
45
                const char *kernel_filename, const char *kernel_cmdline,
46
                const char *initrd_filename, const char *cpu_model)
47
{
48
    struct pxa2xx_state_s *cpu;
49

    
50
    uint32_t connex_rom = 0x01000000;
51
    uint32_t connex_ram = 0x04000000;
52

    
53
    if (ram_size < (connex_ram + connex_rom + PXA2XX_INTERNAL_SIZE)) {
54
        fprintf(stderr, "This platform requires %i bytes of memory\n",
55
                connex_ram + connex_rom + PXA2XX_INTERNAL_SIZE);
56
        exit(1);
57
    }
58

    
59
    cpu = pxa255_init(connex_ram, ds);
60

    
61
    if (pflash_table[0] == NULL) {
62
        fprintf(stderr, "A flash image must be given with the "
63
                "'pflash' parameter\n");
64
        exit(1);
65
    }
66

    
67
    if (!pflash_register(0x00000000, connex_ram + PXA2XX_INTERNAL_SIZE,
68
            pflash_table[0], 128 * 1024, 128, 2, 0, 0, 0, 0)) {
69
        fprintf(stderr, "qemu: Error registering flash memory.\n");
70
        exit(1);
71
    }
72

    
73
    cpu->env->regs[15] = 0x00000000;
74

    
75
    /* Interrupt line of NIC is connected to GPIO line 36 */
76
    smc91c111_init(&nd_table[0], 0x04000300,
77
                    pxa2xx_gpio_in_get(cpu->gpio)[36]);
78
}
79

    
80
static void verdex_init(int ram_size, int vga_ram_size,
81
                const char *boot_device, DisplayState *ds,
82
                const char *kernel_filename, const char *kernel_cmdline,
83
                const char *initrd_filename, const char *cpu_model)
84
{
85
    struct pxa2xx_state_s *cpu;
86

    
87
    uint32_t verdex_rom = 0x02000000;
88
    uint32_t verdex_ram = 0x10000000;
89

    
90
    if (ram_size < (verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE)) {
91
        fprintf(stderr, "This platform requires %i bytes of memory\n",
92
                verdex_ram + verdex_rom + PXA2XX_INTERNAL_SIZE);
93
        exit(1);
94
    }
95

    
96
    cpu = pxa270_init(verdex_ram, ds, "pxa270-c0");
97

    
98
    if (pflash_table[0] == NULL) {
99
        fprintf(stderr, "A flash image must be given with the "
100
                "'pflash' parameter\n");
101
        exit(1);
102
    }
103

    
104
    if (!pflash_register(0x00000000, verdex_ram + PXA2XX_INTERNAL_SIZE,
105
            pflash_table[0], 128 * 1024, 256, 2, 0, 0, 0, 0)) {
106
        fprintf(stderr, "qemu: Error registering flash memory.\n");
107
        exit(1);
108
    }
109

    
110
    cpu->env->regs[15] = 0x00000000;
111

    
112
    /* Interrupt line of NIC is connected to GPIO line 99 */
113
    smc91c111_init(&nd_table[0], 0x04000300,
114
                    pxa2xx_gpio_in_get(cpu->gpio)[99]);
115
}
116

    
117
QEMUMachine connex_machine = {
118
    "connex",
119
    "Gumstix Connex (PXA255)",
120
    connex_init,
121
};
122

    
123
QEMUMachine verdex_machine = {
124
    "verdex",
125
    "Gumstix Verdex (PXA270)",
126
    verdex_init,
127
};