1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2009-2010 Pengutronix
4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
6 #include "../hardware.h"
7 #include "devices-common.h"
9 #define imx_spi_imx_data_entry_single(soc, type, _devid, _id, hwid, _size) \
13 .iobase = soc ## _ ## type ## hwid ## _BASE_ADDR, \
15 .irq = soc ## _INT_ ## type ## hwid, \
18 #define imx_spi_imx_data_entry(soc, type, devid, id, hwid, size) \
19 [id] = imx_spi_imx_data_entry_single(soc, type, devid, id, hwid, size)
21 #ifdef CONFIG_SOC_IMX21
22 const struct imx_spi_imx_data imx21_cspi_data
[] __initconst
= {
23 #define imx21_cspi_data_entry(_id, _hwid) \
24 imx_spi_imx_data_entry(MX21, CSPI, "imx21-cspi", _id, _hwid, SZ_4K)
25 imx21_cspi_data_entry(0, 1),
26 imx21_cspi_data_entry(1, 2),
30 #ifdef CONFIG_SOC_IMX27
31 const struct imx_spi_imx_data imx27_cspi_data
[] __initconst
= {
32 #define imx27_cspi_data_entry(_id, _hwid) \
33 imx_spi_imx_data_entry(MX27, CSPI, "imx27-cspi", _id, _hwid, SZ_4K)
34 imx27_cspi_data_entry(0, 1),
35 imx27_cspi_data_entry(1, 2),
36 imx27_cspi_data_entry(2, 3),
38 #endif /* ifdef CONFIG_SOC_IMX27 */
40 #ifdef CONFIG_SOC_IMX31
41 const struct imx_spi_imx_data imx31_cspi_data
[] __initconst
= {
42 #define imx31_cspi_data_entry(_id, _hwid) \
43 imx_spi_imx_data_entry(MX31, CSPI, "imx31-cspi", _id, _hwid, SZ_4K)
44 imx31_cspi_data_entry(0, 1),
45 imx31_cspi_data_entry(1, 2),
46 imx31_cspi_data_entry(2, 3),
48 #endif /* ifdef CONFIG_SOC_IMX31 */
50 #ifdef CONFIG_SOC_IMX35
51 const struct imx_spi_imx_data imx35_cspi_data
[] __initconst
= {
52 #define imx35_cspi_data_entry(_id, _hwid) \
53 imx_spi_imx_data_entry(MX35, CSPI, "imx35-cspi", _id, _hwid, SZ_4K)
54 imx35_cspi_data_entry(0, 1),
55 imx35_cspi_data_entry(1, 2),
57 #endif /* ifdef CONFIG_SOC_IMX35 */
59 struct platform_device
*__init
imx_add_spi_imx(
60 const struct imx_spi_imx_data
*data
,
61 const struct spi_imx_master
*pdata
)
63 struct resource res
[] = {
65 .start
= data
->iobase
,
66 .end
= data
->iobase
+ data
->iosize
- 1,
67 .flags
= IORESOURCE_MEM
,
71 .flags
= IORESOURCE_IRQ
,
75 return imx_add_platform_device(data
->devid
, data
->id
,
76 res
, ARRAY_SIZE(res
), pdata
, sizeof(*pdata
));