mm: move shmem prototypes to shmem_fs.h
[linux/fpc-iii.git] / arch / arm / plat-mxc / devices / platform-spi_imx.c
blobf97eb3615b2c8d8496c6a8a85f843257a9b412aa
1 /*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
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>
12 #define imx_spi_imx_data_entry_single(soc, type, _devid, _id, hwid, _size) \
13 { \
14 .devid = _devid, \
15 .id = _id, \
16 .iobase = soc ## _ ## type ## hwid ## _BASE_ADDR, \
17 .iosize = _size, \
18 .irq = soc ## _INT_ ## type ## hwid, \
21 #define imx_spi_imx_data_entry(soc, type, devid, id, hwid, size) \
22 [id] = imx_spi_imx_data_entry_single(soc, type, devid, id, hwid, size)
24 #ifdef CONFIG_SOC_IMX1
25 const struct imx_spi_imx_data imx1_cspi_data[] __initconst = {
26 #define imx1_cspi_data_entry(_id, _hwid) \
27 imx_spi_imx_data_entry(MX1, CSPI, "imx1-cspi", _id, _hwid, SZ_4K)
28 imx1_cspi_data_entry(0, 1),
29 imx1_cspi_data_entry(1, 2),
31 #endif
33 #ifdef CONFIG_SOC_IMX21
34 const struct imx_spi_imx_data imx21_cspi_data[] __initconst = {
35 #define imx21_cspi_data_entry(_id, _hwid) \
36 imx_spi_imx_data_entry(MX21, CSPI, "imx21-cspi", _id, _hwid, SZ_4K)
37 imx21_cspi_data_entry(0, 1),
38 imx21_cspi_data_entry(1, 2),
40 #endif
42 #ifdef CONFIG_SOC_IMX25
43 const struct imx_spi_imx_data imx25_cspi_data[] __initconst = {
44 #define imx25_cspi_data_entry(_id, _hwid) \
45 imx_spi_imx_data_entry(MX25, CSPI, "imx25-cspi", _id, _hwid, SZ_16K)
46 imx25_cspi_data_entry(0, 1),
47 imx25_cspi_data_entry(1, 2),
48 imx25_cspi_data_entry(2, 3),
50 #endif /* ifdef CONFIG_SOC_IMX25 */
52 #ifdef CONFIG_SOC_IMX27
53 const struct imx_spi_imx_data imx27_cspi_data[] __initconst = {
54 #define imx27_cspi_data_entry(_id, _hwid) \
55 imx_spi_imx_data_entry(MX27, CSPI, "imx27-cspi", _id, _hwid, SZ_4K)
56 imx27_cspi_data_entry(0, 1),
57 imx27_cspi_data_entry(1, 2),
58 imx27_cspi_data_entry(2, 3),
60 #endif /* ifdef CONFIG_SOC_IMX27 */
62 #ifdef CONFIG_SOC_IMX31
63 const struct imx_spi_imx_data imx31_cspi_data[] __initconst = {
64 #define imx31_cspi_data_entry(_id, _hwid) \
65 imx_spi_imx_data_entry(MX31, CSPI, "imx31-cspi", _id, _hwid, SZ_4K)
66 imx31_cspi_data_entry(0, 1),
67 imx31_cspi_data_entry(1, 2),
68 imx31_cspi_data_entry(2, 3),
70 #endif /* ifdef CONFIG_SOC_IMX31 */
72 #ifdef CONFIG_SOC_IMX35
73 const struct imx_spi_imx_data imx35_cspi_data[] __initconst = {
74 #define imx35_cspi_data_entry(_id, _hwid) \
75 imx_spi_imx_data_entry(MX35, CSPI, "imx35-cspi", _id, _hwid, SZ_4K)
76 imx35_cspi_data_entry(0, 1),
77 imx35_cspi_data_entry(1, 2),
79 #endif /* ifdef CONFIG_SOC_IMX35 */
81 #ifdef CONFIG_SOC_IMX51
82 const struct imx_spi_imx_data imx51_cspi_data __initconst =
83 imx_spi_imx_data_entry_single(MX51, CSPI, "imx51-cspi", 2, , SZ_4K);
85 const struct imx_spi_imx_data imx51_ecspi_data[] __initconst = {
86 #define imx51_ecspi_data_entry(_id, _hwid) \
87 imx_spi_imx_data_entry(MX51, ECSPI, "imx51-ecspi", _id, _hwid, SZ_4K)
88 imx51_ecspi_data_entry(0, 1),
89 imx51_ecspi_data_entry(1, 2),
91 #endif /* ifdef CONFIG_SOC_IMX51 */
93 #ifdef CONFIG_SOC_IMX53
94 const struct imx_spi_imx_data imx53_cspi_data __initconst =
95 imx_spi_imx_data_entry_single(MX53, CSPI, "imx53-cspi", 0, , SZ_4K);
97 const struct imx_spi_imx_data imx53_ecspi_data[] __initconst = {
98 #define imx53_ecspi_data_entry(_id, _hwid) \
99 imx_spi_imx_data_entry(MX53, ECSPI, "imx53-ecspi", _id, _hwid, SZ_4K)
100 imx53_ecspi_data_entry(0, 1),
101 imx53_ecspi_data_entry(1, 2),
103 #endif /* ifdef CONFIG_SOC_IMX53 */
105 struct platform_device *__init imx_add_spi_imx(
106 const struct imx_spi_imx_data *data,
107 const struct spi_imx_master *pdata)
109 struct resource res[] = {
111 .start = data->iobase,
112 .end = data->iobase + data->iosize - 1,
113 .flags = IORESOURCE_MEM,
114 }, {
115 .start = data->irq,
116 .end = data->irq,
117 .flags = IORESOURCE_IRQ,
121 return imx_add_platform_device(data->devid, data->id,
122 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));