summaryrefslogtreecommitdiffstats
path: root/drivers/mmc/sdhci.c
diff options
context:
space:
mode:
authorPierre Ossman2006-11-21 17:54:23 +0100
committerPierre Ossman2007-02-04 20:54:10 +0100
commitfe4a3c7a20f14d86022a8132adbf6ddb98e7197c (patch)
tree0719b8eb2d8c04c286095365ebff3d29285a5796 /drivers/mmc/sdhci.c
parenttifm_sd: add suspend and resume functionality (diff)
downloadkernel-qcow2-linux-fe4a3c7a20f14d86022a8132adbf6ddb98e7197c.tar.gz
kernel-qcow2-linux-fe4a3c7a20f14d86022a8132adbf6ddb98e7197c.tar.xz
kernel-qcow2-linux-fe4a3c7a20f14d86022a8132adbf6ddb98e7197c.zip
mmc: Allow host drivers to specify a max block size
Most controllers have an upper limit on the block size. Allow the host drivers to specify this and make sure we avoid hitting this limit. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/sdhci.c')
-rw-r--r--drivers/mmc/sdhci.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 175a9427b9ba..155aafe69bf4 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -381,7 +381,7 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
/* Sanity checks */
BUG_ON(data->blksz * data->blocks > 524288);
- BUG_ON(data->blksz > host->max_block);
+ BUG_ON(data->blksz > host->mmc->max_blk_size);
BUG_ON(data->blocks > 65535);
/* timeout in us */
@@ -1290,15 +1290,6 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
if (caps & SDHCI_TIMEOUT_CLK_UNIT)
host->timeout_clk *= 1000;
- host->max_block = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
- if (host->max_block >= 3) {
- printk(KERN_ERR "%s: Invalid maximum block size.\n",
- host->slot_descr);
- ret = -ENODEV;
- goto unmap;
- }
- host->max_block = 512 << host->max_block;
-
/*
* Set host parameters.
*/
@@ -1353,6 +1344,19 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
mmc->max_seg_size = mmc->max_sectors * 512;
/*
+ * Maximum block size. This varies from controller to controller and
+ * is specified in the capabilities register.
+ */
+ mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT;
+ if (mmc->max_blk_size >= 3) {
+ printk(KERN_ERR "%s: Invalid maximum block size.\n",
+ host->slot_descr);
+ ret = -ENODEV;
+ goto unmap;
+ }
+ mmc->max_blk_size = 512 << mmc->max_blk_size;
+
+ /*
* Init tasklets.
*/
tasklet_init(&host->card_tasklet,