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,8 +205,13 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status ...@@ -205,8 +205,13 @@ 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);
do {
int count = host->size - (readl(base + MMCIFIFOCNT) << 2);
if (count > 0) { if (count > 0) {
ret = 1; ret = 1;
...@@ -216,7 +221,11 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status ...@@ -216,7 +221,11 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status
} }
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; /*
* Map the BIO buffer.
*/
buffer = bio_kmap_irq(req->bio, &flags);
do {
unsigned int count, maxcnt;
maxcnt = status & MCI_TXFIFOEMPTY ? maxcnt = status & MCI_TXFIFOEMPTY ?
MCI_FIFOSIZE : MCI_FIFOHALFSIZE; MCI_FIFOSIZE : MCI_FIFOHALFSIZE;
count = min(host->size, maxcnt); count = min(host->size, maxcnt);
writesl(base + MMCIFIFO, buffer + host->offset, count >> 2); writesl(base + MMCIFIFO, buffer + host->offset, count >> 2);
host->offset += count; host->offset += count;
host->size -= count; host->size -= count;
ret = 1; ret = 1;
status = readl(base + MMCISTATUS); status = readl(base + MMCISTATUS);
} while (status & MCI_TXFIFOHALFEMPTY); } 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