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 650a23e6eSJustin 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 33*78b02317SMauro Carvalho Chehab block/floppy.c # normal PC driver, DMA emu in asm/floppy.h 341da177e4SLinus Torvalds # and arch/m68k/kernel/entry.S 351da177e4SLinus Torvalds # see drivers/block/README.fd 36*78b02317SMauro Carvalho Chehab ata/pata_falcon.c 371da177e4SLinus Torvalds net/ne.c 381da177e4SLinus Torvalds video/q40fb.c 391da177e4SLinus Torvalds parport/* 401da177e4SLinus Torvalds sound/dmasound_core.c 411da177e4SLinus Torvalds dmasound_q40.c 421da177e4SLinus Torvalds 431da177e4SLinus TorvaldsVarious other PC drivers can be enabled simply by adding them to 441da177e4SLinus Torvaldsarch/m68k/config.in, especially 8 bit devices should be without any 451da177e4SLinus Torvaldsproblems. For cards using 16bit io/mem more care is required, like 461da177e4SLinus Torvaldschecking byte order issues, hacking memcpy_*_io etc. 471da177e4SLinus Torvalds 481da177e4SLinus Torvalds 491da177e4SLinus TorvaldsDebugging 501da177e4SLinus Torvalds========= 511da177e4SLinus Torvalds 521da177e4SLinus TorvaldsUpon startup the kernel will usually output "ABCQGHIJ" into the SRAM, 531da177e4SLinus Torvaldspreceded by the booter signature. This is a trace just in case something 541da177e4SLinus Torvaldswent wrong during earliest setup stages of head.S. 551da177e4SLinus Torvalds**Changed** to preserve SRAM contents by default, this is only done when 561da177e4SLinus Torvaldsrequested - SRAM must start with '%LX$' signature to do this. '-d' option 571da177e4SLinus Torvaldsto 'lxx' loader enables this. 581da177e4SLinus Torvalds 591da177e4SLinus TorvaldsSRAM can also be used as additional console device, use debug=mem. 601da177e4SLinus TorvaldsThis will save kernel startup msgs into SRAM, the screen will display 611da177e4SLinus Torvaldsonly the penguin - and shell prompt if it gets that far.. 621da177e4SLinus TorvaldsUnfortunately only 2000 bytes are available. 631da177e4SLinus Torvalds 641da177e4SLinus TorvaldsSerial console works and can also be used for debugging, see loader_txt 651da177e4SLinus Torvalds 661da177e4SLinus TorvaldsMost problems seem to be caused by fawlty or badly configured io-cards or 671da177e4SLinus Torvaldshard drives anyway. 681da177e4SLinus TorvaldsMake sure to configure the parallel port as SPP and remove IRQ/DMA jumpers 691da177e4SLinus Torvaldsfor first testing. The Q40 does not support DMA and may have trouble with 701da177e4SLinus Torvaldsparallel ports version of interrupts. 711da177e4SLinus Torvalds 721da177e4SLinus Torvalds 731da177e4SLinus TorvaldsQ40 Hardware Description 741da177e4SLinus Torvalds======================== 751da177e4SLinus Torvalds 761da177e4SLinus TorvaldsThis is just an overview, see asm-m68k/* for details ask if you have any 771da177e4SLinus Torvaldsquestions. 781da177e4SLinus Torvalds 791da177e4SLinus TorvaldsThe Q40 consists of a 68040@40 MHz, 1MB video RAM, up to 32MB RAM, AT-style 801da177e4SLinus Torvaldskeyboard interface, 1 Programmable LED, 2x8bit DACs and up to 1MB ROM, 1MB 811da177e4SLinus Torvaldsshadow ROM. 821da177e4SLinus TorvaldsThe Q60 has any of 68060 or 68LC060 and up to 128 MB RAM. 831da177e4SLinus Torvalds 841da177e4SLinus TorvaldsMost interfacing like floppy, IDE, serial and parallel ports is done via ISA 851da177e4SLinus Torvaldsslots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate 861da177e4SLinus Torvaldsregions of the memory. 871da177e4SLinus TorvaldsThe main interrupt register IIRQ_REG will indicate whether an IRQ was internal 881da177e4SLinus Torvaldsor from some ISA devices, EIRQ_REG can distinguish up to 8 ISA IRQs. 891da177e4SLinus Torvalds 901da177e4SLinus TorvaldsThe Q40 custom chip is programmable to provide 2 periodic timers: 9125985edcSLucas De Marchi - 50 or 200 Hz - level 2, !!THIS CAN'T BE DISABLED!! 921da177e4SLinus Torvalds - 10 or 20 KHz - level 4, used for dma-sound 931da177e4SLinus Torvalds 941da177e4SLinus TorvaldsLinux uses the 200 Hz interrupt for timer and beep by default. 951da177e4SLinus Torvalds 961da177e4SLinus Torvalds 971da177e4SLinus TorvaldsInterrupts 981da177e4SLinus Torvalds========== 991da177e4SLinus Torvalds 1001da177e4SLinus Torvaldsq40 master chip handles only a subset of level triggered interrupts. 1011da177e4SLinus Torvalds 1021da177e4SLinus TorvaldsLinux has some requirements wrt interrupt architecture, these are 1031da177e4SLinus Torvaldsto my knowledge: 1041da177e4SLinus Torvalds (a) interrupt handler must not be reentered even when sti() is called 1051da177e4SLinus Torvalds from within handler 1061da177e4SLinus Torvalds (b) working enable/disable_irq 1071da177e4SLinus Torvalds 1081da177e4SLinus TorvaldsLuckily these requirements are only important for drivers shared 1091da177e4SLinus Torvaldswith other architectures - ide,serial,parallel, ethernet. 1101da177e4SLinus Torvaldsq40ints.c now contains a trivial hack for (a), (b) is more difficult 1111da177e4SLinus Torvaldsbecause only irq's 4-15 can be disabled - and only all of them at once. 1121da177e4SLinus TorvaldsThus disable_irq() can effectively block the machine if the driver goes 1131da177e4SLinus Torvaldsasleep. 1141da177e4SLinus TorvaldsOne thing to keep in mind when hacking around the interrupt code is 1151da177e4SLinus Torvaldsthat there is no way to find out which IRQ caused a request, [EI]IRQ_REG 1161da177e4SLinus Torvaldsdisplays current state of the various IRQ lines. 1171da177e4SLinus Torvalds 1181da177e4SLinus TorvaldsKeyboard 1191da177e4SLinus Torvalds======== 1201da177e4SLinus Torvalds 1211da177e4SLinus Torvaldsq40 receives AT make/break codes from the keyboard, these are translated to 1221da177e4SLinus Torvaldsthe PC scancodes x86 Linux uses. So by theory every national keyboard should 1231da177e4SLinus Torvaldswork just by loading the appropriate x86 keytable - see any national-HOWTO. 1241da177e4SLinus Torvalds 1251da177e4SLinus TorvaldsUnfortunately the AT->PC translation isn't quite trivial and even worse, my 1261da177e4SLinus Torvaldsdocumentation of it is absolutely minimal - thus some exotic keys may not 1271da177e4SLinus Torvaldsbehave exactly as expected. 1281da177e4SLinus Torvalds 1291da177e4SLinus TorvaldsThere is still hope that it can be fixed completely though. If you encounter 1301da177e4SLinus Torvaldsproblems, email me ideally this: 1311da177e4SLinus Torvalds - exact keypress/release sequence 1321da177e4SLinus Torvalds - 'showkey -s' run on q40, non-X session 1331da177e4SLinus Torvalds - 'showkey -s' run on a PC, non-X session 1341da177e4SLinus Torvalds - AT codes as displayed by the q40 debugging ROM 1351da177e4SLinus Torvaldsbtw if the showkey output from PC and Q40 doesn't differ then you have some 1361da177e4SLinus Torvaldsclassic configuration problem - don't send me anything in this case 1371da177e4SLinus Torvalds 138