18c2ecf20Sopenharmony_ciLinux for the Q40 28c2ecf20Sopenharmony_ci================= 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ciYou may try http://www.geocities.com/SiliconValley/Bay/2602/ for 58c2ecf20Sopenharmony_cisome up to date information. Booter and other tools will be also 68c2ecf20Sopenharmony_ciavailable from this place or http://ftp.uni-erlangen.de/pub/unix/Linux/680x0/q40/ 78c2ecf20Sopenharmony_ciand mirrors. 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciHints to documentation usually refer to the linux source tree in 108c2ecf20Sopenharmony_ci/usr/src/linux/Documentation unless URL given. 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciIt seems IRQ unmasking can't be safely done on a Q40. IRQ probing 138c2ecf20Sopenharmony_ciis not implemented - do not try it! (See below) 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ciFor a list of kernel command-line options read the documentation for the 168c2ecf20Sopenharmony_ciparticular device drivers. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciThe floppy imposes a very high interrupt load on the CPU, approx 30K/s. 198c2ecf20Sopenharmony_ciWhen something blocks interrupts (HD) it will lose some of them, so far 208c2ecf20Sopenharmony_cithis is not known to have caused any data loss. On highly loaded systems 218c2ecf20Sopenharmony_ciit can make the floppy very slow or practically stop. Other Q40 OS' simply 228c2ecf20Sopenharmony_cipoll the floppy for this reason - something that can't be done in Linux. 238c2ecf20Sopenharmony_ciOnly possible cure is getting a 82072 controller with fifo instead of 248c2ecf20Sopenharmony_cithe 8272A. 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cidrivers used by the Q40, apart from the very obvious (console etc.): 278c2ecf20Sopenharmony_ci drivers/char/q40_keyb.c # use PC keymaps for national keyboards 288c2ecf20Sopenharmony_ci serial.c # normal PC driver - any speed 298c2ecf20Sopenharmony_ci lp.c # printer driver 308c2ecf20Sopenharmony_ci genrtc.c # RTC 318c2ecf20Sopenharmony_ci char/joystick/* # most of this should work, not 328c2ecf20Sopenharmony_ci # in default config.in 338c2ecf20Sopenharmony_ci block/q40ide.c # startup for ide 348c2ecf20Sopenharmony_ci ide* # see Documentation/ide/ide.rst 358c2ecf20Sopenharmony_ci floppy.c # normal PC driver, DMA emu in asm/floppy.h 368c2ecf20Sopenharmony_ci # and arch/m68k/kernel/entry.S 378c2ecf20Sopenharmony_ci # see drivers/block/README.fd 388c2ecf20Sopenharmony_ci net/ne.c 398c2ecf20Sopenharmony_ci video/q40fb.c 408c2ecf20Sopenharmony_ci parport/* 418c2ecf20Sopenharmony_ci sound/dmasound_core.c 428c2ecf20Sopenharmony_ci dmasound_q40.c 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciVarious other PC drivers can be enabled simply by adding them to 458c2ecf20Sopenharmony_ciarch/m68k/config.in, especially 8 bit devices should be without any 468c2ecf20Sopenharmony_ciproblems. For cards using 16bit io/mem more care is required, like 478c2ecf20Sopenharmony_cichecking byte order issues, hacking memcpy_*_io etc. 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciDebugging 518c2ecf20Sopenharmony_ci========= 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ciUpon startup the kernel will usually output "ABCQGHIJ" into the SRAM, 548c2ecf20Sopenharmony_cipreceded by the booter signature. This is a trace just in case something 558c2ecf20Sopenharmony_ciwent wrong during earliest setup stages of head.S. 568c2ecf20Sopenharmony_ci**Changed** to preserve SRAM contents by default, this is only done when 578c2ecf20Sopenharmony_cirequested - SRAM must start with '%LX$' signature to do this. '-d' option 588c2ecf20Sopenharmony_cito 'lxx' loader enables this. 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ciSRAM can also be used as additional console device, use debug=mem. 618c2ecf20Sopenharmony_ciThis will save kernel startup msgs into SRAM, the screen will display 628c2ecf20Sopenharmony_cionly the penguin - and shell prompt if it gets that far.. 638c2ecf20Sopenharmony_ciUnfortunately only 2000 bytes are available. 648c2ecf20Sopenharmony_ci 658c2ecf20Sopenharmony_ciSerial console works and can also be used for debugging, see loader_txt 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ciMost problems seem to be caused by fawlty or badly configured io-cards or 688c2ecf20Sopenharmony_cihard drives anyway. 698c2ecf20Sopenharmony_ciMake sure to configure the parallel port as SPP and remove IRQ/DMA jumpers 708c2ecf20Sopenharmony_cifor first testing. The Q40 does not support DMA and may have trouble with 718c2ecf20Sopenharmony_ciparallel ports version of interrupts. 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ciQ40 Hardware Description 758c2ecf20Sopenharmony_ci======================== 768c2ecf20Sopenharmony_ci 778c2ecf20Sopenharmony_ciThis is just an overview, see asm-m68k/* for details ask if you have any 788c2ecf20Sopenharmony_ciquestions. 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_ciThe Q40 consists of a 68040@40 MHz, 1MB video RAM, up to 32MB RAM, AT-style 818c2ecf20Sopenharmony_cikeyboard interface, 1 Programmable LED, 2x8bit DACs and up to 1MB ROM, 1MB 828c2ecf20Sopenharmony_cishadow ROM. 838c2ecf20Sopenharmony_ciThe Q60 has any of 68060 or 68LC060 and up to 128 MB RAM. 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ciMost interfacing like floppy, IDE, serial and parallel ports is done via ISA 868c2ecf20Sopenharmony_cislots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate 878c2ecf20Sopenharmony_ciregions of the memory. 888c2ecf20Sopenharmony_ciThe main interrupt register IIRQ_REG will indicate whether an IRQ was internal 898c2ecf20Sopenharmony_cior from some ISA devices, EIRQ_REG can distinguish up to 8 ISA IRQs. 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ciThe Q40 custom chip is programmable to provide 2 periodic timers: 928c2ecf20Sopenharmony_ci - 50 or 200 Hz - level 2, !!THIS CAN'T BE DISABLED!! 938c2ecf20Sopenharmony_ci - 10 or 20 KHz - level 4, used for dma-sound 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ciLinux uses the 200 Hz interrupt for timer and beep by default. 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ciInterrupts 998c2ecf20Sopenharmony_ci========== 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ciq40 master chip handles only a subset of level triggered interrupts. 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ciLinux has some requirements wrt interrupt architecture, these are 1048c2ecf20Sopenharmony_cito my knowledge: 1058c2ecf20Sopenharmony_ci (a) interrupt handler must not be reentered even when sti() is called 1068c2ecf20Sopenharmony_ci from within handler 1078c2ecf20Sopenharmony_ci (b) working enable/disable_irq 1088c2ecf20Sopenharmony_ci 1098c2ecf20Sopenharmony_ciLuckily these requirements are only important for drivers shared 1108c2ecf20Sopenharmony_ciwith other architectures - ide,serial,parallel, ethernet. 1118c2ecf20Sopenharmony_ciq40ints.c now contains a trivial hack for (a), (b) is more difficult 1128c2ecf20Sopenharmony_cibecause only irq's 4-15 can be disabled - and only all of them at once. 1138c2ecf20Sopenharmony_ciThus disable_irq() can effectively block the machine if the driver goes 1148c2ecf20Sopenharmony_ciasleep. 1158c2ecf20Sopenharmony_ciOne thing to keep in mind when hacking around the interrupt code is 1168c2ecf20Sopenharmony_cithat there is no way to find out which IRQ caused a request, [EI]IRQ_REG 1178c2ecf20Sopenharmony_cidisplays current state of the various IRQ lines. 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ciKeyboard 1208c2ecf20Sopenharmony_ci======== 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ciq40 receives AT make/break codes from the keyboard, these are translated to 1238c2ecf20Sopenharmony_cithe PC scancodes x86 Linux uses. So by theory every national keyboard should 1248c2ecf20Sopenharmony_ciwork just by loading the appropriate x86 keytable - see any national-HOWTO. 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ciUnfortunately the AT->PC translation isn't quite trivial and even worse, my 1278c2ecf20Sopenharmony_cidocumentation of it is absolutely minimal - thus some exotic keys may not 1288c2ecf20Sopenharmony_cibehave exactly as expected. 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ciThere is still hope that it can be fixed completely though. If you encounter 1318c2ecf20Sopenharmony_ciproblems, email me ideally this: 1328c2ecf20Sopenharmony_ci - exact keypress/release sequence 1338c2ecf20Sopenharmony_ci - 'showkey -s' run on q40, non-X session 1348c2ecf20Sopenharmony_ci - 'showkey -s' run on a PC, non-X session 1358c2ecf20Sopenharmony_ci - AT codes as displayed by the q40 debugging ROM 1368c2ecf20Sopenharmony_cibtw if the showkey output from PC and Q40 doesn't differ then you have some 1378c2ecf20Sopenharmony_ciclassic configuration problem - don't send me anything in this case 1388c2ecf20Sopenharmony_ci 139