2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
4 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #include <linux/kernel.h>
23 #include <linux/init.h>
24 #include <linux/dma-mapping.h>
25 #include <linux/platform_device.h>
26 #include <linux/gpio.h>
27 #include <mach/irqs.h>
28 #include <mach/hardware.h>
32 static struct resource imx1_camera_resources
[] = {
36 .flags
= IORESOURCE_MEM
,
40 .flags
= IORESOURCE_IRQ
,
44 static u64 imx1_camera_dmamask
= DMA_BIT_MASK(32);
46 struct platform_device imx1_camera_device
= {
48 .id
= 0, /* This is used to put cameras on this interface */
50 .dma_mask
= &imx1_camera_dmamask
,
51 .coherent_dma_mask
= DMA_BIT_MASK(32),
53 .resource
= imx1_camera_resources
,
54 .num_resources
= ARRAY_SIZE(imx1_camera_resources
),
57 static struct resource imx_i2c_resources
[] = {
61 .flags
= IORESOURCE_MEM
,
65 .flags
= IORESOURCE_IRQ
,
69 struct platform_device imx_i2c_device0
= {
72 .resource
= imx_i2c_resources
,
73 .num_resources
= ARRAY_SIZE(imx_i2c_resources
),
76 static struct resource imx_uart1_resources
[] = {
78 .start
= MX1_UART1_BASE_ADDR
,
79 .end
= MX1_UART1_BASE_ADDR
+ 0xD0,
80 .flags
= IORESOURCE_MEM
,
82 .start
= MX1_UART1_MINT_RX
,
83 .end
= MX1_UART1_MINT_RX
,
84 .flags
= IORESOURCE_IRQ
,
86 .start
= MX1_UART1_MINT_TX
,
87 .end
= MX1_UART1_MINT_TX
,
88 .flags
= IORESOURCE_IRQ
,
90 .start
= MX1_UART1_MINT_RTS
,
91 .end
= MX1_UART1_MINT_RTS
,
92 .flags
= IORESOURCE_IRQ
,
96 struct platform_device imx_uart1_device
= {
99 .num_resources
= ARRAY_SIZE(imx_uart1_resources
),
100 .resource
= imx_uart1_resources
,
103 static struct resource imx_uart2_resources
[] = {
105 .start
= MX1_UART2_BASE_ADDR
,
106 .end
= MX1_UART2_BASE_ADDR
+ 0xD0,
107 .flags
= IORESOURCE_MEM
,
109 .start
= MX1_UART2_MINT_RX
,
110 .end
= MX1_UART2_MINT_RX
,
111 .flags
= IORESOURCE_IRQ
,
113 .start
= MX1_UART2_MINT_TX
,
114 .end
= MX1_UART2_MINT_TX
,
115 .flags
= IORESOURCE_IRQ
,
117 .start
= MX1_UART2_MINT_RTS
,
118 .end
= MX1_UART2_MINT_RTS
,
119 .flags
= IORESOURCE_IRQ
,
123 struct platform_device imx_uart2_device
= {
126 .num_resources
= ARRAY_SIZE(imx_uart2_resources
),
127 .resource
= imx_uart2_resources
,
130 static struct resource imx_rtc_resources
[] = {
134 .flags
= IORESOURCE_MEM
,
136 .start
= MX1_RTC_INT
,
138 .flags
= IORESOURCE_IRQ
,
140 .start
= MX1_RTC_SAMINT
,
141 .end
= MX1_RTC_SAMINT
,
142 .flags
= IORESOURCE_IRQ
,
146 struct platform_device imx_rtc_device
= {
149 .resource
= imx_rtc_resources
,
150 .num_resources
= ARRAY_SIZE(imx_rtc_resources
),
153 static struct resource imx_wdt_resources
[] = {
157 .flags
= IORESOURCE_MEM
,
159 .start
= MX1_WDT_INT
,
161 .flags
= IORESOURCE_IRQ
,
165 struct platform_device imx_wdt_device
= {
168 .resource
= imx_wdt_resources
,
169 .num_resources
= ARRAY_SIZE(imx_wdt_resources
),
172 static struct resource imx_usb_resources
[] = {
176 .flags
= IORESOURCE_MEM
,
178 .start
= MX1_USBD_INT0
,
179 .end
= MX1_USBD_INT0
,
180 .flags
= IORESOURCE_IRQ
,
182 .start
= MX1_USBD_INT1
,
183 .end
= MX1_USBD_INT1
,
184 .flags
= IORESOURCE_IRQ
,
186 .start
= MX1_USBD_INT2
,
187 .end
= MX1_USBD_INT2
,
188 .flags
= IORESOURCE_IRQ
,
190 .start
= MX1_USBD_INT3
,
191 .end
= MX1_USBD_INT3
,
192 .flags
= IORESOURCE_IRQ
,
194 .start
= MX1_USBD_INT4
,
195 .end
= MX1_USBD_INT4
,
196 .flags
= IORESOURCE_IRQ
,
198 .start
= MX1_USBD_INT5
,
199 .end
= MX1_USBD_INT5
,
200 .flags
= IORESOURCE_IRQ
,
202 .start
= MX1_USBD_INT6
,
203 .end
= MX1_USBD_INT6
,
204 .flags
= IORESOURCE_IRQ
,
208 struct platform_device imx_usb_device
= {
211 .num_resources
= ARRAY_SIZE(imx_usb_resources
),
212 .resource
= imx_usb_resources
,
215 /* GPIO port description */
216 static struct mxc_gpio_port imx_gpio_ports
[] = {
218 .chip
.label
= "gpio-0",
219 .base
= (void __iomem
*)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR
),
220 .irq
= MX1_GPIO_INT_PORTA
,
221 .virtual_irq_start
= MXC_GPIO_IRQ_START
,
223 .chip
.label
= "gpio-1",
224 .base
= (void __iomem
*)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR
+ 0x100),
225 .irq
= MX1_GPIO_INT_PORTB
,
226 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 32,
228 .chip
.label
= "gpio-2",
229 .base
= (void __iomem
*)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR
+ 0x200),
230 .irq
= MX1_GPIO_INT_PORTC
,
231 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 64,
233 .chip
.label
= "gpio-3",
234 .base
= (void __iomem
*)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR
+ 0x300),
235 .irq
= MX1_GPIO_INT_PORTD
,
236 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 96,
240 int __init
imx1_register_gpios(void)
242 return mxc_gpio_init(imx_gpio_ports
, ARRAY_SIZE(imx_gpio_ports
));