]> Pileus Git - ~andy/linux/blob - arch/arm/mach-imx/devices/platform-mxc-mmc.c
mmc: mxcmmc: remove cpu_is_xxx by using platform_device_id
[~andy/linux] / arch / arm / mach-imx / devices / platform-mxc-mmc.c
1 /*
2  * Copyright (C) 2010 Pengutronix
3  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4  *
5  * This program is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU General Public License version 2 as published by the
7  * Free Software Foundation.
8  */
9 #include <linux/dma-mapping.h>
10 #include <mach/hardware.h>
11 #include "devices-common.h"
12
13 #define imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)   \
14         {                                                               \
15                 .devid = _devid,                                        \
16                 .id = _id,                                              \
17                 .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR,          \
18                 .iosize = _size,                                        \
19                 .irq = soc ## _INT_SDHC ## _hwid,                       \
20                 .dmareq = soc ## _DMA_REQ_SDHC ## _hwid,                \
21         }
22 #define imx_mxc_mmc_data_entry(soc, _devid, _id, _hwid, _size)          \
23         [_id] = imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)
24
25 #ifdef CONFIG_SOC_IMX21
26 const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = {
27 #define imx21_mxc_mmc_data_entry(_id, _hwid)                            \
28         imx_mxc_mmc_data_entry(MX21, "imx21-mmc", _id, _hwid, SZ_4K)
29         imx21_mxc_mmc_data_entry(0, 1),
30         imx21_mxc_mmc_data_entry(1, 2),
31 };
32 #endif /* ifdef CONFIG_SOC_IMX21 */
33
34 #ifdef CONFIG_SOC_IMX27
35 const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = {
36 #define imx27_mxc_mmc_data_entry(_id, _hwid)                            \
37         imx_mxc_mmc_data_entry(MX27, "imx21-mmc", _id, _hwid, SZ_4K)
38         imx27_mxc_mmc_data_entry(0, 1),
39         imx27_mxc_mmc_data_entry(1, 2),
40 };
41 #endif /* ifdef CONFIG_SOC_IMX27 */
42
43 #ifdef CONFIG_SOC_IMX31
44 const struct imx_mxc_mmc_data imx31_mxc_mmc_data[] __initconst = {
45 #define imx31_mxc_mmc_data_entry(_id, _hwid)                            \
46         imx_mxc_mmc_data_entry(MX31, "imx31-mmc", _id, _hwid, SZ_16K)
47         imx31_mxc_mmc_data_entry(0, 1),
48         imx31_mxc_mmc_data_entry(1, 2),
49 };
50 #endif /* ifdef CONFIG_SOC_IMX31 */
51
52 struct platform_device *__init imx_add_mxc_mmc(
53                 const struct imx_mxc_mmc_data *data,
54                 const struct imxmmc_platform_data *pdata)
55 {
56         struct resource res[] = {
57                 {
58                         .start = data->iobase,
59                         .end = data->iobase + SZ_4K - 1,
60                         .flags = IORESOURCE_MEM,
61                 }, {
62                         .start = data->irq,
63                         .end = data->irq,
64                         .flags = IORESOURCE_IRQ,
65                 }, {
66                         .start = data->dmareq,
67                         .end = data->dmareq,
68                         .flags = IORESOURCE_DMA,
69                 },
70         };
71         return imx_add_platform_device_dmamask(data->devid, data->id,
72                         res, ARRAY_SIZE(res),
73                         pdata, sizeof(*pdata), DMA_BIT_MASK(32));
74 }