1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2010 Pengutronix, Wolfram Sang <kernel@pengutronix.de>
6 #include <linux/platform_data/mmc-esdhc-imx.h>
8 #include "../hardware.h"
9 #include "devices-common.h"
11 #define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \
15 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \
16 .irq = soc ## _INT_ESDHC ## hwid, \
19 #define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \
20 [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid)
22 #ifdef CONFIG_SOC_IMX35
23 const struct imx_sdhci_esdhc_imx_data
24 imx35_sdhci_esdhc_imx_data
[] __initconst
= {
25 #define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \
26 imx_sdhci_esdhc_imx_data_entry(MX35, "sdhci-esdhc-imx35", _id, _hwid)
27 imx35_sdhci_esdhc_imx_data_entry(0, 1),
28 imx35_sdhci_esdhc_imx_data_entry(1, 2),
29 imx35_sdhci_esdhc_imx_data_entry(2, 3),
31 #endif /* ifdef CONFIG_SOC_IMX35 */
33 static const struct esdhc_platform_data default_esdhc_pdata __initconst
= {
34 .wp_type
= ESDHC_WP_NONE
,
35 .cd_type
= ESDHC_CD_NONE
,
38 struct platform_device
*__init
imx_add_sdhci_esdhc_imx(
39 const struct imx_sdhci_esdhc_imx_data
*data
,
40 const struct esdhc_platform_data
*pdata
)
42 struct resource res
[] = {
44 .start
= data
->iobase
,
45 .end
= data
->iobase
+ SZ_16K
- 1,
46 .flags
= IORESOURCE_MEM
,
50 .flags
= IORESOURCE_IRQ
,
55 * If machine does not provide pdata, use the default one
56 * which means no WP/CD support
59 pdata
= &default_esdhc_pdata
;
61 return imx_add_platform_device_dmamask(data
->devid
, data
->id
, res
,
62 ARRAY_SIZE(res
), pdata
, sizeof(*pdata
),