config.c 28 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085
  1. /*
  2. * linux/arch/m68k/mac/config.c
  3. *
  4. * This file is subject to the terms and conditions of the GNU General Public
  5. * License. See the file COPYING in the main directory of this archive
  6. * for more details.
  7. */
  8. /*
  9. * Miscellaneous linux stuff
  10. */
  11. #include <linux/errno.h>
  12. #include <linux/module.h>
  13. #include <linux/types.h>
  14. #include <linux/mm.h>
  15. #include <linux/tty.h>
  16. #include <linux/console.h>
  17. #include <linux/interrupt.h>
  18. /* keyb */
  19. #include <linux/random.h>
  20. #include <linux/delay.h>
  21. /* keyb */
  22. #include <linux/init.h>
  23. #include <linux/vt_kern.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/adb.h>
  26. #include <linux/cuda.h>
  27. #include <linux/pmu.h>
  28. #include <linux/rtc.h>
  29. #include <asm/setup.h>
  30. #include <asm/bootinfo.h>
  31. #include <asm/bootinfo-mac.h>
  32. #include <asm/byteorder.h>
  33. #include <asm/io.h>
  34. #include <asm/irq.h>
  35. #include <asm/pgtable.h>
  36. #include <asm/machdep.h>
  37. #include <asm/macintosh.h>
  38. #include <asm/macints.h>
  39. #include <asm/machw.h>
  40. #include <asm/mac_iop.h>
  41. #include <asm/mac_via.h>
  42. #include <asm/mac_oss.h>
  43. #include <asm/mac_psc.h>
  44. /* Mac bootinfo struct */
  45. struct mac_booter_data mac_bi_data;
  46. /* The phys. video addr. - might be bogus on some machines */
  47. static unsigned long mac_orig_videoaddr;
  48. /* Mac specific timer functions */
  49. extern u32 mac_gettimeoffset(void);
  50. extern int mac_hwclk(int, struct rtc_time *);
  51. extern void iop_preinit(void);
  52. extern void iop_init(void);
  53. extern void via_init(void);
  54. extern void via_init_clock(irq_handler_t func);
  55. extern void via_flush_cache(void);
  56. extern void oss_init(void);
  57. extern void psc_init(void);
  58. extern void baboon_init(void);
  59. extern void mac_mksound(unsigned int, unsigned int);
  60. static void mac_get_model(char *str);
  61. static void mac_identify(void);
  62. static void mac_report_hardware(void);
  63. static void __init mac_sched_init(irq_handler_t vector)
  64. {
  65. via_init_clock(vector);
  66. }
  67. /*
  68. * Parse a Macintosh-specific record in the bootinfo
  69. */
  70. int __init mac_parse_bootinfo(const struct bi_record *record)
  71. {
  72. int unknown = 0;
  73. const void *data = record->data;
  74. switch (be16_to_cpu(record->tag)) {
  75. case BI_MAC_MODEL:
  76. mac_bi_data.id = be32_to_cpup(data);
  77. break;
  78. case BI_MAC_VADDR:
  79. mac_bi_data.videoaddr = be32_to_cpup(data);
  80. break;
  81. case BI_MAC_VDEPTH:
  82. mac_bi_data.videodepth = be32_to_cpup(data);
  83. break;
  84. case BI_MAC_VROW:
  85. mac_bi_data.videorow = be32_to_cpup(data);
  86. break;
  87. case BI_MAC_VDIM:
  88. mac_bi_data.dimensions = be32_to_cpup(data);
  89. break;
  90. case BI_MAC_VLOGICAL:
  91. mac_orig_videoaddr = be32_to_cpup(data);
  92. mac_bi_data.videological =
  93. VIDEOMEMBASE + (mac_orig_videoaddr & ~VIDEOMEMMASK);
  94. break;
  95. case BI_MAC_SCCBASE:
  96. mac_bi_data.sccbase = be32_to_cpup(data);
  97. break;
  98. case BI_MAC_BTIME:
  99. mac_bi_data.boottime = be32_to_cpup(data);
  100. break;
  101. case BI_MAC_GMTBIAS:
  102. mac_bi_data.gmtbias = be32_to_cpup(data);
  103. break;
  104. case BI_MAC_MEMSIZE:
  105. mac_bi_data.memsize = be32_to_cpup(data);
  106. break;
  107. case BI_MAC_CPUID:
  108. mac_bi_data.cpuid = be32_to_cpup(data);
  109. break;
  110. case BI_MAC_ROMBASE:
  111. mac_bi_data.rombase = be32_to_cpup(data);
  112. break;
  113. default:
  114. unknown = 1;
  115. break;
  116. }
  117. return unknown;
  118. }
  119. /*
  120. * Flip into 24bit mode for an instant - flushes the L2 cache card. We
  121. * have to disable interrupts for this. Our IRQ handlers will crap
  122. * themselves if they take an IRQ in 24bit mode!
  123. */
  124. static void mac_cache_card_flush(int writeback)
  125. {
  126. unsigned long flags;
  127. local_irq_save(flags);
  128. via_flush_cache();
  129. local_irq_restore(flags);
  130. }
  131. void __init config_mac(void)
  132. {
  133. if (!MACH_IS_MAC)
  134. pr_err("ERROR: no Mac, but config_mac() called!!\n");
  135. mach_sched_init = mac_sched_init;
  136. mach_init_IRQ = mac_init_IRQ;
  137. mach_get_model = mac_get_model;
  138. arch_gettimeoffset = mac_gettimeoffset;
  139. mach_hwclk = mac_hwclk;
  140. mach_reset = mac_reset;
  141. mach_halt = mac_poweroff;
  142. mach_power_off = mac_poweroff;
  143. mach_max_dma_address = 0xffffffff;
  144. #if IS_ENABLED(CONFIG_INPUT_M68K_BEEP)
  145. mach_beep = mac_mksound;
  146. #endif
  147. /*
  148. * Determine hardware present
  149. */
  150. mac_identify();
  151. mac_report_hardware();
  152. /*
  153. * AFAIK only the IIci takes a cache card. The IIfx has onboard
  154. * cache ... someone needs to figure out how to tell if it's on or
  155. * not.
  156. */
  157. if (macintosh_config->ident == MAC_MODEL_IICI
  158. || macintosh_config->ident == MAC_MODEL_IIFX)
  159. mach_l2_flush = mac_cache_card_flush;
  160. }
  161. /*
  162. * Macintosh Table: hardcoded model configuration data.
  163. *
  164. * Much of this was defined by Alan, based on who knows what docs.
  165. * I've added a lot more, and some of that was pure guesswork based
  166. * on hardware pages present on the Mac web site. Possibly wildly
  167. * inaccurate, so look here if a new Mac model won't run. Example: if
  168. * a Mac crashes immediately after the VIA1 registers have been dumped
  169. * to the screen, it probably died attempting to read DirB on a RBV.
  170. * Meaning it should have MAC_VIA_IICI here :-)
  171. */
  172. struct mac_model *macintosh_config;
  173. EXPORT_SYMBOL(macintosh_config);
  174. static struct mac_model mac_data_table[] = {
  175. /*
  176. * We'll pretend to be a Macintosh II, that's pretty safe.
  177. */
  178. {
  179. .ident = MAC_MODEL_II,
  180. .name = "Unknown",
  181. .adb_type = MAC_ADB_II,
  182. .via_type = MAC_VIA_II,
  183. .scsi_type = MAC_SCSI_OLD,
  184. .scc_type = MAC_SCC_II,
  185. .expansion_type = MAC_EXP_NUBUS,
  186. .floppy_type = MAC_FLOPPY_IWM,
  187. },
  188. /*
  189. * Original Mac II hardware
  190. */
  191. {
  192. .ident = MAC_MODEL_II,
  193. .name = "II",
  194. .adb_type = MAC_ADB_II,
  195. .via_type = MAC_VIA_II,
  196. .scsi_type = MAC_SCSI_OLD,
  197. .scc_type = MAC_SCC_II,
  198. .expansion_type = MAC_EXP_NUBUS,
  199. .floppy_type = MAC_FLOPPY_IWM,
  200. }, {
  201. .ident = MAC_MODEL_IIX,
  202. .name = "IIx",
  203. .adb_type = MAC_ADB_II,
  204. .via_type = MAC_VIA_II,
  205. .scsi_type = MAC_SCSI_OLD,
  206. .scc_type = MAC_SCC_II,
  207. .expansion_type = MAC_EXP_NUBUS,
  208. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  209. }, {
  210. .ident = MAC_MODEL_IICX,
  211. .name = "IIcx",
  212. .adb_type = MAC_ADB_II,
  213. .via_type = MAC_VIA_II,
  214. .scsi_type = MAC_SCSI_OLD,
  215. .scc_type = MAC_SCC_II,
  216. .expansion_type = MAC_EXP_NUBUS,
  217. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  218. }, {
  219. .ident = MAC_MODEL_SE30,
  220. .name = "SE/30",
  221. .adb_type = MAC_ADB_II,
  222. .via_type = MAC_VIA_II,
  223. .scsi_type = MAC_SCSI_OLD,
  224. .scc_type = MAC_SCC_II,
  225. .expansion_type = MAC_EXP_PDS,
  226. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  227. },
  228. /*
  229. * Weirdified Mac II hardware - all subtly different. Gee thanks
  230. * Apple. All these boxes seem to have VIA2 in a different place to
  231. * the Mac II (+1A000 rather than +4000)
  232. * CSA: see http://developer.apple.com/technotes/hw/hw_09.html
  233. */
  234. {
  235. .ident = MAC_MODEL_IICI,
  236. .name = "IIci",
  237. .adb_type = MAC_ADB_II,
  238. .via_type = MAC_VIA_IICI,
  239. .scsi_type = MAC_SCSI_OLD,
  240. .scc_type = MAC_SCC_II,
  241. .expansion_type = MAC_EXP_NUBUS,
  242. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  243. }, {
  244. .ident = MAC_MODEL_IIFX,
  245. .name = "IIfx",
  246. .adb_type = MAC_ADB_IOP,
  247. .via_type = MAC_VIA_IICI,
  248. .scsi_type = MAC_SCSI_IIFX,
  249. .scc_type = MAC_SCC_IOP,
  250. .expansion_type = MAC_EXP_PDS_NUBUS,
  251. .floppy_type = MAC_FLOPPY_SWIM_IOP,
  252. }, {
  253. .ident = MAC_MODEL_IISI,
  254. .name = "IIsi",
  255. .adb_type = MAC_ADB_EGRET,
  256. .via_type = MAC_VIA_IICI,
  257. .scsi_type = MAC_SCSI_OLD,
  258. .scc_type = MAC_SCC_II,
  259. .expansion_type = MAC_EXP_PDS_NUBUS,
  260. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  261. }, {
  262. .ident = MAC_MODEL_IIVI,
  263. .name = "IIvi",
  264. .adb_type = MAC_ADB_EGRET,
  265. .via_type = MAC_VIA_IICI,
  266. .scsi_type = MAC_SCSI_LC,
  267. .scc_type = MAC_SCC_II,
  268. .expansion_type = MAC_EXP_NUBUS,
  269. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  270. }, {
  271. .ident = MAC_MODEL_IIVX,
  272. .name = "IIvx",
  273. .adb_type = MAC_ADB_EGRET,
  274. .via_type = MAC_VIA_IICI,
  275. .scsi_type = MAC_SCSI_LC,
  276. .scc_type = MAC_SCC_II,
  277. .expansion_type = MAC_EXP_NUBUS,
  278. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  279. },
  280. /*
  281. * Classic models (guessing: similar to SE/30? Nope, similar to LC...)
  282. */
  283. {
  284. .ident = MAC_MODEL_CLII,
  285. .name = "Classic II",
  286. .adb_type = MAC_ADB_EGRET,
  287. .via_type = MAC_VIA_IICI,
  288. .scsi_type = MAC_SCSI_LC,
  289. .scc_type = MAC_SCC_II,
  290. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  291. }, {
  292. .ident = MAC_MODEL_CCL,
  293. .name = "Color Classic",
  294. .adb_type = MAC_ADB_CUDA,
  295. .via_type = MAC_VIA_IICI,
  296. .scsi_type = MAC_SCSI_LC,
  297. .scc_type = MAC_SCC_II,
  298. .expansion_type = MAC_EXP_PDS,
  299. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  300. }, {
  301. .ident = MAC_MODEL_CCLII,
  302. .name = "Color Classic II",
  303. .adb_type = MAC_ADB_CUDA,
  304. .via_type = MAC_VIA_IICI,
  305. .scsi_type = MAC_SCSI_LC,
  306. .scc_type = MAC_SCC_II,
  307. .expansion_type = MAC_EXP_PDS,
  308. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  309. },
  310. /*
  311. * Some Mac LC machines. Basically the same as the IIci, ADB like IIsi
  312. */
  313. {
  314. .ident = MAC_MODEL_LC,
  315. .name = "LC",
  316. .adb_type = MAC_ADB_EGRET,
  317. .via_type = MAC_VIA_IICI,
  318. .scsi_type = MAC_SCSI_LC,
  319. .scc_type = MAC_SCC_II,
  320. .expansion_type = MAC_EXP_PDS,
  321. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  322. }, {
  323. .ident = MAC_MODEL_LCII,
  324. .name = "LC II",
  325. .adb_type = MAC_ADB_EGRET,
  326. .via_type = MAC_VIA_IICI,
  327. .scsi_type = MAC_SCSI_LC,
  328. .scc_type = MAC_SCC_II,
  329. .expansion_type = MAC_EXP_PDS,
  330. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  331. }, {
  332. .ident = MAC_MODEL_LCIII,
  333. .name = "LC III",
  334. .adb_type = MAC_ADB_EGRET,
  335. .via_type = MAC_VIA_IICI,
  336. .scsi_type = MAC_SCSI_LC,
  337. .scc_type = MAC_SCC_II,
  338. .expansion_type = MAC_EXP_PDS,
  339. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  340. },
  341. /*
  342. * Quadra. Video is at 0xF9000000, via is like a MacII. We label it
  343. * differently as some of the stuff connected to VIA2 seems different.
  344. * Better SCSI chip and onboard ethernet using a NatSemi SONIC except
  345. * the 660AV and 840AV which use an AMD 79C940 (MACE).
  346. * The 700, 900 and 950 have some I/O chips in the wrong place to
  347. * confuse us. The 840AV has a SCSI location of its own (same as
  348. * the 660AV).
  349. */
  350. {
  351. .ident = MAC_MODEL_Q605,
  352. .name = "Quadra 605",
  353. .adb_type = MAC_ADB_CUDA,
  354. .via_type = MAC_VIA_QUADRA,
  355. .scsi_type = MAC_SCSI_QUADRA,
  356. .scc_type = MAC_SCC_QUADRA,
  357. .expansion_type = MAC_EXP_PDS,
  358. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  359. }, {
  360. .ident = MAC_MODEL_Q605_ACC,
  361. .name = "Quadra 605",
  362. .adb_type = MAC_ADB_CUDA,
  363. .via_type = MAC_VIA_QUADRA,
  364. .scsi_type = MAC_SCSI_QUADRA,
  365. .scc_type = MAC_SCC_QUADRA,
  366. .expansion_type = MAC_EXP_PDS,
  367. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  368. }, {
  369. .ident = MAC_MODEL_Q610,
  370. .name = "Quadra 610",
  371. .adb_type = MAC_ADB_II,
  372. .via_type = MAC_VIA_QUADRA,
  373. .scsi_type = MAC_SCSI_QUADRA,
  374. .scc_type = MAC_SCC_QUADRA,
  375. .ether_type = MAC_ETHER_SONIC,
  376. .expansion_type = MAC_EXP_PDS_NUBUS,
  377. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  378. }, {
  379. .ident = MAC_MODEL_Q630,
  380. .name = "Quadra 630",
  381. .adb_type = MAC_ADB_CUDA,
  382. .via_type = MAC_VIA_QUADRA,
  383. .scsi_type = MAC_SCSI_QUADRA,
  384. .ide_type = MAC_IDE_QUADRA,
  385. .scc_type = MAC_SCC_QUADRA,
  386. .expansion_type = MAC_EXP_PDS_COMM,
  387. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  388. }, {
  389. .ident = MAC_MODEL_Q650,
  390. .name = "Quadra 650",
  391. .adb_type = MAC_ADB_II,
  392. .via_type = MAC_VIA_QUADRA,
  393. .scsi_type = MAC_SCSI_QUADRA,
  394. .scc_type = MAC_SCC_QUADRA,
  395. .ether_type = MAC_ETHER_SONIC,
  396. .expansion_type = MAC_EXP_PDS_NUBUS,
  397. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  398. },
  399. /* The Q700 does have a NS Sonic */
  400. {
  401. .ident = MAC_MODEL_Q700,
  402. .name = "Quadra 700",
  403. .adb_type = MAC_ADB_II,
  404. .via_type = MAC_VIA_QUADRA,
  405. .scsi_type = MAC_SCSI_QUADRA2,
  406. .scc_type = MAC_SCC_QUADRA,
  407. .ether_type = MAC_ETHER_SONIC,
  408. .expansion_type = MAC_EXP_PDS_NUBUS,
  409. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  410. }, {
  411. .ident = MAC_MODEL_Q800,
  412. .name = "Quadra 800",
  413. .adb_type = MAC_ADB_II,
  414. .via_type = MAC_VIA_QUADRA,
  415. .scsi_type = MAC_SCSI_QUADRA,
  416. .scc_type = MAC_SCC_QUADRA,
  417. .ether_type = MAC_ETHER_SONIC,
  418. .expansion_type = MAC_EXP_PDS_NUBUS,
  419. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  420. }, {
  421. .ident = MAC_MODEL_Q840,
  422. .name = "Quadra 840AV",
  423. .adb_type = MAC_ADB_CUDA,
  424. .via_type = MAC_VIA_QUADRA,
  425. .scsi_type = MAC_SCSI_QUADRA3,
  426. .scc_type = MAC_SCC_PSC,
  427. .ether_type = MAC_ETHER_MACE,
  428. .expansion_type = MAC_EXP_NUBUS,
  429. .floppy_type = MAC_FLOPPY_AV,
  430. }, {
  431. .ident = MAC_MODEL_Q900,
  432. .name = "Quadra 900",
  433. .adb_type = MAC_ADB_IOP,
  434. .via_type = MAC_VIA_QUADRA,
  435. .scsi_type = MAC_SCSI_QUADRA2,
  436. .scc_type = MAC_SCC_IOP,
  437. .ether_type = MAC_ETHER_SONIC,
  438. .expansion_type = MAC_EXP_PDS_NUBUS,
  439. .floppy_type = MAC_FLOPPY_SWIM_IOP,
  440. }, {
  441. .ident = MAC_MODEL_Q950,
  442. .name = "Quadra 950",
  443. .adb_type = MAC_ADB_IOP,
  444. .via_type = MAC_VIA_QUADRA,
  445. .scsi_type = MAC_SCSI_QUADRA2,
  446. .scc_type = MAC_SCC_IOP,
  447. .ether_type = MAC_ETHER_SONIC,
  448. .expansion_type = MAC_EXP_PDS_NUBUS,
  449. .floppy_type = MAC_FLOPPY_SWIM_IOP,
  450. },
  451. /*
  452. * Performa - more LC type machines
  453. */
  454. {
  455. .ident = MAC_MODEL_P460,
  456. .name = "Performa 460",
  457. .adb_type = MAC_ADB_EGRET,
  458. .via_type = MAC_VIA_IICI,
  459. .scsi_type = MAC_SCSI_LC,
  460. .scc_type = MAC_SCC_II,
  461. .expansion_type = MAC_EXP_PDS,
  462. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  463. }, {
  464. .ident = MAC_MODEL_P475,
  465. .name = "Performa 475",
  466. .adb_type = MAC_ADB_CUDA,
  467. .via_type = MAC_VIA_QUADRA,
  468. .scsi_type = MAC_SCSI_QUADRA,
  469. .scc_type = MAC_SCC_II,
  470. .expansion_type = MAC_EXP_PDS,
  471. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  472. }, {
  473. .ident = MAC_MODEL_P475F,
  474. .name = "Performa 475",
  475. .adb_type = MAC_ADB_CUDA,
  476. .via_type = MAC_VIA_QUADRA,
  477. .scsi_type = MAC_SCSI_QUADRA,
  478. .scc_type = MAC_SCC_II,
  479. .expansion_type = MAC_EXP_PDS,
  480. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  481. }, {
  482. .ident = MAC_MODEL_P520,
  483. .name = "Performa 520",
  484. .adb_type = MAC_ADB_CUDA,
  485. .via_type = MAC_VIA_IICI,
  486. .scsi_type = MAC_SCSI_LC,
  487. .scc_type = MAC_SCC_II,
  488. .expansion_type = MAC_EXP_PDS,
  489. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  490. }, {
  491. .ident = MAC_MODEL_P550,
  492. .name = "Performa 550",
  493. .adb_type = MAC_ADB_CUDA,
  494. .via_type = MAC_VIA_IICI,
  495. .scsi_type = MAC_SCSI_LC,
  496. .scc_type = MAC_SCC_II,
  497. .expansion_type = MAC_EXP_PDS,
  498. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  499. },
  500. /* These have the comm slot, and therefore possibly SONIC ethernet */
  501. {
  502. .ident = MAC_MODEL_P575,
  503. .name = "Performa 575",
  504. .adb_type = MAC_ADB_CUDA,
  505. .via_type = MAC_VIA_QUADRA,
  506. .scsi_type = MAC_SCSI_QUADRA,
  507. .scc_type = MAC_SCC_II,
  508. .expansion_type = MAC_EXP_PDS_COMM,
  509. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  510. }, {
  511. .ident = MAC_MODEL_P588,
  512. .name = "Performa 588",
  513. .adb_type = MAC_ADB_CUDA,
  514. .via_type = MAC_VIA_QUADRA,
  515. .scsi_type = MAC_SCSI_QUADRA,
  516. .ide_type = MAC_IDE_QUADRA,
  517. .scc_type = MAC_SCC_II,
  518. .expansion_type = MAC_EXP_PDS_COMM,
  519. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  520. }, {
  521. .ident = MAC_MODEL_TV,
  522. .name = "TV",
  523. .adb_type = MAC_ADB_CUDA,
  524. .via_type = MAC_VIA_IICI,
  525. .scsi_type = MAC_SCSI_LC,
  526. .scc_type = MAC_SCC_II,
  527. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  528. }, {
  529. .ident = MAC_MODEL_P600,
  530. .name = "Performa 600",
  531. .adb_type = MAC_ADB_EGRET,
  532. .via_type = MAC_VIA_IICI,
  533. .scsi_type = MAC_SCSI_LC,
  534. .scc_type = MAC_SCC_II,
  535. .expansion_type = MAC_EXP_NUBUS,
  536. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  537. },
  538. /*
  539. * Centris - just guessing again; maybe like Quadra.
  540. * The C610 may or may not have SONIC. We probe to make sure.
  541. */
  542. {
  543. .ident = MAC_MODEL_C610,
  544. .name = "Centris 610",
  545. .adb_type = MAC_ADB_II,
  546. .via_type = MAC_VIA_QUADRA,
  547. .scsi_type = MAC_SCSI_QUADRA,
  548. .scc_type = MAC_SCC_QUADRA,
  549. .ether_type = MAC_ETHER_SONIC,
  550. .expansion_type = MAC_EXP_PDS_NUBUS,
  551. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  552. }, {
  553. .ident = MAC_MODEL_C650,
  554. .name = "Centris 650",
  555. .adb_type = MAC_ADB_II,
  556. .via_type = MAC_VIA_QUADRA,
  557. .scsi_type = MAC_SCSI_QUADRA,
  558. .scc_type = MAC_SCC_QUADRA,
  559. .ether_type = MAC_ETHER_SONIC,
  560. .expansion_type = MAC_EXP_PDS_NUBUS,
  561. .floppy_type = MAC_FLOPPY_SWIM_ADDR1,
  562. }, {
  563. .ident = MAC_MODEL_C660,
  564. .name = "Centris 660AV",
  565. .adb_type = MAC_ADB_CUDA,
  566. .via_type = MAC_VIA_QUADRA,
  567. .scsi_type = MAC_SCSI_QUADRA3,
  568. .scc_type = MAC_SCC_PSC,
  569. .ether_type = MAC_ETHER_MACE,
  570. .expansion_type = MAC_EXP_PDS_NUBUS,
  571. .floppy_type = MAC_FLOPPY_AV,
  572. },
  573. /*
  574. * The PowerBooks all the same "Combo" custom IC for SCSI and SCC
  575. * and a PMU (in two variations?) for ADB. Most of them use the
  576. * Quadra-style VIAs. A few models also have IDE from hell.
  577. */
  578. {
  579. .ident = MAC_MODEL_PB140,
  580. .name = "PowerBook 140",
  581. .adb_type = MAC_ADB_PB1,
  582. .via_type = MAC_VIA_QUADRA,
  583. .scsi_type = MAC_SCSI_OLD,
  584. .scc_type = MAC_SCC_QUADRA,
  585. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  586. }, {
  587. .ident = MAC_MODEL_PB145,
  588. .name = "PowerBook 145",
  589. .adb_type = MAC_ADB_PB1,
  590. .via_type = MAC_VIA_QUADRA,
  591. .scsi_type = MAC_SCSI_OLD,
  592. .scc_type = MAC_SCC_QUADRA,
  593. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  594. }, {
  595. .ident = MAC_MODEL_PB150,
  596. .name = "PowerBook 150",
  597. .adb_type = MAC_ADB_PB2,
  598. .via_type = MAC_VIA_IICI,
  599. .scsi_type = MAC_SCSI_OLD,
  600. .ide_type = MAC_IDE_PB,
  601. .scc_type = MAC_SCC_QUADRA,
  602. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  603. }, {
  604. .ident = MAC_MODEL_PB160,
  605. .name = "PowerBook 160",
  606. .adb_type = MAC_ADB_PB1,
  607. .via_type = MAC_VIA_QUADRA,
  608. .scsi_type = MAC_SCSI_OLD,
  609. .scc_type = MAC_SCC_QUADRA,
  610. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  611. }, {
  612. .ident = MAC_MODEL_PB165,
  613. .name = "PowerBook 165",
  614. .adb_type = MAC_ADB_PB1,
  615. .via_type = MAC_VIA_QUADRA,
  616. .scsi_type = MAC_SCSI_OLD,
  617. .scc_type = MAC_SCC_QUADRA,
  618. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  619. }, {
  620. .ident = MAC_MODEL_PB165C,
  621. .name = "PowerBook 165c",
  622. .adb_type = MAC_ADB_PB1,
  623. .via_type = MAC_VIA_QUADRA,
  624. .scsi_type = MAC_SCSI_OLD,
  625. .scc_type = MAC_SCC_QUADRA,
  626. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  627. }, {
  628. .ident = MAC_MODEL_PB170,
  629. .name = "PowerBook 170",
  630. .adb_type = MAC_ADB_PB1,
  631. .via_type = MAC_VIA_QUADRA,
  632. .scsi_type = MAC_SCSI_OLD,
  633. .scc_type = MAC_SCC_QUADRA,
  634. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  635. }, {
  636. .ident = MAC_MODEL_PB180,
  637. .name = "PowerBook 180",
  638. .adb_type = MAC_ADB_PB1,
  639. .via_type = MAC_VIA_QUADRA,
  640. .scsi_type = MAC_SCSI_OLD,
  641. .scc_type = MAC_SCC_QUADRA,
  642. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  643. }, {
  644. .ident = MAC_MODEL_PB180C,
  645. .name = "PowerBook 180c",
  646. .adb_type = MAC_ADB_PB1,
  647. .via_type = MAC_VIA_QUADRA,
  648. .scsi_type = MAC_SCSI_OLD,
  649. .scc_type = MAC_SCC_QUADRA,
  650. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  651. }, {
  652. .ident = MAC_MODEL_PB190,
  653. .name = "PowerBook 190",
  654. .adb_type = MAC_ADB_PB2,
  655. .via_type = MAC_VIA_QUADRA,
  656. .scsi_type = MAC_SCSI_OLD,
  657. .ide_type = MAC_IDE_BABOON,
  658. .scc_type = MAC_SCC_QUADRA,
  659. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  660. }, {
  661. .ident = MAC_MODEL_PB520,
  662. .name = "PowerBook 520",
  663. .adb_type = MAC_ADB_PB2,
  664. .via_type = MAC_VIA_QUADRA,
  665. .scsi_type = MAC_SCSI_OLD,
  666. .scc_type = MAC_SCC_QUADRA,
  667. .ether_type = MAC_ETHER_SONIC,
  668. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  669. },
  670. /*
  671. * PowerBook Duos are pretty much like normal PowerBooks
  672. * All of these probably have onboard SONIC in the Dock which
  673. * means we'll have to probe for it eventually.
  674. */
  675. {
  676. .ident = MAC_MODEL_PB210,
  677. .name = "PowerBook Duo 210",
  678. .adb_type = MAC_ADB_PB2,
  679. .via_type = MAC_VIA_IICI,
  680. .scsi_type = MAC_SCSI_DUO,
  681. .scc_type = MAC_SCC_QUADRA,
  682. .expansion_type = MAC_EXP_NUBUS,
  683. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  684. }, {
  685. .ident = MAC_MODEL_PB230,
  686. .name = "PowerBook Duo 230",
  687. .adb_type = MAC_ADB_PB2,
  688. .via_type = MAC_VIA_IICI,
  689. .scsi_type = MAC_SCSI_DUO,
  690. .scc_type = MAC_SCC_QUADRA,
  691. .expansion_type = MAC_EXP_NUBUS,
  692. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  693. }, {
  694. .ident = MAC_MODEL_PB250,
  695. .name = "PowerBook Duo 250",
  696. .adb_type = MAC_ADB_PB2,
  697. .via_type = MAC_VIA_IICI,
  698. .scsi_type = MAC_SCSI_DUO,
  699. .scc_type = MAC_SCC_QUADRA,
  700. .expansion_type = MAC_EXP_NUBUS,
  701. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  702. }, {
  703. .ident = MAC_MODEL_PB270C,
  704. .name = "PowerBook Duo 270c",
  705. .adb_type = MAC_ADB_PB2,
  706. .via_type = MAC_VIA_IICI,
  707. .scsi_type = MAC_SCSI_DUO,
  708. .scc_type = MAC_SCC_QUADRA,
  709. .expansion_type = MAC_EXP_NUBUS,
  710. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  711. }, {
  712. .ident = MAC_MODEL_PB280,
  713. .name = "PowerBook Duo 280",
  714. .adb_type = MAC_ADB_PB2,
  715. .via_type = MAC_VIA_IICI,
  716. .scsi_type = MAC_SCSI_DUO,
  717. .scc_type = MAC_SCC_QUADRA,
  718. .expansion_type = MAC_EXP_NUBUS,
  719. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  720. }, {
  721. .ident = MAC_MODEL_PB280C,
  722. .name = "PowerBook Duo 280c",
  723. .adb_type = MAC_ADB_PB2,
  724. .via_type = MAC_VIA_IICI,
  725. .scsi_type = MAC_SCSI_DUO,
  726. .scc_type = MAC_SCC_QUADRA,
  727. .expansion_type = MAC_EXP_NUBUS,
  728. .floppy_type = MAC_FLOPPY_SWIM_ADDR2,
  729. },
  730. /*
  731. * Other stuff?
  732. */
  733. {
  734. .ident = -1
  735. }
  736. };
  737. static struct resource scc_a_rsrcs[] = {
  738. { .flags = IORESOURCE_MEM },
  739. { .flags = IORESOURCE_IRQ },
  740. };
  741. static struct resource scc_b_rsrcs[] = {
  742. { .flags = IORESOURCE_MEM },
  743. { .flags = IORESOURCE_IRQ },
  744. };
  745. struct platform_device scc_a_pdev = {
  746. .name = "scc",
  747. .id = 0,
  748. .num_resources = ARRAY_SIZE(scc_a_rsrcs),
  749. .resource = scc_a_rsrcs,
  750. };
  751. EXPORT_SYMBOL(scc_a_pdev);
  752. struct platform_device scc_b_pdev = {
  753. .name = "scc",
  754. .id = 1,
  755. .num_resources = ARRAY_SIZE(scc_b_rsrcs),
  756. .resource = scc_b_rsrcs,
  757. };
  758. EXPORT_SYMBOL(scc_b_pdev);
  759. static void __init mac_identify(void)
  760. {
  761. struct mac_model *m;
  762. /* Penguin data useful? */
  763. int model = mac_bi_data.id;
  764. if (!model) {
  765. /* no bootinfo model id -> NetBSD booter was used! */
  766. /* XXX FIXME: breaks for model > 31 */
  767. model = (mac_bi_data.cpuid >> 2) & 63;
  768. pr_warn("No bootinfo model ID, using cpuid instead (obsolete bootloader?)\n");
  769. }
  770. macintosh_config = mac_data_table;
  771. for (m = macintosh_config; m->ident != -1; m++) {
  772. if (m->ident == model) {
  773. macintosh_config = m;
  774. break;
  775. }
  776. }
  777. /* Set up serial port resources for the console initcall. */
  778. scc_a_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase + 2;
  779. scc_a_rsrcs[0].end = scc_a_rsrcs[0].start;
  780. scc_b_rsrcs[0].start = (resource_size_t) mac_bi_data.sccbase;
  781. scc_b_rsrcs[0].end = scc_b_rsrcs[0].start;
  782. switch (macintosh_config->scc_type) {
  783. case MAC_SCC_PSC:
  784. scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC_A;
  785. scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC_B;
  786. break;
  787. default:
  788. /* On non-PSC machines, the serial ports share an IRQ. */
  789. if (macintosh_config->ident == MAC_MODEL_IIFX) {
  790. scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_MAC_SCC;
  791. scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_MAC_SCC;
  792. } else {
  793. scc_a_rsrcs[1].start = scc_a_rsrcs[1].end = IRQ_AUTO_4;
  794. scc_b_rsrcs[1].start = scc_b_rsrcs[1].end = IRQ_AUTO_4;
  795. }
  796. break;
  797. }
  798. /*
  799. * We need to pre-init the IOPs, if any. Otherwise
  800. * the serial console won't work if the user had
  801. * the serial ports set to "Faster" mode in MacOS.
  802. */
  803. iop_preinit();
  804. pr_info("Detected Macintosh model: %d\n", model);
  805. /*
  806. * Report booter data:
  807. */
  808. printk(KERN_DEBUG " Penguin bootinfo data:\n");
  809. printk(KERN_DEBUG " Video: addr 0x%lx row 0x%lx depth %lx dimensions %ld x %ld\n",
  810. mac_bi_data.videoaddr, mac_bi_data.videorow,
  811. mac_bi_data.videodepth, mac_bi_data.dimensions & 0xFFFF,
  812. mac_bi_data.dimensions >> 16);
  813. printk(KERN_DEBUG " Videological 0x%lx phys. 0x%lx, SCC at 0x%lx\n",
  814. mac_bi_data.videological, mac_orig_videoaddr,
  815. mac_bi_data.sccbase);
  816. printk(KERN_DEBUG " Boottime: 0x%lx GMTBias: 0x%lx\n",
  817. mac_bi_data.boottime, mac_bi_data.gmtbias);
  818. printk(KERN_DEBUG " Machine ID: %ld CPUid: 0x%lx memory size: 0x%lx\n",
  819. mac_bi_data.id, mac_bi_data.cpuid, mac_bi_data.memsize);
  820. iop_init();
  821. oss_init();
  822. via_init();
  823. psc_init();
  824. baboon_init();
  825. #ifdef CONFIG_ADB_CUDA
  826. find_via_cuda();
  827. #endif
  828. #ifdef CONFIG_ADB_PMU
  829. find_via_pmu();
  830. #endif
  831. }
  832. static void __init mac_report_hardware(void)
  833. {
  834. pr_info("Apple Macintosh %s\n", macintosh_config->name);
  835. }
  836. static void mac_get_model(char *str)
  837. {
  838. strcpy(str, "Macintosh ");
  839. strcat(str, macintosh_config->name);
  840. }
  841. static const struct resource mac_scsi_iifx_rsrc[] __initconst = {
  842. {
  843. .flags = IORESOURCE_IRQ,
  844. .start = IRQ_MAC_SCSI,
  845. .end = IRQ_MAC_SCSI,
  846. }, {
  847. .flags = IORESOURCE_MEM,
  848. .start = 0x50008000,
  849. .end = 0x50009FFF,
  850. },
  851. };
  852. static const struct resource mac_scsi_duo_rsrc[] __initconst = {
  853. {
  854. .flags = IORESOURCE_MEM,
  855. .start = 0xFEE02000,
  856. .end = 0xFEE03FFF,
  857. },
  858. };
  859. static const struct resource mac_scsi_old_rsrc[] __initconst = {
  860. {
  861. .flags = IORESOURCE_IRQ,
  862. .start = IRQ_MAC_SCSI,
  863. .end = IRQ_MAC_SCSI,
  864. }, {
  865. .flags = IORESOURCE_MEM,
  866. .start = 0x50010000,
  867. .end = 0x50011FFF,
  868. }, {
  869. .flags = IORESOURCE_MEM,
  870. .start = 0x50006000,
  871. .end = 0x50007FFF,
  872. },
  873. };
  874. static const struct resource mac_scsi_ccl_rsrc[] __initconst = {
  875. {
  876. .flags = IORESOURCE_IRQ,
  877. .start = IRQ_MAC_SCSI,
  878. .end = IRQ_MAC_SCSI,
  879. }, {
  880. .flags = IORESOURCE_MEM,
  881. .start = 0x50F10000,
  882. .end = 0x50F11FFF,
  883. }, {
  884. .flags = IORESOURCE_MEM,
  885. .start = 0x50F06000,
  886. .end = 0x50F07FFF,
  887. },
  888. };
  889. int __init mac_platform_init(void)
  890. {
  891. u8 *swim_base;
  892. if (!MACH_IS_MAC)
  893. return -ENODEV;
  894. /*
  895. * Serial devices
  896. */
  897. platform_device_register(&scc_a_pdev);
  898. platform_device_register(&scc_b_pdev);
  899. /*
  900. * Floppy device
  901. */
  902. switch (macintosh_config->floppy_type) {
  903. case MAC_FLOPPY_SWIM_ADDR1:
  904. swim_base = (u8 *)(VIA1_BASE + 0x1E000);
  905. break;
  906. case MAC_FLOPPY_SWIM_ADDR2:
  907. swim_base = (u8 *)(VIA1_BASE + 0x16000);
  908. break;
  909. default:
  910. swim_base = NULL;
  911. break;
  912. }
  913. if (swim_base) {
  914. struct resource swim_rsrc = {
  915. .flags = IORESOURCE_MEM,
  916. .start = (resource_size_t)swim_base,
  917. .end = (resource_size_t)swim_base + 0x1FFF,
  918. };
  919. platform_device_register_simple("swim", -1, &swim_rsrc, 1);
  920. }
  921. /*
  922. * SCSI device(s)
  923. */
  924. switch (macintosh_config->scsi_type) {
  925. case MAC_SCSI_QUADRA:
  926. case MAC_SCSI_QUADRA3:
  927. platform_device_register_simple("mac_esp", 0, NULL, 0);
  928. break;
  929. case MAC_SCSI_QUADRA2:
  930. platform_device_register_simple("mac_esp", 0, NULL, 0);
  931. if ((macintosh_config->ident == MAC_MODEL_Q900) ||
  932. (macintosh_config->ident == MAC_MODEL_Q950))
  933. platform_device_register_simple("mac_esp", 1, NULL, 0);
  934. break;
  935. case MAC_SCSI_IIFX:
  936. /* Addresses from The Guide to Mac Family Hardware.
  937. * $5000 8000 - $5000 9FFF: SCSI DMA
  938. * $5000 C000 - $5000 DFFF: Alternate SCSI (DMA)
  939. * $5000 E000 - $5000 FFFF: Alternate SCSI (Hsk)
  940. * The SCSI DMA custom IC embeds the 53C80 core. mac_scsi does
  941. * not make use of its DMA or hardware handshaking logic.
  942. */
  943. platform_device_register_simple("mac_scsi", 0,
  944. mac_scsi_iifx_rsrc, ARRAY_SIZE(mac_scsi_iifx_rsrc));
  945. break;
  946. case MAC_SCSI_DUO:
  947. /* Addresses from the Duo Dock II Developer Note.
  948. * $FEE0 2000 - $FEE0 3FFF: normal mode
  949. * $FEE0 4000 - $FEE0 5FFF: pseudo DMA without /DRQ
  950. * $FEE0 6000 - $FEE0 7FFF: pseudo DMA with /DRQ
  951. * The NetBSD code indicates that both 5380 chips share
  952. * an IRQ (?) which would need careful handling (see mac_esp).
  953. */
  954. platform_device_register_simple("mac_scsi", 1,
  955. mac_scsi_duo_rsrc, ARRAY_SIZE(mac_scsi_duo_rsrc));
  956. /* fall through */
  957. case MAC_SCSI_OLD:
  958. /* Addresses from Developer Notes for Duo System,
  959. * PowerBook 180 & 160, 140 & 170, Macintosh IIsi
  960. * and also from The Guide to Mac Family Hardware for
  961. * SE/30, II, IIx, IIcx, IIci.
  962. * $5000 6000 - $5000 7FFF: pseudo-DMA with /DRQ
  963. * $5001 0000 - $5001 1FFF: normal mode
  964. * $5001 2000 - $5001 3FFF: pseudo-DMA without /DRQ
  965. * GMFH says that $5000 0000 - $50FF FFFF "wraps
  966. * $5000 0000 - $5001 FFFF eight times" (!)
  967. * mess.org says IIci and Color Classic do not alias
  968. * I/O address space.
  969. */
  970. platform_device_register_simple("mac_scsi", 0,
  971. mac_scsi_old_rsrc, ARRAY_SIZE(mac_scsi_old_rsrc));
  972. break;
  973. case MAC_SCSI_LC:
  974. /* Addresses from Mac LC data in Designing Cards & Drivers 3ed.
  975. * Also from the Developer Notes for Classic II, LC III,
  976. * Color Classic and IIvx.
  977. * $50F0 6000 - $50F0 7FFF: SCSI handshake
  978. * $50F1 0000 - $50F1 1FFF: SCSI
  979. * $50F1 2000 - $50F1 3FFF: SCSI DMA
  980. */
  981. platform_device_register_simple("mac_scsi", 0,
  982. mac_scsi_ccl_rsrc, ARRAY_SIZE(mac_scsi_ccl_rsrc));
  983. break;
  984. }
  985. /*
  986. * Ethernet device
  987. */
  988. if (macintosh_config->ether_type == MAC_ETHER_SONIC ||
  989. macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
  990. platform_device_register_simple("macsonic", -1, NULL, 0);
  991. if (macintosh_config->expansion_type == MAC_EXP_PDS ||
  992. macintosh_config->expansion_type == MAC_EXP_PDS_COMM)
  993. platform_device_register_simple("mac89x0", -1, NULL, 0);
  994. if (macintosh_config->ether_type == MAC_ETHER_MACE)
  995. platform_device_register_simple("macmace", -1, NULL, 0);
  996. return 0;
  997. }
  998. arch_initcall(mac_platform_init);