aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-mxc')
-rw-r--r--arch/arm/plat-mxc/Kconfig9
-rw-r--r--arch/arm/plat-mxc/Makefile1
-rw-r--r--arch/arm/plat-mxc/dma-mx1-mx2.c14
-rw-r--r--arch/arm/plat-mxc/gpio.c6
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27ads.h7
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31ads.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31pdk.h19
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S3
-rw-r--r--arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h10
-rw-r--r--arch/arm/plat-mxc/include/mach/dma.h14
-rw-r--r--arch/arm/plat-mxc/include/mach/entry-macro.S2
-rw-r--r--arch/arm/plat-mxc/include/mach/gpio.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/hardware.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/io.h8
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h72
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx3.h19
-rw-r--r--arch/arm/plat-mxc/include/mach/irqs.h32
-rw-r--r--arch/arm/plat-mxc/include/mach/memory.h21
-rw-r--r--arch/arm/plat-mxc/include/mach/mtd-xip.h34
-rw-r--r--arch/arm/plat-mxc/include/mach/mx1.h186
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h15
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h25
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc_timer.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/timex.h8
-rw-r--r--arch/arm/plat-mxc/iomux-mx1-mx2.c37
-rw-r--r--arch/arm/plat-mxc/irq.c33
26 files changed, 446 insertions, 143 deletions
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index b2a7e3fad117..9cc2b16fdf79 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -6,18 +6,27 @@ choice
6 prompt "MXC/iMX Base Type" 6 prompt "MXC/iMX Base Type"
7 default ARCH_MX3 7 default ARCH_MX3
8 8
9config ARCH_MX1
10 bool "MX1-based"
11 select CPU_ARM920T
12 help
13 This enables support for systems based on the Freescale i.MX1 family
14
9config ARCH_MX2 15config ARCH_MX2
10 bool "MX2-based" 16 bool "MX2-based"
17 select CPU_ARM926T
11 help 18 help
12 This enables support for systems based on the Freescale i.MX2 family 19 This enables support for systems based on the Freescale i.MX2 family
13 20
14config ARCH_MX3 21config ARCH_MX3
15 bool "MX3-based" 22 bool "MX3-based"
23 select CPU_V6
16 help 24 help
17 This enables support for systems based on the Freescale i.MX3 family 25 This enables support for systems based on the Freescale i.MX3 family
18 26
19endchoice 27endchoice
20 28
29source "arch/arm/mach-mx1/Kconfig"
21source "arch/arm/mach-mx2/Kconfig" 30source "arch/arm/mach-mx2/Kconfig"
22source "arch/arm/mach-mx3/Kconfig" 31source "arch/arm/mach-mx3/Kconfig"
23 32
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 067556f7c91f..db74a929179d 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -5,4 +5,5 @@
5# Common support 5# Common support
6obj-y := irq.o clock.o gpio.o time.o devices.o 6obj-y := irq.o clock.o gpio.o time.o devices.o
7 7
8obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o
8obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o 9obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o
diff --git a/arch/arm/plat-mxc/dma-mx1-mx2.c b/arch/arm/plat-mxc/dma-mx1-mx2.c
index b296f19fd89a..2905ec758758 100644
--- a/arch/arm/plat-mxc/dma-mx1-mx2.c
+++ b/arch/arm/plat-mxc/dma-mx1-mx2.c
@@ -34,7 +34,6 @@
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <asm/dma.h>
38#include <mach/dma-mx1-mx2.h> 37#include <mach/dma-mx1-mx2.h>
39 38
40#define DMA_DCR 0x00 /* Control Register */ 39#define DMA_DCR 0x00 /* Control Register */
@@ -114,7 +113,7 @@ struct imx_dma_channel {
114 void (*err_handler) (int, void *, int errcode); 113 void (*err_handler) (int, void *, int errcode);
115 void (*prog_handler) (int, void *, struct scatterlist *); 114 void (*prog_handler) (int, void *, struct scatterlist *);
116 void *data; 115 void *data;
117 dmamode_t dma_mode; 116 unsigned int dma_mode;
118 struct scatterlist *sg; 117 struct scatterlist *sg;
119 unsigned int resbytes; 118 unsigned int resbytes;
120 int dma_num; 119 int dma_num;
@@ -193,7 +192,7 @@ static inline int imx_dma_sg_next(int channel, struct scatterlist *sg)
193int 192int
194imx_dma_setup_single(int channel, dma_addr_t dma_address, 193imx_dma_setup_single(int channel, dma_addr_t dma_address,
195 unsigned int dma_length, unsigned int dev_addr, 194 unsigned int dma_length, unsigned int dev_addr,
196 dmamode_t dmamode) 195 unsigned int dmamode)
197{ 196{
198 struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; 197 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
199 198
@@ -288,7 +287,7 @@ int
288imx_dma_setup_sg(int channel, 287imx_dma_setup_sg(int channel,
289 struct scatterlist *sg, unsigned int sgcount, 288 struct scatterlist *sg, unsigned int sgcount,
290 unsigned int dma_length, unsigned int dev_addr, 289 unsigned int dma_length, unsigned int dev_addr,
291 dmamode_t dmamode) 290 unsigned int dmamode)
292{ 291{
293 struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; 292 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
294 293
@@ -512,6 +511,7 @@ void imx_dma_disable(int channel)
512} 511}
513EXPORT_SYMBOL(imx_dma_disable); 512EXPORT_SYMBOL(imx_dma_disable);
514 513
514#ifdef CONFIG_ARCH_MX2
515static void imx_dma_watchdog(unsigned long chno) 515static void imx_dma_watchdog(unsigned long chno)
516{ 516{
517 struct imx_dma_channel *imxdma = &imx_dma_channels[chno]; 517 struct imx_dma_channel *imxdma = &imx_dma_channels[chno];
@@ -523,6 +523,7 @@ static void imx_dma_watchdog(unsigned long chno)
523 if (imxdma->err_handler) 523 if (imxdma->err_handler)
524 imxdma->err_handler(chno, imxdma->data, IMX_DMA_ERR_TIMEOUT); 524 imxdma->err_handler(chno, imxdma->data, IMX_DMA_ERR_TIMEOUT);
525} 525}
526#endif
526 527
527static irqreturn_t dma_err_handler(int irq, void *dev_id) 528static irqreturn_t dma_err_handler(int irq, void *dev_id)
528{ 529{
@@ -675,7 +676,7 @@ int imx_dma_request(int channel, const char *name)
675{ 676{
676 struct imx_dma_channel *imxdma = &imx_dma_channels[channel]; 677 struct imx_dma_channel *imxdma = &imx_dma_channels[channel];
677 unsigned long flags; 678 unsigned long flags;
678 int ret; 679 int ret = 0;
679 680
680 /* basic sanity checks */ 681 /* basic sanity checks */
681 if (!name) 682 if (!name)
@@ -697,6 +698,7 @@ int imx_dma_request(int channel, const char *name)
697 ret = request_irq(MXC_INT_DMACH0 + channel, dma_irq_handler, 0, "DMA", 698 ret = request_irq(MXC_INT_DMACH0 + channel, dma_irq_handler, 0, "DMA",
698 NULL); 699 NULL);
699 if (ret) { 700 if (ret) {
701 local_irq_restore(flags);
700 printk(KERN_CRIT "Can't register IRQ %d for DMA channel %d\n", 702 printk(KERN_CRIT "Can't register IRQ %d for DMA channel %d\n",
701 MXC_INT_DMACH0 + channel, channel); 703 MXC_INT_DMACH0 + channel, channel);
702 return ret; 704 return ret;
@@ -713,7 +715,7 @@ int imx_dma_request(int channel, const char *name)
713 imxdma->sg = NULL; 715 imxdma->sg = NULL;
714 716
715 local_irq_restore(flags); 717 local_irq_restore(flags);
716 return 0; 718 return ret;
717} 719}
718EXPORT_SYMBOL(imx_dma_request); 720EXPORT_SYMBOL(imx_dma_request);
719 721
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index de5c4747453f..ccbd94adc668 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -115,8 +115,8 @@ static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat)
115 } 115 }
116} 116}
117 117
118#ifdef CONFIG_ARCH_MX3 118#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX1)
119/* MX3 has one interrupt *per* gpio port */ 119/* MX1 and MX3 has one interrupt *per* gpio port */
120static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc) 120static void mx3_gpio_irq_handler(u32 irq, struct irq_desc *desc)
121{ 121{
122 u32 irq_stat; 122 u32 irq_stat;
@@ -237,7 +237,7 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
237 /* its a serious configuration bug when it fails */ 237 /* its a serious configuration bug when it fails */
238 BUG_ON( gpiochip_add(&port[i].chip) < 0 ); 238 BUG_ON( gpiochip_add(&port[i].chip) < 0 );
239 239
240#ifdef CONFIG_ARCH_MX3 240#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX1)
241 /* setup one handler for each entry */ 241 /* setup one handler for each entry */
242 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler); 242 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler);
243 set_irq_data(port[i].irq, &port[i]); 243 set_irq_data(port[i].irq, &port[i]);
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27ads.h b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
index 61e66dac90ef..8f34a05afc87 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx27ads.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
@@ -15,7 +15,7 @@
15#define __ASM_ARCH_MXC_BOARD_MX27ADS_H__ 15#define __ASM_ARCH_MXC_BOARD_MX27ADS_H__
16 16
17/* external interrupt multiplexer */ 17/* external interrupt multiplexer */
18#define MXC_EXP_IO_BASE (MXC_GPIO_BASE + MXC_MAX_GPIO_LINES) 18#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
19 19
20#define MXC_VIRTUAL_INTS_BASE (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES) 20#define MXC_VIRTUAL_INTS_BASE (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES)
21#define MXC_SDIO1_CARD_IRQ MXC_VIRTUAL_INTS_BASE 21#define MXC_SDIO1_CARD_IRQ MXC_VIRTUAL_INTS_BASE
@@ -28,11 +28,6 @@
28/* 28/*
29 * MXC UART EVB board level configurations 29 * MXC UART EVB board level configurations
30 */ 30 */
31
32#define MXC_LL_EXTUART_PADDR (CS4_BASE_ADDR + 0x20000)
33#define MXC_LL_EXTUART_VADDR (CS4_BASE_ADDR_VIRT + 0x20000)
34#define MXC_LL_EXTUART_16BIT_BUS
35
36#define MXC_LL_UART_PADDR UART1_BASE_ADDR 31#define MXC_LL_UART_PADDR UART1_BASE_ADDR
37#define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR) 32#define MXC_LL_UART_VADDR AIPI_IO_ADDRESS(UART1_BASE_ADDR)
38 33
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
index 745b48864f93..451d510d08c3 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31ads.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
@@ -90,7 +90,7 @@
90#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS) 90#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
91#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4) 91#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)
92 92
93#define MXC_EXP_IO_BASE (MXC_MAX_INT_LINES + MXC_MAX_GPIO_LINES) 93#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
94#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE) 94#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
95 95
96#define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 0) 96#define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 0)
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31pdk.h b/arch/arm/plat-mxc/include/mach/board-mx31pdk.h
new file mode 100644
index 000000000000..2b6b316d0f51
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/board-mx31pdk.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_BOARD_MX31PDK_H__
12#define __ASM_ARCH_MXC_BOARD_MX31PDK_H__
13
14/* mandatory for CONFIG_LL_DEBUG */
15
16#define MXC_LL_UART_PADDR UART1_BASE_ADDR
17#define MXC_LL_UART_VADDR AIPS1_IO_ADDRESS(UART1_BASE_ADDR)
18
19#endif /* __ASM_ARCH_MXC_BOARD_MX31PDK_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index b9907bebba3b..602768b427e2 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -28,6 +28,9 @@
28#ifdef CONFIG_MACH_PCM038 28#ifdef CONFIG_MACH_PCM038
29#include <mach/board-pcm038.h> 29#include <mach/board-pcm038.h>
30#endif 30#endif
31#ifdef CONFIG_MACH_MX31_3DS
32#include <mach/board-mx31pdk.h>
33#endif
31 .macro addruart,rx 34 .macro addruart,rx
32 mrc p15, 0, \rx, c1, c0 35 mrc p15, 0, \rx, c1, c0
33 tst \rx, #1 @ MMU enabled? 36 tst \rx, #1 @ MMU enabled?
diff --git a/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h b/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h
index e85fd946116c..b3876cc238ca 100644
--- a/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h
+++ b/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h
@@ -22,13 +22,15 @@
22 * MA 02110-1301, USA. 22 * MA 02110-1301, USA.
23 */ 23 */
24 24
25#include <asm/dma.h>
26
27#ifndef __ASM_ARCH_MXC_DMA_H 25#ifndef __ASM_ARCH_MXC_DMA_H
28#define __ASM_ARCH_MXC_DMA_H 26#define __ASM_ARCH_MXC_DMA_H
29 27
30#define IMX_DMA_CHANNELS 16 28#define IMX_DMA_CHANNELS 16
31 29
30#define DMA_MODE_READ 0
31#define DMA_MODE_WRITE 1
32#define DMA_MODE_MASK 1
33
32#define DMA_BASE IO_ADDRESS(DMA_BASE_ADDR) 34#define DMA_BASE IO_ADDRESS(DMA_BASE_ADDR)
33 35
34#define IMX_DMA_MEMSIZE_32 (0 << 4) 36#define IMX_DMA_MEMSIZE_32 (0 << 4)
@@ -54,12 +56,12 @@ imx_dma_config_burstlen(int channel, unsigned int burstlen);
54int 56int
55imx_dma_setup_single(int channel, dma_addr_t dma_address, 57imx_dma_setup_single(int channel, dma_addr_t dma_address,
56 unsigned int dma_length, unsigned int dev_addr, 58 unsigned int dma_length, unsigned int dev_addr,
57 dmamode_t dmamode); 59 unsigned int dmamode);
58 60
59int 61int
60imx_dma_setup_sg(int channel, struct scatterlist *sg, 62imx_dma_setup_sg(int channel, struct scatterlist *sg,
61 unsigned int sgcount, unsigned int dma_length, 63 unsigned int sgcount, unsigned int dma_length,
62 unsigned int dev_addr, dmamode_t dmamode); 64 unsigned int dev_addr, unsigned int dmamode);
63 65
64int 66int
65imx_dma_setup_handlers(int channel, 67imx_dma_setup_handlers(int channel,
diff --git a/arch/arm/plat-mxc/include/mach/dma.h b/arch/arm/plat-mxc/include/mach/dma.h
deleted file mode 100644
index c822d569a05e..000000000000
--- a/arch/arm/plat-mxc/include/mach/dma.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_DMA_H__
12#define __ASM_ARCH_MXC_DMA_H__
13
14#endif
diff --git a/arch/arm/plat-mxc/include/mach/entry-macro.S b/arch/arm/plat-mxc/include/mach/entry-macro.S
index 11632028f7d1..5f01d60da845 100644
--- a/arch/arm/plat-mxc/include/mach/entry-macro.S
+++ b/arch/arm/plat-mxc/include/mach/entry-macro.S
@@ -9,6 +9,8 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <mach/hardware.h>
13
12#define AVIC_NIMASK 0x04 14#define AVIC_NIMASK 0x04
13 15
14 @ this macro disables fast irq (not implemented) 16 @ this macro disables fast irq (not implemented)
diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
index 65eedc0d196f..ea509f1090fb 100644
--- a/arch/arm/plat-mxc/include/mach/gpio.h
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -27,8 +27,8 @@
27#define gpio_set_value __gpio_set_value 27#define gpio_set_value __gpio_set_value
28#define gpio_cansleep __gpio_cansleep 28#define gpio_cansleep __gpio_cansleep
29 29
30#define gpio_to_irq(gpio) (MXC_MAX_INT_LINES + (gpio)) 30#define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio))
31#define irq_to_gpio(irq) ((irq) - MXC_MAX_INT_LINES) 31#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START)
32 32
33struct mxc_gpio_port { 33struct mxc_gpio_port {
34 void __iomem *base; 34 void __iomem *base;
diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h
index 3caadeeda701..a612d8bb73c8 100644
--- a/arch/arm/plat-mxc/include/mach/hardware.h
+++ b/arch/arm/plat-mxc/include/mach/hardware.h
@@ -32,6 +32,10 @@
32# endif 32# endif
33#endif 33#endif
34 34
35#ifdef CONFIG_ARCH_MX1
36# include <mach/mx1.h>
37#endif
38
35#include <mach/mxc.h> 39#include <mach/mxc.h>
36 40
37#endif /* __ASM_ARCH_MXC_HARDWARE_H__ */ 41#endif /* __ASM_ARCH_MXC_HARDWARE_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/io.h b/arch/arm/plat-mxc/include/mach/io.h
index 5d4cb1196441..b4f2de769466 100644
--- a/arch/arm/plat-mxc/include/mach/io.h
+++ b/arch/arm/plat-mxc/include/mach/io.h
@@ -25,8 +25,8 @@ __mx3_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
25 /* Access all peripherals below 0x80000000 as nonshared device 25 /* Access all peripherals below 0x80000000 as nonshared device
26 * but leave l2cc alone. 26 * but leave l2cc alone.
27 */ 27 */
28 if ((phys_addr < 0x80000000) && ((phys_addr < L2CC_BASE_ADDR) || 28 if ((phys_addr < 0x80000000) && ((phys_addr < 0x30000000) ||
29 (phys_addr >= L2CC_BASE_ADDR + L2CC_SIZE))) 29 (phys_addr >= 0x30000000 + SZ_1M)))
30 mtype = MT_DEVICE_NONSHARED; 30 mtype = MT_DEVICE_NONSHARED;
31 } 31 }
32 32
@@ -35,8 +35,8 @@ __mx3_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
35#endif 35#endif
36 36
37/* io address mapping macro */ 37/* io address mapping macro */
38#define __io(a) ((void __iomem *)(a)) 38#define __io(a) __typesafe_io(a)
39 39
40#define __mem_pci(a) (a) 40#define __mem_pci(a) (a)
41 41
42#endif 42#endif
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h b/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h
index 3d09bfd6c53d..95a383be628e 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx1-mx2.h
@@ -21,12 +21,6 @@
21 21
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#define MXC_GPIO_ALLOC_MODE_NORMAL 0
25#define MXC_GPIO_ALLOC_MODE_NO_ALLOC 1
26#define MXC_GPIO_ALLOC_MODE_TRY_ALLOC 2
27#define MXC_GPIO_ALLOC_MODE_ALLOC_ONLY 4
28#define MXC_GPIO_ALLOC_MODE_RELEASE 8
29
30/* 24/*
31 * GPIO Module and I/O Multiplexer 25 * GPIO Module and I/O Multiplexer
32 * x = 0..3 for reg_A, reg_B, reg_C, reg_D 26 * x = 0..3 for reg_A, reg_B, reg_C, reg_D
@@ -103,7 +97,8 @@
103 97
104extern void mxc_gpio_mode(int gpio_mode); 98extern void mxc_gpio_mode(int gpio_mode);
105extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count, 99extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
106 int alloc_mode, const char *label); 100 const char *label);
101extern void mxc_gpio_release_multiple_pins(const int *pin_list, int count);
107 102
108/*-------------------------------------------------------------------------*/ 103/*-------------------------------------------------------------------------*/
109 104
@@ -113,9 +108,9 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
113 * missing on some (many) pins 108 * missing on some (many) pins
114 */ 109 */
115#ifdef CONFIG_ARCH_MX1 110#ifdef CONFIG_ARCH_MX1
116#define PA0_AIN_SPI2_CLK (GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 0) 111#define PA0_AIN_SPI2_CLK (GPIO_PORTA | GPIO_OUT | 0)
117#define PA0_AF_ETMTRACESYNC (GPIO_PORTA | GPIO_AF | 0) 112#define PA0_AF_ETMTRACESYNC (GPIO_PORTA | GPIO_AF | 0)
118#define PA1_AOUT_SPI2_RXD (GPIO_GIUS | GPIO_PORTA | GPIO_IN | 1) 113#define PA1_AOUT_SPI2_RXD (GPIO_PORTA | GPIO_IN | 1)
119#define PA1_PF_TIN (GPIO_PORTA | GPIO_PF | 1) 114#define PA1_PF_TIN (GPIO_PORTA | GPIO_PF | 1)
120#define PA2_PF_PWM0 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 2) 115#define PA2_PF_PWM0 (GPIO_PORTA | GPIO_OUT | GPIO_PF | 2)
121#define PA3_PF_CSI_MCLK (GPIO_PORTA | GPIO_PF | 3) 116#define PA3_PF_CSI_MCLK (GPIO_PORTA | GPIO_PF | 3)
@@ -133,7 +128,7 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
133#define PA15_PF_I2C_SDA (GPIO_PORTA | GPIO_OUT | GPIO_PF | 15) 128#define PA15_PF_I2C_SDA (GPIO_PORTA | GPIO_OUT | GPIO_PF | 15)
134#define PA16_PF_I2C_SCL (GPIO_PORTA | GPIO_OUT | GPIO_PF | 16) 129#define PA16_PF_I2C_SCL (GPIO_PORTA | GPIO_OUT | GPIO_PF | 16)
135#define PA17_AF_ETMTRACEPKT4 (GPIO_PORTA | GPIO_AF | 17) 130#define PA17_AF_ETMTRACEPKT4 (GPIO_PORTA | GPIO_AF | 17)
136#define PA17_AIN_SPI2_SS (GPIO_GIUS | GPIO_PORTA | GPIO_OUT | 17) 131#define PA17_AIN_SPI2_SS (GPIO_PORTA | GPIO_OUT | 17)
137#define PA18_AF_ETMTRACEPKT5 (GPIO_PORTA | GPIO_AF | 18) 132#define PA18_AF_ETMTRACEPKT5 (GPIO_PORTA | GPIO_AF | 18)
138#define PA19_AF_ETMTRACEPKT6 (GPIO_PORTA | GPIO_AF | 19) 133#define PA19_AF_ETMTRACEPKT6 (GPIO_PORTA | GPIO_AF | 19)
139#define PA20_AF_ETMTRACEPKT7 (GPIO_PORTA | GPIO_AF | 20) 134#define PA20_AF_ETMTRACEPKT7 (GPIO_PORTA | GPIO_AF | 20)
@@ -201,27 +196,27 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
201#define PC15_PF_SPI1_SS (GPIO_PORTC | GPIO_PF | 15) 196#define PC15_PF_SPI1_SS (GPIO_PORTC | GPIO_PF | 15)
202#define PC16_PF_SPI1_MISO (GPIO_PORTC | GPIO_PF | 16) 197#define PC16_PF_SPI1_MISO (GPIO_PORTC | GPIO_PF | 16)
203#define PC17_PF_SPI1_MOSI (GPIO_PORTC | GPIO_PF | 17) 198#define PC17_PF_SPI1_MOSI (GPIO_PORTC | GPIO_PF | 17)
204#define PC24_BIN_UART3_RI (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24) 199#define PC24_BIN_UART3_RI (GPIO_PORTC | GPIO_OUT | GPIO_BIN | 24)
205#define PC25_BIN_UART3_DSR (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25) 200#define PC25_BIN_UART3_DSR (GPIO_PORTC | GPIO_OUT | GPIO_BIN | 25)
206#define PC26_AOUT_UART3_DTR (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 26) 201#define PC26_AOUT_UART3_DTR (GPIO_PORTC | GPIO_IN | 26)
207#define PC27_BIN_UART3_DCD (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27) 202#define PC27_BIN_UART3_DCD (GPIO_PORTC | GPIO_OUT | GPIO_BIN | 27)
208#define PC28_BIN_UART3_CTS (GPIO_GIUS | GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28) 203#define PC28_BIN_UART3_CTS (GPIO_PORTC | GPIO_OUT | GPIO_BIN | 28)
209#define PC29_AOUT_UART3_RTS (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 29) 204#define PC29_AOUT_UART3_RTS (GPIO_PORTC | GPIO_IN | 29)
210#define PC30_BIN_UART3_TX (GPIO_GIUS | GPIO_PORTC | GPIO_BIN | 30) 205#define PC30_BIN_UART3_TX (GPIO_PORTC | GPIO_BIN | 30)
211#define PC31_AOUT_UART3_RX (GPIO_GIUS | GPIO_PORTC | GPIO_IN | 31) 206#define PC31_AOUT_UART3_RX (GPIO_PORTC | GPIO_IN | 31)
212#define PD6_PF_LSCLK (GPIO_PORTD | GPIO_OUT | GPIO_PF | 6) 207#define PD6_PF_LSCLK (GPIO_PORTD | GPIO_OUT | GPIO_PF | 6)
213#define PD7_PF_REV (GPIO_PORTD | GPIO_PF | 7) 208#define PD7_PF_REV (GPIO_PORTD | GPIO_PF | 7)
214#define PD7_AF_UART2_DTR (GPIO_GIUS | GPIO_PORTD | GPIO_IN | GPIO_AF | 7) 209#define PD7_AF_UART2_DTR (GPIO_PORTD | GPIO_IN | GPIO_AF | 7)
215#define PD7_AIN_SPI2_SCLK (GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 7) 210#define PD7_AIN_SPI2_SCLK (GPIO_PORTD | GPIO_AIN | 7)
216#define PD8_PF_CLS (GPIO_PORTD | GPIO_PF | 8) 211#define PD8_PF_CLS (GPIO_PORTD | GPIO_PF | 8)
217#define PD8_AF_UART2_DCD (GPIO_PORTD | GPIO_OUT | GPIO_AF | 8) 212#define PD8_AF_UART2_DCD (GPIO_PORTD | GPIO_OUT | GPIO_AF | 8)
218#define PD8_AIN_SPI2_SS (GPIO_GIUS | GPIO_PORTD | GPIO_AIN | 8) 213#define PD8_AIN_SPI2_SS (GPIO_PORTD | GPIO_AIN | 8)
219#define PD9_PF_PS (GPIO_PORTD | GPIO_PF | 9) 214#define PD9_PF_PS (GPIO_PORTD | GPIO_PF | 9)
220#define PD9_AF_UART2_RI (GPIO_PORTD | GPIO_OUT | GPIO_AF | 9) 215#define PD9_AF_UART2_RI (GPIO_PORTD | GPIO_OUT | GPIO_AF | 9)
221#define PD9_AOUT_SPI2_RXD (GPIO_GIUS | GPIO_PORTD | GPIO_IN | 9) 216#define PD9_AOUT_SPI2_RXD (GPIO_PORTD | GPIO_IN | 9)
222#define PD10_PF_SPL_SPR (GPIO_PORTD | GPIO_OUT | GPIO_PF | 10) 217#define PD10_PF_SPL_SPR (GPIO_PORTD | GPIO_OUT | GPIO_PF | 10)
223#define PD10_AF_UART2_DSR (GPIO_PORTD | GPIO_OUT | GPIO_AF | 10) 218#define PD10_AF_UART2_DSR (GPIO_PORTD | GPIO_OUT | GPIO_AF | 10)
224#define PD10_AIN_SPI2_TXD (GPIO_GIUS | GPIO_PORTD | GPIO_OUT | 10) 219#define PD10_AIN_SPI2_TXD (GPIO_PORTD | GPIO_OUT | 10)
225#define PD11_PF_CONTRAST (GPIO_PORTD | GPIO_OUT | GPIO_PF | 11) 220#define PD11_PF_CONTRAST (GPIO_PORTD | GPIO_OUT | GPIO_PF | 11)
226#define PD12_PF_ACD_OE (GPIO_PORTD | GPIO_OUT | GPIO_PF | 12) 221#define PD12_PF_ACD_OE (GPIO_PORTD | GPIO_OUT | GPIO_PF | 12)
227#define PD13_PF_LP_HSYNC (GPIO_PORTD | GPIO_OUT | GPIO_PF | 13) 222#define PD13_PF_LP_HSYNC (GPIO_PORTD | GPIO_OUT | GPIO_PF | 13)
@@ -243,7 +238,7 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
243#define PD29_PF_LD14 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 29) 238#define PD29_PF_LD14 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 29)
244#define PD30_PF_LD15 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 30) 239#define PD30_PF_LD15 (GPIO_PORTD | GPIO_OUT | GPIO_PF | 30)
245#define PD31_PF_TMR2OUT (GPIO_PORTD | GPIO_PF | 31) 240#define PD31_PF_TMR2OUT (GPIO_PORTD | GPIO_PF | 31)
246#define PD31_BIN_SPI2_TXD (GPIO_GIUS | GPIO_PORTD | GPIO_BIN | 31) 241#define PD31_BIN_SPI2_TXD (GPIO_PORTD | GPIO_BIN | 31)
247#endif 242#endif
248 243
249#ifdef CONFIG_ARCH_MX2 244#ifdef CONFIG_ARCH_MX2
@@ -279,6 +274,12 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
279#define PA29_PF_VSYNC (GPIO_PORTA | GPIO_OUT | GPIO_PF | 29) 274#define PA29_PF_VSYNC (GPIO_PORTA | GPIO_OUT | GPIO_PF | 29)
280#define PA30_PF_CONTRAST (GPIO_PORTA | GPIO_OUT | GPIO_PF | 30) 275#define PA30_PF_CONTRAST (GPIO_PORTA | GPIO_OUT | GPIO_PF | 30)
281#define PA31_PF_OE_ACD (GPIO_PORTA | GPIO_OUT | GPIO_PF | 31) 276#define PA31_PF_OE_ACD (GPIO_PORTA | GPIO_OUT | GPIO_PF | 31)
277#define PB4_PF_SD2_D0 (GPIO_PORTB | GPIO_PF | 4)
278#define PB5_PF_SD2_D1 (GPIO_PORTB | GPIO_PF | 5)
279#define PB6_PF_SD2_D2 (GPIO_PORTB | GPIO_PF | 6)
280#define PB7_PF_SD2_D3 (GPIO_PORTB | GPIO_PF | 7)
281#define PB8_PF_SD2_CMD (GPIO_PORTB | GPIO_PF | 8)
282#define PB9_PF_SD2_CLK (GPIO_PORTB | GPIO_PF | 9)
282#define PB10_PF_CSI_D0 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 10) 283#define PB10_PF_CSI_D0 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 10)
283#define PB10_AF_UART6_TXD (GPIO_PORTB | GPIO_OUT | GPIO_AF | 10) 284#define PB10_AF_UART6_TXD (GPIO_PORTB | GPIO_OUT | GPIO_AF | 10)
284#define PB11_PF_CSI_D1 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 11) 285#define PB11_PF_CSI_D1 (GPIO_PORTB | GPIO_OUT | GPIO_PF | 11)
@@ -315,6 +316,13 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
315#define PB31_AF_UART4_RXD (GPIO_PORTB | GPIO_IN | GPIO_AF | 31) 316#define PB31_AF_UART4_RXD (GPIO_PORTB | GPIO_IN | GPIO_AF | 31)
316#define PC5_PF_I2C2_SDA (GPIO_PORTC | GPIO_IN | GPIO_PF | 5) 317#define PC5_PF_I2C2_SDA (GPIO_PORTC | GPIO_IN | GPIO_PF | 5)
317#define PC6_PF_I2C2_SCL (GPIO_PORTC | GPIO_IN | GPIO_PF | 6) 318#define PC6_PF_I2C2_SCL (GPIO_PORTC | GPIO_IN | GPIO_PF | 6)
319#define PC7_PF_USBOTG_DATA5 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 7)
320#define PC8_PF_USBOTG_DATA6 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 8)
321#define PC9_PF_USBOTG_DATA0 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 9)
322#define PC10_PF_USBOTG_DATA2 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 10)
323#define PC11_PF_USBOTG_DATA1 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 11)
324#define PC12_PF_USBOTG_DATA4 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 12)
325#define PC13_PF_USBOTG_DATA3 (GPIO_PORTC | GPIO_OUT | GPIO_PF | 13)
318#define PC16_PF_SSI4_FS (GPIO_PORTC | GPIO_IN | GPIO_PF | 16) 326#define PC16_PF_SSI4_FS (GPIO_PORTC | GPIO_IN | GPIO_PF | 16)
319#define PC17_PF_SSI4_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 17) 327#define PC17_PF_SSI4_RXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 17)
320#define PC18_PF_SSI4_TXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 18) 328#define PC18_PF_SSI4_TXD (GPIO_PORTC | GPIO_IN | GPIO_PF | 18)
@@ -365,6 +373,9 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
365#define PD30_PF_CSPI1_MISO (GPIO_PORTD | GPIO_IN | GPIO_PF | 30) 373#define PD30_PF_CSPI1_MISO (GPIO_PORTD | GPIO_IN | GPIO_PF | 30)
366#define PD31_PF_CSPI1_MOSI (GPIO_PORTD | GPIO_OUT | GPIO_PF | 31) 374#define PD31_PF_CSPI1_MOSI (GPIO_PORTD | GPIO_OUT | GPIO_PF | 31)
367#define PF23_AIN_FEC_TX_EN (GPIO_PORTF | GPIO_OUT | GPIO_AIN | 23) 375#define PF23_AIN_FEC_TX_EN (GPIO_PORTF | GPIO_OUT | GPIO_AIN | 23)
376#define PE0_PF_USBOTG_NXT (GPIO_PORTE | GPIO_OUT | GPIO_PF | 0)
377#define PE1_PF_USBOTG_STP (GPIO_PORTE | GPIO_OUT | GPIO_PF | 1)
378#define PE2_PF_USBOTG_DIR (GPIO_PORTE | GPIO_OUT | GPIO_PF | 2)
368#define PE3_PF_UART2_CTS (GPIO_PORTE | GPIO_OUT | GPIO_PF | 3) 379#define PE3_PF_UART2_CTS (GPIO_PORTE | GPIO_OUT | GPIO_PF | 3)
369#define PE4_PF_UART2_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 4) 380#define PE4_PF_UART2_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 4)
370#define PE6_PF_UART2_TXD (GPIO_PORTE | GPIO_OUT | GPIO_PF | 6) 381#define PE6_PF_UART2_TXD (GPIO_PORTE | GPIO_OUT | GPIO_PF | 6)
@@ -379,18 +390,27 @@ extern int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
379#define PE15_PF_UART1_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 15) 390#define PE15_PF_UART1_RTS (GPIO_PORTE | GPIO_IN | GPIO_PF | 15)
380#define PE16_AF_RTCK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 16) 391#define PE16_AF_RTCK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 16)
381#define PE16_PF_RTCK (GPIO_PORTE | GPIO_OUT | GPIO_PF | 16) 392#define PE16_PF_RTCK (GPIO_PORTE | GPIO_OUT | GPIO_PF | 16)
393#define PE18_PF_SDHC1_D0 (GPIO_PORTE | GPIO_PF | 18)
382#define PE18_AF_CSPI3_MISO (GPIO_PORTE | GPIO_IN | GPIO_AF | 18) 394#define PE18_AF_CSPI3_MISO (GPIO_PORTE | GPIO_IN | GPIO_AF | 18)
395#define PE19_PF_SDHC1_D1 (GPIO_PORTE | GPIO_PF | 19)
396#define PE20_PF_SDHC1_D2 (GPIO_PORTE | GPIO_PF | 20)
397#define PE21_PF_SDHC1_D3 (GPIO_PORTE | GPIO_PF | 21)
383#define PE21_AF_CSPI3_SS (GPIO_PORTE | GPIO_OUT | GPIO_AF | 21) 398#define PE21_AF_CSPI3_SS (GPIO_PORTE | GPIO_OUT | GPIO_AF | 21)
399#define PE22_PF_SDHC1_CMD (GPIO_PORTE | GPIO_PF | 22)
384#define PE22_AF_CSPI3_MOSI (GPIO_PORTE | GPIO_OUT | GPIO_AF | 22) 400#define PE22_AF_CSPI3_MOSI (GPIO_PORTE | GPIO_OUT | GPIO_AF | 22)
401#define PE22_PF_SDHC1_CLK (GPIO_PORTE | GPIO_PF | 23)
385#define PE23_AF_CSPI3_SCLK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 23) 402#define PE23_AF_CSPI3_SCLK (GPIO_PORTE | GPIO_OUT | GPIO_AF | 23)
403#define PE24_PF_USBOTG_CLK (GPIO_PORTE | GPIO_OUT | GPIO_PF | 24)
404#define PE25_PF_USBOTG_DATA7 (GPIO_PORTE | GPIO_OUT | GPIO_PF | 25)
386#endif 405#endif
387 406
388/* decode irq number to use with IMR(x), ISR(x) and friends */ 407/* decode irq number to use with IMR(x), ISR(x) and friends */
389#define IRQ_TO_REG(irq) ((irq - MXC_MAX_INT_LINES) >> 5) 408#define IRQ_TO_REG(irq) ((irq - MXC_INTERNAL_IRQS) >> 5)
390 409
391#define IRQ_GPIOA(x) (MXC_MAX_INT_LINES + x) 410#define IRQ_GPIOA(x) (MXC_GPIO_IRQ_START + x)
392#define IRQ_GPIOB(x) (IRQ_GPIOA(32) + x) 411#define IRQ_GPIOB(x) (IRQ_GPIOA(32) + x)
393#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x) 412#define IRQ_GPIOC(x) (IRQ_GPIOB(32) + x)
394#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x) 413#define IRQ_GPIOD(x) (IRQ_GPIOC(32) + x)
414#define IRQ_GPIOE(x) (IRQ_GPIOD(32) + x)
395 415
396#endif /* _MXC_GPIO_MX1_MX2_H */ 416#endif /* _MXC_GPIO_MX1_MX2_H */
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx3.h b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
index c9f39c2fb8c6..c9198c0aea18 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx3.h
@@ -141,7 +141,7 @@ void mxc_iomux_set_gpr(enum iomux_gp_func, bool);
141 ((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) 141 ((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT)
142#define IOMUX_TO_IRQ(iomux_pin) \ 142#define IOMUX_TO_IRQ(iomux_pin) \
143 (((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) + \ 143 (((iomux_pin & IOMUX_GPIONUM_MASK) >> IOMUX_GPIONUM_SHIFT) + \
144 MXC_GPIO_INT_BASE) 144 MXC_GPIO_IRQ_START)
145 145
146/* 146/*
147 * This enumeration is constructed based on the Section 147 * This enumeration is constructed based on the Section
@@ -491,6 +491,14 @@ enum iomux_pins {
491#define MX31_PIN_RTS1__RTS1 IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_FUNC) 491#define MX31_PIN_RTS1__RTS1 IOMUX_MODE(MX31_PIN_RTS1, IOMUX_CONFIG_FUNC)
492#define MX31_PIN_TXD1__TXD1 IOMUX_MODE(MX31_PIN_TXD1, IOMUX_CONFIG_FUNC) 492#define MX31_PIN_TXD1__TXD1 IOMUX_MODE(MX31_PIN_TXD1, IOMUX_CONFIG_FUNC)
493#define MX31_PIN_RXD1__RXD1 IOMUX_MODE(MX31_PIN_RXD1, IOMUX_CONFIG_FUNC) 493#define MX31_PIN_RXD1__RXD1 IOMUX_MODE(MX31_PIN_RXD1, IOMUX_CONFIG_FUNC)
494#define MX31_PIN_CTS2__CTS2 IOMUX_MODE(MX31_PIN_CTS2, IOMUX_CONFIG_FUNC)
495#define MX31_PIN_RTS2__RTS2 IOMUX_MODE(MX31_PIN_RTS2, IOMUX_CONFIG_FUNC)
496#define MX31_PIN_TXD2__TXD2 IOMUX_MODE(MX31_PIN_TXD2, IOMUX_CONFIG_FUNC)
497#define MX31_PIN_RXD2__RXD2 IOMUX_MODE(MX31_PIN_RXD2, IOMUX_CONFIG_FUNC)
498#define MX31_PIN_PC_RST__CTS5 IOMUX_MODE(MX31_PIN_PC_RST, IOMUX_CONFIG_ALT2)
499#define MX31_PIN_PC_VS2__RTS5 IOMUX_MODE(MX31_PIN_PC_VS2, IOMUX_CONFIG_ALT2)
500#define MX31_PIN_PC_BVD2__TXD5 IOMUX_MODE(MX31_PIN_PC_BVD2, IOMUX_CONFIG_ALT2)
501#define MX31_PIN_PC_BVD1__RXD5 IOMUX_MODE(MX31_PIN_PC_BVD1, IOMUX_CONFIG_ALT2)
494#define MX31_PIN_CSPI1_MOSI__MOSI IOMUX_MODE(MX31_PIN_CSPI1_MOSI, IOMUX_CONFIG_FUNC) 502#define MX31_PIN_CSPI1_MOSI__MOSI IOMUX_MODE(MX31_PIN_CSPI1_MOSI, IOMUX_CONFIG_FUNC)
495#define MX31_PIN_CSPI1_MISO__MISO IOMUX_MODE(MX31_PIN_CSPI1_MISO, IOMUX_CONFIG_FUNC) 503#define MX31_PIN_CSPI1_MISO__MISO IOMUX_MODE(MX31_PIN_CSPI1_MISO, IOMUX_CONFIG_FUNC)
496#define MX31_PIN_CSPI1_SCLK__SCLK IOMUX_MODE(MX31_PIN_CSPI1_SCLK, IOMUX_CONFIG_FUNC) 504#define MX31_PIN_CSPI1_SCLK__SCLK IOMUX_MODE(MX31_PIN_CSPI1_SCLK, IOMUX_CONFIG_FUNC)
@@ -509,6 +517,15 @@ enum iomux_pins {
509#define MX31_PIN_CSPI3_MISO__MISO IOMUX_MODE(MX31_PIN_CSPI3_MISO, IOMUX_CONFIG_FUNC) 517#define MX31_PIN_CSPI3_MISO__MISO IOMUX_MODE(MX31_PIN_CSPI3_MISO, IOMUX_CONFIG_FUNC)
510#define MX31_PIN_CSPI3_SCLK__SCLK IOMUX_MODE(MX31_PIN_CSPI3_SCLK, IOMUX_CONFIG_FUNC) 518#define MX31_PIN_CSPI3_SCLK__SCLK IOMUX_MODE(MX31_PIN_CSPI3_SCLK, IOMUX_CONFIG_FUNC)
511#define MX31_PIN_CSPI3_SPI_RDY__SPI_RDY IOMUX_MODE(MX31_PIN_CSPI3_SPI_RDY, IOMUX_CONFIG_FUNC) 519#define MX31_PIN_CSPI3_SPI_RDY__SPI_RDY IOMUX_MODE(MX31_PIN_CSPI3_SPI_RDY, IOMUX_CONFIG_FUNC)
520#define MX31_PIN_BATT_LINE__OWIRE IOMUX_MODE(MX31_PIN_BATT_LINE, IOMUX_CONFIG_FUNC)
521#define MX31_PIN_CS4__CS4 IOMUX_MODE(MX31_PIN_CS4, IOMUX_CONFIG_FUNC)
522#define MX31_PIN_SD1_DATA3__SD1_DATA3 IOMUX_MODE(MX31_PIN_SD1_DATA3, IOMUX_CONFIG_FUNC)
523#define MX31_PIN_SD1_DATA2__SD1_DATA2 IOMUX_MODE(MX31_PIN_SD1_DATA2, IOMUX_CONFIG_FUNC)
524#define MX31_PIN_SD1_DATA1__SD1_DATA1 IOMUX_MODE(MX31_PIN_SD1_DATA1, IOMUX_CONFIG_FUNC)
525#define MX31_PIN_SD1_DATA0__SD1_DATA0 IOMUX_MODE(MX31_PIN_SD1_DATA0, IOMUX_CONFIG_FUNC)
526#define MX31_PIN_SD1_CLK__SD1_CLK IOMUX_MODE(MX31_PIN_SD1_CLK, IOMUX_CONFIG_FUNC)
527#define MX31_PIN_SD1_CMD__SD1_CMD IOMUX_MODE(MX31_PIN_SD1_CMD, IOMUX_CONFIG_FUNC)
528
512/*XXX: The SS0, SS1, SS2, SS3 lines of spi3 are multiplexed by cspi2_ss0, cspi2_ss1, cspi1_ss0 529/*XXX: The SS0, SS1, SS2, SS3 lines of spi3 are multiplexed by cspi2_ss0, cspi2_ss1, cspi1_ss0
513 * cspi1_ss1*/ 530 * cspi1_ss1*/
514 531
diff --git a/arch/arm/plat-mxc/include/mach/irqs.h b/arch/arm/plat-mxc/include/mach/irqs.h
index b55bba35e18a..e06d3cb0ee11 100644
--- a/arch/arm/plat-mxc/include/mach/irqs.h
+++ b/arch/arm/plat-mxc/include/mach/irqs.h
@@ -11,7 +11,37 @@
11#ifndef __ASM_ARCH_MXC_IRQS_H__ 11#ifndef __ASM_ARCH_MXC_IRQS_H__
12#define __ASM_ARCH_MXC_IRQS_H__ 12#define __ASM_ARCH_MXC_IRQS_H__
13 13
14#include <mach/hardware.h> 14/*
15 * So far all i.MX SoCs have 64 internal interrupts
16 */
17#define MXC_INTERNAL_IRQS 64
18
19#define MXC_GPIO_IRQ_START MXC_INTERNAL_IRQS
20
21#if defined CONFIG_ARCH_MX1
22#define MXC_GPIO_IRQS (32 * 4)
23#elif defined CONFIG_ARCH_MX2
24#define MXC_GPIO_IRQS (32 * 6)
25#elif defined CONFIG_ARCH_MX3
26#define MXC_GPIO_IRQS (32 * 3)
27#endif
28
29/*
30 * The next 16 interrupts are for board specific purposes. Since
31 * the kernel can only run on one machine at a time, we can re-use
32 * these. If you need more, increase MXC_BOARD_IRQS, but keep it
33 * within sensible limits.
34 */
35#define MXC_BOARD_IRQ_START (MXC_INTERNAL_IRQS + MXC_GPIO_IRQS)
36#define MXC_BOARD_IRQS 16
37
38#define NR_IRQS (MXC_BOARD_IRQ_START + MXC_BOARD_IRQS)
39
15extern void imx_irq_set_priority(unsigned char irq, unsigned char prio); 40extern void imx_irq_set_priority(unsigned char irq, unsigned char prio);
16 41
42/* all normal IRQs can be FIQs */
43#define FIQ_START 0
44/* switch betwean IRQ and FIQ */
45extern int mxc_set_irq_fiq(unsigned int irq, unsigned int type);
46
17#endif /* __ASM_ARCH_MXC_IRQS_H__ */ 47#endif /* __ASM_ARCH_MXC_IRQS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
index d7a8d3ebed57..0b808399097f 100644
--- a/arch/arm/plat-mxc/include/mach/memory.h
+++ b/arch/arm/plat-mxc/include/mach/memory.h
@@ -11,19 +11,12 @@
11#ifndef __ASM_ARCH_MXC_MEMORY_H__ 11#ifndef __ASM_ARCH_MXC_MEMORY_H__
12#define __ASM_ARCH_MXC_MEMORY_H__ 12#define __ASM_ARCH_MXC_MEMORY_H__
13 13
14#include <mach/hardware.h> 14#if defined CONFIG_ARCH_MX1
15 15#define PHYS_OFFSET UL(0x08000000)
16/* 16#elif defined CONFIG_ARCH_MX2
17 * Virtual view <-> DMA view memory address translations 17#define PHYS_OFFSET UL(0xA0000000)
18 * This macro is used to translate the virtual address to an address 18#elif defined CONFIG_ARCH_MX3
19 * suitable to be passed to set_dma_addr() 19#define PHYS_OFFSET UL(0x80000000)
20 */ 20#endif
21#define __virt_to_bus(a) __virt_to_phys(a)
22
23/*
24 * Used to convert an address for DMA operations to an address that the
25 * kernel can use.
26 */
27#define __bus_to_virt(a) __phys_to_virt(a)
28 21
29#endif /* __ASM_ARCH_MXC_MEMORY_H__ */ 22#endif /* __ASM_ARCH_MXC_MEMORY_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mtd-xip.h b/arch/arm/plat-mxc/include/mach/mtd-xip.h
new file mode 100644
index 000000000000..1ab1bba5688d
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mtd-xip.h
@@ -0,0 +1,34 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Copyright (C) 2008 Darius Augulis <augulis.darius@gmail.com>, Teltonika, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 */
13
14#include <mach/mxc_timer.h>
15
16#ifndef __ARCH_IMX_MTD_XIP_H__
17#define __ARCH_IMX_MTD_XIP_H__
18
19#ifdef CONFIG_ARCH_MX1
20/* AITC registers */
21#define AITC_BASE IO_ADDRESS(AVIC_BASE_ADDR)
22#define NIPNDH (AITC_BASE + 0x58)
23#define NIPNDL (AITC_BASE + 0x5C)
24#define INTENABLEH (AITC_BASE + 0x10)
25#define INTENABLEL (AITC_BASE + 0x14)
26/* MTD macros */
27#define xip_irqpending() ((__raw_readl(INTENABLEH) & __raw_readl(NIPNDH)) \
28 || (__raw_readl(INTENABLEL) & __raw_readl(NIPNDL)))
29#define xip_currtime() (__raw_readl(TIMER_BASE + MXC_TCN))
30#define xip_elapsed_since(x) (signed)((__raw_readl(TIMER_BASE + MXC_TCN) - (x)) / 96)
31#define xip_cpu_idle() asm volatile ("mcr p15, 0, %0, c7, c0, 4" :: "r" (0))
32#endif /* CONFIG_ARCH_MX1 */
33
34#endif /* __ARCH_IMX_MTD_XIP_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/plat-mxc/include/mach/mx1.h
new file mode 100644
index 000000000000..b92e02324d8e
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mx1.h
@@ -0,0 +1,186 @@
1/*
2 * Copyright (C) 1997,1998 Russell King
3 * Copyright (C) 1999 ARM Limited
4 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
5 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ASM_ARCH_MXC_MX1_H__
13#define __ASM_ARCH_MXC_MX1_H__
14
15#ifndef __ASM_ARCH_MXC_HARDWARE_H__
16#error "Do not include directly."
17#endif
18
19#include <mach/vmalloc.h>
20
21/*
22 * Memory map
23 */
24#define IMX_IO_PHYS 0x00200000
25#define IMX_IO_SIZE 0x00100000
26#define IMX_IO_BASE VMALLOC_END
27
28#define IMX_CS0_PHYS 0x10000000
29#define IMX_CS0_SIZE 0x02000000
30
31#define IMX_CS1_PHYS 0x12000000
32#define IMX_CS1_SIZE 0x01000000
33
34#define IMX_CS2_PHYS 0x13000000
35#define IMX_CS2_SIZE 0x01000000
36
37#define IMX_CS3_PHYS 0x14000000
38#define IMX_CS3_SIZE 0x01000000
39
40#define IMX_CS4_PHYS 0x15000000
41#define IMX_CS4_SIZE 0x01000000
42
43#define IMX_CS5_PHYS 0x16000000
44#define IMX_CS5_SIZE 0x01000000
45
46/*
47 * Register BASEs, based on OFFSETs
48 */
49#define AIPI1_BASE_ADDR (0x00000 + IMX_IO_PHYS)
50#define WDT_BASE_ADDR (0x01000 + IMX_IO_PHYS)
51#define TIM1_BASE_ADDR (0x02000 + IMX_IO_PHYS)
52#define TIM2_BASE_ADDR (0x03000 + IMX_IO_PHYS)
53#define RTC_BASE_ADDR (0x04000 + IMX_IO_PHYS)
54#define LCDC_BASE_ADDR (0x05000 + IMX_IO_PHYS)
55#define UART1_BASE_ADDR (0x06000 + IMX_IO_PHYS)
56#define UART2_BASE_ADDR (0x07000 + IMX_IO_PHYS)
57#define PWM_BASE_ADDR (0x08000 + IMX_IO_PHYS)
58#define DMA_BASE_ADDR (0x09000 + IMX_IO_PHYS)
59#define AIPI2_BASE_ADDR (0x10000 + IMX_IO_PHYS)
60#define SIM_BASE_ADDR (0x11000 + IMX_IO_PHYS)
61#define USBD_BASE_ADDR (0x12000 + IMX_IO_PHYS)
62#define SPI1_BASE_ADDR (0x13000 + IMX_IO_PHYS)
63#define MMC_BASE_ADDR (0x14000 + IMX_IO_PHYS)
64#define ASP_BASE_ADDR (0x15000 + IMX_IO_PHYS)
65#define BTA_BASE_ADDR (0x16000 + IMX_IO_PHYS)
66#define I2C_BASE_ADDR (0x17000 + IMX_IO_PHYS)
67#define SSI_BASE_ADDR (0x18000 + IMX_IO_PHYS)
68#define SPI2_BASE_ADDR (0x19000 + IMX_IO_PHYS)
69#define MSHC_BASE_ADDR (0x1A000 + IMX_IO_PHYS)
70#define CCM_BASE_ADDR (0x1B000 + IMX_IO_PHYS)
71#define SCM_BASE_ADDR (0x1B804 + IMX_IO_PHYS)
72#define GPIO_BASE_ADDR (0x1C000 + IMX_IO_PHYS)
73#define EIM_BASE_ADDR (0x20000 + IMX_IO_PHYS)
74#define SDRAMC_BASE_ADDR (0x21000 + IMX_IO_PHYS)
75#define MMA_BASE_ADDR (0x22000 + IMX_IO_PHYS)
76#define AVIC_BASE_ADDR (0x23000 + IMX_IO_PHYS)
77#define CSI_BASE_ADDR (0x24000 + IMX_IO_PHYS)
78
79/* macro to get at IO space when running virtually */
80#define IO_ADDRESS(x) ((x) - IMX_IO_PHYS + IMX_IO_BASE)
81
82/* define macros needed for entry-macro.S */
83#define AVIC_IO_ADDRESS(x) IO_ADDRESS(x)
84
85/* fixed interrput numbers */
86#define INT_SOFTINT 0
87#define CSI_INT 6
88#define DSPA_MAC_INT 7
89#define DSPA_INT 8
90#define COMP_INT 9
91#define MSHC_XINT 10
92#define GPIO_INT_PORTA 11
93#define GPIO_INT_PORTB 12
94#define GPIO_INT_PORTC 13
95#define LCDC_INT 14
96#define SIM_INT 15
97#define SIM_DATA_INT 16
98#define RTC_INT 17
99#define RTC_SAMINT 18
100#define UART2_MINT_PFERR 19
101#define UART2_MINT_RTS 20
102#define UART2_MINT_DTR 21
103#define UART2_MINT_UARTC 22
104#define UART2_MINT_TX 23
105#define UART2_MINT_RX 24
106#define UART1_MINT_PFERR 25
107#define UART1_MINT_RTS 26
108#define UART1_MINT_DTR 27
109#define UART1_MINT_UARTC 28
110#define UART1_MINT_TX 29
111#define UART1_MINT_RX 30
112#define VOICE_DAC_INT 31
113#define VOICE_ADC_INT 32
114#define PEN_DATA_INT 33
115#define PWM_INT 34
116#define SDHC_INT 35
117#define I2C_INT 39
118#define CSPI_INT 41
119#define SSI_TX_INT 42
120#define SSI_TX_ERR_INT 43
121#define SSI_RX_INT 44
122#define SSI_RX_ERR_INT 45
123#define TOUCH_INT 46
124#define USBD_INT0 47
125#define USBD_INT1 48
126#define USBD_INT2 49
127#define USBD_INT3 50
128#define USBD_INT4 51
129#define USBD_INT5 52
130#define USBD_INT6 53
131#define BTSYS_INT 55
132#define BTTIM_INT 56
133#define BTWUI_INT 57
134#define TIM2_INT 58
135#define TIM1_INT 59
136#define DMA_ERR 60
137#define DMA_INT 61
138#define GPIO_INT_PORTD 62
139#define WDT_INT 63
140
141/* gpio and gpio based interrupt handling */
142#define GPIO_DR 0x1C
143#define GPIO_GDIR 0x00
144#define GPIO_PSR 0x24
145#define GPIO_ICR1 0x28
146#define GPIO_ICR2 0x2C
147#define GPIO_IMR 0x30
148#define GPIO_ISR 0x34
149#define GPIO_INT_LOW_LEV 0x3
150#define GPIO_INT_HIGH_LEV 0x2
151#define GPIO_INT_RISE_EDGE 0x0
152#define GPIO_INT_FALL_EDGE 0x1
153#define GPIO_INT_NONE 0x4
154
155/* DMA */
156#define DMA_REQ_UART3_T 2
157#define DMA_REQ_UART3_R 3
158#define DMA_REQ_SSI2_T 4
159#define DMA_REQ_SSI2_R 5
160#define DMA_REQ_CSI_STAT 6
161#define DMA_REQ_CSI_R 7
162#define DMA_REQ_MSHC 8
163#define DMA_REQ_DSPA_DCT_DOUT 9
164#define DMA_REQ_DSPA_DCT_DIN 10
165#define DMA_REQ_DSPA_MAC 11
166#define DMA_REQ_EXT 12
167#define DMA_REQ_SDHC 13
168#define DMA_REQ_SPI1_R 14
169#define DMA_REQ_SPI1_T 15
170#define DMA_REQ_SSI_T 16
171#define DMA_REQ_SSI_R 17
172#define DMA_REQ_ASP_DAC 18
173#define DMA_REQ_ASP_ADC 19
174#define DMA_REQ_USP_EP(x) (20 + (x))
175#define DMA_REQ_SPI2_R 26
176#define DMA_REQ_SPI2_T 27
177#define DMA_REQ_UART2_T 28
178#define DMA_REQ_UART2_R 29
179#define DMA_REQ_UART1_T 30
180#define DMA_REQ_UART1_R 31
181
182/* mandatory for CONFIG_LL_DEBUG */
183#define MXC_LL_UART_PADDR UART1_BASE_ADDR
184#define MXC_LL_UART_VADDR IO_ADDRESS(UART1_BASE_ADDR)
185
186#endif /* __ASM_ARCH_MXC_MX1_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
index a86db64744a1..0313be720552 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -72,7 +72,8 @@
72/* for mx27*/ 72/* for mx27*/
73#define OTG_BASE_ADDR USBOTG_BASE_ADDR 73#define OTG_BASE_ADDR USBOTG_BASE_ADDR
74#define SAHARA_BASE_ADDR (AIPI_BASE_ADDR + 0x25000) 74#define SAHARA_BASE_ADDR (AIPI_BASE_ADDR + 0x25000)
75#define EMMA_BASE_ADDR (AIPI_BASE_ADDR + 0x26400) 75#define EMMA_PP_BASE_ADDR (AIPI_BASE_ADDR + 0x26000)
76#define EMMA_PRP_BASE_ADDR (AIPI_BASE_ADDR + 0x26400)
76#define CCM_BASE_ADDR (AIPI_BASE_ADDR + 0x27000) 77#define CCM_BASE_ADDR (AIPI_BASE_ADDR + 0x27000)
77#define SYSCTRL_BASE_ADDR (AIPI_BASE_ADDR + 0x27800) 78#define SYSCTRL_BASE_ADDR (AIPI_BASE_ADDR + 0x27800)
78#define IIM_BASE_ADDR (AIPI_BASE_ADDR + 0x28000) 79#define IIM_BASE_ADDR (AIPI_BASE_ADDR + 0x28000)
@@ -288,16 +289,4 @@ extern int mx27_revision(void);
288/* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */ 289/* this CPU supports up to 192 GPIOs (don't forget the baseboard!) */
289#define ARCH_NR_GPIOS (192 + 16) 290#define ARCH_NR_GPIOS (192 + 16)
290 291
291/* OS clock tick rate */
292#define CLOCK_TICK_RATE 13300000
293
294/* Start of RAM */
295#define PHYS_OFFSET SDRAM_BASE_ADDR
296
297/* max interrupt lines count */
298#define NR_IRQS 256
299
300/* count of internal interrupt sources */
301#define MXC_MAX_INT_LINES 64
302
303#endif /* __ASM_ARCH_MXC_MX27_H__ */ 292#endif /* __ASM_ARCH_MXC_MX27_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index 0536f8917bc0..de026654b00e 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -15,11 +15,6 @@
15#error "Do not include directly." 15#error "Do not include directly."
16#endif 16#endif
17 17
18/*!
19 * defines the hardware clock tick rate
20 */
21#define CLOCK_TICK_RATE 16625000
22
23/* 18/*
24 * MX31 memory map: 19 * MX31 memory map:
25 * 20 *
@@ -244,9 +239,6 @@
244#define PCMCIA_IO_ADDRESS(x) \ 239#define PCMCIA_IO_ADDRESS(x) \
245 (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT) 240 (((x) - X_MEMC_BASE_ADDR) + X_MEMC_BASE_ADDR_VIRT)
246 241
247/* Start of physical RAM - On many MX31 platforms, this is the first SDRAM bank (CSD0) */
248#define PHYS_OFFSET CSD0_BASE_ADDR
249
250/* 242/*
251 * Interrupt numbers 243 * Interrupt numbers
252 */ 244 */
@@ -315,23 +307,6 @@
315#define MXC_INT_EXT_WDOG 62 307#define MXC_INT_EXT_WDOG 62
316#define MXC_INT_EXT_TV 63 308#define MXC_INT_EXT_TV 63
317 309
318#define MXC_MAX_INT_LINES 64
319
320#define MXC_GPIO_INT_BASE MXC_MAX_INT_LINES
321#define MXC_MAX_GPIO_LINES (GPIO_NUM_PIN * GPIO_PORT_NUM)
322#define MXC_MAX_VIRTUAL_INTS 16
323
324#define NR_IRQS (MXC_MAX_INT_LINES + MXC_MAX_GPIO_LINES + MXC_MAX_VIRTUAL_INTS)
325
326/*!
327 * Number of GPIO port as defined in the IC Spec
328 */
329#define GPIO_PORT_NUM 3
330/*!
331 * Number of GPIO pins per port
332 */
333#define GPIO_NUM_PIN 32
334
335#define PROD_SIGNATURE 0x1 /* For MX31 */ 310#define PROD_SIGNATURE 0x1 /* For MX31 */
336 311
337/* silicon revisions specific to i.MX31 */ 312/* silicon revisions specific to i.MX31 */
diff --git a/arch/arm/plat-mxc/include/mach/mxc_timer.h b/arch/arm/plat-mxc/include/mach/mxc_timer.h
index 130aebfbe168..6c19a134744b 100644
--- a/arch/arm/plat-mxc/include/mach/mxc_timer.h
+++ b/arch/arm/plat-mxc/include/mach/mxc_timer.h
@@ -26,7 +26,7 @@
26#include <linux/clk.h> 26#include <linux/clk.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28 28
29#ifdef CONFIG_ARCH_IMX 29#ifdef CONFIG_ARCH_MX1
30#define TIMER_BASE IO_ADDRESS(TIM1_BASE_ADDR) 30#define TIMER_BASE IO_ADDRESS(TIM1_BASE_ADDR)
31#define TIMER_INTERRUPT TIM1_INT 31#define TIMER_INTERRUPT TIM1_INT
32 32
@@ -65,7 +65,7 @@ static void gpt_irq_acknowledge(void)
65{ 65{
66 __raw_writel(0, TIMER_BASE + MXC_TSTAT); 66 __raw_writel(0, TIMER_BASE + MXC_TSTAT);
67} 67}
68#endif /* CONFIG_ARCH_IMX */ 68#endif /* CONFIG_ARCH_MX1 */
69 69
70#ifdef CONFIG_ARCH_MX2 70#ifdef CONFIG_ARCH_MX2
71#define TIMER_BASE IO_ADDRESS(GPT1_BASE_ADDR) 71#define TIMER_BASE IO_ADDRESS(GPT1_BASE_ADDR)
diff --git a/arch/arm/plat-mxc/include/mach/timex.h b/arch/arm/plat-mxc/include/mach/timex.h
index 0b0af0253e91..07b4a73c9d2f 100644
--- a/arch/arm/plat-mxc/include/mach/timex.h
+++ b/arch/arm/plat-mxc/include/mach/timex.h
@@ -20,6 +20,12 @@
20#ifndef __ASM_ARCH_MXC_TIMEX_H__ 20#ifndef __ASM_ARCH_MXC_TIMEX_H__
21#define __ASM_ARCH_MXC_TIMEX_H__ 21#define __ASM_ARCH_MXC_TIMEX_H__
22 22
23#include <mach/hardware.h> /* for CLOCK_TICK_RATE */ 23#if defined CONFIG_ARCH_MX1
24#define CLOCK_TICK_RATE 16000000
25#elif defined CONFIG_ARCH_MX2
26#define CLOCK_TICK_RATE 13300000
27#elif defined CONFIG_ARCH_MX3
28#define CLOCK_TICK_RATE 16625000
29#endif
24 30
25#endif /* __ASM_ARCH_MXC_TIMEX_H__ */ 31#endif /* __ASM_ARCH_MXC_TIMEX_H__ */
diff --git a/arch/arm/plat-mxc/iomux-mx1-mx2.c b/arch/arm/plat-mxc/iomux-mx1-mx2.c
index d97387aa9a42..df6f18395686 100644
--- a/arch/arm/plat-mxc/iomux-mx1-mx2.c
+++ b/arch/arm/plat-mxc/iomux-mx1-mx2.c
@@ -110,12 +110,13 @@ void mxc_gpio_mode(int gpio_mode)
110EXPORT_SYMBOL(mxc_gpio_mode); 110EXPORT_SYMBOL(mxc_gpio_mode);
111 111
112int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count, 112int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
113 int alloc_mode, const char *label) 113 const char *label)
114{ 114{
115 const int *p = pin_list; 115 const int *p = pin_list;
116 int i; 116 int i;
117 unsigned gpio; 117 unsigned gpio;
118 unsigned mode; 118 unsigned mode;
119 int ret = -EINVAL;
119 120
120 for (i = 0; i < count; i++) { 121 for (i = 0; i < count; i++) {
121 gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK); 122 gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
@@ -124,33 +125,33 @@ int mxc_gpio_setup_multiple_pins(const int *pin_list, unsigned count,
124 if (gpio >= (GPIO_PORT_MAX + 1) * 32) 125 if (gpio >= (GPIO_PORT_MAX + 1) * 32)
125 goto setup_error; 126 goto setup_error;
126 127
127 if (alloc_mode & MXC_GPIO_ALLOC_MODE_RELEASE) 128 ret = gpio_request(gpio, label);
128 gpio_free(gpio); 129 if (ret)
129 else if (!(alloc_mode & MXC_GPIO_ALLOC_MODE_NO_ALLOC)) 130 goto setup_error;
130 if (gpio_request(gpio, label)
131 && !(alloc_mode & MXC_GPIO_ALLOC_MODE_TRY_ALLOC))
132 goto setup_error;
133 131
134 if (!(alloc_mode & (MXC_GPIO_ALLOC_MODE_ALLOC_ONLY | 132 mxc_gpio_mode(gpio | mode);
135 MXC_GPIO_ALLOC_MODE_RELEASE)))
136 mxc_gpio_mode(gpio | mode);
137 133
138 p++; 134 p++;
139 } 135 }
140 return 0; 136 return 0;
141 137
142setup_error: 138setup_error:
143 if (alloc_mode & (MXC_GPIO_ALLOC_MODE_NO_ALLOC | 139 mxc_gpio_release_multiple_pins(pin_list, i);
144 MXC_GPIO_ALLOC_MODE_TRY_ALLOC)) 140 return ret;
145 return -EINVAL; 141}
142EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins);
146 143
147 while (p != pin_list) { 144void mxc_gpio_release_multiple_pins(const int *pin_list, int count)
148 p--; 145{
149 gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK); 146 const int *p = pin_list;
147 int i;
148
149 for (i = 0; i < count; i++) {
150 unsigned gpio = *p & (GPIO_PIN_MASK | GPIO_PORT_MASK);
150 gpio_free(gpio); 151 gpio_free(gpio);
152 p++;
151 } 153 }
152 154
153 return -EINVAL;
154} 155}
155EXPORT_SYMBOL(mxc_gpio_setup_multiple_pins); 156EXPORT_SYMBOL(mxc_gpio_release_multiple_pins);
156 157
diff --git a/arch/arm/plat-mxc/irq.c b/arch/arm/plat-mxc/irq.c
index d862c9e5f8db..6e7578a3514b 100644
--- a/arch/arm/plat-mxc/irq.c
+++ b/arch/arm/plat-mxc/irq.c
@@ -17,9 +17,12 @@
17 * MA 02110-1301, USA. 17 * MA 02110-1301, USA.
18 */ 18 */
19 19
20#include <linux/module.h>
20#include <linux/irq.h> 21#include <linux/irq.h>
21#include <linux/io.h> 22#include <linux/io.h>
22#include <mach/common.h> 23#include <mach/common.h>
24#include <asm/mach/irq.h>
25#include <mach/hardware.h>
23 26
24#define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR) 27#define AVIC_BASE IO_ADDRESS(AVIC_BASE_ADDR)
25#define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */ 28#define AVIC_INTCNTL (AVIC_BASE + 0x00) /* int control reg */
@@ -65,6 +68,28 @@ void imx_irq_set_priority(unsigned char irq, unsigned char prio)
65EXPORT_SYMBOL(imx_irq_set_priority); 68EXPORT_SYMBOL(imx_irq_set_priority);
66#endif 69#endif
67 70
71#ifdef CONFIG_FIQ
72int mxc_set_irq_fiq(unsigned int irq, unsigned int type)
73{
74 unsigned int irqt;
75
76 if (irq >= MXC_INTERNAL_IRQS)
77 return -EINVAL;
78
79 if (irq < MXC_INTERNAL_IRQS / 2) {
80 irqt = __raw_readl(AVIC_INTTYPEL) & ~(1 << irq);
81 __raw_writel(irqt | (!!type << irq), AVIC_INTTYPEL);
82 } else {
83 irq -= MXC_INTERNAL_IRQS / 2;
84 irqt = __raw_readl(AVIC_INTTYPEH) & ~(1 << irq);
85 __raw_writel(irqt | (!!type << irq), AVIC_INTTYPEH);
86 }
87
88 return 0;
89}
90EXPORT_SYMBOL(mxc_set_irq_fiq);
91#endif /* CONFIG_FIQ */
92
68/* Disable interrupt number "irq" in the AVIC */ 93/* Disable interrupt number "irq" in the AVIC */
69static void mxc_mask_irq(unsigned int irq) 94static void mxc_mask_irq(unsigned int irq)
70{ 95{
@@ -91,7 +116,6 @@ static struct irq_chip mxc_avic_chip = {
91void __init mxc_init_irq(void) 116void __init mxc_init_irq(void)
92{ 117{
93 int i; 118 int i;
94 u32 reg;
95 119
96 /* put the AVIC into the reset value with 120 /* put the AVIC into the reset value with
97 * all interrupts disabled 121 * all interrupts disabled
@@ -106,7 +130,7 @@ void __init mxc_init_irq(void)
106 /* all IRQ no FIQ */ 130 /* all IRQ no FIQ */
107 __raw_writel(0, AVIC_INTTYPEH); 131 __raw_writel(0, AVIC_INTTYPEH);
108 __raw_writel(0, AVIC_INTTYPEL); 132 __raw_writel(0, AVIC_INTTYPEL);
109 for (i = 0; i < MXC_MAX_INT_LINES; i++) { 133 for (i = 0; i < MXC_INTERNAL_IRQS; i++) {
110 set_irq_chip(i, &mxc_avic_chip); 134 set_irq_chip(i, &mxc_avic_chip);
111 set_irq_handler(i, handle_level_irq); 135 set_irq_handler(i, handle_level_irq);
112 set_irq_flags(i, IRQF_VALID); 136 set_irq_flags(i, IRQF_VALID);
@@ -119,5 +143,10 @@ void __init mxc_init_irq(void)
119 /* init architectures chained interrupt handler */ 143 /* init architectures chained interrupt handler */
120 mxc_register_gpios(); 144 mxc_register_gpios();
121 145
146#ifdef CONFIG_FIQ
147 /* Initialize FIQ */
148 init_FIQ();
149#endif
150
122 printk(KERN_INFO "MXC IRQ initialized\n"); 151 printk(KERN_INFO "MXC IRQ initialized\n");
123} 152}