2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
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.
9 #include <linux/dma-mapping.h>
11 #include "../hardware.h"
12 #include "devices-common.h"
14 #define imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size) \
18 .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \
20 .irq = soc ## _INT_SDHC ## _hwid, \
21 .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \
23 #define imx_mxc_mmc_data_entry(soc, _devid, _id, _hwid, _size) \
24 [_id] = imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)
26 #ifdef CONFIG_SOC_IMX21
27 const struct imx_mxc_mmc_data imx21_mxc_mmc_data
[] __initconst
= {
28 #define imx21_mxc_mmc_data_entry(_id, _hwid) \
29 imx_mxc_mmc_data_entry(MX21, "imx21-mmc", _id, _hwid, SZ_4K)
30 imx21_mxc_mmc_data_entry(0, 1),
31 imx21_mxc_mmc_data_entry(1, 2),
33 #endif /* ifdef CONFIG_SOC_IMX21 */
35 #ifdef CONFIG_SOC_IMX27
36 const struct imx_mxc_mmc_data imx27_mxc_mmc_data
[] __initconst
= {
37 #define imx27_mxc_mmc_data_entry(_id, _hwid) \
38 imx_mxc_mmc_data_entry(MX27, "imx21-mmc", _id, _hwid, SZ_4K)
39 imx27_mxc_mmc_data_entry(0, 1),
40 imx27_mxc_mmc_data_entry(1, 2),
42 #endif /* ifdef CONFIG_SOC_IMX27 */
44 #ifdef CONFIG_SOC_IMX31
45 const struct imx_mxc_mmc_data imx31_mxc_mmc_data
[] __initconst
= {
46 #define imx31_mxc_mmc_data_entry(_id, _hwid) \
47 imx_mxc_mmc_data_entry(MX31, "imx31-mmc", _id, _hwid, SZ_16K)
48 imx31_mxc_mmc_data_entry(0, 1),
49 imx31_mxc_mmc_data_entry(1, 2),
51 #endif /* ifdef CONFIG_SOC_IMX31 */
53 struct platform_device
*__init
imx_add_mxc_mmc(
54 const struct imx_mxc_mmc_data
*data
,
55 const struct imxmmc_platform_data
*pdata
)
57 struct resource res
[] = {
59 .start
= data
->iobase
,
60 .end
= data
->iobase
+ data
->iosize
- 1,
61 .flags
= IORESOURCE_MEM
,
65 .flags
= IORESOURCE_IRQ
,
67 .start
= data
->dmareq
,
69 .flags
= IORESOURCE_DMA
,
72 return imx_add_platform_device_dmamask(data
->devid
, data
->id
,
74 pdata
, sizeof(*pdata
), DMA_BIT_MASK(32));