patch-mxc-add-ARCH_MX1
[linux-block.git] / arch / arm / mach-mx1 / devices.c
1 /*
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  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA  02110-1301, USA.
19  */
20
21 #include <linux/kernel.h>
22 #include <linux/init.h>
23 #include <linux/platform_device.h>
24 #include <linux/gpio.h>
25 #include <mach/hardware.h>
26
27 static struct resource imx_uart1_resources[] = {
28         [0] = {
29                 .start  = UART1_BASE_ADDR,
30                 .end    = UART1_BASE_ADDR + 0xD0,
31                 .flags  = IORESOURCE_MEM,
32         },
33         [1] = {
34                 .start  = UART1_MINT_RX,
35                 .end    = UART1_MINT_RX,
36                 .flags  = IORESOURCE_IRQ,
37         },
38         [2] = {
39                 .start  = UART1_MINT_TX,
40                 .end    = UART1_MINT_TX,
41                 .flags  = IORESOURCE_IRQ,
42         },
43         [3] = {
44                 .start  = UART1_MINT_RTS,
45                 .end    = UART1_MINT_RTS,
46                 .flags  = IORESOURCE_IRQ,
47         },
48 };
49
50 struct platform_device imx_uart1_device = {
51         .name           = "imx-uart",
52         .id             = 0,
53         .num_resources  = ARRAY_SIZE(imx_uart1_resources),
54         .resource       = imx_uart1_resources,
55 };
56
57 static struct resource imx_uart2_resources[] = {
58         [0] = {
59                 .start  = UART2_BASE_ADDR,
60                 .end    = UART2_BASE_ADDR + 0xD0,
61                 .flags  = IORESOURCE_MEM,
62         },
63         [1] = {
64                 .start  = UART2_MINT_RX,
65                 .end    = UART2_MINT_RX,
66                 .flags  = IORESOURCE_IRQ,
67         },
68         [2] = {
69                 .start  = UART2_MINT_TX,
70                 .end    = UART2_MINT_TX,
71                 .flags  = IORESOURCE_IRQ,
72         },
73         [3] = {
74                 .start  = UART2_MINT_RTS,
75                 .end    = UART2_MINT_RTS,
76                 .flags  = IORESOURCE_IRQ,
77         },
78 };
79
80 struct platform_device imx_uart2_device = {
81         .name           = "imx-uart",
82         .id             = 1,
83         .num_resources  = ARRAY_SIZE(imx_uart2_resources),
84         .resource       = imx_uart2_resources,
85 };
86
87 /* GPIO port description */
88 static struct mxc_gpio_port imx_gpio_ports[] = {
89         [0] = {
90                 .chip.label = "gpio-0",
91                 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR),
92                 .irq = GPIO_INT_PORTA,
93                 .virtual_irq_start = MXC_MAX_INT_LINES
94         },
95         [1] = {
96                 .chip.label = "gpio-1",
97                 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
98                 .irq = GPIO_INT_PORTB,
99                 .virtual_irq_start = MXC_MAX_INT_LINES + 32
100         },
101         [2] = {
102                 .chip.label = "gpio-2",
103                 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
104                 .irq = GPIO_INT_PORTC,
105                 .virtual_irq_start = MXC_MAX_INT_LINES + 64
106         },
107         [3] = {
108                 .chip.label = "gpio-3",
109                 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
110                 .irq = GPIO_INT_PORTD,
111                 .virtual_irq_start = MXC_MAX_INT_LINES + 96
112         }
113 };
114
115 int __init mxc_register_gpios(void)
116 {
117         return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
118 }