]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
clocksource/drivers/ralink: Add Ralink System Tick Counter driver
authorSergio Paracuellos <sergio.paracuellos@gmail.com>
Mon, 28 Oct 2024 20:36:43 +0000 (21:36 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 13 Nov 2024 12:49:33 +0000 (13:49 +0100)
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>
arch/mips/ralink/Kconfig
arch/mips/ralink/Makefile
drivers/clocksource/Kconfig
drivers/clocksource/Makefile
drivers/clocksource/timer-ralink.c [moved from arch/mips/ralink/cevt-rt3352.c with 91% similarity]

index 08c012a2591f9dcbec225e0bda8e154ef3356cda..910d059ec70b770f766f1b78c3e0eb01b53cf91f 100644 (file)
@@ -1,13 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 if RALINK
 
-config CLKEVT_RT3352
-       bool
-       depends on SOC_RT305X || SOC_MT7620
-       default y
-       select TIMER_OF
-       select CLKSRC_MMIO
-
 config RALINK_ILL_ACC
        bool
        depends on SOC_RT305X
index 26fabbdea1f1e3ed462c1c562d0f64b1e0a890b5..0c109eae195359ee26e27944cd3c90587d92bbb9 100644 (file)
@@ -10,8 +10,6 @@ ifndef CONFIG_MIPS_GIC
        obj-y += clk.o timer.o
 endif
 
-obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o
-
 obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o
 
 obj-$(CONFIG_IRQ_INTC) += irq.o
index d546903dba4f3af3d92a1b8f17323ae4954135fa..487c8525996724fbf9c6e9726dabb478d86513b9 100644 (file)
@@ -754,4 +754,13 @@ config EP93XX_TIMER
          Enables support for the Cirrus Logic timer block
          EP93XX.
 
+config RALINK_TIMER
+       bool "Ralink System Tick Counter"
+       depends on SOC_RT305X || SOC_MT7620 || COMPILE_TEST
+       select CLKSRC_MMIO
+       select TIMER_OF
+       help
+         Enables support for system tick counter present on
+         Ralink SoCs RT3352 and MT7620.
+
 endmenu
index 22743785299eda59189f256d71451be0977ad862..43ef16a4efa6a33bf69ca05a8d66d682826841c9 100644 (file)
@@ -91,3 +91,4 @@ obj-$(CONFIG_GOLDFISH_TIMER)          += timer-goldfish.o
 obj-$(CONFIG_GXP_TIMER)                        += timer-gxp.o
 obj-$(CONFIG_CLKSRC_LOONGSON1_PWM)     += timer-loongson1-pwm.o
 obj-$(CONFIG_EP93XX_TIMER)             += timer-ep93xx.o
+obj-$(CONFIG_RALINK_TIMER)             += timer-ralink.o
similarity index 91%
rename from arch/mips/ralink/cevt-rt3352.c
rename to drivers/clocksource/timer-ralink.c
index 269d4877d120e8e9249a75fd0a5c3e94858acfe7..6ecdb4228f7637662fdaf5362991aa80f7cb867c 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
+ * Ralink System Tick Counter driver present on RT3352 and MT7620 SoCs.
  *
  * Copyright (C) 2013 by John Crispin <john@phrozen.org>
  */
@@ -16,8 +15,6 @@
 #include <linux/of_irq.h>
 #include <linux/of_address.h>
 
-#include <asm/mach-ralink/ralink_regs.h>
-
 #define SYSTICK_FREQ           (50 * 1000)
 
 #define SYSTICK_CONFIG         0x00
@@ -40,7 +37,7 @@ static int systick_set_oneshot(struct clock_event_device *evt);
 static int systick_shutdown(struct clock_event_device *evt);
 
 static int systick_next_event(unsigned long delta,
-                               struct clock_event_device *evt)
+                             struct clock_event_device *evt)
 {
        struct systick_device *sdev;
        u32 count;
@@ -60,7 +57,7 @@ static void systick_event_handler(struct clock_event_device *dev)
 
 static irqreturn_t systick_interrupt(int irq, void *dev_id)
 {
-       struct clock_event_device *dev = (struct clock_event_device *) dev_id;
+       struct clock_event_device *dev = (struct clock_event_device *)dev_id;
 
        dev->event_handler(dev);