multi-mmc support
authorRiku Voipio <riku.voipio@nokia.com>
Mon, 16 Feb 2009 13:02:34 +0000 (15:02 +0200)
committerRiku Voipio <riku.voipio@nokia.com>
Mon, 16 Feb 2009 13:18:27 +0000 (15:18 +0200)
hw/omap.h
hw/omap1.c
hw/omap2.c
hw/omap3.c
hw/omap3_mmc.c

index 8c09007..be8aedd 100644 (file)
--- a/hw/omap.h
+++ b/hw/omap.h
@@ -1046,7 +1046,7 @@ struct omap_mpu_state_s {
     /* MPU public TIPB peripherals */
     struct omap_32khz_timer_s *os_timer;
 
-    struct omap_mmc_s *mmc;
+    struct omap_mmc_s *mmc[2];
 
     struct omap_mpuio_s *mpuio;
 
@@ -1156,7 +1156,7 @@ struct omap_mpu_state_s {
     struct omap3_scm_s *omap3_scm;
     struct omap3_pm_s *omap3_pm;
     struct omap3_sms_s *omap3_sms;
-    struct omap3_mmc_s *omap3_mmc;
+    struct omap3_mmc_s *omap3_mmc[3];
 };
 
 struct omap_target_agent_s {
index ed2cfc6..82b2b40 100644 (file)
@@ -4503,7 +4503,7 @@ static void omap1_mpu_reset(void *opaque)
     omap_uart_reset(mpu->uart[0]);
     omap_uart_reset(mpu->uart[1]);
     omap_uart_reset(mpu->uart[2]);
-    omap_mmc_reset(mpu->mmc);
+    omap_mmc_reset(mpu->mmc[0]);
     omap_mpuio_reset(mpu->mpuio);
     omap_gpio_reset(mpu->gpio);
     omap_uwire_reset(mpu->microwire);
@@ -4751,7 +4751,7 @@ struct omap_mpu_state_s *omap310_mpu_init(unsigned long sdram_size,
         fprintf(stderr, "qemu: missing SecureDigital device\n");
         exit(1);
     }
-    s->mmc = omap_mmc_init(0xfffb7800, drives_table[sdindex].bdrv,
+    s->mmc[0] = omap_mmc_init(0xfffb7800, drives_table[sdindex].bdrv,
                     s->irq[1][OMAP_INT_OQN], &s->drq[OMAP_DMA_MMC_TX],
                     omap_findclk(s, "mmc_ck"));
 
index a8a1a38..7f9d04d 100644 (file)
@@ -4780,7 +4780,7 @@ static void omap2_mpu_reset(void *opaque)
     omap_uart_reset(mpu->uart[0]);
     omap_uart_reset(mpu->uart[1]);
     omap_uart_reset(mpu->uart[2]);
-    omap_mmc_reset(mpu->mmc);
+    omap_mmc_reset(mpu->mmc[0]);
     omap_gpif_reset(mpu->gpif);
     omap_mcspi_reset(mpu->mcspi[0]);
     omap_mcspi_reset(mpu->mcspi[1]);
@@ -4966,7 +4966,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(unsigned long sdram_size,
         fprintf(stderr, "qemu: missing SecureDigital device\n");
         exit(1);
     }
-    s->mmc = omap2_mmc_init(omap_l4tao(s->l4, 9), drives_table[sdindex].bdrv,
+    s->mmc[0] = omap2_mmc_init(omap_l4tao(s->l4, 9), drives_table[sdindex].bdrv,
                     s->irq[0][OMAP_INT_24XX_MMC_IRQ],
                     &s->drq[OMAP24XX_DMA_MMC1_TX],
                     omap_findclk(s, "mmc_fclk"), omap_findclk(s, "mmc_iclk"));
index e239d5b..34ad4bf 100644 (file)
@@ -4189,13 +4189,27 @@ struct omap_mpu_state_s *omap3530_mpu_init(unsigned long sdram_size,
 \r
     omap_tap_init(omap3_l4ta_get(s->l4, L4A_TAP), s);\r
 \r
-    s->omap3_mmc = omap3_mmc_init(omap3_l4ta_get(s->l4, L4A_MMC1), \r
+    s->omap3_mmc[0] = omap3_mmc_init(omap3_l4ta_get(s->l4, L4A_MMC1),\r
                                   drives_table[sdindex].bdrv,\r
                                   s->irq[0][OMAP_INT_35XX_MMC1_IRQ],\r
                                   &s->drq[OMAP35XX_DMA_MMC1_TX],\r
                                   omap_findclk(s, "omap3_mmc1_fclk"),\r
                                   omap_findclk(s, "omap3_mmc1_iclk"));\r
 \r
+    s->omap3_mmc[1] = omap3_mmc_init(omap3_l4ta_get(s->l4, L4A_MMC2),\r
+                                  drives_table[-1].bdrv,\r
+                                  s->irq[0][OMAP_INT_35XX_MMC2_IRQ],\r
+                                  &s->drq[OMAP35XX_DMA_MMC2_TX],\r
+                                  omap_findclk(s, "omap3_mmc2_fclk"),\r
+                                  omap_findclk(s, "omap3_mmc2_iclk"));\r
+\r
+    s->omap3_mmc[2] = omap3_mmc_init(omap3_l4ta_get(s->l4, L4A_MMC3),\r
+                                  drives_table[-1].bdrv,\r
+                                  s->irq[0][OMAP_INT_35XX_MMC3_IRQ],\r
+                                  &s->drq[OMAP35XX_DMA_MMC3_TX],\r
+                                  omap_findclk(s, "omap3_mmc3_fclk"),\r
+                                  omap_findclk(s, "omap3_mmc3_iclk"));\r
+\r
     s->i2c[0] = omap3_i2c_init(omap3_l4ta_get(s->l4, L4A_I2C1),\r
                                s->irq[0][OMAP_INT_35XX_I2C1_IRQ],\r
                                &s->drq[OMAP35XX_DMA_I2C1_TX],\r
index a7d23d0..16974c4 100644 (file)
@@ -599,12 +599,10 @@ struct omap3_mmc_s *omap3_mmc_init(struct omap_target_agent_s *ta,
     omap_l4_attach(ta, 0, iomemtype);\r
 \r
     /* Instantiate the storage */\r
-    s->card = sd_init(bd, 0);\r
-\r
-    //s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0];\r
-    //sd_set_cb(s->card, 0, s->cdet);\r
-\r
-    omap3_mmc_enable(s,1);\r
+    if (bd!=NULL) {\r
+       s->card = sd_init(bd, 0);\r
+           omap3_mmc_enable(s,1);\r
+    }\r
 \r
     return s;\r
 }\r