aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mx3
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-10-09 16:33:03 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-10-09 16:33:03 -0400
commitb1add0480a95b6ceaece5caf6c50614771eae9b2 (patch)
tree06f969f37bd0f51d9ebcccdb3e3ae983edaad889 /arch/arm/mach-mx3
parent3f30a09a612bac2b531a206c2a58a292dd7ff182 (diff)
parent58a85f465fb16a918a869eba05addb8f78d9e064 (diff)
Merge branch 'for-rmk' of git://pasiphae.extern.pengutronix.de/git/imx/linux-2.6.git
Merge branch 'imx-devel' into devel
Diffstat (limited to 'arch/arm/mach-mx3')
-rw-r--r--arch/arm/mach-mx3/devices.c43
-rw-r--r--arch/arm/mach-mx3/devices.h6
-rw-r--r--arch/arm/mach-mx3/iomux.c6
-rw-r--r--arch/arm/mach-mx3/mx31ads.c114
-rw-r--r--arch/arm/mach-mx3/pcm037.c6
5 files changed, 132 insertions, 43 deletions
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index e08c6a8ac56b..a6bdcc07f3c9 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -36,7 +36,7 @@ static struct resource uart0[] = {
36 }, 36 },
37}; 37};
38 38
39static struct platform_device mxc_uart_device0 = { 39struct platform_device mxc_uart_device0 = {
40 .name = "imx-uart", 40 .name = "imx-uart",
41 .id = 0, 41 .id = 0,
42 .resource = uart0, 42 .resource = uart0,
@@ -55,7 +55,7 @@ static struct resource uart1[] = {
55 }, 55 },
56}; 56};
57 57
58static struct platform_device mxc_uart_device1 = { 58struct platform_device mxc_uart_device1 = {
59 .name = "imx-uart", 59 .name = "imx-uart",
60 .id = 1, 60 .id = 1,
61 .resource = uart1, 61 .resource = uart1,
@@ -74,7 +74,7 @@ static struct resource uart2[] = {
74 }, 74 },
75}; 75};
76 76
77static struct platform_device mxc_uart_device2 = { 77struct platform_device mxc_uart_device2 = {
78 .name = "imx-uart", 78 .name = "imx-uart",
79 .id = 2, 79 .id = 2,
80 .resource = uart2, 80 .resource = uart2,
@@ -93,7 +93,7 @@ static struct resource uart3[] = {
93 }, 93 },
94}; 94};
95 95
96static struct platform_device mxc_uart_device3 = { 96struct platform_device mxc_uart_device3 = {
97 .name = "imx-uart", 97 .name = "imx-uart",
98 .id = 3, 98 .id = 3,
99 .resource = uart3, 99 .resource = uart3,
@@ -112,46 +112,13 @@ static struct resource uart4[] = {
112 }, 112 },
113}; 113};
114 114
115static struct platform_device mxc_uart_device4 = { 115struct platform_device mxc_uart_device4 = {
116 .name = "imx-uart", 116 .name = "imx-uart",
117 .id = 4, 117 .id = 4,
118 .resource = uart4, 118 .resource = uart4,
119 .num_resources = ARRAY_SIZE(uart4), 119 .num_resources = ARRAY_SIZE(uart4),
120}; 120};
121 121
122/*
123 * Register only those UARTs that physically exist
124 */
125int __init imx_init_uart(int uart_no, struct imxuart_platform_data *pdata)
126{
127 switch (uart_no) {
128 case 0:
129 mxc_uart_device0.dev.platform_data = pdata;
130 platform_device_register(&mxc_uart_device0);
131 break;
132 case 1:
133 mxc_uart_device1.dev.platform_data = pdata;
134 platform_device_register(&mxc_uart_device1);
135 break;
136 case 2:
137 mxc_uart_device2.dev.platform_data = pdata;
138 platform_device_register(&mxc_uart_device2);
139 break;
140 case 3:
141 mxc_uart_device3.dev.platform_data = pdata;
142 platform_device_register(&mxc_uart_device3);
143 break;
144 case 4:
145 mxc_uart_device4.dev.platform_data = pdata;
146 platform_device_register(&mxc_uart_device4);
147 break;
148 default:
149 return -ENODEV;
150 }
151
152 return 0;
153}
154
155/* GPIO port description */ 122/* GPIO port description */
156static struct mxc_gpio_port imx_gpio_ports[] = { 123static struct mxc_gpio_port imx_gpio_ports[] = {
157 [0] = { 124 [0] = {
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
new file mode 100644
index 000000000000..4dc03f9e6001
--- /dev/null
+++ b/arch/arm/mach-mx3/devices.h
@@ -0,0 +1,6 @@
1
2extern struct platform_device mxc_uart_device0;
3extern struct platform_device mxc_uart_device1;
4extern struct platform_device mxc_uart_device2;
5extern struct platform_device mxc_uart_device3;
6extern struct platform_device mxc_uart_device4;
diff --git a/arch/arm/mach-mx3/iomux.c b/arch/arm/mach-mx3/iomux.c
index 3dda1fe23cbf..6e664be8cc13 100644
--- a/arch/arm/mach-mx3/iomux.c
+++ b/arch/arm/mach-mx3/iomux.c
@@ -43,7 +43,8 @@ static DEFINE_SPINLOCK(gpio_mux_lock);
43 */ 43 */
44int mxc_iomux_mode(unsigned int pin_mode) 44int mxc_iomux_mode(unsigned int pin_mode)
45{ 45{
46 u32 reg, field, l, mode, ret = 0; 46 u32 field, l, mode, ret = 0;
47 void __iomem *reg;
47 48
48 reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK); 49 reg = IOMUXSW_MUX_CTL + (pin_mode & IOMUX_REG_MASK);
49 field = pin_mode & 0x3; 50 field = pin_mode & 0x3;
@@ -70,7 +71,8 @@ EXPORT_SYMBOL(mxc_iomux_mode);
70 */ 71 */
71void mxc_iomux_set_pad(enum iomux_pins pin, u32 config) 72void mxc_iomux_set_pad(enum iomux_pins pin, u32 config)
72{ 73{
73 u32 reg, field, l; 74 u32 field, l;
75 void __iomem *reg;
74 76
75 reg = IOMUXSW_PAD_CTL + (pin + 2) / 3; 77 reg = IOMUXSW_PAD_CTL + (pin + 2) / 3;
76 field = (pin + 2) % 3; 78 field = (pin + 2) % 3;
diff --git a/arch/arm/mach-mx3/mx31ads.c b/arch/arm/mach-mx3/mx31ads.c
index 0cd90a9667c8..1be4a390c63f 100644
--- a/arch/arm/mach-mx3/mx31ads.c
+++ b/arch/arm/mach-mx3/mx31ads.c
@@ -22,6 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/serial_8250.h> 24#include <linux/serial_8250.h>
25#include <linux/irq.h>
25 26
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <asm/mach-types.h> 28#include <asm/mach-types.h>
@@ -31,6 +32,8 @@
31#include <asm/mach/map.h> 32#include <asm/mach/map.h>
32#include <mach/common.h> 33#include <mach/common.h>
33#include <mach/board-mx31ads.h> 34#include <mach/board-mx31ads.h>
35#include <mach/imx-uart.h>
36#include <mach/iomux-mx3.h>
34 37
35/*! 38/*!
36 * @file mx31ads.c 39 * @file mx31ads.c
@@ -84,6 +87,108 @@ static inline int mxc_init_extuart(void)
84} 87}
85#endif 88#endif
86 89
90#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
91static struct imxuart_platform_data uart_pdata = {
92 .flags = IMXUART_HAVE_RTSCTS,
93};
94
95static inline void mxc_init_imx_uart(void)
96{
97 mxc_iomux_mode(MX31_PIN_CTS1__CTS1);
98 mxc_iomux_mode(MX31_PIN_RTS1__RTS1);
99 mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
100 mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
101
102 mxc_register_device(&mxc_uart_device0, &uart_pdata);
103}
104#else /* !SERIAL_IMX */
105static inline void mxc_init_imx_uart(void)
106{
107}
108#endif /* !SERIAL_IMX */
109
110static void mx31ads_expio_irq_handler(u32 irq, struct irq_desc *desc)
111{
112 u32 imr_val;
113 u32 int_valid;
114 u32 expio_irq;
115
116 imr_val = __raw_readw(PBC_INTMASK_SET_REG);
117 int_valid = __raw_readw(PBC_INTSTATUS_REG) & imr_val;
118
119 expio_irq = MXC_EXP_IO_BASE;
120 for (; int_valid != 0; int_valid >>= 1, expio_irq++) {
121 if ((int_valid & 1) == 0)
122 continue;
123
124 generic_handle_irq(expio_irq);
125 }
126}
127
128/*
129 * Disable an expio pin's interrupt by setting the bit in the imr.
130 * @param irq an expio virtual irq number
131 */
132static void expio_mask_irq(u32 irq)
133{
134 u32 expio = MXC_IRQ_TO_EXPIO(irq);
135 /* mask the interrupt */
136 __raw_writew(1 << expio, PBC_INTMASK_CLEAR_REG);
137 __raw_readw(PBC_INTMASK_CLEAR_REG);
138}
139
140/*
141 * Acknowledge an expanded io pin's interrupt by clearing the bit in the isr.
142 * @param irq an expanded io virtual irq number
143 */
144static void expio_ack_irq(u32 irq)
145{
146 u32 expio = MXC_IRQ_TO_EXPIO(irq);
147 /* clear the interrupt status */
148 __raw_writew(1 << expio, PBC_INTSTATUS_REG);
149}
150
151/*
152 * Enable a expio pin's interrupt by clearing the bit in the imr.
153 * @param irq a expio virtual irq number
154 */
155static void expio_unmask_irq(u32 irq)
156{
157 u32 expio = MXC_IRQ_TO_EXPIO(irq);
158 /* unmask the interrupt */
159 __raw_writew(1 << expio, PBC_INTMASK_SET_REG);
160}
161
162static struct irq_chip expio_irq_chip = {
163 .ack = expio_ack_irq,
164 .mask = expio_mask_irq,
165 .unmask = expio_unmask_irq,
166};
167
168static void __init mx31ads_init_expio(void)
169{
170 int i;
171
172 printk(KERN_INFO "MX31ADS EXPIO(CPLD) hardware\n");
173
174 /*
175 * Configure INT line as GPIO input
176 */
177 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_GPIO1_4, IOMUX_CONFIG_GPIO));
178
179 /* disable the interrupt and clear the status */
180 __raw_writew(0xFFFF, PBC_INTMASK_CLEAR_REG);
181 __raw_writew(0xFFFF, PBC_INTSTATUS_REG);
182 for (i = MXC_EXP_IO_BASE; i < (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES);
183 i++) {
184 set_irq_chip(i, &expio_irq_chip);
185 set_irq_handler(i, handle_level_irq);
186 set_irq_flags(i, IRQF_VALID);
187 }
188 set_irq_type(EXPIO_PARENT_INT, IRQ_TYPE_LEVEL_HIGH);
189 set_irq_chained_handler(EXPIO_PARENT_INT, mx31ads_expio_irq_handler);
190}
191
87/*! 192/*!
88 * This structure defines static mappings for the i.MX31ADS board. 193 * This structure defines static mappings for the i.MX31ADS board.
89 */ 194 */
@@ -120,12 +225,19 @@ void __init mx31ads_map_io(void)
120 iotable_init(mx31ads_io_desc, ARRAY_SIZE(mx31ads_io_desc)); 225 iotable_init(mx31ads_io_desc, ARRAY_SIZE(mx31ads_io_desc));
121} 226}
122 227
228void __init mx31ads_init_irq(void)
229{
230 mxc_init_irq();
231 mx31ads_init_expio();
232}
233
123/*! 234/*!
124 * Board specific initialization. 235 * Board specific initialization.
125 */ 236 */
126static void __init mxc_board_init(void) 237static void __init mxc_board_init(void)
127{ 238{
128 mxc_init_extuart(); 239 mxc_init_extuart();
240 mxc_init_imx_uart();
129} 241}
130 242
131static void __init mx31ads_timer_init(void) 243static void __init mx31ads_timer_init(void)
@@ -148,7 +260,7 @@ MACHINE_START(MX31ADS, "Freescale MX31ADS")
148 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc, 260 .io_pg_offst = ((AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
149 .boot_params = PHYS_OFFSET + 0x100, 261 .boot_params = PHYS_OFFSET + 0x100,
150 .map_io = mx31ads_map_io, 262 .map_io = mx31ads_map_io,
151 .init_irq = mxc_init_irq, 263 .init_irq = mx31ads_init_irq,
152 .init_machine = mxc_board_init, 264 .init_machine = mxc_board_init,
153 .timer = &mx31ads_timer, 265 .timer = &mx31ads_timer,
154MACHINE_END 266MACHINE_END
diff --git a/arch/arm/mach-mx3/pcm037.c b/arch/arm/mach-mx3/pcm037.c
index 0a152ed15a85..03374f9e0000 100644
--- a/arch/arm/mach-mx3/pcm037.c
+++ b/arch/arm/mach-mx3/pcm037.c
@@ -33,6 +33,8 @@
33#include <mach/iomux-mx3.h> 33#include <mach/iomux-mx3.h>
34#include <mach/board-pcm037.h> 34#include <mach/board-pcm037.h>
35 35
36#include "devices.h"
37
36static struct physmap_flash_data pcm037_flash_data = { 38static struct physmap_flash_data pcm037_flash_data = {
37 .width = 2, 39 .width = 2,
38}; 40};
@@ -73,12 +75,12 @@ static void __init mxc_board_init(void)
73 mxc_iomux_mode(MX31_PIN_TXD1__TXD1); 75 mxc_iomux_mode(MX31_PIN_TXD1__TXD1);
74 mxc_iomux_mode(MX31_PIN_RXD1__RXD1); 76 mxc_iomux_mode(MX31_PIN_RXD1__RXD1);
75 77
76 imx_init_uart(0, &uart_pdata); 78 mxc_register_device(&mxc_uart_device0, &uart_pdata);
77 79
78 mxc_iomux_mode(MX31_PIN_CSPI3_MOSI__RXD3); 80 mxc_iomux_mode(MX31_PIN_CSPI3_MOSI__RXD3);
79 mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3); 81 mxc_iomux_mode(MX31_PIN_CSPI3_MISO__TXD3);
80 82
81 imx_init_uart(2, &uart_pdata); 83 mxc_register_device(&mxc_uart_device2, &uart_pdata);
82} 84}
83 85
84/* 86/*