]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/plat-mxc/devices/platform-esdhc.c
imx-esdhc: update devices registration
[net-next-2.6.git] / arch / arm / plat-mxc / devices / platform-esdhc.c
CommitLineData
203a0734
WS
1/*
2 * Copyright (C) 2010 Pengutronix, Wolfram Sang <w.sang@pengutronix.de>
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
c0745129 9#include <mach/hardware.h>
203a0734
WS
10#include <mach/devices-common.h>
11#include <mach/esdhc.h>
12
c0745129
EB
13#define imx_esdhc_imx_data_entry_single(soc, _id, hwid) \
14 { \
15 .id = _id, \
16 .iobase = soc ## _ESDHC ## hwid ## _BASE_ADDR, \
17 .irq = soc ## _INT_ESDHC ## hwid, \
18 }
19
20#define imx_esdhc_imx_data_entry(soc, id, hwid) \
21 [id] = imx_esdhc_imx_data_entry_single(soc, id, hwid)
22
23#ifdef CONFIG_ARCH_MX25
24const struct imx_esdhc_imx_data imx25_esdhc_data[] __initconst = {
25#define imx25_esdhc_data_entry(_id, _hwid) \
26 imx_esdhc_imx_data_entry(MX25, _id, _hwid)
27 imx25_esdhc_data_entry(0, 1),
28 imx25_esdhc_data_entry(1, 2),
29};
30#endif /* ifdef CONFIG_ARCH_MX25 */
31
32#ifdef CONFIG_ARCH_MX35
33const struct imx_esdhc_imx_data imx35_esdhc_data[] __initconst = {
34#define imx35_esdhc_data_entry(_id, _hwid) \
35 imx_esdhc_imx_data_entry(MX35, _id, _hwid)
36 imx35_esdhc_data_entry(0, 1),
37 imx35_esdhc_data_entry(1, 2),
38 imx35_esdhc_data_entry(2, 3),
39};
40#endif /* ifdef CONFIG_ARCH_MX35 */
41
42#ifdef CONFIG_ARCH_MX51
43const struct imx_esdhc_imx_data imx51_esdhc_data[] __initconst = {
44#define imx51_esdhc_data_entry(_id, _hwid) \
45 imx_esdhc_imx_data_entry(MX51, _id, _hwid)
46 imx51_esdhc_data_entry(0, 1),
47 imx51_esdhc_data_entry(1, 2),
48 imx51_esdhc_data_entry(2, 3),
49 imx51_esdhc_data_entry(3, 4),
50};
51#endif /* ifdef CONFIG_ARCH_MX51 */
52
53struct platform_device *__init imx_add_esdhc(
54 const struct imx_esdhc_imx_data *data,
203a0734
WS
55 const struct esdhc_platform_data *pdata)
56{
57 struct resource res[] = {
58 {
c0745129
EB
59 .start = data->iobase,
60 .end = data->iobase + SZ_16K - 1,
203a0734
WS
61 .flags = IORESOURCE_MEM,
62 }, {
c0745129
EB
63 .start = data->irq,
64 .end = data->irq,
203a0734
WS
65 .flags = IORESOURCE_IRQ,
66 },
67 };
68
c0745129 69 return imx_add_platform_device("sdhci-esdhc-imx", data->id, res,
203a0734
WS
70 ARRAY_SIZE(res), pdata, sizeof(*pdata));
71}