1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2010 Pengutronix
4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
6 #include <linux/dma-mapping.h>
8 #include "../hardware.h"
9 #include "devices-common.h"
11 #define imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size) \
15 .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \
17 .irq = soc ## _INT_SDHC ## _hwid, \
18 .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \
20 #define imx_mxc_mmc_data_entry(soc, _devid, _id, _hwid, _size) \
21 [_id] = imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size)
23 #ifdef CONFIG_SOC_IMX21
24 const struct imx_mxc_mmc_data imx21_mxc_mmc_data
[] __initconst
= {
25 #define imx21_mxc_mmc_data_entry(_id, _hwid) \
26 imx_mxc_mmc_data_entry(MX21, "imx21-mmc", _id, _hwid, SZ_4K)
27 imx21_mxc_mmc_data_entry(0, 1),
28 imx21_mxc_mmc_data_entry(1, 2),
30 #endif /* ifdef CONFIG_SOC_IMX21 */
32 #ifdef CONFIG_SOC_IMX27
33 const struct imx_mxc_mmc_data imx27_mxc_mmc_data
[] __initconst
= {
34 #define imx27_mxc_mmc_data_entry(_id, _hwid) \
35 imx_mxc_mmc_data_entry(MX27, "imx21-mmc", _id, _hwid, SZ_4K)
36 imx27_mxc_mmc_data_entry(0, 1),
37 imx27_mxc_mmc_data_entry(1, 2),
39 #endif /* ifdef CONFIG_SOC_IMX27 */
41 #ifdef CONFIG_SOC_IMX31
42 const struct imx_mxc_mmc_data imx31_mxc_mmc_data
[] __initconst
= {
43 #define imx31_mxc_mmc_data_entry(_id, _hwid) \
44 imx_mxc_mmc_data_entry(MX31, "imx31-mmc", _id, _hwid, SZ_16K)
45 imx31_mxc_mmc_data_entry(0, 1),
46 imx31_mxc_mmc_data_entry(1, 2),
48 #endif /* ifdef CONFIG_SOC_IMX31 */
50 struct platform_device
*__init
imx_add_mxc_mmc(
51 const struct imx_mxc_mmc_data
*data
,
52 const struct imxmmc_platform_data
*pdata
)
54 struct resource res
[] = {
56 .start
= data
->iobase
,
57 .end
= data
->iobase
+ data
->iosize
- 1,
58 .flags
= IORESOURCE_MEM
,
62 .flags
= IORESOURCE_IRQ
,
64 .start
= data
->dmareq
,
66 .flags
= IORESOURCE_DMA
,
69 return imx_add_platform_device_dmamask(data
->devid
, data
->id
,
71 pdata
, sizeof(*pdata
), DMA_BIT_MASK(32));