Skip to contentSkip to conversation

[4640] Enable SD card on creation.

Qemu-devel Andrzej Zaborowski 2 participants 3 messages Jun 2, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 4640

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4640
Author:   balrog
Date:     2008-06-02 00:55:08 +0000 (Mon, 02 Jun 2008)

Log Message:
-----------
Enable SD card on creation.

Modified Paths:
--------------
trunk/hw/sd.c

Modified: trunk/hw/sd.c
===================================================================

hw/sd.c +1 -0
@@ -421,6 +421,7 @@
     sd = (SDState *) qemu_mallocz(sizeof(SDState));
     sd->buf = qemu_memalign(512, 512);
     sd->spi = is_spi;
+    sd->enable = 1;
     sd_reset(sd, bs);
     bdrv_set_change_cb(sd->bdrv, sd_cardchange, sd);
     return sd;
#1 lore raw
Quoted 9 lines · Andrzej Zaborowski

Revision: 4640

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4640
Author:   balrog
Date:     2008-06-02 00:55:08 +0000 (Mon, 02 Jun 2008)

Log Message:
-----------
Enable SD card on creation.
void sd_enable(SDState *sd, int enable)

This shouldn't exist to start with. It should be using a qemu_irq, like the other GPIO pins do, and probably wants to be implemented outside sd.c anyway. The whole point of chip selects is to allow multiple devices on the same bus. See stellaris_ssi_bus for an example of a bus multiplexer with chip selects.

Paul

#2 lore raw
Quoted 4 lines · Paul Brook
Quoted 1 line

void sd_enable(SDState *sd, int enable)

This shouldn't exist to start with. It should be using a qemu_irq, like the other GPIO pins do, and probably wants to be implemented outside sd.c anyway.

Yes, that shouldn't be in sd.c. We should be able to create a number of SD cards and "insert" and "eject" them from the slots using monitor commands or a chipselect pin driven by guest.

I partially did this in svn.openmoko.org qemu where we have SDIO cards using the same slots as SD.

The root misconception is of whether BlockDriverState represents the drive or the media. In the cd-rom implementation the whole state machine is in the drive and the media is just a piece of plastic. In MMC/SD the removable card has the entire state machine in it and using bdrv_is_inserted() makes no sense anymore.

Signature · 2 lines
Please do not print this email unless absolutely necessary. Spread
environmental awareness.