aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mxs/devices/platform-gpmi-nfc.c
blob: ae88672ccb2e756d3abf3796b351cfc4a733f794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
 * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
#include <asm/sizes.h>
#include <mach/mx23.h>
#include <mach/mx28.h>
#include <mach/devices-common.h>

#define RES_MEM(soc, _id, _s, _n)				\
	{							\
		.start = soc ##_## _id ## _BASE_ADDR,		\
		.end   = soc ##_## _id ## _BASE_ADDR + (_s) - 1,\
		.name  = (_n),					\
		.flags = IORESOURCE_MEM,			\
	}

#define RES_IRQ(soc, _id, _n)			\
	{					\
		.start = soc ##_INT_## _id,	\
		.end   = soc ##_INT_## _id,	\
		.name  = (_n),			\
		.flags = IORESOURCE_IRQ,	\
	}

#define RES_DMA(soc, _i_s, _i_e, _n)		\
	{					\
		.start = soc ##_## _i_s,	\
		.end   = soc ##_## _i_e,	\
		.name  = (_n),			\
		.flags = IORESOURCE_DMA,	\
	}

#ifdef CONFIG_SOC_IMX23
const struct mxs_gpmi_nfc_data mx23_gpmi_nfc_data __initconst = {
	.devid = "imx23-gpmi-nfc",
	.res = {
		/* GPMI */
		RES_MEM(MX23, GPMI, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME),
		RES_IRQ(MX23, GPMI_ATTENTION, GPMI_NFC_GPMI_INTERRUPT_RES_NAME),
		/* BCH */
		RES_MEM(MX23, BCH, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME),
		RES_IRQ(MX23, BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME),
		/* DMA */
		RES_DMA(MX23, DMA_GPMI0, DMA_GPMI3,
					GPMI_NFC_DMA_CHANNELS_RES_NAME),
		RES_IRQ(MX23, GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME),
	},
};
#endif

#ifdef CONFIG_SOC_IMX28
const struct mxs_gpmi_nfc_data mx28_gpmi_nfc_data __initconst = {
	.devid = "imx28-gpmi-nfc",
	.res = {
		/* GPMI */
		RES_MEM(MX28, GPMI, SZ_8K, GPMI_NFC_GPMI_REGS_ADDR_RES_NAME),
		RES_IRQ(MX28, GPMI, GPMI_NFC_GPMI_INTERRUPT_RES_NAME),
		/* BCH */
		RES_MEM(MX28, BCH, SZ_8K, GPMI_NFC_BCH_REGS_ADDR_RES_NAME),
		RES_IRQ(MX28, BCH, GPMI_NFC_BCH_INTERRUPT_RES_NAME),
		/* DMA */
		RES_DMA(MX28, DMA_GPMI0, DMA_GPMI7,
					GPMI_NFC_DMA_CHANNELS_RES_NAME),
		RES_IRQ(MX28, GPMI_DMA, GPMI_NFC_DMA_INTERRUPT_RES_NAME),
	},
};
#endif

struct platform_device *__init
mxs_add_gpmi_nfc(const struct gpmi_nfc_platform_data *pdata,
		const struct mxs_gpmi_nfc_data *data)
{
	return mxs_add_platform_device_dmamask(data->devid, -1,
				data->res, RES_SIZE,
				pdata, sizeof(*pdata), DMA_BIT_MASK(32));
}