diff options
author | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 02:41:24 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2006-09-27 02:41:24 -0400 |
commit | 373e68b5472d421cbd2703e7a77caf053f78c005 (patch) | |
tree | 6fed51fdf1b89f80a1ec9ea4aab285c1af649945 /arch/sh/boards/snapgear | |
parent | f647d33f879d258de4ab2559975bd6eebda2033e (diff) |
sh: Board updates for I/O routine rework.
This updates the various boards for some of the recent I/O routine
updates.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards/snapgear')
-rw-r--r-- | arch/sh/boards/snapgear/io.c | 63 | ||||
-rw-r--r-- | arch/sh/boards/snapgear/rtc.c | 3 | ||||
-rw-r--r-- | arch/sh/boards/snapgear/setup.c | 97 |
3 files changed, 11 insertions, 152 deletions
diff --git a/arch/sh/boards/snapgear/io.c b/arch/sh/boards/snapgear/io.c index e2eb78fc381d..9f700b8392bb 100644 --- a/arch/sh/boards/snapgear/io.c +++ b/arch/sh/boards/snapgear/io.c | |||
@@ -28,39 +28,26 @@ unsigned short secureedge5410_ioport; | |||
28 | /* | 28 | /* |
29 | * The SnapGear uses the built-in PCI controller (PCIC) | 29 | * The SnapGear uses the built-in PCI controller (PCIC) |
30 | * of the 7751 processor | 30 | * of the 7751 processor |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR) | 33 | #define PCIIOBR (volatile long *)PCI_REG(SH7751_PCIIOBR) |
34 | #define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) | 34 | #define PCIMBR (volatile long *)PCI_REG(SH7751_PCIMBR) |
35 | #define PCI_IO_AREA SH7751_PCI_IO_BASE | 35 | #define PCI_IO_AREA SH7751_PCI_IO_BASE |
36 | #define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE | 36 | #define PCI_MEM_AREA SH7751_PCI_CONFIG_BASE |
37 | 37 | ||
38 | |||
39 | #define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) | 38 | #define PCI_IOMAP(adr) (PCI_IO_AREA + (adr & ~SH7751_PCIIOBR_MASK)) |
40 | 39 | ||
41 | |||
42 | #define maybebadio(name,port) \ | ||
43 | printk("bad PC-like io %s for port 0x%lx at 0x%08x\n", \ | ||
44 | #name, (port), (__u32) __builtin_return_address(0)) | ||
45 | |||
46 | |||
47 | static inline void delay(void) | 40 | static inline void delay(void) |
48 | { | 41 | { |
49 | ctrl_inw(0xa0000000); | 42 | ctrl_inw(0xa0000000); |
50 | } | 43 | } |
51 | 44 | ||
52 | |||
53 | static inline volatile __u16 *port2adr(unsigned int port) | 45 | static inline volatile __u16 *port2adr(unsigned int port) |
54 | { | 46 | { |
55 | #if 0 | 47 | maybebadio((unsigned long)port); |
56 | if (port >= 0x2000) | ||
57 | return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000)); | ||
58 | #endif | ||
59 | maybebadio(name,(unsigned long)port); | ||
60 | return (volatile __u16*)port; | 48 | return (volatile __u16*)port; |
61 | } | 49 | } |
62 | 50 | ||
63 | |||
64 | /* In case someone configures the kernel w/o PCI support: in that */ | 51 | /* In case someone configures the kernel w/o PCI support: in that */ |
65 | /* scenario, don't ever bother to check for PCI-window addresses */ | 52 | /* scenario, don't ever bother to check for PCI-window addresses */ |
66 | 53 | ||
@@ -115,7 +102,7 @@ unsigned short snapgear_inw(unsigned long port) | |||
115 | else if (port >= 0x2000) | 102 | else if (port >= 0x2000) |
116 | return *port2adr(port); | 103 | return *port2adr(port); |
117 | else | 104 | else |
118 | maybebadio(inw, port); | 105 | maybebadio(port); |
119 | return 0; | 106 | return 0; |
120 | } | 107 | } |
121 | 108 | ||
@@ -129,7 +116,7 @@ unsigned int snapgear_inl(unsigned long port) | |||
129 | else if (port >= 0x2000) | 116 | else if (port >= 0x2000) |
130 | return *port2adr(port); | 117 | return *port2adr(port); |
131 | else | 118 | else |
132 | maybebadio(inl, port); | 119 | maybebadio(port); |
133 | return 0; | 120 | return 0; |
134 | } | 121 | } |
135 | 122 | ||
@@ -167,7 +154,7 @@ void snapgear_outw(unsigned short value, unsigned long port) | |||
167 | else if (port >= 0x2000) | 154 | else if (port >= 0x2000) |
168 | *port2adr(port) = value; | 155 | *port2adr(port) = value; |
169 | else | 156 | else |
170 | maybebadio(outw, port); | 157 | maybebadio(port); |
171 | } | 158 | } |
172 | 159 | ||
173 | 160 | ||
@@ -178,49 +165,15 @@ void snapgear_outl(unsigned int value, unsigned long port) | |||
178 | else if (CHECK_SH7751_PCIIO(port)) | 165 | else if (CHECK_SH7751_PCIIO(port)) |
179 | *((unsigned long*)PCI_IOMAP(port)) = value; | 166 | *((unsigned long*)PCI_IOMAP(port)) = value; |
180 | else | 167 | else |
181 | maybebadio(outl, port); | 168 | maybebadio(port); |
182 | } | 169 | } |
183 | 170 | ||
184 | void snapgear_insl(unsigned long port, void *addr, unsigned long count) | 171 | void snapgear_insl(unsigned long port, void *addr, unsigned long count) |
185 | { | 172 | { |
186 | maybebadio(insl, port); | 173 | maybebadio(port); |
187 | } | 174 | } |
188 | 175 | ||
189 | void snapgear_outsl(unsigned long port, const void *addr, unsigned long count) | 176 | void snapgear_outsl(unsigned long port, const void *addr, unsigned long count) |
190 | { | 177 | { |
191 | maybebadio(outsw, port); | 178 | maybebadio(port); |
192 | } | ||
193 | |||
194 | /* Map ISA bus address to the real address. Only for PCMCIA. */ | ||
195 | |||
196 | |||
197 | /* ISA page descriptor. */ | ||
198 | static __u32 sh_isa_memmap[256]; | ||
199 | |||
200 | |||
201 | #if 0 | ||
202 | static int sh_isa_mmap(__u32 start, __u32 length, __u32 offset) | ||
203 | { | ||
204 | int idx; | ||
205 | |||
206 | if (start >= 0x100000 || (start & 0xfff) || (length != 0x1000)) | ||
207 | return -1; | ||
208 | |||
209 | idx = start >> 12; | ||
210 | sh_isa_memmap[idx] = 0xb8000000 + (offset &~ 0xfff); | ||
211 | #if 0 | ||
212 | printk("sh_isa_mmap: start %x len %x offset %x (idx %x paddr %x)\n", | ||
213 | start, length, offset, idx, sh_isa_memmap[idx]); | ||
214 | #endif | ||
215 | return 0; | ||
216 | } | ||
217 | #endif | ||
218 | |||
219 | unsigned long snapgear_isa_port2addr(unsigned long offset) | ||
220 | { | ||
221 | int idx; | ||
222 | |||
223 | idx = (offset >> 12) & 0xff; | ||
224 | offset &= 0xfff; | ||
225 | return sh_isa_memmap[idx] + offset; | ||
226 | } | 179 | } |
diff --git a/arch/sh/boards/snapgear/rtc.c b/arch/sh/boards/snapgear/rtc.c index b71e009da35c..287bc4ed3ac7 100644 --- a/arch/sh/boards/snapgear/rtc.c +++ b/arch/sh/boards/snapgear/rtc.c | |||
@@ -17,10 +17,7 @@ | |||
17 | #include <linux/time.h> | 17 | #include <linux/time.h> |
18 | #include <linux/rtc.h> | 18 | #include <linux/rtc.h> |
19 | #include <linux/mc146818rtc.h> | 19 | #include <linux/mc146818rtc.h> |
20 | |||
21 | #include <asm/io.h> | 20 | #include <asm/io.h> |
22 | #include <asm/rtc.h> | ||
23 | #include <asm/mc146818rtc.h> | ||
24 | 21 | ||
25 | /****************************************************************************/ | 22 | /****************************************************************************/ |
26 | 23 | ||
diff --git a/arch/sh/boards/snapgear/setup.c b/arch/sh/boards/snapgear/setup.c index f1f7c70c9402..66ce32f8b13c 100644 --- a/arch/sh/boards/snapgear/setup.c +++ b/arch/sh/boards/snapgear/setup.c | |||
@@ -1,5 +1,4 @@ | |||
1 | /****************************************************************************/ | 1 | /* |
2 | /* | ||
3 | * linux/arch/sh/boards/snapgear/setup.c | 2 | * linux/arch/sh/boards/snapgear/setup.c |
4 | * | 3 | * |
5 | * Copyright (C) 2002 David McCullough <davidm@snapgear.com> | 4 | * Copyright (C) 2002 David McCullough <davidm@snapgear.com> |
@@ -12,8 +11,6 @@ | |||
12 | * Modified for 7751 Solution Engine by | 11 | * Modified for 7751 Solution Engine by |
13 | * Ian da Silva and Jeremy Siegel, 2001. | 12 | * Ian da Silva and Jeremy Siegel, 2001. |
14 | */ | 13 | */ |
15 | /****************************************************************************/ | ||
16 | |||
17 | #include <linux/init.h> | 14 | #include <linux/init.h> |
18 | #include <linux/irq.h> | 15 | #include <linux/irq.h> |
19 | #include <linux/interrupt.h> | 16 | #include <linux/interrupt.h> |
@@ -21,14 +18,13 @@ | |||
21 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
22 | #include <linux/module.h> | 19 | #include <linux/module.h> |
23 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
24 | |||
25 | #include <asm/machvec.h> | 21 | #include <asm/machvec.h> |
26 | #include <asm/mach/io.h> | 22 | #include <asm/snapgear.h> |
27 | #include <asm/irq.h> | 23 | #include <asm/irq.h> |
28 | #include <asm/io.h> | 24 | #include <asm/io.h> |
25 | #include <asm/rtc.h> | ||
29 | #include <asm/cpu/timer.h> | 26 | #include <asm/cpu/timer.h> |
30 | 27 | ||
31 | extern void (*board_time_init)(void); | ||
32 | extern void secureedge5410_rtc_init(void); | 28 | extern void secureedge5410_rtc_init(void); |
33 | extern void pcibios_init(void); | 29 | extern void pcibios_init(void); |
34 | 30 | ||
@@ -85,91 +81,6 @@ static void __init init_snapgear_IRQ(void) | |||
85 | make_ipr_irq(IRL3_IRQ, IRL3_IPR_ADDR, IRL3_IPR_POS, IRL3_PRIORITY); | 81 | make_ipr_irq(IRL3_IRQ, IRL3_IPR_ADDR, IRL3_IPR_POS, IRL3_PRIORITY); |
86 | } | 82 | } |
87 | 83 | ||
88 | /****************************************************************************/ | ||
89 | /* | ||
90 | * Fast poll interrupt simulator. | ||
91 | */ | ||
92 | |||
93 | /* | ||
94 | * Leave all of the fast timer/fast poll stuff commented out for now, since | ||
95 | * it's not clear whether it actually works or not. Since it wasn't being used | ||
96 | * at all in 2.4, we'll assume it's not sane for 2.6 either.. -- PFM | ||
97 | */ | ||
98 | #if 0 | ||
99 | #define FAST_POLL 1000 | ||
100 | //#define FAST_POLL_INTR | ||
101 | |||
102 | #define FASTTIMER_IRQ 17 | ||
103 | #define FASTTIMER_IPR_ADDR INTC_IPRA | ||
104 | #define FASTTIMER_IPR_POS 2 | ||
105 | #define FASTTIMER_PRIORITY 3 | ||
106 | |||
107 | #ifdef FAST_POLL_INTR | ||
108 | #define TMU1_TCR_INIT 0x0020 | ||
109 | #else | ||
110 | #define TMU1_TCR_INIT 0 | ||
111 | #endif | ||
112 | #define TMU_TSTR_INIT 1 | ||
113 | #define TMU1_TCR_CALIB 0x0000 | ||
114 | |||
115 | |||
116 | #ifdef FAST_POLL_INTR | ||
117 | static void fast_timer_irq(int irq, void *dev_instance, struct pt_regs *regs) | ||
118 | { | ||
119 | unsigned long timer_status; | ||
120 | timer_status = ctrl_inw(TMU1_TCR); | ||
121 | timer_status &= ~0x100; | ||
122 | ctrl_outw(timer_status, TMU1_TCR); | ||
123 | } | ||
124 | #endif | ||
125 | |||
126 | /* | ||
127 | * return the current ticks on the fast timer | ||
128 | */ | ||
129 | |||
130 | unsigned long fast_timer_count(void) | ||
131 | { | ||
132 | return(ctrl_inl(TMU1_TCNT)); | ||
133 | } | ||
134 | |||
135 | /* | ||
136 | * setup a fast timer for profiling etc etc | ||
137 | */ | ||
138 | |||
139 | static void setup_fast_timer() | ||
140 | { | ||
141 | unsigned long interval; | ||
142 | |||
143 | #ifdef FAST_POLL_INTR | ||
144 | interval = (current_cpu_data.module_clock/4 + FAST_POLL/2) / FAST_POLL; | ||
145 | |||
146 | make_ipr_irq(FASTTIMER_IRQ, FASTTIMER_IPR_ADDR, FASTTIMER_IPR_POS, | ||
147 | FASTTIMER_PRIORITY); | ||
148 | |||
149 | printk("SnapGear: %dHz fast timer on IRQ %d\n",FAST_POLL,FASTTIMER_IRQ); | ||
150 | |||
151 | if (request_irq(FASTTIMER_IRQ, fast_timer_irq, 0, "SnapGear fast timer", | ||
152 | NULL) != 0) | ||
153 | printk("%s(%d): request_irq() failed?\n", __FILE__, __LINE__); | ||
154 | #else | ||
155 | printk("SnapGear: fast timer running\n",FAST_POLL,FASTTIMER_IRQ); | ||
156 | interval = 0xffffffff; | ||
157 | #endif | ||
158 | |||
159 | ctrl_outb(ctrl_inb(TMU_TSTR) & ~0x2, TMU_TSTR); /* disable timer 1 */ | ||
160 | ctrl_outw(TMU1_TCR_INIT, TMU1_TCR); | ||
161 | ctrl_outl(interval, TMU1_TCOR); | ||
162 | ctrl_outl(interval, TMU1_TCNT); | ||
163 | ctrl_outb(ctrl_inb(TMU_TSTR) | 0x2, TMU_TSTR); /* enable timer 1 */ | ||
164 | |||
165 | printk("Timer count 1 = 0x%x\n", fast_timer_count()); | ||
166 | udelay(1000); | ||
167 | printk("Timer count 2 = 0x%x\n", fast_timer_count()); | ||
168 | } | ||
169 | #endif | ||
170 | |||
171 | /****************************************************************************/ | ||
172 | |||
173 | const char *get_system_type(void) | 84 | const char *get_system_type(void) |
174 | { | 85 | { |
175 | return "SnapGear SecureEdge5410"; | 86 | return "SnapGear SecureEdge5410"; |
@@ -196,8 +107,6 @@ struct sh_machine_vector mv_snapgear __initmv = { | |||
196 | .mv_outw_p = snapgear_outw, | 107 | .mv_outw_p = snapgear_outw, |
197 | .mv_outl_p = snapgear_outl, | 108 | .mv_outl_p = snapgear_outl, |
198 | 109 | ||
199 | .mv_isa_port2addr = snapgear_isa_port2addr, | ||
200 | |||
201 | .mv_init_irq = init_snapgear_IRQ, | 110 | .mv_init_irq = init_snapgear_IRQ, |
202 | }; | 111 | }; |
203 | ALIAS_MV(snapgear) | 112 | ALIAS_MV(snapgear) |