diff options
author | Yusuke Goda <yusuke.goda.sx@renesas.com> | 2010-08-30 06:50:19 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2010-10-28 18:29:16 -0400 |
commit | f1334fb3c3006ba109886158c0ad79512f928bc1 (patch) | |
tree | 99038a92a9e1bf77e96129473614fad4d99a0d33 | |
parent | 68accd7370a90b899ea6563ba9032e5a102ec1b5 (diff) |
mmc: Allow 2 byte requests in 4-bit mode for tmio_mmc
Adjust the tmio_mmc block size check to accept 2-byte requests in 4-bit
mode if the hardware supports it.
Tested with the SDHI hardware block included in sh7724.
Signed-off-by: Yusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: Matt Fleming <matt@console-pimps.org>
Acked-by: Magnus Damm <damm@opensource.se>
Tested-by: Arnd Hannemann <arnd@arndnet.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r-- | drivers/mfd/sh_mobile_sdhi.c | 6 | ||||
-rw-r--r-- | drivers/mmc/host/tmio_mmc.c | 17 | ||||
-rw-r--r-- | include/linux/mfd/tmio.h | 5 |
3 files changed, 23 insertions, 5 deletions
diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c index 01d83a41d570..f1714f93af9d 100644 --- a/drivers/mfd/sh_mobile_sdhi.c +++ b/drivers/mfd/sh_mobile_sdhi.c | |||
@@ -125,6 +125,12 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) | |||
125 | mmc_data->capabilities |= p->tmio_caps; | 125 | mmc_data->capabilities |= p->tmio_caps; |
126 | } | 126 | } |
127 | 127 | ||
128 | /* | ||
129 | * All SDHI blocks support 2-byte and larger block sizes in 4-bit | ||
130 | * bus width mode. | ||
131 | */ | ||
132 | mmc_data->flags |= TMIO_MMC_BLKSZ_2BYTES; | ||
133 | |||
128 | if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) { | 134 | if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) { |
129 | priv->param_tx.slave_id = p->dma_slave_tx; | 135 | priv->param_tx.slave_id = p->dma_slave_tx; |
130 | priv->param_rx.slave_id = p->dma_slave_rx; | 136 | priv->param_rx.slave_id = p->dma_slave_rx; |
diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c index 1a47221d01a4..e7765a89593e 100644 --- a/drivers/mmc/host/tmio_mmc.c +++ b/drivers/mmc/host/tmio_mmc.c | |||
@@ -658,14 +658,21 @@ static void tmio_mmc_release_dma(struct tmio_mmc_host *host) | |||
658 | static int tmio_mmc_start_data(struct tmio_mmc_host *host, | 658 | static int tmio_mmc_start_data(struct tmio_mmc_host *host, |
659 | struct mmc_data *data) | 659 | struct mmc_data *data) |
660 | { | 660 | { |
661 | struct mfd_cell *cell = host->pdev->dev.platform_data; | ||
662 | struct tmio_mmc_data *pdata = cell->driver_data; | ||
663 | |||
661 | pr_debug("setup data transfer: blocksize %08x nr_blocks %d\n", | 664 | pr_debug("setup data transfer: blocksize %08x nr_blocks %d\n", |
662 | data->blksz, data->blocks); | 665 | data->blksz, data->blocks); |
663 | 666 | ||
664 | /* Hardware cannot perform 1 and 2 byte requests in 4 bit mode */ | 667 | /* Some hardware cannot perform 2 byte requests in 4 bit mode */ |
665 | if (data->blksz < 4 && host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) { | 668 | if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) { |
666 | pr_err("%s: %d byte block unsupported in 4 bit mode\n", | 669 | int blksz_2bytes = pdata->flags & TMIO_MMC_BLKSZ_2BYTES; |
667 | mmc_hostname(host->mmc), data->blksz); | 670 | |
668 | return -EINVAL; | 671 | if (data->blksz < 2 || (data->blksz < 4 && !blksz_2bytes)) { |
672 | pr_err("%s: %d byte block unsupported in 4 bit mode\n", | ||
673 | mmc_hostname(host->mmc), data->blksz); | ||
674 | return -EINVAL; | ||
675 | } | ||
669 | } | 676 | } |
670 | 677 | ||
671 | tmio_mmc_init_sg(host, data); | 678 | tmio_mmc_init_sg(host, data); |
diff --git a/include/linux/mfd/tmio.h b/include/linux/mfd/tmio.h index 24c43bbad541..085f041197dc 100644 --- a/include/linux/mfd/tmio.h +++ b/include/linux/mfd/tmio.h | |||
@@ -52,6 +52,11 @@ | |||
52 | 52 | ||
53 | /* tmio MMC platform flags */ | 53 | /* tmio MMC platform flags */ |
54 | #define TMIO_MMC_WRPROTECT_DISABLE (1 << 0) | 54 | #define TMIO_MMC_WRPROTECT_DISABLE (1 << 0) |
55 | /* | ||
56 | * Some controllers can support a 2-byte block size when the bus width | ||
57 | * is configured in 4-bit mode. | ||
58 | */ | ||
59 | #define TMIO_MMC_BLKSZ_2BYTES (1 << 1) | ||
55 | 60 | ||
56 | int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); | 61 | int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); |
57 | int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); | 62 | int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); |