~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to hw/nseries.c

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * GNU General Public License for more details.
16
16
 *
17
17
 * You should have received a copy of the GNU General Public License along
18
 
 * with this program; if not, write to the Free Software Foundation, Inc.,
19
 
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
18
 * with this program; if not, see <http://www.gnu.org/licenses/>.
20
19
 */
21
20
 
22
21
#include "qemu-common.h"
40
39
    struct {
41
40
        void *opaque;
42
41
        uint32_t (*txrx)(void *opaque, uint32_t value, int len);
43
 
        struct uwire_slave_s *chip;
 
42
        uWireSlave *chip;
44
43
    } ts;
45
44
    i2c_bus *i2c;
46
45
 
47
46
    int keymap[0x80];
48
47
    i2c_slave *kbd;
49
48
 
50
 
    struct tusb_s *usb;
 
49
    TUSBState *usb;
51
50
    void *retu;
52
51
    void *tahvo;
53
52
    void *nand;
179
178
 
180
179
static void n8x0_i2c_setup(struct n800_s *s)
181
180
{
 
181
    DeviceState *dev;
182
182
    qemu_irq tmp_irq = omap2_gpio_in_get(s->cpu->gpif, N8X0_TMP105_GPIO)[0];
183
183
 
184
184
    /* Attach the CPU on one end of our I2C bus.  */
185
185
    s->i2c = omap_i2c_bus(s->cpu->i2c[0]);
186
186
 
187
187
    /* Attach a menelaus PM chip */
188
 
    i2c_set_slave_address(
189
 
                    twl92230_init(s->i2c,
190
 
                            s->cpu->irq[0][OMAP_INT_24XX_SYS_NIRQ]),
191
 
                    N8X0_MENELAUS_ADDR);
 
188
    dev = i2c_create_slave(s->i2c, "twl92230", N8X0_MENELAUS_ADDR);
 
189
    qdev_connect_gpio_out(dev, 3, s->cpu->irq[0][OMAP_INT_24XX_SYS_NIRQ]);
192
190
 
193
191
    /* Attach a TMP105 PM chip (A0 wired to ground) */
194
 
    i2c_set_slave_address(tmp105_init(s->i2c, tmp_irq), N8X0_TMP105_ADDR);
 
192
    dev = i2c_create_slave(s->i2c, "tmp105", N8X0_TMP105_ADDR);
 
193
    qdev_connect_gpio_out(dev, 0, tmp_irq);
195
194
}
196
195
 
197
196
/* Touchscreen and keypad controller */
198
 
static struct mouse_transform_info_s n800_pointercal = {
 
197
static MouseTransformInfo n800_pointercal = {
199
198
    .x = 800,
200
199
    .y = 480,
201
200
    .a = { 14560, -68, -3455208, -39, -9621, 35152972, 65536 },
202
201
};
203
202
 
204
 
static struct mouse_transform_info_s n810_pointercal = {
 
203
static MouseTransformInfo n810_pointercal = {
205
204
    .x = 800,
206
205
    .y = 480,
207
206
    .a = { 15041, 148, -4731056, 171, -10238, 35933380, 65536 },
252
251
    qemu_irq kbirq = omap2_gpio_in_get(s->cpu->gpif, N800_TSC_KP_IRQ_GPIO)[0];
253
252
    qemu_irq dav = omap2_gpio_in_get(s->cpu->gpif, N800_TSC_TS_GPIO)[0];
254
253
 
255
 
    s->ts.chip = tsc2301_init(penirq, kbirq, dav, 0);
 
254
    s->ts.chip = tsc2301_init(penirq, kbirq, dav);
256
255
    s->ts.opaque = s->ts.chip->opaque;
257
256
    s->ts.txrx = tsc210x_txrx;
258
257
 
362
361
static void n810_kbd_setup(struct n800_s *s)
363
362
{
364
363
    qemu_irq kbd_irq = omap2_gpio_in_get(s->cpu->gpif, N810_KEYBOARD_GPIO)[0];
 
364
    DeviceState *dev;
365
365
    int i;
366
366
 
367
367
    for (i = 0; i < 0x80; i ++)
374
374
 
375
375
    /* Attach the LM8322 keyboard to the I2C bus,
376
376
     * should happen in n8x0_i2c_setup and s->kbd be initialised here.  */
377
 
    s->kbd = lm8323_init(s->i2c, kbd_irq);
378
 
    i2c_set_slave_address(s->kbd, N810_LM8323_ADDR);
 
377
    dev = i2c_create_slave(s->i2c, "lm8323", N810_LM8323_ADDR);
 
378
    qdev_connect_gpio_out(dev, 0, kbd_irq);
379
379
}
380
380
 
381
381
/* LCD MIPI DBI-C controller (URAL) */
428
428
    uint8_t ret;
429
429
 
430
430
    if (len > 9)
431
 
        cpu_abort(cpu_single_env, "%s: FIXME: bad SPI word width %i\n",
432
 
                        __FUNCTION__, len);
 
431
        hw_error("%s: FIXME: bad SPI word width %i\n", __FUNCTION__, len);
433
432
 
434
433
    if (s->p >= ARRAY_SIZE(s->resp))
435
434
        ret = 0;
730
729
    qemu_irq retu_irq = omap2_gpio_in_get(s->cpu->gpif, N8X0_RETU_GPIO)[0];
731
730
    qemu_irq tahvo_irq = omap2_gpio_in_get(s->cpu->gpif, N8X0_TAHVO_GPIO)[0];
732
731
 
733
 
    struct cbus_s *cbus = cbus_init(dat_out);
 
732
    CBus *cbus = cbus_init(dat_out);
734
733
 
735
734
    omap2_gpio_out_set(s->cpu->gpif, N8X0_CBUS_CLK_GPIO, cbus->clk);
736
735
    omap2_gpio_out_set(s->cpu->gpif, N8X0_CBUS_DAT_GPIO, cbus->dat);
765
764
{
766
765
    qemu_irq tusb_irq = omap2_gpio_in_get(s->cpu->gpif, N8X0_TUSB_INT_GPIO)[0];
767
766
    qemu_irq tusb_pwr = qemu_allocate_irqs(n8x0_usb_power_cb, s, 1)[0];
768
 
    struct tusb_s *tusb = tusb6010_init(tusb_irq);
 
767
    TUSBState *tusb = tusb6010_init(tusb_irq);
769
768
 
770
769
    /* Using the NOR interface */
771
770
    omap_gpmc_attach(s->cpu->gpmc, N8X0_USB_ASYNC_CS,
1272
1271
{
1273
1272
    struct n800_s *s = (struct n800_s *) qemu_mallocz(sizeof(*s));
1274
1273
    int sdram_size = binfo->ram_size;
1275
 
    int onenandram_size = 0x00010000;
1276
1274
    DisplayState *ds;
1277
1275
 
1278
 
    if (ram_size < sdram_size + onenandram_size + OMAP242X_SRAM_SIZE) {
1279
 
        fprintf(stderr, "This architecture uses %i bytes of memory\n",
1280
 
                        sdram_size + onenandram_size + OMAP242X_SRAM_SIZE);
1281
 
        exit(1);
1282
 
    }
1283
 
 
1284
1276
    s->cpu = omap2420_mpu_init(sdram_size, cpu_model);
1285
1277
 
1286
1278
    /* Setup peripherals
1341
1333
    }
1342
1334
 
1343
1335
    if (option_rom[0] && (boot_device[0] == 'n' || !kernel_filename)) {
 
1336
        int rom_size;
 
1337
        uint8_t nolo_tags[0x10000];
1344
1338
        /* No, wait, better start at the ROM.  */
1345
1339
        s->cpu->env->regs[15] = OMAP2_Q2_BASE + 0x400000;
1346
1340
 
1353
1347
         *
1354
1348
         * The code above is for loading the `zImage' file from Nokia
1355
1349
         * images.  */
1356
 
        printf("%i bytes of image loaded\n", load_image(option_rom[0],
1357
 
                                phys_ram_base + 0x400000));
 
1350
        rom_size = load_image_targphys(option_rom[0],
 
1351
                                       OMAP2_Q2_BASE + 0x400000,
 
1352
                                       sdram_size - 0x400000);
 
1353
        printf("%i bytes of image loaded\n", rom_size);
1358
1354
 
1359
 
        n800_setup_nolo_tags(phys_ram_base + sdram_size);
 
1355
        n800_setup_nolo_tags(nolo_tags);
 
1356
        cpu_physical_memory_write(OMAP2_SRAM_BASE, nolo_tags, 0x10000);
1360
1357
    }
1361
1358
    /* FIXME: We shouldn't really be doing this here.  The LCD controller
1362
1359
       will set the size once configured, so this just sets an initial
1363
1360
       size until the guest activates the display.  */
1364
1361
    ds = get_displaystate();
1365
 
    ds->surface = qemu_resize_displaysurface(ds->surface, 800, 480, 32, 4 * 800);
 
1362
    ds->surface = qemu_resize_displaysurface(ds, 800, 480);
1366
1363
    dpy_resize(ds);
1367
1364
}
1368
1365
 
1385
1382
    .atag_board = n810_atag_setup,
1386
1383
};
1387
1384
 
1388
 
static void n800_init(ram_addr_t ram_size, int vga_ram_size,
 
1385
static void n800_init(ram_addr_t ram_size,
1389
1386
                const char *boot_device,
1390
1387
                const char *kernel_filename, const char *kernel_cmdline,
1391
1388
                const char *initrd_filename, const char *cpu_model)
1395
1392
                    cpu_model, &n800_binfo, 800);
1396
1393
}
1397
1394
 
1398
 
static void n810_init(ram_addr_t ram_size, int vga_ram_size,
 
1395
static void n810_init(ram_addr_t ram_size,
1399
1396
                const char *boot_device,
1400
1397
                const char *kernel_filename, const char *kernel_cmdline,
1401
1398
                const char *initrd_filename, const char *cpu_model)
1405
1402
                    cpu_model, &n810_binfo, 810);
1406
1403
}
1407
1404
 
1408
 
QEMUMachine n800_machine = {
 
1405
static QEMUMachine n800_machine = {
1409
1406
    .name = "n800",
1410
1407
    .desc = "Nokia N800 tablet aka. RX-34 (OMAP2420)",
1411
1408
    .init = n800_init,
1412
 
    .ram_require = (0x08000000 + 0x00010000 + OMAP242X_SRAM_SIZE) |
1413
 
            RAMSIZE_FIXED,
1414
1409
};
1415
1410
 
1416
 
QEMUMachine n810_machine = {
 
1411
static QEMUMachine n810_machine = {
1417
1412
    .name = "n810",
1418
1413
    .desc = "Nokia N810 tablet aka. RX-44 (OMAP2420)",
1419
1414
    .init = n810_init,
1420
 
    .ram_require = (0x08000000 + 0x00010000 + OMAP242X_SRAM_SIZE) |
1421
 
            RAMSIZE_FIXED,
1422
1415
};
 
1416
 
 
1417
static void nseries_machine_init(void)
 
1418
{
 
1419
    qemu_register_machine(&n800_machine);
 
1420
    qemu_register_machine(&n810_machine);
 
1421
}
 
1422
 
 
1423
machine_init(nseries_machine_init);