Merge remote-tracking branch 'moduleh/module.h-split'
[linux-2.6/next.git] / arch / arm / mach-mxs / devices / platform-mxs-saif.c
blob1ec965e9fe92e6e14c98b3bbc4787966136dbfa4
1 /*
2 * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
7 */
8 #include <linux/compiler.h>
9 #include <linux/err.h>
10 #include <linux/init.h>
12 #include <mach/mx23.h>
13 #include <mach/mx28.h>
14 #include <mach/devices-common.h>
16 #define mxs_saif_data_entry_single(soc, _id) \
17 { \
18 .id = _id, \
19 .iobase = soc ## _SAIF ## _id ## _BASE_ADDR, \
20 .irq = soc ## _INT_SAIF ## _id, \
21 .dma = soc ## _DMA_SAIF ## _id, \
22 .dmairq = soc ## _INT_SAIF ## _id ##_DMA, \
25 #define mxs_saif_data_entry(soc, _id) \
26 [_id] = mxs_saif_data_entry_single(soc, _id)
28 #ifdef CONFIG_SOC_IMX28
29 const struct mxs_saif_data mx28_saif_data[] __initconst = {
30 mxs_saif_data_entry(MX28, 0),
31 mxs_saif_data_entry(MX28, 1),
33 #endif
35 struct platform_device *__init mxs_add_saif(const struct mxs_saif_data *data)
37 struct resource res[] = {
39 .start = data->iobase,
40 .end = data->iobase + SZ_4K - 1,
41 .flags = IORESOURCE_MEM,
42 }, {
43 .start = data->irq,
44 .end = data->irq,
45 .flags = IORESOURCE_IRQ,
46 }, {
47 .start = data->dma,
48 .end = data->dma,
49 .flags = IORESOURCE_DMA,
50 }, {
51 .start = data->dmairq,
52 .end = data->dmairq,
53 .flags = IORESOURCE_IRQ,
58 return mxs_add_platform_device("mxs-saif", data->id, res,
59 ARRAY_SIZE(res), NULL, 0);