diff options
Diffstat (limited to 'arch/arm/mach-imx/devices/platform-mxc-mmc.c')
-rw-r--r-- | arch/arm/mach-imx/devices/platform-mxc-mmc.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/devices/platform-mxc-mmc.c b/arch/arm/mach-imx/devices/platform-mxc-mmc.c new file mode 100644 index 000000000000..b8203c760c8f --- /dev/null +++ b/arch/arm/mach-imx/devices/platform-mxc-mmc.c | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2010 Pengutronix | ||
3 | * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> | ||
4 | * | ||
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. | ||
8 | */ | ||
9 | #include <linux/dma-mapping.h> | ||
10 | |||
11 | #include "../hardware.h" | ||
12 | #include "devices-common.h" | ||
13 | |||
14 | #define imx_mxc_mmc_data_entry_single(soc, _devid, _id, _hwid, _size) \ | ||
15 | { \ | ||
16 | .devid = _devid, \ | ||
17 | .id = _id, \ | ||
18 | .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \ | ||
19 | .iosize = _size, \ | ||
20 | .irq = soc ## _INT_SDHC ## _hwid, \ | ||
21 | .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \ | ||
22 | } | ||
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) | ||
25 | |||
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), | ||
32 | }; | ||
33 | #endif /* ifdef CONFIG_SOC_IMX21 */ | ||
34 | |||
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), | ||
41 | }; | ||
42 | #endif /* ifdef CONFIG_SOC_IMX27 */ | ||
43 | |||
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), | ||
50 | }; | ||
51 | #endif /* ifdef CONFIG_SOC_IMX31 */ | ||
52 | |||
53 | struct platform_device *__init imx_add_mxc_mmc( | ||
54 | const struct imx_mxc_mmc_data *data, | ||
55 | const struct imxmmc_platform_data *pdata) | ||
56 | { | ||
57 | struct resource res[] = { | ||
58 | { | ||
59 | .start = data->iobase, | ||
60 | .end = data->iobase + data->iosize - 1, | ||
61 | .flags = IORESOURCE_MEM, | ||
62 | }, { | ||
63 | .start = data->irq, | ||
64 | .end = data->irq, | ||
65 | .flags = IORESOURCE_IRQ, | ||
66 | }, { | ||
67 | .start = data->dmareq, | ||
68 | .end = data->dmareq, | ||
69 | .flags = IORESOURCE_DMA, | ||
70 | }, | ||
71 | }; | ||
72 | return imx_add_platform_device_dmamask(data->devid, data->id, | ||
73 | res, ARRAY_SIZE(res), | ||
74 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | ||
75 | } | ||