diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-05 12:26:09 -0400 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-17 04:01:30 -0500 |
commit | 9d3d945a8d5be2c915f646e8dff8422486a77030 (patch) | |
tree | 7e0557484ef0e8c6de6e5da3f9d7b08ab1b5b2c4 /arch/arm/plat-mxc/devices/platform-mxc-mmc.c | |
parent | c194daad0e0de94ed5e03aa723eb56b4a3ae9738 (diff) |
ARM: imx: dynamically register mxc-mmc devices
... plus a trivial simplification of mx21ads_sdhc_init()
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc/devices/platform-mxc-mmc.c')
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-mxc-mmc.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/devices/platform-mxc-mmc.c b/arch/arm/plat-mxc/devices/platform-mxc-mmc.c new file mode 100644 index 000000000000..953319e4d874 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-mxc-mmc.c | |||
@@ -0,0 +1,62 @@ | |||
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 <mach/hardware.h> | ||
10 | #include <mach/devices-common.h> | ||
11 | |||
12 | #define imx_mxc_mmc_data_entry_single(soc, _id, _hwid) \ | ||
13 | { \ | ||
14 | .id = _id, \ | ||
15 | .iobase = soc ## _SDHC ## _hwid ## _BASE_ADDR, \ | ||
16 | .irq = soc ## _INT_SDHC ## _hwid, \ | ||
17 | .dmareq = soc ## _DMA_REQ_SDHC ## _hwid, \ | ||
18 | } | ||
19 | #define imx_mxc_mmc_data_entry(soc, _id, _hwid) \ | ||
20 | [_id] = imx_mxc_mmc_data_entry_single(soc, _id, _hwid) | ||
21 | |||
22 | #ifdef CONFIG_SOC_IMX21 | ||
23 | const struct imx_mxc_mmc_data imx21_mxc_mmc_data[] __initconst = { | ||
24 | #define imx21_mxc_mmc_data_entry(_id, _hwid) \ | ||
25 | imx_mxc_mmc_data_entry(MX21, _id, _hwid) | ||
26 | imx21_mxc_mmc_data_entry(0, 1), | ||
27 | imx21_mxc_mmc_data_entry(1, 2), | ||
28 | }; | ||
29 | #endif /* ifdef CONFIG_SOC_IMX21 */ | ||
30 | |||
31 | #ifdef CONFIG_SOC_IMX27 | ||
32 | const struct imx_mxc_mmc_data imx27_mxc_mmc_data[] __initconst = { | ||
33 | #define imx27_mxc_mmc_data_entry(_id, _hwid) \ | ||
34 | imx_mxc_mmc_data_entry(MX27, _id, _hwid) | ||
35 | imx27_mxc_mmc_data_entry(0, 1), | ||
36 | imx27_mxc_mmc_data_entry(1, 2), | ||
37 | }; | ||
38 | #endif /* ifdef CONFIG_SOC_IMX27 */ | ||
39 | |||
40 | struct platform_device *__init imx_add_mxc_mmc( | ||
41 | const struct imx_mxc_mmc_data *data, | ||
42 | const struct imxmmc_platform_data *pdata) | ||
43 | { | ||
44 | struct resource res[] = { | ||
45 | { | ||
46 | .start = data->iobase, | ||
47 | .end = data->iobase + SZ_4K - 1, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | }, { | ||
50 | .start = data->irq, | ||
51 | .end = data->irq, | ||
52 | .flags = IORESOURCE_IRQ, | ||
53 | }, { | ||
54 | .start = data->dmareq, | ||
55 | .end = data->dmareq, | ||
56 | .flags = IORESOURCE_DMA, | ||
57 | }, | ||
58 | }; | ||
59 | return imx_add_platform_device_dmamask("mxc-mmc", data->id, | ||
60 | res, ARRAY_SIZE(res), | ||
61 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | ||
62 | } | ||