diff options
author | Pierre Ossman <drzeus@drzeus.cx> | 2006-11-21 11:54:23 -0500 |
---|---|---|
committer | Pierre Ossman <drzeus@drzeus.cx> | 2007-02-04 14:54:10 -0500 |
commit | fe4a3c7a20f14d86022a8132adbf6ddb98e7197c (patch) | |
tree | 0719b8eb2d8c04c286095365ebff3d29285a5796 /drivers/mmc/sdhci.c | |
parent | dba4accab17bd2e2e09088f746257a8c14af1cc2 (diff) |
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.c | 24 |
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) | |||
381 | 381 | ||
382 | /* Sanity checks */ | 382 | /* Sanity checks */ |
383 | BUG_ON(data->blksz * data->blocks > 524288); | 383 | BUG_ON(data->blksz * data->blocks > 524288); |
384 | BUG_ON(data->blksz > host->max_block); | 384 | BUG_ON(data->blksz > host->mmc->max_blk_size); |
385 | BUG_ON(data->blocks > 65535); | 385 | BUG_ON(data->blocks > 65535); |
386 | 386 | ||
387 | /* timeout in us */ | 387 | /* timeout in us */ |
@@ -1290,15 +1290,6 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1290 | if (caps & SDHCI_TIMEOUT_CLK_UNIT) | 1290 | if (caps & SDHCI_TIMEOUT_CLK_UNIT) |
1291 | host->timeout_clk *= 1000; | 1291 | host->timeout_clk *= 1000; |
1292 | 1292 | ||
1293 | host->max_block = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT; | ||
1294 | if (host->max_block >= 3) { | ||
1295 | printk(KERN_ERR "%s: Invalid maximum block size.\n", | ||
1296 | host->slot_descr); | ||
1297 | ret = -ENODEV; | ||
1298 | goto unmap; | ||
1299 | } | ||
1300 | host->max_block = 512 << host->max_block; | ||
1301 | |||
1302 | /* | 1293 | /* |
1303 | * Set host parameters. | 1294 | * Set host parameters. |
1304 | */ | 1295 | */ |
@@ -1353,6 +1344,19 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1353 | mmc->max_seg_size = mmc->max_sectors * 512; | 1344 | mmc->max_seg_size = mmc->max_sectors * 512; |
1354 | 1345 | ||
1355 | /* | 1346 | /* |
1347 | * Maximum block size. This varies from controller to controller and | ||
1348 | * is specified in the capabilities register. | ||
1349 | */ | ||
1350 | mmc->max_blk_size = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT; | ||
1351 | if (mmc->max_blk_size >= 3) { | ||
1352 | printk(KERN_ERR "%s: Invalid maximum block size.\n", | ||
1353 | host->slot_descr); | ||
1354 | ret = -ENODEV; | ||
1355 | goto unmap; | ||
1356 | } | ||
1357 | mmc->max_blk_size = 512 << mmc->max_blk_size; | ||
1358 | |||
1359 | /* | ||
1356 | * Init tasklets. | 1360 | * Init tasklets. |
1357 | */ | 1361 | */ |
1358 | tasklet_init(&host->card_tasklet, | 1362 | tasklet_init(&host->card_tasklet, |