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/hardware.h>
28 static struct resource imx_csi_resources[] = {
32 .flags = IORESOURCE_MEM,
37 .flags = IORESOURCE_IRQ,
41 static u64 imx_csi_dmamask = 0xffffffffUL;
43 struct platform_device imx_csi_device = {
45 .id = 0, /* This is used to put cameras on this interface */
47 .dma_mask = &imx_csi_dmamask,
48 .coherent_dma_mask = 0xffffffff,
50 .resource = imx_csi_resources,
51 .num_resources = ARRAY_SIZE(imx_csi_resources),
54 static struct resource imx_i2c_resources[] = {
58 .flags = IORESOURCE_MEM,
63 .flags = IORESOURCE_IRQ,
67 struct platform_device imx_i2c_device = {
70 .resource = imx_i2c_resources,
71 .num_resources = ARRAY_SIZE(imx_i2c_resources),
74 static struct resource imx_uart1_resources[] = {
76 .start = UART1_BASE_ADDR,
77 .end = UART1_BASE_ADDR + 0xD0,
78 .flags = IORESOURCE_MEM,
81 .start = UART1_MINT_RX,
83 .flags = IORESOURCE_IRQ,
86 .start = UART1_MINT_TX,
88 .flags = IORESOURCE_IRQ,
91 .start = UART1_MINT_RTS,
92 .end = UART1_MINT_RTS,
93 .flags = IORESOURCE_IRQ,
97 struct platform_device imx_uart1_device = {
100 .num_resources = ARRAY_SIZE(imx_uart1_resources),
101 .resource = imx_uart1_resources,
104 static struct resource imx_uart2_resources[] = {
106 .start = UART2_BASE_ADDR,
107 .end = UART2_BASE_ADDR + 0xD0,
108 .flags = IORESOURCE_MEM,
111 .start = UART2_MINT_RX,
112 .end = UART2_MINT_RX,
113 .flags = IORESOURCE_IRQ,
116 .start = UART2_MINT_TX,
117 .end = UART2_MINT_TX,
118 .flags = IORESOURCE_IRQ,
121 .start = UART2_MINT_RTS,
122 .end = UART2_MINT_RTS,
123 .flags = IORESOURCE_IRQ,
127 struct platform_device imx_uart2_device = {
130 .num_resources = ARRAY_SIZE(imx_uart2_resources),
131 .resource = imx_uart2_resources,
134 static struct resource imx_rtc_resources[] = {
138 .flags = IORESOURCE_MEM,
143 .flags = IORESOURCE_IRQ,
148 .flags = IORESOURCE_IRQ,
152 struct platform_device imx_rtc_device = {
155 .resource = imx_rtc_resources,
156 .num_resources = ARRAY_SIZE(imx_rtc_resources),
159 static struct resource imx_wdt_resources[] = {
163 .flags = IORESOURCE_MEM,
168 .flags = IORESOURCE_IRQ,
172 struct platform_device imx_wdt_device = {
175 .resource = imx_wdt_resources,
176 .num_resources = ARRAY_SIZE(imx_wdt_resources),
179 static struct resource imx_usb_resources[] = {
183 .flags = IORESOURCE_MEM,
188 .flags = IORESOURCE_IRQ,
193 .flags = IORESOURCE_IRQ,
198 .flags = IORESOURCE_IRQ,
203 .flags = IORESOURCE_IRQ,
208 .flags = IORESOURCE_IRQ,
213 .flags = IORESOURCE_IRQ,
218 .flags = IORESOURCE_IRQ,
222 struct platform_device imx_usb_device = {
225 .num_resources = ARRAY_SIZE(imx_usb_resources),
226 .resource = imx_usb_resources,
229 /* GPIO port description */
230 static struct mxc_gpio_port imx_gpio_ports[] = {
232 .chip.label = "gpio-0",
233 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR),
234 .irq = GPIO_INT_PORTA,
235 .virtual_irq_start = MXC_GPIO_IRQ_START
238 .chip.label = "gpio-1",
239 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
240 .irq = GPIO_INT_PORTB,
241 .virtual_irq_start = MXC_GPIO_IRQ_START + 32
244 .chip.label = "gpio-2",
245 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
246 .irq = GPIO_INT_PORTC,
247 .virtual_irq_start = MXC_GPIO_IRQ_START + 64
250 .chip.label = "gpio-3",
251 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
252 .irq = GPIO_INT_PORTD,
253 .virtual_irq_start = MXC_GPIO_IRQ_START + 96
257 int __init mxc_register_gpios(void)
259 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));