[MMC] Convert all hosts except mmci to use data->blksz
The MMC specification allows non-power of two block sizes. As such, we should not pass the log2 block size to host drivers, but instead pass the byte size. However, ARM MMCI can only work with log2 block size, so continue to pass both the log2 block size and byte block size. This means that for the moment, the byte block size must remain a power of two, but this is the first stage of removing this restriction for other hosts. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
parent
12223dabc6
commit
a3fd4a1b9c
@ -411,7 +411,7 @@ static unsigned int at91_mci_send_command(struct at91mci_host *host, struct mmc_
|
||||
}
|
||||
|
||||
if (data) {
|
||||
block_length = 1 << data->blksz_bits;
|
||||
block_length = data->blksz;
|
||||
blocks = data->blocks;
|
||||
|
||||
/* always set data start - also set direction flag for read */
|
||||
|
@ -228,7 +228,7 @@ static int imxmci_busy_wait_for_status(struct imxmci_host *host,
|
||||
static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data)
|
||||
{
|
||||
unsigned int nob = data->blocks;
|
||||
unsigned int blksz = 1 << data->blksz_bits;
|
||||
unsigned int blksz = data->blksz;
|
||||
unsigned int datasz = nob * blksz;
|
||||
int i;
|
||||
|
||||
|
@ -584,10 +584,10 @@ mmc_omap_prepare_dma(struct mmc_omap_host *host, struct mmc_data *data)
|
||||
int sync_dev = 0;
|
||||
|
||||
data_addr = io_v2p((u32) host->base) + OMAP_MMC_REG_DATA;
|
||||
frame = 1 << data->blksz_bits;
|
||||
frame = data->blksz;
|
||||
count = sg_dma_len(sg);
|
||||
|
||||
if ((data->blocks == 1) && (count > (1 << data->blksz_bits)))
|
||||
if ((data->blocks == 1) && (count > data->blksz))
|
||||
count = frame;
|
||||
|
||||
host->dma_len = count;
|
||||
@ -776,7 +776,7 @@ mmc_omap_prepare_data(struct mmc_omap_host *host, struct mmc_request *req)
|
||||
}
|
||||
|
||||
|
||||
block_size = 1 << data->blksz_bits;
|
||||
block_size = data->blksz;
|
||||
|
||||
OMAP_MMC_WRITE(host->base, NBLK, data->blocks - 1);
|
||||
OMAP_MMC_WRITE(host->base, BLEN, block_size - 1);
|
||||
|
@ -268,7 +268,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
|
||||
}
|
||||
|
||||
DBG("blksz %04x blks %04x flags %08x\n",
|
||||
1 << data->blksz_bits, data->blocks, data->flags);
|
||||
data->blksz, data->blocks, data->flags);
|
||||
DBG("tsac %d ms nsac %d clk\n",
|
||||
data->timeout_ns / 1000000, data->timeout_clks);
|
||||
|
||||
@ -282,7 +282,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
|
||||
|
||||
writew(mode, host->ioaddr + SDHCI_TRANSFER_MODE);
|
||||
|
||||
writew(1 << data->blksz_bits, host->ioaddr + SDHCI_BLOCK_SIZE);
|
||||
writew(data->blksz, host->ioaddr + SDHCI_BLOCK_SIZE);
|
||||
writew(data->blocks, host->ioaddr + SDHCI_BLOCK_COUNT);
|
||||
|
||||
if (host->flags & SDHCI_USE_DMA) {
|
||||
@ -294,7 +294,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
|
||||
|
||||
writel(sg_dma_address(data->sg), host->ioaddr + SDHCI_DMA_ADDRESS);
|
||||
} else {
|
||||
host->size = (1 << data->blksz_bits) * data->blocks;
|
||||
host->size = data->blksz * data->blocks;
|
||||
|
||||
host->cur_sg = data->sg;
|
||||
host->num_sg = data->sg_len;
|
||||
@ -335,7 +335,7 @@ static void sdhci_finish_data(struct sdhci_host *host)
|
||||
blocks = 0;
|
||||
else
|
||||
blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT);
|
||||
data->bytes_xfered = (1 << data->blksz_bits) * (data->blocks - blocks);
|
||||
data->bytes_xfered = data->blksz * (data->blocks - blocks);
|
||||
|
||||
if ((data->error == MMC_ERR_NONE) && blocks) {
|
||||
printk(KERN_ERR "%s: Controller signalled completion even "
|
||||
|
Loading…
Reference in New Issue
Block a user