aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mxs/devices/platform-mxs-mmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-mxs/devices/platform-mxs-mmc.c')
-rw-r--r--arch/arm/mach-mxs/devices/platform-mxs-mmc.c73
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/mach-mxs/devices/platform-mxs-mmc.c b/arch/arm/mach-mxs/devices/platform-mxs-mmc.c
new file mode 100644
index 000000000000..382dacbeca21
--- /dev/null
+++ b/arch/arm/mach-mxs/devices/platform-mxs-mmc.c
@@ -0,0 +1,73 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License version 2 as published by the
9 * Free Software Foundation.
10 */
11
12#include <linux/compiler.h>
13#include <linux/err.h>
14#include <linux/init.h>
15
16#include <mach/mx23.h>
17#include <mach/mx28.h>
18#include <mach/devices-common.h>
19
20#define mxs_mxs_mmc_data_entry_single(soc, _id, hwid) \
21 { \
22 .id = _id, \
23 .iobase = soc ## _SSP ## hwid ## _BASE_ADDR, \
24 .dma = soc ## _DMA_SSP ## hwid, \
25 .irq_err = soc ## _INT_SSP ## hwid ## _ERROR, \
26 .irq_dma = soc ## _INT_SSP ## hwid ## _DMA, \
27 }
28
29#define mxs_mxs_mmc_data_entry(soc, _id, hwid) \
30 [_id] = mxs_mxs_mmc_data_entry_single(soc, _id, hwid)
31
32
33#ifdef CONFIG_SOC_IMX23
34const struct mxs_mxs_mmc_data mx23_mxs_mmc_data[] __initconst = {
35 mxs_mxs_mmc_data_entry(MX23, 0, 1),
36 mxs_mxs_mmc_data_entry(MX23, 1, 2),
37};
38#endif
39
40#ifdef CONFIG_SOC_IMX28
41const struct mxs_mxs_mmc_data mx28_mxs_mmc_data[] __initconst = {
42 mxs_mxs_mmc_data_entry(MX28, 0, 0),
43 mxs_mxs_mmc_data_entry(MX28, 1, 1),
44};
45#endif
46
47struct platform_device *__init mxs_add_mxs_mmc(
48 const struct mxs_mxs_mmc_data *data,
49 const struct mxs_mmc_platform_data *pdata)
50{
51 struct resource res[] = {
52 {
53 .start = data->iobase,
54 .end = data->iobase + SZ_8K - 1,
55 .flags = IORESOURCE_MEM,
56 }, {
57 .start = data->dma,
58 .end = data->dma,
59 .flags = IORESOURCE_DMA,
60 }, {
61 .start = data->irq_err,
62 .end = data->irq_err,
63 .flags = IORESOURCE_IRQ,
64 }, {
65 .start = data->irq_dma,
66 .end = data->irq_dma,
67 .flags = IORESOURCE_IRQ,
68 },
69 };
70
71 return mxs_add_platform_device("mxs-mmc", data->id,
72 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
73}