aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDinh Nguyen <Dinh.Nguyen@freescale.com>2010-04-22 09:28:42 -0400
committerSascha Hauer <s.hauer@pengutronix.de>2010-04-22 10:53:23 -0400
commite24798e637f5d5222f9fd767aefbea15de456e4a (patch)
tree5a5463389abeae884bf0fb7157cddffb4aae2916 /arch
parent38a66f51e71c8d3e24c221614c57b9e8b37a46b3 (diff)
mx5: Add registration of GPIOs for MX5 devices
Register the gpio irqs on Freescale's MX51 Babbage HW. Signed-off-by: Dinh Nguyen <Dinh.Nguyen@freescale.com> Signed-off-by: Amit Kucheria <amit.kucheria@canonical.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx5/devices.c33
-rw-r--r--arch/arm/plat-mxc/gpio.c5
-rw-r--r--arch/arm/plat-mxc/tzic.c4
3 files changed, 36 insertions, 6 deletions
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index d6fd3961ade9..5070ae1f94c6 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright 2009 Amit Kucheria <amit.kucheria@canonical.com> 2 * Copyright 2009 Amit Kucheria <amit.kucheria@canonical.com>
3 * Copyright (C) 2010 Freescale Semiconductor, Inc.
3 * 4 *
4 * The code contained herein is licensed under the GNU General Public 5 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License 6 * License. You may obtain a copy of the GNU General Public License
@@ -10,8 +11,10 @@
10 */ 11 */
11 12
12#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/gpio.h>
13#include <mach/hardware.h> 15#include <mach/hardware.h>
14#include <mach/imx-uart.h> 16#include <mach/imx-uart.h>
17#include <mach/irqs.h>
15 18
16static struct resource uart0[] = { 19static struct resource uart0[] = {
17 { 20 {
@@ -89,8 +92,34 @@ struct platform_device mxc_fec_device = {
89 .resource = mxc_fec_resources, 92 .resource = mxc_fec_resources,
90}; 93};
91 94
92/* Dummy definition to allow compiling in AVIC and TZIC simultaneously */ 95static struct mxc_gpio_port mxc_gpio_ports[] = {
96 {
97 .chip.label = "gpio-0",
98 .base = MX51_IO_ADDRESS(MX51_GPIO1_BASE_ADDR),
99 .irq = MX51_MXC_INT_GPIO1_LOW,
100 .virtual_irq_start = MXC_GPIO_IRQ_START
101 },
102 {
103 .chip.label = "gpio-1",
104 .base = MX51_IO_ADDRESS(MX51_GPIO2_BASE_ADDR),
105 .irq = MX51_MXC_INT_GPIO2_LOW,
106 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 1
107 },
108 {
109 .chip.label = "gpio-2",
110 .base = MX51_IO_ADDRESS(MX51_GPIO3_BASE_ADDR),
111 .irq = MX51_MXC_INT_GPIO3_LOW,
112 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2
113 },
114 {
115 .chip.label = "gpio-3",
116 .base = MX51_IO_ADDRESS(MX51_GPIO4_BASE_ADDR),
117 .irq = MX51_MXC_INT_GPIO4_LOW,
118 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 3
119 },
120};
121
93int __init mxc_register_gpios(void) 122int __init mxc_register_gpios(void)
94{ 123{
95 return 0; 124 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
96} 125}
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 70b23893f094..71437c61cfd7 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -3,7 +3,7 @@
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de 3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 * 4 *
5 * Based on code from Freescale, 5 * Based on code from Freescale,
6 * Copyright 2004-2006 Freescale Semiconductor, Inc. All Rights Reserved. 6 * Copyright (C) 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
7 * 7 *
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 9 * modify it under the terms of the GNU General Public License
@@ -38,7 +38,6 @@ static int gpio_table_size;
38#define GPIO_ICR2 (cpu_is_mx1_mx2() ? 0x2C : 0x10) 38#define GPIO_ICR2 (cpu_is_mx1_mx2() ? 0x2C : 0x10)
39#define GPIO_IMR (cpu_is_mx1_mx2() ? 0x30 : 0x14) 39#define GPIO_IMR (cpu_is_mx1_mx2() ? 0x30 : 0x14)
40#define GPIO_ISR (cpu_is_mx1_mx2() ? 0x34 : 0x18) 40#define GPIO_ISR (cpu_is_mx1_mx2() ? 0x34 : 0x18)
41#define GPIO_ISR (cpu_is_mx1_mx2() ? 0x34 : 0x18)
42 41
43#define GPIO_INT_LOW_LEV (cpu_is_mx1_mx2() ? 0x3 : 0x0) 42#define GPIO_INT_LOW_LEV (cpu_is_mx1_mx2() ? 0x3 : 0x0)
44#define GPIO_INT_HIGH_LEV (cpu_is_mx1_mx2() ? 0x2 : 0x1) 43#define GPIO_INT_HIGH_LEV (cpu_is_mx1_mx2() ? 0x2 : 0x1)
@@ -289,7 +288,7 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
289 /* its a serious configuration bug when it fails */ 288 /* its a serious configuration bug when it fails */
290 BUG_ON( gpiochip_add(&port[i].chip) < 0 ); 289 BUG_ON( gpiochip_add(&port[i].chip) < 0 );
291 290
292 if (cpu_is_mx1() || cpu_is_mx3() || cpu_is_mx25()) { 291 if (cpu_is_mx1() || cpu_is_mx3() || cpu_is_mx25() || cpu_is_mx51()) {
293 /* setup one handler for each entry */ 292 /* setup one handler for each entry */
294 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler); 293 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler);
295 set_irq_data(port[i].irq, &port[i]); 294 set_irq_data(port[i].irq, &port[i]);
diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c
index afa6709db0b3..9b86d2a60d43 100644
--- a/arch/arm/plat-mxc/tzic.c
+++ b/arch/arm/plat-mxc/tzic.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2004-2009 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright (C)2004-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 * 3 *
4 * The code contained herein is licensed under the GNU General Public 4 * The code contained herein is licensed under the GNU General Public
5 * License. You may obtain a copy of the GNU General Public License 5 * License. You may obtain a copy of the GNU General Public License
@@ -19,6 +19,7 @@
19#include <asm/mach/irq.h> 19#include <asm/mach/irq.h>
20 20
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <mach/common.h>
22 23
23/* 24/*
24 ***************************************** 25 *****************************************
@@ -144,6 +145,7 @@ void __init tzic_init_irq(void __iomem *irqbase)
144 set_irq_handler(i, handle_level_irq); 145 set_irq_handler(i, handle_level_irq);
145 set_irq_flags(i, IRQF_VALID); 146 set_irq_flags(i, IRQF_VALID);
146 } 147 }
148 mxc_register_gpios();
147 149
148 pr_info("TrustZone Interrupt Controller (TZIC) initialized\n"); 150 pr_info("TrustZone Interrupt Controller (TZIC) initialized\n");
149} 151}