This source file includes following definitions.
- scc_test
- atari_parse_bootinfo
- atari_switches_setup
- config_atari
- atari_heartbeat
- atari_reset
- atari_get_model
- atari_get_hardware_list
- isp1160_delay
- atari_platform_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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/vt_kern.h>
37 #include <linux/module.h>
38
39 #include <asm/bootinfo.h>
40 #include <asm/bootinfo-atari.h>
41 #include <asm/byteorder.h>
42 #include <asm/setup.h>
43 #include <asm/atarihw.h>
44 #include <asm/atariints.h>
45 #include <asm/atari_stram.h>
46 #include <asm/machdep.h>
47 #include <asm/hwtest.h>
48 #include <asm/io.h>
49
50 u_long atari_mch_cookie;
51 EXPORT_SYMBOL(atari_mch_cookie);
52
53 u_long atari_mch_type;
54 EXPORT_SYMBOL(atari_mch_type);
55
56 struct atari_hw_present atari_hw_present;
57 EXPORT_SYMBOL(atari_hw_present);
58
59 u_long atari_switches;
60 EXPORT_SYMBOL(atari_switches);
61
62 int atari_dont_touch_floppy_select;
63 EXPORT_SYMBOL(atari_dont_touch_floppy_select);
64
65 int atari_rtc_year_offset;
66
67
68 static void atari_reset(void);
69 static void atari_get_model(char *model);
70 static void atari_get_hardware_list(struct seq_file *m);
71
72
73 extern void atari_init_IRQ (void);
74 extern void atari_mksound(unsigned int count, unsigned int ticks);
75 #ifdef CONFIG_HEARTBEAT
76 static void atari_heartbeat(int on);
77 #endif
78
79
80 extern void atari_sched_init(irq_handler_t);
81 extern int atari_mste_hwclk (int, struct rtc_time *);
82 extern int atari_tt_hwclk (int, struct rtc_time *);
83
84
85
86
87
88
89
90
91
92 static int __init scc_test(volatile char *ctla)
93 {
94 if (!hwreg_present(ctla))
95 return 0;
96 MFPDELAY();
97
98 *ctla = 2;
99 MFPDELAY();
100 *ctla = 0x40;
101 MFPDELAY();
102
103 *ctla = 2;
104 MFPDELAY();
105 if (*ctla != 0x40)
106 return 0;
107 MFPDELAY();
108
109 *ctla = 2;
110 MFPDELAY();
111 *ctla = 0x60;
112 MFPDELAY();
113
114 *ctla = 2;
115 MFPDELAY();
116 if (*ctla != 0x60)
117 return 0;
118
119 return 1;
120 }
121
122
123
124
125
126
127 int __init atari_parse_bootinfo(const struct bi_record *record)
128 {
129 int unknown = 0;
130 const void *data = record->data;
131
132 switch (be16_to_cpu(record->tag)) {
133 case BI_ATARI_MCH_COOKIE:
134 atari_mch_cookie = be32_to_cpup(data);
135 break;
136 case BI_ATARI_MCH_TYPE:
137 atari_mch_type = be32_to_cpup(data);
138 break;
139 default:
140 unknown = 1;
141 break;
142 }
143 return unknown;
144 }
145
146
147
148 static int __init atari_switches_setup(char *str)
149 {
150 char switches[COMMAND_LINE_SIZE];
151 char *p;
152 int ovsc_shift;
153 char *args = switches;
154
155 if (!MACH_IS_ATARI)
156 return 0;
157
158
159 strcpy(switches, str);
160 atari_switches = 0;
161
162
163 while ((p = strsep(&args, ",")) != NULL) {
164 if (!*p)
165 continue;
166 ovsc_shift = 0;
167 if (strncmp(p, "ov_", 3) == 0) {
168 p += 3;
169 ovsc_shift = ATARI_SWITCH_OVSC_SHIFT;
170 }
171
172 if (strcmp(p, "ikbd") == 0) {
173
174 atari_switches |= ATARI_SWITCH_IKBD << ovsc_shift;
175 } else if (strcmp(p, "midi") == 0) {
176
177 atari_switches |= ATARI_SWITCH_MIDI << ovsc_shift;
178 } else if (strcmp(p, "snd6") == 0) {
179 atari_switches |= ATARI_SWITCH_SND6 << ovsc_shift;
180 } else if (strcmp(p, "snd7") == 0) {
181 atari_switches |= ATARI_SWITCH_SND7 << ovsc_shift;
182 }
183 }
184 return 0;
185 }
186
187 early_param("switches", atari_switches_setup);
188
189
190
191
192
193
194 void __init config_atari(void)
195 {
196 unsigned short tos_version;
197
198 memset(&atari_hw_present, 0, sizeof(atari_hw_present));
199
200
201 ioport_resource.end = 0xFFFFFFFF;
202
203 mach_sched_init = atari_sched_init;
204 mach_init_IRQ = atari_init_IRQ;
205 mach_get_model = atari_get_model;
206 mach_get_hardware_list = atari_get_hardware_list;
207 mach_reset = atari_reset;
208 mach_max_dma_address = 0xffffff;
209 #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
210 mach_beep = atari_mksound;
211 #endif
212 #ifdef CONFIG_HEARTBEAT
213 mach_heartbeat = atari_heartbeat;
214 #endif
215
216
217 if (atari_switches & ATARI_SWITCH_IKBD)
218 acia.key_ctrl = ACIA_DIV64 | ACIA_D8N1S | ACIA_RHTID;
219 if (atari_switches & ATARI_SWITCH_MIDI)
220 acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S | ACIA_RHTID;
221 if (atari_switches & (ATARI_SWITCH_SND6|ATARI_SWITCH_SND7)) {
222 sound_ym.rd_data_reg_sel = 14;
223 sound_ym.wd_data = sound_ym.rd_data_reg_sel |
224 ((atari_switches&ATARI_SWITCH_SND6) ? 0x40 : 0) |
225 ((atari_switches&ATARI_SWITCH_SND7) ? 0x80 : 0);
226 }
227
228
229
230
231
232 pr_info("Atari hardware found:");
233 if (MACH_IS_MEDUSA) {
234
235
236 } else if (hwreg_present(f030_xreg)) {
237 ATARIHW_SET(VIDEL_SHIFTER);
238 pr_cont(" VIDEL");
239
240
241
242
243
244 ATARIHW_SET(ST_SCSI);
245 pr_cont(" STDMA-SCSI");
246 } else if (hwreg_present(tt_palette)) {
247 ATARIHW_SET(TT_SHIFTER);
248 pr_cont(" TT_SHIFTER");
249 } else if (hwreg_present(&shifter_st.bas_hi)) {
250 if (hwreg_present(&shifter_st.bas_lo) &&
251 (shifter_st.bas_lo = 0x0aau, shifter_st.bas_lo == 0x0aau)) {
252 ATARIHW_SET(EXTD_SHIFTER);
253 pr_cont(" EXTD_SHIFTER");
254 } else {
255 ATARIHW_SET(STND_SHIFTER);
256 pr_cont(" STND_SHIFTER");
257 }
258 }
259 if (hwreg_present(&st_mfp.par_dt_reg)) {
260 ATARIHW_SET(ST_MFP);
261 pr_cont(" ST_MFP");
262 }
263 if (hwreg_present(&tt_mfp.par_dt_reg)) {
264 ATARIHW_SET(TT_MFP);
265 pr_cont(" TT_MFP");
266 }
267 if (hwreg_present(&tt_scsi_dma.dma_addr_hi)) {
268 ATARIHW_SET(SCSI_DMA);
269 pr_cont(" TT_SCSI_DMA");
270 }
271
272
273
274
275 if (MACH_IS_MEDUSA ||
276 (hwreg_present(&st_dma.dma_vhi) &&
277 (st_dma.dma_vhi = 0x55) && (st_dma.dma_hi = 0xaa) &&
278 st_dma.dma_vhi == 0x55 && st_dma.dma_hi == 0xaa &&
279 (st_dma.dma_vhi = 0xaa) && (st_dma.dma_hi = 0x55) &&
280 st_dma.dma_vhi == 0xaa && st_dma.dma_hi == 0x55)) {
281 ATARIHW_SET(EXTD_DMA);
282 pr_cont(" EXTD_DMA");
283 }
284 if (hwreg_present(&tt_scsi.scsi_data)) {
285 ATARIHW_SET(TT_SCSI);
286 pr_cont(" TT_SCSI");
287 }
288 if (hwreg_present(&sound_ym.rd_data_reg_sel)) {
289 ATARIHW_SET(YM_2149);
290 pr_cont(" YM2149");
291 }
292 if (!MACH_IS_MEDUSA && hwreg_present(&tt_dmasnd.ctrl)) {
293 ATARIHW_SET(PCM_8BIT);
294 pr_cont(" PCM");
295 }
296 if (hwreg_present(&falcon_codec.unused5)) {
297 ATARIHW_SET(CODEC);
298 pr_cont(" CODEC");
299 }
300 if (hwreg_present(&dsp56k_host_interface.icr)) {
301 ATARIHW_SET(DSP56K);
302 pr_cont(" DSP56K");
303 }
304 if (hwreg_present(&tt_scc_dma.dma_ctrl) &&
305 #if 0
306
307 (tt_scc_dma.dma_ctrl = 0x01, (tt_scc_dma.dma_ctrl & 1) == 1) &&
308 (tt_scc_dma.dma_ctrl = 0x00, (tt_scc_dma.dma_ctrl & 1) == 0)
309 #else
310 !MACH_IS_MEDUSA
311 #endif
312 ) {
313 ATARIHW_SET(SCC_DMA);
314 pr_cont(" SCC_DMA");
315 }
316 if (scc_test(&atari_scc.cha_a_ctrl)) {
317 ATARIHW_SET(SCC);
318 pr_cont(" SCC");
319 }
320 if (scc_test(&st_escc.cha_b_ctrl)) {
321 ATARIHW_SET(ST_ESCC);
322 pr_cont(" ST_ESCC");
323 }
324 if (hwreg_present(&tt_scu.sys_mask)) {
325 ATARIHW_SET(SCU);
326
327 ATARIHW_SET(VME);
328 pr_cont(" VME SCU");
329 }
330 if (hwreg_present((void *)(0xffff9210))) {
331 ATARIHW_SET(ANALOG_JOY);
332 pr_cont(" ANALOG_JOY");
333 }
334 if (hwreg_present(blitter.halftone)) {
335 ATARIHW_SET(BLITTER);
336 pr_cont(" BLITTER");
337 }
338 if (hwreg_present((void *)0xfff00039)) {
339 ATARIHW_SET(IDE);
340 pr_cont(" IDE");
341 }
342 #if 1
343 if (!MACH_IS_MEDUSA && hwreg_present(&tt_microwire.data) &&
344 hwreg_present(&tt_microwire.mask) &&
345 (tt_microwire.mask = 0x7ff,
346 udelay(1),
347 tt_microwire.data = MW_LM1992_PSG_HIGH | MW_LM1992_ADDR,
348 udelay(1),
349 tt_microwire.data != 0)) {
350 ATARIHW_SET(MICROWIRE);
351 while (tt_microwire.mask != 0x7ff)
352 ;
353 pr_cont(" MICROWIRE");
354 }
355 #endif
356 if (hwreg_present(&tt_rtc.regsel)) {
357 ATARIHW_SET(TT_CLK);
358 pr_cont(" TT_CLK");
359 mach_hwclk = atari_tt_hwclk;
360 }
361 if (hwreg_present(&mste_rtc.sec_ones)) {
362 ATARIHW_SET(MSTE_CLK);
363 pr_cont(" MSTE_CLK");
364 mach_hwclk = atari_mste_hwclk;
365 }
366 if (!MACH_IS_MEDUSA && hwreg_present(&dma_wd.fdc_speed) &&
367 hwreg_write(&dma_wd.fdc_speed, 0)) {
368 ATARIHW_SET(FDCSPEED);
369 pr_cont(" FDC_SPEED");
370 }
371 if (!ATARIHW_PRESENT(ST_SCSI)) {
372 ATARIHW_SET(ACSI);
373 pr_cont(" ACSI");
374 }
375 pr_cont("\n");
376
377 if (CPU_IS_040_OR_060)
378
379
380
381
382 asm volatile ("\n"
383 " moveq #0,%%d0\n"
384 " .chip 68040\n"
385 " movec %%d0,%%itt0\n"
386 " movec %%d0,%%dtt0\n"
387 " .chip 68k"
388 :
389 :
390 : "d0");
391
392
393 atari_stram_init();
394
395
396
397
398
399
400
401
402
403
404
405
406 if (CPU_IS_020_OR_030) {
407 unsigned long tt1_val;
408 tt1_val = 0xfe008543;
409
410
411 asm volatile ("\n"
412 " .chip 68030\n"
413 " pmove %0,%/tt1\n"
414 " .chip 68k"
415 : : "m" (tt1_val));
416 } else {
417 asm volatile ("\n"
418 " .chip 68040\n"
419 " movec %0,%%itt1\n"
420 " movec %0,%%dtt1\n"
421 " .chip 68k"
422 :
423 : "d" (0xfe00a040));
424
425
426
427 }
428
429
430
431
432
433
434
435
436
437
438
439 tos_version = (MACH_IS_MEDUSA) ?
440 0xfff : *(unsigned short *)0xff000002;
441 atari_rtc_year_offset = (tos_version < 0x306) ? 70 : 68;
442 }
443
444 #ifdef CONFIG_HEARTBEAT
445 static void atari_heartbeat(int on)
446 {
447 unsigned char tmp;
448 unsigned long flags;
449
450 if (atari_dont_touch_floppy_select)
451 return;
452
453 local_irq_save(flags);
454 sound_ym.rd_data_reg_sel = 14;
455 tmp = sound_ym.rd_data_reg_sel;
456 sound_ym.wd_data = on ? (tmp & ~0x02) : (tmp | 0x02);
457 local_irq_restore(flags);
458 }
459 #endif
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492 static void atari_reset(void)
493 {
494 long tc_val = 0;
495 long reset_addr;
496
497
498
499
500
501 reset_addr = MACH_IS_MEDUSA || MACH_IS_AB40 ? 0xe00030 :
502 *(unsigned long *) 0xff000004;
503
504
505 if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
506 acia.key_ctrl = ACIA_RESET;
507 if (atari_switches & ATARI_SWITCH_OVSC_MIDI)
508 acia.mid_ctrl = ACIA_RESET;
509
510
511
512
513
514 local_irq_disable();
515 asm volatile ("movec %0,%%vbr"
516 : : "d" (0));
517
518 if (CPU_IS_040_OR_060) {
519 unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
520 if (CPU_IS_060) {
521
522 asm volatile ("\n"
523 " .chip 68060\n"
524 " movec %0,%%pcr\n"
525 " .chip 68k"
526 : : "d" (0));
527 }
528
529 asm volatile ("\n"
530 " move.l %0,%%d0\n"
531 " and.l #0xff000000,%%d0\n"
532 " or.w #0xe020,%%d0\n"
533 " .chip 68040\n"
534 " movec %%d0,%%itt0\n"
535 " movec %%d0,%%dtt0\n"
536 " .chip 68k\n"
537 " jmp %0@"
538 : : "a" (jmp_addr040)
539 : "d0");
540 jmp_addr_label040:
541 asm volatile ("\n"
542 " moveq #0,%%d0\n"
543 " nop\n"
544 " .chip 68040\n"
545 " cinva %%bc\n"
546 " nop\n"
547 " pflusha\n"
548 " nop\n"
549 " movec %%d0,%%tc\n"
550 " nop\n"
551
552
553
554
555 " move.l #0xffc000,%%d0\n"
556 " movec %%d0,%%itt0\n"
557 " movec %%d0,%%itt1\n"
558 " or.w #0x40,%/d0\n"
559 " movec %%d0,%%dtt0\n"
560 " movec %%d0,%%dtt1\n"
561 " .chip 68k\n"
562 " jmp %0@"
563 :
564 : "a" (reset_addr)
565 : "d0");
566 } else
567 asm volatile ("\n"
568 " pmove %0,%%tc\n"
569 " jmp %1@"
570 :
571 : "m" (tc_val), "a" (reset_addr));
572 }
573
574
575 static void atari_get_model(char *model)
576 {
577 strcpy(model, "Atari ");
578 switch (atari_mch_cookie >> 16) {
579 case ATARI_MCH_ST:
580 if (ATARIHW_PRESENT(MSTE_CLK))
581 strcat(model, "Mega ST");
582 else
583 strcat(model, "ST");
584 break;
585 case ATARI_MCH_STE:
586 if (MACH_IS_MSTE)
587 strcat(model, "Mega STE");
588 else
589 strcat(model, "STE");
590 break;
591 case ATARI_MCH_TT:
592 if (MACH_IS_MEDUSA)
593
594 strcat(model, "Medusa");
595 else
596 strcat(model, "TT");
597 break;
598 case ATARI_MCH_FALCON:
599 strcat(model, "Falcon");
600 if (MACH_IS_AB40)
601 strcat(model, " (with Afterburner040)");
602 break;
603 default:
604 sprintf(model + strlen(model), "(unknown mach cookie 0x%lx)",
605 atari_mch_cookie);
606 break;
607 }
608 }
609
610
611 static void atari_get_hardware_list(struct seq_file *m)
612 {
613 int i;
614
615 for (i = 0; i < m68k_num_memory; i++)
616 seq_printf(m, "\t%3ld MB at 0x%08lx (%s)\n",
617 m68k_memory[i].size >> 20, m68k_memory[i].addr,
618 (m68k_memory[i].addr & 0xff000000 ?
619 "alternate RAM" : "ST-RAM"));
620
621 #define ATARIHW_ANNOUNCE(name, str) \
622 if (ATARIHW_PRESENT(name)) \
623 seq_printf(m, "\t%s\n", str)
624
625 seq_puts(m, "Detected hardware:\n");
626 ATARIHW_ANNOUNCE(STND_SHIFTER, "ST Shifter");
627 ATARIHW_ANNOUNCE(EXTD_SHIFTER, "STe Shifter");
628 ATARIHW_ANNOUNCE(TT_SHIFTER, "TT Shifter");
629 ATARIHW_ANNOUNCE(VIDEL_SHIFTER, "Falcon Shifter");
630 ATARIHW_ANNOUNCE(YM_2149, "Programmable Sound Generator");
631 ATARIHW_ANNOUNCE(PCM_8BIT, "PCM 8 Bit Sound");
632 ATARIHW_ANNOUNCE(CODEC, "CODEC Sound");
633 ATARIHW_ANNOUNCE(TT_SCSI, "SCSI Controller NCR5380 (TT style)");
634 ATARIHW_ANNOUNCE(ST_SCSI, "SCSI Controller NCR5380 (Falcon style)");
635 ATARIHW_ANNOUNCE(ACSI, "ACSI Interface");
636 ATARIHW_ANNOUNCE(IDE, "IDE Interface");
637 ATARIHW_ANNOUNCE(FDCSPEED, "8/16 Mhz Switch for FDC");
638 ATARIHW_ANNOUNCE(ST_MFP, "Multi Function Peripheral MFP 68901");
639 ATARIHW_ANNOUNCE(TT_MFP, "Second Multi Function Peripheral MFP 68901");
640 ATARIHW_ANNOUNCE(SCC, "Serial Communications Controller SCC 8530");
641 ATARIHW_ANNOUNCE(ST_ESCC, "Extended Serial Communications Controller SCC 85230");
642 ATARIHW_ANNOUNCE(ANALOG_JOY, "Paddle Interface");
643 ATARIHW_ANNOUNCE(MICROWIRE, "MICROWIRE(tm) Interface");
644 ATARIHW_ANNOUNCE(STND_DMA, "DMA Controller (24 bit)");
645 ATARIHW_ANNOUNCE(EXTD_DMA, "DMA Controller (32 bit)");
646 ATARIHW_ANNOUNCE(SCSI_DMA, "DMA Controller for NCR5380");
647 ATARIHW_ANNOUNCE(SCC_DMA, "DMA Controller for SCC");
648 ATARIHW_ANNOUNCE(TT_CLK, "Clock Chip MC146818A");
649 ATARIHW_ANNOUNCE(MSTE_CLK, "Clock Chip RP5C15");
650 ATARIHW_ANNOUNCE(SCU, "System Control Unit");
651 ATARIHW_ANNOUNCE(BLITTER, "Blitter");
652 ATARIHW_ANNOUNCE(VME, "VME Bus");
653 ATARIHW_ANNOUNCE(DSP56K, "DSP56001 processor");
654 }
655
656
657
658
659
660
661 #if defined(CONFIG_ATARI_ETHERNAT) || defined(CONFIG_ATARI_ETHERNEC)
662 static void isp1160_delay(struct device *dev, int delay)
663 {
664 ndelay(delay);
665 }
666 #endif
667
668 #ifdef CONFIG_ATARI_ETHERNAT
669
670
671
672
673 #define ATARI_ETHERNAT_IRQ 140
674
675 static struct resource smc91x_resources[] = {
676 [0] = {
677 .name = "smc91x-regs",
678 .start = ATARI_ETHERNAT_PHYS_ADDR,
679 .end = ATARI_ETHERNAT_PHYS_ADDR + 0xfffff,
680 .flags = IORESOURCE_MEM,
681 },
682 [1] = {
683 .name = "smc91x-irq",
684 .start = ATARI_ETHERNAT_IRQ,
685 .end = ATARI_ETHERNAT_IRQ,
686 .flags = IORESOURCE_IRQ,
687 },
688 };
689
690 static struct platform_device smc91x_device = {
691 .name = "smc91x",
692 .id = -1,
693 .num_resources = ARRAY_SIZE(smc91x_resources),
694 .resource = smc91x_resources,
695 };
696
697
698
699
700
701 #define ATARI_USB_PHYS_ADDR 0x80000012
702 #define ATARI_USB_IRQ 139
703
704 static struct resource isp1160_resources[] = {
705 [0] = {
706 .name = "isp1160-data",
707 .start = ATARI_USB_PHYS_ADDR,
708 .end = ATARI_USB_PHYS_ADDR + 0x1,
709 .flags = IORESOURCE_MEM,
710 },
711 [1] = {
712 .name = "isp1160-regs",
713 .start = ATARI_USB_PHYS_ADDR + 0x4,
714 .end = ATARI_USB_PHYS_ADDR + 0x5,
715 .flags = IORESOURCE_MEM,
716 },
717 [2] = {
718 .name = "isp1160-irq",
719 .start = ATARI_USB_IRQ,
720 .end = ATARI_USB_IRQ,
721 .flags = IORESOURCE_IRQ,
722 },
723 };
724
725
726 static struct isp116x_platform_data isp1160_platform_data = {
727
728 .sel15Kres = 1,
729
730 .oc_enable = 1,
731
732 .int_act_high = 1,
733
734 .int_edge_triggered = 0,
735
736
737
738
739 .remote_wakeup_enable = 0,
740 .delay = isp1160_delay,
741 };
742
743 static struct platform_device isp1160_device = {
744 .name = "isp116x-hcd",
745 .id = 0,
746 .num_resources = ARRAY_SIZE(isp1160_resources),
747 .resource = isp1160_resources,
748 .dev = {
749 .platform_data = &isp1160_platform_data,
750 },
751 };
752
753 static struct platform_device *atari_ethernat_devices[] __initdata = {
754 &smc91x_device,
755 &isp1160_device
756 };
757 #endif
758
759 #ifdef CONFIG_ATARI_ETHERNEC
760
761
762
763
764
765 #define ATARI_ETHERNEC_PHYS_ADDR 0xfffa0000
766 #define ATARI_ETHERNEC_BASE 0x300
767 #define ATARI_ETHERNEC_IRQ IRQ_MFP_TIMER1
768
769 static struct resource rtl8019_resources[] = {
770 [0] = {
771 .name = "rtl8019-regs",
772 .start = ATARI_ETHERNEC_BASE,
773 .end = ATARI_ETHERNEC_BASE + 0x20 - 1,
774 .flags = IORESOURCE_IO,
775 },
776 [1] = {
777 .name = "rtl8019-irq",
778 .start = ATARI_ETHERNEC_IRQ,
779 .end = ATARI_ETHERNEC_IRQ,
780 .flags = IORESOURCE_IRQ,
781 },
782 };
783
784 static struct platform_device rtl8019_device = {
785 .name = "ne",
786 .id = -1,
787 .num_resources = ARRAY_SIZE(rtl8019_resources),
788 .resource = rtl8019_resources,
789 };
790
791
792
793
794
795 #define ATARI_NETUSBEE_PHYS_ADDR 0xfffa8000
796 #define ATARI_NETUSBEE_BASE 0x340
797 #define ATARI_NETUSBEE_IRQ IRQ_MFP_TIMER2
798
799 static struct resource netusbee_resources[] = {
800 [0] = {
801 .name = "isp1160-data",
802 .start = ATARI_NETUSBEE_BASE,
803 .end = ATARI_NETUSBEE_BASE + 0x1,
804 .flags = IORESOURCE_MEM,
805 },
806 [1] = {
807 .name = "isp1160-regs",
808 .start = ATARI_NETUSBEE_BASE + 0x20,
809 .end = ATARI_NETUSBEE_BASE + 0x21,
810 .flags = IORESOURCE_MEM,
811 },
812 [2] = {
813 .name = "isp1160-irq",
814 .start = ATARI_NETUSBEE_IRQ,
815 .end = ATARI_NETUSBEE_IRQ,
816 .flags = IORESOURCE_IRQ,
817 },
818 };
819
820
821 static struct isp116x_platform_data netusbee_platform_data = {
822
823 .sel15Kres = 1,
824
825 .oc_enable = 1,
826
827 .int_act_high = 1,
828
829 .int_edge_triggered = 0,
830
831
832
833
834 .remote_wakeup_enable = 0,
835 .delay = isp1160_delay,
836 };
837
838 static struct platform_device netusbee_device = {
839 .name = "isp116x-hcd",
840 .id = 1,
841 .num_resources = ARRAY_SIZE(netusbee_resources),
842 .resource = netusbee_resources,
843 .dev = {
844 .platform_data = &netusbee_platform_data,
845 },
846 };
847
848 static struct platform_device *atari_netusbee_devices[] __initdata = {
849 &rtl8019_device,
850 &netusbee_device
851 };
852 #endif
853
854 #if IS_ENABLED(CONFIG_ATARI_SCSI)
855 static const struct resource atari_scsi_st_rsrc[] __initconst = {
856 {
857 .flags = IORESOURCE_IRQ,
858 .start = IRQ_MFP_FSCSI,
859 .end = IRQ_MFP_FSCSI,
860 },
861 };
862
863 static const struct resource atari_scsi_tt_rsrc[] __initconst = {
864 {
865 .flags = IORESOURCE_IRQ,
866 .start = IRQ_TT_MFP_SCSI,
867 .end = IRQ_TT_MFP_SCSI,
868 },
869 };
870 #endif
871
872 int __init atari_platform_init(void)
873 {
874 int rv = 0;
875
876 if (!MACH_IS_ATARI)
877 return -ENODEV;
878
879 #ifdef CONFIG_ATARI_ETHERNAT
880 {
881 unsigned char *enatc_virt;
882 enatc_virt = (unsigned char *)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
883 if (hwreg_present(enatc_virt)) {
884 rv = platform_add_devices(atari_ethernat_devices,
885 ARRAY_SIZE(atari_ethernat_devices));
886 }
887 iounmap(enatc_virt);
888 }
889 #endif
890
891 #ifdef CONFIG_ATARI_ETHERNEC
892 {
893 int error;
894 unsigned char *enec_virt;
895 enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf);
896 if (hwreg_present(enec_virt)) {
897 error = platform_add_devices(atari_netusbee_devices,
898 ARRAY_SIZE(atari_netusbee_devices));
899 if (error && !rv)
900 rv = error;
901 }
902 iounmap(enec_virt);
903 }
904 #endif
905
906 #if IS_ENABLED(CONFIG_ATARI_SCSI)
907 if (ATARIHW_PRESENT(ST_SCSI))
908 platform_device_register_simple("atari_scsi", -1,
909 atari_scsi_st_rsrc, ARRAY_SIZE(atari_scsi_st_rsrc));
910 else if (ATARIHW_PRESENT(TT_SCSI))
911 platform_device_register_simple("atari_scsi", -1,
912 atari_scsi_tt_rsrc, ARRAY_SIZE(atari_scsi_tt_rsrc));
913 #endif
914
915 return rv;
916 }
917
918 arch_initcall(atari_platform_init);