Commit f1334fb3 authored by Yusuke Goda's avatar Yusuke Goda Committed by Samuel Ortiz

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: default avatarYusuke Goda <yusuke.goda.sx@renesas.com>
Signed-off-by: default avatarMatt Fleming <matt@console-pimps.org>
Acked-by: default avatarMagnus Damm <damm@opensource.se>
Tested-by: default avatarArnd Hannemann <arnd@arndnet.de>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 68accd73
...@@ -125,6 +125,12 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev) ...@@ -125,6 +125,12 @@ static int __devinit sh_mobile_sdhi_probe(struct platform_device *pdev)
mmc_data->capabilities |= p->tmio_caps; mmc_data->capabilities |= p->tmio_caps;
} }
/*
* All SDHI blocks support 2-byte and larger block sizes in 4-bit
* bus width mode.
*/
mmc_data->flags |= TMIO_MMC_BLKSZ_2BYTES;
if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) { if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) {
priv->param_tx.slave_id = p->dma_slave_tx; priv->param_tx.slave_id = p->dma_slave_tx;
priv->param_rx.slave_id = p->dma_slave_rx; priv->param_rx.slave_id = p->dma_slave_rx;
......
...@@ -658,14 +658,21 @@ static void tmio_mmc_release_dma(struct tmio_mmc_host *host) ...@@ -658,14 +658,21 @@ static void tmio_mmc_release_dma(struct tmio_mmc_host *host)
static int tmio_mmc_start_data(struct tmio_mmc_host *host, static int tmio_mmc_start_data(struct tmio_mmc_host *host,
struct mmc_data *data) struct mmc_data *data)
{ {
struct mfd_cell *cell = host->pdev->dev.platform_data;
struct tmio_mmc_data *pdata = cell->driver_data;
pr_debug("setup data transfer: blocksize %08x nr_blocks %d\n", pr_debug("setup data transfer: blocksize %08x nr_blocks %d\n",
data->blksz, data->blocks); data->blksz, data->blocks);
/* Hardware cannot perform 1 and 2 byte requests in 4 bit mode */ /* Some hardware cannot perform 2 byte requests in 4 bit mode */
if (data->blksz < 4 && host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) { if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4) {
pr_err("%s: %d byte block unsupported in 4 bit mode\n", int blksz_2bytes = pdata->flags & TMIO_MMC_BLKSZ_2BYTES;
mmc_hostname(host->mmc), data->blksz);
return -EINVAL; if (data->blksz < 2 || (data->blksz < 4 && !blksz_2bytes)) {
pr_err("%s: %d byte block unsupported in 4 bit mode\n",
mmc_hostname(host->mmc), data->blksz);
return -EINVAL;
}
} }
tmio_mmc_init_sg(host, data); tmio_mmc_init_sg(host, data);
......
...@@ -52,6 +52,11 @@ ...@@ -52,6 +52,11 @@
/* tmio MMC platform flags */ /* tmio MMC platform flags */
#define TMIO_MMC_WRPROTECT_DISABLE (1 << 0) #define TMIO_MMC_WRPROTECT_DISABLE (1 << 0)
/*
* Some controllers can support a 2-byte block size when the bus width
* is configured in 4-bit mode.
*/
#define TMIO_MMC_BLKSZ_2BYTES (1 << 1)
int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base); int tmio_core_mmc_enable(void __iomem *cnf, int shift, unsigned long base);
int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base); int tmio_core_mmc_resume(void __iomem *cnf, int shift, unsigned long base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment