config.c 23 KB

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