Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clocksource/drivers/ralink: Add Ralink System Tick Counter driver

System Tick Counter is present on Ralink SoCs RT3352 and MT7620. This
driver has been in 'arch/mips/ralink' directory since the beggining of
Ralink architecture support. However, it can be moved into a more proper
place in 'drivers/clocksource'. Hence add it here adding also support for
compile test targets and reducing LOC in architecture code folder.

Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Link: https://lore.kernel.org/r/20241028203643.191268-2-sergio.paracuellos@gmail.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Sergio Paracuellos and committed by
Daniel Lezcano
cd537561 dfe101bc

+14 -16
-7
arch/mips/ralink/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 if RALINK 3 3 4 - config CLKEVT_RT3352 5 - bool 6 - depends on SOC_RT305X || SOC_MT7620 7 - default y 8 - select TIMER_OF 9 - select CLKSRC_MMIO 10 - 11 4 config RALINK_ILL_ACC 12 5 bool 13 6 depends on SOC_RT305X
-2
arch/mips/ralink/Makefile
··· 10 10 obj-y += clk.o timer.o 11 11 endif 12 12 13 - obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o 14 - 15 13 obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o 16 14 17 15 obj-$(CONFIG_IRQ_INTC) += irq.o
+4 -7
arch/mips/ralink/cevt-rt3352.c drivers/clocksource/timer-ralink.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 - * This file is subject to the terms and conditions of the GNU General Public 3 - * License. See the file "COPYING" in the main directory of this archive 4 - * for more details. 3 + * Ralink System Tick Counter driver present on RT3352 and MT7620 SoCs. 5 4 * 6 5 * Copyright (C) 2013 by John Crispin <john@phrozen.org> 7 6 */ ··· 14 15 #include <linux/of.h> 15 16 #include <linux/of_irq.h> 16 17 #include <linux/of_address.h> 17 - 18 - #include <asm/mach-ralink/ralink_regs.h> 19 18 20 19 #define SYSTICK_FREQ (50 * 1000) 21 20 ··· 37 40 static int systick_shutdown(struct clock_event_device *evt); 38 41 39 42 static int systick_next_event(unsigned long delta, 40 - struct clock_event_device *evt) 43 + struct clock_event_device *evt) 41 44 { 42 45 struct systick_device *sdev; 43 46 u32 count; ··· 57 60 58 61 static irqreturn_t systick_interrupt(int irq, void *dev_id) 59 62 { 60 - struct clock_event_device *dev = (struct clock_event_device *) dev_id; 63 + struct clock_event_device *dev = (struct clock_event_device *)dev_id; 61 64 62 65 dev->event_handler(dev); 63 66
+9
drivers/clocksource/Kconfig
··· 754 754 Enables support for the Cirrus Logic timer block 755 755 EP93XX. 756 756 757 + config RALINK_TIMER 758 + bool "Ralink System Tick Counter" 759 + depends on SOC_RT305X || SOC_MT7620 || COMPILE_TEST 760 + select CLKSRC_MMIO 761 + select TIMER_OF 762 + help 763 + Enables support for system tick counter present on 764 + Ralink SoCs RT3352 and MT7620. 765 + 757 766 endmenu
+1
drivers/clocksource/Makefile
··· 91 91 obj-$(CONFIG_GXP_TIMER) += timer-gxp.o 92 92 obj-$(CONFIG_CLKSRC_LOONGSON1_PWM) += timer-loongson1-pwm.o 93 93 obj-$(CONFIG_EP93XX_TIMER) += timer-ep93xx.o 94 + obj-$(CONFIG_RALINK_TIMER) += timer-ralink.o