Linux 5.7.7
[linux/fpc-iii.git] / arch / arm / mach-imx / devices / platform-imx-ssi.c
blobed8c66438af024757262cff5ccc97f19c1af6edd
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2010 Pengutronix
4 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5 */
6 #include "../hardware.h"
7 #include "devices-common.h"
9 #define imx_imx_ssi_data_entry(soc, _id, _hwid, _size) \
10 [_id] = { \
11 .id = _id, \
12 .iobase = soc ## _SSI ## _hwid ## _BASE_ADDR, \
13 .iosize = _size, \
14 .irq = soc ## _INT_SSI ## _hwid, \
15 .dmatx0 = soc ## _DMA_REQ_SSI ## _hwid ## _TX0, \
16 .dmarx0 = soc ## _DMA_REQ_SSI ## _hwid ## _RX0, \
17 .dmatx1 = soc ## _DMA_REQ_SSI ## _hwid ## _TX1, \
18 .dmarx1 = soc ## _DMA_REQ_SSI ## _hwid ## _RX1, \
21 #ifdef CONFIG_SOC_IMX21
22 const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst = {
23 #define imx21_imx_ssi_data_entry(_id, _hwid) \
24 imx_imx_ssi_data_entry(MX21, _id, _hwid, SZ_4K)
25 imx21_imx_ssi_data_entry(0, 1),
26 imx21_imx_ssi_data_entry(1, 2),
28 #endif /* ifdef CONFIG_SOC_IMX21 */
30 #ifdef CONFIG_SOC_IMX27
31 const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
32 #define imx27_imx_ssi_data_entry(_id, _hwid) \
33 imx_imx_ssi_data_entry(MX27, _id, _hwid, SZ_4K)
34 imx27_imx_ssi_data_entry(0, 1),
35 imx27_imx_ssi_data_entry(1, 2),
37 #endif /* ifdef CONFIG_SOC_IMX27 */
39 #ifdef CONFIG_SOC_IMX31
40 const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst = {
41 #define imx31_imx_ssi_data_entry(_id, _hwid) \
42 imx_imx_ssi_data_entry(MX31, _id, _hwid, SZ_4K)
43 imx31_imx_ssi_data_entry(0, 1),
44 imx31_imx_ssi_data_entry(1, 2),
46 #endif /* ifdef CONFIG_SOC_IMX31 */
48 #ifdef CONFIG_SOC_IMX35
49 const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
50 #define imx35_imx_ssi_data_entry(_id, _hwid) \
51 imx_imx_ssi_data_entry(MX35, _id, _hwid, SZ_4K)
52 imx35_imx_ssi_data_entry(0, 1),
53 imx35_imx_ssi_data_entry(1, 2),
55 #endif /* ifdef CONFIG_SOC_IMX35 */
57 struct platform_device *__init imx_add_imx_ssi(
58 const struct imx_imx_ssi_data *data,
59 const struct imx_ssi_platform_data *pdata)
61 struct resource res[] = {
63 .start = data->iobase,
64 .end = data->iobase + data->iosize - 1,
65 .flags = IORESOURCE_MEM,
66 }, {
67 .start = data->irq,
68 .end = data->irq,
69 .flags = IORESOURCE_IRQ,
71 #define DMARES(_name) { \
72 .name = #_name, \
73 .start = data->dma ## _name, \
74 .end = data->dma ## _name, \
75 .flags = IORESOURCE_DMA, \
77 DMARES(tx0),
78 DMARES(rx0),
79 DMARES(tx1),
80 DMARES(rx1),
83 return imx_add_platform_device("imx-ssi", data->id,
84 res, ARRAY_SIZE(res),
85 pdata, sizeof(*pdata));