Commit c8ebd528 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by James Toy

Add support for tmio_mmc hardware configurations, that lack the cnf io

area, like SuperH SoCs.  With this patch such hardware can pass a single
ctl io area with the platform data.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Acked-by: default avatarMagnus Damm <damm@opensource.se>
Cc: Pierre Ossman <drzeus@drzeus.cx>
Cc: Matt Fleming <matt@console-pimps.org>
Cc: Ian Molton <ian@mnementh.co.uk>
Cc: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent a9292020
......@@ -519,12 +519,12 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
struct mmc_host *mmc;
int ret = -EINVAL;
if (dev->num_resources != 3)
if (dev->num_resources < 2 || dev->num_resources > 3)
goto out;
res_ctl = platform_get_resource(dev, IORESOURCE_MEM, 0);
res_cnf = platform_get_resource(dev, IORESOURCE_MEM, 1);
if (!res_ctl || !res_cnf)
if (!res_ctl)
goto out;
pdata = cell->driver_data;
......@@ -548,9 +548,11 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
if (!host->ctl)
goto host_free;
host->cnf = ioremap(res_cnf->start, resource_size(res_cnf));
if (!host->cnf)
goto unmap_ctl;
if (res_cnf) {
host->cnf = ioremap(res_cnf->start, resource_size(res_cnf));
if (!host->cnf)
goto unmap_ctl;
}
mmc->ops = &tmio_mmc_ops;
mmc->caps = MMC_CAP_4_BIT_DATA;
......@@ -606,7 +608,8 @@ static int __devinit tmio_mmc_probe(struct platform_device *dev)
return 0;
unmap_cnf:
iounmap(host->cnf);
if (host->cnf)
iounmap(host->cnf);
unmap_ctl:
iounmap(host->ctl);
host_free:
......@@ -626,7 +629,8 @@ static int __devexit tmio_mmc_remove(struct platform_device *dev)
mmc_remove_host(mmc);
free_irq(host->irq, host);
iounmap(host->ctl);
iounmap(host->cnf);
if (host->cnf)
iounmap(host->cnf);
mmc_free_host(mmc);
}
......
......@@ -166,18 +166,24 @@ static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr,
static inline void sd_config_write8(struct tmio_mmc_host *host, int addr,
u8 val)
{
if (!host->cnf)
return;
writeb(val, host->cnf + (addr << host->bus_shift));
}
static inline void sd_config_write16(struct tmio_mmc_host *host, int addr,
u16 val)
{
if (!host->cnf)
return;
writew(val, host->cnf + (addr << host->bus_shift));
}
static inline void sd_config_write32(struct tmio_mmc_host *host, int addr,
u32 val)
{
if (!host->cnf)
return;
writew(val, host->cnf + (addr << host->bus_shift));
writew(val >> 16, host->cnf + ((addr + 2) << host->bus_shift));
}
......
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