PERFORCE change 107209 for review
Warner Losh
imp at FreeBSD.org
Tue Oct 3 12:42:05 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=107209
Change 107209 by imp at imp_lighthouse on 2006/10/03 19:41:03
Add data command logging
decrement mapped when we unmap the DMA buffer
On the error path, if we have a dma buffer mapped, unmap it
In read finished processing:
o swap all the words in the buffer, not just the first one
o Disable ENDRX and enable RXBUFF interrutps
o turn off transfer bits of PDC (maybe could RXTDIS?)
When we get a RXBUFF interrupt, disable it before enabling CMDRDY
Affected files ...
.. //depot/projects/arm/src/sys/arm/at91/at91_mci.c#17 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/at91/at91_mci.c#17 (text+ko) ====
@@ -378,6 +378,7 @@
} else
panic("Write write support");
}
+ printf("CMDR %x ARGR %x with data\n", cmdr, cmd->arg);
WR4(sc, MCI_ARGR, cmd->arg);
WR4(sc, MCI_CMDR, cmdr);
if (cmdr & MCI_CMDR_TRCMD_START) {
@@ -474,10 +475,15 @@
cmd = sc->curcmd;
bus_dmamap_sync(sc->dmatag, sc->map, BUS_DMASYNC_POSTREAD);
bus_dmamap_unload(sc->dmatag, sc->map);
+ sc->mapped--;
walker = (uint32_t *)cmd->data->data;
len = cmd->data->len / 4;
for (i = 0; i < len; i++)
- *walker = bswap32(*walker);
+ walker[i] = bswap32(walker[i]);
+ // Finish up the sequence...
+ WR4(sc, MCI_IDR, MCI_SR_ENDRX);
+ WR4(sc, MCI_IER, MCI_SR_RXBUFF);
+ WR4(sc, PDC_PTCR, PDC_PTCR_RXTDIS | PDC_PTCR_TXTDIS);
}
static void
@@ -506,6 +512,10 @@
else
cmd->error = MMC_ERR_FAILED;
done = 1;
+ if (sc->mapped && cmd->error) {
+ bus_dmamap_unload(sc->dmatag, sc->map);
+ sc->mapped--;
+ }
} else {
if (sr & MCI_SR_TXBUFE) {
printf("TXBUFE\n");
@@ -513,6 +523,7 @@
}
if (sr & MCI_SR_RXBUFF) {
printf("RXBUFF\n");
+ WR4(sc, MCI_IDR, MCI_SR_RXBUFF);
WR4(sc, MCI_IER, MCI_SR_CMDRDY);
}
if (sr & MCI_SR_ENDTX) {
More information about the p4-projects
mailing list