Commit 0b364777 authored by Russell King's avatar Russell King

[MMC] MMCI: Maintain offset rather than buffer pointer for PIO

parent 8fe6710a
...@@ -64,7 +64,6 @@ static void mmci_stop_data(struct mmci_host *host) ...@@ -64,7 +64,6 @@ static void mmci_stop_data(struct mmci_host *host)
writel(0, host->base + MMCIDATACTRL); writel(0, host->base + MMCIDATACTRL);
writel(0, host->base + MMCIMASK1); writel(0, host->base + MMCIMASK1);
host->data = NULL; host->data = NULL;
host->buffer = NULL;
} }
static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
...@@ -76,7 +75,7 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data) ...@@ -76,7 +75,7 @@ static void mmci_start_data(struct mmci_host *host, struct mmc_data *data)
1 << data->blksz_bits, data->blocks, data->flags); 1 << data->blksz_bits, data->blocks, data->flags);
host->data = data; host->data = data;
host->buffer = data->req->buffer; host->offset = 0;
host->size = data->blocks << data->blksz_bits; host->size = data->blocks << data->blksz_bits;
host->data_xfered = 0; host->data_xfered = 0;
...@@ -198,6 +197,7 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status ...@@ -198,6 +197,7 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status
do { do {
unsigned int count; unsigned int count;
char *buffer;
/* /*
* Check for data available. * Check for data available.
...@@ -205,13 +205,13 @@ static int mmci_pio_read(struct mmci_host *host, struct request *req, u32 status ...@@ -205,13 +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); count = host->size - (readl(base + MMCIFIFOCNT) << 2);
if (count < 0)
count = 0; if (count > 0) {
if (count && host->buffer) {
ret = 1; ret = 1;
readsl(base + MMCIFIFO, host->buffer, count >> 2); readsl(base + MMCIFIFO, buffer + host->offset, count >> 2);
host->buffer += count; host->offset += count;
host->size -= count; host->size -= count;
} }
...@@ -228,6 +228,7 @@ static int mmci_pio_write(struct mmci_host *host, struct request *req, u32 statu ...@@ -228,6 +228,7 @@ static int mmci_pio_write(struct mmci_host *host, struct request *req, u32 statu
do { do {
unsigned int count, maxcnt; unsigned int count, maxcnt;
char *buffer;
/* /*
* We only need to test the half-empty flag here - if * We only need to test the half-empty flag here - if
...@@ -237,13 +238,14 @@ static int mmci_pio_write(struct mmci_host *host, struct request *req, u32 statu ...@@ -237,13 +238,14 @@ 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 ? 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, host->buffer, count >> 2); writesl(base + MMCIFIFO, buffer + host->offset, count >> 2);
host->buffer += count; host->offset += count;
host->size -= count; host->size -= count;
ret = 1; ret = 1;
......
...@@ -138,6 +138,6 @@ struct mmci_host { ...@@ -138,6 +138,6 @@ struct mmci_host {
unsigned int oldstat; unsigned int oldstat;
/* pio stuff */ /* pio stuff */
void *buffer; unsigned int offset;
unsigned int size; unsigned int size;
}; };
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