config.c 24 KB

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