aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/Makefile2
-rw-r--r--arch/arm/mach-imx/devices.c124
-rw-r--r--arch/arm/plat-mxc/gpio.c59
3 files changed, 59 insertions, 126 deletions
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
index 5582692bb176..d099c4af0aec 100644
--- a/arch/arm/mach-imx/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -4,8 +4,6 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := devices.o
8
9obj-$(CONFIG_IMX_HAVE_DMA_V1) += dma-v1.o 7obj-$(CONFIG_IMX_HAVE_DMA_V1) += dma-v1.o
10 8
11obj-$(CONFIG_ARCH_MX1) += clock-imx1.o mm-imx1.o 9obj-$(CONFIG_ARCH_MX1) += clock-imx1.o mm-imx1.o
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c
deleted file mode 100644
index cfc68916d4ca..000000000000
--- a/arch/arm/mach-imx/devices.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/*
2 * Author: MontaVista Software, Inc.
3 * <source@mvista.com>
4 *
5 * Based on the OMAP devices.c
6 *
7 * 2005 (c) MontaVista Software, Inc. This file is licensed under the
8 * terms of the GNU General Public License version 2. This program is
9 * licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 *
12 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
13 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
14 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
15 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
16 * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
17 *
18 * This program is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU General Public License
20 * as published by the Free Software Foundation; either version 2
21 * of the License, or (at your option) any later version.
22 * This program is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
30 * MA 02110-1301, USA.
31 */
32#include <linux/module.h>
33#include <linux/kernel.h>
34#include <linux/init.h>
35#include <linux/platform_device.h>
36#include <linux/gpio.h>
37#include <linux/dma-mapping.h>
38#include <linux/serial.h>
39
40#include <mach/irqs.h>
41#include <mach/hardware.h>
42#include <mach/common.h>
43#include <mach/mmc.h>
44
45#if defined(CONFIG_ARCH_MX1)
46/* GPIO port description */
47static struct mxc_gpio_port imx_gpio_ports[] = {
48 {
49 .chip.label = "gpio-0",
50 .base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
51 .irq = MX1_GPIO_INT_PORTA,
52 .virtual_irq_start = MXC_GPIO_IRQ_START,
53 }, {
54 .chip.label = "gpio-1",
55 .base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
56 .irq = MX1_GPIO_INT_PORTB,
57 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
58 }, {
59 .chip.label = "gpio-2",
60 .base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
61 .irq = MX1_GPIO_INT_PORTC,
62 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
63 }, {
64 .chip.label = "gpio-3",
65 .base = MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
66 .irq = MX1_GPIO_INT_PORTD,
67 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
68 }
69};
70
71int __init imx1_register_gpios(void)
72{
73 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
74}
75#endif
76
77#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
78/* GPIO port description */
79#define DEFINE_MXC_GPIO_PORT_IRQ(SOC, n, _irq) \
80 { \
81 .chip.label = "gpio-" #n, \
82 .irq = _irq, \
83 .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \
84 n * 0x100), \
85 .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \
86 }
87
88#define DEFINE_MXC_GPIO_PORT(SOC, n) \
89 { \
90 .chip.label = "gpio-" #n, \
91 .base = SOC ## _IO_ADDRESS(MX2x_GPIO_BASE_ADDR + \
92 n * 0x100), \
93 .virtual_irq_start = MXC_GPIO_IRQ_START + n * 32, \
94 }
95
96#define DEFINE_MXC_GPIO_PORTS(SOC, pfx) \
97 static struct mxc_gpio_port pfx ## _gpio_ports[] = { \
98 DEFINE_MXC_GPIO_PORT_IRQ(SOC, 0, SOC ## _INT_GPIO), \
99 DEFINE_MXC_GPIO_PORT(SOC, 1), \
100 DEFINE_MXC_GPIO_PORT(SOC, 2), \
101 DEFINE_MXC_GPIO_PORT(SOC, 3), \
102 DEFINE_MXC_GPIO_PORT(SOC, 4), \
103 DEFINE_MXC_GPIO_PORT(SOC, 5), \
104 }
105
106#ifdef CONFIG_MACH_MX21
107DEFINE_MXC_GPIO_PORTS(MX21, imx21);
108
109int __init imx21_register_gpios(void)
110{
111 return mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports));
112}
113#endif
114
115#ifdef CONFIG_MACH_MX27
116DEFINE_MXC_GPIO_PORTS(MX27, imx27);
117
118int __init imx27_register_gpios(void)
119{
120 return mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports));
121}
122#endif
123
124#endif
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index a43d9ccb1962..2c00d9bf0a66 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -349,3 +349,62 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
349 349
350 return 0; 350 return 0;
351} 351}
352
353#define DEFINE_IMX_GPIO_PORT_IRQ(soc, n, _irq) \
354 { \
355 .chip.label = "gpio-" #n, \
356 .irq = _irq, \
357 .base = soc ## _IO_ADDRESS(soc ## _GPIO_BASE_ADDR + \
358 (n) * SZ_256), \
359 .virtual_irq_start = MXC_GPIO_IRQ_START + (n) * 32, \
360 }
361
362#define DEFINE_IMX_GPIO_PORT(soc, n) \
363 DEFINE_IMX_GPIO_PORT_IRQ(soc, n, 0)
364
365#define DEFINE_REGISTER_FUNCTION(prefix) \
366int __init prefix ## _register_gpios(void) \
367{ \
368 return mxc_gpio_init(prefix ## _gpio_ports, \
369 ARRAY_SIZE(prefix ## _gpio_ports)); \
370}
371
372#if defined(CONFIG_SOC_IMX1)
373static struct mxc_gpio_port imx1_gpio_ports[] = {
374 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 0, MX1_GPIO_INT_PORTA),
375 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 1, MX1_GPIO_INT_PORTB),
376 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 2, MX1_GPIO_INT_PORTC),
377 DEFINE_IMX_GPIO_PORT_IRQ(MX1, 3, MX1_GPIO_INT_PORTD),
378};
379
380DEFINE_REGISTER_FUNCTION(imx1)
381
382#endif /* if defined(CONFIG_SOC_IMX1) */
383
384#if defined(CONFIG_SOC_IMX21)
385static struct mxc_gpio_port imx21_gpio_ports[] = {
386 DEFINE_IMX_GPIO_PORT_IRQ(MX21, 0, MX21_INT_GPIO),
387 DEFINE_IMX_GPIO_PORT(MX21, 1),
388 DEFINE_IMX_GPIO_PORT(MX21, 2),
389 DEFINE_IMX_GPIO_PORT(MX21, 3),
390 DEFINE_IMX_GPIO_PORT(MX21, 4),
391 DEFINE_IMX_GPIO_PORT(MX21, 5),
392};
393
394DEFINE_REGISTER_FUNCTION(imx21)
395
396#endif /* if defined(CONFIG_SOC_IMX21) */
397
398#if defined(CONFIG_SOC_IMX27)
399static struct mxc_gpio_port imx27_gpio_ports[] = {
400 DEFINE_IMX_GPIO_PORT_IRQ(MX27, 0, MX27_INT_GPIO),
401 DEFINE_IMX_GPIO_PORT(MX27, 1),
402 DEFINE_IMX_GPIO_PORT(MX27, 2),
403 DEFINE_IMX_GPIO_PORT(MX27, 3),
404 DEFINE_IMX_GPIO_PORT(MX27, 4),
405 DEFINE_IMX_GPIO_PORT(MX27, 5),
406};
407
408DEFINE_REGISTER_FUNCTION(imx27)
409
410#endif /* if defined(CONFIG_SOC_IMX27) */