2 * Author: MontaVista Software, Inc.
5 * Based on the OMAP devices.c
7 * 2005 (c) MontaVista Software, Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is
9 * licensed "as is" without any warranty of any kind, whether express
12 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
13 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version 2
18 * of the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
29 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/init.h>
32 #include <linux/platform_device.h>
33 #include <linux/gpio.h>
35 #include <mach/irqs.h>
36 #include <mach/hardware.h>
39 * Resource definition for the MXC IrDA
41 static struct resource mxc_irda_resources
[] = {
43 .start
= UART3_BASE_ADDR
,
44 .end
= UART3_BASE_ADDR
+ SZ_4K
- 1,
45 .flags
= IORESOURCE_MEM
,
48 .start
= MXC_INT_UART3
,
50 .flags
= IORESOURCE_IRQ
,
54 /* Platform Data for MXC IrDA */
55 struct platform_device mxc_irda_device
= {
58 .num_resources
= ARRAY_SIZE(mxc_irda_resources
),
59 .resource
= mxc_irda_resources
,
63 * General Purpose Timer
64 * - i.MX1: 2 timer (slighly different register handling)
69 /* We use gpt0 as system timer, so do not add a device for this one */
71 static struct resource timer1_resources
[] = {
73 .start
= GPT2_BASE_ADDR
,
74 .end
= GPT2_BASE_ADDR
+ 0x17,
75 .flags
= IORESOURCE_MEM
78 .start
= MXC_INT_GPT2
,
80 .flags
= IORESOURCE_IRQ
,
84 struct platform_device mxc_gpt1
= {
87 .num_resources
= ARRAY_SIZE(timer1_resources
),
88 .resource
= timer1_resources
91 static struct resource timer2_resources
[] = {
93 .start
= GPT3_BASE_ADDR
,
94 .end
= GPT3_BASE_ADDR
+ 0x17,
95 .flags
= IORESOURCE_MEM
98 .start
= MXC_INT_GPT3
,
100 .flags
= IORESOURCE_IRQ
,
104 struct platform_device mxc_gpt2
= {
107 .num_resources
= ARRAY_SIZE(timer2_resources
),
108 .resource
= timer2_resources
111 #ifdef CONFIG_MACH_MX27
112 static struct resource timer3_resources
[] = {
114 .start
= GPT4_BASE_ADDR
,
115 .end
= GPT4_BASE_ADDR
+ 0x17,
116 .flags
= IORESOURCE_MEM
119 .start
= MXC_INT_GPT4
,
121 .flags
= IORESOURCE_IRQ
,
125 struct platform_device mxc_gpt3
= {
128 .num_resources
= ARRAY_SIZE(timer3_resources
),
129 .resource
= timer3_resources
132 static struct resource timer4_resources
[] = {
134 .start
= GPT5_BASE_ADDR
,
135 .end
= GPT5_BASE_ADDR
+ 0x17,
136 .flags
= IORESOURCE_MEM
139 .start
= MXC_INT_GPT5
,
141 .flags
= IORESOURCE_IRQ
,
145 struct platform_device mxc_gpt4
= {
148 .num_resources
= ARRAY_SIZE(timer4_resources
),
149 .resource
= timer4_resources
152 static struct resource timer5_resources
[] = {
154 .start
= GPT6_BASE_ADDR
,
155 .end
= GPT6_BASE_ADDR
+ 0x17,
156 .flags
= IORESOURCE_MEM
159 .start
= MXC_INT_GPT6
,
161 .flags
= IORESOURCE_IRQ
,
165 struct platform_device mxc_gpt5
= {
168 .num_resources
= ARRAY_SIZE(timer5_resources
),
169 .resource
= timer5_resources
179 static struct resource mxc_wdt_resources
[] = {
181 .start
= WDOG_BASE_ADDR
,
182 .end
= WDOG_BASE_ADDR
+ 0x30,
183 .flags
= IORESOURCE_MEM
,
187 struct platform_device mxc_wdt
= {
190 .num_resources
= ARRAY_SIZE(mxc_wdt_resources
),
191 .resource
= mxc_wdt_resources
,
194 static struct resource mxc_w1_master_resources
[] = {
196 .start
= OWIRE_BASE_ADDR
,
197 .end
= OWIRE_BASE_ADDR
+ SZ_4K
- 1,
198 .flags
= IORESOURCE_MEM
,
202 struct platform_device mxc_w1_master_device
= {
205 .num_resources
= ARRAY_SIZE(mxc_w1_master_resources
),
206 .resource
= mxc_w1_master_resources
,
209 static struct resource mxc_nand_resources
[] = {
211 .start
= NFC_BASE_ADDR
,
212 .end
= NFC_BASE_ADDR
+ 0xfff,
213 .flags
= IORESOURCE_MEM
215 .start
= MXC_INT_NANDFC
,
216 .end
= MXC_INT_NANDFC
,
217 .flags
= IORESOURCE_IRQ
221 struct platform_device mxc_nand_device
= {
224 .num_resources
= ARRAY_SIZE(mxc_nand_resources
),
225 .resource
= mxc_nand_resources
,
228 /* GPIO port description */
229 static struct mxc_gpio_port imx_gpio_ports
[] = {
231 .chip
.label
= "gpio-0",
233 .base
= (void*)(AIPI_BASE_ADDR_VIRT
+ 0x15000 + 0x100 * 0),
234 .virtual_irq_start
= MXC_GPIO_IRQ_START
,
237 .chip
.label
= "gpio-1",
238 .base
= (void*)(AIPI_BASE_ADDR_VIRT
+ 0x15000 + 0x100 * 1),
239 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 32,
242 .chip
.label
= "gpio-2",
243 .base
= (void*)(AIPI_BASE_ADDR_VIRT
+ 0x15000 + 0x100 * 2),
244 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 64,
247 .chip
.label
= "gpio-3",
248 .base
= (void*)(AIPI_BASE_ADDR_VIRT
+ 0x15000 + 0x100 * 3),
249 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 96,
252 .chip
.label
= "gpio-4",
253 .base
= (void*)(AIPI_BASE_ADDR_VIRT
+ 0x15000 + 0x100 * 4),
254 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 128,
257 .chip
.label
= "gpio-5",
258 .base
= (void*)(AIPI_BASE_ADDR_VIRT
+ 0x15000 + 0x100 * 5),
259 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 160,
263 int __init
mxc_register_gpios(void)
265 return mxc_gpio_init(imx_gpio_ports
, ARRAY_SIZE(imx_gpio_ports
));