Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/m68k/atari/config.c
26444 views
1
/*
2
* linux/arch/m68k/atari/config.c
3
*
4
* Copyright (C) 1994 Bjoern Brauel
5
*
6
* 5/2/94 Roman Hodek:
7
* Added setting of time_adj to get a better clock.
8
*
9
* 5/14/94 Roman Hodek:
10
* gettod() for TT
11
*
12
* 5/15/94 Roman Hodek:
13
* hard_reset_now() for Atari (and others?)
14
*
15
* 94/12/30 Andreas Schwab:
16
* atari_sched_init fixed to get precise clock.
17
*
18
* This file is subject to the terms and conditions of the GNU General Public
19
* License. See the file COPYING in the main directory of this archive
20
* for more details.
21
*/
22
23
/*
24
* Miscellaneous atari stuff
25
*/
26
27
#include <linux/types.h>
28
#include <linux/mm.h>
29
#include <linux/seq_file.h>
30
#include <linux/console.h>
31
#include <linux/init.h>
32
#include <linux/delay.h>
33
#include <linux/ioport.h>
34
#include <linux/platform_device.h>
35
#include <linux/usb/isp116x.h>
36
#include <linux/module.h>
37
38
#include <asm/bootinfo.h>
39
#include <asm/bootinfo-atari.h>
40
#include <asm/byteorder.h>
41
#include <asm/setup.h>
42
#include <asm/atarihw.h>
43
#include <asm/atariints.h>
44
#include <asm/atari_stram.h>
45
#include <asm/machdep.h>
46
#include <asm/hwtest.h>
47
#include <asm/io.h>
48
#include <asm/config.h>
49
50
#include "atari.h"
51
52
u_long atari_mch_cookie;
53
EXPORT_SYMBOL(atari_mch_cookie);
54
55
u_long atari_mch_type;
56
EXPORT_SYMBOL(atari_mch_type);
57
58
struct atari_hw_present atari_hw_present;
59
EXPORT_SYMBOL(atari_hw_present);
60
61
u_long atari_switches;
62
EXPORT_SYMBOL(atari_switches);
63
64
int atari_dont_touch_floppy_select;
65
EXPORT_SYMBOL(atari_dont_touch_floppy_select);
66
67
int atari_rtc_year_offset;
68
69
/* local function prototypes */
70
static void atari_reset(void);
71
static void atari_get_model(char *model);
72
static void atari_get_hardware_list(struct seq_file *m);
73
#ifdef CONFIG_HEARTBEAT
74
static void atari_heartbeat(int on);
75
#endif
76
77
/* ++roman: This is a more elaborate test for an SCC chip, since the plain
78
* Medusa board generates DTACK at the SCC's standard addresses, but a SCC
79
* board in the Medusa is possible. Also, the addresses where the ST_ESCC
80
* resides generate DTACK without the chip, too.
81
* The method is to write values into the interrupt vector register, that
82
* should be readable without trouble (from channel A!).
83
*/
84
85
static int __init scc_test(volatile char *ctla)
86
{
87
if (!hwreg_present(ctla))
88
return 0;
89
MFPDELAY();
90
91
*ctla = 2;
92
MFPDELAY();
93
*ctla = 0x40;
94
MFPDELAY();
95
96
*ctla = 2;
97
MFPDELAY();
98
if (*ctla != 0x40)
99
return 0;
100
MFPDELAY();
101
102
*ctla = 2;
103
MFPDELAY();
104
*ctla = 0x60;
105
MFPDELAY();
106
107
*ctla = 2;
108
MFPDELAY();
109
if (*ctla != 0x60)
110
return 0;
111
112
return 1;
113
}
114
115
116
/*
117
* Parse an Atari-specific record in the bootinfo
118
*/
119
120
int __init atari_parse_bootinfo(const struct bi_record *record)
121
{
122
int unknown = 0;
123
const void *data = record->data;
124
125
switch (be16_to_cpu(record->tag)) {
126
case BI_ATARI_MCH_COOKIE:
127
atari_mch_cookie = be32_to_cpup(data);
128
break;
129
case BI_ATARI_MCH_TYPE:
130
atari_mch_type = be32_to_cpup(data);
131
break;
132
default:
133
unknown = 1;
134
break;
135
}
136
return unknown;
137
}
138
139
140
/* Parse the Atari-specific switches= option. */
141
static int __init atari_switches_setup(char *str)
142
{
143
char switches[COMMAND_LINE_SIZE];
144
char *p;
145
int ovsc_shift;
146
char *args = switches;
147
148
if (!MACH_IS_ATARI)
149
return 0;
150
151
/* copy string to local array, strsep works destructively... */
152
strcpy(switches, str);
153
atari_switches = 0;
154
155
/* parse the options */
156
while ((p = strsep(&args, ",")) != NULL) {
157
if (!*p)
158
continue;
159
ovsc_shift = 0;
160
if (strncmp(p, "ov_", 3) == 0) {
161
p += 3;
162
ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;
163
}
164
165
if (strcmp(p, "ikbd") == 0) {
166
/* RTS line of IKBD ACIA */
167
atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;
168
} else if (strcmp(p, "midi") == 0) {
169
/* RTS line of MIDI ACIA */
170
atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift;
171
} else if (strcmp(p, "snd6") == 0) {
172
atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
173
} else if (strcmp(p, "snd7") == 0) {
174
atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
175
}
176
}
177
return 0;
178
}
179
180
early_param("switches", atari_switches_setup);
181
182
183
/*
184
* Setup the Atari configuration info
185
*/
186
187
void __init config_atari(void)
188
{
189
unsigned short tos_version;
190
191
memset(&atari_hw_present, 0, sizeof(atari_hw_present));
192
193
/* Change size of I/O space from 64KB to 4GB. */
194
ioport_resource.end = 0xFFFFFFFF;
195
196
mach_sched_init = atari_sched_init;
197
mach_init_IRQ = atari_init_IRQ;
198
mach_get_model = atari_get_model;
199
mach_get_hardware_list = atari_get_hardware_list;
200
mach_reset = atari_reset;
201
#if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
202
mach_beep = atari_mksound;
203
#endif
204
#ifdef CONFIG_HEARTBEAT
205
mach_heartbeat = atari_heartbeat;
206
#endif
207
208
/* Set switches as requested by the user */
209
if (atari_switches & ATARI_SWITCH_IKBD)
210
acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID;
211
if (atari_switches & ATARI_SWITCH_MIDI)
212
acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;
213
if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) {
214
sound_ym.rd_data_reg_sel = 14;
215
sound_ym.wd_data = sound_ym.rd_data_reg_sel |
216
((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |
217
((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);
218
}
219
220
/* ++bjoern:
221
* Determine hardware present
222
*/
223
224
pr_info("Atari hardware found:");
225
if (MACH_IS_MEDUSA) {
226
/* There's no Atari video hardware on the Medusa, but all the
227
* addresses below generate a DTACK so no bus error occurs! */
228
} else if (hwreg_present(f030_xreg)) {
229
ATARIHW_SET(VIDEL_SHIFTER);
230
pr_cont(" VIDEL");
231
/* This is a temporary hack: If there is Falcon video
232
* hardware, we assume that the ST-DMA serves SCSI instead of
233
* ACSI. In the future, there should be a better method for
234
* this...
235
*/
236
ATARIHW_SET(ST_SCSI);
237
pr_cont(" STDMA-SCSI");
238
} else if (hwreg_present(tt_palette)) {
239
ATARIHW_SET(TT_SHIFTER);
240
pr_cont(" TT_SHIFTER");
241
} else if (hwreg_present(&shifter_st.bas_hi)) {
242
if (hwreg_present(&shifter_st.bas_lo) &&
243
(shifter_st.bas_lo = 0x0aau, shifter_st.bas_lo == 0x0aau)) {
244
ATARIHW_SET(EXTD_SHIFTER);
245
pr_cont(" EXTD_SHIFTER");
246
} else {
247
ATARIHW_SET(STND_SHIFTER);
248
pr_cont(" STND_SHIFTER");
249
}
250
}
251
if (hwreg_present(&st_mfp.par_dt_reg)) {
252
ATARIHW_SET(ST_MFP);
253
pr_cont(" ST_MFP");
254
}
255
if (hwreg_present(&tt_mfp.par_dt_reg)) {
256
ATARIHW_SET(TT_MFP);
257
pr_cont(" TT_MFP");
258
}
259
if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) {
260
ATARIHW_SET(SCSI_DMA);
261
pr_cont(" TT_SCSI_DMA");
262
}
263
/*
264
* The ST-DMA address registers aren't readable
265
* on all Medusas, so the test below may fail
266
*/
267
if (MACH_IS_MEDUSA ||
268
(hwreg_present(&st_dma.dma_vhi) &&
269
(st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) &&
270
st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa &&
271
(st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&
272
st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {
273
ATARIHW_SET(EXTD_DMA);
274
pr_cont(" EXTD_DMA");
275
}
276
if (hwreg_present(&tt_scsi.scsi_data)) {
277
ATARIHW_SET(TT_SCSI);
278
pr_cont(" TT_SCSI");
279
}
280
if (hwreg_present(&sound_ym.rd_data_reg_sel)) {
281
ATARIHW_SET(YM_2149);
282
pr_cont(" YM2149");
283
}
284
if (!MACH_IS_MEDUSA && hwreg_present(&tt_dmasnd.ctrl)) {
285
ATARIHW_SET(PCM_8BIT);
286
pr_cont(" PCM");
287
}
288
if (hwreg_present(&falcon_codec.unused5)) {
289
ATARIHW_SET(CODEC);
290
pr_cont(" CODEC");
291
}
292
if (hwreg_present(&dsp56k_host_interface.icr)) {
293
ATARIHW_SET(DSP56K);
294
pr_cont(" DSP56K");
295
}
296
if (hwreg_present(&tt_scc_dma.dma_ctrl) &&
297
#if 0
298
/* This test sucks! Who knows some better? */
299
(tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
300
(tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
301
#else
302
!MACH_IS_MEDUSA
303
#endif
304
) {
305
ATARIHW_SET(SCC_DMA);
306
pr_cont(" SCC_DMA");
307
}
308
if (scc_test(&atari_scc.cha_a_ctrl)) {
309
ATARIHW_SET(SCC);
310
pr_cont(" SCC");
311
}
312
if (scc_test(&st_escc.cha_b_ctrl)) {
313
ATARIHW_SET(ST_ESCC);
314
pr_cont(" ST_ESCC");
315
}
316
if (hwreg_present(&tt_scu.sys_mask)) {
317
ATARIHW_SET(SCU);
318
/* Assume a VME bus if there's a SCU */
319
ATARIHW_SET(VME);
320
pr_cont(" VME SCU");
321
}
322
if (hwreg_present((void *)(0xffff9210))) {
323
ATARIHW_SET(ANALOG_JOY);
324
pr_cont(" ANALOG_JOY");
325
}
326
if (hwreg_present(blitter.halftone)) {
327
ATARIHW_SET(BLITTER);
328
pr_cont(" BLITTER");
329
}
330
if (hwreg_present((void *)0xfff00039)) {
331
ATARIHW_SET(IDE);
332
pr_cont(" IDE");
333
}
334
#if 1 /* This maybe wrong */
335
if (!MACH_IS_MEDUSA && hwreg_present(&tt_microwire.data) &&
336
hwreg_present(&tt_microwire.mask) &&
337
(tt_microwire.mask = 0x7ff,
338
udelay(1),
339
tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR,
340
udelay(1),
341
tt_microwire.data != 0)) {
342
ATARIHW_SET(MICROWIRE);
343
while (tt_microwire.mask != 0x7ff)
344
;
345
pr_cont(" MICROWIRE");
346
}
347
#endif
348
if (hwreg_present(&tt_rtc.regsel)) {
349
ATARIHW_SET(TT_CLK);
350
pr_cont(" TT_CLK");
351
mach_hwclk = atari_tt_hwclk;
352
}
353
if (hwreg_present(&mste_rtc.sec_ones)) {
354
ATARIHW_SET(MSTE_CLK);
355
pr_cont(" MSTE_CLK");
356
mach_hwclk = atari_mste_hwclk;
357
}
358
if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) &&
359
hwreg_write(&dma_wd.fdc_speed, 0)) {
360
ATARIHW_SET(FDCSPEED);
361
pr_cont(" FDC_SPEED");
362
}
363
if (!ATARIHW_PRESENT(ST_SCSI)) {
364
ATARIHW_SET(ACSI);
365
pr_cont(" ACSI");
366
}
367
pr_cont("\n");
368
369
if (CPU_IS_040_OR_060)
370
/* Now it seems to be safe to turn of the tt0 transparent
371
* translation (the one that must not be turned off in
372
* head.S...)
373
*/
374
asm volatile ("\n"
375
" moveq #0,%%d0\n"
376
" .chip 68040\n"
377
" movec %%d0,%%itt0\n"
378
" movec %%d0,%%dtt0\n"
379
" .chip 68k"
380
: /* no outputs */
381
: /* no inputs */
382
: "d0");
383
384
/* allocator for memory that must reside in st-ram */
385
atari_stram_init();
386
387
/* Set up a mapping for the VMEbus address region:
388
*
389
* VME is either at phys. 0xfexxxxxx (TT) or 0xa00000..0xdfffff
390
* (MegaSTE) In both cases, the whole 16 MB chunk is mapped at
391
* 0xfe000000 virt., because this can be done with a single
392
* transparent translation. On the 68040, lots of often unused
393
* page tables would be needed otherwise. On a MegaSTE or similar,
394
* the highest byte is stripped off by hardware due to the 24 bit
395
* design of the bus.
396
*/
397
398
if (CPU_IS_020_OR_030) {
399
unsigned long tt1_val;
400
tt1_val = 0xfe008543; /* Translate 0xfexxxxxx, enable, cache
401
* inhibit, read and write, FDC mask = 3,
402
* FDC val = 4 -> Supervisor only */
403
asm volatile ("\n"
404
" .chip 68030\n"
405
" pmove %0,%/tt1\n"
406
" .chip 68k"
407
: : "m" (tt1_val));
408
} else {
409
asm volatile ("\n"
410
" .chip 68040\n"
411
" movec %0,%%itt1\n"
412
" movec %0,%%dtt1\n"
413
" .chip 68k"
414
:
415
: "d" (0xfe00a040)); /* Translate 0xfexxxxxx, enable,
416
* supervisor only, non-cacheable/
417
* serialized, writable */
418
419
}
420
421
/* Fetch tos version at Physical 2 */
422
/*
423
* We my not be able to access this address if the kernel is
424
* loaded to st ram, since the first page is unmapped. On the
425
* Medusa this is always the case and there is nothing we can do
426
* about this, so we just assume the smaller offset. For the TT
427
* we use the fact that in head.S we have set up a mapping
428
* 0xFFxxxxxx -> 0x00xxxxxx, so that the first 16MB is accessible
429
* in the last 16MB of the address space.
430
*/
431
tos_version = (MACH_IS_MEDUSA) ?
432
0xfff : *(unsigned short *)0xff000002;
433
atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
434
}
435
436
#ifdef CONFIG_HEARTBEAT
437
static void atari_heartbeat(int on)
438
{
439
unsigned char tmp;
440
unsigned long flags;
441
442
if (atari_dont_touch_floppy_select)
443
return;
444
445
local_irq_save(flags);
446
sound_ym.rd_data_reg_sel = 14; /* Select PSG Port A */
447
tmp = sound_ym.rd_data_reg_sel;
448
sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02);
449
local_irq_restore(flags);
450
}
451
#endif
452
453
/* ++roman:
454
*
455
* This function does a reset on machines that lack the ability to
456
* assert the processor's _RESET signal somehow via hardware. It is
457
* based on the fact that you can find the initial SP and PC values
458
* after a reset at physical addresses 0 and 4. This works pretty well
459
* for Atari machines, since the lowest 8 bytes of physical memory are
460
* really ROM (mapped by hardware). For other 680x0 machines: don't
461
* know if it works...
462
*
463
* To get the values at addresses 0 and 4, the MMU better is turned
464
* off first. After that, we have to jump into physical address space
465
* (the PC before the pmove statement points to the virtual address of
466
* the code). Getting that physical address is not hard, but the code
467
* becomes a bit complex since I've tried to ensure that the jump
468
* statement after the pmove is in the cache already (otherwise the
469
* processor can't fetch it!). For that, the code first jumps to the
470
* jump statement with the (virtual) address of the pmove section in
471
* an address register . The jump statement is surely in the cache
472
* now. After that, that physical address of the reset code is loaded
473
* into the same address register, pmove is done and the same jump
474
* statements goes to the reset code. Since there are not many
475
* statements between the two jumps, I hope it stays in the cache.
476
*
477
* The C code makes heavy use of the GCC features that you can get the
478
* address of a C label. No hope to compile this with another compiler
479
* than GCC!
480
*/
481
482
/* ++andreas: no need for complicated code, just depend on prefetch */
483
484
static void atari_reset(void)
485
{
486
long tc_val = 0;
487
long reset_addr;
488
489
/*
490
* On the Medusa, phys. 0x4 may contain garbage because it's no
491
* ROM. See above for explanation why we cannot use PTOV(4).
492
*/
493
reset_addr = MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
494
*(unsigned long *) 0xff000004;
495
496
/* reset ACIA for switch off OverScan, if it's active */
497
if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
498
acia.key_ctrl = ACIA_RESET;
499
if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
500
acia.mid_ctrl = ACIA_RESET;
501
502
/* processor independent: turn off interrupts and reset the VBR;
503
* the caches must be left enabled, else prefetching the final jump
504
* instruction doesn't work.
505
*/
506
local_irq_disable();
507
asm volatile ("movec %0,%%vbr"
508
: : "d" (0));
509
510
if (CPU_IS_040_OR_060) {
511
unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
512
if (CPU_IS_060) {
513
/* 68060: clear PCR to turn off superscalar operation */
514
asm volatile ("\n"
515
" .chip 68060\n"
516
" movec %0,%%pcr\n"
517
" .chip 68k"
518
: : "d" (0));
519
}
520
521
asm volatile ("\n"
522
" move.l %0,%%d0\n"
523
" and.l #0xff000000,%%d0\n"
524
" or.w #0xe020,%%d0\n" /* map 16 MB, enable, cacheable */
525
" .chip 68040\n"
526
" movec %%d0,%%itt0\n"
527
" movec %%d0,%%dtt0\n"
528
" .chip 68k\n"
529
" jmp %0@"
530
: : "a" (jmp_addr040)
531
: "d0");
532
jmp_addr_label040:
533
asm volatile ("\n"
534
" moveq #0,%%d0\n"
535
" nop\n"
536
" .chip 68040\n"
537
" cinva %%bc\n"
538
" nop\n"
539
" pflusha\n"
540
" nop\n"
541
" movec %%d0,%%tc\n"
542
" nop\n"
543
/* the following setup of transparent translations is needed on the
544
* Afterburner040 to successfully reboot. Other machines shouldn't
545
* care about a different tt regs setup, they also didn't care in
546
* the past that the regs weren't turned off. */
547
" move.l #0xffc000,%%d0\n" /* whole insn space cacheable */
548
" movec %%d0,%%itt0\n"
549
" movec %%d0,%%itt1\n"
550
" or.w #0x40,%/d0\n" /* whole data space non-cacheable/ser. */
551
" movec %%d0,%%dtt0\n"
552
" movec %%d0,%%dtt1\n"
553
" .chip 68k\n"
554
" jmp %0@"
555
: /* no outputs */
556
: "a" (reset_addr)
557
: "d0");
558
} else
559
asm volatile ("\n"
560
" pmove %0,%%tc\n"
561
" jmp %1@"
562
: /* no outputs */
563
: "m" (tc_val), "a" (reset_addr));
564
}
565
566
567
static void atari_get_model(char *model)
568
{
569
strcpy(model, "Atari ");
570
switch (atari_mch_cookie >> 16) {
571
case ATARI_MCH_ST:
572
if (ATARIHW_PRESENT(MSTE_CLK))
573
strcat(model, "Mega ST");
574
else
575
strcat(model, "ST");
576
break;
577
case ATARI_MCH_STE:
578
if (MACH_IS_MSTE)
579
strcat(model, "Mega STE");
580
else
581
strcat(model, "STE");
582
break;
583
case ATARI_MCH_TT:
584
if (MACH_IS_MEDUSA)
585
/* Medusa has TT _MCH cookie */
586
strcat(model, "Medusa");
587
else
588
strcat(model, "TT");
589
break;
590
case ATARI_MCH_FALCON:
591
strcat(model, "Falcon");
592
if (MACH_IS_AB40)
593
strcat(model, " (with Afterburner040)");
594
break;
595
default:
596
sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)",
597
atari_mch_cookie);
598
break;
599
}
600
}
601
602
603
static void atari_get_hardware_list(struct seq_file *m)
604
{
605
int i;
606
607
for (i = 0; i < m68k_num_memory; i++)
608
seq_printf(m, "\t%3ld MB at 0x%08lx (%s)\n",
609
m68k_memory[i].size >> 20, m68k_memory[i].addr,
610
(m68k_memory[i].addr & 0xff000000 ?
611
"alternate RAM" : "ST-RAM"));
612
613
#define ATARIHW_ANNOUNCE(name, str) \
614
if (ATARIHW_PRESENT(name)) \
615
seq_printf(m, "\t%s\n", str)
616
617
seq_puts(m, "Detected hardware:\n");
618
ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter");
619
ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter");
620
ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter");
621
ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter");
622
ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator");
623
ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound");
624
ATARIHW_ANNOUNCE(CODEC, "CODEC Sound");
625
ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)");
626
ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)");
627
ATARIHW_ANNOUNCE(ACSI, "ACSI Interface");
628
ATARIHW_ANNOUNCE(IDE, "IDE Interface");
629
ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC");
630
ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901");
631
ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901");
632
ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530");
633
ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230");
634
ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface");
635
ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface");
636
ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)");
637
ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)");
638
ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380");
639
ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC");
640
ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A");
641
ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15");
642
ATARIHW_ANNOUNCE(SCU, "System Control Unit");
643
ATARIHW_ANNOUNCE(BLITTER, "Blitter");
644
ATARIHW_ANNOUNCE(VME, "VME Bus");
645
ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
646
}
647
648
/*
649
* MSch: initial platform device support for Atari,
650
* required for EtherNAT/EtherNEC/NetUSBee drivers
651
*/
652
653
#if defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNEC)
654
static void isp1160_delay(struct device *dev, int delay)
655
{
656
ndelay(delay);
657
}
658
#endif
659
660
#ifdef CONFIG_ATARI_ETHERNAT
661
/*
662
* EtherNAT: SMC91C111 Ethernet chipset, handled by smc91x driver
663
*/
664
665
#define ATARI_ETHERNAT_IRQ 140
666
667
static struct resource smc91x_resources[] = {
668
[0] = {
669
.name = "smc91x-regs",
670
.start = ATARI_ETHERNAT_PHYS_ADDR,
671
.end = ATARI_ETHERNAT_PHYS_ADDR + 0xfffff,
672
.flags = IORESOURCE_MEM,
673
},
674
[1] = {
675
.name = "smc91x-irq",
676
.start = ATARI_ETHERNAT_IRQ,
677
.end = ATARI_ETHERNAT_IRQ,
678
.flags = IORESOURCE_IRQ,
679
},
680
};
681
682
static struct platform_device smc91x_device = {
683
.name = "smc91x",
684
.id = -1,
685
.num_resources = ARRAY_SIZE(smc91x_resources),
686
.resource = smc91x_resources,
687
};
688
689
/*
690
* ISP 1160 - using the isp116x-hcd module
691
*/
692
693
#define ATARI_USB_PHYS_ADDR 0x80000012
694
#define ATARI_USB_IRQ 139
695
696
static struct resource isp1160_resources[] = {
697
[0] = {
698
.name = "isp1160-data",
699
.start = ATARI_USB_PHYS_ADDR,
700
.end = ATARI_USB_PHYS_ADDR + 0x1,
701
.flags = IORESOURCE_MEM,
702
},
703
[1] = {
704
.name = "isp1160-regs",
705
.start = ATARI_USB_PHYS_ADDR + 0x4,
706
.end = ATARI_USB_PHYS_ADDR + 0x5,
707
.flags = IORESOURCE_MEM,
708
},
709
[2] = {
710
.name = "isp1160-irq",
711
.start = ATARI_USB_IRQ,
712
.end = ATARI_USB_IRQ,
713
.flags = IORESOURCE_IRQ,
714
},
715
};
716
717
/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */
718
static struct isp116x_platform_data isp1160_platform_data = {
719
/* Enable internal resistors on downstream ports */
720
.sel15Kres = 1,
721
/* On-chip overcurrent protection */
722
.oc_enable = 1,
723
/* INT output polarity */
724
.int_act_high = 1,
725
/* INT edge or level triggered */
726
.int_edge_triggered = 0,
727
728
/* WAKEUP pin connected - NOT SUPPORTED */
729
/* .remote_wakeup_connected = 0, */
730
/* Wakeup by devices on usb bus enabled */
731
.remote_wakeup_enable = 0,
732
.delay = isp1160_delay,
733
};
734
735
static struct platform_device isp1160_device = {
736
.name = "isp116x-hcd",
737
.id = 0,
738
.num_resources = ARRAY_SIZE(isp1160_resources),
739
.resource = isp1160_resources,
740
.dev = {
741
.platform_data = &isp1160_platform_data,
742
},
743
};
744
745
static struct platform_device *atari_ethernat_devices[] __initdata = {
746
&smc91x_device,
747
&isp1160_device
748
};
749
#endif /* CONFIG_ATARI_ETHERNAT */
750
751
#ifdef CONFIG_ATARI_ETHERNEC
752
/*
753
* EtherNEC: RTL8019 (NE2000 compatible) Ethernet chipset,
754
* handled by ne.c driver
755
*/
756
757
#define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000
758
#define ATARI_ETHERNEC_BASE 0x300
759
#define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMER1
760
761
static struct resource rtl8019_resources[] = {
762
[0] = {
763
.name = "rtl8019-regs",
764
.start = ATARI_ETHERNEC_BASE,
765
.end = ATARI_ETHERNEC_BASE + 0x20 - 1,
766
.flags = IORESOURCE_IO,
767
},
768
[1] = {
769
.name = "rtl8019-irq",
770
.start = ATARI_ETHERNEC_IRQ,
771
.end = ATARI_ETHERNEC_IRQ,
772
.flags = IORESOURCE_IRQ,
773
},
774
};
775
776
static struct platform_device rtl8019_device = {
777
.name = "ne",
778
.id = -1,
779
.num_resources = ARRAY_SIZE(rtl8019_resources),
780
.resource = rtl8019_resources,
781
};
782
783
/*
784
* NetUSBee: ISP1160 USB host adapter via ROM-port adapter
785
*/
786
787
#define ATARI_NETUSBEE_PHYS_ADDR 0xfffa8000
788
#define ATARI_NETUSBEE_BASE 0x340
789
#define ATARI_NETUSBEE_IRQ IRQ_MFP_TIMER2
790
791
static struct resource netusbee_resources[] = {
792
[0] = {
793
.name = "isp1160-data",
794
.start = ATARI_NETUSBEE_BASE,
795
.end = ATARI_NETUSBEE_BASE + 0x1,
796
.flags = IORESOURCE_MEM,
797
},
798
[1] = {
799
.name = "isp1160-regs",
800
.start = ATARI_NETUSBEE_BASE + 0x20,
801
.end = ATARI_NETUSBEE_BASE + 0x21,
802
.flags = IORESOURCE_MEM,
803
},
804
[2] = {
805
.name = "isp1160-irq",
806
.start = ATARI_NETUSBEE_IRQ,
807
.end = ATARI_NETUSBEE_IRQ,
808
.flags = IORESOURCE_IRQ,
809
},
810
};
811
812
/* (DataBusWidth16|AnalogOCEnable|DREQOutputPolarity|DownstreamPort15KRSel ) */
813
static struct isp116x_platform_data netusbee_platform_data = {
814
/* Enable internal resistors on downstream ports */
815
.sel15Kres = 1,
816
/* On-chip overcurrent protection */
817
.oc_enable = 1,
818
/* INT output polarity */
819
.int_act_high = 1,
820
/* INT edge or level triggered */
821
.int_edge_triggered = 0,
822
823
/* WAKEUP pin connected - NOT SUPPORTED */
824
/* .remote_wakeup_connected = 0, */
825
/* Wakeup by devices on usb bus enabled */
826
.remote_wakeup_enable = 0,
827
.delay = isp1160_delay,
828
};
829
830
static struct platform_device netusbee_device = {
831
.name = "isp116x-hcd",
832
.id = 1,
833
.num_resources = ARRAY_SIZE(netusbee_resources),
834
.resource = netusbee_resources,
835
.dev = {
836
.platform_data = &netusbee_platform_data,
837
},
838
};
839
840
static struct platform_device *atari_netusbee_devices[] __initdata = {
841
&rtl8019_device,
842
&netusbee_device
843
};
844
#endif /* CONFIG_ATARI_ETHERNEC */
845
846
#if IS_ENABLED(CONFIG_ATARI_SCSI)
847
static const struct resource atari_scsi_st_rsrc[] __initconst = {
848
{
849
.flags = IORESOURCE_IRQ,
850
.start = IRQ_MFP_FSCSI,
851
.end = IRQ_MFP_FSCSI,
852
},
853
};
854
855
static const struct resource atari_scsi_tt_rsrc[] __initconst = {
856
{
857
.flags = IORESOURCE_IRQ,
858
.start = IRQ_TT_MFP_SCSI,
859
.end = IRQ_TT_MFP_SCSI,
860
},
861
};
862
#endif
863
864
/*
865
* Falcon IDE interface
866
*/
867
868
#define FALCON_IDE_BASE 0xfff00000
869
870
static const struct resource atari_falconide_rsrc[] __initconst = {
871
DEFINE_RES_MEM(FALCON_IDE_BASE, 0x38),
872
DEFINE_RES_MEM(FALCON_IDE_BASE + 0x38, 2),
873
};
874
875
static int __init atari_platform_init(void)
876
{
877
struct platform_device *pdev;
878
int rv = 0;
879
880
if (!MACH_IS_ATARI)
881
return -ENODEV;
882
883
#ifdef CONFIG_ATARI_ETHERNAT
884
{
885
unsigned char *enatc_virt;
886
enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
887
if (hwreg_present(enatc_virt)) {
888
rv = platform_add_devices(atari_ethernat_devices,
889
ARRAY_SIZE(atari_ethernat_devices));
890
}
891
iounmap(enatc_virt);
892
}
893
#endif
894
895
#ifdef CONFIG_ATARI_ETHERNEC
896
{
897
int error;
898
unsigned char *enec_virt;
899
enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf);
900
if (hwreg_present(enec_virt)) {
901
error = platform_add_devices(atari_netusbee_devices,
902
ARRAY_SIZE(atari_netusbee_devices));
903
if (error && !rv)
904
rv = error;
905
}
906
iounmap(enec_virt);
907
}
908
#endif
909
910
#if IS_ENABLED(CONFIG_ATARI_SCSI)
911
if (ATARIHW_PRESENT(ST_SCSI))
912
platform_device_register_simple("atari_scsi", -1,
913
atari_scsi_st_rsrc, ARRAY_SIZE(atari_scsi_st_rsrc));
914
else if (ATARIHW_PRESENT(TT_SCSI))
915
platform_device_register_simple("atari_scsi", -1,
916
atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));
917
#endif
918
919
if (ATARIHW_PRESENT(IDE)) {
920
pdev = platform_device_register_simple("atari-falcon-ide", -1,
921
atari_falconide_rsrc, ARRAY_SIZE(atari_falconide_rsrc));
922
if (IS_ERR(pdev))
923
rv = PTR_ERR(pdev);
924
}
925
926
return rv;
927
}
928
929
arch_initcall(atari_platform_init);
930
931