xref: /kernel/linux/linux-6.6/arch/m68k/q40/README (revision 62306a36)
162306a36Sopenharmony_ciLinux for the Q40
262306a36Sopenharmony_ci=================
362306a36Sopenharmony_ci
462306a36Sopenharmony_ciYou may try http://www.geocities.com/SiliconValley/Bay/2602/ for
562306a36Sopenharmony_cisome up to date information. Booter and other tools will be also
662306a36Sopenharmony_ciavailable from this place or http://ftp.uni-erlangen.de/pub/unix/Linux/680x0/q40/
762306a36Sopenharmony_ciand mirrors.
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciHints to documentation usually refer to the linux source tree in
1062306a36Sopenharmony_ci/usr/src/linux/Documentation unless URL given.
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciIt seems IRQ unmasking can't be safely done on a Q40. IRQ probing
1362306a36Sopenharmony_ciis not implemented - do not try it! (See below)
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciFor a list of kernel command-line options read the documentation for the
1662306a36Sopenharmony_ciparticular device drivers.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciThe floppy imposes a very high interrupt load on the CPU, approx 30K/s.
1962306a36Sopenharmony_ciWhen something blocks interrupts (HD) it will lose some of them, so far
2062306a36Sopenharmony_cithis is not known to have caused any data loss. On highly loaded systems
2162306a36Sopenharmony_ciit can make the floppy very slow or practically stop. Other Q40 OS' simply
2262306a36Sopenharmony_cipoll the floppy for this reason - something that can't be done in Linux.
2362306a36Sopenharmony_ciOnly possible cure is getting a 82072 controller with fifo instead of
2462306a36Sopenharmony_cithe 8272A.
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cidrivers used by the Q40, apart from the very obvious (console etc.):
2762306a36Sopenharmony_ci	drivers/char/q40_keyb.c		# use PC keymaps for national keyboards
2862306a36Sopenharmony_ci		     serial.c		# normal PC driver - any speed
2962306a36Sopenharmony_ci	             lp.c		# printer driver
3062306a36Sopenharmony_ci		     genrtc.c		# RTC
3162306a36Sopenharmony_ci		char/joystick/*		# most of this should work, not
3262306a36Sopenharmony_ci				        # in default config.in
3362306a36Sopenharmony_ci	        block/floppy.c		# normal PC driver, DMA emu in asm/floppy.h
3462306a36Sopenharmony_ci					# and arch/m68k/kernel/entry.S
3562306a36Sopenharmony_ci					# see drivers/block/README.fd
3662306a36Sopenharmony_ci		ata/pata_falcon.c
3762306a36Sopenharmony_ci		net/ne.c
3862306a36Sopenharmony_ci		video/q40fb.c
3962306a36Sopenharmony_ci		parport/*
4062306a36Sopenharmony_ci		sound/dmasound_core.c
4162306a36Sopenharmony_ci		      dmasound_q40.c
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciVarious other PC drivers can be enabled simply by adding them to
4462306a36Sopenharmony_ciarch/m68k/config.in, especially 8 bit devices should be without any
4562306a36Sopenharmony_ciproblems. For cards using 16bit io/mem more care is required, like
4662306a36Sopenharmony_cichecking byte order issues, hacking memcpy_*_io etc.
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciDebugging
5062306a36Sopenharmony_ci=========
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ciUpon startup the kernel will usually output "ABCQGHIJ" into the SRAM,
5362306a36Sopenharmony_cipreceded by the booter signature. This is a trace just in case something
5462306a36Sopenharmony_ciwent wrong during earliest setup stages of head.S.
5562306a36Sopenharmony_ci**Changed** to preserve SRAM contents by default, this is only done when
5662306a36Sopenharmony_cirequested - SRAM must start with '%LX$' signature to do this. '-d' option
5762306a36Sopenharmony_cito 'lxx' loader enables this.
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ciSRAM can also be used as additional console device, use debug=mem.
6062306a36Sopenharmony_ciThis will save kernel startup msgs into SRAM, the screen will display
6162306a36Sopenharmony_cionly the penguin - and shell prompt if it gets that far..
6262306a36Sopenharmony_ciUnfortunately only 2000 bytes are available.
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciSerial console works and can also be used for debugging, see loader_txt
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ciMost problems seem to be caused by fawlty or badly configured io-cards or
6762306a36Sopenharmony_cihard drives anyway.
6862306a36Sopenharmony_ciMake sure to configure the parallel port as SPP and remove IRQ/DMA jumpers
6962306a36Sopenharmony_cifor first testing. The Q40 does not support DMA and may have trouble with
7062306a36Sopenharmony_ciparallel ports version of interrupts.
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ciQ40 Hardware Description
7462306a36Sopenharmony_ci========================
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ciThis is just an overview, see asm-m68k/* for details ask if you have any
7762306a36Sopenharmony_ciquestions.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ciThe Q40 consists of a 68040@40 MHz, 1MB video RAM, up to 32MB RAM, AT-style
8062306a36Sopenharmony_cikeyboard interface, 1 Programmable LED, 2x8bit DACs and up to 1MB ROM, 1MB
8162306a36Sopenharmony_cishadow ROM.
8262306a36Sopenharmony_ciThe Q60 has any of 68060 or 68LC060 and up to 128 MB RAM.
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ciMost interfacing like floppy, IDE, serial and parallel ports is done via ISA
8562306a36Sopenharmony_cislots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate
8662306a36Sopenharmony_ciregions of the memory.
8762306a36Sopenharmony_ciThe main interrupt register IIRQ_REG will indicate whether an IRQ was internal
8862306a36Sopenharmony_cior from some ISA devices, EIRQ_REG can distinguish up to 8 ISA IRQs.
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ciThe Q40 custom chip is programmable to provide 2 periodic timers:
9162306a36Sopenharmony_ci	- 50 or 200 Hz - level 2, !!THIS CAN'T BE DISABLED!!
9262306a36Sopenharmony_ci	- 10 or 20 KHz - level 4, used for dma-sound
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ciLinux uses the 200 Hz interrupt for timer and beep by default.
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ciInterrupts
9862306a36Sopenharmony_ci==========
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ciq40 master chip handles only a subset of level triggered interrupts.
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ciLinux has some requirements wrt interrupt architecture, these are
10362306a36Sopenharmony_cito my knowledge:
10462306a36Sopenharmony_ci	(a) interrupt handler must not be reentered even when sti() is called
10562306a36Sopenharmony_ci	    from within handler
10662306a36Sopenharmony_ci	(b) working enable/disable_irq
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ciLuckily these requirements are only important for drivers shared
10962306a36Sopenharmony_ciwith other architectures - ide,serial,parallel, ethernet.
11062306a36Sopenharmony_ciq40ints.c now contains a trivial hack for (a), (b) is more difficult
11162306a36Sopenharmony_cibecause only irq's 4-15 can be disabled - and only all of them at once.
11262306a36Sopenharmony_ciThus disable_irq() can effectively block the machine if the driver goes
11362306a36Sopenharmony_ciasleep.
11462306a36Sopenharmony_ciOne thing to keep in mind when hacking around the interrupt code is
11562306a36Sopenharmony_cithat there is no way to find out which IRQ caused a request, [EI]IRQ_REG
11662306a36Sopenharmony_cidisplays current state of the various IRQ lines.
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ciKeyboard
11962306a36Sopenharmony_ci========
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ciq40 receives AT make/break codes from the keyboard, these are translated to
12262306a36Sopenharmony_cithe PC scancodes x86 Linux uses. So by theory every national keyboard should
12362306a36Sopenharmony_ciwork just by loading the appropriate x86 keytable - see any national-HOWTO.
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ciUnfortunately the AT->PC translation isn't quite trivial and even worse, my
12662306a36Sopenharmony_cidocumentation of it is absolutely minimal - thus some exotic keys may not
12762306a36Sopenharmony_cibehave exactly as expected.
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ciThere is still hope that it can be fixed completely though. If you encounter
13062306a36Sopenharmony_ciproblems, email me ideally this:
13162306a36Sopenharmony_ci	- exact keypress/release sequence
13262306a36Sopenharmony_ci	- 'showkey -s' run on q40, non-X session
13362306a36Sopenharmony_ci	- 'showkey -s' run on a PC, non-X session
13462306a36Sopenharmony_ci	- AT codes as displayed by the q40 debugging ROM
13562306a36Sopenharmony_cibtw if the showkey output from PC and Q40 doesn't differ then you have some
13662306a36Sopenharmony_ciclassic configuration problem - don't send me anything in this case
13762306a36Sopenharmony_ci
138