From: Magnus Damm <magnus.damm@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: drzeus-wbsd@drzeus.cx, Magnus Damm <magnus.damm@gmail.com>,
ian@mnementh.co.uk, akpm@linux-foundation.org
Subject: [PATCH 04/05] tmio_mmc: Make cnf area optional
Date: Wed, 11 Mar 2009 21:59:19 +0900 [thread overview]
Message-ID: <20090311125919.1563.39503.sendpatchset@rx1.opensource.se> (raw)
In-Reply-To: <20090311125845.1563.31960.sendpatchset@rx1.opensource.se>
From: Magnus Damm <damm@opensource.se>
Add support for tmio_mmc hardware configurations that
lack the cnf io area. With this patch such hardware
can pass a single ctl io area with the platform data.
Signed-off-by: Magnus Damm <damm@opensource.se>
---
drivers/mmc/host/tmio_mmc.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
--- 0012/drivers/mmc/host/tmio_mmc.c
+++ work/drivers/mmc/host/tmio_mmc.c 2009-03-11 19:35:46.000000000 +0900
@@ -37,12 +37,18 @@
static void tmio_mmc_cnf_power(struct tmio_mmc_host *host, int on)
{
+ if (!host->cnf)
+ return;
+
tmio_iowrite8(on ? 0x02 : 0x00, host->cnf + CNF_PWR_CTL_2);
}
static void tmio_mmc_cnf_setup_regs(struct tmio_mmc_host *host,
struct platform_device *dev)
{
+ if (!host->cnf)
+ return;
+
/* Enable the MMC/SD Control registers */
tmio_iowrite16(SDCREN, host->cnf + CNF_CMD);
tmio_iowrite32(dev->resource[0].start & 0xfffe,
@@ -52,12 +58,18 @@ static void tmio_mmc_cnf_setup_regs(stru
static void tmio_mmc_cnf_setup_clock(struct tmio_mmc_host *host,
int divide_by_one)
{
+ if (!host->cnf)
+ return;
+
tmio_iowrite8(divide_by_one ? 0 : 1,
host->cnf + CNF_SD_CLK_MODE);
}
static void tmio_mmc_cnf_setup_late(struct tmio_mmc_host *host)
{
+ if (!host->cnf)
+ return;
+
/* Disable SD power during suspend */
tmio_iowrite8(0x01, host->cnf + CNF_PWR_CTL_3);
@@ -576,12 +588,8 @@ static int __devinit tmio_mmc_probe(stru
struct mmc_host *mmc;
int ret = -ENOMEM;
- if (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) {
ret = -EINVAL;
goto out;
}
@@ -598,9 +606,12 @@ static int __devinit tmio_mmc_probe(stru
if (!host->ctl)
goto host_free;
- host->cnf = ioremap(res_cnf->start, resource_size(res_cnf));
- if (!host->cnf)
- goto unmap_ctl;
+ res_cnf = platform_get_resource(dev, IORESOURCE_MEM, 1);
+ 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;
@@ -651,7 +662,8 @@ static int __devinit tmio_mmc_probe(stru
return 0;
unmap_cnf:
- iounmap(host->cnf);
+ if (host->cnf)
+ iounmap(host->cnf);
unmap_ctl:
iounmap(host->ctl);
host_free:
@@ -670,8 +682,9 @@ static int __devexit tmio_mmc_remove(str
struct tmio_mmc_host *host = mmc_priv(mmc);
mmc_remove_host(mmc);
free_irq(host->irq, host);
+ if (host->cnf)
+ iounmap(host->cnf);
iounmap(host->ctl);
- iounmap(host->cnf);
mmc_free_host(mmc);
}
next prev parent reply other threads:[~2009-03-11 13:02 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-11 12:58 [PATCH 00/05] tmio_mmc: Minor fixes and cnf/irq changes Magnus Damm
2009-03-11 12:58 ` [PATCH 01/05] tmio_mmc: Fix one off, use resource_size() in probe() Magnus Damm
2009-03-11 14:26 ` Ian Molton
2009-03-11 12:59 ` [PATCH 02/05] tmio_mmc: Fix use after free in remove() Magnus Damm
2009-03-11 14:28 ` Ian Molton
2009-03-11 12:59 ` [PATCH 03/05] tmio_mmc: Break out cnf area operations Magnus Damm
2009-03-11 14:39 ` Ian Molton
2009-03-12 2:13 ` Magnus Damm
2009-03-11 12:59 ` Magnus Damm [this message]
2009-03-11 12:59 ` [PATCH 05/05] tmio_mmc: Support multiple interrupts Magnus Damm
2009-03-11 14:21 ` Ian Molton
2009-03-12 1:45 ` Magnus Damm
2009-03-16 18:30 ` [PATCH 00/05] tmio_mmc: Minor fixes and cnf/irq changes Pierre Ossman
2009-03-18 1:58 ` Magnus Damm
2009-03-24 2:07 ` Ian Molton
2009-03-25 8:56 ` Magnus Damm
2009-03-31 2:51 ` Magnus Damm
2009-03-31 18:37 ` Ian Molton
2009-04-01 2:20 ` Magnus Damm
2009-04-01 19:00 ` Ian Molton
2009-03-24 2:00 ` Ian Molton
2009-03-24 20:05 ` Pierre Ossman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090311125919.1563.39503.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=drzeus-wbsd@drzeus.cx \
--cc=ian@mnementh.co.uk \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.