]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm/plat-mxc/devices/platform-imx-spdif.c
80a5e782067ee3708c6e1b00d3775d46ca76c9f3
[karo-tx-linux.git] / arch / arm / plat-mxc / devices / platform-imx-spdif.c
1 /*
2  * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
3  */
4
5 /*
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #include <mach/hardware.h>
22 #include <mach/devices-common.h>
23
24 #define imx5_spdif_data_entry_single(soc)                       \
25         {                                                       \
26                 .iobase = soc ## _SPDIF_BASE_ADDR,              \
27                 .irq = soc ## _INT_SPDIF,                       \
28         }
29
30 #ifdef CONFIG_SOC_IMX50
31 const struct imx_spdif_data imx50_imx_spdif_data __initconst =
32                         imx5_spdif_data_entry_single(MX53);
33 #endif /* ifdef CONFIG_SOC_IMX50 */
34
35 #ifdef CONFIG_SOC_IMX51
36 const struct imx_spdif_data imx51_imx_spdif_data __initconst =
37                         imx5_spdif_data_entry_single(MX51);
38 #endif /* ifdef CONFIG_SOC_IMX51 */
39
40 #ifdef CONFIG_SOC_IMX53
41 const struct imx_spdif_data imx53_imx_spdif_data __initconst =
42                         imx5_spdif_data_entry_single(MX53);
43 #endif /* ifdef CONFIG_SOC_IMX53 */
44
45 struct platform_device *__init imx_add_spdif(
46                 const struct imx_spdif_data *data,
47                 const struct mxc_spdif_platform_data *pdata)
48 {
49         struct resource res[] = {
50                 {
51                         .start = data->iobase,
52                         .end = data->iobase + 0x50,
53                         .flags = IORESOURCE_MEM,
54                 }, {
55                         .start = data->irq,
56                         .end = data->irq,
57                         .flags = IORESOURCE_IRQ,
58                 },
59         };
60
61         return imx_add_platform_device("mxc_spdif", 0,
62                         res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
63 }
64