Revision 60fe76e3

b/hw/omap.h
841 841
    MemoryRegion clkdsp_iomem;
842 842
    MemoryRegion pwl_iomem;
843 843
    MemoryRegion pwt_iomem;
844
    MemoryRegion mpui_io_iomem;
844 845

  
845 846
    struct omap_dma_port_if_s {
846 847
        uint32_t (*read[3])(struct omap_mpu_state_s *s,
b/hw/omap1.c
3452 3452

  
3453 3453
/* LED Pulse Generators */
3454 3454
struct omap_lpg_s {
3455
    MemoryRegion iomem;
3455 3456
    QEMUTimer *tm;
3456 3457

  
3457 3458
    uint8_t control;
......
3516 3517
    omap_lpg_update(s);
3517 3518
}
3518 3519

  
3519
static uint32_t omap_lpg_read(void *opaque, target_phys_addr_t addr)
3520
static uint64_t omap_lpg_read(void *opaque, target_phys_addr_t addr,
3521
                              unsigned size)
3520 3522
{
3521 3523
    struct omap_lpg_s *s = (struct omap_lpg_s *) opaque;
3522 3524
    int offset = addr & OMAP_MPUI_REG_MASK;
3523 3525

  
3526
    if (size != 1) {
3527
        return omap_badwidth_read8(opaque, addr);
3528
    }
3529

  
3524 3530
    switch (offset) {
3525 3531
    case 0x00:	/* LCR */
3526 3532
        return s->control;
......
3534 3540
}
3535 3541

  
3536 3542
static void omap_lpg_write(void *opaque, target_phys_addr_t addr,
3537
                uint32_t value)
3543
                           uint64_t value, unsigned size)
3538 3544
{
3539 3545
    struct omap_lpg_s *s = (struct omap_lpg_s *) opaque;
3540 3546
    int offset = addr & OMAP_MPUI_REG_MASK;
3541 3547

  
3548
    if (size != 1) {
3549
        return omap_badwidth_write8(opaque, addr, value);
3550
    }
3551

  
3542 3552
    switch (offset) {
3543 3553
    case 0x00:	/* LCR */
3544 3554
        if (~value & (1 << 6))					/* LPGRES */
......
3558 3568
    }
3559 3569
}
3560 3570

  
3561
static CPUReadMemoryFunc * const omap_lpg_readfn[] = {
3562
    omap_lpg_read,
3563
    omap_badwidth_read8,
3564
    omap_badwidth_read8,
3565
};
3566

  
3567
static CPUWriteMemoryFunc * const omap_lpg_writefn[] = {
3568
    omap_lpg_write,
3569
    omap_badwidth_write8,
3570
    omap_badwidth_write8,
3571
static const MemoryRegionOps omap_lpg_ops = {
3572
    .read = omap_lpg_read,
3573
    .write = omap_lpg_write,
3574
    .endianness = DEVICE_NATIVE_ENDIAN,
3571 3575
};
3572 3576

  
3573 3577
static void omap_lpg_clk_update(void *opaque, int line, int on)
......
3578 3582
    omap_lpg_update(s);
3579 3583
}
3580 3584

  
3581
static struct omap_lpg_s *omap_lpg_init(target_phys_addr_t base, omap_clk clk)
3585
static struct omap_lpg_s *omap_lpg_init(MemoryRegion *system_memory,
3586
                                        target_phys_addr_t base, omap_clk clk)
3582 3587
{
3583
    int iomemtype;
3584 3588
    struct omap_lpg_s *s = (struct omap_lpg_s *)
3585 3589
            g_malloc0(sizeof(struct omap_lpg_s));
3586 3590

  
......
3588 3592

  
3589 3593
    omap_lpg_reset(s);
3590 3594

  
3591
    iomemtype = cpu_register_io_memory(omap_lpg_readfn,
3592
                    omap_lpg_writefn, s, DEVICE_NATIVE_ENDIAN);
3593
    cpu_register_physical_memory(base, 0x800, iomemtype);
3595
    memory_region_init_io(&s->iomem, &omap_lpg_ops, s, "omap-lpg", 0x800);
3596
    memory_region_add_subregion(system_memory, base, &s->iomem);
3594 3597

  
3595 3598
    omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]);
3596 3599

  
......
3598 3601
}
3599 3602

  
3600 3603
/* MPUI Peripheral Bridge configuration */
3601
static uint32_t omap_mpui_io_read(void *opaque, target_phys_addr_t addr)
3604
static uint64_t omap_mpui_io_read(void *opaque, target_phys_addr_t addr,
3605
                                  unsigned size)
3602 3606
{
3607
    if (size != 2) {
3608
        return omap_badwidth_read16(opaque, addr);
3609
    }
3610

  
3603 3611
    if (addr == OMAP_MPUI_BASE)	/* CMR */
3604 3612
        return 0xfe4d;
3605 3613

  
......
3607 3615
    return 0;
3608 3616
}
3609 3617

  
3610
static CPUReadMemoryFunc * const omap_mpui_io_readfn[] = {
3611
    omap_badwidth_read16,
3612
    omap_mpui_io_read,
3613
    omap_badwidth_read16,
3614
};
3618
static void omap_mpui_io_write(void *opaque, target_phys_addr_t addr,
3619
                               uint64_t value, unsigned size)
3620
{
3621
    /* FIXME: infinite loop */
3622
    omap_badwidth_write16(opaque, addr, value);
3623
}
3615 3624

  
3616
static CPUWriteMemoryFunc * const omap_mpui_io_writefn[] = {
3617
    omap_badwidth_write16,
3618
    omap_badwidth_write16,
3619
    omap_badwidth_write16,
3625
static const MemoryRegionOps omap_mpui_io_ops = {
3626
    .read = omap_mpui_io_read,
3627
    .write = omap_mpui_io_write,
3628
    .endianness = DEVICE_NATIVE_ENDIAN,
3620 3629
};
3621 3630

  
3622
static void omap_setup_mpui_io(struct omap_mpu_state_s *mpu)
3631
static void omap_setup_mpui_io(MemoryRegion *system_memory,
3632
                               struct omap_mpu_state_s *mpu)
3623 3633
{
3624
    int iomemtype = cpu_register_io_memory(omap_mpui_io_readfn,
3625
                    omap_mpui_io_writefn, mpu, DEVICE_NATIVE_ENDIAN);
3626
    cpu_register_physical_memory(OMAP_MPUI_BASE, 0x7fff, iomemtype);
3634
    memory_region_init_io(&mpu->mpui_io_iomem, &omap_mpui_io_ops, mpu,
3635
                          "omap-mpui-io", 0x7fff);
3636
    memory_region_add_subregion(system_memory, OMAP_MPUI_BASE,
3637
                                &mpu->mpui_io_iomem);
3627 3638
}
3628 3639

  
3629 3640
/* General chip reset */
......
3947 3958
                    0xfffb7000, &s->irq[1][OMAP_INT_McBSP3TX],
3948 3959
                    &s->drq[OMAP_DMA_MCBSP3_TX], omap_findclk(s, "dspxor_ck"));
3949 3960

  
3950
    s->led[0] = omap_lpg_init(0xfffbd000, omap_findclk(s, "clk32-kHz"));
3951
    s->led[1] = omap_lpg_init(0xfffbd800, omap_findclk(s, "clk32-kHz"));
3961
    s->led[0] = omap_lpg_init(system_memory,
3962
                              0xfffbd000, omap_findclk(s, "clk32-kHz"));
3963
    s->led[1] = omap_lpg_init(system_memory,
3964
                              0xfffbd800, omap_findclk(s, "clk32-kHz"));
3952 3965

  
3953 3966
    /* Register mappings not currenlty implemented:
3954 3967
     * MCSI2 Comm	fffb2000 - fffb27ff (not mapped on OMAP310)
......
3966 3979
     */
3967 3980

  
3968 3981
    omap_setup_dsp_mapping(omap15xx_dsp_mm);
3969
    omap_setup_mpui_io(s);
3982
    omap_setup_mpui_io(system_memory, s);
3970 3983

  
3971 3984
    qemu_register_reset(omap1_mpu_reset, s);
3972 3985

  

Also available in: Unified diff