aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/m68k/amiga/config.c1076
-rw-r--r--arch/m68k/atari/config.c989
-rw-r--r--arch/m68k/atari/debug.c474
-rw-r--r--arch/m68k/kernel/entry.S2
-rw-r--r--arch/m68k/kernel/head.S2
-rw-r--r--arch/m68k/kernel/setup.c371
-rw-r--r--arch/m68k/mac/config.c161
-rw-r--r--arch/m68k/mac/debug.c323
-rw-r--r--arch/m68k/q40/config.c265
-rw-r--r--arch/m68k/sun3x/prom.c127
10 files changed, 1865 insertions, 1925 deletions
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 3204f412cad8..c3b69b1b0cef 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -22,9 +22,7 @@
22#include <linux/vt_kern.h> 22#include <linux/vt_kern.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#ifdef CONFIG_ZORRO
26#include <linux/zorro.h> 25#include <linux/zorro.h>
27#endif
28 26
29#include <asm/bootinfo.h> 27#include <asm/bootinfo.h>
30#include <asm/setup.h> 28#include <asm/setup.h>
@@ -62,21 +60,21 @@ static char s_cdtv[] __initdata = "CDTV";
62static char s_cd32[] __initdata = "CD32"; 60static char s_cd32[] __initdata = "CD32";
63static char s_draco[] __initdata = "Draco"; 61static char s_draco[] __initdata = "Draco";
64static char *amiga_models[] __initdata = { 62static char *amiga_models[] __initdata = {
65 [AMI_500-AMI_500] = s_a500, 63 [AMI_500-AMI_500] = s_a500,
66 [AMI_500PLUS-AMI_500] = s_a500p, 64 [AMI_500PLUS-AMI_500] = s_a500p,
67 [AMI_600-AMI_500] = s_a600, 65 [AMI_600-AMI_500] = s_a600,
68 [AMI_1000-AMI_500] = s_a1000, 66 [AMI_1000-AMI_500] = s_a1000,
69 [AMI_1200-AMI_500] = s_a1200, 67 [AMI_1200-AMI_500] = s_a1200,
70 [AMI_2000-AMI_500] = s_a2000, 68 [AMI_2000-AMI_500] = s_a2000,
71 [AMI_2500-AMI_500] = s_a2500, 69 [AMI_2500-AMI_500] = s_a2500,
72 [AMI_3000-AMI_500] = s_a3000, 70 [AMI_3000-AMI_500] = s_a3000,
73 [AMI_3000T-AMI_500] = s_a3000t, 71 [AMI_3000T-AMI_500] = s_a3000t,
74 [AMI_3000PLUS-AMI_500] = s_a3000p, 72 [AMI_3000PLUS-AMI_500] = s_a3000p,
75 [AMI_4000-AMI_500] = s_a4000, 73 [AMI_4000-AMI_500] = s_a4000,
76 [AMI_4000T-AMI_500] = s_a4000t, 74 [AMI_4000T-AMI_500] = s_a4000t,
77 [AMI_CDTV-AMI_500] = s_cdtv, 75 [AMI_CDTV-AMI_500] = s_cdtv,
78 [AMI_CD32-AMI_500] = s_cd32, 76 [AMI_CD32-AMI_500] = s_cd32,
79 [AMI_DRACO-AMI_500] = s_draco, 77 [AMI_DRACO-AMI_500] = s_draco,
80}; 78};
81 79
82static char amiga_model_name[13] = "Amiga "; 80static char amiga_model_name[13] = "Amiga ";
@@ -85,17 +83,17 @@ extern char m68k_debug_device[];
85 83
86static void amiga_sched_init(irq_handler_t handler); 84static void amiga_sched_init(irq_handler_t handler);
87/* amiga specific irq functions */ 85/* amiga specific irq functions */
88extern void amiga_init_IRQ (void); 86extern void amiga_init_IRQ(void);
89static void amiga_get_model(char *model); 87static void amiga_get_model(char *model);
90static int amiga_get_hardware_list(char *buffer); 88static int amiga_get_hardware_list(char *buffer);
91/* amiga specific timer functions */ 89/* amiga specific timer functions */
92static unsigned long amiga_gettimeoffset (void); 90static unsigned long amiga_gettimeoffset(void);
93static int a3000_hwclk (int, struct rtc_time *); 91static int a3000_hwclk(int, struct rtc_time *);
94static int a2000_hwclk (int, struct rtc_time *); 92static int a2000_hwclk(int, struct rtc_time *);
95static int amiga_set_clock_mmss (unsigned long); 93static int amiga_set_clock_mmss(unsigned long);
96static unsigned int amiga_get_ss (void); 94static unsigned int amiga_get_ss(void);
97extern void amiga_mksound( unsigned int count, unsigned int ticks ); 95extern void amiga_mksound(unsigned int count, unsigned int ticks);
98static void amiga_reset (void); 96static void amiga_reset(void);
99extern void amiga_init_sound(void); 97extern void amiga_init_sound(void);
100static void amiga_savekmsg_init(void); 98static void amiga_savekmsg_init(void);
101static void amiga_mem_console_write(struct console *co, const char *b, 99static void amiga_mem_console_write(struct console *co, const char *b,
@@ -108,9 +106,9 @@ static void amiga_heartbeat(int on);
108#endif 106#endif
109 107
110static struct console amiga_console_driver = { 108static struct console amiga_console_driver = {
111 .name = "debug", 109 .name = "debug",
112 .flags = CON_PRINTBUFFER, 110 .flags = CON_PRINTBUFFER,
113 .index = -1, 111 .index = -1,
114}; 112};
115 113
116 114
@@ -119,24 +117,24 @@ static struct console amiga_console_driver = {
119 */ 117 */
120 118
121static struct { 119static struct {
122 struct resource _ciab, _ciaa, _custom, _kickstart; 120 struct resource _ciab, _ciaa, _custom, _kickstart;
123} mb_resources = { 121} mb_resources = {
124 ._ciab = { 122 ._ciab = {
125 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff 123 .name = "CIA B", .start = 0x00bfd000, .end = 0x00bfdfff
126 }, 124 },
127 ._ciaa = { 125 ._ciaa = {
128 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff 126 .name = "CIA A", .start = 0x00bfe000, .end = 0x00bfefff
129 }, 127 },
130 ._custom = { 128 ._custom = {
131 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff 129 .name = "Custom I/O", .start = 0x00dff000, .end = 0x00dfffff
132 }, 130 },
133 ._kickstart = { 131 ._kickstart = {
134 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff 132 .name = "Kickstart ROM", .start = 0x00f80000, .end = 0x00ffffff
135 } 133 }
136}; 134};
137 135
138static struct resource rtc_resource = { 136static struct resource rtc_resource = {
139 .start = 0x00dc0000, .end = 0x00dcffff 137 .start = 0x00dc0000, .end = 0x00dcffff
140}; 138};
141 139
142static struct resource ram_resource[NUM_MEMINFO]; 140static struct resource ram_resource[NUM_MEMINFO];
@@ -148,57 +146,57 @@ static struct resource ram_resource[NUM_MEMINFO];
148 146
149int amiga_parse_bootinfo(const struct bi_record *record) 147int amiga_parse_bootinfo(const struct bi_record *record)
150{ 148{
151 int unknown = 0; 149 int unknown = 0;
152 const unsigned long *data = record->data; 150 const unsigned long *data = record->data;
153 151
154 switch (record->tag) { 152 switch (record->tag) {
155 case BI_AMIGA_MODEL: 153 case BI_AMIGA_MODEL:
156 amiga_model = *data; 154 amiga_model = *data;
157 break; 155 break;
158 156
159 case BI_AMIGA_ECLOCK: 157 case BI_AMIGA_ECLOCK:
160 amiga_eclock = *data; 158 amiga_eclock = *data;
161 break; 159 break;
162 160
163 case BI_AMIGA_CHIPSET: 161 case BI_AMIGA_CHIPSET:
164 amiga_chipset = *data; 162 amiga_chipset = *data;
165 break; 163 break;
166 164
167 case BI_AMIGA_CHIP_SIZE: 165 case BI_AMIGA_CHIP_SIZE:
168 amiga_chip_size = *(const int *)data; 166 amiga_chip_size = *(const int *)data;
169 break; 167 break;
170 168
171 case BI_AMIGA_VBLANK: 169 case BI_AMIGA_VBLANK:
172 amiga_vblank = *(const unsigned char *)data; 170 amiga_vblank = *(const unsigned char *)data;
173 break; 171 break;
174 172
175 case BI_AMIGA_PSFREQ: 173 case BI_AMIGA_PSFREQ:
176 amiga_psfreq = *(const unsigned char *)data; 174 amiga_psfreq = *(const unsigned char *)data;
177 break; 175 break;
178 176
179 case BI_AMIGA_AUTOCON: 177 case BI_AMIGA_AUTOCON:
180#ifdef CONFIG_ZORRO 178#ifdef CONFIG_ZORRO
181 if (zorro_num_autocon < ZORRO_NUM_AUTO) { 179 if (zorro_num_autocon < ZORRO_NUM_AUTO) {
182 const struct ConfigDev *cd = (struct ConfigDev *)data; 180 const struct ConfigDev *cd = (struct ConfigDev *)data;
183 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++]; 181 struct zorro_dev *dev = &zorro_autocon[zorro_num_autocon++];
184 dev->rom = cd->cd_Rom; 182 dev->rom = cd->cd_Rom;
185 dev->slotaddr = cd->cd_SlotAddr; 183 dev->slotaddr = cd->cd_SlotAddr;
186 dev->slotsize = cd->cd_SlotSize; 184 dev->slotsize = cd->cd_SlotSize;
187 dev->resource.start = (unsigned long)cd->cd_BoardAddr; 185 dev->resource.start = (unsigned long)cd->cd_BoardAddr;
188 dev->resource.end = dev->resource.start+cd->cd_BoardSize-1; 186 dev->resource.end = dev->resource.start + cd->cd_BoardSize - 1;
189 } else 187 } else
190 printk("amiga_parse_bootinfo: too many AutoConfig devices\n"); 188 printk("amiga_parse_bootinfo: too many AutoConfig devices\n");
191#endif /* CONFIG_ZORRO */ 189#endif /* CONFIG_ZORRO */
192 break; 190 break;
193 191
194 case BI_AMIGA_SERPER: 192 case BI_AMIGA_SERPER:
195 /* serial port period: ignored here */ 193 /* serial port period: ignored here */
196 break; 194 break;
197 195
198 default: 196 default:
199 unknown = 1; 197 unknown = 1;
200 } 198 }
201 return(unknown); 199 return unknown;
202} 200}
203 201
204 /* 202 /*
@@ -207,159 +205,159 @@ int amiga_parse_bootinfo(const struct bi_record *record)
207 205
208static void __init amiga_identify(void) 206static void __init amiga_identify(void)
209{ 207{
210 /* Fill in some default values, if necessary */ 208 /* Fill in some default values, if necessary */
211 if (amiga_eclock == 0) 209 if (amiga_eclock == 0)
212 amiga_eclock = 709379; 210 amiga_eclock = 709379;
213
214 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
215
216 printk("Amiga hardware found: ");
217 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
218 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
219 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
220 }
221
222 switch(amiga_model) {
223 case AMI_UNKNOWN:
224 goto Generic;
225
226 case AMI_600:
227 case AMI_1200:
228 AMIGAHW_SET(A1200_IDE);
229 AMIGAHW_SET(PCMCIA);
230 case AMI_500:
231 case AMI_500PLUS:
232 case AMI_1000:
233 case AMI_2000:
234 case AMI_2500:
235 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
236 goto Generic;
237
238 case AMI_3000:
239 case AMI_3000T:
240 AMIGAHW_SET(AMBER_FF);
241 AMIGAHW_SET(MAGIC_REKICK);
242 /* fall through */
243 case AMI_3000PLUS:
244 AMIGAHW_SET(A3000_SCSI);
245 AMIGAHW_SET(A3000_CLK);
246 AMIGAHW_SET(ZORRO3);
247 goto Generic;
248
249 case AMI_4000T:
250 AMIGAHW_SET(A4000_SCSI);
251 /* fall through */
252 case AMI_4000:
253 AMIGAHW_SET(A4000_IDE);
254 AMIGAHW_SET(A3000_CLK);
255 AMIGAHW_SET(ZORRO3);
256 goto Generic;
257
258 case AMI_CDTV:
259 case AMI_CD32:
260 AMIGAHW_SET(CD_ROM);
261 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
262 goto Generic;
263
264 Generic:
265 AMIGAHW_SET(AMI_VIDEO);
266 AMIGAHW_SET(AMI_BLITTER);
267 AMIGAHW_SET(AMI_AUDIO);
268 AMIGAHW_SET(AMI_FLOPPY);
269 AMIGAHW_SET(AMI_KEYBOARD);
270 AMIGAHW_SET(AMI_MOUSE);
271 AMIGAHW_SET(AMI_SERIAL);
272 AMIGAHW_SET(AMI_PARALLEL);
273 AMIGAHW_SET(CHIP_RAM);
274 AMIGAHW_SET(PAULA);
275
276 switch(amiga_chipset) {
277 case CS_OCS:
278 case CS_ECS:
279 case CS_AGA:
280 switch (amiga_custom.deniseid & 0xf) {
281 case 0x0c:
282 AMIGAHW_SET(DENISE_HR);
283 break;
284 case 0x08:
285 AMIGAHW_SET(LISA);
286 break;
287 }
288 break;
289 default:
290 AMIGAHW_SET(DENISE);
291 break;
292 }
293 switch ((amiga_custom.vposr>>8) & 0x7f) {
294 case 0x00:
295 AMIGAHW_SET(AGNUS_PAL);
296 break;
297 case 0x10:
298 AMIGAHW_SET(AGNUS_NTSC);
299 break;
300 case 0x20:
301 case 0x21:
302 AMIGAHW_SET(AGNUS_HR_PAL);
303 break;
304 case 0x30:
305 case 0x31:
306 AMIGAHW_SET(AGNUS_HR_NTSC);
307 break;
308 case 0x22:
309 case 0x23:
310 AMIGAHW_SET(ALICE_PAL);
311 break;
312 case 0x32:
313 case 0x33:
314 AMIGAHW_SET(ALICE_NTSC);
315 break;
316 }
317 AMIGAHW_SET(ZORRO);
318 break;
319
320 case AMI_DRACO:
321 panic("No support for Draco yet");
322
323 default:
324 panic("Unknown Amiga Model");
325 }
326 211
327#define AMIGAHW_ANNOUNCE(name, str) \ 212 memset(&amiga_hw_present, 0, sizeof(amiga_hw_present));
328 if (AMIGAHW_PRESENT(name)) \ 213
329 printk(str) 214 printk("Amiga hardware found: ");
330 215 if (amiga_model >= AMI_500 && amiga_model <= AMI_DRACO) {
331 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO "); 216 printk("[%s] ", amiga_models[amiga_model-AMI_500]);
332 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER "); 217 strcat(amiga_model_name, amiga_models[amiga_model-AMI_500]);
333 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF "); 218 }
334 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO "); 219
335 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY "); 220 switch (amiga_model) {
336 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI "); 221 case AMI_UNKNOWN:
337 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI "); 222 goto Generic;
338 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE "); 223
339 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE "); 224 case AMI_600:
340 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM "); 225 case AMI_1200:
341 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD "); 226 AMIGAHW_SET(A1200_IDE);
342 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE "); 227 AMIGAHW_SET(PCMCIA);
343 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL "); 228 case AMI_500:
344 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL "); 229 case AMI_500PLUS:
345 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK "); 230 case AMI_1000:
346 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK "); 231 case AMI_2000:
347 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM "); 232 case AMI_2500:
348 AMIGAHW_ANNOUNCE(PAULA, "PAULA "); 233 AMIGAHW_SET(A2000_CLK); /* Is this correct for all models? */
349 AMIGAHW_ANNOUNCE(DENISE, "DENISE "); 234 goto Generic;
350 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR "); 235
351 AMIGAHW_ANNOUNCE(LISA, "LISA "); 236 case AMI_3000:
352 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL "); 237 case AMI_3000T:
353 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC "); 238 AMIGAHW_SET(AMBER_FF);
354 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL "); 239 AMIGAHW_SET(MAGIC_REKICK);
355 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC "); 240 /* fall through */
356 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL "); 241 case AMI_3000PLUS:
357 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC "); 242 AMIGAHW_SET(A3000_SCSI);
358 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK "); 243 AMIGAHW_SET(A3000_CLK);
359 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA "); 244 AMIGAHW_SET(ZORRO3);
360 if (AMIGAHW_PRESENT(ZORRO)) 245 goto Generic;
361 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : ""); 246
362 printk("\n"); 247 case AMI_4000T:
248 AMIGAHW_SET(A4000_SCSI);
249 /* fall through */
250 case AMI_4000:
251 AMIGAHW_SET(A4000_IDE);
252 AMIGAHW_SET(A3000_CLK);
253 AMIGAHW_SET(ZORRO3);
254 goto Generic;
255
256 case AMI_CDTV:
257 case AMI_CD32:
258 AMIGAHW_SET(CD_ROM);
259 AMIGAHW_SET(A2000_CLK); /* Is this correct? */
260 goto Generic;
261
262 Generic:
263 AMIGAHW_SET(AMI_VIDEO);
264 AMIGAHW_SET(AMI_BLITTER);
265 AMIGAHW_SET(AMI_AUDIO);
266 AMIGAHW_SET(AMI_FLOPPY);
267 AMIGAHW_SET(AMI_KEYBOARD);
268 AMIGAHW_SET(AMI_MOUSE);
269 AMIGAHW_SET(AMI_SERIAL);
270 AMIGAHW_SET(AMI_PARALLEL);
271 AMIGAHW_SET(CHIP_RAM);
272 AMIGAHW_SET(PAULA);
273
274 switch (amiga_chipset) {
275 case CS_OCS:
276 case CS_ECS:
277 case CS_AGA:
278 switch (amiga_custom.deniseid & 0xf) {
279 case 0x0c:
280 AMIGAHW_SET(DENISE_HR);
281 break;
282 case 0x08:
283 AMIGAHW_SET(LISA);
284 break;
285 }
286 break;
287 default:
288 AMIGAHW_SET(DENISE);
289 break;
290 }
291 switch ((amiga_custom.vposr>>8) & 0x7f) {
292 case 0x00:
293 AMIGAHW_SET(AGNUS_PAL);
294 break;
295 case 0x10:
296 AMIGAHW_SET(AGNUS_NTSC);
297 break;
298 case 0x20:
299 case 0x21:
300 AMIGAHW_SET(AGNUS_HR_PAL);
301 break;
302 case 0x30:
303 case 0x31:
304 AMIGAHW_SET(AGNUS_HR_NTSC);
305 break;
306 case 0x22:
307 case 0x23:
308 AMIGAHW_SET(ALICE_PAL);
309 break;
310 case 0x32:
311 case 0x33:
312 AMIGAHW_SET(ALICE_NTSC);
313 break;
314 }
315 AMIGAHW_SET(ZORRO);
316 break;
317
318 case AMI_DRACO:
319 panic("No support for Draco yet");
320
321 default:
322 panic("Unknown Amiga Model");
323 }
324
325#define AMIGAHW_ANNOUNCE(name, str) \
326 if (AMIGAHW_PRESENT(name)) \
327 printk(str)
328
329 AMIGAHW_ANNOUNCE(AMI_VIDEO, "VIDEO ");
330 AMIGAHW_ANNOUNCE(AMI_BLITTER, "BLITTER ");
331 AMIGAHW_ANNOUNCE(AMBER_FF, "AMBER_FF ");
332 AMIGAHW_ANNOUNCE(AMI_AUDIO, "AUDIO ");
333 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "FLOPPY ");
334 AMIGAHW_ANNOUNCE(A3000_SCSI, "A3000_SCSI ");
335 AMIGAHW_ANNOUNCE(A4000_SCSI, "A4000_SCSI ");
336 AMIGAHW_ANNOUNCE(A1200_IDE, "A1200_IDE ");
337 AMIGAHW_ANNOUNCE(A4000_IDE, "A4000_IDE ");
338 AMIGAHW_ANNOUNCE(CD_ROM, "CD_ROM ");
339 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "KEYBOARD ");
340 AMIGAHW_ANNOUNCE(AMI_MOUSE, "MOUSE ");
341 AMIGAHW_ANNOUNCE(AMI_SERIAL, "SERIAL ");
342 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "PARALLEL ");
343 AMIGAHW_ANNOUNCE(A2000_CLK, "A2000_CLK ");
344 AMIGAHW_ANNOUNCE(A3000_CLK, "A3000_CLK ");
345 AMIGAHW_ANNOUNCE(CHIP_RAM, "CHIP_RAM ");
346 AMIGAHW_ANNOUNCE(PAULA, "PAULA ");
347 AMIGAHW_ANNOUNCE(DENISE, "DENISE ");
348 AMIGAHW_ANNOUNCE(DENISE_HR, "DENISE_HR ");
349 AMIGAHW_ANNOUNCE(LISA, "LISA ");
350 AMIGAHW_ANNOUNCE(AGNUS_PAL, "AGNUS_PAL ");
351 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "AGNUS_NTSC ");
352 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "AGNUS_HR_PAL ");
353 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "AGNUS_HR_NTSC ");
354 AMIGAHW_ANNOUNCE(ALICE_PAL, "ALICE_PAL ");
355 AMIGAHW_ANNOUNCE(ALICE_NTSC, "ALICE_NTSC ");
356 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "MAGIC_REKICK ");
357 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA ");
358 if (AMIGAHW_PRESENT(ZORRO))
359 printk("ZORRO%s ", AMIGAHW_PRESENT(ZORRO3) ? "3" : "");
360 printk("\n");
363 361
364#undef AMIGAHW_ANNOUNCE 362#undef AMIGAHW_ANNOUNCE
365} 363}
@@ -370,119 +368,117 @@ static void __init amiga_identify(void)
370 368
371void __init config_amiga(void) 369void __init config_amiga(void)
372{ 370{
373 int i; 371 int i;
374 372
375 amiga_debug_init(); 373 amiga_debug_init();
376 amiga_identify(); 374 amiga_identify();
377 375
378 /* Yuk, we don't have PCI memory */ 376 /* Yuk, we don't have PCI memory */
379 iomem_resource.name = "Memory"; 377 iomem_resource.name = "Memory";
380 for (i = 0; i < 4; i++) 378 for (i = 0; i < 4; i++)
381 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]); 379 request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
382 380
383 mach_sched_init = amiga_sched_init; 381 mach_sched_init = amiga_sched_init;
384 mach_init_IRQ = amiga_init_IRQ; 382 mach_init_IRQ = amiga_init_IRQ;
385 mach_get_model = amiga_get_model; 383 mach_get_model = amiga_get_model;
386 mach_get_hardware_list = amiga_get_hardware_list; 384 mach_get_hardware_list = amiga_get_hardware_list;
387 mach_gettimeoffset = amiga_gettimeoffset; 385 mach_gettimeoffset = amiga_gettimeoffset;
388 if (AMIGAHW_PRESENT(A3000_CLK)){ 386 if (AMIGAHW_PRESENT(A3000_CLK)) {
389 mach_hwclk = a3000_hwclk; 387 mach_hwclk = a3000_hwclk;
390 rtc_resource.name = "A3000 RTC"; 388 rtc_resource.name = "A3000 RTC";
391 request_resource(&iomem_resource, &rtc_resource); 389 request_resource(&iomem_resource, &rtc_resource);
392 } 390 } else /* if (AMIGAHW_PRESENT(A2000_CLK)) */ {
393 else{ /* if (AMIGAHW_PRESENT(A2000_CLK)) */ 391 mach_hwclk = a2000_hwclk;
394 mach_hwclk = a2000_hwclk; 392 rtc_resource.name = "A2000 RTC";
395 rtc_resource.name = "A2000 RTC"; 393 request_resource(&iomem_resource, &rtc_resource);
396 request_resource(&iomem_resource, &rtc_resource); 394 }
397 } 395
398 396 /*
399 mach_max_dma_address = 0xffffffff; /* 397 * default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
400 * default MAX_DMA=0xffffffff 398 * code will not be able to allocate any mem for transfers, unless we are
401 * on all machines. If we don't 399 * dealing with a Z2 mem only system. /Jes
402 * do so, the SCSI code will not 400 */
403 * be able to allocate any mem 401 mach_max_dma_address = 0xffffffff;
404 * for transfers, unless we are 402
405 * dealing with a Z2 mem only 403 mach_set_clock_mmss = amiga_set_clock_mmss;
406 * system. /Jes 404 mach_get_ss = amiga_get_ss;
407 */ 405 mach_reset = amiga_reset;
408
409 mach_set_clock_mmss = amiga_set_clock_mmss;
410 mach_get_ss = amiga_get_ss;
411 mach_reset = amiga_reset;
412#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 406#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
413 mach_beep = amiga_mksound; 407 mach_beep = amiga_mksound;
414#endif 408#endif
415 409
416#ifdef CONFIG_HEARTBEAT 410#ifdef CONFIG_HEARTBEAT
417 mach_heartbeat = amiga_heartbeat; 411 mach_heartbeat = amiga_heartbeat;
418#endif 412#endif
419 413
420 /* Fill in the clock values (based on the 700 kHz E-Clock) */ 414 /* Fill in the clock values (based on the 700 kHz E-Clock) */
421 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */ 415 amiga_masterclock = 40*amiga_eclock; /* 28 MHz */
422 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */ 416 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
423 417
424 /* clear all DMA bits */ 418 /* clear all DMA bits */
425 amiga_custom.dmacon = DMAF_ALL; 419 amiga_custom.dmacon = DMAF_ALL;
426 /* ensure that the DMA master bit is set */ 420 /* ensure that the DMA master bit is set */
427 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER; 421 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
428 422
429 /* don't use Z2 RAM as system memory on Z3 capable machines */ 423 /* don't use Z2 RAM as system memory on Z3 capable machines */
430 if (AMIGAHW_PRESENT(ZORRO3)) { 424 if (AMIGAHW_PRESENT(ZORRO3)) {
431 int i, j; 425 int i, j;
432 u32 disabled_z2mem = 0; 426 u32 disabled_z2mem = 0;
433 for (i = 0; i < m68k_num_memory; i++) 427
434 if (m68k_memory[i].addr < 16*1024*1024) { 428 for (i = 0; i < m68k_num_memory; i++) {
435 if (i == 0) { 429 if (m68k_memory[i].addr < 16*1024*1024) {
436 /* don't cut off the branch we're sitting on */ 430 if (i == 0) {
437 printk("Warning: kernel runs in Zorro II memory\n"); 431 /* don't cut off the branch we're sitting on */
438 continue; 432 printk("Warning: kernel runs in Zorro II memory\n");
433 continue;
434 }
435 disabled_z2mem += m68k_memory[i].size;
436 m68k_num_memory--;
437 for (j = i; j < m68k_num_memory; j++)
438 m68k_memory[j] = m68k_memory[j+1];
439 i--;
440 }
441 }
442 if (disabled_z2mem)
443 printk("%dK of Zorro II memory will not be used as system memory\n",
444 disabled_z2mem>>10);
445 }
446
447 /* request all RAM */
448 for (i = 0; i < m68k_num_memory; i++) {
449 ram_resource[i].name =
450 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
451 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
452 "16-bit Slow RAM";
453 ram_resource[i].start = m68k_memory[i].addr;
454 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
455 request_resource(&iomem_resource, &ram_resource[i]);
456 }
457
458 /* initialize chipram allocator */
459 amiga_chip_init();
460
461 /* debugging using chipram */
462 if (!strcmp(m68k_debug_device, "mem")) {
463 if (!AMIGAHW_PRESENT(CHIP_RAM))
464 printk("Warning: no chipram present for debugging\n");
465 else {
466 amiga_savekmsg_init();
467 amiga_console_driver.write = amiga_mem_console_write;
468 register_console(&amiga_console_driver);
469 }
439 } 470 }
440 disabled_z2mem += m68k_memory[i].size; 471
441 m68k_num_memory--; 472 /* our beloved beeper */
442 for (j = i; j < m68k_num_memory; j++) 473 if (AMIGAHW_PRESENT(AMI_AUDIO))
443 m68k_memory[j] = m68k_memory[j+1]; 474 amiga_init_sound();
444 i--; 475
445 } 476 /*
446 if (disabled_z2mem) 477 * if it is an A3000, set the magic bit that forces
447 printk("%dK of Zorro II memory will not be used as system memory\n", 478 * a hard rekick
448 disabled_z2mem>>10); 479 */
449 } 480 if (AMIGAHW_PRESENT(MAGIC_REKICK))
450 481 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
451 /* request all RAM */
452 for (i = 0; i < m68k_num_memory; i++) {
453 ram_resource[i].name =
454 (m68k_memory[i].addr >= 0x01000000) ? "32-bit Fast RAM" :
455 (m68k_memory[i].addr < 0x00c00000) ? "16-bit Fast RAM" :
456 "16-bit Slow RAM";
457 ram_resource[i].start = m68k_memory[i].addr;
458 ram_resource[i].end = m68k_memory[i].addr+m68k_memory[i].size-1;
459 request_resource(&iomem_resource, &ram_resource[i]);
460 }
461
462 /* initialize chipram allocator */
463 amiga_chip_init ();
464
465 /* debugging using chipram */
466 if (!strcmp( m68k_debug_device, "mem" )){
467 if (!AMIGAHW_PRESENT(CHIP_RAM))
468 printk("Warning: no chipram present for debugging\n");
469 else {
470 amiga_savekmsg_init();
471 amiga_console_driver.write = amiga_mem_console_write;
472 register_console(&amiga_console_driver);
473 }
474 }
475
476 /* our beloved beeper */
477 if (AMIGAHW_PRESENT(AMI_AUDIO))
478 amiga_init_sound();
479
480 /*
481 * if it is an A3000, set the magic bit that forces
482 * a hard rekick
483 */
484 if (AMIGAHW_PRESENT(MAGIC_REKICK))
485 *(unsigned char *)ZTWO_VADDR(0xde0002) |= 0x80;
486} 482}
487 483
488static unsigned short jiffy_ticks; 484static unsigned short jiffy_ticks;
@@ -490,12 +486,12 @@ static unsigned short jiffy_ticks;
490static void __init amiga_sched_init(irq_handler_t timer_routine) 486static void __init amiga_sched_init(irq_handler_t timer_routine)
491{ 487{
492 static struct resource sched_res = { 488 static struct resource sched_res = {
493 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff, 489 .name = "timer", .start = 0x00bfd400, .end = 0x00bfd5ff,
494 }; 490 };
495 jiffy_ticks = (amiga_eclock+HZ/2)/HZ; 491 jiffy_ticks = (amiga_eclock+HZ/2)/HZ;
496 492
497 if (request_resource(&mb_resources._ciab, &sched_res)) 493 if (request_resource(&mb_resources._ciab, &sched_res))
498 printk("Cannot allocate ciab.ta{lo,hi}\n"); 494 printk("Cannot allocate ciab.ta{lo,hi}\n");
499 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */ 495 ciab.cra &= 0xC0; /* turn off timer A, continuous mode, from Eclk */
500 ciab.talo = jiffy_ticks % 256; 496 ciab.talo = jiffy_ticks % 256;
501 ciab.tahi = jiffy_ticks / 256; 497 ciab.tahi = jiffy_ticks / 256;
@@ -513,7 +509,7 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
513#define TICK_SIZE 10000 509#define TICK_SIZE 10000
514 510
515/* This is always executed with interrupts disabled. */ 511/* This is always executed with interrupts disabled. */
516static unsigned long amiga_gettimeoffset (void) 512static unsigned long amiga_gettimeoffset(void)
517{ 513{
518 unsigned short hi, lo, hi2; 514 unsigned short hi, lo, hi2;
519 unsigned long ticks, offset = 0; 515 unsigned long ticks, offset = 0;
@@ -585,15 +581,15 @@ static int a2000_hwclk(int op, struct rtc_time *t)
585 581
586 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD; 582 tod_2000.cntrl1 = TOD2000_CNTRL1_HOLD;
587 583
588 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) 584 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
589 { 585 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
590 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; 586 udelay(70);
591 udelay(70); 587 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
592 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
593 } 588 }
594 589
595 if (!cnt) 590 if (!cnt)
596 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n", tod_2000.cntrl1); 591 printk(KERN_INFO "hwclk: timed out waiting for RTC (0x%x)\n",
592 tod_2000.cntrl1);
597 593
598 if (!op) { /* read */ 594 if (!op) { /* read */
599 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2; 595 t->tm_sec = tod_2000.second1 * 10 + tod_2000.second2;
@@ -606,7 +602,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
606 if (t->tm_year <= 69) 602 if (t->tm_year <= 69)
607 t->tm_year += 100; 603 t->tm_year += 100;
608 604
609 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)){ 605 if (!(tod_2000.cntrl3 & TOD2000_CNTRL3_24HMODE)) {
610 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12) 606 if (!(tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour == 12)
611 t->tm_hour = 0; 607 t->tm_hour = 0;
612 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12) 608 else if ((tod_2000.hour1 & TOD2000_HOUR1_PM) && t->tm_hour != 12)
@@ -642,7 +638,7 @@ static int a2000_hwclk(int op, struct rtc_time *t)
642 return 0; 638 return 0;
643} 639}
644 640
645static int amiga_set_clock_mmss (unsigned long nowtime) 641static int amiga_set_clock_mmss(unsigned long nowtime)
646{ 642{
647 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; 643 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
648 644
@@ -660,8 +656,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
660 656
661 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; 657 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
662 658
663 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) 659 while ((tod_2000.cntrl1 & TOD2000_CNTRL1_BUSY) && cnt--) {
664 {
665 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD; 660 tod_2000.cntrl1 &= ~TOD2000_CNTRL1_HOLD;
666 udelay(70); 661 udelay(70);
667 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD; 662 tod_2000.cntrl1 |= TOD2000_CNTRL1_HOLD;
@@ -681,7 +676,7 @@ static int amiga_set_clock_mmss (unsigned long nowtime)
681 return 0; 676 return 0;
682} 677}
683 678
684static unsigned int amiga_get_ss( void ) 679static unsigned int amiga_get_ss(void)
685{ 680{
686 unsigned int s; 681 unsigned int s;
687 682
@@ -695,71 +690,72 @@ static unsigned int amiga_get_ss( void )
695 return s; 690 return s;
696} 691}
697 692
698static NORET_TYPE void amiga_reset( void ) 693static NORET_TYPE void amiga_reset(void)
699 ATTRIB_NORET; 694 ATTRIB_NORET;
700 695
701static void amiga_reset (void) 696static void amiga_reset(void)
702{ 697{
703 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); 698 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
704 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label); 699 unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
705 700
706 local_irq_disable(); 701 local_irq_disable();
707 if (CPU_IS_040_OR_060) 702 if (CPU_IS_040_OR_060)
708 /* Setup transparent translation registers for mapping 703 /* Setup transparent translation registers for mapping
709 * of 16 MB kernel segment before disabling translation 704 * of 16 MB kernel segment before disabling translation
710 */ 705 */
711 __asm__ __volatile__ 706 asm volatile ("\n"
712 ("movel %0,%/d0\n\t" 707 " move.l %0,%%d0\n"
713 "andl #0xff000000,%/d0\n\t" 708 " and.l #0xff000000,%%d0\n"
714 "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ 709 " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
715 ".chip 68040\n\t" 710 " .chip 68040\n"
716 "movec %%d0,%%itt0\n\t" 711 " movec %%d0,%%itt0\n"
717 "movec %%d0,%%dtt0\n\t" 712 " movec %%d0,%%dtt0\n"
718 ".chip 68k\n\t" 713 " .chip 68k\n"
719 "jmp %0@\n\t" 714 " jmp %0@\n"
720 : /* no outputs */ 715 : /* no outputs */
721 : "a" (jmp_addr040)); 716 : "a" (jmp_addr040)
722 else 717 : "d0");
723 /* for 680[23]0, just disable translation and jump to the physical 718 else
724 * address of the label 719 /* for 680[23]0, just disable translation and jump to the physical
725 */ 720 * address of the label
726 __asm__ __volatile__ 721 */
727 ("pmove %/tc,%@\n\t" 722 asm volatile ("\n"
728 "bclr #7,%@\n\t" 723 " pmove %%tc,%@\n"
729 "pmove %@,%/tc\n\t" 724 " bclr #7,%@\n"
730 "jmp %0@\n\t" 725 " pmove %@,%%tc\n"
731 : /* no outputs */ 726 " jmp %0@\n"
732 : "a" (jmp_addr)); 727 : /* no outputs */
733 jmp_addr_label040: 728 : "a" (jmp_addr));
734 /* disable translation on '040 now */ 729jmp_addr_label040:
735 __asm__ __volatile__ 730 /* disable translation on '040 now */
736 ("moveq #0,%/d0\n\t" 731 asm volatile ("\n"
737 ".chip 68040\n\t" 732 " moveq #0,%%d0\n"
738 "movec %%d0,%%tc\n\t" /* disable MMU */ 733 " .chip 68040\n"
739 ".chip 68k\n\t" 734 " movec %%d0,%%tc\n" /* disable MMU */
740 : /* no outputs */ 735 " .chip 68k\n"
741 : /* no inputs */ 736 : /* no outputs */
742 : "d0"); 737 : /* no inputs */
743 738 : "d0");
744 jmp_addr_label: 739
745 /* pickup reset address from AmigaOS ROM, reset devices and jump 740 jmp_addr_label:
746 * to reset address 741 /* pickup reset address from AmigaOS ROM, reset devices and jump
747 */ 742 * to reset address
748 __asm__ __volatile__ 743 */
749 ("movew #0x2700,%/sr\n\t" 744 asm volatile ("\n"
750 "leal 0x01000000,%/a0\n\t" 745 " move.w #0x2700,%sr\n"
751 "subl %/a0@(-0x14),%/a0\n\t" 746 " lea 0x01000000,%a0\n"
752 "movel %/a0@(4),%/a0\n\t" 747 " sub.l %a0@(-0x14),%a0\n"
753 "subql #2,%/a0\n\t" 748 " move.l %a0@(4),%a0\n"
754 "bra 1f\n\t" 749 " subq.l #2,%a0\n"
755 /* align on a longword boundary */ 750 " jra 1f\n"
756 __ALIGN_STR "\n" 751 /* align on a longword boundary */
757 "1:\n\t" 752 " " __ALIGN_STR "\n"
758 "reset\n\t" 753 "1:\n"
759 "jmp %/a0@" : /* Just that gcc scans it for % escapes */ ); 754 " reset\n"
760 755 " jmp %a0@");
761 for (;;); 756
762 757 for (;;)
758 ;
763} 759}
764 760
765 761
@@ -773,11 +769,11 @@ static void amiga_reset (void)
773#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */ 769#define SAVEKMSG_MAGIC2 0x4B4D5347 /* 'KMSG' */
774 770
775struct savekmsg { 771struct savekmsg {
776 unsigned long magic1; /* SAVEKMSG_MAGIC1 */ 772 unsigned long magic1; /* SAVEKMSG_MAGIC1 */
777 unsigned long magic2; /* SAVEKMSG_MAGIC2 */ 773 unsigned long magic2; /* SAVEKMSG_MAGIC2 */
778 unsigned long magicptr; /* address of magic1 */ 774 unsigned long magicptr; /* address of magic1 */
779 unsigned long size; 775 unsigned long size;
780 char data[0]; 776 char data[0];
781}; 777};
782 778
783static struct savekmsg *savekmsg; 779static struct savekmsg *savekmsg;
@@ -785,100 +781,100 @@ static struct savekmsg *savekmsg;
785static void amiga_mem_console_write(struct console *co, const char *s, 781static void amiga_mem_console_write(struct console *co, const char *s,
786 unsigned int count) 782 unsigned int count)
787{ 783{
788 if (savekmsg->size+count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) { 784 if (savekmsg->size + count <= SAVEKMSG_MAXMEM-sizeof(struct savekmsg)) {
789 memcpy(savekmsg->data+savekmsg->size, s, count); 785 memcpy(savekmsg->data + savekmsg->size, s, count);
790 savekmsg->size += count; 786 savekmsg->size += count;
791 } 787 }
792} 788}
793 789
794static void amiga_savekmsg_init(void) 790static void amiga_savekmsg_init(void)
795{ 791{
796 static struct resource debug_res = { .name = "Debug" }; 792 static struct resource debug_res = { .name = "Debug" };
797 793
798 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res); 794 savekmsg = amiga_chip_alloc_res(SAVEKMSG_MAXMEM, &debug_res);
799 savekmsg->magic1 = SAVEKMSG_MAGIC1; 795 savekmsg->magic1 = SAVEKMSG_MAGIC1;
800 savekmsg->magic2 = SAVEKMSG_MAGIC2; 796 savekmsg->magic2 = SAVEKMSG_MAGIC2;
801 savekmsg->magicptr = ZTWO_PADDR(savekmsg); 797 savekmsg->magicptr = ZTWO_PADDR(savekmsg);
802 savekmsg->size = 0; 798 savekmsg->size = 0;
803} 799}
804 800
805static void amiga_serial_putc(char c) 801static void amiga_serial_putc(char c)
806{ 802{
807 amiga_custom.serdat = (unsigned char)c | 0x100; 803 amiga_custom.serdat = (unsigned char)c | 0x100;
808 while (!(amiga_custom.serdatr & 0x2000)) 804 while (!(amiga_custom.serdatr & 0x2000))
809 ; 805 ;
810} 806}
811 807
812void amiga_serial_console_write(struct console *co, const char *s, 808void amiga_serial_console_write(struct console *co, const char *s,
813 unsigned int count) 809 unsigned int count)
814{ 810{
815 while (count--) { 811 while (count--) {
816 if (*s == '\n') 812 if (*s == '\n')
817 amiga_serial_putc('\r'); 813 amiga_serial_putc('\r');
818 amiga_serial_putc(*s++); 814 amiga_serial_putc(*s++);
819 } 815 }
820} 816}
821 817
822#ifdef CONFIG_SERIAL_CONSOLE 818#ifdef CONFIG_SERIAL_CONSOLE
823void amiga_serial_puts(const char *s) 819void amiga_serial_puts(const char *s)
824{ 820{
825 amiga_serial_console_write(NULL, s, strlen(s)); 821 amiga_serial_console_write(NULL, s, strlen(s));
826} 822}
827 823
828int amiga_serial_console_wait_key(struct console *co) 824int amiga_serial_console_wait_key(struct console *co)
829{ 825{
830 int ch; 826 int ch;
831 827
832 while (!(amiga_custom.intreqr & IF_RBF)) 828 while (!(amiga_custom.intreqr & IF_RBF))
833 barrier(); 829 barrier();
834 ch = amiga_custom.serdatr & 0xff; 830 ch = amiga_custom.serdatr & 0xff;
835 /* clear the interrupt, so that another character can be read */ 831 /* clear the interrupt, so that another character can be read */
836 amiga_custom.intreq = IF_RBF; 832 amiga_custom.intreq = IF_RBF;
837 return ch; 833 return ch;
838} 834}
839 835
840void amiga_serial_gets(struct console *co, char *s, int len) 836void amiga_serial_gets(struct console *co, char *s, int len)
841{ 837{
842 int ch, cnt = 0; 838 int ch, cnt = 0;
843 839
844 while (1) { 840 while (1) {
845 ch = amiga_serial_console_wait_key(co); 841 ch = amiga_serial_console_wait_key(co);
846 842
847 /* Check for backspace. */ 843 /* Check for backspace. */
848 if (ch == 8 || ch == 127) { 844 if (ch == 8 || ch == 127) {
849 if (cnt == 0) { 845 if (cnt == 0) {
850 amiga_serial_putc('\007'); 846 amiga_serial_putc('\007');
851 continue; 847 continue;
852 } 848 }
853 cnt--; 849 cnt--;
854 amiga_serial_puts("\010 \010"); 850 amiga_serial_puts("\010 \010");
855 continue; 851 continue;
856 } 852 }
857 853
858 /* Check for enter. */ 854 /* Check for enter. */
859 if (ch == 10 || ch == 13) 855 if (ch == 10 || ch == 13)
860 break; 856 break;
861 857
862 /* See if line is too long. */ 858 /* See if line is too long. */
863 if (cnt >= len + 1) { 859 if (cnt >= len + 1) {
864 amiga_serial_putc(7); 860 amiga_serial_putc(7);
865 cnt--; 861 cnt--;
866 continue; 862 continue;
867 } 863 }
868 864
869 /* Store and echo character. */ 865 /* Store and echo character. */
870 s[cnt++] = ch; 866 s[cnt++] = ch;
871 amiga_serial_putc(ch); 867 amiga_serial_putc(ch);
872 } 868 }
873 /* Print enter. */ 869 /* Print enter. */
874 amiga_serial_puts("\r\n"); 870 amiga_serial_puts("\r\n");
875 s[cnt] = 0; 871 s[cnt] = 0;
876} 872}
877#endif 873#endif
878 874
879static void __init amiga_debug_init(void) 875static void __init amiga_debug_init(void)
880{ 876{
881 if (!strcmp( m68k_debug_device, "ser" )) { 877 if (!strcmp(m68k_debug_device, "ser" )) {
882 /* no initialization required (?) */ 878 /* no initialization required (?) */
883 amiga_console_driver.write = amiga_serial_console_write; 879 amiga_console_driver.write = amiga_serial_console_write;
884 register_console(&amiga_console_driver); 880 register_console(&amiga_console_driver);
@@ -888,10 +884,10 @@ static void __init amiga_debug_init(void)
888#ifdef CONFIG_HEARTBEAT 884#ifdef CONFIG_HEARTBEAT
889static void amiga_heartbeat(int on) 885static void amiga_heartbeat(int on)
890{ 886{
891 if (on) 887 if (on)
892 ciaa.pra &= ~2; 888 ciaa.pra &= ~2;
893 else 889 else
894 ciaa.pra |= 2; 890 ciaa.pra |= 2;
895} 891}
896#endif 892#endif
897 893
@@ -901,81 +897,81 @@ static void amiga_heartbeat(int on)
901 897
902static void amiga_get_model(char *model) 898static void amiga_get_model(char *model)
903{ 899{
904 strcpy(model, amiga_model_name); 900 strcpy(model, amiga_model_name);
905} 901}
906 902
907 903
908static int amiga_get_hardware_list(char *buffer) 904static int amiga_get_hardware_list(char *buffer)
909{ 905{
910 int len = 0; 906 int len = 0;
911 907
912 if (AMIGAHW_PRESENT(CHIP_RAM)) 908 if (AMIGAHW_PRESENT(CHIP_RAM))
913 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10); 909 len += sprintf(buffer+len, "Chip RAM:\t%ldK\n", amiga_chip_size>>10);
914 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n", 910 len += sprintf(buffer+len, "PS Freq:\t%dHz\nEClock Freq:\t%ldHz\n",
915 amiga_psfreq, amiga_eclock); 911 amiga_psfreq, amiga_eclock);
916 if (AMIGAHW_PRESENT(AMI_VIDEO)) { 912 if (AMIGAHW_PRESENT(AMI_VIDEO)) {
917 char *type; 913 char *type;
918 switch(amiga_chipset) { 914 switch (amiga_chipset) {
919 case CS_OCS: 915 case CS_OCS:
920 type = "OCS"; 916 type = "OCS";
921 break; 917 break;
922 case CS_ECS: 918 case CS_ECS:
923 type = "ECS"; 919 type = "ECS";
924 break; 920 break;
925 case CS_AGA: 921 case CS_AGA:
926 type = "AGA"; 922 type = "AGA";
927 break; 923 break;
928 default: 924 default:
929 type = "Old or Unknown"; 925 type = "Old or Unknown";
930 break; 926 break;
927 }
928 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
931 } 929 }
932 len += sprintf(buffer+len, "Graphics:\t%s\n", type);
933 }
934 930
935#define AMIGAHW_ANNOUNCE(name, str) \ 931#define AMIGAHW_ANNOUNCE(name, str) \
936 if (AMIGAHW_PRESENT(name)) \ 932 if (AMIGAHW_PRESENT(name)) \
937 len += sprintf (buffer+len, "\t%s\n", str) 933 len += sprintf (buffer+len, "\t%s\n", str)
938 934
939 len += sprintf (buffer + len, "Detected hardware:\n"); 935 len += sprintf (buffer + len, "Detected hardware:\n");
940 936
941 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video"); 937 AMIGAHW_ANNOUNCE(AMI_VIDEO, "Amiga Video");
942 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter"); 938 AMIGAHW_ANNOUNCE(AMI_BLITTER, "Blitter");
943 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer"); 939 AMIGAHW_ANNOUNCE(AMBER_FF, "Amber Flicker Fixer");
944 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio"); 940 AMIGAHW_ANNOUNCE(AMI_AUDIO, "Amiga Audio");
945 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller"); 941 AMIGAHW_ANNOUNCE(AMI_FLOPPY, "Floppy Controller");
946 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)"); 942 AMIGAHW_ANNOUNCE(A3000_SCSI, "SCSI Controller WD33C93 (A3000 style)");
947 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)"); 943 AMIGAHW_ANNOUNCE(A4000_SCSI, "SCSI Controller NCR53C710 (A4000T style)");
948 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)"); 944 AMIGAHW_ANNOUNCE(A1200_IDE, "IDE Interface (A1200 style)");
949 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)"); 945 AMIGAHW_ANNOUNCE(A4000_IDE, "IDE Interface (A4000 style)");
950 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive"); 946 AMIGAHW_ANNOUNCE(CD_ROM, "Internal CD ROM drive");
951 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard"); 947 AMIGAHW_ANNOUNCE(AMI_KEYBOARD, "Keyboard");
952 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port"); 948 AMIGAHW_ANNOUNCE(AMI_MOUSE, "Mouse Port");
953 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port"); 949 AMIGAHW_ANNOUNCE(AMI_SERIAL, "Serial Port");
954 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port"); 950 AMIGAHW_ANNOUNCE(AMI_PARALLEL, "Parallel Port");
955 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)"); 951 AMIGAHW_ANNOUNCE(A2000_CLK, "Hardware Clock (A2000 style)");
956 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)"); 952 AMIGAHW_ANNOUNCE(A3000_CLK, "Hardware Clock (A3000 style)");
957 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM"); 953 AMIGAHW_ANNOUNCE(CHIP_RAM, "Chip RAM");
958 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364"); 954 AMIGAHW_ANNOUNCE(PAULA, "Paula 8364");
959 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362"); 955 AMIGAHW_ANNOUNCE(DENISE, "Denise 8362");
960 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373"); 956 AMIGAHW_ANNOUNCE(DENISE_HR, "Denise 8373");
961 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375"); 957 AMIGAHW_ANNOUNCE(LISA, "Lisa 8375");
962 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371"); 958 AMIGAHW_ANNOUNCE(AGNUS_PAL, "Normal/Fat PAL Agnus 8367/8371");
963 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370"); 959 AMIGAHW_ANNOUNCE(AGNUS_NTSC, "Normal/Fat NTSC Agnus 8361/8370");
964 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372"); 960 AMIGAHW_ANNOUNCE(AGNUS_HR_PAL, "Fat Hires PAL Agnus 8372");
965 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372"); 961 AMIGAHW_ANNOUNCE(AGNUS_HR_NTSC, "Fat Hires NTSC Agnus 8372");
966 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374"); 962 AMIGAHW_ANNOUNCE(ALICE_PAL, "PAL Alice 8374");
967 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374"); 963 AMIGAHW_ANNOUNCE(ALICE_NTSC, "NTSC Alice 8374");
968 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick"); 964 AMIGAHW_ANNOUNCE(MAGIC_REKICK, "Magic Hard Rekick");
969 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot"); 965 AMIGAHW_ANNOUNCE(PCMCIA, "PCMCIA Slot");
970#ifdef CONFIG_ZORRO 966#ifdef CONFIG_ZORRO
971 if (AMIGAHW_PRESENT(ZORRO)) 967 if (AMIGAHW_PRESENT(ZORRO))
972 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion " 968 len += sprintf(buffer+len, "\tZorro II%s AutoConfig: %d Expansion "
973 "Device%s\n", 969 "Device%s\n",
974 AMIGAHW_PRESENT(ZORRO3) ? "I" : "", 970 AMIGAHW_PRESENT(ZORRO3) ? "I" : "",
975 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s"); 971 zorro_num_autocon, zorro_num_autocon == 1 ? "" : "s");
976#endif /* CONFIG_ZORRO */ 972#endif /* CONFIG_ZORRO */
977 973
978#undef AMIGAHW_ANNOUNCE 974#undef AMIGAHW_ANNOUNCE
979 975
980 return(len); 976 return len;
981} 977}
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index ca5cd4344e3d..b10e7addae5c 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -50,19 +50,19 @@ int atari_dont_touch_floppy_select;
50int atari_rtc_year_offset; 50int atari_rtc_year_offset;
51 51
52/* local function prototypes */ 52/* local function prototypes */
53static void atari_reset( void ); 53static void atari_reset(void);
54static void atari_get_model(char *model); 54static void atari_get_model(char *model);
55static int atari_get_hardware_list(char *buffer); 55static int atari_get_hardware_list(char *buffer);
56 56
57/* atari specific irq functions */ 57/* atari specific irq functions */
58extern void atari_init_IRQ (void); 58extern void atari_init_IRQ (void);
59extern void atari_mksound( unsigned int count, unsigned int ticks ); 59extern void atari_mksound(unsigned int count, unsigned int ticks);
60#ifdef CONFIG_HEARTBEAT 60#ifdef CONFIG_HEARTBEAT
61static void atari_heartbeat( int on ); 61static void atari_heartbeat(int on);
62#endif 62#endif
63 63
64/* atari specific timer functions (in time.c) */ 64/* atari specific timer functions (in time.c) */
65extern void atari_sched_init(irq_handler_t ); 65extern void atari_sched_init(irq_handler_t);
66extern unsigned long atari_gettimeoffset (void); 66extern unsigned long atari_gettimeoffset (void);
67extern int atari_mste_hwclk (int, struct rtc_time *); 67extern int atari_mste_hwclk (int, struct rtc_time *);
68extern int atari_tt_hwclk (int, struct rtc_time *); 68extern int atari_tt_hwclk (int, struct rtc_time *);
@@ -73,48 +73,6 @@ extern int atari_tt_set_clock_mmss (unsigned long);
73extern void atari_debug_init(void); 73extern void atari_debug_init(void);
74 74
75 75
76/* I've moved hwreg_present() and hwreg_present_bywrite() out into
77 * mm/hwtest.c, to avoid having multiple copies of the same routine
78 * in the kernel [I wanted them in hp300 and they were already used
79 * in the nubus code. NB: I don't have an Atari so this might (just
80 * conceivably) break something.
81 * I've preserved the #if 0 version of hwreg_present_bywrite() here
82 * for posterity.
83 * -- Peter Maydell <pmaydell@chiark.greenend.org.uk>, 05/1998
84 */
85
86#if 0
87static int __init
88hwreg_present_bywrite(volatile void *regp, unsigned char val)
89{
90 int ret;
91 long save_sp, save_vbr;
92 static long tmp_vectors[3] = { [2] = (long)&&after_test };
93
94 __asm__ __volatile__
95 ( "movec %/vbr,%2\n\t" /* save vbr value */
96 "movec %4,%/vbr\n\t" /* set up temporary vectors */
97 "movel %/sp,%1\n\t" /* save sp */
98 "moveq #0,%0\n\t" /* assume not present */
99 "moveb %5,%3@\n\t" /* write the hardware reg */
100 "cmpb %3@,%5\n\t" /* compare it */
101 "seq %0" /* comes here only if reg */
102 /* is present */
103 : "=d&" (ret), "=r&" (save_sp), "=r&" (save_vbr)
104 : "a" (regp), "r" (tmp_vectors), "d" (val)
105 );
106 after_test:
107 __asm__ __volatile__
108 ( "movel %0,%/sp\n\t" /* restore sp */
109 "movec %1,%/vbr" /* restore vbr */
110 : : "r" (save_sp), "r" (save_vbr) : "sp"
111 );
112
113 return( ret );
114}
115#endif
116
117
118/* ++roman: This is a more elaborate test for an SCC chip, since the plain 76/* ++roman: This is a more elaborate test for an SCC chip, since the plain
119 * Medusa board generates DTACK at the SCC's standard addresses, but a SCC 77 * Medusa board generates DTACK at the SCC's standard addresses, but a SCC
120 * board in the Medusa is possible. Also, the addresses where the ST_ESCC 78 * board in the Medusa is possible. Also, the addresses where the ST_ESCC
@@ -123,26 +81,34 @@ hwreg_present_bywrite(volatile void *regp, unsigned char val)
123 * should be readable without trouble (from channel A!). 81 * should be readable without trouble (from channel A!).
124 */ 82 */
125 83
126static int __init scc_test( volatile char *ctla ) 84static int __init scc_test(volatile char *ctla)
127{ 85{
128 if (!hwreg_present( ctla )) 86 if (!hwreg_present(ctla))
129 return( 0 ); 87 return 0;
130 MFPDELAY(); 88 MFPDELAY();
131 89
132 *ctla = 2; MFPDELAY(); 90 *ctla = 2;
133 *ctla = 0x40; MFPDELAY(); 91 MFPDELAY();
92 *ctla = 0x40;
93 MFPDELAY();
134 94
135 *ctla = 2; MFPDELAY(); 95 *ctla = 2;
136 if (*ctla != 0x40) return( 0 ); 96 MFPDELAY();
97 if (*ctla != 0x40)
98 return 0;
137 MFPDELAY(); 99 MFPDELAY();
138 100
139 *ctla = 2; MFPDELAY(); 101 *ctla = 2;
140 *ctla = 0x60; MFPDELAY(); 102 MFPDELAY();
103 *ctla = 0x60;
104 MFPDELAY();
141 105
142 *ctla = 2; MFPDELAY(); 106 *ctla = 2;
143 if (*ctla != 0x60) return( 0 ); 107 MFPDELAY();
108 if (*ctla != 0x60)
109 return 0;
144 110
145 return( 1 ); 111 return 1;
146} 112}
147 113
148 114
@@ -152,59 +118,58 @@ static int __init scc_test( volatile char *ctla )
152 118
153int __init atari_parse_bootinfo(const struct bi_record *record) 119int __init atari_parse_bootinfo(const struct bi_record *record)
154{ 120{
155 int unknown = 0; 121 int unknown = 0;
156 const u_long *data = record->data; 122 const u_long *data = record->data;
157 123
158 switch (record->tag) { 124 switch (record->tag) {
159 case BI_ATARI_MCH_COOKIE: 125 case BI_ATARI_MCH_COOKIE:
160 atari_mch_cookie = *data; 126 atari_mch_cookie = *data;
161 break; 127 break;
162 case BI_ATARI_MCH_TYPE: 128 case BI_ATARI_MCH_TYPE:
163 atari_mch_type = *data; 129 atari_mch_type = *data;
164 break; 130 break;
165 default: 131 default:
166 unknown = 1; 132 unknown = 1;
167 } 133 break;
168 return(unknown); 134 }
135 return unknown;
169} 136}
170 137
171 138
172/* Parse the Atari-specific switches= option. */ 139/* Parse the Atari-specific switches= option. */
173void __init atari_switches_setup( const char *str, unsigned len ) 140void __init atari_switches_setup(const char *str, unsigned len)
174{ 141{
175 char switches[len+1]; 142 char switches[len+1];
176 char *p; 143 char *p;
177 int ovsc_shift; 144 int ovsc_shift;
178 char *args = switches; 145 char *args = switches;
179 146
180 /* copy string to local array, strsep works destructively... */ 147 /* copy string to local array, strsep works destructively... */
181 strlcpy( switches, str, sizeof(switches) ); 148 strlcpy(switches, str, sizeof(switches));
182 atari_switches = 0; 149 atari_switches = 0;
183 150
184 /* parse the options */ 151 /* parse the options */
185 while ((p = strsep(&args, ",")) != NULL) { 152 while ((p = strsep(&args, ",")) != NULL) {
186 if (!*p) continue; 153 if (!*p)
187 ovsc_shift = 0; 154 continue;
188 if (strncmp( p, "ov_", 3 ) == 0) { 155 ovsc_shift = 0;
189 p += 3; 156 if (strncmp(p, "ov_", 3) == 0) {
190 ovsc_shift = ATARI_SWITCH_OVSC_SHIFT; 157 p += 3;
191 } 158 ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;
192 159 }
193 if (strcmp( p, "ikbd" ) == 0) { 160
194 /* RTS line of IKBD ACIA */ 161 if (strcmp(p, "ikbd") == 0) {
195 atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift; 162 /* RTS line of IKBD ACIA */
196 } 163 atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;
197 else if (strcmp( p, "midi" ) == 0) { 164 } else if (strcmp(p, "midi") == 0) {
198 /* RTS line of MIDI ACIA */ 165 /* RTS line of MIDI ACIA */
199 atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift; 166 atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift;
167 } else if (strcmp(p, "snd6") == 0) {
168 atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
169 } else if (strcmp(p, "snd7") == 0) {
170 atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
171 }
200 } 172 }
201 else if (strcmp( p, "snd6" ) == 0) {
202 atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
203 }
204 else if (strcmp( p, "snd7" ) == 0) {
205 atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
206 }
207 }
208} 173}
209 174
210 175
@@ -214,284 +179,283 @@ void __init atari_switches_setup( const char *str, unsigned len )
214 179
215void __init config_atari(void) 180void __init config_atari(void)
216{ 181{
217 unsigned short tos_version; 182 unsigned short tos_version;
218 183
219 memset(&atari_hw_present, 0, sizeof(atari_hw_present)); 184 memset(&atari_hw_present, 0, sizeof(atari_hw_present));
220 185
221 atari_debug_init(); 186 atari_debug_init();
222 187
223 ioport_resource.end = 0xFFFFFFFF; /* Change size of I/O space from 64KB 188 /* Change size of I/O space from 64KB to 4GB. */
224 to 4GB. */ 189 ioport_resource.end = 0xFFFFFFFF;
225 190
226 mach_sched_init = atari_sched_init; 191 mach_sched_init = atari_sched_init;
227 mach_init_IRQ = atari_init_IRQ; 192 mach_init_IRQ = atari_init_IRQ;
228 mach_get_model = atari_get_model; 193 mach_get_model = atari_get_model;
229 mach_get_hardware_list = atari_get_hardware_list; 194 mach_get_hardware_list = atari_get_hardware_list;
230 mach_gettimeoffset = atari_gettimeoffset; 195 mach_gettimeoffset = atari_gettimeoffset;
231 mach_reset = atari_reset; 196 mach_reset = atari_reset;
232 mach_max_dma_address = 0xffffff; 197 mach_max_dma_address = 0xffffff;
233#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 198#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
234 mach_beep = atari_mksound; 199 mach_beep = atari_mksound;
235#endif 200#endif
236#ifdef CONFIG_HEARTBEAT 201#ifdef CONFIG_HEARTBEAT
237 mach_heartbeat = atari_heartbeat; 202 mach_heartbeat = atari_heartbeat;
238#endif 203#endif
239 204
240 /* Set switches as requested by the user */ 205 /* Set switches as requested by the user */
241 if (atari_switches & ATARI_SWITCH_IKBD) 206 if (atari_switches & ATARI_SWITCH_IKBD)
242 acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID; 207 acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID;
243 if (atari_switches & ATARI_SWITCH_MIDI) 208 if (atari_switches & ATARI_SWITCH_MIDI)
244 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID; 209 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;
245 if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) { 210 if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) {
246 sound_ym.rd_data_reg_sel = 14; 211 sound_ym.rd_data_reg_sel = 14;
247 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 212 sound_ym.wd_data = sound_ym.rd_data_reg_sel |
248 ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) | 213 ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |
249 ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0); 214 ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);
250 } 215 }
251
252 /* ++bjoern:
253 * Determine hardware present
254 */
255 216
256 printk( "Atari hardware found: " ); 217 /* ++bjoern:
257 if (MACH_IS_MEDUSA || MACH_IS_HADES) { 218 * Determine hardware present
258 /* There's no Atari video hardware on the Medusa, but all the 219 */
259 * addresses below generate a DTACK so no bus error occurs! */ 220
260 } 221 printk("Atari hardware found: ");
261 else if (hwreg_present( f030_xreg )) { 222 if (MACH_IS_MEDUSA || MACH_IS_HADES) {
262 ATARIHW_SET(VIDEL_SHIFTER); 223 /* There's no Atari video hardware on the Medusa, but all the
263 printk( "VIDEL " ); 224 * addresses below generate a DTACK so no bus error occurs! */
264 /* This is a temporary hack: If there is Falcon video 225 } else if (hwreg_present(f030_xreg)) {
265 * hardware, we assume that the ST-DMA serves SCSI instead of 226 ATARIHW_SET(VIDEL_SHIFTER);
266 * ACSI. In the future, there should be a better method for 227 printk("VIDEL ");
267 * this... 228 /* This is a temporary hack: If there is Falcon video
268 */ 229 * hardware, we assume that the ST-DMA serves SCSI instead of
269 ATARIHW_SET(ST_SCSI); 230 * ACSI. In the future, there should be a better method for
270 printk( "STDMA-SCSI " ); 231 * this...
271 } 232 */
272 else if (hwreg_present( tt_palette )) { 233 ATARIHW_SET(ST_SCSI);
273 ATARIHW_SET(TT_SHIFTER); 234 printk("STDMA-SCSI ");
274 printk( "TT_SHIFTER " ); 235 } else if (hwreg_present(tt_palette)) {
275 } 236 ATARIHW_SET(TT_SHIFTER);
276 else if (hwreg_present( &shifter.bas_hi )) { 237 printk("TT_SHIFTER ");
277 if (hwreg_present( &shifter.bas_lo ) && 238 } else if (hwreg_present(&shifter.bas_hi)) {
278 (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) { 239 if (hwreg_present(&shifter.bas_lo) &&
279 ATARIHW_SET(EXTD_SHIFTER); 240 (shifter.bas_lo = 0x0aau, shifter.bas_lo == 0x0aau)) {
280 printk( "EXTD_SHIFTER " ); 241 ATARIHW_SET(EXTD_SHIFTER);
281 } 242 printk("EXTD_SHIFTER ");
282 else { 243 } else {
283 ATARIHW_SET(STND_SHIFTER); 244 ATARIHW_SET(STND_SHIFTER);
284 printk( "STND_SHIFTER " ); 245 printk("STND_SHIFTER ");
285 } 246 }
286 } 247 }
287 if (hwreg_present( &mfp.par_dt_reg )) { 248 if (hwreg_present(&mfp.par_dt_reg)) {
288 ATARIHW_SET(ST_MFP); 249 ATARIHW_SET(ST_MFP);
289 printk( "ST_MFP " ); 250 printk("ST_MFP ");
290 } 251 }
291 if (hwreg_present( &tt_mfp.par_dt_reg )) { 252 if (hwreg_present(&tt_mfp.par_dt_reg)) {
292 ATARIHW_SET(TT_MFP); 253 ATARIHW_SET(TT_MFP);
293 printk( "TT_MFP " ); 254 printk("TT_MFP ");
294 } 255 }
295 if (hwreg_present( &tt_scsi_dma.dma_addr_hi )) { 256 if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) {
296 ATARIHW_SET(SCSI_DMA); 257 ATARIHW_SET(SCSI_DMA);
297 printk( "TT_SCSI_DMA " ); 258 printk("TT_SCSI_DMA ");
298 } 259 }
299 if (!MACH_IS_HADES && hwreg_present( &st_dma.dma_hi )) { 260 if (!MACH_IS_HADES && hwreg_present(&st_dma.dma_hi)) {
300 ATARIHW_SET(STND_DMA); 261 ATARIHW_SET(STND_DMA);
301 printk( "STND_DMA " ); 262 printk("STND_DMA ");
302 } 263 }
303 if (MACH_IS_MEDUSA || /* The ST-DMA address registers aren't readable 264 /*
304 * on all Medusas, so the test below may fail */ 265 * The ST-DMA address registers aren't readable
305 (hwreg_present( &st_dma.dma_vhi ) && 266 * on all Medusas, so the test below may fail
306 (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) && 267 */
307 st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa && 268 if (MACH_IS_MEDUSA ||
308 (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) && 269 (hwreg_present(&st_dma.dma_vhi) &&
309 st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) { 270 (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) &&
310 ATARIHW_SET(EXTD_DMA); 271 st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa &&
311 printk( "EXTD_DMA " ); 272 (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&
312 } 273 st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {
313 if (hwreg_present( &tt_scsi.scsi_data )) { 274 ATARIHW_SET(EXTD_DMA);
314 ATARIHW_SET(TT_SCSI); 275 printk("EXTD_DMA ");
315 printk( "TT_SCSI " ); 276 }
316 } 277 if (hwreg_present(&tt_scsi.scsi_data)) {
317 if (hwreg_present( &sound_ym.rd_data_reg_sel )) { 278 ATARIHW_SET(TT_SCSI);
318 ATARIHW_SET(YM_2149); 279 printk("TT_SCSI ");
319 printk( "YM2149 " ); 280 }
320 } 281 if (hwreg_present(&sound_ym.rd_data_reg_sel)) {
321 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 282 ATARIHW_SET(YM_2149);
322 hwreg_present( &tt_dmasnd.ctrl )) { 283 printk("YM2149 ");
323 ATARIHW_SET(PCM_8BIT); 284 }
324 printk( "PCM " ); 285 if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
325 } 286 hwreg_present(&tt_dmasnd.ctrl)) {
326 if (!MACH_IS_HADES && hwreg_present( &falcon_codec.unused5 )) { 287 ATARIHW_SET(PCM_8BIT);
327 ATARIHW_SET(CODEC); 288 printk("PCM ");
328 printk( "CODEC " ); 289 }
329 } 290 if (!MACH_IS_HADES && hwreg_present(&falcon_codec.unused5)) {
330 if (hwreg_present( &dsp56k_host_interface.icr )) { 291 ATARIHW_SET(CODEC);
331 ATARIHW_SET(DSP56K); 292 printk("CODEC ");
332 printk( "DSP56K " ); 293 }
333 } 294 if (hwreg_present(&dsp56k_host_interface.icr)) {
334 if (hwreg_present( &tt_scc_dma.dma_ctrl ) && 295 ATARIHW_SET(DSP56K);
296 printk("DSP56K ");
297 }
298 if (hwreg_present(&tt_scc_dma.dma_ctrl) &&
335#if 0 299#if 0
336 /* This test sucks! Who knows some better? */ 300 /* This test sucks! Who knows some better? */
337 (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) && 301 (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
338 (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0) 302 (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
339#else 303#else
340 !MACH_IS_MEDUSA && !MACH_IS_HADES 304 !MACH_IS_MEDUSA && !MACH_IS_HADES
341#endif 305#endif
342 ) { 306 ) {
343 ATARIHW_SET(SCC_DMA); 307 ATARIHW_SET(SCC_DMA);
344 printk( "SCC_DMA " ); 308 printk("SCC_DMA ");
345 } 309 }
346 if (scc_test( &scc.cha_a_ctrl )) { 310 if (scc_test(&scc.cha_a_ctrl)) {
347 ATARIHW_SET(SCC); 311 ATARIHW_SET(SCC);
348 printk( "SCC " ); 312 printk("SCC ");
349 } 313 }
350 if (scc_test( &st_escc.cha_b_ctrl )) { 314 if (scc_test(&st_escc.cha_b_ctrl)) {
351 ATARIHW_SET( ST_ESCC ); 315 ATARIHW_SET(ST_ESCC);
352 printk( "ST_ESCC " ); 316 printk("ST_ESCC ");
353 } 317 }
354 if (MACH_IS_HADES) 318 if (MACH_IS_HADES) {
355 { 319 ATARIHW_SET(VME);
356 ATARIHW_SET( VME ); 320 printk("VME ");
357 printk( "VME " ); 321 } else if (hwreg_present(&tt_scu.sys_mask)) {
358 } 322 ATARIHW_SET(SCU);
359 else if (hwreg_present( &tt_scu.sys_mask )) { 323 /* Assume a VME bus if there's a SCU */
360 ATARIHW_SET(SCU); 324 ATARIHW_SET(VME);
361 /* Assume a VME bus if there's a SCU */ 325 printk("VME SCU ");
362 ATARIHW_SET( VME ); 326 }
363 printk( "VME SCU " ); 327 if (hwreg_present((void *)(0xffff9210))) {
364 } 328 ATARIHW_SET(ANALOG_JOY);
365 if (hwreg_present( (void *)(0xffff9210) )) { 329 printk("ANALOG_JOY ");
366 ATARIHW_SET(ANALOG_JOY); 330 }
367 printk( "ANALOG_JOY " ); 331 if (!MACH_IS_HADES && hwreg_present(blitter.halftone)) {
368 } 332 ATARIHW_SET(BLITTER);
369 if (!MACH_IS_HADES && hwreg_present( blitter.halftone )) { 333 printk("BLITTER ");
370 ATARIHW_SET(BLITTER); 334 }
371 printk( "BLITTER " ); 335 if (hwreg_present((void *)0xfff00039)) {
372 } 336 ATARIHW_SET(IDE);
373 if (hwreg_present((void *)0xfff00039)) { 337 printk("IDE ");
374 ATARIHW_SET(IDE); 338 }
375 printk( "IDE " );
376 }
377#if 1 /* This maybe wrong */ 339#if 1 /* This maybe wrong */
378 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 340 if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
379 hwreg_present( &tt_microwire.data ) && 341 hwreg_present(&tt_microwire.data) &&
380 hwreg_present( &tt_microwire.mask ) && 342 hwreg_present(&tt_microwire.mask) &&
381 (tt_microwire.mask = 0x7ff, 343 (tt_microwire.mask = 0x7ff,
382 udelay(1), 344 udelay(1),
383 tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR, 345 tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR,
384 udelay(1), 346 udelay(1),
385 tt_microwire.data != 0)) { 347 tt_microwire.data != 0)) {
386 ATARIHW_SET(MICROWIRE); 348 ATARIHW_SET(MICROWIRE);
387 while (tt_microwire.mask != 0x7ff) ; 349 while (tt_microwire.mask != 0x7ff)
388 printk( "MICROWIRE " ); 350 ;
389 } 351 printk("MICROWIRE ");
352 }
390#endif 353#endif
391 if (hwreg_present( &tt_rtc.regsel )) { 354 if (hwreg_present(&tt_rtc.regsel)) {
392 ATARIHW_SET(TT_CLK); 355 ATARIHW_SET(TT_CLK);
393 printk( "TT_CLK " ); 356 printk("TT_CLK ");
394 mach_hwclk = atari_tt_hwclk; 357 mach_hwclk = atari_tt_hwclk;
395 mach_set_clock_mmss = atari_tt_set_clock_mmss; 358 mach_set_clock_mmss = atari_tt_set_clock_mmss;
396 } 359 }
397 if (!MACH_IS_HADES && hwreg_present( &mste_rtc.sec_ones)) { 360 if (!MACH_IS_HADES && hwreg_present(&mste_rtc.sec_ones)) {
398 ATARIHW_SET(MSTE_CLK); 361 ATARIHW_SET(MSTE_CLK);
399 printk( "MSTE_CLK "); 362 printk("MSTE_CLK ");
400 mach_hwclk = atari_mste_hwclk; 363 mach_hwclk = atari_mste_hwclk;
401 mach_set_clock_mmss = atari_mste_set_clock_mmss; 364 mach_set_clock_mmss = atari_mste_set_clock_mmss;
402 } 365 }
403 if (!MACH_IS_MEDUSA && !MACH_IS_HADES && 366 if (!MACH_IS_MEDUSA && !MACH_IS_HADES &&
404 hwreg_present( &dma_wd.fdc_speed ) && 367 hwreg_present(&dma_wd.fdc_speed) &&
405 hwreg_write( &dma_wd.fdc_speed, 0 )) { 368 hwreg_write(&dma_wd.fdc_speed, 0)) {
406 ATARIHW_SET(FDCSPEED); 369 ATARIHW_SET(FDCSPEED);
407 printk( "FDC_SPEED "); 370 printk("FDC_SPEED ");
408 } 371 }
409 if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) { 372 if (!MACH_IS_HADES && !ATARIHW_PRESENT(ST_SCSI)) {
410 ATARIHW_SET(ACSI); 373 ATARIHW_SET(ACSI);
411 printk( "ACSI " ); 374 printk("ACSI ");
412 } 375 }
413 printk("\n"); 376 printk("\n");
414 377
415 if (CPU_IS_040_OR_060) 378 if (CPU_IS_040_OR_060)
416 /* Now it seems to be safe to turn of the tt0 transparent 379 /* Now it seems to be safe to turn of the tt0 transparent
417 * translation (the one that must not be turned off in 380 * translation (the one that must not be turned off in
418 * head.S...) 381 * head.S...)
419 */ 382 */
420 __asm__ volatile ("moveq #0,%/d0\n\t" 383 asm volatile ("\n"
421 ".chip 68040\n\t" 384 " moveq #0,%%d0\n"
422 "movec %%d0,%%itt0\n\t" 385 " .chip 68040\n"
423 "movec %%d0,%%dtt0\n\t" 386 " movec %%d0,%%itt0\n"
424 ".chip 68k" 387 " movec %%d0,%%dtt0\n"
425 : /* no outputs */ 388 " .chip 68k"
426 : /* no inputs */ 389 : /* no outputs */
427 : "d0"); 390 : /* no inputs */
428 391 : "d0");
429 /* allocator for memory that must reside in st-ram */ 392
430 atari_stram_init (); 393 /* allocator for memory that must reside in st-ram */
431 394 atari_stram_init();
432 /* Set up a mapping for the VMEbus address region: 395
433 * 396 /* Set up a mapping for the VMEbus address region:
434 * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff 397 *
435 * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at 398 * VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff
436 * 0xfe000000 virt., because this can be done with a single 399 * (MegaSTE) In both cases, the whole 16 MB chunk is mapped at
437 * transparent translation. On the 68040, lots of often unused 400 * 0xfe000000 virt., because this can be done with a single
438 * page tables would be needed otherwise. On a MegaSTE or similar, 401 * transparent translation. On the 68040, lots of often unused
439 * the highest byte is stripped off by hardware due to the 24 bit 402 * page tables would be needed otherwise. On a MegaSTE or similar,
440 * design of the bus. 403 * the highest byte is stripped off by hardware due to the 24 bit
441 */ 404 * design of the bus.
405 */
406
407 if (CPU_IS_020_OR_030) {
408 unsigned long tt1_val;
409 tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache
410 * inhibit, read and write, FDC mask = 3,
411 * FDC val = 4 -> Supervisor only */
412 asm volatile ("\n"
413 " .chip 68030\n"
414 " pmove %0@,%/tt1\n"
415 " .chip 68k"
416 : : "a" (&tt1_val));
417 } else {
418 asm volatile ("\n"
419 " .chip 68040\n"
420 " movec %0,%%itt1\n"
421 " movec %0,%%dtt1\n"
422 " .chip 68k"
423 :
424 : "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable,
425 * supervisor only, non-cacheable/
426 * serialized, writable */
427
428 }
442 429
443 if (CPU_IS_020_OR_030) { 430 /* Fetch tos version at Physical 2 */
444 unsigned long tt1_val; 431 /*
445 tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache 432 * We my not be able to access this address if the kernel is
446 * inhibit, read and write, FDC mask = 3, 433 * loaded to st ram, since the first page is unmapped. On the
447 * FDC val = 4 -> Supervisor only */ 434 * Medusa this is always the case and there is nothing we can do
448 __asm__ __volatile__ ( ".chip 68030\n\t" 435 * about this, so we just assume the smaller offset. For the TT
449 "pmove %0@,%/tt1\n\t" 436 * we use the fact that in head.S we have set up a mapping
450 ".chip 68k" 437 * 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
451 : : "a" (&tt1_val) ); 438 * in the last 16MB of the address space.
452 } 439 */
453 else { 440 tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ?
454 __asm__ __volatile__ 441 0xfff : *(unsigned short *)0xff000002;
455 ( "movel %0,%/d0\n\t" 442 atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
456 ".chip 68040\n\t"
457 "movec %%d0,%%itt1\n\t"
458 "movec %%d0,%%dtt1\n\t"
459 ".chip 68k"
460 :
461 : "g" (0xfe00a040) /* Translate 0xfexxxxxx, enable,
462 * supervisor only, non-cacheable/
463 * serialized, writable */
464 : "d0" );
465
466 }
467
468 /* Fetch tos version at Physical 2 */
469 /* We my not be able to access this address if the kernel is
470 loaded to st ram, since the first page is unmapped. On the
471 Medusa this is always the case and there is nothing we can do
472 about this, so we just assume the smaller offset. For the TT
473 we use the fact that in head.S we have set up a mapping
474 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
475 in the last 16MB of the address space. */
476 tos_version = (MACH_IS_MEDUSA || MACH_IS_HADES) ?
477 0xfff : *(unsigned short *)0xff000002;
478 atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
479} 443}
480 444
481#ifdef CONFIG_HEARTBEAT 445#ifdef CONFIG_HEARTBEAT
482static void atari_heartbeat( int on ) 446static void atari_heartbeat(int on)
483{ 447{
484 unsigned char tmp; 448 unsigned char tmp;
485 unsigned long flags; 449 unsigned long flags;
486 450
487 if (atari_dont_touch_floppy_select) 451 if (atari_dont_touch_floppy_select)
488 return; 452 return;
489 453
490 local_irq_save(flags); 454 local_irq_save(flags);
491 sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */ 455 sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
492 tmp = sound_ym.rd_data_reg_sel; 456 tmp = sound_ym.rd_data_reg_sel;
493 sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02); 457 sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02);
494 local_irq_restore(flags); 458 local_irq_restore(flags);
495} 459}
496#endif 460#endif
497 461
@@ -526,180 +490,171 @@ static void atari_heartbeat( int on )
526 490
527/* ++andreas: no need for complicated code, just depend on prefetch */ 491/* ++andreas: no need for complicated code, just depend on prefetch */
528 492
529static void atari_reset (void) 493static void atari_reset(void)
530{ 494{
531 long tc_val = 0; 495 long tc_val = 0;
532 long reset_addr; 496 long reset_addr;
533 497
534 /* On the Medusa, phys. 0x4 may contain garbage because it's no 498 /*
535 ROM. See above for explanation why we cannot use PTOV(4). */ 499 * On the Medusa, phys. 0x4 may contain garbage because it's no
536 reset_addr = MACH_IS_HADES ? 0x7fe00030 : 500 * ROM. See above for explanation why we cannot use PTOV(4).
537 MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 : 501 */
538 *(unsigned long *) 0xff000004; 502 reset_addr = MACH_IS_HADES ? 0x7fe00030 :
539 503 MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
540 /* reset ACIA for switch off OverScan, if it's active */ 504 *(unsigned long *) 0xff000004;
541 if (atari_switches & ATARI_SWITCH_OVSC_IKBD) 505
542 acia.key_ctrl = ACIA_RESET; 506 /* reset ACIA for switch off OverScan, if it's active */
543 if (atari_switches & ATARI_SWITCH_OVSC_MIDI) 507 if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
544 acia.mid_ctrl = ACIA_RESET; 508 acia.key_ctrl = ACIA_RESET;
545 509 if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
546 /* processor independent: turn off interrupts and reset the VBR; 510 acia.mid_ctrl = ACIA_RESET;
547 * the caches must be left enabled, else prefetching the final jump 511
548 * instruction doesn't work. */ 512 /* processor independent: turn off interrupts and reset the VBR;
549 local_irq_disable(); 513 * the caches must be left enabled, else prefetching the final jump
550 __asm__ __volatile__ 514 * instruction doesn't work.
551 ("moveq #0,%/d0\n\t" 515 */
552 "movec %/d0,%/vbr" 516 local_irq_disable();
553 : : : "d0" ); 517 asm volatile ("movec %0,%%vbr"
554 518 : : "d" (0));
555 if (CPU_IS_040_OR_060) { 519
556 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040); 520 if (CPU_IS_040_OR_060) {
557 if (CPU_IS_060) { 521 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
558 /* 68060: clear PCR to turn off superscalar operation */ 522 if (CPU_IS_060) {
559 __asm__ __volatile__ 523 /* 68060: clear PCR to turn off superscalar operation */
560 ("moveq #0,%/d0\n\t" 524 asm volatile ("\n"
561 ".chip 68060\n\t" 525 " .chip 68060\n"
562 "movec %%d0,%%pcr\n\t" 526 " movec %0,%%pcr\n"
563 ".chip 68k" 527 " .chip 68k"
564 : : : "d0" ); 528 : : "d" (0));
565 } 529 }
566 530
567 __asm__ __volatile__ 531 asm volatile ("\n"
568 ("movel %0,%/d0\n\t" 532 " move.l %0,%%d0\n"
569 "andl #0xff000000,%/d0\n\t" 533 " and.l #0xff000000,%%d0\n"
570 "orw #0xe020,%/d0\n\t" /* map 16 MB, enable, cacheable */ 534 " or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
571 ".chip 68040\n\t" 535 " .chip 68040\n"
572 "movec %%d0,%%itt0\n\t" 536 " movec %%d0,%%itt0\n"
573 "movec %%d0,%%dtt0\n\t" 537 " movec %%d0,%%dtt0\n"
574 ".chip 68k\n\t" 538 " .chip 68k\n"
575 "jmp %0@\n\t" 539 " jmp %0@"
576 : /* no outputs */ 540 : : "a" (jmp_addr040)
577 : "a" (jmp_addr040) 541 : "d0");
578 : "d0" ); 542 jmp_addr_label040:
579 jmp_addr_label040: 543 asm volatile ("\n"
580 __asm__ __volatile__ 544 " moveq #0,%%d0\n"
581 ("moveq #0,%/d0\n\t" 545 " nop\n"
582 "nop\n\t" 546 " .chip 68040\n"
583 ".chip 68040\n\t" 547 " cinva %%bc\n"
584 "cinva %%bc\n\t" 548 " nop\n"
585 "nop\n\t" 549 " pflusha\n"
586 "pflusha\n\t" 550 " nop\n"
587 "nop\n\t" 551 " movec %%d0,%%tc\n"
588 "movec %%d0,%%tc\n\t" 552 " nop\n"
589 "nop\n\t" 553 /* the following setup of transparent translations is needed on the
590 /* the following setup of transparent translations is needed on the 554 * Afterburner040 to successfully reboot. Other machines shouldn't
591 * Afterburner040 to successfully reboot. Other machines shouldn't 555 * care about a different tt regs setup, they also didn't care in
592 * care about a different tt regs setup, they also didn't care in 556 * the past that the regs weren't turned off. */
593 * the past that the regs weren't turned off. */ 557 " move.l #0xffc000,%%d0\n" /* whole insn space cacheable */
594 "movel #0xffc000,%%d0\n\t" /* whole insn space cacheable */ 558 " movec %%d0,%%itt0\n"
595 "movec %%d0,%%itt0\n\t" 559 " movec %%d0,%%itt1\n"
596 "movec %%d0,%%itt1\n\t" 560 " or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */
597 "orw #0x40,%/d0\n\t" /* whole data space non-cacheable/ser. */ 561 " movec %%d0,%%dtt0\n"
598 "movec %%d0,%%dtt0\n\t" 562 " movec %%d0,%%dtt1\n"
599 "movec %%d0,%%dtt1\n\t" 563 " .chip 68k\n"
600 ".chip 68k\n\t" 564 " jmp %0@"
601 "jmp %0@" 565 : /* no outputs */
602 : /* no outputs */ 566 : "a" (reset_addr)
603 : "a" (reset_addr) 567 : "d0");
604 : "d0"); 568 } else
605 } 569 asm volatile ("\n"
606 else 570 " pmove %0@,%%tc\n"
607 __asm__ __volatile__ 571 " jmp %1@"
608 ("pmove %0@,%/tc\n\t" 572 : /* no outputs */
609 "jmp %1@" 573 : "a" (&tc_val), "a" (reset_addr));
610 : /* no outputs */
611 : "a" (&tc_val), "a" (reset_addr));
612} 574}
613 575
614 576
615static void atari_get_model(char *model) 577static void atari_get_model(char *model)
616{ 578{
617 strcpy(model, "Atari "); 579 strcpy(model, "Atari ");
618 switch (atari_mch_cookie >> 16) { 580 switch (atari_mch_cookie >> 16) {
619 case ATARI_MCH_ST: 581 case ATARI_MCH_ST:
620 if (ATARIHW_PRESENT(MSTE_CLK)) 582 if (ATARIHW_PRESENT(MSTE_CLK))
621 strcat (model, "Mega ST"); 583 strcat(model, "Mega ST");
622 else 584 else
623 strcat (model, "ST"); 585 strcat(model, "ST");
624 break; 586 break;
625 case ATARI_MCH_STE: 587 case ATARI_MCH_STE:
626 if (MACH_IS_MSTE) 588 if (MACH_IS_MSTE)
627 strcat (model, "Mega STE"); 589 strcat(model, "Mega STE");
628 else 590 else
629 strcat (model, "STE"); 591 strcat(model, "STE");
630 break; 592 break;
631 case ATARI_MCH_TT: 593 case ATARI_MCH_TT:
632 if (MACH_IS_MEDUSA) 594 if (MACH_IS_MEDUSA)
633 /* Medusa has TT _MCH cookie */ 595 /* Medusa has TT _MCH cookie */
634 strcat (model, "Medusa"); 596 strcat(model, "Medusa");
635 else if (MACH_IS_HADES) 597 else if (MACH_IS_HADES)
636 strcat(model, "Hades"); 598 strcat(model, "Hades");
637 else 599 else
638 strcat (model, "TT"); 600 strcat(model, "TT");
639 break; 601 break;
640 case ATARI_MCH_FALCON: 602 case ATARI_MCH_FALCON:
641 strcat (model, "Falcon"); 603 strcat(model, "Falcon");
642 if (MACH_IS_AB40) 604 if (MACH_IS_AB40)
643 strcat (model, " (with Afterburner040)"); 605 strcat(model, " (with Afterburner040)");
644 break; 606 break;
645 default: 607 default:
646 sprintf (model + strlen (model), "(unknown mach cookie 0x%lx)", 608 sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)",
647 atari_mch_cookie); 609 atari_mch_cookie);
648 break; 610 break;
649 } 611 }
650} 612}
651 613
652 614
653static int atari_get_hardware_list(char *buffer) 615static int atari_get_hardware_list(char *buffer)
654{ 616{
655 int len = 0, i; 617 int len = 0, i;
656 618
657 for (i = 0; i < m68k_num_memory; i++) 619 for (i = 0; i < m68k_num_memory; i++)
658 len += sprintf (buffer+len, "\t%3ld MB at 0x%08lx (%s)\n", 620 len += sprintf(buffer+len, "\t%3ld MB at 0x%08lx (%s)\n",
659 m68k_memory[i].size >> 20, m68k_memory[i].addr, 621 m68k_memory[i].size >> 20, m68k_memory[i].addr,
660 (m68k_memory[i].addr & 0xff000000 ? 622 (m68k_memory[i].addr & 0xff000000 ?
661 "alternate RAM" : "ST-RAM")); 623 "alternate RAM" : "ST-RAM"));
662 624
663#define ATARIHW_ANNOUNCE(name,str) \ 625#define ATARIHW_ANNOUNCE(name, str) \
664 if (ATARIHW_PRESENT(name)) \ 626 if (ATARIHW_PRESENT(name)) \
665 len += sprintf (buffer + len, "\t%s\n", str) 627 len += sprintf(buffer + len, "\t%s\n", str)
666 628
667 len += sprintf (buffer + len, "Detected hardware:\n"); 629 len += sprintf(buffer + len, "Detected hardware:\n");
668 ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter"); 630 ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter");
669 ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter"); 631 ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter");
670 ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter"); 632 ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter");
671 ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter"); 633 ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter");
672 ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator"); 634 ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator");
673 ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound"); 635 ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound");
674 ATARIHW_ANNOUNCE(CODEC, "CODEC Sound"); 636 ATARIHW_ANNOUNCE(CODEC, "CODEC Sound");
675 ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)"); 637 ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)");
676 ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)"); 638 ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)");
677 ATARIHW_ANNOUNCE(ACSI, "ACSI Interface"); 639 ATARIHW_ANNOUNCE(ACSI, "ACSI Interface");
678 ATARIHW_ANNOUNCE(IDE, "IDE Interface"); 640 ATARIHW_ANNOUNCE(IDE, "IDE Interface");
679 ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC"); 641 ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC");
680 ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901"); 642 ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901");
681 ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901"); 643 ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901");
682 ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530"); 644 ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530");
683 ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230"); 645 ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230");
684 ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface"); 646 ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface");
685 ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface"); 647 ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface");
686 ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)"); 648 ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)");
687 ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)"); 649 ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)");
688 ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380"); 650 ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380");
689 ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC"); 651 ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC");
690 ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A"); 652 ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A");
691 ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15"); 653 ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15");
692 ATARIHW_ANNOUNCE(SCU, "System Control Unit"); 654 ATARIHW_ANNOUNCE(SCU, "System Control Unit");
693 ATARIHW_ANNOUNCE(BLITTER, "Blitter"); 655 ATARIHW_ANNOUNCE(BLITTER, "Blitter");
694 ATARIHW_ANNOUNCE(VME, "VME Bus"); 656 ATARIHW_ANNOUNCE(VME, "VME Bus");
695 ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor"); 657 ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
696 658
697 return(len); 659 return len;
698} 660}
699
700/*
701 * Local variables:
702 * c-indent-level: 4
703 * tab-width: 8
704 * End:
705 */
diff --git a/arch/m68k/atari/debug.c b/arch/m68k/atari/debug.c
index 4ae01004d8dd..66983fe87509 100644
--- a/arch/m68k/atari/debug.c
+++ b/arch/m68k/atari/debug.c
@@ -30,317 +30,311 @@ int atari_SCC_init_done;
30int atari_SCC_reset_done; 30int atari_SCC_reset_done;
31 31
32static struct console atari_console_driver = { 32static struct console atari_console_driver = {
33 .name = "debug", 33 .name = "debug",
34 .flags = CON_PRINTBUFFER, 34 .flags = CON_PRINTBUFFER,
35 .index = -1, 35 .index = -1,
36}; 36};
37 37
38 38
39static inline void ata_mfp_out (char c) 39static inline void ata_mfp_out(char c)
40{ 40{
41 while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */ 41 while (!(mfp.trn_stat & 0x80)) /* wait for tx buf empty */
42 barrier (); 42 barrier();
43 mfp.usart_dta = c; 43 mfp.usart_dta = c;
44} 44}
45 45
46void atari_mfp_console_write (struct console *co, const char *str, 46void atari_mfp_console_write(struct console *co, const char *str,
47 unsigned int count) 47 unsigned int count)
48{ 48{
49 while (count--) { 49 while (count--) {
50 if (*str == '\n') 50 if (*str == '\n')
51 ata_mfp_out( '\r' ); 51 ata_mfp_out('\r');
52 ata_mfp_out( *str++ ); 52 ata_mfp_out(*str++);
53 } 53 }
54} 54}
55 55
56static inline void ata_scc_out (char c) 56static inline void ata_scc_out(char c)
57{ 57{
58 do { 58 do {
59 MFPDELAY();
60 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
59 MFPDELAY(); 61 MFPDELAY();
60 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ 62 scc.cha_b_data = c;
61 MFPDELAY();
62 scc.cha_b_data = c;
63} 63}
64 64
65void atari_scc_console_write (struct console *co, const char *str, 65void atari_scc_console_write(struct console *co, const char *str,
66 unsigned int count) 66 unsigned int count)
67{ 67{
68 while (count--) { 68 while (count--) {
69 if (*str == '\n') 69 if (*str == '\n')
70 ata_scc_out( '\r' ); 70 ata_scc_out('\r');
71 ata_scc_out( *str++ ); 71 ata_scc_out(*str++);
72 } 72 }
73} 73}
74 74
75static inline void ata_midi_out (char c) 75static inline void ata_midi_out(char c)
76{ 76{
77 while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */ 77 while (!(acia.mid_ctrl & ACIA_TDRE)) /* wait for tx buf empty */
78 barrier (); 78 barrier();
79 acia.mid_data = c; 79 acia.mid_data = c;
80} 80}
81 81
82void atari_midi_console_write (struct console *co, const char *str, 82void atari_midi_console_write(struct console *co, const char *str,
83 unsigned int count) 83 unsigned int count)
84{ 84{
85 while (count--) { 85 while (count--) {
86 if (*str == '\n') 86 if (*str == '\n')
87 ata_midi_out( '\r' ); 87 ata_midi_out('\r');
88 ata_midi_out( *str++ ); 88 ata_midi_out(*str++);
89 } 89 }
90} 90}
91 91
92static int ata_par_out (char c) 92static int ata_par_out(char c)
93{ 93{
94 unsigned char tmp; 94 unsigned char tmp;
95 /* This a some-seconds timeout in case no printer is connected */ 95 /* This a some-seconds timeout in case no printer is connected */
96 unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ; 96 unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ;
97 97
98 while( (mfp.par_dt_reg & 1) && --i ) /* wait for BUSY == L */ 98 while ((mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */
99 ; 99 ;
100 if (!i) return( 0 ); 100 if (!i)
101 101 return 0;
102 sound_ym.rd_data_reg_sel = 15; /* select port B */ 102
103 sound_ym.wd_data = c; /* put char onto port */ 103 sound_ym.rd_data_reg_sel = 15; /* select port B */
104 sound_ym.rd_data_reg_sel = 14; /* select port A */ 104 sound_ym.wd_data = c; /* put char onto port */
105 tmp = sound_ym.rd_data_reg_sel; 105 sound_ym.rd_data_reg_sel = 14; /* select port A */
106 sound_ym.wd_data = tmp & ~0x20; /* set strobe L */ 106 tmp = sound_ym.rd_data_reg_sel;
107 MFPDELAY(); /* wait a bit */ 107 sound_ym.wd_data = tmp & ~0x20; /* set strobe L */
108 sound_ym.wd_data = tmp | 0x20; /* set strobe H */ 108 MFPDELAY(); /* wait a bit */
109 return( 1 ); 109 sound_ym.wd_data = tmp | 0x20; /* set strobe H */
110 return 1;
110} 111}
111 112
112static void atari_par_console_write (struct console *co, const char *str, 113static void atari_par_console_write(struct console *co, const char *str,
113 unsigned int count) 114 unsigned int count)
114{ 115{
115 static int printer_present = 1; 116 static int printer_present = 1;
116
117 if (!printer_present)
118 return;
119 117
120 while (count--) { 118 if (!printer_present)
121 if (*str == '\n')
122 if (!ata_par_out( '\r' )) {
123 printer_present = 0;
124 return; 119 return;
125 } 120
126 if (!ata_par_out( *str++ )) { 121 while (count--) {
127 printer_present = 0; 122 if (*str == '\n') {
128 return; 123 if (!ata_par_out('\r')) {
124 printer_present = 0;
125 return;
126 }
127 }
128 if (!ata_par_out(*str++)) {
129 printer_present = 0;
130 return;
131 }
129 } 132 }
130 }
131} 133}
132 134
133#ifdef CONFIG_SERIAL_CONSOLE 135#ifdef CONFIG_SERIAL_CONSOLE
134int atari_mfp_console_wait_key(struct console *co) 136int atari_mfp_console_wait_key(struct console *co)
135{ 137{
136 while( !(mfp.rcv_stat & 0x80) ) /* wait for rx buf filled */ 138 while (!(mfp.rcv_stat & 0x80)) /* wait for rx buf filled */
137 barrier(); 139 barrier();
138 return( mfp.usart_dta ); 140 return mfp.usart_dta;
139} 141}
140 142
141int atari_scc_console_wait_key(struct console *co) 143int atari_scc_console_wait_key(struct console *co)
142{ 144{
143 do { 145 do {
146 MFPDELAY();
147 } while (!(scc.cha_b_ctrl & 0x01)); /* wait for rx buf filled */
144 MFPDELAY(); 148 MFPDELAY();
145 } while( !(scc.cha_b_ctrl & 0x01) ); /* wait for rx buf filled */ 149 return scc.cha_b_data;
146 MFPDELAY();
147 return( scc.cha_b_data );
148} 150}
149 151
150int atari_midi_console_wait_key(struct console *co) 152int atari_midi_console_wait_key(struct console *co)
151{ 153{
152 while( !(acia.mid_ctrl & ACIA_RDRF) ) /* wait for rx buf filled */ 154 while (!(acia.mid_ctrl & ACIA_RDRF)) /* wait for rx buf filled */
153 barrier(); 155 barrier();
154 return( acia.mid_data ); 156 return acia.mid_data;
155} 157}
156#endif 158#endif
157 159
158/* The following two functions do a quick'n'dirty initialization of the MFP or 160/*
161 * The following two functions do a quick'n'dirty initialization of the MFP or
159 * SCC serial ports. They're used by the debugging interface, kgdb, and the 162 * SCC serial ports. They're used by the debugging interface, kgdb, and the
160 * serial console code. */ 163 * serial console code.
164 */
161#ifndef CONFIG_SERIAL_CONSOLE 165#ifndef CONFIG_SERIAL_CONSOLE
162static void __init atari_init_mfp_port( int cflag ) 166static void __init atari_init_mfp_port(int cflag)
163#else 167#else
164void atari_init_mfp_port( int cflag ) 168void atari_init_mfp_port(int cflag)
165#endif 169#endif
166{ 170{
167 /* timer values for 1200...115200 bps; > 38400 select 110, 134, or 150 171 /*
168 * bps, resp., and work only correct if there's a RSVE or RSSPEED */ 172 * timer values for 1200...115200 bps; > 38400 select 110, 134, or 150
169 static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 }; 173 * bps, resp., and work only correct if there's a RSVE or RSSPEED
170 int baud = cflag & CBAUD; 174 */
171 int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0; 175 static int baud_table[9] = { 16, 11, 8, 4, 2, 1, 175, 143, 128 };
172 int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00; 176 int baud = cflag & CBAUD;
173 177 int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x04 : 0x06) : 0;
174 if (cflag & CBAUDEX) 178 int csize = ((cflag & CSIZE) == CS7) ? 0x20 : 0x00;
175 baud += B38400; 179
176 if (baud < B1200 || baud > B38400+2) 180 if (cflag & CBAUDEX)
177 baud = B9600; /* use default 9600bps for non-implemented rates */ 181 baud += B38400;
178 baud -= B1200; /* baud_table[] starts at 1200bps */ 182 if (baud < B1200 || baud > B38400+2)
179 183 baud = B9600; /* use default 9600bps for non-implemented rates */
180 mfp.trn_stat &= ~0x01; /* disable TX */ 184 baud -= B1200; /* baud_table[] starts at 1200bps */
181 mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */ 185
182 mfp.tim_ct_cd &= 0x70; /* stop timer D */ 186 mfp.trn_stat &= ~0x01; /* disable TX */
183 mfp.tim_dt_d = baud_table[baud]; 187 mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
184 mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */ 188 mfp.tim_ct_cd &= 0x70; /* stop timer D */
185 mfp.trn_stat |= 0x01; /* enable TX */ 189 mfp.tim_dt_d = baud_table[baud];
186 190 mfp.tim_ct_cd |= 0x01; /* start timer D, 1:4 */
187 atari_MFP_init_done = 1; 191 mfp.trn_stat |= 0x01; /* enable TX */
192
193 atari_MFP_init_done = 1;
188} 194}
189 195
190#define SCC_WRITE(reg,val) \ 196#define SCC_WRITE(reg, val) \
191 do { \ 197 do { \
192 scc.cha_b_ctrl = (reg); \ 198 scc.cha_b_ctrl = (reg); \
193 MFPDELAY(); \ 199 MFPDELAY(); \
194 scc.cha_b_ctrl = (val); \ 200 scc.cha_b_ctrl = (val); \
195 MFPDELAY(); \ 201 MFPDELAY(); \
196 } while(0) 202 } while (0)
197 203
198/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a 204/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
199 * delay of ~ 60us. */ 205 * delay of ~ 60us. */
200#define LONG_DELAY() \ 206#define LONG_DELAY() \
201 do { \ 207 do { \
202 int i; \ 208 int i; \
203 for( i = 100; i > 0; --i ) \ 209 for (i = 100; i > 0; --i) \
204 MFPDELAY(); \ 210 MFPDELAY(); \
205 } while(0) 211 } while (0)
206 212
207#ifndef CONFIG_SERIAL_CONSOLE 213#ifndef CONFIG_SERIAL_CONSOLE
208static void __init atari_init_scc_port( int cflag ) 214static void __init atari_init_scc_port(int cflag)
209#else 215#else
210void atari_init_scc_port( int cflag ) 216void atari_init_scc_port(int cflag)
211#endif 217#endif
212{ 218{
213 extern int atari_SCC_reset_done; 219 extern int atari_SCC_reset_done;
214 static int clksrc_table[9] = 220 static int clksrc_table[9] =
215 /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ 221 /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */
216 { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; 222 { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 };
217 static int brgsrc_table[9] = 223 static int brgsrc_table[9] =
218 /* reg 14: 0 = RTxC, 2 = PCLK */ 224 /* reg 14: 0 = RTxC, 2 = PCLK */
219 { 2, 2, 2, 2, 2, 2, 0, 2, 2 }; 225 { 2, 2, 2, 2, 2, 2, 0, 2, 2 };
220 static int clkmode_table[9] = 226 static int clkmode_table[9] =
221 /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */ 227 /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */
222 { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 }; 228 { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 };
223 static int div_table[9] = 229 static int div_table[9] =
224 /* reg12 (BRG low) */ 230 /* reg12 (BRG low) */
225 { 208, 138, 103, 50, 24, 11, 1, 0, 0 }; 231 { 208, 138, 103, 50, 24, 11, 1, 0, 0 };
226 232
227 int baud = cflag & CBAUD; 233 int baud = cflag & CBAUD;
228 int clksrc, clkmode, div, reg3, reg5; 234 int clksrc, clkmode, div, reg3, reg5;
229 235
230 if (cflag & CBAUDEX) 236 if (cflag & CBAUDEX)
231 baud += B38400; 237 baud += B38400;
232 if (baud < B1200 || baud > B38400+2) 238 if (baud < B1200 || baud > B38400+2)
233 baud = B9600; /* use default 9600bps for non-implemented rates */ 239 baud = B9600; /* use default 9600bps for non-implemented rates */
234 baud -= B1200; /* tables starts at 1200bps */ 240 baud -= B1200; /* tables starts at 1200bps */
235 241
236 clksrc = clksrc_table[baud]; 242 clksrc = clksrc_table[baud];
237 clkmode = clkmode_table[baud]; 243 clkmode = clkmode_table[baud];
238 div = div_table[baud]; 244 div = div_table[baud];
239 if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) { 245 if (ATARIHW_PRESENT(TT_MFP) && baud >= 6) {
240 /* special treatment for TT, where rates >= 38400 are done via TRxC */ 246 /* special treatment for TT, where rates >= 38400 are done via TRxC */
241 clksrc = 0x28; /* TRxC */ 247 clksrc = 0x28; /* TRxC */
242 clkmode = baud == 6 ? 0xc0 : 248 clkmode = baud == 6 ? 0xc0 :
243 baud == 7 ? 0x80 : /* really 76800bps */ 249 baud == 7 ? 0x80 : /* really 76800bps */
244 0x40; /* really 153600bps */ 250 0x40; /* really 153600bps */
245 div = 0; 251 div = 0;
246 } 252 }
247 253
248 reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40; 254 reg3 = (cflag & CSIZE) == CS8 ? 0xc0 : 0x40;
249 reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */; 255 reg5 = (cflag & CSIZE) == CS8 ? 0x60 : 0x20 | 0x82 /* assert DTR/RTS */;
250 256
251 (void)scc.cha_b_ctrl; /* reset reg pointer */ 257 (void)scc.cha_b_ctrl; /* reset reg pointer */
252 SCC_WRITE( 9, 0xc0 ); /* reset */ 258 SCC_WRITE(9, 0xc0); /* reset */
253 LONG_DELAY(); /* extra delay after WR9 access */ 259 LONG_DELAY(); /* extra delay after WR9 access */
254 SCC_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | 260 SCC_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03)
255 0x04 /* 1 stopbit */ | 261 : 0 | 0x04 /* 1 stopbit */ | clkmode);
256 clkmode ); 262 SCC_WRITE(3, reg3);
257 SCC_WRITE( 3, reg3 ); 263 SCC_WRITE(5, reg5);
258 SCC_WRITE( 5, reg5 ); 264 SCC_WRITE(9, 0); /* no interrupts */
259 SCC_WRITE( 9, 0 ); /* no interrupts */ 265 LONG_DELAY(); /* extra delay after WR9 access */
260 LONG_DELAY(); /* extra delay after WR9 access */ 266 SCC_WRITE(10, 0); /* NRZ mode */
261 SCC_WRITE( 10, 0 ); /* NRZ mode */ 267 SCC_WRITE(11, clksrc); /* main clock source */
262 SCC_WRITE( 11, clksrc ); /* main clock source */ 268 SCC_WRITE(12, div); /* BRG value */
263 SCC_WRITE( 12, div ); /* BRG value */ 269 SCC_WRITE(13, 0); /* BRG high byte */
264 SCC_WRITE( 13, 0 ); /* BRG high byte */ 270 SCC_WRITE(14, brgsrc_table[baud]);
265 SCC_WRITE( 14, brgsrc_table[baud] ); 271 SCC_WRITE(14, brgsrc_table[baud] | (div ? 1 : 0));
266 SCC_WRITE( 14, brgsrc_table[baud] | (div ? 1 : 0) ); 272 SCC_WRITE(3, reg3 | 1);
267 SCC_WRITE( 3, reg3 | 1 ); 273 SCC_WRITE(5, reg5 | 8);
268 SCC_WRITE( 5, reg5 | 8 ); 274
269 275 atari_SCC_reset_done = 1;
270 atari_SCC_reset_done = 1; 276 atari_SCC_init_done = 1;
271 atari_SCC_init_done = 1;
272} 277}
273 278
274#ifndef CONFIG_SERIAL_CONSOLE 279#ifndef CONFIG_SERIAL_CONSOLE
275static void __init atari_init_midi_port( int cflag ) 280static void __init atari_init_midi_port(int cflag)
276#else 281#else
277void atari_init_midi_port( int cflag ) 282void atari_init_midi_port(int cflag)
278#endif 283#endif
279{ 284{
280 int baud = cflag & CBAUD; 285 int baud = cflag & CBAUD;
281 int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00; 286 int csize = ((cflag & CSIZE) == CS8) ? 0x10 : 0x00;
282 /* warning 7N1 isn't possible! (instead 7O2 is used...) */ 287 /* warning 7N1 isn't possible! (instead 7O2 is used...) */
283 int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04; 288 int parity = (cflag & PARENB) ? ((cflag & PARODD) ? 0x0c : 0x08) : 0x04;
284 int div; 289 int div;
285 290
286 /* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as 291 /* 4800 selects 7812.5, 115200 selects 500000, all other (incl. 9600 as
287 * default) the standard MIDI speed 31250. */ 292 * default) the standard MIDI speed 31250. */
288 if (cflag & CBAUDEX) 293 if (cflag & CBAUDEX)
289 baud += B38400; 294 baud += B38400;
290 if (baud == B4800) 295 if (baud == B4800)
291 div = ACIA_DIV64; /* really 7812.5 bps */ 296 div = ACIA_DIV64; /* really 7812.5 bps */
292 else if (baud == B38400+2 /* 115200 */) 297 else if (baud == B38400+2 /* 115200 */)
293 div = ACIA_DIV1; /* really 500 kbps (does that work??) */ 298 div = ACIA_DIV1; /* really 500 kbps (does that work??) */
294 else 299 else
295 div = ACIA_DIV16; /* 31250 bps, standard for MIDI */ 300 div = ACIA_DIV16; /* 31250 bps, standard for MIDI */
296 301
297 /* RTS low, ints disabled */ 302 /* RTS low, ints disabled */
298 acia.mid_ctrl = div | csize | parity | 303 acia.mid_ctrl = div | csize | parity |
299 ((atari_switches & ATARI_SWITCH_MIDI) ? 304 ((atari_switches & ATARI_SWITCH_MIDI) ?
300 ACIA_RHTID : ACIA_RLTID); 305 ACIA_RHTID : ACIA_RLTID);
301} 306}
302 307
303void __init atari_debug_init(void) 308void __init atari_debug_init(void)
304{ 309{
305 if (!strcmp( m68k_debug_device, "ser" )) { 310 if (!strcmp(m68k_debug_device, "ser")) {
306 /* defaults to ser2 for a Falcon and ser1 otherwise */ 311 /* defaults to ser2 for a Falcon and ser1 otherwise */
307 strcpy( m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1" ); 312 strcpy(m68k_debug_device, MACH_IS_FALCON ? "ser2" : "ser1");
308 313 }
309 }
310
311 if (!strcmp( m68k_debug_device, "ser1" )) {
312 /* ST-MFP Modem1 serial port */
313 atari_init_mfp_port( B9600|CS8 );
314 atari_console_driver.write = atari_mfp_console_write;
315 }
316 else if (!strcmp( m68k_debug_device, "ser2" )) {
317 /* SCC Modem2 serial port */
318 atari_init_scc_port( B9600|CS8 );
319 atari_console_driver.write = atari_scc_console_write;
320 }
321 else if (!strcmp( m68k_debug_device, "midi" )) {
322 /* MIDI port */
323 atari_init_midi_port( B9600|CS8 );
324 atari_console_driver.write = atari_midi_console_write;
325 }
326 else if (!strcmp( m68k_debug_device, "par" )) {
327 /* parallel printer */
328 atari_turnoff_irq( IRQ_MFP_BUSY ); /* avoid ints */
329 sound_ym.rd_data_reg_sel = 7; /* select mixer control */
330 sound_ym.wd_data = 0xff; /* sound off, ports are output */
331 sound_ym.rd_data_reg_sel = 15; /* select port B */
332 sound_ym.wd_data = 0; /* no char */
333 sound_ym.rd_data_reg_sel = 14; /* select port A */
334 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
335 atari_console_driver.write = atari_par_console_write;
336 }
337 if (atari_console_driver.write)
338 register_console(&atari_console_driver);
339}
340 314
341/* 315 if (!strcmp(m68k_debug_device, "ser1")) {
342 * Local variables: 316 /* ST-MFP Modem1 serial port */
343 * c-indent-level: 4 317 atari_init_mfp_port(B9600|CS8);
344 * tab-width: 8 318 atari_console_driver.write = atari_mfp_console_write;
345 * End: 319 } else if (!strcmp(m68k_debug_device, "ser2")) {
346 */ 320 /* SCC Modem2 serial port */
321 atari_init_scc_port(B9600|CS8);
322 atari_console_driver.write = atari_scc_console_write;
323 } else if (!strcmp(m68k_debug_device, "midi")) {
324 /* MIDI port */
325 atari_init_midi_port(B9600|CS8);
326 atari_console_driver.write = atari_midi_console_write;
327 } else if (!strcmp(m68k_debug_device, "par")) {
328 /* parallel printer */
329 atari_turnoff_irq(IRQ_MFP_BUSY); /* avoid ints */
330 sound_ym.rd_data_reg_sel = 7; /* select mixer control */
331 sound_ym.wd_data = 0xff; /* sound off, ports are output */
332 sound_ym.rd_data_reg_sel = 15; /* select port B */
333 sound_ym.wd_data = 0; /* no char */
334 sound_ym.rd_data_reg_sel = 14; /* select port A */
335 sound_ym.wd_data = sound_ym.rd_data_reg_sel | 0x20; /* strobe H */
336 atari_console_driver.write = atari_par_console_write;
337 }
338 if (atari_console_driver.write)
339 register_console(&atari_console_driver);
340}
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S
index 222ce4244564..e162ee685d20 100644
--- a/arch/m68k/kernel/entry.S
+++ b/arch/m68k/kernel/entry.S
@@ -692,7 +692,7 @@ sys_call_table:
692 .long sys_tgkill /* 265 */ 692 .long sys_tgkill /* 265 */
693 .long sys_utimes 693 .long sys_utimes
694 .long sys_fadvise64_64 694 .long sys_fadvise64_64
695 .long sys_mbind 695 .long sys_mbind
696 .long sys_get_mempolicy 696 .long sys_get_mempolicy
697 .long sys_set_mempolicy /* 270 */ 697 .long sys_set_mempolicy /* 270 */
698 .long sys_mq_open 698 .long sys_mq_open
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index 6739e87fe825..05741f233567 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -3195,7 +3195,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1
3195 jbra L(serial_putc_done) 3195 jbra L(serial_putc_done)
31963: 31963:
3197#endif 3197#endif
3198 3198
3199L(serial_putc_done): 3199L(serial_putc_done):
3200func_return serial_putc 3200func_return serial_putc
3201 3201
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index 42b8fd09ea8f..852cefe7c800 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -133,78 +133,78 @@ extern void config_hp300(void);
133extern void config_q40(void); 133extern void config_q40(void);
134extern void config_sun3x(void); 134extern void config_sun3x(void);
135 135
136extern void mac_debugging_short (int, short);
137extern void mac_debugging_long (int, long);
138
139#define MASK_256K 0xfffc0000 136#define MASK_256K 0xfffc0000
140 137
141extern void paging_init(void); 138extern void paging_init(void);
142 139
143static void __init m68k_parse_bootinfo(const struct bi_record *record) 140static void __init m68k_parse_bootinfo(const struct bi_record *record)
144{ 141{
145 while (record->tag != BI_LAST) { 142 while (record->tag != BI_LAST) {
146 int unknown = 0; 143 int unknown = 0;
147 const unsigned long *data = record->data; 144 const unsigned long *data = record->data;
148 switch (record->tag) { 145
149 case BI_MACHTYPE: 146 switch (record->tag) {
150 case BI_CPUTYPE: 147 case BI_MACHTYPE:
151 case BI_FPUTYPE: 148 case BI_CPUTYPE:
152 case BI_MMUTYPE: 149 case BI_FPUTYPE:
153 /* Already set up by head.S */ 150 case BI_MMUTYPE:
154 break; 151 /* Already set up by head.S */
155 152 break;
156 case BI_MEMCHUNK: 153
157 if (m68k_num_memory < NUM_MEMINFO) { 154 case BI_MEMCHUNK:
158 m68k_memory[m68k_num_memory].addr = data[0]; 155 if (m68k_num_memory < NUM_MEMINFO) {
159 m68k_memory[m68k_num_memory].size = data[1]; 156 m68k_memory[m68k_num_memory].addr = data[0];
160 m68k_num_memory++; 157 m68k_memory[m68k_num_memory].size = data[1];
161 } else 158 m68k_num_memory++;
162 printk("m68k_parse_bootinfo: too many memory chunks\n"); 159 } else
163 break; 160 printk("m68k_parse_bootinfo: too many memory chunks\n");
164 161 break;
165 case BI_RAMDISK: 162
166 m68k_ramdisk.addr = data[0]; 163 case BI_RAMDISK:
167 m68k_ramdisk.size = data[1]; 164 m68k_ramdisk.addr = data[0];
168 break; 165 m68k_ramdisk.size = data[1];
169 166 break;
170 case BI_COMMAND_LINE: 167
171 strlcpy(m68k_command_line, (const char *)data, sizeof(m68k_command_line)); 168 case BI_COMMAND_LINE:
172 break; 169 strlcpy(m68k_command_line, (const char *)data,
173 170 sizeof(m68k_command_line));
174 default: 171 break;
175 if (MACH_IS_AMIGA) 172
176 unknown = amiga_parse_bootinfo(record); 173 default:
177 else if (MACH_IS_ATARI) 174 if (MACH_IS_AMIGA)
178 unknown = atari_parse_bootinfo(record); 175 unknown = amiga_parse_bootinfo(record);
179 else if (MACH_IS_MAC) 176 else if (MACH_IS_ATARI)
180 unknown = mac_parse_bootinfo(record); 177 unknown = atari_parse_bootinfo(record);
181 else if (MACH_IS_Q40) 178 else if (MACH_IS_MAC)
182 unknown = q40_parse_bootinfo(record); 179 unknown = mac_parse_bootinfo(record);
183 else if (MACH_IS_BVME6000) 180 else if (MACH_IS_Q40)
184 unknown = bvme6000_parse_bootinfo(record); 181 unknown = q40_parse_bootinfo(record);
185 else if (MACH_IS_MVME16x) 182 else if (MACH_IS_BVME6000)
186 unknown = mvme16x_parse_bootinfo(record); 183 unknown = bvme6000_parse_bootinfo(record);
187 else if (MACH_IS_MVME147) 184 else if (MACH_IS_MVME16x)
188 unknown = mvme147_parse_bootinfo(record); 185 unknown = mvme16x_parse_bootinfo(record);
189 else if (MACH_IS_HP300) 186 else if (MACH_IS_MVME147)
190 unknown = hp300_parse_bootinfo(record); 187 unknown = mvme147_parse_bootinfo(record);
191 else 188 else if (MACH_IS_HP300)
192 unknown = 1; 189 unknown = hp300_parse_bootinfo(record);
190 else
191 unknown = 1;
192 }
193 if (unknown)
194 printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
195 record->tag);
196 record = (struct bi_record *)((unsigned long)record +
197 record->size);
193 } 198 }
194 if (unknown)
195 printk("m68k_parse_bootinfo: unknown tag 0x%04x ignored\n",
196 record->tag);
197 record = (struct bi_record *)((unsigned long)record+record->size);
198 }
199 199
200 m68k_realnum_memory = m68k_num_memory; 200 m68k_realnum_memory = m68k_num_memory;
201#ifdef CONFIG_SINGLE_MEMORY_CHUNK 201#ifdef CONFIG_SINGLE_MEMORY_CHUNK
202 if (m68k_num_memory > 1) { 202 if (m68k_num_memory > 1) {
203 printk("Ignoring last %i chunks of physical memory\n", 203 printk("Ignoring last %i chunks of physical memory\n",
204 (m68k_num_memory - 1)); 204 (m68k_num_memory - 1));
205 m68k_num_memory = 1; 205 m68k_num_memory = 1;
206 } 206 }
207 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET; 207 m68k_memoffset = m68k_memory[0].addr-PAGE_OFFSET;
208#endif 208#endif
209} 209}
210 210
@@ -234,7 +234,7 @@ void __init setup_arch(char **cmdline_p)
234 /* clear the fpu if we have one */ 234 /* clear the fpu if we have one */
235 if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) { 235 if (m68k_fputype & (FPU_68881|FPU_68882|FPU_68040|FPU_68060)) {
236 volatile int zero = 0; 236 volatile int zero = 0;
237 asm __volatile__ ("frestore %0" : : "m" (zero)); 237 asm volatile ("frestore %0" : : "m" (zero));
238 } 238 }
239#endif 239#endif
240 240
@@ -262,32 +262,35 @@ void __init setup_arch(char **cmdline_p)
262 * For the m68k, this is currently only "debug=xxx" to enable printing 262 * For the m68k, this is currently only "debug=xxx" to enable printing
263 * certain kernel messages to some machine-specific device. 263 * certain kernel messages to some machine-specific device.
264 */ 264 */
265 for( p = *cmdline_p; p && *p; ) { 265 for (p = *cmdline_p; p && *p;) {
266 i = 0; 266 i = 0;
267 if (!strncmp( p, "debug=", 6 )) { 267 if (!strncmp(p, "debug=", 6)) {
268 strlcpy( m68k_debug_device, p+6, sizeof(m68k_debug_device) ); 268 strlcpy(m68k_debug_device, p+6, sizeof(m68k_debug_device));
269 if ((q = strchr( m68k_debug_device, ' ' ))) *q = 0; 269 q = strchr(m68k_debug_device, ' ');
270 i = 1; 270 if (q)
271 } 271 *q = 0;
272 i = 1;
273 }
272#ifdef CONFIG_ATARI 274#ifdef CONFIG_ATARI
273 /* This option must be parsed very early */ 275 /* This option must be parsed very early */
274 if (!strncmp( p, "switches=", 9 )) { 276 if (!strncmp(p, "switches=", 9)) {
275 extern void atari_switches_setup( const char *, int ); 277 extern void atari_switches_setup(const char *, int);
276 atari_switches_setup( p+9, (q = strchr( p+9, ' ' )) ? 278 q = strchr(p + 9, ' ');
277 (q - (p+9)) : strlen(p+9) ); 279 atari_switches_setup(p + 9, q ? (q - (p + 9)) : strlen(p + 9));
278 i = 1; 280 i = 1;
279 } 281 }
280#endif 282#endif
281 283
282 if (i) { 284 if (i) {
283 /* option processed, delete it */ 285 /* option processed, delete it */
284 if ((q = strchr( p, ' ' ))) 286 if ((q = strchr(p, ' ')))
285 strcpy( p, q+1 ); 287 strcpy(p, q + 1);
286 else 288 else
287 *p = 0; 289 *p = 0;
288 } else { 290 } else {
289 if ((p = strchr( p, ' ' ))) ++p; 291 if ((p = strchr(p, ' ')))
290 } 292 ++p;
293 }
291 } 294 }
292 295
293#ifdef CONFIG_DUMMY_CONSOLE 296#ifdef CONFIG_DUMMY_CONSOLE
@@ -296,62 +299,62 @@ void __init setup_arch(char **cmdline_p)
296 299
297 switch (m68k_machtype) { 300 switch (m68k_machtype) {
298#ifdef CONFIG_AMIGA 301#ifdef CONFIG_AMIGA
299 case MACH_AMIGA: 302 case MACH_AMIGA:
300 config_amiga(); 303 config_amiga();
301 break; 304 break;
302#endif 305#endif
303#ifdef CONFIG_ATARI 306#ifdef CONFIG_ATARI
304 case MACH_ATARI: 307 case MACH_ATARI:
305 config_atari(); 308 config_atari();
306 break; 309 break;
307#endif 310#endif
308#ifdef CONFIG_MAC 311#ifdef CONFIG_MAC
309 case MACH_MAC: 312 case MACH_MAC:
310 config_mac(); 313 config_mac();
311 break; 314 break;
312#endif 315#endif
313#ifdef CONFIG_SUN3 316#ifdef CONFIG_SUN3
314 case MACH_SUN3: 317 case MACH_SUN3:
315 config_sun3(); 318 config_sun3();
316 break; 319 break;
317#endif 320#endif
318#ifdef CONFIG_APOLLO 321#ifdef CONFIG_APOLLO
319 case MACH_APOLLO: 322 case MACH_APOLLO:
320 config_apollo(); 323 config_apollo();
321 break; 324 break;
322#endif 325#endif
323#ifdef CONFIG_MVME147 326#ifdef CONFIG_MVME147
324 case MACH_MVME147: 327 case MACH_MVME147:
325 config_mvme147(); 328 config_mvme147();
326 break; 329 break;
327#endif 330#endif
328#ifdef CONFIG_MVME16x 331#ifdef CONFIG_MVME16x
329 case MACH_MVME16x: 332 case MACH_MVME16x:
330 config_mvme16x(); 333 config_mvme16x();
331 break; 334 break;
332#endif 335#endif
333#ifdef CONFIG_BVME6000 336#ifdef CONFIG_BVME6000
334 case MACH_BVME6000: 337 case MACH_BVME6000:
335 config_bvme6000(); 338 config_bvme6000();
336 break; 339 break;
337#endif 340#endif
338#ifdef CONFIG_HP300 341#ifdef CONFIG_HP300
339 case MACH_HP300: 342 case MACH_HP300:
340 config_hp300(); 343 config_hp300();
341 break; 344 break;
342#endif 345#endif
343#ifdef CONFIG_Q40 346#ifdef CONFIG_Q40
344 case MACH_Q40: 347 case MACH_Q40:
345 config_q40(); 348 config_q40();
346 break; 349 break;
347#endif 350#endif
348#ifdef CONFIG_SUN3X 351#ifdef CONFIG_SUN3X
349 case MACH_SUN3X: 352 case MACH_SUN3X:
350 config_sun3x(); 353 config_sun3x();
351 break; 354 break;
352#endif 355#endif
353 default: 356 default:
354 panic ("No configuration setup"); 357 panic("No configuration setup");
355 } 358 }
356 359
357#ifndef CONFIG_SUN3 360#ifndef CONFIG_SUN3
@@ -380,7 +383,7 @@ void __init setup_arch(char **cmdline_p)
380 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size); 383 reserve_bootmem(m68k_ramdisk.addr, m68k_ramdisk.size);
381 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr); 384 initrd_start = (unsigned long)phys_to_virt(m68k_ramdisk.addr);
382 initrd_end = initrd_start + m68k_ramdisk.size; 385 initrd_end = initrd_start + m68k_ramdisk.size;
383 printk ("initrd: %08lx - %08lx\n", initrd_start, initrd_end); 386 printk("initrd: %08lx - %08lx\n", initrd_start, initrd_end);
384 } 387 }
385#endif 388#endif
386 389
@@ -402,18 +405,18 @@ void __init setup_arch(char **cmdline_p)
402#if defined(CONFIG_ISA) && defined(MULTI_ISA) 405#if defined(CONFIG_ISA) && defined(MULTI_ISA)
403#if defined(CONFIG_Q40) 406#if defined(CONFIG_Q40)
404 if (MACH_IS_Q40) { 407 if (MACH_IS_Q40) {
405 isa_type = Q40_ISA; 408 isa_type = Q40_ISA;
406 isa_sex = 0; 409 isa_sex = 0;
407 } 410 }
408#elif defined(CONFIG_GG2) 411#elif defined(CONFIG_GG2)
409 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)){ 412 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(GG2_ISA)) {
410 isa_type = GG2_ISA; 413 isa_type = GG2_ISA;
411 isa_sex = 0; 414 isa_sex = 0;
412 } 415 }
413#elif defined(CONFIG_AMIGA_PCMCIA) 416#elif defined(CONFIG_AMIGA_PCMCIA)
414 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)){ 417 if (MACH_IS_AMIGA && AMIGAHW_PRESENT(PCMCIA)) {
415 isa_type = AG_ISA; 418 isa_type = AG_ISA;
416 isa_sex = 1; 419 isa_sex = 1;
417 } 420 }
418#endif 421#endif
419#endif 422#endif
@@ -421,66 +424,66 @@ void __init setup_arch(char **cmdline_p)
421 424
422static int show_cpuinfo(struct seq_file *m, void *v) 425static int show_cpuinfo(struct seq_file *m, void *v)
423{ 426{
424 const char *cpu, *mmu, *fpu; 427 const char *cpu, *mmu, *fpu;
425 unsigned long clockfreq, clockfactor; 428 unsigned long clockfreq, clockfactor;
426 429
427#define LOOP_CYCLES_68020 (8) 430#define LOOP_CYCLES_68020 (8)
428#define LOOP_CYCLES_68030 (8) 431#define LOOP_CYCLES_68030 (8)
429#define LOOP_CYCLES_68040 (3) 432#define LOOP_CYCLES_68040 (3)
430#define LOOP_CYCLES_68060 (1) 433#define LOOP_CYCLES_68060 (1)
431 434
432 if (CPU_IS_020) { 435 if (CPU_IS_020) {
433 cpu = "68020"; 436 cpu = "68020";
434 clockfactor = LOOP_CYCLES_68020; 437 clockfactor = LOOP_CYCLES_68020;
435 } else if (CPU_IS_030) { 438 } else if (CPU_IS_030) {
436 cpu = "68030"; 439 cpu = "68030";
437 clockfactor = LOOP_CYCLES_68030; 440 clockfactor = LOOP_CYCLES_68030;
438 } else if (CPU_IS_040) { 441 } else if (CPU_IS_040) {
439 cpu = "68040"; 442 cpu = "68040";
440 clockfactor = LOOP_CYCLES_68040; 443 clockfactor = LOOP_CYCLES_68040;
441 } else if (CPU_IS_060) { 444 } else if (CPU_IS_060) {
442 cpu = "68060"; 445 cpu = "68060";
443 clockfactor = LOOP_CYCLES_68060; 446 clockfactor = LOOP_CYCLES_68060;
444 } else { 447 } else {
445 cpu = "680x0"; 448 cpu = "680x0";
446 clockfactor = 0; 449 clockfactor = 0;
447 } 450 }
448 451
449#ifdef CONFIG_M68KFPU_EMU_ONLY 452#ifdef CONFIG_M68KFPU_EMU_ONLY
450 fpu="none(soft float)"; 453 fpu = "none(soft float)";
451#else 454#else
452 if (m68k_fputype & FPU_68881) 455 if (m68k_fputype & FPU_68881)
453 fpu = "68881"; 456 fpu = "68881";
454 else if (m68k_fputype & FPU_68882) 457 else if (m68k_fputype & FPU_68882)
455 fpu = "68882"; 458 fpu = "68882";
456 else if (m68k_fputype & FPU_68040) 459 else if (m68k_fputype & FPU_68040)
457 fpu = "68040"; 460 fpu = "68040";
458 else if (m68k_fputype & FPU_68060) 461 else if (m68k_fputype & FPU_68060)
459 fpu = "68060"; 462 fpu = "68060";
460 else if (m68k_fputype & FPU_SUNFPA) 463 else if (m68k_fputype & FPU_SUNFPA)
461 fpu = "Sun FPA"; 464 fpu = "Sun FPA";
462 else 465 else
463 fpu = "none"; 466 fpu = "none";
464#endif 467#endif
465 468
466 if (m68k_mmutype & MMU_68851) 469 if (m68k_mmutype & MMU_68851)
467 mmu = "68851"; 470 mmu = "68851";
468 else if (m68k_mmutype & MMU_68030) 471 else if (m68k_mmutype & MMU_68030)
469 mmu = "68030"; 472 mmu = "68030";
470 else if (m68k_mmutype & MMU_68040) 473 else if (m68k_mmutype & MMU_68040)
471 mmu = "68040"; 474 mmu = "68040";
472 else if (m68k_mmutype & MMU_68060) 475 else if (m68k_mmutype & MMU_68060)
473 mmu = "68060"; 476 mmu = "68060";
474 else if (m68k_mmutype & MMU_SUN3) 477 else if (m68k_mmutype & MMU_SUN3)
475 mmu = "Sun-3"; 478 mmu = "Sun-3";
476 else if (m68k_mmutype & MMU_APOLLO) 479 else if (m68k_mmutype & MMU_APOLLO)
477 mmu = "Apollo"; 480 mmu = "Apollo";
478 else 481 else
479 mmu = "unknown"; 482 mmu = "unknown";
480 483
481 clockfreq = loops_per_jiffy*HZ*clockfactor; 484 clockfreq = loops_per_jiffy * HZ * clockfactor;
482 485
483 seq_printf(m, "CPU:\t\t%s\n" 486 seq_printf(m, "CPU:\t\t%s\n"
484 "MMU:\t\t%s\n" 487 "MMU:\t\t%s\n"
485 "FPU:\t\t%s\n" 488 "FPU:\t\t%s\n"
486 "Clocking:\t%lu.%1luMHz\n" 489 "Clocking:\t%lu.%1luMHz\n"
@@ -490,7 +493,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
490 clockfreq/1000000,(clockfreq/100000)%10, 493 clockfreq/1000000,(clockfreq/100000)%10,
491 loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100, 494 loops_per_jiffy/(500000/HZ),(loops_per_jiffy/(5000/HZ))%100,
492 loops_per_jiffy); 495 loops_per_jiffy);
493 return 0; 496 return 0;
494} 497}
495 498
496static void *c_start(struct seq_file *m, loff_t *pos) 499static void *c_start(struct seq_file *m, loff_t *pos)
@@ -506,44 +509,44 @@ static void c_stop(struct seq_file *m, void *v)
506{ 509{
507} 510}
508struct seq_operations cpuinfo_op = { 511struct seq_operations cpuinfo_op = {
509 .start = c_start, 512 .start = c_start,
510 .next = c_next, 513 .next = c_next,
511 .stop = c_stop, 514 .stop = c_stop,
512 .show = show_cpuinfo, 515 .show = show_cpuinfo,
513}; 516};
514 517
515int get_hardware_list(char *buffer) 518int get_hardware_list(char *buffer)
516{ 519{
517 int len = 0; 520 int len = 0;
518 char model[80]; 521 char model[80];
519 unsigned long mem; 522 unsigned long mem;
520 int i; 523 int i;
521 524
522 if (mach_get_model) 525 if (mach_get_model)
523 mach_get_model(model); 526 mach_get_model(model);
524 else 527 else
525 strcpy(model, "Unknown m68k"); 528 strcpy(model, "Unknown m68k");
526 529
527 len += sprintf(buffer+len, "Model:\t\t%s\n", model); 530 len += sprintf(buffer + len, "Model:\t\t%s\n", model);
528 for (mem = 0, i = 0; i < m68k_num_memory; i++) 531 for (mem = 0, i = 0; i < m68k_num_memory; i++)
529 mem += m68k_memory[i].size; 532 mem += m68k_memory[i].size;
530 len += sprintf(buffer+len, "System Memory:\t%ldK\n", mem>>10); 533 len += sprintf(buffer + len, "System Memory:\t%ldK\n", mem >> 10);
531 534
532 if (mach_get_hardware_list) 535 if (mach_get_hardware_list)
533 len += mach_get_hardware_list(buffer+len); 536 len += mach_get_hardware_list(buffer + len);
534 537
535 return(len); 538 return len;
536} 539}
537 540
538void check_bugs(void) 541void check_bugs(void)
539{ 542{
540#ifndef CONFIG_M68KFPU_EMU 543#ifndef CONFIG_M68KFPU_EMU
541 if (m68k_fputype == 0) { 544 if (m68k_fputype == 0) {
542 printk( KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, " 545 printk(KERN_EMERG "*** YOU DO NOT HAVE A FLOATING POINT UNIT, "
543 "WHICH IS REQUIRED BY LINUX/M68K ***\n" ); 546 "WHICH IS REQUIRED BY LINUX/M68K ***\n");
544 printk( KERN_EMERG "Upgrade your hardware or join the FPU " 547 printk(KERN_EMERG "Upgrade your hardware or join the FPU "
545 "emulation project\n" ); 548 "emulation project\n");
546 panic( "no FPU" ); 549 panic("no FPU");
547 } 550 }
548#endif /* !CONFIG_M68KFPU_EMU */ 551#endif /* !CONFIG_M68KFPU_EMU */
549} 552}
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index 562b38d00180..d2fbf436a1fb 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -59,15 +59,15 @@ extern struct mem_info m68k_ramdisk;
59 59
60extern char m68k_command_line[CL_SIZE]; 60extern char m68k_command_line[CL_SIZE];
61 61
62void *mac_env; /* Loaded by the boot asm */ 62void *mac_env; /* Loaded by the boot asm */
63 63
64/* The phys. video addr. - might be bogus on some machines */ 64/* The phys. video addr. - might be bogus on some machines */
65unsigned long mac_orig_videoaddr; 65unsigned long mac_orig_videoaddr;
66 66
67/* Mac specific timer functions */ 67/* Mac specific timer functions */
68extern unsigned long mac_gettimeoffset (void); 68extern unsigned long mac_gettimeoffset(void);
69extern int mac_hwclk (int, struct rtc_time *); 69extern int mac_hwclk(int, struct rtc_time *);
70extern int mac_set_clock_mmss (unsigned long); 70extern int mac_set_clock_mmss(unsigned long);
71extern int show_mac_interrupts(struct seq_file *, void *); 71extern int show_mac_interrupts(struct seq_file *, void *);
72extern void iop_preinit(void); 72extern void iop_preinit(void);
73extern void iop_init(void); 73extern void iop_init(void);
@@ -99,51 +99,52 @@ static void mac_sched_init(irq_handler_t vector)
99 99
100int __init mac_parse_bootinfo(const struct bi_record *record) 100int __init mac_parse_bootinfo(const struct bi_record *record)
101{ 101{
102 int unknown = 0; 102 int unknown = 0;
103 const u_long *data = record->data; 103 const u_long *data = record->data;
104 104
105 switch (record->tag) { 105 switch (record->tag) {
106 case BI_MAC_MODEL: 106 case BI_MAC_MODEL:
107 mac_bi_data.id = *data; 107 mac_bi_data.id = *data;
108 break; 108 break;
109 case BI_MAC_VADDR: 109 case BI_MAC_VADDR:
110 mac_bi_data.videoaddr = *data; 110 mac_bi_data.videoaddr = *data;
111 break; 111 break;
112 case BI_MAC_VDEPTH: 112 case BI_MAC_VDEPTH:
113 mac_bi_data.videodepth = *data; 113 mac_bi_data.videodepth = *data;
114 break; 114 break;
115 case BI_MAC_VROW: 115 case BI_MAC_VROW:
116 mac_bi_data.videorow = *data; 116 mac_bi_data.videorow = *data;
117 break; 117 break;
118 case BI_MAC_VDIM: 118 case BI_MAC_VDIM:
119 mac_bi_data.dimensions = *data; 119 mac_bi_data.dimensions = *data;
120 break; 120 break;
121 case BI_MAC_VLOGICAL: 121 case BI_MAC_VLOGICAL:
122 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK); 122 mac_bi_data.videological = VIDEOMEMBASE + (*data & ~VIDEOMEMMASK);
123 mac_orig_videoaddr = *data; 123 mac_orig_videoaddr = *data;
124 break; 124 break;
125 case BI_MAC_SCCBASE: 125 case BI_MAC_SCCBASE:
126 mac_bi_data.sccbase = *data; 126 mac_bi_data.sccbase = *data;
127 break; 127 break;
128 case BI_MAC_BTIME: 128 case BI_MAC_BTIME:
129 mac_bi_data.boottime = *data; 129 mac_bi_data.boottime = *data;
130 break; 130 break;
131 case BI_MAC_GMTBIAS: 131 case BI_MAC_GMTBIAS:
132 mac_bi_data.gmtbias = *data; 132 mac_bi_data.gmtbias = *data;
133 break; 133 break;
134 case BI_MAC_MEMSIZE: 134 case BI_MAC_MEMSIZE:
135 mac_bi_data.memsize = *data; 135 mac_bi_data.memsize = *data;
136 break; 136 break;
137 case BI_MAC_CPUID: 137 case BI_MAC_CPUID:
138 mac_bi_data.cpuid = *data; 138 mac_bi_data.cpuid = *data;
139 break; 139 break;
140 case BI_MAC_ROMBASE: 140 case BI_MAC_ROMBASE:
141 mac_bi_data.rombase = *data; 141 mac_bi_data.rombase = *data;
142 break; 142 break;
143 default: 143 default:
144 unknown = 1; 144 unknown = 1;
145 } 145 break;
146 return(unknown); 146 }
147 return unknown;
147} 148}
148 149
149/* 150/*
@@ -155,6 +156,7 @@ int __init mac_parse_bootinfo(const struct bi_record *record)
155static void mac_cache_card_flush(int writeback) 156static void mac_cache_card_flush(int writeback)
156{ 157{
157 unsigned long flags; 158 unsigned long flags;
159
158 local_irq_save(flags); 160 local_irq_save(flags);
159 via_flush_cache(); 161 via_flush_cache();
160 local_irq_restore(flags); 162 local_irq_restore(flags);
@@ -162,28 +164,27 @@ static void mac_cache_card_flush(int writeback)
162 164
163void __init config_mac(void) 165void __init config_mac(void)
164{ 166{
165 if (!MACH_IS_MAC) { 167 if (!MACH_IS_MAC)
166 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n"); 168 printk(KERN_ERR "ERROR: no Mac, but config_mac() called!! \n");
167 }
168 169
169 mach_sched_init = mac_sched_init; 170 mach_sched_init = mac_sched_init;
170 mach_init_IRQ = mac_init_IRQ; 171 mach_init_IRQ = mac_init_IRQ;
171 mach_get_model = mac_get_model; 172 mach_get_model = mac_get_model;
172 mach_gettimeoffset = mac_gettimeoffset; 173 mach_gettimeoffset = mac_gettimeoffset;
173#warning move to adb/via init 174#warning move to adb/via init
174#if 0 175#if 0
175 mach_hwclk = mac_hwclk; 176 mach_hwclk = mac_hwclk;
176#endif 177#endif
177 mach_set_clock_mmss = mac_set_clock_mmss; 178 mach_set_clock_mmss = mac_set_clock_mmss;
178 mach_reset = mac_reset; 179 mach_reset = mac_reset;
179 mach_halt = mac_poweroff; 180 mach_halt = mac_poweroff;
180 mach_power_off = mac_poweroff; 181 mach_power_off = mac_poweroff;
181 mach_max_dma_address = 0xffffffff; 182 mach_max_dma_address = 0xffffffff;
182#if 0 183#if 0
183 mach_debug_init = mac_debug_init; 184 mach_debug_init = mac_debug_init;
184#endif 185#endif
185#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 186#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
186 mach_beep = mac_mksound; 187 mach_beep = mac_mksound;
187#endif 188#endif
188#ifdef CONFIG_HEARTBEAT 189#ifdef CONFIG_HEARTBEAT
189#if 0 190#if 0
@@ -199,21 +200,22 @@ void __init config_mac(void)
199 mac_identify(); 200 mac_identify();
200 mac_report_hardware(); 201 mac_report_hardware();
201 202
202 /* AFAIK only the IIci takes a cache card. The IIfx has onboard 203 /*
203 cache ... someone needs to figure out how to tell if it's on or 204 * AFAIK only the IIci takes a cache card. The IIfx has onboard
204 not. */ 205 * cache ... someone needs to figure out how to tell if it's on or
206 * not.
207 */
205 208
206 if (macintosh_config->ident == MAC_MODEL_IICI 209 if (macintosh_config->ident == MAC_MODEL_IICI
207 || macintosh_config->ident == MAC_MODEL_IIFX) { 210 || macintosh_config->ident == MAC_MODEL_IIFX)
208 mach_l2_flush = mac_cache_card_flush; 211 mach_l2_flush = mac_cache_card_flush;
209 }
210 212
211 /* 213 /*
212 * Check for machine specific fixups. 214 * Check for machine specific fixups.
213 */ 215 */
214 216
215#ifdef OLD_NUBUS_CODE 217#ifdef OLD_NUBUS_CODE
216 nubus_sweep_video(); 218 nubus_sweep_video();
217#endif 219#endif
218} 220}
219 221
@@ -233,8 +235,7 @@ void __init config_mac(void)
233struct mac_model *macintosh_config; 235struct mac_model *macintosh_config;
234EXPORT_SYMBOL(macintosh_config); 236EXPORT_SYMBOL(macintosh_config);
235 237
236static struct mac_model mac_data_table[]= 238static struct mac_model mac_data_table[] = {
237{
238 /* 239 /*
239 * We'll pretend to be a Macintosh II, that's pretty safe. 240 * We'll pretend to be a Macintosh II, that's pretty safe.
240 */ 241 */
@@ -784,12 +785,12 @@ void mac_identify(void)
784 if (!model) { 785 if (!model) {
785 /* no bootinfo model id -> NetBSD booter was used! */ 786 /* no bootinfo model id -> NetBSD booter was used! */
786 /* XXX FIXME: breaks for model > 31 */ 787 /* XXX FIXME: breaks for model > 31 */
787 model=(mac_bi_data.cpuid>>2)&63; 788 model = (mac_bi_data.cpuid >> 2) & 63;
788 printk (KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n"); 789 printk(KERN_WARNING "No bootinfo model ID, using cpuid instead (hey, use Penguin!)\n");
789 } 790 }
790 791
791 macintosh_config = mac_data_table; 792 macintosh_config = mac_data_table;
792 for (m = macintosh_config ; m->ident != -1 ; m++) { 793 for (m = macintosh_config; m->ident != -1; m++) {
793 if (m->ident == model) { 794 if (m->ident == model) {
794 macintosh_config = m; 795 macintosh_config = m;
795 break; 796 break;
@@ -803,25 +804,25 @@ void mac_identify(void)
803 iop_preinit(); 804 iop_preinit();
804 mac_debug_init(); 805 mac_debug_init();
805 806
806 printk (KERN_INFO "Detected Macintosh model: %d \n", model); 807 printk(KERN_INFO "Detected Macintosh model: %d \n", model);
807 808
808 /* 809 /*
809 * Report booter data: 810 * Report booter data:
810 */ 811 */
811 printk (KERN_DEBUG " Penguin bootinfo data:\n"); 812 printk(KERN_DEBUG " Penguin bootinfo data:\n");
812 printk (KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n", 813 printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
813 mac_bi_data.videoaddr, mac_bi_data.videorow, 814 mac_bi_data.videoaddr, mac_bi_data.videorow,
814 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF, 815 mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
815 mac_bi_data.dimensions >> 16); 816 mac_bi_data.dimensions >> 16);
816 printk (KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n", 817 printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx \n",
817 mac_bi_data.videological, mac_orig_videoaddr, 818 mac_bi_data.videological, mac_orig_videoaddr,
818 mac_bi_data.sccbase); 819 mac_bi_data.sccbase);
819 printk (KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n", 820 printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx \n",
820 mac_bi_data.boottime, mac_bi_data.gmtbias); 821 mac_bi_data.boottime, mac_bi_data.gmtbias);
821 printk (KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n", 822 printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx \n",
822 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize); 823 mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
823#if 0 824#if 0
824 printk ("Ramdisk: addr 0x%lx size 0x%lx\n", 825 printk("Ramdisk: addr 0x%lx size 0x%lx\n",
825 m68k_ramdisk.addr, m68k_ramdisk.size); 826 m68k_ramdisk.addr, m68k_ramdisk.size);
826#endif 827#endif
827 828
@@ -830,22 +831,22 @@ void mac_identify(void)
830 */ 831 */
831 switch (macintosh_config->scsi_type) { 832 switch (macintosh_config->scsi_type) {
832 case MAC_SCSI_OLD: 833 case MAC_SCSI_OLD:
833 MACHW_SET(MAC_SCSI_80); 834 MACHW_SET(MAC_SCSI_80);
834 break; 835 break;
835 case MAC_SCSI_QUADRA: 836 case MAC_SCSI_QUADRA:
836 case MAC_SCSI_QUADRA2: 837 case MAC_SCSI_QUADRA2:
837 case MAC_SCSI_QUADRA3: 838 case MAC_SCSI_QUADRA3:
838 MACHW_SET(MAC_SCSI_96); 839 MACHW_SET(MAC_SCSI_96);
839 if ((macintosh_config->ident == MAC_MODEL_Q900) || 840 if ((macintosh_config->ident == MAC_MODEL_Q900) ||
840 (macintosh_config->ident == MAC_MODEL_Q950)) 841 (macintosh_config->ident == MAC_MODEL_Q950))
841 MACHW_SET(MAC_SCSI_96_2); 842 MACHW_SET(MAC_SCSI_96_2);
842 break; 843 break;
843 default: 844 default:
844 printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n"); 845 printk(KERN_WARNING "config.c: wtf: unknown scsi, using 53c80\n");
845 MACHW_SET(MAC_SCSI_80); 846 MACHW_SET(MAC_SCSI_80);
846 break; 847 break;
847
848 } 848 }
849
849 iop_init(); 850 iop_init();
850 via_init(); 851 via_init();
851 oss_init(); 852 oss_init();
@@ -860,6 +861,6 @@ void mac_report_hardware(void)
860 861
861static void mac_get_model(char *str) 862static void mac_get_model(char *str)
862{ 863{
863 strcpy(str,"Macintosh "); 864 strcpy(str, "Macintosh ");
864 strcat(str, macintosh_config->name); 865 strcat(str, macintosh_config->name);
865} 866}
diff --git a/arch/m68k/mac/debug.c b/arch/m68k/mac/debug.c
index 4eeb09dc0e8f..83990326099b 100644
--- a/arch/m68k/mac/debug.c
+++ b/arch/m68k/mac/debug.c
@@ -52,7 +52,7 @@ extern void mac_serial_print(const char *);
52 */ 52 */
53 53
54#ifdef DEBUG_SCREEN 54#ifdef DEBUG_SCREEN
55static int peng=0, line=0; 55static int peng, line;
56#endif 56#endif
57 57
58void mac_debugging_short(int pos, short num) 58void mac_debugging_short(int pos, short num)
@@ -74,15 +74,14 @@ void mac_debugging_short(int pos, short num)
74 } 74 }
75 75
76 /* calculate current offset */ 76 /* calculate current offset */
77 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) 77 pengoffset = (unsigned char *)mac_videobase +
78 +80*peng; 78 (150+line*2) * mac_rowbytes) + 80 * peng;
79 79
80 pptr=pengoffset; 80 pptr = pengoffset;
81 81
82 for(i=0;i<8*sizeof(short);i++) /* # of bits */ 82 for (i = 0; i < 8 * sizeof(short); i++) { /* # of bits */
83 {
84 /* value mask for bit i, reverse order */ 83 /* value mask for bit i, reverse order */
85 *pptr++ = (num & ( 1 << (8*sizeof(short)-i-1) ) ? 0xFF : 0x00); 84 *pptr++ = (num & (1 << (8*sizeof(short)-i-1)) ? 0xFF : 0x00);
86 } 85 }
87 86
88 peng++; 87 peng++;
@@ -115,11 +114,10 @@ void mac_debugging_long(int pos, long addr)
115 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) 114 pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes)
116 +80*peng; 115 +80*peng;
117 116
118 pptr=pengoffset; 117 pptr = pengoffset;
119 118
120 for(i=0;i<8*sizeof(long);i++) /* # of bits */ 119 for (i = 0; i < 8 * sizeof(long); i++) { /* # of bits */
121 { 120 *pptr++ = (addr & (1 << (8*sizeof(long)-i-1)) ? 0xFF : 0x00);
122 *pptr++ = (addr & ( 1 << (8*sizeof(long)-i-1) ) ? 0xFF : 0x00);
123 } 121 }
124 122
125 peng++; 123 peng++;
@@ -136,16 +134,15 @@ void mac_debugging_long(int pos, long addr)
136 * TODO: serial debug code 134 * TODO: serial debug code
137 */ 135 */
138 136
139struct mac_SCC 137struct mac_SCC {
140 { 138 u_char cha_b_ctrl;
141 u_char cha_b_ctrl; 139 u_char char_dummy1;
142 u_char char_dummy1; 140 u_char cha_a_ctrl;
143 u_char cha_a_ctrl; 141 u_char char_dummy2;
144 u_char char_dummy2; 142 u_char cha_b_data;
145 u_char cha_b_data; 143 u_char char_dummy3;
146 u_char char_dummy3; 144 u_char cha_a_data;
147 u_char cha_a_data; 145};
148 };
149 146
150# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase)) 147# define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase))
151 148
@@ -158,9 +155,9 @@ int mac_SCC_reset_done;
158static int scc_port = -1; 155static int scc_port = -1;
159 156
160static struct console mac_console_driver = { 157static struct console mac_console_driver = {
161 .name = "debug", 158 .name = "debug",
162 .flags = CON_PRINTBUFFER, 159 .flags = CON_PRINTBUFFER,
163 .index = -1, 160 .index = -1,
164}; 161};
165 162
166/* 163/*
@@ -178,8 +175,8 @@ static struct console mac_console_driver = {
178 * this driver if Mac. 175 * this driver if Mac.
179 */ 176 */
180 177
181void mac_debug_console_write (struct console *co, const char *str, 178void mac_debug_console_write(struct console *co, const char *str,
182 unsigned int count) 179 unsigned int count)
183{ 180{
184 mac_serial_print(str); 181 mac_serial_print(str);
185} 182}
@@ -190,48 +187,50 @@ void mac_debug_console_write (struct console *co, const char *str,
190 187
191#define uSEC 1 188#define uSEC 1
192 189
193static inline void mac_sccb_out (char c) 190static inline void mac_sccb_out(char c)
194{ 191{
195 int i; 192 int i;
196 do { 193
197 for( i = uSEC; i > 0; --i ) 194 do {
195 for (i = uSEC; i > 0; --i)
196 barrier();
197 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */
198 for (i = uSEC; i > 0; --i)
198 barrier(); 199 barrier();
199 } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ 200 scc.cha_b_data = c;
200 for( i = uSEC; i > 0; --i )
201 barrier();
202 scc.cha_b_data = c;
203} 201}
204 202
205static inline void mac_scca_out (char c) 203static inline void mac_scca_out(char c)
206{ 204{
207 int i; 205 int i;
208 do { 206
209 for( i = uSEC; i > 0; --i ) 207 do {
208 for (i = uSEC; i > 0; --i)
209 barrier();
210 } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */
211 for (i = uSEC; i > 0; --i)
210 barrier(); 212 barrier();
211 } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */ 213 scc.cha_a_data = c;
212 for( i = uSEC; i > 0; --i )
213 barrier();
214 scc.cha_a_data = c;
215} 214}
216 215
217void mac_sccb_console_write (struct console *co, const char *str, 216void mac_sccb_console_write(struct console *co, const char *str,
218 unsigned int count) 217 unsigned int count)
219{ 218{
220 while (count--) { 219 while (count--) {
221 if (*str == '\n') 220 if (*str == '\n')
222 mac_sccb_out( '\r' ); 221 mac_sccb_out('\r');
223 mac_sccb_out( *str++ ); 222 mac_sccb_out(*str++);
224 } 223 }
225} 224}
226 225
227void mac_scca_console_write (struct console *co, const char *str, 226void mac_scca_console_write(struct console *co, const char *str,
228 unsigned int count) 227 unsigned int count)
229{ 228{
230 while (count--) { 229 while (count--) {
231 if (*str == '\n') 230 if (*str == '\n')
232 mac_scca_out( '\r' ); 231 mac_scca_out('\r');
233 mac_scca_out( *str++ ); 232 mac_scca_out(*str++);
234 } 233 }
235} 234}
236 235
237 236
@@ -239,41 +238,41 @@ void mac_scca_console_write (struct console *co, const char *str,
239 * SCC serial ports. They're used by the debugging interface, kgdb, and the 238 * SCC serial ports. They're used by the debugging interface, kgdb, and the
240 * serial console code. */ 239 * serial console code. */
241#define SCCB_WRITE(reg,val) \ 240#define SCCB_WRITE(reg,val) \
242 do { \ 241 do { \
243 int i; \ 242 int i; \
244 scc.cha_b_ctrl = (reg); \ 243 scc.cha_b_ctrl = (reg); \
245 for( i = uSEC; i > 0; --i ) \ 244 for (i = uSEC; i > 0; --i) \
246 barrier(); \ 245 barrier(); \
247 scc.cha_b_ctrl = (val); \ 246 scc.cha_b_ctrl = (val); \
248 for( i = uSEC; i > 0; --i ) \ 247 for (i = uSEC; i > 0; --i) \
249 barrier(); \ 248 barrier(); \
250 } while(0) 249 } while(0)
251 250
252#define SCCA_WRITE(reg,val) \ 251#define SCCA_WRITE(reg,val) \
253 do { \ 252 do { \
254 int i; \ 253 int i; \
255 scc.cha_a_ctrl = (reg); \ 254 scc.cha_a_ctrl = (reg); \
256 for( i = uSEC; i > 0; --i ) \ 255 for (i = uSEC; i > 0; --i) \
257 barrier(); \ 256 barrier(); \
258 scc.cha_a_ctrl = (val); \ 257 scc.cha_a_ctrl = (val); \
259 for( i = uSEC; i > 0; --i ) \ 258 for (i = uSEC; i > 0; --i) \
260 barrier(); \ 259 barrier(); \
261 } while(0) 260 } while(0)
262 261
263/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a 262/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a
264 * delay of ~ 60us. */ 263 * delay of ~ 60us. */
265/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ 264/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/
266#define LONG_DELAY() \ 265#define LONG_DELAY() \
267 do { \ 266 do { \
268 int i; \ 267 int i; \
269 for( i = 60*uSEC; i > 0; --i ) \ 268 for (i = 60*uSEC; i > 0; --i) \
270 barrier(); \ 269 barrier(); \
271 } while(0) 270 } while(0)
272 271
273#ifndef CONFIG_SERIAL_CONSOLE 272#ifndef CONFIG_SERIAL_CONSOLE
274static void __init mac_init_scc_port( int cflag, int port ) 273static void __init mac_init_scc_port(int cflag, int port)
275#else 274#else
276void mac_init_scc_port( int cflag, int port ) 275void mac_init_scc_port(int cflag, int port)
277#endif 276#endif
278{ 277{
279 extern int mac_SCC_reset_done; 278 extern int mac_SCC_reset_done;
@@ -292,71 +291,71 @@ void mac_init_scc_port( int cflag, int port )
292 /* reg12 (BRG low) */ 291 /* reg12 (BRG low) */
293 { 94, 62, 46, 22, 10, 4, 1, 0, 0 }; 292 { 94, 62, 46, 22, 10, 4, 1, 0, 0 };
294 293
295 int baud = cflag & CBAUD; 294 int baud = cflag & CBAUD;
296 int clksrc, clkmode, div, reg3, reg5; 295 int clksrc, clkmode, div, reg3, reg5;
297 296
298 if (cflag & CBAUDEX) 297 if (cflag & CBAUDEX)
299 baud += B38400; 298 baud += B38400;
300 if (baud < B1200 || baud > B38400+2) 299 if (baud < B1200 || baud > B38400+2)
301 baud = B9600; /* use default 9600bps for non-implemented rates */ 300 baud = B9600; /* use default 9600bps for non-implemented rates */
302 baud -= B1200; /* tables starts at 1200bps */ 301 baud -= B1200; /* tables starts at 1200bps */
303 302
304 clksrc = clksrc_table[baud]; 303 clksrc = clksrc_table[baud];
305 clkmode = clkmode_table[baud]; 304 clkmode = clkmode_table[baud];
306 div = div_table[baud]; 305 div = div_table[baud];
307 306
308 reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40); 307 reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40);
309 reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */; 308 reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */;
310 309
311 if (port == 1) { 310 if (port == 1) {
312 (void)scc.cha_b_ctrl; /* reset reg pointer */ 311 (void)scc.cha_b_ctrl; /* reset reg pointer */
313 SCCB_WRITE( 9, 0xc0 ); /* reset */ 312 SCCB_WRITE(9, 0xc0); /* reset */
314 LONG_DELAY(); /* extra delay after WR9 access */ 313 LONG_DELAY(); /* extra delay after WR9 access */
315 SCCB_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | 314 SCCB_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
316 0x04 /* 1 stopbit */ | 315 0x04 /* 1 stopbit */ |
317 clkmode ); 316 clkmode);
318 SCCB_WRITE( 3, reg3 ); 317 SCCB_WRITE(3, reg3);
319 SCCB_WRITE( 5, reg5 ); 318 SCCB_WRITE(5, reg5);
320 SCCB_WRITE( 9, 0 ); /* no interrupts */ 319 SCCB_WRITE(9, 0); /* no interrupts */
321 LONG_DELAY(); /* extra delay after WR9 access */ 320 LONG_DELAY(); /* extra delay after WR9 access */
322 SCCB_WRITE( 10, 0 ); /* NRZ mode */ 321 SCCB_WRITE(10, 0); /* NRZ mode */
323 SCCB_WRITE( 11, clksrc ); /* main clock source */ 322 SCCB_WRITE(11, clksrc); /* main clock source */
324 SCCB_WRITE( 12, div ); /* BRG value */ 323 SCCB_WRITE(12, div); /* BRG value */
325 SCCB_WRITE( 13, 0 ); /* BRG high byte */ 324 SCCB_WRITE(13, 0); /* BRG high byte */
326 SCCB_WRITE( 14, 1 ); 325 SCCB_WRITE(14, 1);
327 SCCB_WRITE( 3, reg3 | 1 ); 326 SCCB_WRITE(3, reg3 | 1);
328 SCCB_WRITE( 5, reg5 | 8 ); 327 SCCB_WRITE(5, reg5 | 8);
329 } else if (port == 0) { 328 } else if (port == 0) {
330 (void)scc.cha_a_ctrl; /* reset reg pointer */ 329 (void)scc.cha_a_ctrl; /* reset reg pointer */
331 SCCA_WRITE( 9, 0xc0 ); /* reset */ 330 SCCA_WRITE(9, 0xc0); /* reset */
332 LONG_DELAY(); /* extra delay after WR9 access */ 331 LONG_DELAY(); /* extra delay after WR9 access */
333 SCCA_WRITE( 4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | 332 SCCA_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 |
334 0x04 /* 1 stopbit */ | 333 0x04 /* 1 stopbit */ |
335 clkmode ); 334 clkmode);
336 SCCA_WRITE( 3, reg3 ); 335 SCCA_WRITE(3, reg3);
337 SCCA_WRITE( 5, reg5 ); 336 SCCA_WRITE(5, reg5);
338 SCCA_WRITE( 9, 0 ); /* no interrupts */ 337 SCCA_WRITE(9, 0); /* no interrupts */
339 LONG_DELAY(); /* extra delay after WR9 access */ 338 LONG_DELAY(); /* extra delay after WR9 access */
340 SCCA_WRITE( 10, 0 ); /* NRZ mode */ 339 SCCA_WRITE(10, 0); /* NRZ mode */
341 SCCA_WRITE( 11, clksrc ); /* main clock source */ 340 SCCA_WRITE(11, clksrc); /* main clock source */
342 SCCA_WRITE( 12, div ); /* BRG value */ 341 SCCA_WRITE(12, div); /* BRG value */
343 SCCA_WRITE( 13, 0 ); /* BRG high byte */ 342 SCCA_WRITE(13, 0); /* BRG high byte */
344 SCCA_WRITE( 14, 1 ); 343 SCCA_WRITE(14, 1);
345 SCCA_WRITE( 3, reg3 | 1 ); 344 SCCA_WRITE(3, reg3 | 1);
346 SCCA_WRITE( 5, reg5 | 8 ); 345 SCCA_WRITE(5, reg5 | 8);
347 } 346 }
348 347
349 mac_SCC_reset_done = 1; 348 mac_SCC_reset_done = 1;
350 mac_SCC_init_done = 1; 349 mac_SCC_init_done = 1;
351} 350}
352#endif /* DEBUG_SERIAL */ 351#endif /* DEBUG_SERIAL */
353 352
354void mac_init_scca_port( int cflag ) 353void mac_init_scca_port(int cflag)
355{ 354{
356 mac_init_scc_port(cflag, 0); 355 mac_init_scc_port(cflag, 0);
357} 356}
358 357
359void mac_init_sccb_port( int cflag ) 358void mac_init_sccb_port(int cflag)
360{ 359{
361 mac_init_scc_port(cflag, 1); 360 mac_init_scc_port(cflag, 1);
362} 361}
@@ -364,34 +363,26 @@ void mac_init_sccb_port( int cflag )
364void __init mac_debug_init(void) 363void __init mac_debug_init(void)
365{ 364{
366#ifdef DEBUG_SERIAL 365#ifdef DEBUG_SERIAL
367 if ( !strcmp( m68k_debug_device, "ser" ) 366 if (!strcmp(m68k_debug_device, "ser") ||
368 || !strcmp( m68k_debug_device, "ser1" )) { 367 !strcmp(m68k_debug_device, "ser1")) {
369 /* Mac modem port */ 368 /* Mac modem port */
370 mac_init_scc_port( B9600|CS8, 0 ); 369 mac_init_scc_port(B9600|CS8, 0);
371 mac_console_driver.write = mac_scca_console_write; 370 mac_console_driver.write = mac_scca_console_write;
372 scc_port = 0; 371 scc_port = 0;
373 } 372 } else if (!strcmp(m68k_debug_device, "ser2")) {
374 else if (!strcmp( m68k_debug_device, "ser2" )) { 373 /* Mac printer port */
375 /* Mac printer port */ 374 mac_init_scc_port(B9600|CS8, 1);
376 mac_init_scc_port( B9600|CS8, 1 ); 375 mac_console_driver.write = mac_sccb_console_write;
377 mac_console_driver.write = mac_sccb_console_write; 376 scc_port = 1;
378 scc_port = 1; 377 }
379 }
380#endif 378#endif
381#ifdef DEBUG_HEADS 379#ifdef DEBUG_HEADS
382 if ( !strcmp( m68k_debug_device, "scn" ) 380 if (!strcmp(m68k_debug_device, "scn") ||
383 || !strcmp( m68k_debug_device, "con" )) { 381 !strcmp(m68k_debug_device, "con")) {
384 /* display, using head.S console routines */ 382 /* display, using head.S console routines */
385 mac_console_driver.write = mac_debug_console_write; 383 mac_console_driver.write = mac_debug_console_write;
386 } 384 }
387#endif 385#endif
388 if (mac_console_driver.write) 386 if (mac_console_driver.write)
389 register_console(&mac_console_driver); 387 register_console(&mac_console_driver);
390} 388}
391
392/*
393 * Local variables:
394 * c-indent-level: 4
395 * tab-width: 8
396 * End:
397 */
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 92f873cc7060..4c5b9e4e98bc 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -35,35 +35,35 @@
35#include <asm/machdep.h> 35#include <asm/machdep.h>
36#include <asm/q40_master.h> 36#include <asm/q40_master.h>
37 37
38extern irqreturn_t q40_process_int (int level, struct pt_regs *regs); 38extern irqreturn_t q40_process_int(int level, struct pt_regs *regs);
39extern void q40_init_IRQ (void); 39extern void q40_init_IRQ(void);
40static void q40_get_model(char *model); 40static void q40_get_model(char *model);
41static int q40_get_hardware_list(char *buffer); 41static int q40_get_hardware_list(char *buffer);
42extern void q40_sched_init(irq_handler_t handler); 42extern void q40_sched_init(irq_handler_t handler);
43 43
44extern unsigned long q40_gettimeoffset (void); 44extern unsigned long q40_gettimeoffset(void);
45extern int q40_hwclk (int, struct rtc_time *); 45extern int q40_hwclk(int, struct rtc_time *);
46extern unsigned int q40_get_ss (void); 46extern unsigned int q40_get_ss(void);
47extern int q40_set_clock_mmss (unsigned long); 47extern int q40_set_clock_mmss(unsigned long);
48static int q40_get_rtc_pll(struct rtc_pll_info *pll); 48static int q40_get_rtc_pll(struct rtc_pll_info *pll);
49static int q40_set_rtc_pll(struct rtc_pll_info *pll); 49static int q40_set_rtc_pll(struct rtc_pll_info *pll);
50extern void q40_reset (void); 50extern void q40_reset(void);
51void q40_halt(void); 51void q40_halt(void);
52extern void q40_waitbut(void); 52extern void q40_waitbut(void);
53void q40_set_vectors (void); 53void q40_set_vectors(void);
54 54
55extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/ ); 55extern void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/);
56 56
57extern char m68k_debug_device[]; 57extern char m68k_debug_device[];
58static void q40_mem_console_write(struct console *co, const char *b, 58static void q40_mem_console_write(struct console *co, const char *b,
59 unsigned int count); 59 unsigned int count);
60 60
61extern int ql_ticks; 61extern int ql_ticks;
62 62
63static struct console q40_console_driver = { 63static struct console q40_console_driver = {
64 .name = "debug", 64 .name = "debug",
65 .flags = CON_PRINTBUFFER, 65 .flags = CON_PRINTBUFFER,
66 .index = -1, 66 .index = -1,
67}; 67};
68 68
69 69
@@ -74,150 +74,157 @@ static int _cpleft;
74static void q40_mem_console_write(struct console *co, const char *s, 74static void q40_mem_console_write(struct console *co, const char *s,
75 unsigned int count) 75 unsigned int count)
76{ 76{
77 char *p=(char *)s; 77 const char *p = s;
78 78
79 if (count<_cpleft) 79 if (count < _cpleft) {
80 while (count-- >0){ 80 while (count-- > 0) {
81 *q40_mem_cptr=*p++; 81 *q40_mem_cptr = *p++;
82 q40_mem_cptr+=4; 82 q40_mem_cptr += 4;
83 _cpleft--; 83 _cpleft--;
84 } 84 }
85 }
85} 86}
87
86#if 0 88#if 0
87void printq40(char *str) 89void printq40(char *str)
88{ 90{
89 int l=strlen(str); 91 int l = strlen(str);
90 char *p=q40_mem_cptr; 92 char *p = q40_mem_cptr;
91 93
92 while (l-- >0 && _cpleft-- >0) 94 while (l-- > 0 && _cpleft-- > 0) {
93 { 95 *p = *str++;
94 *p=*str++; 96 p += 4;
95 p+=4; 97 }
96 } 98 q40_mem_cptr = p;
97 q40_mem_cptr=p;
98} 99}
99#endif 100#endif
100 101
101static int halted=0; 102static int halted;
102 103
103#ifdef CONFIG_HEARTBEAT 104#ifdef CONFIG_HEARTBEAT
104static void q40_heartbeat(int on) 105static void q40_heartbeat(int on)
105{ 106{
106 if (halted) return; 107 if (halted)
108 return;
107 109
108 if (on) 110 if (on)
109 Q40_LED_ON(); 111 Q40_LED_ON();
110 else 112 else
111 Q40_LED_OFF(); 113 Q40_LED_OFF();
112} 114}
113#endif 115#endif
114 116
115void q40_reset(void) 117void q40_reset(void)
116{ 118{
117 halted=1; 119 halted = 1;
118 printk ("\n\n*******************************************\n" 120 printk("\n\n*******************************************\n"
119 "Called q40_reset : press the RESET button!! \n" 121 "Called q40_reset : press the RESET button!! \n"
120 "*******************************************\n"); 122 "*******************************************\n");
121 Q40_LED_ON(); 123 Q40_LED_ON();
122 while(1) ; 124 while (1)
125 ;
123} 126}
124void q40_halt(void) 127void q40_halt(void)
125{ 128{
126 halted=1; 129 halted = 1;
127 printk ("\n\n*******************\n" 130 printk("\n\n*******************\n"
128 " Called q40_halt\n" 131 " Called q40_halt\n"
129 "*******************\n"); 132 "*******************\n");
130 Q40_LED_ON(); 133 Q40_LED_ON();
131 while(1) ; 134 while (1)
135 ;
132} 136}
133 137
134static void q40_get_model(char *model) 138static void q40_get_model(char *model)
135{ 139{
136 sprintf(model, "Q40"); 140 sprintf(model, "Q40");
137} 141}
138 142
139/* No hardware options on Q40? */ 143/* No hardware options on Q40? */
140 144
141static int q40_get_hardware_list(char *buffer) 145static int q40_get_hardware_list(char *buffer)
142{ 146{
143 *buffer = '\0'; 147 *buffer = '\0';
144 return 0; 148 return 0;
145} 149}
146 150
147static unsigned int serports[]={0x3f8,0x2f8,0x3e8,0x2e8,0}; 151static unsigned int serports[] =
152{
153 0x3f8,0x2f8,0x3e8,0x2e8,0
154};
148void q40_disable_irqs(void) 155void q40_disable_irqs(void)
149{ 156{
150 unsigned i,j; 157 unsigned i, j;
151 158
152 j=0; 159 j = 0;
153 while((i=serports[j++])) outb(0,i+UART_IER); 160 while ((i = serports[j++]))
154 master_outb(0,EXT_ENABLE_REG); 161 outb(0, i + UART_IER);
155 master_outb(0,KEY_IRQ_ENABLE_REG); 162 master_outb(0, EXT_ENABLE_REG);
163 master_outb(0, KEY_IRQ_ENABLE_REG);
156} 164}
157 165
158void __init config_q40(void) 166void __init config_q40(void)
159{ 167{
160 mach_sched_init = q40_sched_init; 168 mach_sched_init = q40_sched_init;
161 169
162 mach_init_IRQ = q40_init_IRQ; 170 mach_init_IRQ = q40_init_IRQ;
163 mach_gettimeoffset = q40_gettimeoffset; 171 mach_gettimeoffset = q40_gettimeoffset;
164 mach_hwclk = q40_hwclk; 172 mach_hwclk = q40_hwclk;
165 mach_get_ss = q40_get_ss; 173 mach_get_ss = q40_get_ss;
166 mach_get_rtc_pll = q40_get_rtc_pll; 174 mach_get_rtc_pll = q40_get_rtc_pll;
167 mach_set_rtc_pll = q40_set_rtc_pll; 175 mach_set_rtc_pll = q40_set_rtc_pll;
168 mach_set_clock_mmss = q40_set_clock_mmss; 176 mach_set_clock_mmss = q40_set_clock_mmss;
169 177
170 mach_reset = q40_reset; 178 mach_reset = q40_reset;
171 mach_get_model = q40_get_model; 179 mach_get_model = q40_get_model;
172 mach_get_hardware_list = q40_get_hardware_list; 180 mach_get_hardware_list = q40_get_hardware_list;
173 181
174#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 182#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
175 mach_beep = q40_mksound; 183 mach_beep = q40_mksound;
176#endif 184#endif
177#ifdef CONFIG_HEARTBEAT 185#ifdef CONFIG_HEARTBEAT
178 mach_heartbeat = q40_heartbeat; 186 mach_heartbeat = q40_heartbeat;
179#endif 187#endif
180 mach_halt = q40_halt; 188 mach_halt = q40_halt;
181 189
182 /* disable a few things that SMSQ might have left enabled */ 190 /* disable a few things that SMSQ might have left enabled */
183 q40_disable_irqs(); 191 q40_disable_irqs();
184 192
185 /* no DMA at all, but ide-scsi requires it.. make sure 193 /* no DMA at all, but ide-scsi requires it.. make sure
186 * all physical RAM fits into the boundary - otherwise 194 * all physical RAM fits into the boundary - otherwise
187 * allocator may play costly and useless tricks */ 195 * allocator may play costly and useless tricks */
188 mach_max_dma_address = 1024*1024*1024; 196 mach_max_dma_address = 1024*1024*1024;
189 197
190 /* useful for early debugging stages - writes kernel messages into SRAM */ 198 /* useful for early debugging stages - writes kernel messages into SRAM */
191 if (!strncmp( m68k_debug_device,"mem",3 )) 199 if (!strncmp( m68k_debug_device,"mem", 3)) {
192 { 200 /*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/
193 /*printk("using NVRAM debug, q40_mem_cptr=%p\n",q40_mem_cptr);*/ 201 _cpleft = 2000 - ((long)q40_mem_cptr-0xff020000) / 4;
194 _cpleft=2000-((long)q40_mem_cptr-0xff020000)/4; 202 q40_console_driver.write = q40_mem_console_write;
195 q40_console_driver.write = q40_mem_console_write; 203 register_console(&q40_console_driver);
196 register_console(&q40_console_driver); 204 }
197 }
198} 205}
199 206
200 207
201int q40_parse_bootinfo(const struct bi_record *rec) 208int q40_parse_bootinfo(const struct bi_record *rec)
202{ 209{
203 return 1; 210 return 1;
204} 211}
205 212
206 213
207static inline unsigned char bcd2bin (unsigned char b) 214static inline unsigned char bcd2bin(unsigned char b)
208{ 215{
209 return ((b>>4)*10 + (b&15)); 216 return (b >> 4) * 10 + (b & 15);
210} 217}
211 218
212static inline unsigned char bin2bcd (unsigned char b) 219static inline unsigned char bin2bcd(unsigned char b)
213{ 220{
214 return (((b/10)*16) + (b%10)); 221 return (b / 10) * 16 + (b % 10);
215} 222}
216 223
217 224
218unsigned long q40_gettimeoffset (void) 225unsigned long q40_gettimeoffset(void)
219{ 226{
220 return 5000*(ql_ticks!=0); 227 return 5000 * (ql_ticks != 0);
221} 228}
222 229
223 230
@@ -238,9 +245,9 @@ unsigned long q40_gettimeoffset (void)
238 245
239int q40_hwclk(int op, struct rtc_time *t) 246int q40_hwclk(int op, struct rtc_time *t)
240{ 247{
241 if (op) 248 if (op) {
242 { /* Write.... */ 249 /* Write.... */
243 Q40_RTC_CTRL |= Q40_RTC_WRITE; 250 Q40_RTC_CTRL |= Q40_RTC_WRITE;
244 251
245 Q40_RTC_SECS = bin2bcd(t->tm_sec); 252 Q40_RTC_SECS = bin2bcd(t->tm_sec);
246 Q40_RTC_MINS = bin2bcd(t->tm_min); 253 Q40_RTC_MINS = bin2bcd(t->tm_min);
@@ -251,25 +258,23 @@ int q40_hwclk(int op, struct rtc_time *t)
251 if (t->tm_wday >= 0) 258 if (t->tm_wday >= 0)
252 Q40_RTC_DOW = bin2bcd(t->tm_wday+1); 259 Q40_RTC_DOW = bin2bcd(t->tm_wday+1);
253 260
254 Q40_RTC_CTRL &= ~(Q40_RTC_WRITE); 261 Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
255 } 262 } else {
256 else 263 /* Read.... */
257 { /* Read.... */ 264 Q40_RTC_CTRL |= Q40_RTC_READ;
258 Q40_RTC_CTRL |= Q40_RTC_READ; 265
259 266 t->tm_year = bcd2bin (Q40_RTC_YEAR);
260 t->tm_year = bcd2bin (Q40_RTC_YEAR); 267 t->tm_mon = bcd2bin (Q40_RTC_MNTH)-1;
261 t->tm_mon = bcd2bin (Q40_RTC_MNTH)-1; 268 t->tm_mday = bcd2bin (Q40_RTC_DATE);
262 t->tm_mday = bcd2bin (Q40_RTC_DATE); 269 t->tm_hour = bcd2bin (Q40_RTC_HOUR);
263 t->tm_hour = bcd2bin (Q40_RTC_HOUR); 270 t->tm_min = bcd2bin (Q40_RTC_MINS);
264 t->tm_min = bcd2bin (Q40_RTC_MINS); 271 t->tm_sec = bcd2bin (Q40_RTC_SECS);
265 t->tm_sec = bcd2bin (Q40_RTC_SECS); 272
266 273 Q40_RTC_CTRL &= ~(Q40_RTC_READ);
267 Q40_RTC_CTRL &= ~(Q40_RTC_READ); 274
268 275 if (t->tm_year < 70)
269 if (t->tm_year < 70) 276 t->tm_year += 100;
270 t->tm_year += 100; 277 t->tm_wday = bcd2bin(Q40_RTC_DOW)-1;
271 t->tm_wday = bcd2bin(Q40_RTC_DOW)-1;
272
273 } 278 }
274 279
275 return 0; 280 return 0;
@@ -285,29 +290,25 @@ unsigned int q40_get_ss(void)
285 * clock is out by > 30 minutes. Logic lifted from atari code. 290 * clock is out by > 30 minutes. Logic lifted from atari code.
286 */ 291 */
287 292
288int q40_set_clock_mmss (unsigned long nowtime) 293int q40_set_clock_mmss(unsigned long nowtime)
289{ 294{
290 int retval = 0; 295 int retval = 0;
291 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60; 296 short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
292 297
293 int rtc_minutes; 298 int rtc_minutes;
294 299
300 rtc_minutes = bcd2bin(Q40_RTC_MINS);
295 301
296 rtc_minutes = bcd2bin (Q40_RTC_MINS); 302 if ((rtc_minutes < real_minutes ?
297 303 real_minutes - rtc_minutes :
298 if ((rtc_minutes < real_minutes 304 rtc_minutes - real_minutes) < 30) {
299 ? real_minutes - rtc_minutes 305 Q40_RTC_CTRL |= Q40_RTC_WRITE;
300 : rtc_minutes - real_minutes) < 30)
301 {
302 Q40_RTC_CTRL |= Q40_RTC_WRITE;
303 Q40_RTC_MINS = bin2bcd(real_minutes); 306 Q40_RTC_MINS = bin2bcd(real_minutes);
304 Q40_RTC_SECS = bin2bcd(real_seconds); 307 Q40_RTC_SECS = bin2bcd(real_seconds);
305 Q40_RTC_CTRL &= ~(Q40_RTC_WRITE); 308 Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
306 } 309 } else
307 else
308 retval = -1; 310 retval = -1;
309 311
310
311 return retval; 312 return retval;
312} 313}
313 314
@@ -318,21 +319,23 @@ int q40_set_clock_mmss (unsigned long nowtime)
318 319
319static int q40_get_rtc_pll(struct rtc_pll_info *pll) 320static int q40_get_rtc_pll(struct rtc_pll_info *pll)
320{ 321{
321 int tmp=Q40_RTC_CTRL; 322 int tmp = Q40_RTC_CTRL;
323
322 pll->pll_value = tmp & Q40_RTC_PLL_MASK; 324 pll->pll_value = tmp & Q40_RTC_PLL_MASK;
323 if (tmp & Q40_RTC_PLL_SIGN) 325 if (tmp & Q40_RTC_PLL_SIGN)
324 pll->pll_value = -pll->pll_value; 326 pll->pll_value = -pll->pll_value;
325 pll->pll_max=31; 327 pll->pll_max = 31;
326 pll->pll_min=-31; 328 pll->pll_min = -31;
327 pll->pll_posmult=512; 329 pll->pll_posmult = 512;
328 pll->pll_negmult=256; 330 pll->pll_negmult = 256;
329 pll->pll_clock=125829120; 331 pll->pll_clock = 125829120;
332
330 return 0; 333 return 0;
331} 334}
332 335
333static int q40_set_rtc_pll(struct rtc_pll_info *pll) 336static int q40_set_rtc_pll(struct rtc_pll_info *pll)
334{ 337{
335 if (!pll->pll_ctrl){ 338 if (!pll->pll_ctrl) {
336 /* the docs are a bit unclear so I am doublesetting */ 339 /* the docs are a bit unclear so I am doublesetting */
337 /* RTC_WRITE here ... */ 340 /* RTC_WRITE here ... */
338 int tmp = (pll->pll_value & 31) | (pll->pll_value<0 ? 32 : 0) | 341 int tmp = (pll->pll_value & 31) | (pll->pll_value<0 ? 32 : 0) |
diff --git a/arch/m68k/sun3x/prom.c b/arch/m68k/sun3x/prom.c
index 574cf06df9e4..f23d4255a6fa 100644
--- a/arch/m68k/sun3x/prom.c
+++ b/arch/m68k/sun3x/prom.c
@@ -34,43 +34,43 @@ e_vector *sun3x_prom_vbr;
34/* Handle returning to the prom */ 34/* Handle returning to the prom */
35void sun3x_halt(void) 35void sun3x_halt(void)
36{ 36{
37 unsigned long flags; 37 unsigned long flags;
38 38
39 /* Disable interrupts while we mess with things */ 39 /* Disable interrupts while we mess with things */
40 local_irq_save(flags); 40 local_irq_save(flags);
41 41
42 /* Restore prom vbr */ 42 /* Restore prom vbr */
43 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); 43 asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
44 44
45 /* Restore prom NMI clock */ 45 /* Restore prom NMI clock */
46// sun3x_disable_intreg(5); 46// sun3x_disable_intreg(5);
47 sun3_enable_irq(7); 47 sun3_enable_irq(7);
48 48
49 /* Let 'er rip */ 49 /* Let 'er rip */
50 __asm__ volatile ("trap #14" : : ); 50 asm volatile ("trap #14");
51 51
52 /* Restore everything */ 52 /* Restore everything */
53 sun3_disable_irq(7); 53 sun3_disable_irq(7);
54 sun3_enable_irq(5); 54 sun3_enable_irq(5);
55 55
56 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors)); 56 asm volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
57 local_irq_restore(flags); 57 local_irq_restore(flags);
58} 58}
59 59
60void sun3x_reboot(void) 60void sun3x_reboot(void)
61{ 61{
62 /* This never returns, don't bother saving things */ 62 /* This never returns, don't bother saving things */
63 local_irq_disable(); 63 local_irq_disable();
64 64
65 /* Restore prom vbr */ 65 /* Restore prom vbr */
66 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); 66 asm volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr));
67 67
68 /* Restore prom NMI clock */ 68 /* Restore prom NMI clock */
69 sun3_disable_irq(5); 69 sun3_disable_irq(5);
70 sun3_enable_irq(7); 70 sun3_enable_irq(7);
71 71
72 /* Let 'er rip */ 72 /* Let 'er rip */
73 (*romvec->pv_reboot)("vmlinux"); 73 (*romvec->pv_reboot)("vmlinux");
74} 74}
75 75
76extern char m68k_debug_device[]; 76extern char m68k_debug_device[];
@@ -78,54 +78,52 @@ extern char m68k_debug_device[];
78static void sun3x_prom_write(struct console *co, const char *s, 78static void sun3x_prom_write(struct console *co, const char *s,
79 unsigned int count) 79 unsigned int count)
80{ 80{
81 while (count--) { 81 while (count--) {
82 if (*s == '\n') 82 if (*s == '\n')
83 sun3x_putchar('\r'); 83 sun3x_putchar('\r');
84 sun3x_putchar(*s++); 84 sun3x_putchar(*s++);
85 } 85 }
86} 86}
87 87
88/* debug console - write-only */ 88/* debug console - write-only */
89 89
90static struct console sun3x_debug = { 90static struct console sun3x_debug = {
91 .name = "debug", 91 .name = "debug",
92 .write = sun3x_prom_write, 92 .write = sun3x_prom_write,
93 .flags = CON_PRINTBUFFER, 93 .flags = CON_PRINTBUFFER,
94 .index = -1, 94 .index = -1,
95}; 95};
96 96
97void sun3x_prom_init(void) 97void sun3x_prom_init(void)
98{ 98{
99 /* Read the vector table */ 99 /* Read the vector table */
100 100
101 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR); 101 sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR);
102 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR); 102 sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR);
103 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET); 103 sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET);
104 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT); 104 sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT);
105 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT); 105 sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT);
106 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT); 106 sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT);
107 romvec = (struct linux_romvec *)SUN3X_PROM_BASE; 107 romvec = (struct linux_romvec *)SUN3X_PROM_BASE;
108 108
109 idprom_init(); 109 idprom_init();
110 110
111 if(!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) { 111 if (!((idprom->id_machtype & SM_ARCH_MASK) == SM_SUN3X)) {
112 printk("Warning: machine reports strange type %02x\n", 112 printk("Warning: machine reports strange type %02x\n",
113 idprom->id_machtype); 113 idprom->id_machtype);
114 printk("Pretending it's a 3/80, but very afraid...\n"); 114 printk("Pretending it's a 3/80, but very afraid...\n");
115 idprom->id_machtype = SM_SUN3X | SM_3_80; 115 idprom->id_machtype = SM_SUN3X | SM_3_80;
116 } 116 }
117 117
118 /* point trap #14 at abort. 118 /* point trap #14 at abort.
119 * XXX this is futile since we restore the vbr first - oops 119 * XXX this is futile since we restore the vbr first - oops
120 */ 120 */
121 vectors[VEC_TRAP14] = sun3x_prom_abort; 121 vectors[VEC_TRAP14] = sun3x_prom_abort;
122 122
123 /* If debug=prom was specified, start the debug console */ 123 /* If debug=prom was specified, start the debug console */
124 124
125 if (!strcmp(m68k_debug_device, "prom")) 125 if (!strcmp(m68k_debug_device, "prom"))
126 register_console(&sun3x_debug); 126 register_console(&sun3x_debug);
127
128
129} 127}
130 128
131/* some prom functions to export */ 129/* some prom functions to export */
@@ -141,7 +139,6 @@ int prom_getbool (int node, char *prop)
141 139
142void prom_printf(char *fmt, ...) 140void prom_printf(char *fmt, ...)
143{ 141{
144
145} 142}
146 143
147void prom_halt (void) 144void prom_halt (void)
@@ -159,7 +156,7 @@ prom_get_idprom(char *idbuf, int num_bytes)
159 int i; 156 int i;
160 157
161 /* make a copy of the idprom structure */ 158 /* make a copy of the idprom structure */
162 for(i = 0; i < num_bytes; i++) 159 for (i = 0; i < num_bytes; i++)
163 idbuf[i] = ((char *)SUN3X_IDPROM)[i]; 160 idbuf[i] = ((char *)SUN3X_IDPROM)[i];
164 161
165 return idbuf[0]; 162 return idbuf[0];