Skip to contentSkip to conversation

pull: omap patches

GIT PULL New Peter Maydell 2 participants 6 messages Sep 23, 2011 – Sep 26, 2011

lore
Share & tools
lore
#0 lore raw

This is a small pullreq for the couple of outstanding OMAP patches, which I have now rebased following the landing of Avi's memoryregion batch which touched omap1.c. I've also included the MAINTAINERS file update. Please pull.

Thanks
-- PMM

The following changes since commit 7e36b264ce524bc60b7b71dd45c05af767ceff2b:

hw/omap_gpmc: Modify correct field when writing IRQSTATUS register (2011-09-23 08:36:58 +0200)

are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git omap-for-upstream

Peter Maydell (4):
omap_intc: Use MemoryRegion API
omap_intc: Qdevify
hw/omap1: Wire up GPIO clock
MAINTAINERS: claim maintainership for the OMAP devices

 MAINTAINERS    |    5 ++
 hw/nseries.c   |    4 +-
 hw/omap.h      |   21 +-------
 hw/omap1.c     |  142 ++++++++++++++++++++++++++++------------------
 hw/omap2.c     |   92 +++++++++++++++++------------
 hw/omap_intc.c |  175 +++++++++++++++++++++++++++++++------------------------
 6 files changed, 249 insertions(+), 190 deletions(-)
#1 lore raw

PATCH 1/4 omap_intc: Use MemoryRegion API

Convert omap_intc to use the MemoryRegion API

---
 hw/omap_intc.c |   64 ++++++++++++++++++++++++++-----------------------------
 1 files changed, 30 insertions(+), 34 deletions(-)
hw/omap_intc.c +30 -34
index f1f570e..38637c6 100644
@@ -19,6 +19,7 @@
  */
 #include "hw.h"
 #include "omap.h"
+#include "exec-memory.h"
 
 /* Interrupt Handlers */
 struct omap_intr_handler_bank_s {
@@ -34,6 +35,7 @@ struct omap_intr_handler_bank_s {
 struct omap_intr_handler_s {
     qemu_irq *pins;
     qemu_irq parent_intr[2];
+    MemoryRegion mmio;
     unsigned char nbanks;
     int level_only;
 
@@ -142,7 +144,8 @@ static void omap_set_intr_noedge(void *opaque, int irq, int req)
         bank->irqs = (bank->inputs &= ~(1 << n)) | bank->swi;
 }
 
-static uint32_t omap_inth_read(void *opaque, target_phys_addr_t addr)
+static uint64_t omap_inth_read(void *opaque, target_phys_addr_t addr,
+                               unsigned size)
 {
     struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
     int i, offset = addr;
@@ -220,7 +223,7 @@ static uint32_t omap_inth_read(void *opaque, target_phys_addr_t addr)
 }
 
 static void omap_inth_write(void *opaque, target_phys_addr_t addr,
-                uint32_t value)
+                            uint64_t value, unsigned size)
 {
     struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
     int i, offset = addr;
@@ -312,16 +315,14 @@ static void omap_inth_write(void *opaque, target_phys_addr_t addr,
     OMAP_BAD_REG(addr);
 }
 
-static CPUReadMemoryFunc * const omap_inth_readfn[] = {
-    omap_badwidth_read32,
-    omap_badwidth_read32,
-    omap_inth_read,
-};
-
-static CPUWriteMemoryFunc * const omap_inth_writefn[] = {
-    omap_inth_write,
-    omap_inth_write,
-    omap_inth_write,
+static const MemoryRegionOps omap_inth_mem_ops = {
+    .read = omap_inth_read,
+    .write = omap_inth_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
+    .valid = {
+        .min_access_size = 4,
+        .max_access_size = 4,
+    },
 };
 
 void omap_inth_reset(struct omap_intr_handler_s *s)
@@ -356,7 +357,6 @@ struct omap_intr_handler_s *omap_inth_init(target_phys_addr_t base,
                 unsigned long size, unsigned char nbanks, qemu_irq **pins,
                 qemu_irq parent_irq, qemu_irq parent_fiq, omap_clk clk)
 {
-    int iomemtype;
     struct omap_intr_handler_s *s = (struct omap_intr_handler_s *)
             g_malloc0(sizeof(struct omap_intr_handler_s) +
                             sizeof(struct omap_intr_handler_bank_s) * nbanks);
@@ -368,16 +368,16 @@ struct omap_intr_handler_s *omap_inth_init(target_phys_addr_t base,
     if (pins)
         *pins = s->pins;
 
-    omap_inth_reset(s);
+    memory_region_init_io(&s->mmio, &omap_inth_mem_ops, s, "omap-intc", size);
+    memory_region_add_subregion(get_system_memory(), base, &s->mmio);
 
-    iomemtype = cpu_register_io_memory(omap_inth_readfn,
-                    omap_inth_writefn, s, DEVICE_NATIVE_ENDIAN);
-    cpu_register_physical_memory(base, size, iomemtype);
+    omap_inth_reset(s);
 
     return s;
 }
 
-static uint32_t omap2_inth_read(void *opaque, target_phys_addr_t addr)
+static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr,
+                                unsigned size)
 {
     struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
     int offset = addr;
@@ -455,7 +455,7 @@ static uint32_t omap2_inth_read(void *opaque, target_phys_addr_t addr)
 }
 
 static void omap2_inth_write(void *opaque, target_phys_addr_t addr,
-                uint32_t value)
+                             uint64_t value, unsigned size)
 {
     struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
     int offset = addr;
@@ -558,16 +558,14 @@ static void omap2_inth_write(void *opaque, target_phys_addr_t addr,
     OMAP_BAD_REG(addr);
 }
 
-static CPUReadMemoryFunc * const omap2_inth_readfn[] = {
-    omap_badwidth_read32,
-    omap_badwidth_read32,
-    omap2_inth_read,
-};
-
-static CPUWriteMemoryFunc * const omap2_inth_writefn[] = {
-    omap2_inth_write,
-    omap2_inth_write,
-    omap2_inth_write,
+static const MemoryRegionOps omap2_inth_mem_ops = {
+    .read = omap2_inth_read,
+    .write = omap2_inth_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
+    .valid = {
+        .min_access_size = 4,
+        .max_access_size = 4,
+    },
 };
 
 struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
@@ -575,7 +573,6 @@ struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
                 qemu_irq parent_irq, qemu_irq parent_fiq,
                 omap_clk fclk, omap_clk iclk)
 {
-    int iomemtype;
     struct omap_intr_handler_s *s = (struct omap_intr_handler_s *)
             g_malloc0(sizeof(struct omap_intr_handler_s) +
                             sizeof(struct omap_intr_handler_bank_s) * nbanks);
@@ -588,11 +585,10 @@ struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
     if (pins)
         *pins = s->pins;
 
-    omap_inth_reset(s);
+    memory_region_init_io(&s->mmio, &omap2_inth_mem_ops, s, "omap2-intc", size);
+    memory_region_add_subregion(get_system_memory(), base, &s->mmio);
 
-    iomemtype = cpu_register_io_memory(omap2_inth_readfn,
-                    omap2_inth_writefn, s, DEVICE_NATIVE_ENDIAN);
-    cpu_register_physical_memory(base, size, iomemtype);
+    omap_inth_reset(s);
 
     return s;
 }
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/4 omap_intc: Qdevify

In reply to Peter Maydell

Convert the omap_intc devices to qdev. This includes adding a 'revision' property which will be needed for omap3.

The bulk of this patch is the replacement of "s->irq[x][y]" with "qdev_get_gpio_in(s->ih[x], y)" now that the interrupt controller exposes its input lines as qdev gpio inputs.

The devices are named "omap-intc" and "omap2-intc", following the filename and the OMAP2/3 hardware names, although some internal functions are still named "omap_inth_*".

---
 hw/nseries.c   |    4 +-
 hw/omap.h      |   21 +--------
 hw/omap1.c     |  141 ++++++++++++++++++++++++++++++++++----------------------
 hw/omap2.c     |   92 +++++++++++++++++++++---------------
 hw/omap_intc.c |  125 ++++++++++++++++++++++++++++++-------------------
 5 files changed, 220 insertions(+), 163 deletions(-)
hw/nseries.c +3 -1
index af287dd..eb99143 100644
@@ -199,7 +199,9 @@ static void n8x0_i2c_setup(struct n800_s *s)
 
     /* Attach a menelaus PM chip */
     dev = i2c_create_slave(s->i2c, "twl92230", N8X0_MENELAUS_ADDR);
-    qdev_connect_gpio_out(dev, 3, s->cpu->irq[0][OMAP_INT_24XX_SYS_NIRQ]);
+    qdev_connect_gpio_out(dev, 3,
+                          qdev_get_gpio_in(s->cpu->ih[0],
+                                           OMAP_INT_24XX_SYS_NIRQ));
 
     /* Attach a TMP105 PM chip (A0 wired to ground) */
     dev = i2c_create_slave(s->i2c, "tmp105", N8X0_TMP105_ADDR);
hw/omap.h +1 -20
index 0260cc0..cc09a3c 100644
@@ -99,18 +99,6 @@ target_phys_addr_t omap_l4_region_base(struct omap_target_agent_s *ta,
 int l4_register_io_memory(CPUReadMemoryFunc * const *mem_read,
                 CPUWriteMemoryFunc * const *mem_write, void *opaque);
 
-/* OMAP interrupt controller */
-struct omap_intr_handler_s;
-struct omap_intr_handler_s *omap_inth_init(target_phys_addr_t base,
-                unsigned long size, unsigned char nbanks, qemu_irq **pins,
-                qemu_irq parent_irq, qemu_irq parent_fiq, omap_clk clk);
-struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
-                int size, int nbanks, qemu_irq **pins,
-                qemu_irq parent_irq, qemu_irq parent_fiq,
-                omap_clk fclk, omap_clk iclk);
-void omap_inth_reset(struct omap_intr_handler_s *s);
-qemu_irq omap_inth_get_pin(struct omap_intr_handler_s *s, int n);
-
 /* OMAP2 SDRAM controller */
 struct omap_sdrc_s;
 struct omap_sdrc_s *omap_sdrc_init(target_phys_addr_t base);
@@ -692,9 +680,6 @@ struct uWireSlave {
     void *opaque;
 };
 struct omap_uwire_s;
-struct omap_uwire_s *omap_uwire_init(MemoryRegion *system_memory,
-                target_phys_addr_t base,
-                qemu_irq *irq, qemu_irq dma, omap_clk clk);
 void omap_uwire_attach(struct omap_uwire_s *s,
                 uWireSlave *slave, int chipselect);
 
@@ -732,9 +717,6 @@ struct I2SCodec {
     } in, out;
 };
 struct omap_mcbsp_s;
-struct omap_mcbsp_s *omap_mcbsp_init(MemoryRegion *system_memory,
-                target_phys_addr_t base,
-                qemu_irq *irq, qemu_irq *dma, omap_clk clk);
 void omap_mcbsp_i2s_attach(struct omap_mcbsp_s *s, I2SCodec *slave);
 
 void omap_tap_init(struct omap_target_agent_s *ta,
@@ -823,7 +805,6 @@ struct omap_mpu_state_s {
 
     CPUState *env;
 
-    qemu_irq *irq[2];
     qemu_irq *drq;
 
     qemu_irq wakeup;
@@ -896,7 +877,7 @@ struct omap_mpu_state_s {
     struct omap_lpg_s *led[2];
 
     /* MPU private TIPB peripherals */
-    struct omap_intr_handler_s *ih[2];
+    DeviceState *ih[2];
 
     struct soc_dma_s *dma;
 
hw/omap1.c +86 -55

269 lines not on this page · raw message

hw/omap2.c +54 -38

218 lines not on this page · raw message

hw/omap_intc.c +76 -49

186 lines not on this page · raw message

Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/4 hw/omap1: Wire up GPIO clock

In reply to Peter Maydell

Wire up the OMAP1 GPIO clock -- this fixes a hw_error() on startup with OMAP1 based machines (sx1, cheetah).

---
 hw/omap1.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
hw/omap1.c +1 -0
index 4bf88e8..619812c 100644
@@ -3950,6 +3950,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
 
     s->gpio = qdev_create(NULL, "omap-gpio");
     qdev_prop_set_int32(s->gpio, "mpu_model", s->mpu_model);
+    qdev_prop_set_ptr(s->gpio, "clk", omap_findclk(s, "arm_gpio_ck"));
     qdev_init_nofail(s->gpio);
     sysbus_connect_irq(sysbus_from_qdev(s->gpio), 0,
                        qdev_get_gpio_in(s->ih[0], OMAP_INT_GPIO_BANK1));
Signature · 1 line
1.7.1
#4 lore raw

PATCH 4/4 MAINTAINERS: claim maintainership for the OMAP devices

In reply to Peter Maydell
---
 MAINTAINERS |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
MAINTAINERS +5 -0
index 7c5ea87..5046dc9 100644
@@ -355,6 +355,11 @@ M: Kevin Wolf <[email protected]>
 S: Odd Fixes
 F: hw/ide/
 
+OMAP
+M: Peter Maydell <[email protected]>
+S: Maintained
+F: hw/omap*
+
 PCI
 M: Michael S. Tsirkin <[email protected]>
 S: Supported
Signature · 1 line
1.7.1
#5 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

This is a small pullreq for the couple of outstanding OMAP patches, which I have now rebased following the landing of Avi's memoryregion batch which touched omap1.c. I've also included the MAINTAINERS file update. Please pull.

Thanks
-- PMM

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 24 lines

The following changes since commit 7e36b264ce524bc60b7b71dd45c05af767ceff2b:

hw/omap_gpmc: Modify correct field when writing IRQSTATUS register (2011-09-23 08:36:58 +0200)

are available in the git repository at:
git://git.linaro.org/people/pmaydell/qemu-arm.git omap-for-upstream

Peter Maydell (4):
omap_intc: Use MemoryRegion API
omap_intc: Qdevify
hw/omap1: Wire up GPIO clock
MAINTAINERS: claim maintainership for the OMAP devices

  MAINTAINERS    |    5 ++
  hw/nseries.c   |    4 +-
  hw/omap.h      |   21 +-------
  hw/omap1.c     |  142 ++++++++++++++++++++++++++++------------------
  hw/omap2.c     |   92 +++++++++++++++++------------
  hw/omap_intc.c |  175 +++++++++++++++++++++++++++++++------------------------
  6 files changed, 249 insertions(+), 190 deletions(-)