Skip to content

Commit

Permalink
[MMC] Convert all hosts except mmci to use data->blksz
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Russell King authored and Russell King committed Jun 19, 2006
1 parent 12223da commit a3fd4a1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion drivers/mmc/at91_mci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/imxmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions drivers/mmc/omap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions drivers/mmc/sdhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit a3fd4a1

Please sign in to comment.