From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 29/34] mmc: mxcmmc: remove mach/hardware.h inclusion
Date: Mon, 17 Sep 2012 13:34:58 +0800 [thread overview]
Message-ID: <1347860103-4141-30-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1347860103-4141-1-git-send-email-shawn.guo@linaro.org>
It changes the driver to use platform_device_id rather than cpu_is_xxx
to determine the controller type, and updates the platform code
accordingly.
As the result, mach/hardware.h inclusion gets removed from the driver.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Chris Ball <cjb@laptop.org>
Cc: linux-mmc at vger.kernel.org
---
arch/arm/mach-imx/clk-imx27.c | 12 +++++-----
arch/arm/mach-imx/clk-imx31.c | 4 ++--
arch/arm/mach-imx/devices/devices-common.h | 1 +
arch/arm/mach-imx/devices/platform-mxc-mmc.c | 15 +++++++------
arch/arm/mach-imx/mach-mx31_3ds.c | 2 +-
arch/arm/mach-imx/mach-mx31moboard.c | 4 ++--
arch/arm/mach-imx/mach-pcm038.c | 2 +-
drivers/mmc/host/mxcmmc.c | 31 ++++++++++++++++++++++++--
8 files changed, 50 insertions(+), 21 deletions(-)
diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c
index e26de52..114be46 100644
--- a/arch/arm/mach-imx/clk-imx27.c
+++ b/arch/arm/mach-imx/clk-imx27.c
@@ -212,12 +212,12 @@ int __init mx27_clocks_init(unsigned long fref)
clk_register_clkdev(clk[gpt6_ipg_gate], "ipg", "imx-gpt.5");
clk_register_clkdev(clk[per1_gate], "per", "imx-gpt.5");
clk_register_clkdev(clk[pwm_ipg_gate], NULL, "mxc_pwm.0");
- clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.0");
- clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "mxc-mmc.0");
- clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.1");
- clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "mxc-mmc.1");
- clk_register_clkdev(clk[per2_gate], "per", "mxc-mmc.2");
- clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "mxc-mmc.2");
+ clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.0");
+ clk_register_clkdev(clk[sdhc1_ipg_gate], "ipg", "imx21-mmc.0");
+ clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.1");
+ clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "imx21-mmc.1");
+ clk_register_clkdev(clk[per2_gate], "per", "imx21-mmc.2");
+ clk_register_clkdev(clk[sdhc2_ipg_gate], "ipg", "imx21-mmc.2");
clk_register_clkdev(clk[cspi1_ipg_gate], NULL, "imx27-cspi.0");
clk_register_clkdev(clk[cspi2_ipg_gate], NULL, "imx27-cspi.1");
clk_register_clkdev(clk[cspi3_ipg_gate], NULL, "imx27-cspi.2");
diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c
index d9ff16e..1277f73 100644
--- a/arch/arm/mach-imx/clk-imx31.c
+++ b/arch/arm/mach-imx/clk-imx31.c
@@ -159,8 +159,8 @@ int __init mx31_clocks_init(unsigned long fref)
clk_register_clkdev(clk[i2c2_gate], NULL, "imx21-i2c.1");
clk_register_clkdev(clk[i2c3_gate], NULL, "imx21-i2c.2");
clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0");
- clk_register_clkdev(clk[sdhc1_gate], NULL, "mxc-mmc.0");
- clk_register_clkdev(clk[sdhc2_gate], NULL, "mxc-mmc.1");
+ clk_register_clkdev(clk[sdhc1_gate], NULL, "imx31-mmc.0");
+ clk_register_clkdev(clk[sdhc2_gate], NULL, "imx31-mmc.1");
clk_register_clkdev(clk[ssi1_gate], NULL, "imx-ssi.0");
clk_register_clkdev(clk[ssi2_gate], NULL, "imx-ssi.1");
clk_register_clkdev(clk[firi_gate], "firi", NULL);
diff --git a/arch/arm/mach-imx/devices/devices-common.h b/arch/arm/mach-imx/devices/devices-common.h
index 8112a1a..7fa3ef7 100644
--- a/arch/arm/mach-imx/devices/devices-common.h
+++ b/arch/arm/mach-imx/devices/devices-common.h
@@ -228,6 +228,7 @@ struct platform_device *__init imx_add_mxc_ehci(
#include <linux/platform_data/mmc-mxcmmc.h>
struct imx_mxc_mmc_data {
+ const char *devid;
int id;
resource_size_t iobase;
resource_size_t iosize;
diff --git a/arch/arm/mach-imx/devices/platform-mxc-mmc.c b/arch/arm/mach-imx/devices/platform-mxc-mmc.c
index ce90ab0..487f61c 100644
--- a/arch/arm/mach-imx/devices/platform-mxc-mmc.c
+++ b/arch/arm/mach-imx/devices/platform-mxc-mmc.c
@@ -10,21 +10,22 @@
#include <mach/hardware.h>
#include "devices-common.h"
-#define imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size) \
+#define imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size) \
{ \
+ .devid = _devid, \
.id = _id, \
.iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \
.iosize = _size, \
.irq = soc ## _INT_SDHC ## _hwid, \
.dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \
}
-#define imx_mxc_mmc_data_entry(soc, _id, _hwid, _size) \
- [_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid, _size)
+#define imx_mxc_mmc_data_entry(soc, _devid, _id, _hwid, _size) \
+ [_id] = imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)
#ifdef CONFIG_SOC_IMX21
const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
#define imx21_mxc_mmc_data_entry(_id, _hwid) \
- imx_mxc_mmc_data_entry(MX21, _id, _hwid, SZ_4K)
+ imx_mxc_mmc_data_entry(MX21, "imx21-mmc", _id, _hwid, SZ_4K)
imx21_mxc_mmc_data_entry(0, 1),
imx21_mxc_mmc_data_entry(1, 2),
};
@@ -33,7 +34,7 @@ const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
#ifdef CONFIG_SOC_IMX27
const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
#define imx27_mxc_mmc_data_entry(_id, _hwid) \
- imx_mxc_mmc_data_entry(MX27, _id, _hwid, SZ_4K)
+ imx_mxc_mmc_data_entry(MX27, "imx21-mmc", _id, _hwid, SZ_4K)
imx27_mxc_mmc_data_entry(0, 1),
imx27_mxc_mmc_data_entry(1, 2),
};
@@ -42,7 +43,7 @@ const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
#ifdef CONFIG_SOC_IMX31
const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = {
#define imx31_mxc_mmc_data_entry(_id, _hwid) \
- imx_mxc_mmc_data_entry(MX31, _id, _hwid, SZ_16K)
+ imx_mxc_mmc_data_entry(MX31, "imx31-mmc", _id, _hwid, SZ_16K)
imx31_mxc_mmc_data_entry(0, 1),
imx31_mxc_mmc_data_entry(1, 2),
};
@@ -67,7 +68,7 @@ struct platform_device *__init imx_add_mxc_mmc(
.flags = IORESOURCE_DMA,
},
};
- return imx_add_platform_device_dmamask("mxc-mmc", data->id,
+ return imx_add_platform_device_dmamask(data->devid, data->id,
res, ARRAY_SIZE(res),
pdata, sizeof(*pdata), DMA_BIT_MASK(32));
}
diff --git a/arch/arm/mach-imx/mach-mx31_3ds.c b/arch/arm/mach-imx/mach-mx31_3ds.c
index 5377c88..0333567 100644
--- a/arch/arm/mach-imx/mach-mx31_3ds.c
+++ b/arch/arm/mach-imx/mach-mx31_3ds.c
@@ -393,7 +393,7 @@ static struct regulator_init_data gpo_init = {
};
static struct regulator_consumer_supply vmmc2_consumers[] = {
- REGULATOR_SUPPLY("vmmc", "mxc-mmc.0"),
+ REGULATOR_SUPPLY("vmmc", "imx31-mmc.0"),
};
static struct regulator_init_data vmmc2_init = {
diff --git a/arch/arm/mach-imx/mach-mx31moboard.c b/arch/arm/mach-imx/mach-mx31moboard.c
index e719c76..31c7d05 100644
--- a/arch/arm/mach-imx/mach-mx31moboard.c
+++ b/arch/arm/mach-imx/mach-mx31moboard.c
@@ -175,11 +175,11 @@ static const struct spi_imx_master moboard_spi1_pdata __initconst = {
static struct regulator_consumer_supply sdhc_consumers[] = {
{
- .dev_name = "mxc-mmc.0",
+ .dev_name = "imx31-mmc.0",
.supply = "sdhc0_vcc",
},
{
- .dev_name = "mxc-mmc.1",
+ .dev_name = "imx31-mmc.1",
.supply = "sdhc1_vcc",
},
};
diff --git a/arch/arm/mach-imx/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 4a52340..8bf95f5 100644
--- a/arch/arm/mach-imx/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -212,7 +212,7 @@ static const struct spi_imx_master pcm038_spi0_data __initconst = {
static struct regulator_consumer_supply sdhc1_consumers[] = {
{
- .dev_name = "mxc-mmc.1",
+ .dev_name = "imx21-mmc.1",
.supply = "sdhc_vcc",
},
};
diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c
index 7b1161d..15010b3 100644
--- a/drivers/mmc/host/mxcmmc.c
+++ b/drivers/mmc/host/mxcmmc.c
@@ -41,7 +41,6 @@
#include <linux/platform_data/mmc-mxcmmc.h>
#include <linux/platform_data/dma-imx.h>
-#include <mach/hardware.h>
#define DRIVER_NAME "mxc-mmc"
@@ -112,6 +111,11 @@
#define INT_WRITE_OP_DONE_EN (1 << 1)
#define INT_READ_OP_EN (1 << 0)
+enum mxcmci_type {
+ IMX21_MMC,
+ IMX31_MMC,
+};
+
struct mxcmci_host {
struct mmc_host *mmc;
struct resource *res;
@@ -150,7 +154,26 @@ struct mxcmci_host {
int dmareq;
struct dma_slave_config dma_slave_config;
struct imx_dma_data dma_data;
+ enum mxcmci_type devtype;
+};
+
+static struct platform_device_id mxcmci_devtype[] = {
+ {
+ .name = "imx21-mmc",
+ .driver_data = IMX21_MMC,
+ }, {
+ .name = "imx31-mmc",
+ .driver_data = IMX31_MMC,
+ }, {
+ /* sentinel */
+ }
};
+MODULE_DEVICE_TABLE(platform, mxcmci_devtype);
+
+static inline int is_imx31_mmc(struct mxcmci_host *host)
+{
+ return host->devtype == IMX31_MMC;
+}
static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
@@ -811,6 +834,8 @@ static void mxcmci_enable_sdio_irq(struct mmc_host *mmc, int enable)
static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card)
{
+ struct mxcmci_host *mxcmci = mmc_priv(host);
+
/*
* MX3 SoCs have a silicon bug which corrupts CRC calculation of
* multi-block transfers when connected SDIO peripheral doesn't
@@ -818,7 +843,7 @@ static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card)
* One way to prevent this is to only allow 1-bit transfers.
*/
- if (cpu_is_mx3() && card->type == MMC_TYPE_SDIO)
+ if (is_imx31_mmc(mxcmci) && card->type == MMC_TYPE_SDIO)
host->caps &= ~MMC_CAP_4_BIT_DATA;
else
host->caps |= MMC_CAP_4_BIT_DATA;
@@ -888,6 +913,7 @@ static int mxcmci_probe(struct platform_device *pdev)
host->mmc = mmc;
host->pdata = pdev->dev.platform_data;
+ host->devtype = pdev->id_entry->driver_data;
spin_lock_init(&host->lock);
mxcmci_init_ocr(host);
@@ -1056,6 +1082,7 @@ static const struct dev_pm_ops mxcmci_pm_ops = {
static struct platform_driver mxcmci_driver = {
.probe = mxcmci_probe,
.remove = mxcmci_remove,
+ .id_table = mxcmci_devtype,
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
--
1.7.9.5
next prev parent reply other threads:[~2012-09-17 5:34 UTC|newest]
Thread overview: 80+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 5:34 [PATCH 00/34] i.MX multi-platform support Shawn Guo
2012-09-17 5:34 ` [PATCH 01/34] ARM: imx: include board headers in the same folder Shawn Guo
2012-09-17 5:34 ` [PATCH 02/34] ASoC: mx27vis: retrieve gpio numbers from platform_data Shawn Guo
2012-09-17 9:19 ` javier Martin
2012-09-17 11:07 ` Mark Brown
2012-09-20 1:14 ` Shawn Guo
2012-09-20 1:26 ` Mark Brown
2012-09-20 2:20 ` Shawn Guo
2012-09-17 5:34 ` [PATCH 03/34] ARM: imx: move iomux drivers and headers into mach-imx Shawn Guo
2012-09-17 5:34 ` [PATCH 04/34] ARM: imx: remove unnecessary inclusion from device-imx*.h Shawn Guo
2012-09-17 5:34 ` [PATCH 05/34] ARM: imx: move platform device code into mach-imx Shawn Guo
2012-09-17 5:34 ` [PATCH 06/34] ARM: imx: merge plat-mxc " Shawn Guo
2012-09-18 8:08 ` Shawn Guo
2012-09-17 5:34 ` [PATCH 07/34] ARM: imx: include common.h rather than mach/common.h Shawn Guo
2012-09-17 5:34 ` [PATCH 08/34] ARM: imx: ARM: imx: include cpuidle.h rather than mach/cpuidle.h Shawn Guo
2012-09-17 5:34 ` [PATCH 09/34] ARM: imx: include iim.h rather than mach/iim.h Shawn Guo
2012-09-17 5:34 ` [PATCH 10/34] ARM: imx: include iram.h rather than mach/iram.h Shawn Guo
2012-09-17 5:34 ` [PATCH 11/34] ARM: imx: include ulpi.h rather than mach/ulpi.h Shawn Guo
2012-09-17 5:34 ` [PATCH 12/34] media: mx1_camera: remove the driver Shawn Guo
2012-09-17 8:33 ` Guennadi Liakhovetski
2012-09-18 1:28 ` Shawn Guo
2012-09-18 9:13 ` Arnd Bergmann
2012-09-20 1:35 ` Shawn Guo
2012-09-17 5:34 ` [PATCH 13/34] ARM: imx: remove mach/dma-mx1-mx2.h Shawn Guo
2012-09-17 5:34 ` [PATCH 14/34] dma: ipu: rename mach/ipu.h to include/linux/dma/ipu-dma.h Shawn Guo
2012-09-17 9:26 ` Guennadi Liakhovetski
2012-09-27 7:38 ` Mauro Carvalho Chehab
2012-09-17 5:34 ` [PATCH 15/34] dma: imx-sdma: remove unneeded mach/hardware.h inclusion Shawn Guo
2012-09-17 5:34 ` [PATCH 16/34] ASoC: imx-ssi: " Shawn Guo
2012-09-17 11:45 ` Mark Brown
2012-09-17 14:30 ` Arnd Bergmann
2012-09-19 3:23 ` Mark Brown
2012-09-19 8:01 ` Arnd Bergmann
2012-09-19 11:44 ` Mark Brown
2012-09-17 5:34 ` [PATCH 17/34] usb: ehci-mxc: " Shawn Guo
2012-09-17 11:18 ` Greg Kroah-Hartman
2012-09-17 5:34 ` [PATCH 18/34] video: mx3fb: " Shawn Guo
2012-09-17 5:34 ` [PATCH 19/34] watchdog: imx2_wdt: " Shawn Guo
2012-09-17 5:34 ` [PATCH 20/34] i2c: imx: remove " Shawn Guo
2012-09-17 5:34 ` [PATCH 21/34] mtd: mxc_nand: " Shawn Guo
2012-09-17 5:34 ` [PATCH 22/34] rtc: mxc_rtc: " Shawn Guo
2012-09-17 5:34 ` [PATCH 23/34] dma: imx-dma: use devm_kzalloc and devm_request_irq Shawn Guo
2012-09-17 5:34 ` [PATCH 24/34] dma: imx-dma: retrieve MEM and IRQ from resources Shawn Guo
2012-09-17 5:34 ` [PATCH 25/34] dma: imx-dma: remove mach/hardware.h inclusion Shawn Guo
2012-09-17 7:58 ` Sascha Hauer
2012-09-18 1:40 ` Shawn Guo
2012-09-21 2:49 ` Shawn Guo
2012-09-17 5:34 ` [PATCH 26/34] media: mx2_camera: remove dead code in mx2_camera_add_device Shawn Guo
2012-09-17 8:18 ` Guennadi Liakhovetski
2012-09-17 13:36 ` javier Martin
2012-09-18 1:49 ` Shawn Guo
2012-09-17 5:34 ` [PATCH 27/34] media: mx2_camera: use managed functions to clean up code Shawn Guo
2012-09-17 9:11 ` Guennadi Liakhovetski
2012-09-17 13:36 ` javier Martin
2012-09-18 7:43 ` Shawn Guo
2012-09-18 8:34 ` javier Martin
2012-09-17 5:34 ` [PATCH 28/34] media: mx2_camera: remove mach/hardware.h inclusion Shawn Guo
2012-09-17 9:21 ` Guennadi Liakhovetski
2012-09-17 13:43 ` javier Martin
2012-09-17 13:59 ` Guennadi Liakhovetski
2012-09-18 8:35 ` javier Martin
2012-09-27 7:36 ` Mauro Carvalho Chehab
2012-10-06 8:16 ` Shawn Guo
2012-09-17 5:34 ` Shawn Guo [this message]
2012-09-17 5:41 ` [PATCH 29/34] mmc: mxcmmc: " Chris Ball
2012-09-18 9:18 ` javier Martin
2012-09-17 5:34 ` [PATCH 30/34] video: imxfb: " Shawn Guo
2012-09-17 5:35 ` [PATCH 31/34] ARM: imx: move debug macros to include/debug Shawn Guo
2012-09-17 5:35 ` [PATCH 32/34] ARM: imx: include hardware.h rather than mach/hardware.h Shawn Guo
2012-09-17 5:35 ` [PATCH 33/34] ARM: imx: remove header file mach/irqs.h Shawn Guo
2012-09-17 11:32 ` Arnd Bergmann
2012-09-18 8:13 ` Shawn Guo
2012-09-17 11:46 ` Mark Brown
2012-09-17 5:35 ` [PATCH 34/34] ARM: imx: enable multi-platform build Shawn Guo
2012-09-17 11:44 ` Arnd Bergmann
2012-09-17 7:51 ` [PATCH 00/34] i.MX multi-platform support Sascha Hauer
2012-09-17 11:38 ` Arnd Bergmann
2012-09-18 8:20 ` Shawn Guo
2012-09-18 7:52 ` Sascha Hauer
2012-09-18 8:05 ` [alsa-devel] " Shawn Guo
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=1347860103-4141-30-git-send-email-shawn.guo@linaro.org \
--to=shawn.guo@linaro.org \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).