1 From 775d903216a08c2a8009863d2f9c33f62657ba94 Mon Sep 17 00:00:00 2001
2 From: Birger Koblitz <git@birger-koblitz.de>
3 Date: Thu, 6 Jan 2022 20:27:01 +0100
4 Subject: [PATCH] realtek: Replace the RTL9300 generic timer with a CEVT timer
6 The RTL9300 has a broken R4K MIPS timer interrupt, however, the
7 R4K clocksource works. We replace the RTL9300 timer with a
8 Clock Event Timer (CEVT), which is VSMP aware and can be instantiated
9 as part of brining a VSMTP cpu up instead of the R4K CEVT source.
10 For this we place the RTL9300 CEVT timer in arch/mips/kernel
11 together with other MIPS CEVT timers, initialize the SoC IRQs
12 from a modified smp-mt.c and instantiate each timer as part
13 of the MIPS time setup in arch/mips/include/asm/time.h instead
14 of the R4K CEVT, similarly as is done by other MIPS CEVT timers.
16 Submitted-by: Birger Koblitz <git@birger-koblitz.de>
18 arch/mips/kernel/Makefile | 1 +
19 arch/mips/include/asm/time.h | 7 +++++++
20 2 files changed, 8 insertions(+)
22 --- a/arch/mips/kernel/Makefile
23 +++ b/arch/mips/kernel/Makefile
24 @@ -27,6 +27,7 @@ obj-$(CONFIG_CEVT_BCM1480) += cevt-bcm14
25 obj-$(CONFIG_CEVT_R4K) += cevt-r4k.o
26 obj-$(CONFIG_CEVT_DS1287) += cevt-ds1287.o
27 obj-$(CONFIG_CEVT_GT641XX) += cevt-gt641xx.o
28 +obj-$(CONFIG_CEVT_RTL9300) += cevt-rtl9300.o
29 obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o
30 obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o
31 obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o
32 --- a/arch/mips/include/asm/time.h
33 +++ b/arch/mips/include/asm/time.h
35 #include <linux/clockchips.h>
36 #include <linux/clocksource.h>
38 +extern void rtl9300_clockevent_init(void);
40 extern spinlock_t rtc_lock;
43 @@ -43,6 +45,11 @@ extern int r4k_clockevent_init(void);
45 static inline int mips_clockevent_init(void)
47 +#ifdef CONFIG_CEVT_RTL9300
48 + rtl9300_clockevent_init();
52 #ifdef CONFIG_CEVT_R4K
53 return r4k_clockevent_init();