diff options
author | Ludovic Desroches <ludovic.desroches@atmel.com> | 2011-08-11 19:25:47 +0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2011-10-26 23:43:26 +0400 |
commit | 341fa4c3affe1171005597847a86e4c26dea8bb1 (patch) | |
tree | e248b1ba0d88f1d1b4fb4e3c3b75627d38fc1420 /drivers/mmc | |
parent | 1ebbe3d31fd96865b4d4874f3c74fef0e386fb79 (diff) | |
download | linux-341fa4c3affe1171005597847a86e4c26dea8bb1.tar.xz |
mmc: atmel-mci: correct sg buffer size evaluation
Assuming that a sg buffer size is a page size is false so use sg_dma_len.
A 4096 bytes can be required with two 2048-bytes sg buffer.
Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/host/atmel-mci.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index c0a0659261aa..96004c9fe3a5 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -608,7 +608,7 @@ static void atmci_pdc_set_single_buf(struct atmel_mci *host, } atmci_writel(host, pointer_reg, sg_dma_address(host->sg)); - if (host->data_size <= PAGE_SIZE) { + if (host->data_size <= sg_dma_len(host->sg)) { if (host->data_size & 0x3) { /* If size is different from modulo 4, transfer bytes */ atmci_writel(host, counter_reg, host->data_size); @@ -620,8 +620,8 @@ static void atmci_pdc_set_single_buf(struct atmel_mci *host, host->data_size = 0; } else { /* We assume the size of a page is 32-bits aligned */ - atmci_writel(host, counter_reg, PAGE_SIZE / 4); - host->data_size -= PAGE_SIZE; + atmci_writel(host, counter_reg, sg_dma_len(host->sg) / 4); + host->data_size -= sg_dma_len(host->sg); if (host->data_size) host->sg = sg_next(host->sg); } @@ -808,7 +808,6 @@ atmci_prepare_data_pdc(struct atmel_mci *host, struct mmc_data *data) /* Configure PDC */ host->data_size = data->blocks * data->blksz; sg_len = dma_map_sg(&host->pdev->dev, data->sg, data->sg_len, dir); - BUG_ON(sg_len < host->data_size / PAGE_SIZE); if (host->data_size) atmci_pdc_set_both_buf(host, ((dir == DMA_FROM_DEVICE) ? XFER_RECEIVE : XFER_TRANSMIT)); |