linux/arch/mips
Maciej W. Rozycki daed1285c3 MIPS: DECstation HRT initialization rearrangement
Not all I/O ASIC versions have the free-running counter implemented, an
early revision used in the 5000/1xx models aka 3MIN and 4MIN did not have
it.  Therefore we cannot unconditionally use it as a clock source.
Fortunately if not implemented its register slot has a fixed value so it
is enough if we check for the value at the end of the calibration period
being the same as at the beginning.

This also means we need to look for another high-precision clock source on
the systems affected.  The 5000/1xx can have an R4000SC processor
installed where the CP0 Count register can be used as a clock source.
Unfortunately all the R4k DECstations suffer from the missed timer
interrupt on CP0 Count reads erratum, so we cannot use the CP0 timer as a
clock source and a clock event both at a time.  However we never need an
R4k clock event device because all DECstations have a DS1287A RTC chip
whose periodic interrupt can be used as a clock source.

This gives us the following four configuration possibilities for I/O ASIC
DECstations:

1. No I/O ASIC counter and no CP0 timer, e.g. R3k 5000/1xx (3MIN).

2. No I/O ASIC counter but the CP0 timer, i.e. R4k 5000/150 (4MIN).

3. The I/O ASIC counter but no CP0 timer, e.g. R3k 5000/240 (3MAX+).

4. The I/O ASIC counter and the CP0 timer, e.g. R4k 5000/260 (4MAX+).

For #1 and #2 this change stops the I/O ASIC free-running counter from
being installed as a clock source of a 0Hz frequency.  For #2 it also
arranges for the CP0 timer to be used as a clock source rather than a
clock event device, because having an accurate wall clock is more
important than a high-precision interval timer.  For #3 there is no
change.  For #4 the change makes the I/O ASIC free-running counter
installed as a clock source so that the CP0 timer can be used as a clock
event device.

Unfortunately the use of the CP0 timer as a clock event device relies on a
succesful completion of c0_compare_interrupt.  That never happens, because
while waiting for a CP0 Compare interrupt to happen the function spins in
a loop reading the CP0 Count register.  This makes the CP0 Count erratum
trigger reliably causing the interrupt waited for to be lost in all cases.
As a result #4 resorts to using the CP0 timer as a clock source as well,
just as #2.  However we want to keep this separate arrangement in case
(hope) c0_compare_interrupt is eventually rewritten such that it avoids
the erratum.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5825/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2013-09-13 11:56:13 +02:00
..
alchemy MIPS: Idle: Consolidate all declarations in <asm/idle.h>. 2013-05-22 01:34:27 +02:00
ar7 MIPS: FW: Remove obsolete header file for MTI platforms. 2013-05-08 12:30:10 +02:00
ath79 MIPS: ath79: Switch to the clkdev framework 2013-09-03 23:22:18 +02:00
bcm47xx MIPS: Set default CPU type for BCM47XX platforms 2013-07-30 18:48:50 +02:00
bcm63xx MIPS: BCM63XX: export PSI size from nvram 2013-08-05 18:58:55 +01:00
boot MIPS: Add uImage build target 2013-09-03 18:00:01 +02:00
cavium-octeon MIPS: Move declaration of Octeon function fixup_irqs() to header. 2013-09-03 18:19:28 +02:00
cobalt MIPS: Idle: Consolidate all declarations in <asm/idle.h>. 2013-05-22 01:34:27 +02:00
configs MIPS: Lantiq: Add defconfig for xway SoC 2013-09-03 23:22:16 +02:00
dec MIPS: DECstation HRT initialization rearrangement 2013-09-13 11:56:13 +02:00
emma MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
fw MIPS: sibyte: Declare the cfe_write() buffer as constant 2013-06-21 18:07:02 +02:00
include MIPS: DECstation HRT initialization rearrangement 2013-09-13 11:56:13 +02:00
jazz Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-03-02 07:44:16 -08:00
jz4740 MIPS: jz4740: Correct clock gate bit for DMA controller 2013-07-05 11:40:53 +05:30
kernel MIPS: DECstation HRT initialization rearrangement 2013-09-13 11:56:13 +02:00
kvm Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2013-09-04 18:15:06 -07:00
lantiq MIPS: Lantiq: Falcon: fix asc clock definition 2013-09-03 23:22:16 +02:00
lasat MIPS: Refactor load/entry address calculations 2013-09-03 17:58:37 +02:00
lib MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
loongson MIPS: Loongson: Hide the pci code behind CONFIG_PCI 2013-09-03 15:27:39 +02:00
loongson1 MIPS: Idle: Consolidate all declarations in <asm/idle.h>. 2013-05-22 01:34:27 +02:00
math-emu MIPS: Remove unreachable break statements from cp1emu.c 2013-08-26 15:33:40 +02:00
mm Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-09-12 16:14:49 -07:00
mti-malta MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
mti-sead3 MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
netlogic MIPS: Netlogic: Built-in DTB for XLP2xx SoC boards 2013-09-03 23:22:20 +02:00
oprofile oprofilefs_create_...() do not need superblock argument 2013-09-03 22:52:48 -04:00
pci Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-09-12 16:14:49 -07:00
pmcs-msp71xx MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
pnx833x MIPS: PNX833x: PNX8335_PCI_ETHERNET_INT depends on CONFIG_SOC_PNX8335 2013-08-05 13:34:22 +02:00
power MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
powertv MIPS: powertv: Drop BOOTLOADER_DRIVER Kconfig symbol 2013-09-03 16:48:37 +02:00
ralink MIPS: Add driver for the built-in PCI controller of the RT3883 SoC 2013-09-04 19:17:21 +02:00
rb532 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sgi-ip22 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sgi-ip27 MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
sgi-ip32 MIPS: Whitespace cleanup. 2013-02-01 10:00:22 +01:00
sibyte MIPS: Delete __cpuinit/__CPUINIT usage from MIPS code 2013-07-14 19:36:51 -04:00
sni serial: sccnxp: Using CLK API for getting UART clock 2013-07-31 18:08:01 -07:00
txx9 MIPS: TXx9: Fix build error if CONFIG_TOSHIBA_JMR3927 is not selected 2013-09-03 15:30:50 +02:00
vr41xx MIPS: Idle: Consolidate all declarations in <asm/idle.h>. 2013-05-22 01:34:27 +02:00
Kbuild KVM/MIPS32: Infrastructure/build files. 2013-05-08 03:55:34 +02:00
Kbuild.platforms MIPS: Delete Wind River ppmc eval board support. 2013-07-01 15:10:53 +02:00
Kconfig Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2013-09-12 16:14:49 -07:00
Kconfig.debug consolidate per-arch stack overflow debugging options 2013-07-04 11:25:39 -07:00
Makefile MIPS: Add uImage build target 2013-09-03 18:00:01 +02:00