diff options
author | Bridge Wu <bridge.wu@marvell.com> | 2007-12-13 01:24:30 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:07:52 -0500 |
commit | 64eb036af42d3816364c4db49d93be3a4614389c (patch) | |
tree | 920a52c9b29aace4006d753fc8b1d43754bca0fc | |
parent | 9e2697ff371b4380dca108a66860868c19d8c4b6 (diff) |
[ARM] 4709/1: pxa: mmc: add 26MHz support for pxa3[0|1]0 mmc controller
pxa3[0|1]0 mmc controller can support 26MHz clock mode, they support
SD spec 1.1 and MMC spec 4.0 which specify high speed mode. So host
caps will include MMC_CAP_MMC_HIGHSPEED and MMC_CAP_SD_HIGHSPEED for
pxa3[0|1]0.
This patch is to add 26MHz support for them. pxa host clock will be
set to 26MHz mode when the card supported max clock rate is higher
than or equal to 26MHz.
Signed-off-by: Bridge Wu <bridge.wu@marvell.com>
Acked-by: Pierre Ossman <drzeus@drzeus.cx>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | drivers/mmc/host/pxamci.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 1654a3330340..80df4b047c81 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -375,14 +375,23 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
375 | if (host->clkrt == CLKRT_OFF) | 375 | if (host->clkrt == CLKRT_OFF) |
376 | clk_enable(host->clk); | 376 | clk_enable(host->clk); |
377 | 377 | ||
378 | /* | 378 | if (ios->clock == 26000000) { |
379 | * clk might result in a lower divisor than we | 379 | /* to support 26MHz on pxa300/pxa310 */ |
380 | * desire. check for that condition and adjust | 380 | host->clkrt = 7; |
381 | * as appropriate. | 381 | } else { |
382 | */ | 382 | /* to handle (19.5MHz, 26MHz) */ |
383 | if (rate / clk > ios->clock) | 383 | if (!clk) |
384 | clk <<= 1; | 384 | clk = 1; |
385 | host->clkrt = fls(clk) - 1; | 385 | |
386 | /* | ||
387 | * clk might result in a lower divisor than we | ||
388 | * desire. check for that condition and adjust | ||
389 | * as appropriate. | ||
390 | */ | ||
391 | if (rate / clk > ios->clock) | ||
392 | clk <<= 1; | ||
393 | host->clkrt = fls(clk) - 1; | ||
394 | } | ||
386 | 395 | ||
387 | /* | 396 | /* |
388 | * we write clkrt on the next command | 397 | * we write clkrt on the next command |
@@ -519,7 +528,8 @@ static int pxamci_probe(struct platform_device *pdev) | |||
519 | * Calculate minimum clock rate, rounding up. | 528 | * Calculate minimum clock rate, rounding up. |
520 | */ | 529 | */ |
521 | mmc->f_min = (host->clkrate + 63) / 64; | 530 | mmc->f_min = (host->clkrate + 63) / 64; |
522 | mmc->f_max = host->clkrate; | 531 | mmc->f_max = (cpu_is_pxa300() || cpu_is_pxa310()) ? 26000000 |
532 | : host->clkrate; | ||
523 | 533 | ||
524 | mmc->ocr_avail = host->pdata ? | 534 | mmc->ocr_avail = host->pdata ? |
525 | host->pdata->ocr_mask : | 535 | host->pdata->ocr_mask : |
@@ -529,6 +539,9 @@ static int pxamci_probe(struct platform_device *pdev) | |||
529 | if (!cpu_is_pxa21x() && !cpu_is_pxa25x()) { | 539 | if (!cpu_is_pxa21x() && !cpu_is_pxa25x()) { |
530 | mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; | 540 | mmc->caps |= MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; |
531 | host->cmdat |= CMDAT_SDIO_INT_EN; | 541 | host->cmdat |= CMDAT_SDIO_INT_EN; |
542 | if (cpu_is_pxa300() || cpu_is_pxa310()) | ||
543 | mmc->caps |= MMC_CAP_MMC_HIGHSPEED | | ||
544 | MMC_CAP_SD_HIGHSPEED; | ||
532 | } | 545 | } |
533 | 546 | ||
534 | host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); | 547 | host->sg_cpu = dma_alloc_coherent(&pdev->dev, PAGE_SIZE, &host->sg_dma, GFP_KERNEL); |