Commit | Line | Data |
---|---|---|
124bf94a | 1 | /* |
61b8c7b5 | 2 | * Copyright (C) 2010 Pengutronix, Wolfram Sang <kernel@pengutronix.de> |
124bf94a UKK |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify it under | |
5 | * the terms of the GNU General Public License version 2 as published by the | |
6 | * Free Software Foundation. | |
7 | */ | |
8 | ||
82906b13 | 9 | #include <linux/platform_data/mmc-esdhc-imx.h> |
50f2de61 SG |
10 | |
11 | #include "../hardware.h" | |
e0557c0d | 12 | #include "devices-common.h" |
124bf94a | 13 | |
57ed3314 | 14 | #define imx_sdhci_esdhc_imx_data_entry_single(soc, _devid, _id, hwid) \ |
124bf94a | 15 | { \ |
57ed3314 | 16 | .devid = _devid, \ |
124bf94a UKK |
17 | .id = _id, \ |
18 | .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \ | |
19 | .irq = soc ## _INT_ESDHC ## hwid, \ | |
20 | } | |
21 | ||
57ed3314 SG |
22 | #define imx_sdhci_esdhc_imx_data_entry(soc, devid, id, hwid) \ |
23 | [id] = imx_sdhci_esdhc_imx_data_entry_single(soc, devid, id, hwid) | |
124bf94a UKK |
24 | |
25 | #ifdef CONFIG_SOC_IMX25 | |
26 | const struct imx_sdhci_esdhc_imx_data | |
27 | imx25_sdhci_esdhc_imx_data[] __initconst = { | |
28 | #define imx25_sdhci_esdhc_imx_data_entry(_id, _hwid) \ | |
57ed3314 | 29 | imx_sdhci_esdhc_imx_data_entry(MX25, "sdhci-esdhc-imx25", _id, _hwid) |
124bf94a UKK |
30 | imx25_sdhci_esdhc_imx_data_entry(0, 1), |
31 | imx25_sdhci_esdhc_imx_data_entry(1, 2), | |
32 | }; | |
33 | #endif /* ifdef CONFIG_SOC_IMX25 */ | |
34 | ||
35 | #ifdef CONFIG_SOC_IMX35 | |
36 | const struct imx_sdhci_esdhc_imx_data | |
37 | imx35_sdhci_esdhc_imx_data[] __initconst = { | |
38 | #define imx35_sdhci_esdhc_imx_data_entry(_id, _hwid) \ | |
57ed3314 | 39 | imx_sdhci_esdhc_imx_data_entry(MX35, "sdhci-esdhc-imx35", _id, _hwid) |
124bf94a UKK |
40 | imx35_sdhci_esdhc_imx_data_entry(0, 1), |
41 | imx35_sdhci_esdhc_imx_data_entry(1, 2), | |
42 | imx35_sdhci_esdhc_imx_data_entry(2, 3), | |
43 | }; | |
44 | #endif /* ifdef CONFIG_SOC_IMX35 */ | |
45 | ||
913413c3 SG |
46 | static const struct esdhc_platform_data default_esdhc_pdata __initconst = { |
47 | .wp_type = ESDHC_WP_NONE, | |
48 | .cd_type = ESDHC_CD_NONE, | |
49 | }; | |
50 | ||
124bf94a UKK |
51 | struct platform_device *__init imx_add_sdhci_esdhc_imx( |
52 | const struct imx_sdhci_esdhc_imx_data *data, | |
53 | const struct esdhc_platform_data *pdata) | |
54 | { | |
55 | struct resource res[] = { | |
56 | { | |
57 | .start = data->iobase, | |
58 | .end = data->iobase + SZ_16K - 1, | |
59 | .flags = IORESOURCE_MEM, | |
60 | }, { | |
61 | .start = data->irq, | |
62 | .end = data->irq, | |
63 | .flags = IORESOURCE_IRQ, | |
64 | }, | |
65 | }; | |
66 | ||
913413c3 SG |
67 | /* |
68 | * If machine does not provide pdata, use the default one | |
69 | * which means no WP/CD support | |
70 | */ | |
71 | if (!pdata) | |
72 | pdata = &default_esdhc_pdata; | |
73 | ||
fc26fe9c AK |
74 | return imx_add_platform_device_dmamask(data->devid, data->id, res, |
75 | ARRAY_SIZE(res), pdata, sizeof(*pdata), | |
76 | DMA_BIT_MASK(32)); | |
124bf94a | 77 | } |