public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* MMC: Make the configuration memory resource optional
@ 2009-07-17 11:10 Guennadi Liakhovetski
  2009-07-17 14:19 ` Magnus Damm
  2009-07-28 13:55 ` Ian Molton
  0 siblings, 2 replies; 46+ messages in thread
From: Guennadi Liakhovetski @ 2009-07-17 11:10 UTC (permalink / raw)
  To: Ian Molton; +Cc: linux-kernel, Pierre Ossman, Magnus Damm

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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
CC: Magnus Damm <damm@opensource.se>
---
Pierre, I know you wanted to step down as a MMC maintainer (thanks for 
your great work btw!), but since we don't have a new one yet, I'm CC-ing 
you.

A version of this patch has previously been submitted by Magnus Damm 
(CCed), but it hasn't been accepted back at 2.6.29 times (about 4 months 
ago). Now this driver extension has become much simpler, so, I think, 
there should be no problem accepting this patch now.

diff --git a/drivers/mmc/host/tmio_mmc.c b/drivers/mmc/host/tmio_mmc.c
index 91991b4..c246191 100644
--- a/drivers/mmc/host/tmio_mmc.c
+++ b/drivers/mmc/host/tmio_mmc.c
@@ -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);
 	}
 
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index 9fa9985..45f06aa 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -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));
 }

^ permalink raw reply related	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2009-09-02 10:52 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-17 11:10 MMC: Make the configuration memory resource optional Guennadi Liakhovetski
2009-07-17 14:19 ` Magnus Damm
2009-07-17 14:34   ` [PATCH] " Guennadi Liakhovetski
2009-07-17 17:38     ` Ian Molton
2009-07-23 10:29     ` Magnus Damm
2009-07-28 13:55 ` Ian Molton
2009-07-29  2:48   ` Magnus Damm
2009-07-29 10:24     ` Ian Molton
2009-07-29 11:58     ` Mark Brown
2009-07-29 12:27       ` Magnus Damm
2009-07-29 12:35         ` Paul Mundt
2009-07-29 12:42         ` Mark Brown
2009-07-29 12:51           ` Magnus Damm
2009-07-29 12:58             ` Ian Molton
2009-07-29 13:08               ` Magnus Damm
2009-07-29 13:51                 ` Ian Molton
2009-07-29 20:17                   ` Paul Mundt
2009-07-29 20:55                     ` pHilipp Zabel
2009-07-29 21:03                       ` Paul Mundt
2009-07-30  9:59                       ` Ian Molton
2009-07-30 10:56                         ` Guennadi Liakhovetski
2009-07-30 19:21                           ` Ian Molton
2009-07-31  6:55                             ` Guennadi Liakhovetski
2009-08-03 18:51                               ` Ian Molton
2009-08-05 13:33                                 ` Guennadi Liakhovetski
2009-08-05 14:10                                   ` Ian Molton
2009-08-03  2:52                             ` Magnus Damm
2009-08-04 18:21                               ` Ian Molton
2009-08-05  2:08                                 ` Magnus Damm
2009-08-05 12:07                                   ` Ian Molton
2009-08-05 13:34                                   ` Ian Molton
2009-08-05 19:44                                     ` Guennadi Liakhovetski
2009-08-05 22:34                                       ` Ian Molton
2009-08-05 22:53                                         ` Guennadi Liakhovetski
2009-08-05 23:06                                           ` Ian Molton
2009-08-18  8:40                                             ` Magnus Damm
2009-08-09 19:10                                       ` MMC / MFD / Clocks Ian Molton
2009-08-10  3:48                                         ` Magnus Damm
2009-08-05 14:02                                   ` Example idea for how to solve the clock/cnf problem Ian Molton
2009-08-05 22:43                                     ` Ian Molton
2009-09-02 10:44                                       ` Magnus Damm
2009-07-30 19:33                           ` MMC: Make the configuration memory resource optional Ian Molton
2009-07-29 13:11               ` Mark Brown
2009-07-29 12:59             ` Mark Brown
2009-07-29 12:37       ` Ian Molton
2009-07-29  7:31   ` Paul Mundt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox