aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2012-01-24 17:13:00 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-02-09 10:34:14 -0500
commit92e617d9e6f148b8301968c8b78e3cbc7bd5172e (patch)
tree7a250f426609cc15cc33d9c90cb222cf28e3413e
parent6ad1b614007c556129989b9f6b020d0d2e058121 (diff)
ARM: sa11x0: neponset: shuffle some code around
Move the IRQ handler along side the rest of the IRQ code, and rearrange the include files. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/mach-sa1100/neponset.c202
1 files changed, 101 insertions, 101 deletions
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 10be07e2bd56..8fcd542d46f7 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -2,24 +2,24 @@
2 * linux/arch/arm/mach-sa1100/neponset.c 2 * linux/arch/arm/mach-sa1100/neponset.c
3 * 3 *
4 */ 4 */
5#include <linux/kernel.h>
6#include <linux/init.h> 5#include <linux/init.h>
7#include <linux/tty.h>
8#include <linux/ioport.h> 6#include <linux/ioport.h>
9#include <linux/serial_core.h> 7#include <linux/kernel.h>
10#include <linux/platform_device.h> 8#include <linux/platform_device.h>
9#include <linux/serial_core.h>
11 10
12#include <mach/hardware.h>
13#include <asm/mach-types.h> 11#include <asm/mach-types.h>
14#include <asm/irq.h> 12#include <asm/irq.h>
15#include <asm/mach/map.h> 13#include <asm/mach/map.h>
16#include <asm/mach/irq.h> 14#include <asm/mach/irq.h>
17#include <asm/mach/serial_sa1100.h> 15#include <asm/mach/serial_sa1100.h>
18#include <mach/assabet.h>
19#include <mach/neponset.h>
20#include <asm/hardware/sa1111.h> 16#include <asm/hardware/sa1111.h>
21#include <asm/sizes.h> 17#include <asm/sizes.h>
22 18
19#include <mach/hardware.h>
20#include <mach/assabet.h>
21#include <mach/neponset.h>
22
23void neponset_ncr_frob(unsigned int mask, unsigned int val) 23void neponset_ncr_frob(unsigned int mask, unsigned int val)
24{ 24{
25 unsigned long flags; 25 unsigned long flags;
@@ -29,6 +29,64 @@ void neponset_ncr_frob(unsigned int mask, unsigned int val)
29 local_irq_restore(flags); 29 local_irq_restore(flags);
30} 30}
31 31
32static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
33{
34 u_int mdm_ctl0 = MDM_CTL_0;
35
36 if (port->mapbase == _Ser1UTCR0) {
37 if (mctrl & TIOCM_RTS)
38 mdm_ctl0 &= ~MDM_CTL0_RTS2;
39 else
40 mdm_ctl0 |= MDM_CTL0_RTS2;
41
42 if (mctrl & TIOCM_DTR)
43 mdm_ctl0 &= ~MDM_CTL0_DTR2;
44 else
45 mdm_ctl0 |= MDM_CTL0_DTR2;
46 } else if (port->mapbase == _Ser3UTCR0) {
47 if (mctrl & TIOCM_RTS)
48 mdm_ctl0 &= ~MDM_CTL0_RTS1;
49 else
50 mdm_ctl0 |= MDM_CTL0_RTS1;
51
52 if (mctrl & TIOCM_DTR)
53 mdm_ctl0 &= ~MDM_CTL0_DTR1;
54 else
55 mdm_ctl0 |= MDM_CTL0_DTR1;
56 }
57
58 MDM_CTL_0 = mdm_ctl0;
59}
60
61static u_int neponset_get_mctrl(struct uart_port *port)
62{
63 u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
64 u_int mdm_ctl1 = MDM_CTL_1;
65
66 if (port->mapbase == _Ser1UTCR0) {
67 if (mdm_ctl1 & MDM_CTL1_DCD2)
68 ret &= ~TIOCM_CD;
69 if (mdm_ctl1 & MDM_CTL1_CTS2)
70 ret &= ~TIOCM_CTS;
71 if (mdm_ctl1 & MDM_CTL1_DSR2)
72 ret &= ~TIOCM_DSR;
73 } else if (port->mapbase == _Ser3UTCR0) {
74 if (mdm_ctl1 & MDM_CTL1_DCD1)
75 ret &= ~TIOCM_CD;
76 if (mdm_ctl1 & MDM_CTL1_CTS1)
77 ret &= ~TIOCM_CTS;
78 if (mdm_ctl1 & MDM_CTL1_DSR1)
79 ret &= ~TIOCM_DSR;
80 }
81
82 return ret;
83}
84
85static struct sa1100_port_fns neponset_port_fns __devinitdata = {
86 .set_mctrl = neponset_set_mctrl,
87 .get_mctrl = neponset_get_mctrl,
88};
89
32/* 90/*
33 * Install handler for Neponset IRQ. Note that we have to loop here 91 * Install handler for Neponset IRQ. Note that we have to loop here
34 * since the ETHERNET and USAR IRQs are level based, and we need to 92 * since the ETHERNET and USAR IRQs are level based, and we need to
@@ -89,64 +147,6 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
89 } 147 }
90} 148}
91 149
92static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
93{
94 u_int mdm_ctl0 = MDM_CTL_0;
95
96 if (port->mapbase == _Ser1UTCR0) {
97 if (mctrl & TIOCM_RTS)
98 mdm_ctl0 &= ~MDM_CTL0_RTS2;
99 else
100 mdm_ctl0 |= MDM_CTL0_RTS2;
101
102 if (mctrl & TIOCM_DTR)
103 mdm_ctl0 &= ~MDM_CTL0_DTR2;
104 else
105 mdm_ctl0 |= MDM_CTL0_DTR2;
106 } else if (port->mapbase == _Ser3UTCR0) {
107 if (mctrl & TIOCM_RTS)
108 mdm_ctl0 &= ~MDM_CTL0_RTS1;
109 else
110 mdm_ctl0 |= MDM_CTL0_RTS1;
111
112 if (mctrl & TIOCM_DTR)
113 mdm_ctl0 &= ~MDM_CTL0_DTR1;
114 else
115 mdm_ctl0 |= MDM_CTL0_DTR1;
116 }
117
118 MDM_CTL_0 = mdm_ctl0;
119}
120
121static u_int neponset_get_mctrl(struct uart_port *port)
122{
123 u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
124 u_int mdm_ctl1 = MDM_CTL_1;
125
126 if (port->mapbase == _Ser1UTCR0) {
127 if (mdm_ctl1 & MDM_CTL1_DCD2)
128 ret &= ~TIOCM_CD;
129 if (mdm_ctl1 & MDM_CTL1_CTS2)
130 ret &= ~TIOCM_CTS;
131 if (mdm_ctl1 & MDM_CTL1_DSR2)
132 ret &= ~TIOCM_DSR;
133 } else if (port->mapbase == _Ser3UTCR0) {
134 if (mdm_ctl1 & MDM_CTL1_DCD1)
135 ret &= ~TIOCM_CD;
136 if (mdm_ctl1 & MDM_CTL1_CTS1)
137 ret &= ~TIOCM_CTS;
138 if (mdm_ctl1 & MDM_CTL1_DSR1)
139 ret &= ~TIOCM_DSR;
140 }
141
142 return ret;
143}
144
145static struct sa1100_port_fns neponset_port_fns __devinitdata = {
146 .set_mctrl = neponset_set_mctrl,
147 .get_mctrl = neponset_get_mctrl,
148};
149
150/* 150/*
151 * Yes, we really do not have any kind of masking or unmasking 151 * Yes, we really do not have any kind of masking or unmasking
152 */ 152 */
@@ -161,6 +161,43 @@ static struct irq_chip nochip = {
161 .irq_unmask = nochip_noop, 161 .irq_unmask = nochip_noop,
162}; 162};
163 163
164static struct resource sa1111_resources[] = {
165 [0] = DEFINE_RES_MEM(0x40000000, SZ_8K),
166 [1] = DEFINE_RES_IRQ(IRQ_NEPONSET_SA1111),
167};
168
169static struct sa1111_platform_data sa1111_info = {
170 .irq_base = IRQ_BOARD_END,
171};
172
173static u64 sa1111_dmamask = 0xffffffffUL;
174
175static struct platform_device sa1111_device = {
176 .name = "sa1111",
177 .id = 0,
178 .dev = {
179 .dma_mask = &sa1111_dmamask,
180 .coherent_dma_mask = 0xffffffff,
181 .platform_data = &sa1111_info,
182 },
183 .num_resources = ARRAY_SIZE(sa1111_resources),
184 .resource = sa1111_resources,
185};
186
187static struct resource smc91x_resources[] = {
188 [0] = DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS, 0x02000000, "smc91x-regs"),
189 [1] = DEFINE_RES_IRQ(IRQ_NEPONSET_SMC9196),
190 [2] = DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS + 0x02000000,
191 0x02000000, "smc91x-attrib"),
192};
193
194static struct platform_device smc91x_device = {
195 .name = "smc91x",
196 .id = 0,
197 .num_resources = ARRAY_SIZE(smc91x_resources),
198 .resource = smc91x_resources,
199};
200
164static int __devinit neponset_probe(struct platform_device *dev) 201static int __devinit neponset_probe(struct platform_device *dev)
165{ 202{
166 sa1100_register_uart_fns(&neponset_port_fns); 203 sa1100_register_uart_fns(&neponset_port_fns);
@@ -249,43 +286,6 @@ static struct platform_device neponset_device = {
249 .resource = neponset_resources, 286 .resource = neponset_resources,
250}; 287};
251 288
252static struct resource sa1111_resources[] = {
253 [0] = DEFINE_RES_MEM(0x40000000, SZ_8K),
254 [1] = DEFINE_RES_IRQ(IRQ_NEPONSET_SA1111),
255};
256
257static struct sa1111_platform_data sa1111_info = {
258 .irq_base = IRQ_BOARD_END,
259};
260
261static u64 sa1111_dmamask = 0xffffffffUL;
262
263static struct platform_device sa1111_device = {
264 .name = "sa1111",
265 .id = 0,
266 .dev = {
267 .dma_mask = &sa1111_dmamask,
268 .coherent_dma_mask = 0xffffffff,
269 .platform_data = &sa1111_info,
270 },
271 .num_resources = ARRAY_SIZE(sa1111_resources),
272 .resource = sa1111_resources,
273};
274
275static struct resource smc91x_resources[] = {
276 [0] = DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS, 0x02000000, "smc91x-regs"),
277 [1] = DEFINE_RES_IRQ(IRQ_NEPONSET_SMC9196),
278 [2] = DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS + 0x02000000,
279 0x02000000, "smc91x-attrib"),
280};
281
282static struct platform_device smc91x_device = {
283 .name = "smc91x",
284 .id = 0,
285 .num_resources = ARRAY_SIZE(smc91x_resources),
286 .resource = smc91x_resources,
287};
288
289static struct platform_device *devices[] __initdata = { 289static struct platform_device *devices[] __initdata = {
290 &neponset_device, 290 &neponset_device,
291 &sa1111_device, 291 &sa1111_device,