Linux for the Q40
=================

You may try http://www.geocities.com/SiliconValley/Bay/2602/ for
some up to date information. Booter and other tools will be also
available from this place and ftp.uni-erlangen.de/linux/680x0/q40/
and mirrors.

Hints to documentation usually refer to the linux source tree in
/usr/src/linux unless URL given.

It seems IRQ unmasking can't be safely done on a Q40. Autoprobing is 
not yet implemented - do not try it! (See below)

For a list of kernel commandline options read the documentation for the
particular device drivers.

The floppy imposes a very high interrupt load on the CPU, approx 30K/s.
When something blocks interrupts (HD) it will loose some of them, so far 
this is not known to have caused any data loss. On hihgly loaded systems
it can make the floppy very slow. Other Q40 OS' simply poll the floppy
for this reason - something that can't be done in Linux.
Only possible cure is getting a 82072 contoler with fifo instead of 
the 8272A

drivers used by the Q40, appart from the very obvious (console etc.):
	drivers/char/q40_keyb.c		# use PC keymaps for national keyboards
		     serial.c		# normal PC driver - any speed
	             lp.c		# printer driver
		char/joystick/*		# most of this should work
	        block/q40ide.c		# startup for ide
		      ide*		# see Documentation/ide.txt
		      floppy.c		# normal PC driver, DMA emu in asm/floppy.h
					# and arch/m68k/kernel/entry.S
					# see drivers/block/README.fd
		video/q40fb.c
		misc/parport_pc.c

Various other PC drivers can be enabled simply by adding them to 
arch/m68k/config.in, especially 8 bit devices should be without any
problems. For cards using 16bit io/mem more care is required, like 
checking byteorder issues, hacking memcpy_*_io etc.


Debugging
=========

Upon startup the kernel will usually output "ABCQGHIJ" into the SRAM, 
preceded by the booter signature. This is a trace just in case something 
went wrong during earliest setup stages. 
*Changed* to preserve SRAM contents by default, this is only done when 
requested - SRAM must start with '%LX$' signature to do this. '-d' option 
to 'lxx' loader enables this.

SRAM can also be used as additional console device, use debug=mem.
This will save kernel startup msgs into SRAM, the screen will display 
only the penguin - and shell prompt if it gets that far..

Serial console works and can also be used for debugging, provided serial
initialisation works.

Most problems seem to be caused by fawlty or badly configured io-cards or 
harddrives anyway..there are so many things that can go wrong here.
Make sure to configure the parallel port as SPP for first testing..the
Q40 may have trouble with parallel interrupts.


Q40 Hardware Description
========================

This is just an overview, see asm-m68k/* for details ask if you have any 
questions.

The Q40 consists of a 68040@40 MHz, 1MB video RAM, up to 32MB RAM, AT-style
keyboard interface, 1 Programmable LED, 2 8bit DACs and up to 1MB ROM, 1MB
shadow ROM.

Most interfacing like floppy, hd, serial, parallel ports is done via ISA 
slots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate 
regions of the memory.
The main interrupt register IIRQ_REG will indicate whether an IRQ was internal 
or from some ISA devices, EIRQ_REG can distinguish up to 8 ISA IRQs.

The Q40 custom chip is programmable to provide 2 periodic timers:
	- 50 or 200 Hz - level 2,  !!THIS CANT BE DISABLED!!
	- 10 or 20 KHz - level 4 (and possibly 6 - hardware decoding..)

Linux uses the 200 Hz interrupt for timer and beep by default.


Interrupts
==========

q40 master chip handles only level triggered interrupts :-((
further limitation is no disabling etc. Unless someone finds 
some ingenious clue this means autoprobing will never work.
Parallel port interrupts cause most trouble..

IRQ sharing is not yet implemented.


Keyboard
========

q40 receives AT make/break codes from the keyboard, these are translated to
the PC scancodes x86 Linux uses. So by theory every national keyboard should
work just by loading the apropriate x86 keytable - see any national-HOWTO.

Unfortunately the AT->PC translation isn't quite trivial and even worse, my 
documentation of it is absolutely minimal - thus some exotic keys may not 
behave exactly as expected.

There is still hope that it can be fixed completely though. If you encounter 
problems, email me idealy this:
	- exact keypress/release sequence
	- 'showkey -s' run on q40, non-X session
	- 'showkey -s' run on a PC, non-X session
	- AT codes as displayed by the q40 debuging ROM
btw if the showkey output from PC and Q40 doesn't differ then you have some
classic configuration problem - don't send me anything in this case

