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/platform_device.h>
25 #include <linux/gpio.h>
26 #include <mach/irqs.h>
27 #include <mach/hardware.h>
31 static struct resource imx_csi_resources
[] = {
35 .flags
= IORESOURCE_MEM
,
39 .flags
= IORESOURCE_IRQ
,
43 static u64 imx_csi_dmamask
= 0xffffffffUL
;
45 struct platform_device imx_csi_device
= {
47 .id
= 0, /* This is used to put cameras on this interface */
49 .dma_mask
= &imx_csi_dmamask
,
50 .coherent_dma_mask
= 0xffffffff,
52 .resource
= imx_csi_resources
,
53 .num_resources
= ARRAY_SIZE(imx_csi_resources
),
56 static struct resource imx_i2c_resources
[] = {
60 .flags
= IORESOURCE_MEM
,
64 .flags
= IORESOURCE_IRQ
,
68 struct platform_device imx_i2c_device
= {
71 .resource
= imx_i2c_resources
,
72 .num_resources
= ARRAY_SIZE(imx_i2c_resources
),
75 static struct resource imx_uart1_resources
[] = {
77 .start
= UART1_BASE_ADDR
,
78 .end
= UART1_BASE_ADDR
+ 0xD0,
79 .flags
= IORESOURCE_MEM
,
81 .start
= UART1_MINT_RX
,
83 .flags
= IORESOURCE_IRQ
,
85 .start
= UART1_MINT_TX
,
87 .flags
= IORESOURCE_IRQ
,
89 .start
= UART1_MINT_RTS
,
90 .end
= UART1_MINT_RTS
,
91 .flags
= IORESOURCE_IRQ
,
95 struct platform_device imx_uart1_device
= {
98 .num_resources
= ARRAY_SIZE(imx_uart1_resources
),
99 .resource
= imx_uart1_resources
,
102 static struct resource imx_uart2_resources
[] = {
104 .start
= UART2_BASE_ADDR
,
105 .end
= UART2_BASE_ADDR
+ 0xD0,
106 .flags
= IORESOURCE_MEM
,
108 .start
= UART2_MINT_RX
,
109 .end
= UART2_MINT_RX
,
110 .flags
= IORESOURCE_IRQ
,
112 .start
= UART2_MINT_TX
,
113 .end
= UART2_MINT_TX
,
114 .flags
= IORESOURCE_IRQ
,
116 .start
= UART2_MINT_RTS
,
117 .end
= UART2_MINT_RTS
,
118 .flags
= IORESOURCE_IRQ
,
122 struct platform_device imx_uart2_device
= {
125 .num_resources
= ARRAY_SIZE(imx_uart2_resources
),
126 .resource
= imx_uart2_resources
,
129 static struct resource imx_rtc_resources
[] = {
133 .flags
= IORESOURCE_MEM
,
137 .flags
= IORESOURCE_IRQ
,
141 .flags
= IORESOURCE_IRQ
,
145 struct platform_device imx_rtc_device
= {
148 .resource
= imx_rtc_resources
,
149 .num_resources
= ARRAY_SIZE(imx_rtc_resources
),
152 static struct resource imx_wdt_resources
[] = {
156 .flags
= IORESOURCE_MEM
,
160 .flags
= IORESOURCE_IRQ
,
164 struct platform_device imx_wdt_device
= {
167 .resource
= imx_wdt_resources
,
168 .num_resources
= ARRAY_SIZE(imx_wdt_resources
),
171 static struct resource imx_usb_resources
[] = {
175 .flags
= IORESOURCE_MEM
,
179 .flags
= IORESOURCE_IRQ
,
183 .flags
= IORESOURCE_IRQ
,
187 .flags
= IORESOURCE_IRQ
,
191 .flags
= IORESOURCE_IRQ
,
195 .flags
= IORESOURCE_IRQ
,
199 .flags
= IORESOURCE_IRQ
,
203 .flags
= IORESOURCE_IRQ
,
207 struct platform_device imx_usb_device
= {
210 .num_resources
= ARRAY_SIZE(imx_usb_resources
),
211 .resource
= imx_usb_resources
,
214 /* GPIO port description */
215 static struct mxc_gpio_port imx_gpio_ports
[] = {
217 .chip
.label
= "gpio-0",
218 .base
= (void __iomem
*)IO_ADDRESS(GPIO_BASE_ADDR
),
219 .irq
= GPIO_INT_PORTA
,
220 .virtual_irq_start
= MXC_GPIO_IRQ_START
,
222 .chip
.label
= "gpio-1",
223 .base
= (void __iomem
*)IO_ADDRESS(GPIO_BASE_ADDR
+ 0x100),
224 .irq
= GPIO_INT_PORTB
,
225 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 32,
227 .chip
.label
= "gpio-2",
228 .base
= (void __iomem
*)IO_ADDRESS(GPIO_BASE_ADDR
+ 0x200),
229 .irq
= GPIO_INT_PORTC
,
230 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 64,
232 .chip
.label
= "gpio-3",
233 .base
= (void __iomem
*)IO_ADDRESS(GPIO_BASE_ADDR
+ 0x300),
234 .irq
= GPIO_INT_PORTD
,
235 .virtual_irq_start
= MXC_GPIO_IRQ_START
+ 96,
239 int __init
mxc_register_gpios(void)
241 return mxc_gpio_init(imx_gpio_ports
, ARRAY_SIZE(imx_gpio_ports
));