blob: 6f0e94eb29eeec2c549a0110beb3234357e9c08d [file] [log] [blame]
Uwe Kleine-König4697bb922010-08-25 17:37:45 +02001/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
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 */
Shawn Guo50f2de62012-09-14 14:14:45 +08009#include "../hardware.h"
Shawn Guoe0557c02012-09-13 15:51:15 +080010#include "devices-common.h"
Uwe Kleine-König4697bb922010-08-25 17:37:45 +020011
12#define imx_imx_ssi_data_entry(soc, _id, _hwid, _size) \
13 [_id] = { \
14 .id = _id, \
15 .iobase = soc ## _SSI ## _hwid ## _BASE_ADDR, \
16 .iosize = _size, \
17 .irq = soc ## _INT_SSI ## _hwid, \
18 .dmatx0 = soc ## _DMA_REQ_SSI ## _hwid ## _TX0, \
19 .dmarx0 = soc ## _DMA_REQ_SSI ## _hwid ## _RX0, \
20 .dmatx1 = soc ## _DMA_REQ_SSI ## _hwid ## _TX1, \
21 .dmarx1 = soc ## _DMA_REQ_SSI ## _hwid ## _RX1, \
22 }
23
24#ifdef CONFIG_SOC_IMX21
25const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst = {
26#define imx21_imx_ssi_data_entry(_id, _hwid) \
27 imx_imx_ssi_data_entry(MX21, _id, _hwid, SZ_4K)
28 imx21_imx_ssi_data_entry(0, 1),
29 imx21_imx_ssi_data_entry(1, 2),
30};
31#endif /* ifdef CONFIG_SOC_IMX21 */
32
Uwe Kleine-König4697bb922010-08-25 17:37:45 +020033#ifdef CONFIG_SOC_IMX27
34const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst = {
35#define imx27_imx_ssi_data_entry(_id, _hwid) \
36 imx_imx_ssi_data_entry(MX27, _id, _hwid, SZ_4K)
37 imx27_imx_ssi_data_entry(0, 1),
38 imx27_imx_ssi_data_entry(1, 2),
39};
40#endif /* ifdef CONFIG_SOC_IMX27 */
41
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010042#ifdef CONFIG_SOC_IMX31
Uwe Kleine-König4697bb922010-08-25 17:37:45 +020043const struct imx_imx_ssi_data imx31_imx_ssi_data[] __initconst = {
44#define imx31_imx_ssi_data_entry(_id, _hwid) \
45 imx_imx_ssi_data_entry(MX31, _id, _hwid, SZ_4K)
46 imx31_imx_ssi_data_entry(0, 1),
47 imx31_imx_ssi_data_entry(1, 2),
48};
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010049#endif /* ifdef CONFIG_SOC_IMX31 */
Uwe Kleine-König4697bb922010-08-25 17:37:45 +020050
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010051#ifdef CONFIG_SOC_IMX35
Uwe Kleine-König4697bb922010-08-25 17:37:45 +020052const struct imx_imx_ssi_data imx35_imx_ssi_data[] __initconst = {
53#define imx35_imx_ssi_data_entry(_id, _hwid) \
54 imx_imx_ssi_data_entry(MX35, _id, _hwid, SZ_4K)
55 imx35_imx_ssi_data_entry(0, 1),
56 imx35_imx_ssi_data_entry(1, 2),
57};
Uwe Kleine-Königa528bc82010-11-12 10:11:42 +010058#endif /* ifdef CONFIG_SOC_IMX35 */
Uwe Kleine-König4697bb922010-08-25 17:37:45 +020059
Uwe Kleine-König4697bb922010-08-25 17:37:45 +020060struct platform_device *__init imx_add_imx_ssi(
61 const struct imx_imx_ssi_data *data,
62 const struct imx_ssi_platform_data *pdata)
63{
64 struct resource res[] = {
65 {
66 .start = data->iobase,
67 .end = data->iobase + data->iosize - 1,
68 .flags = IORESOURCE_MEM,
69 }, {
70 .start = data->irq,
71 .end = data->irq,
72 .flags = IORESOURCE_IRQ,
73 },
74#define DMARES(_name) { \
75 .name = #_name, \
76 .start = data->dma ## _name, \
77 .end = data->dma ## _name, \
78 .flags = IORESOURCE_DMA, \
79}
80 DMARES(tx0),
81 DMARES(rx0),
82 DMARES(tx1),
83 DMARES(rx1),
84 };
85
86 return imx_add_platform_device("imx-ssi", data->id,
87 res, ARRAY_SIZE(res),
88 pdata, sizeof(*pdata));
89}