Commit 3dc036d2 authored by Russell King's avatar Russell King

[MMC] MMCI: use bio_kmap_irq() rather than req->buffer

This is in preparation for SG data IO.
parent 0b364777
...@@ -196,7 +196,7 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status ...@@ -196,7 +196,7 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status
int ret = 0; int ret = 0;
do { do {
unsigned int count; unsigned long flags;
char *buffer; char *buffer;
/* /*
...@@ -205,18 +205,27 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status ...@@ -205,18 +205,27 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status
if (!(status & MCI_RXDATAAVLBL)) if (!(status & MCI_RXDATAAVLBL))
break; break;
buffer = req->buffer; /*
count = host->size - (readl(base + MMCIFIFOCNT) << 2); * Map the BIO buffer.
*/
buffer = bio_kmap_irq(req->bio, &flags);
if (count > 0) { do {
ret = 1; int count = host->size - (readl(base + MMCIFIFOCNT) << 2);
readsl(base + MMCIFIFO, buffer + host->offset, count >> 2);
host->offset += count; if (count > 0) {
host->size -= count; ret = 1;
} readsl(base + MMCIFIFO, buffer + host->offset, count >> 2);
host->offset += count;
host->size -= count;
}
status = readl(base + MMCISTATUS); status = readl(base + MMCISTATUS);
} while (status & MCI_RXDATAAVLBL); } while (status & MCI_RXDATAAVLBL && host->size);
bio_kunmap_irq(buffer, &flags);
break;
} while (1);
return ret; return ret;
} }
...@@ -227,7 +236,7 @@ static int mmci_pio_write(struct mmci_host *host, struct request *req, u32 statu ...@@ -227,7 +236,7 @@ static int mmci_pio_write(struct mmci_host *host, struct request *req, u32 statu
int ret = 0; int ret = 0;
do { do {
unsigned int count, maxcnt; unsigned long flags;
char *buffer; char *buffer;
/* /*
...@@ -238,20 +247,30 @@ static int mmci_pio_write(struct mmci_host *host, struct request *req, u32 statu ...@@ -238,20 +247,30 @@ static int mmci_pio_write(struct mmci_host *host, struct request *req, u32 statu
if (!(status & MCI_TXFIFOHALFEMPTY)) if (!(status & MCI_TXFIFOHALFEMPTY))
break; break;
buffer = req->buffer; /*
maxcnt = status & MCI_TXFIFOEMPTY ? * Map the BIO buffer.
MCI_FIFOSIZE : MCI_FIFOHALFSIZE; */
count = min(host->size, maxcnt); buffer = bio_kmap_irq(req->bio, &flags);
writesl(base + MMCIFIFO, buffer + host->offset, count >> 2); do {
unsigned int count, maxcnt;
host->offset += count; maxcnt = status & MCI_TXFIFOEMPTY ?
host->size -= count; MCI_FIFOSIZE : MCI_FIFOHALFSIZE;
count = min(host->size, maxcnt);
ret = 1; writesl(base + MMCIFIFO, buffer + host->offset, count >> 2);
host->offset += count;
host->size -= count;
status = readl(base + MMCISTATUS); ret = 1;
} while (status & MCI_TXFIFOHALFEMPTY);
status = readl(base + MMCISTATUS);
} while (status & MCI_TXFIFOHALFEMPTY && host->size);
bio_kunmap_irq(buffer, &flags);
break;
} while (1);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment