11da177e4SLinus TorvaldsLinux for the Q40 21da177e4SLinus Torvalds================= 31da177e4SLinus Torvalds 41da177e4SLinus TorvaldsYou may try http://www.geocities.com/SiliconValley/Bay/2602/ for 51da177e4SLinus Torvaldssome up to date information. Booter and other tools will be also 6*50a23e6eSJustin P. Mattockavailable from this place or http://ftp.uni-erlangen.de/pub/unix/Linux/680x0/q40/ 71da177e4SLinus Torvaldsand mirrors. 81da177e4SLinus Torvalds 91da177e4SLinus TorvaldsHints to documentation usually refer to the linux source tree in 101da177e4SLinus Torvalds/usr/src/linux/Documentation unless URL given. 111da177e4SLinus Torvalds 121da177e4SLinus TorvaldsIt seems IRQ unmasking can't be safely done on a Q40. IRQ probing 131da177e4SLinus Torvaldsis not implemented - do not try it! (See below) 141da177e4SLinus Torvalds 151da177e4SLinus TorvaldsFor a list of kernel command-line options read the documentation for the 161da177e4SLinus Torvaldsparticular device drivers. 171da177e4SLinus Torvalds 181da177e4SLinus TorvaldsThe floppy imposes a very high interrupt load on the CPU, approx 30K/s. 191da177e4SLinus TorvaldsWhen something blocks interrupts (HD) it will lose some of them, so far 201da177e4SLinus Torvaldsthis is not known to have caused any data loss. On highly loaded systems 211da177e4SLinus Torvaldsit can make the floppy very slow or practically stop. Other Q40 OS' simply 221da177e4SLinus Torvaldspoll the floppy for this reason - something that can't be done in Linux. 231da177e4SLinus TorvaldsOnly possible cure is getting a 82072 controller with fifo instead of 241da177e4SLinus Torvaldsthe 8272A. 251da177e4SLinus Torvalds 261da177e4SLinus Torvaldsdrivers used by the Q40, apart from the very obvious (console etc.): 271da177e4SLinus Torvalds drivers/char/q40_keyb.c # use PC keymaps for national keyboards 281da177e4SLinus Torvalds serial.c # normal PC driver - any speed 291da177e4SLinus Torvalds lp.c # printer driver 301da177e4SLinus Torvalds genrtc.c # RTC 311da177e4SLinus Torvalds char/joystick/* # most of this should work, not 321da177e4SLinus Torvalds # in default config.in 331da177e4SLinus Torvalds block/q40ide.c # startup for ide 341da177e4SLinus Torvalds ide* # see Documentation/ide.txt 351da177e4SLinus Torvalds floppy.c # normal PC driver, DMA emu in asm/floppy.h 361da177e4SLinus Torvalds # and arch/m68k/kernel/entry.S 371da177e4SLinus Torvalds # see drivers/block/README.fd 381da177e4SLinus Torvalds net/ne.c 391da177e4SLinus Torvalds video/q40fb.c 401da177e4SLinus Torvalds parport/* 411da177e4SLinus Torvalds sound/dmasound_core.c 421da177e4SLinus Torvalds dmasound_q40.c 431da177e4SLinus Torvalds 441da177e4SLinus TorvaldsVarious other PC drivers can be enabled simply by adding them to 451da177e4SLinus Torvaldsarch/m68k/config.in, especially 8 bit devices should be without any 461da177e4SLinus Torvaldsproblems. For cards using 16bit io/mem more care is required, like 471da177e4SLinus Torvaldschecking byte order issues, hacking memcpy_*_io etc. 481da177e4SLinus Torvalds 491da177e4SLinus Torvalds 501da177e4SLinus TorvaldsDebugging 511da177e4SLinus Torvalds========= 521da177e4SLinus Torvalds 531da177e4SLinus TorvaldsUpon startup the kernel will usually output "ABCQGHIJ" into the SRAM, 541da177e4SLinus Torvaldspreceded by the booter signature. This is a trace just in case something 551da177e4SLinus Torvaldswent wrong during earliest setup stages of head.S. 561da177e4SLinus Torvalds**Changed** to preserve SRAM contents by default, this is only done when 571da177e4SLinus Torvaldsrequested - SRAM must start with '%LX$' signature to do this. '-d' option 581da177e4SLinus Torvaldsto 'lxx' loader enables this. 591da177e4SLinus Torvalds 601da177e4SLinus TorvaldsSRAM can also be used as additional console device, use debug=mem. 611da177e4SLinus TorvaldsThis will save kernel startup msgs into SRAM, the screen will display 621da177e4SLinus Torvaldsonly the penguin - and shell prompt if it gets that far.. 631da177e4SLinus TorvaldsUnfortunately only 2000 bytes are available. 641da177e4SLinus Torvalds 651da177e4SLinus TorvaldsSerial console works and can also be used for debugging, see loader_txt 661da177e4SLinus Torvalds 671da177e4SLinus TorvaldsMost problems seem to be caused by fawlty or badly configured io-cards or 681da177e4SLinus Torvaldshard drives anyway. 691da177e4SLinus TorvaldsMake sure to configure the parallel port as SPP and remove IRQ/DMA jumpers 701da177e4SLinus Torvaldsfor first testing. The Q40 does not support DMA and may have trouble with 711da177e4SLinus Torvaldsparallel ports version of interrupts. 721da177e4SLinus Torvalds 731da177e4SLinus Torvalds 741da177e4SLinus TorvaldsQ40 Hardware Description 751da177e4SLinus Torvalds======================== 761da177e4SLinus Torvalds 771da177e4SLinus TorvaldsThis is just an overview, see asm-m68k/* for details ask if you have any 781da177e4SLinus Torvaldsquestions. 791da177e4SLinus Torvalds 801da177e4SLinus TorvaldsThe Q40 consists of a 68040@40 MHz, 1MB video RAM, up to 32MB RAM, AT-style 811da177e4SLinus Torvaldskeyboard interface, 1 Programmable LED, 2x8bit DACs and up to 1MB ROM, 1MB 821da177e4SLinus Torvaldsshadow ROM. 831da177e4SLinus TorvaldsThe Q60 has any of 68060 or 68LC060 and up to 128 MB RAM. 841da177e4SLinus Torvalds 851da177e4SLinus TorvaldsMost interfacing like floppy, IDE, serial and parallel ports is done via ISA 861da177e4SLinus Torvaldsslots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate 871da177e4SLinus Torvaldsregions of the memory. 881da177e4SLinus TorvaldsThe main interrupt register IIRQ_REG will indicate whether an IRQ was internal 891da177e4SLinus Torvaldsor from some ISA devices, EIRQ_REG can distinguish up to 8 ISA IRQs. 901da177e4SLinus Torvalds 911da177e4SLinus TorvaldsThe Q40 custom chip is programmable to provide 2 periodic timers: 921da177e4SLinus Torvalds - 50 or 200 Hz - level 2, !!THIS CANT BE DISABLED!! 931da177e4SLinus Torvalds - 10 or 20 KHz - level 4, used for dma-sound 941da177e4SLinus Torvalds 951da177e4SLinus TorvaldsLinux uses the 200 Hz interrupt for timer and beep by default. 961da177e4SLinus Torvalds 971da177e4SLinus Torvalds 981da177e4SLinus TorvaldsInterrupts 991da177e4SLinus Torvalds========== 1001da177e4SLinus Torvalds 1011da177e4SLinus Torvaldsq40 master chip handles only a subset of level triggered interrupts. 1021da177e4SLinus Torvalds 1031da177e4SLinus TorvaldsLinux has some requirements wrt interrupt architecture, these are 1041da177e4SLinus Torvaldsto my knowledge: 1051da177e4SLinus Torvalds (a) interrupt handler must not be reentered even when sti() is called 1061da177e4SLinus Torvalds from within handler 1071da177e4SLinus Torvalds (b) working enable/disable_irq 1081da177e4SLinus Torvalds 1091da177e4SLinus TorvaldsLuckily these requirements are only important for drivers shared 1101da177e4SLinus Torvaldswith other architectures - ide,serial,parallel, ethernet. 1111da177e4SLinus Torvaldsq40ints.c now contains a trivial hack for (a), (b) is more difficult 1121da177e4SLinus Torvaldsbecause only irq's 4-15 can be disabled - and only all of them at once. 1131da177e4SLinus TorvaldsThus disable_irq() can effectively block the machine if the driver goes 1141da177e4SLinus Torvaldsasleep. 1151da177e4SLinus TorvaldsOne thing to keep in mind when hacking around the interrupt code is 1161da177e4SLinus Torvaldsthat there is no way to find out which IRQ caused a request, [EI]IRQ_REG 1171da177e4SLinus Torvaldsdisplays current state of the various IRQ lines. 1181da177e4SLinus Torvalds 1191da177e4SLinus TorvaldsKeyboard 1201da177e4SLinus Torvalds======== 1211da177e4SLinus Torvalds 1221da177e4SLinus Torvaldsq40 receives AT make/break codes from the keyboard, these are translated to 1231da177e4SLinus Torvaldsthe PC scancodes x86 Linux uses. So by theory every national keyboard should 1241da177e4SLinus Torvaldswork just by loading the appropriate x86 keytable - see any national-HOWTO. 1251da177e4SLinus Torvalds 1261da177e4SLinus TorvaldsUnfortunately the AT->PC translation isn't quite trivial and even worse, my 1271da177e4SLinus Torvaldsdocumentation of it is absolutely minimal - thus some exotic keys may not 1281da177e4SLinus Torvaldsbehave exactly as expected. 1291da177e4SLinus Torvalds 1301da177e4SLinus TorvaldsThere is still hope that it can be fixed completely though. If you encounter 1311da177e4SLinus Torvaldsproblems, email me ideally this: 1321da177e4SLinus Torvalds - exact keypress/release sequence 1331da177e4SLinus Torvalds - 'showkey -s' run on q40, non-X session 1341da177e4SLinus Torvalds - 'showkey -s' run on a PC, non-X session 1351da177e4SLinus Torvalds - AT codes as displayed by the q40 debugging ROM 1361da177e4SLinus Torvaldsbtw if the showkey output from PC and Q40 doesn't differ then you have some 1371da177e4SLinus Torvaldsclassic configuration problem - don't send me anything in this case 1381da177e4SLinus Torvalds 139