diff options
author | Mischa Jonker <mischa.jonker@synopsys.com> | 2013-07-26 16:18:40 +0200 |
---|---|---|
committer | Pantelis Antoniou <panto@antoniou-consulting.com> | 2013-09-20 18:59:11 +0300 |
commit | 21bd5761a6e945eabaf245668868b58c2772fa21 (patch) | |
tree | 6e1fa187f2a6cb93764270aa44d49e8e1263f26e /drivers/mmc | |
parent | 2136d22630ef5acf36b90c45b6e44e964547b618 (diff) | |
download | u-boot-imx-21bd5761a6e945eabaf245668868b58c2772fa21.zip u-boot-imx-21bd5761a6e945eabaf245668868b58c2772fa21.tar.gz u-boot-imx-21bd5761a6e945eabaf245668868b58c2772fa21.tar.bz2 |
mmc/dw_mmc: Allocate the correct amount of descriptors
This fixes two issues:
* a descriptor was allocated for every block, while a descriptor can
take 8 blocks
* there was an off-by-one error in the descriptor preparation: there
were two last descriptors, one with length==0
Signed-off-by: Mischa Jonker <mjonker@synopsys.com>
Cc: Alexey Brodkin <abrodkin@synopsys.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Andy Fleming <afleming@gmail.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/dw_mmc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index 796a811..9a803a0 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -72,7 +72,7 @@ static void dwmci_prepare_data(struct dwmci_host *host, dwmci_set_idma_desc(cur_idmac, flags, cnt, start_addr + (i * PAGE_SIZE)); - if(blk_cnt < 8) + if (blk_cnt <= 8) break; blk_cnt -= 8; cur_idmac++; @@ -111,7 +111,7 @@ static int dwmci_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, { struct dwmci_host *host = (struct dwmci_host *)mmc->priv; ALLOC_CACHE_ALIGN_BUFFER(struct dwmci_idmac, cur_idmac, - data ? data->blocks : 0); + data ? DIV_ROUND_UP(data->blocks, 8) : 0); int flags = 0, i; unsigned int timeout = 100000; u32 retry = 10000; |