improve OMAP DSS emulation supporting OMAP2/3 differences
authorJuha Riihimäki <juhriihi@esdhcp039222.research.nokia.com>
Tue, 24 Feb 2009 09:06:36 +0000 (11:06 +0200)
committerJuha Riihimäki <juhriihi@esdhcp039222.research.nokia.com>
Tue, 24 Feb 2009 09:06:36 +0000 (11:06 +0200)
Add mapping for OMAP3 DSS DSI registers (dummy implementation with error printout only at this stage) and move OMAP2 DSS L3 register mapping as specific for OMAP2. OMAP3 L3 implementation will be in omap3.c.

hw/omap.h
hw/omap2.c
hw/omap3.c
hw/omap_dss.c

index 8cd34e5..52b04f4 100644 (file)
--- a/hw/omap.h
+++ b/hw/omap.h
@@ -932,11 +932,11 @@ struct omap3_lcd_panel_s {
 };
 struct omap_dss_s;
 void omap_dss_reset(struct omap_dss_s *s);
-struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta,
-                target_phys_addr_t l3_base,
-                qemu_irq irq, qemu_irq drq,
-                omap_clk fck1, omap_clk fck2, omap_clk ck54m,
-                omap_clk ick1, omap_clk ick2, int region_start);
+struct omap_dss_s *omap_dss_init(struct omap_mpu_state_s *mpu,
+                                 struct omap_target_agent_s *ta,
+                                 qemu_irq irq, qemu_irq drq,
+                                 omap_clk fck1, omap_clk fck2, omap_clk ck54m,
+                                 omap_clk ick1, omap_clk ick2);
 void omap_rfbi_attach(struct omap_dss_s *s, int cs, struct rfbi_chip_s *chip);
 void omap3_lcd_panel_attach(struct omap_dss_s *s, int cs, struct omap3_lcd_panel_s *lcd_panel);
 void *omap3_lcd_panel_init(void);
index 4eeab9c..2503eec 100644 (file)
@@ -4983,13 +4983,13 @@ struct omap_mpu_state_s *omap2420_mpu_init(unsigned long sdram_size,
                     omap_findclk(s, "spi2_fclk"),
                     omap_findclk(s, "spi2_iclk"));
 
-    s->dss = omap_dss_init(omap_l4ta(s->l4, 10), 0x68000800,
+    s->dss = omap_dss_init(s, omap_l4ta(s->l4, 10),
                     /* XXX wire M_IRQ_25, D_L2_IRQ_30 and I_IRQ_13 together */
                     s->irq[0][OMAP_INT_24XX_DSS_IRQ], s->drq[OMAP24XX_DMA_DSS],
                     omap_findclk(s, "dss_clk1"), omap_findclk(s, "dss_clk2"),
                     omap_findclk(s, "dss_54m_clk"),
                     omap_findclk(s, "dss_l3_iclk"),
-                    omap_findclk(s, "dss_l4_iclk"),0);
+                    omap_findclk(s, "dss_l4_iclk"));
 
     omap_sti_init(omap_l4ta(s->l4, 18), 0x54000000,
                     s->irq[0][OMAP_INT_24XX_STI], omap_findclk(s, "emul_ck"),
index d75e282..949ec52 100644 (file)
@@ -4159,9 +4159,9 @@ struct omap_mpu_state_s *omap3530_mpu_init(unsigned long sdram_size,
     /*attach serial[0] to uart 2 for beagle board */
     omap_uart_attach(s->uart[2], serial_hds[0]);
 
-    s->dss = omap_dss_init(omap3_l4ta_get(s->l4, L4A_DSS), 0x68005400, 
+    s->dss = omap_dss_init(s, omap3_l4ta_get(s->l4, L4A_DSS), 
                     s->irq[0][OMAP_INT_35XX_DSS_IRQ], s->drq[OMAP24XX_DMA_DSS],
-                   NULL,NULL,NULL,NULL,NULL,1);
+                   NULL,NULL,NULL,NULL,NULL);
 
     //gpio_clks[0] = NULL;
     //gpio_clks[1] = NULL;
index f1ca109..bb77869 100644 (file)
@@ -1067,13 +1067,40 @@ static CPUWriteMemoryFunc *omap_im3_writefn[] = {
     omap_im3_write,
 };
 
-struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta,
-                                 target_phys_addr_t l3_base,
+static uint32_t omap_dsi_read(void *opaque, target_phys_addr_t addr)
+{
+    fprintf(stderr, "%s: DSI register %08x not implemented!\n", __FUNCTION__,
+            addr);
+    return 0;
+}
+
+static void omap_dsi_write(void *opaque, target_phys_addr_t addr,
+                           uint32_t value)
+{
+    fprintf(stderr, "%s: DSI register %08x not implemented!\n", __FUNCTION__,
+            addr);
+}
+
+static CPUReadMemoryFunc *omap_dsi_readfn[] = {
+    omap_badwidth_read32,
+    omap_badwidth_read32,
+    omap_dsi_read,
+};
+
+static CPUWriteMemoryFunc *omap_dsi_writefn[] = {
+    omap_badwidth_write32,
+    omap_badwidth_write32,
+    omap_dsi_write,
+};
+
+struct omap_dss_s *omap_dss_init(struct omap_mpu_state_s *mpu,
+                                 struct omap_target_agent_s *ta,
                                  qemu_irq irq, qemu_irq drq,
                                  omap_clk fck1, omap_clk fck2, omap_clk ck54m,
-                                 omap_clk ick1, omap_clk ick2, int region_base)
+                                 omap_clk ick1, omap_clk ick2)
 {
-    int iomemtype[6];
+    int iomemtype[5];
+    int region_base = 0;
     struct omap_dss_s *s = (struct omap_dss_s *)
             qemu_mallocz(sizeof(struct omap_dss_s));
 
@@ -1089,14 +1116,22 @@ struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta,
                                          omap_rfbi1_writefn, s);
     iomemtype[3] = l4_register_io_memory(0, omap_venc1_readfn,
                                          omap_venc1_writefn, s);
-    iomemtype[4] = cpu_register_io_memory(0, omap_im3_readfn,
-                                          omap_im3_writefn, s);
-    /* TODO: DSI */
-    omap_l4_attach(ta, region_base+0, iomemtype[0]);
-    omap_l4_attach(ta, region_base+1, iomemtype[1]);
-    omap_l4_attach(ta, region_base+2, iomemtype[2]);
-    omap_l4_attach(ta, region_base+3, iomemtype[3]);
-    cpu_register_physical_memory(l3_base, 0x1000, iomemtype[4]);
+
+    if (cpu_class_omap3(mpu)) {
+        iomemtype[4] = l4_register_io_memory(0, omap_dsi_readfn,
+                                             omap_dsi_writefn, s);
+        omap_l4_attach(ta, 0, iomemtype[4]);
+        region_base = 1;
+    } else {
+        iomemtype[4] = cpu_register_io_memory(0, omap_im3_readfn,
+                                              omap_im3_writefn, s);
+        cpu_register_physical_memory(0x68000800, 0x1000, iomemtype[4]);
+    }
+    
+    omap_l4_attach(ta, region_base+0, iomemtype[0]); /* DISS */
+    omap_l4_attach(ta, region_base+1, iomemtype[1]); /* DISC */
+    omap_l4_attach(ta, region_base+2, iomemtype[2]); /* RFBI */
+    omap_l4_attach(ta, region_base+3, iomemtype[3]); /* VENC */
 
 #if 0
     s->state = graphic_console_init(omap_update_display,