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 #define DEFINE_IMX1_UART_DEVICE(n, baseaddr, irqrx, irqtx, irqrts) \
77 static struct resource imx1_uart_resources ## n[] = { \
80 .end = baseaddr + 0xd0, \
81 .flags = IORESOURCE_MEM, \
85 .flags = IORESOURCE_IRQ, \
89 .flags = IORESOURCE_IRQ, \
93 .flags = IORESOURCE_IRQ, \
97 struct platform_device imx1_uart_device ## n = { \
100 .num_resources = ARRAY_SIZE(imx1_uart_resources ## n), \
101 .resource = imx1_uart_resources ## n, \
104 DEFINE_IMX1_UART_DEVICE(0, MX1_UART1_BASE_ADDR, MX1_UART1_MINT_RX, MX1_UART1_MINT_TX, MX1_UART1_MINT_RTS);
105 DEFINE_IMX1_UART_DEVICE(1, MX1_UART2_BASE_ADDR, MX1_UART2_MINT_RX, MX1_UART2_MINT_TX, MX1_UART2_MINT_RTS);
107 static struct resource imx_rtc_resources[] = {
111 .flags = IORESOURCE_MEM,
113 .start = MX1_RTC_INT,
115 .flags = IORESOURCE_IRQ,
117 .start = MX1_RTC_SAMINT,
118 .end = MX1_RTC_SAMINT,
119 .flags = IORESOURCE_IRQ,
123 struct platform_device imx_rtc_device = {
126 .resource = imx_rtc_resources,
127 .num_resources = ARRAY_SIZE(imx_rtc_resources),
130 static struct resource imx_wdt_resources[] = {
134 .flags = IORESOURCE_MEM,
136 .start = MX1_WDT_INT,
138 .flags = IORESOURCE_IRQ,
142 struct platform_device imx_wdt_device = {
145 .resource = imx_wdt_resources,
146 .num_resources = ARRAY_SIZE(imx_wdt_resources),
149 static struct resource imx_usb_resources[] = {
153 .flags = IORESOURCE_MEM,
155 .start = MX1_USBD_INT0,
156 .end = MX1_USBD_INT0,
157 .flags = IORESOURCE_IRQ,
159 .start = MX1_USBD_INT1,
160 .end = MX1_USBD_INT1,
161 .flags = IORESOURCE_IRQ,
163 .start = MX1_USBD_INT2,
164 .end = MX1_USBD_INT2,
165 .flags = IORESOURCE_IRQ,
167 .start = MX1_USBD_INT3,
168 .end = MX1_USBD_INT3,
169 .flags = IORESOURCE_IRQ,
171 .start = MX1_USBD_INT4,
172 .end = MX1_USBD_INT4,
173 .flags = IORESOURCE_IRQ,
175 .start = MX1_USBD_INT5,
176 .end = MX1_USBD_INT5,
177 .flags = IORESOURCE_IRQ,
179 .start = MX1_USBD_INT6,
180 .end = MX1_USBD_INT6,
181 .flags = IORESOURCE_IRQ,
185 struct platform_device imx_usb_device = {
188 .num_resources = ARRAY_SIZE(imx_usb_resources),
189 .resource = imx_usb_resources,
192 /* GPIO port description */
193 static struct mxc_gpio_port imx_gpio_ports[] = {
195 .chip.label = "gpio-0",
196 .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
197 .irq = MX1_GPIO_INT_PORTA,
198 .virtual_irq_start = MXC_GPIO_IRQ_START,
200 .chip.label = "gpio-1",
201 .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
202 .irq = MX1_GPIO_INT_PORTB,
203 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
205 .chip.label = "gpio-2",
206 .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
207 .irq = MX1_GPIO_INT_PORTC,
208 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
210 .chip.label = "gpio-3",
211 .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
212 .irq = MX1_GPIO_INT_PORTD,
213 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
217 int __init imx1_register_gpios(void)
219 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));