Patchwork [23/48] multi-mmc support in init call

login
register
mail settings
Submitter Riku Voipio
Date March 26, 2010, 4:06 p.m.
Message ID <5b3d6ea78f9cb0e95ef84d3b830d6f144bb795a1.1269617186.git.riku.voipio@nokia.com>
Download mbox | patch
Permalink /patch/48671/
State New
Headers show

Comments

Riku Voipio - March 26, 2010, 4:06 p.m.
From: Juha Riihimäki <juha.riihimaki@nokia.com>

change sd_init convention to allow multiple entries

Signed-Off-By: Riku Voipio <riku.voipio@nokia.com>
Signed-Off-By: Juha Riihimäki <juha.riihimaki@nokia.com>

---
 hw/omap_mmc.c    |    4 ++--
 hw/pl181.c       |    2 +-
 hw/pxa2xx_mmci.c |    2 +-
 hw/sd.h          |    4 +++-
 hw/ssi-sd.c      |    2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)
Filip Navara - March 28, 2010, 7:19 p.m.
I see neither the change to sd_init implementation nor the implementation
of sd_is_mmc.

Best regards,
Filip Navara

On Fri, Mar 26, 2010 at 5:06 PM, Riku Voipio <riku.voipio@iki.fi> wrote:

> From: Juha Riihimäki <juha.riihimaki@nokia.com>
>
> change sd_init convention to allow multiple entries
>
> Signed-Off-By: Riku Voipio <riku.voipio@nokia.com>
> Signed-Off-By: Juha Riihimäki <juha.riihimaki@nokia.com>
>
> ---
>  hw/omap_mmc.c    |    4 ++--
>  hw/pl181.c       |    2 +-
>  hw/pxa2xx_mmci.c |    2 +-
>  hw/sd.h          |    4 +++-
>  hw/ssi-sd.c      |    2 +-
>  5 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/hw/omap_mmc.c b/hw/omap_mmc.c
> index 15cbf06..7c94d91 100644
> --- a/hw/omap_mmc.c
> +++ b/hw/omap_mmc.c
> @@ -590,7 +590,7 @@ struct omap_mmc_s *omap_mmc_init(target_phys_addr_t
> base,
>     cpu_register_physical_memory(base, 0x800, iomemtype);
>
>     /* Instantiate the storage */
> -    s->card = sd_init(bd, 0);
> +    s->card = sd_init(bd, 0, 0);
>
>     return s;
>  }
> @@ -616,7 +616,7 @@ struct omap_mmc_s *omap2_mmc_init(struct
> omap_target_agent_s *ta,
>     omap_l4_attach(ta, 0, iomemtype);
>
>     /* Instantiate the storage */
> -    s->card = sd_init(bd, 0);
> +    s->card = sd_init(bd, 0, 0);
>
>     s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0];
>     sd_set_cb(s->card, NULL, s->cdet);
> diff --git a/hw/pl181.c b/hw/pl181.c
> index 1924053..fd5ee81 100644
> --- a/hw/pl181.c
> +++ b/hw/pl181.c
> @@ -458,7 +458,7 @@ static int pl181_init(SysBusDevice *dev)
>     sysbus_init_irq(dev, &s->irq[0]);
>     sysbus_init_irq(dev, &s->irq[1]);
>     bd = qdev_init_bdrv(&dev->qdev, IF_SD);
> -    s->card = sd_init(bd, 0);
> +    s->card = sd_init(bd, 0, 0);
>     qemu_register_reset(pl181_reset, s);
>     pl181_reset(s);
>     /* ??? Save/restore.  */
> diff --git a/hw/pxa2xx_mmci.c b/hw/pxa2xx_mmci.c
> index a415349..01e7f1e 100644
> --- a/hw/pxa2xx_mmci.c
> +++ b/hw/pxa2xx_mmci.c
> @@ -532,7 +532,7 @@ PXA2xxMMCIState *pxa2xx_mmci_init(target_phys_addr_t
> base,
>     cpu_register_physical_memory(base, 0x00100000, iomemtype);
>
>     /* Instantiate the actual storage */
> -    s->card = sd_init(bd, 0);
> +    s->card = sd_init(bd, 0, 0);
>
>     register_savevm("pxa2xx_mmci", 0, 0,
>                     pxa2xx_mmci_save, pxa2xx_mmci_load, s);
> diff --git a/hw/sd.h b/hw/sd.h
> index ac4b7c4..96450f2 100644
> --- a/hw/sd.h
> +++ b/hw/sd.h
> @@ -67,7 +67,8 @@ typedef struct {
>
>  typedef struct SDState SDState;
>
> -SDState *sd_init(BlockDriverState *bs, int is_spi);
> +SDState *sd_init(BlockDriverState *bs, int is_spi, int is_mmc);
> +void sd_reset(SDState *sd);
>  int sd_do_command(SDState *sd, SDRequest *req,
>                   uint8_t *response);
>  void sd_write_data(SDState *sd, uint8_t value);
> @@ -75,5 +76,6 @@ uint8_t sd_read_data(SDState *sd);
>  void sd_set_cb(SDState *sd, qemu_irq readonly, qemu_irq insert);
>  int sd_data_ready(SDState *sd);
>  void sd_enable(SDState *sd, int enable);
> +int sd_is_mmc(SDState *sd);
>
>  #endif /* __hw_sd_h */
> diff --git a/hw/ssi-sd.c b/hw/ssi-sd.c
> index 5e74e5d..a5d350d 100644
> --- a/hw/ssi-sd.c
> +++ b/hw/ssi-sd.c
> @@ -236,7 +236,7 @@ static int ssi_sd_init(SSISlave *dev)
>
>     s->mode = SSI_SD_CMD;
>     bs = qdev_init_bdrv(&dev->qdev, IF_SD);
> -    s->sd = sd_init(bs, 1);
> +    s->sd = sd_init(bs, 1, 0);
>     register_savevm("ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
>     return 0;
>  }
> --
> 1.6.5
>
>
>
>

Patch

diff --git a/hw/omap_mmc.c b/hw/omap_mmc.c
index 15cbf06..7c94d91 100644
--- a/hw/omap_mmc.c
+++ b/hw/omap_mmc.c
@@ -590,7 +590,7 @@  struct omap_mmc_s *omap_mmc_init(target_phys_addr_t base,
     cpu_register_physical_memory(base, 0x800, iomemtype);
 
     /* Instantiate the storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, 0, 0);
 
     return s;
 }
@@ -616,7 +616,7 @@  struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
     omap_l4_attach(ta, 0, iomemtype);
 
     /* Instantiate the storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, 0, 0);
 
     s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0];
     sd_set_cb(s->card, NULL, s->cdet);
diff --git a/hw/pl181.c b/hw/pl181.c
index 1924053..fd5ee81 100644
--- a/hw/pl181.c
+++ b/hw/pl181.c
@@ -458,7 +458,7 @@  static int pl181_init(SysBusDevice *dev)
     sysbus_init_irq(dev, &s->irq[0]);
     sysbus_init_irq(dev, &s->irq[1]);
     bd = qdev_init_bdrv(&dev->qdev, IF_SD);
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, 0, 0);
     qemu_register_reset(pl181_reset, s);
     pl181_reset(s);
     /* ??? Save/restore.  */
diff --git a/hw/pxa2xx_mmci.c b/hw/pxa2xx_mmci.c
index a415349..01e7f1e 100644
--- a/hw/pxa2xx_mmci.c
+++ b/hw/pxa2xx_mmci.c
@@ -532,7 +532,7 @@  PXA2xxMMCIState *pxa2xx_mmci_init(target_phys_addr_t base,
     cpu_register_physical_memory(base, 0x00100000, iomemtype);
 
     /* Instantiate the actual storage */
-    s->card = sd_init(bd, 0);
+    s->card = sd_init(bd, 0, 0);
 
     register_savevm("pxa2xx_mmci", 0, 0,
                     pxa2xx_mmci_save, pxa2xx_mmci_load, s);
diff --git a/hw/sd.h b/hw/sd.h
index ac4b7c4..96450f2 100644
--- a/hw/sd.h
+++ b/hw/sd.h
@@ -67,7 +67,8 @@  typedef struct {
 
 typedef struct SDState SDState;
 
-SDState *sd_init(BlockDriverState *bs, int is_spi);
+SDState *sd_init(BlockDriverState *bs, int is_spi, int is_mmc);
+void sd_reset(SDState *sd);
 int sd_do_command(SDState *sd, SDRequest *req,
                   uint8_t *response);
 void sd_write_data(SDState *sd, uint8_t value);
@@ -75,5 +76,6 @@  uint8_t sd_read_data(SDState *sd);
 void sd_set_cb(SDState *sd, qemu_irq readonly, qemu_irq insert);
 int sd_data_ready(SDState *sd);
 void sd_enable(SDState *sd, int enable);
+int sd_is_mmc(SDState *sd);
 
 #endif	/* __hw_sd_h */
diff --git a/hw/ssi-sd.c b/hw/ssi-sd.c
index 5e74e5d..a5d350d 100644
--- a/hw/ssi-sd.c
+++ b/hw/ssi-sd.c
@@ -236,7 +236,7 @@  static int ssi_sd_init(SSISlave *dev)
 
     s->mode = SSI_SD_CMD;
     bs = qdev_init_bdrv(&dev->qdev, IF_SD);
-    s->sd = sd_init(bs, 1);
+    s->sd = sd_init(bs, 1, 0);
     register_savevm("ssi_sd", -1, 1, ssi_sd_save, ssi_sd_load, s);
     return 0;
 }