Linux 5.7.7
[linux/fpc-iii.git] / arch / arm / mach-imx / devices / platform-sdhci-esdhc-imx.c
blob40c261071144b4f2edfebc46ca392a49e253d136
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2010 Pengutronix, Wolfram Sang <kernel@pengutronix.de>
4 */
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) \
12 { \
13 .devid = _devid, \
14 .id = _id, \
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,
47 }, {
48 .start = data->irq,
49 .end = data->irq,
50 .flags = IORESOURCE_IRQ,
55 * If machine does not provide pdata, use the default one
56 * which means no WP/CD support
58 if (!pdata)
59 pdata = &default_esdhc_pdata;
61 return imx_add_platform_device_dmamask(data->devid, data->id, res,
62 ARRAY_SIZE(res), pdata, sizeof(*pdata),
63 DMA_BIT_MASK(32));