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,
40 .flags = IORESOURCE_IRQ,
44 static u64 imx_csi_dmamask = 0xffffffffUL;
46 struct platform_device imx_csi_device = {
48 .id = 0, /* This is used to put cameras on this interface */
50 .dma_mask = &imx_csi_dmamask,
51 .coherent_dma_mask = 0xffffffff,
53 .resource = imx_csi_resources,
54 .num_resources = ARRAY_SIZE(imx_csi_resources),
57 static struct resource imx_i2c_resources[] = {
61 .flags = IORESOURCE_MEM,
66 .flags = IORESOURCE_IRQ,
70 struct platform_device imx_i2c_device = {
73 .resource = imx_i2c_resources,
74 .num_resources = ARRAY_SIZE(imx_i2c_resources),
77 static struct resource imx_uart1_resources[] = {
79 .start = UART1_BASE_ADDR,
80 .end = UART1_BASE_ADDR + 0xD0,
81 .flags = IORESOURCE_MEM,
84 .start = UART1_MINT_RX,
86 .flags = IORESOURCE_IRQ,
89 .start = UART1_MINT_TX,
91 .flags = IORESOURCE_IRQ,
94 .start = UART1_MINT_RTS,
95 .end = UART1_MINT_RTS,
96 .flags = IORESOURCE_IRQ,
100 struct platform_device imx_uart1_device = {
103 .num_resources = ARRAY_SIZE(imx_uart1_resources),
104 .resource = imx_uart1_resources,
107 static struct resource imx_uart2_resources[] = {
109 .start = UART2_BASE_ADDR,
110 .end = UART2_BASE_ADDR + 0xD0,
111 .flags = IORESOURCE_MEM,
114 .start = UART2_MINT_RX,
115 .end = UART2_MINT_RX,
116 .flags = IORESOURCE_IRQ,
119 .start = UART2_MINT_TX,
120 .end = UART2_MINT_TX,
121 .flags = IORESOURCE_IRQ,
124 .start = UART2_MINT_RTS,
125 .end = UART2_MINT_RTS,
126 .flags = IORESOURCE_IRQ,
130 struct platform_device imx_uart2_device = {
133 .num_resources = ARRAY_SIZE(imx_uart2_resources),
134 .resource = imx_uart2_resources,
137 static struct resource imx_rtc_resources[] = {
141 .flags = IORESOURCE_MEM,
146 .flags = IORESOURCE_IRQ,
151 .flags = IORESOURCE_IRQ,
155 struct platform_device imx_rtc_device = {
158 .resource = imx_rtc_resources,
159 .num_resources = ARRAY_SIZE(imx_rtc_resources),
162 static struct resource imx_wdt_resources[] = {
166 .flags = IORESOURCE_MEM,
171 .flags = IORESOURCE_IRQ,
175 struct platform_device imx_wdt_device = {
178 .resource = imx_wdt_resources,
179 .num_resources = ARRAY_SIZE(imx_wdt_resources),
182 static struct resource imx_usb_resources[] = {
186 .flags = IORESOURCE_MEM,
191 .flags = IORESOURCE_IRQ,
196 .flags = IORESOURCE_IRQ,
201 .flags = IORESOURCE_IRQ,
206 .flags = IORESOURCE_IRQ,
211 .flags = IORESOURCE_IRQ,
216 .flags = IORESOURCE_IRQ,
221 .flags = IORESOURCE_IRQ,
225 struct platform_device imx_usb_device = {
228 .num_resources = ARRAY_SIZE(imx_usb_resources),
229 .resource = imx_usb_resources,
232 /* GPIO port description */
233 static struct mxc_gpio_port imx_gpio_ports[] = {
235 .chip.label = "gpio-0",
236 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR),
237 .irq = GPIO_INT_PORTA,
238 .virtual_irq_start = MXC_GPIO_IRQ_START
241 .chip.label = "gpio-1",
242 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
243 .irq = GPIO_INT_PORTB,
244 .virtual_irq_start = MXC_GPIO_IRQ_START + 32
247 .chip.label = "gpio-2",
248 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
249 .irq = GPIO_INT_PORTC,
250 .virtual_irq_start = MXC_GPIO_IRQ_START + 64
253 .chip.label = "gpio-3",
254 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
255 .irq = GPIO_INT_PORTD,
256 .virtual_irq_start = MXC_GPIO_IRQ_START + 96
260 int __init mxc_register_gpios(void)
262 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));