Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) Linux for the Q40
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) =================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) You may try http://www.geocities.com/SiliconValley/Bay/2602/ for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) some up to date information. Booter and other tools will be also
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) available from this place or http://ftp.uni-erlangen.de/pub/unix/Linux/680x0/q40/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) and mirrors.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) Hints to documentation usually refer to the linux source tree in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) /usr/src/linux/Documentation unless URL given.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) It seems IRQ unmasking can't be safely done on a Q40. IRQ probing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) is not implemented - do not try it! (See below)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) For a list of kernel command-line options read the documentation for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) particular device drivers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) The floppy imposes a very high interrupt load on the CPU, approx 30K/s.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) When something blocks interrupts (HD) it will lose some of them, so far
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) this is not known to have caused any data loss. On highly loaded systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) it can make the floppy very slow or practically stop. Other Q40 OS' simply
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) poll the floppy for this reason - something that can't be done in Linux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) Only possible cure is getting a 82072 controller with fifo instead of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) the 8272A.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) drivers used by the Q40, apart from the very obvious (console etc.):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	drivers/char/q40_keyb.c		# use PC keymaps for national keyboards
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 		     serial.c		# normal PC driver - any speed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	             lp.c		# printer driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 		     genrtc.c		# RTC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 		char/joystick/*		# most of this should work, not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 				        # in default config.in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	        block/q40ide.c		# startup for ide
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 		      ide*		# see Documentation/ide/ide.rst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		      floppy.c		# normal PC driver, DMA emu in asm/floppy.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 					# and arch/m68k/kernel/entry.S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 					# see drivers/block/README.fd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 		net/ne.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		video/q40fb.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		parport/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		sound/dmasound_core.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		      dmasound_q40.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) Various other PC drivers can be enabled simply by adding them to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) arch/m68k/config.in, especially 8 bit devices should be without any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) problems. For cards using 16bit io/mem more care is required, like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) checking byte order issues, hacking memcpy_*_io etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) Debugging
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) =========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) Upon startup the kernel will usually output "ABCQGHIJ" into the SRAM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) preceded by the booter signature. This is a trace just in case something
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) went wrong during earliest setup stages of head.S.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) **Changed** to preserve SRAM contents by default, this is only done when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) requested - SRAM must start with '%LX$' signature to do this. '-d' option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) to 'lxx' loader enables this.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) SRAM can also be used as additional console device, use debug=mem.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) This will save kernel startup msgs into SRAM, the screen will display
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) only the penguin - and shell prompt if it gets that far..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) Unfortunately only 2000 bytes are available.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) Serial console works and can also be used for debugging, see loader_txt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) Most problems seem to be caused by fawlty or badly configured io-cards or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) hard drives anyway.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) Make sure to configure the parallel port as SPP and remove IRQ/DMA jumpers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) for first testing. The Q40 does not support DMA and may have trouble with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) parallel ports version of interrupts.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) Q40 Hardware Description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) ========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) This is just an overview, see asm-m68k/* for details ask if you have any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) questions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) The Q40 consists of a 68040@40 MHz, 1MB video RAM, up to 32MB RAM, AT-style
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) keyboard interface, 1 Programmable LED, 2x8bit DACs and up to 1MB ROM, 1MB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) shadow ROM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) The Q60 has any of 68060 or 68LC060 and up to 128 MB RAM.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) Most interfacing like floppy, IDE, serial and parallel ports is done via ISA
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) slots. The ISA io and mem range is mapped (sparse&byteswapped!) into separate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) regions of the memory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) The main interrupt register IIRQ_REG will indicate whether an IRQ was internal
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) or from some ISA devices, EIRQ_REG can distinguish up to 8 ISA IRQs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) The Q40 custom chip is programmable to provide 2 periodic timers:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	- 50 or 200 Hz - level 2, !!THIS CAN'T BE DISABLED!!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	- 10 or 20 KHz - level 4, used for dma-sound
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) Linux uses the 200 Hz interrupt for timer and beep by default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) Interrupts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) ==========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) q40 master chip handles only a subset of level triggered interrupts.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) Linux has some requirements wrt interrupt architecture, these are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) to my knowledge:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	(a) interrupt handler must not be reentered even when sti() is called
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	    from within handler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	(b) working enable/disable_irq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) Luckily these requirements are only important for drivers shared
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) with other architectures - ide,serial,parallel, ethernet.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) q40ints.c now contains a trivial hack for (a), (b) is more difficult
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) because only irq's 4-15 can be disabled - and only all of them at once.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) Thus disable_irq() can effectively block the machine if the driver goes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) asleep.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) One thing to keep in mind when hacking around the interrupt code is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) that there is no way to find out which IRQ caused a request, [EI]IRQ_REG
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) displays current state of the various IRQ lines.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) Keyboard
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) ========
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) q40 receives AT make/break codes from the keyboard, these are translated to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) the PC scancodes x86 Linux uses. So by theory every national keyboard should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) work just by loading the appropriate x86 keytable - see any national-HOWTO.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) Unfortunately the AT->PC translation isn't quite trivial and even worse, my
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) documentation of it is absolutely minimal - thus some exotic keys may not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) behave exactly as expected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) There is still hope that it can be fixed completely though. If you encounter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) problems, email me ideally this:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	- exact keypress/release sequence
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	- 'showkey -s' run on q40, non-X session
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	- 'showkey -s' run on a PC, non-X session
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	- AT codes as displayed by the q40 debugging ROM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) btw if the showkey output from PC and Q40 doesn't differ then you have some
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) classic configuration problem - don't send me anything in this case
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)