r3753 - trunk/src/host/qemu-neo1973/hw
andrew at sita.openmoko.org
andrew at sita.openmoko.org
Sat Dec 29 03:55:57 CET 2007
Author: andrew
Date: 2007-12-29 03:55:56 +0100 (Sat, 29 Dec 2007)
New Revision: 3753
Modified:
trunk/src/host/qemu-neo1973/hw/ar6000.c
trunk/src/host/qemu-neo1973/hw/s3c24xx_mmci.c
Log:
Teach CMD52 to preserve concurrently executing transfers.
Fix commands without data in S3C24xx mmc/sd host.
Decrement tx-credits on COUNTER_DEC read.
Modified: trunk/src/host/qemu-neo1973/hw/ar6000.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/ar6000.c 2007-12-29 02:11:33 UTC (rev 3752)
+++ trunk/src/host/qemu-neo1973/hw/ar6000.c 2007-12-29 02:55:56 UTC (rev 3753)
@@ -76,6 +76,7 @@
int spi;
int sdio_ok;
int current_cmd;
+ int next_cmd;
uint16_t blk_len[8];
struct {
uint8_t func;
@@ -370,10 +371,13 @@
/* I/O mode commands (Class 9) */
case 52: /* CMD52: IO_RW_DIRECT */
- /* XXX In some situations this must preserve cmdNo and restore later */
switch (sd->state) {
+ case sd_transfer_state:
+ /* A transfer is active on DAT lines, don't break it. */
+ sd->next_cmd = sd->current_cmd;
+
+ /* Fall through. */
case sd_command_state:
- case sd_transfer_state:
fun = (req.arg >> 28) & 7;
addr = (req.arg >> 9) & SDIO_ADDR_MASK;
sd->transfer.data_offset = 0;
@@ -475,9 +479,10 @@
sd->card_status &= ~(COM_CRC_ERROR | ILLEGAL_COMMAND); /* B type */
+ sd->next_cmd = req->cmd;
rtype = sdio_normal_command(sd, *req);
- sd->current_cmd = req->cmd;
+ sd->current_cmd = sd->next_cmd;
switch (rtype) {
case sd_r1:
@@ -699,10 +704,11 @@
return sd->cccr.bus;
case 0x08: /* Card Capability */
- /* XXX: set SDC (01) when CMD52 learns to preserve current_cmd */
- /* XXX: need to addr ReadWait support too (RWC (04)) */
- return 0x12 | sd->cccr.e4mi; /* SMB | S4MI | E4MI | Full-Speed */
+ /* XXX: need to add ReadWait support too (RWC (04)) */
+ /* SDC | SMB | S4MI | E4MI | Full-Speed */
+ return 0x13 | sd->cccr.e4mi;
+
case 0x09: /* Common CIS Pointer */
return (SDIO_CIS_START >> 0) & 0xff;
case 0x0a: /* Common CIS Pointer */
@@ -1022,6 +1028,8 @@
{
struct wmi_s *s = (void *) opaque;
+ /* TODO: reschedule if we're in the middle of a transfer or other
+ * activity. Do the same for other timers we may need in WMI. */
qemu_free_timer(s->alive);
/* Send the initial event */
@@ -1498,7 +1506,7 @@
case AR6K_COUNT_DEC + 0x8: mbox ++;
case AR6K_COUNT_DEC + 0x4: mbox ++;
case AR6K_COUNT_DEC + 0x0:
- return s->hif.cnt_tx[mbox];
+ return s->hif.cnt_tx[mbox] --;
case AR6K_SCRATCH ... (AR6K_SCRATCH + 7):
return s->hif.scratch[addr - AR6K_SCRATCH];
Modified: trunk/src/host/qemu-neo1973/hw/s3c24xx_mmci.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/s3c24xx_mmci.c 2007-12-29 02:11:33 UTC (rev 3752)
+++ trunk/src/host/qemu-neo1973/hw/s3c24xx_mmci.c 2007-12-29 02:55:56 UTC (rev 3753)
@@ -170,6 +170,7 @@
s->blklen_cnt = s->blklen;
s->blknum_cnt = s->blknum;
+ s->data = 0;
if (((s->dcontrol >> 12) & 3) == 1) { /* DatMode */
if (s->dcontrol & (1 << 18)) /* BACMD */
s->data = 1;
@@ -179,6 +180,7 @@
} else if (((s->dcontrol >> 12) & 3) == 3) /* DatMode */
if (s->dcontrol & (1 << 20)) /* RACMD */
s->data = 1;
+ s->data &= s->ccontrol >> 11; /* WithData */
return;
timeout:
More information about the commitlog
mailing list