Skip to content

Commit cd53756

Browse files
parakadlezcano
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent dfe101b commit cd53756

File tree

5 files changed

+14
-16
lines changed

5 files changed

+14
-16
lines changed

arch/mips/ralink/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
if RALINK
33

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-
114
config RALINK_ILL_ACC
125
bool
136
depends on SOC_RT305X

arch/mips/ralink/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ ifndef CONFIG_MIPS_GIC
1010
obj-y += clk.o timer.o
1111
endif
1212

13-
obj-$(CONFIG_CLKEVT_RT3352) += cevt-rt3352.o
14-
1513
obj-$(CONFIG_RALINK_ILL_ACC) += ill_acc.o
1614

1715
obj-$(CONFIG_IRQ_INTC) += irq.o

drivers/clocksource/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,4 +754,13 @@ config EP93XX_TIMER
754754
Enables support for the Cirrus Logic timer block
755755
EP93XX.
756756

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+
757766
endmenu

drivers/clocksource/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,3 +91,4 @@ obj-$(CONFIG_GOLDFISH_TIMER) += timer-goldfish.o
9191
obj-$(CONFIG_GXP_TIMER) += timer-gxp.o
9292
obj-$(CONFIG_CLKSRC_LOONGSON1_PWM) += timer-loongson1-pwm.o
9393
obj-$(CONFIG_EP93XX_TIMER) += timer-ep93xx.o
94+
obj-$(CONFIG_RALINK_TIMER) += timer-ralink.o

arch/mips/ralink/cevt-rt3352.c renamed to drivers/clocksource/timer-ralink.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
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.
54
*
65
* Copyright (C) 2013 by John Crispin <[email protected]>
76
*/
@@ -16,8 +15,6 @@
1615
#include <linux/of_irq.h>
1716
#include <linux/of_address.h>
1817

19-
#include <asm/mach-ralink/ralink_regs.h>
20-
2118
#define SYSTICK_FREQ (50 * 1000)
2219

2320
#define SYSTICK_CONFIG 0x00
@@ -40,7 +37,7 @@ static int systick_set_oneshot(struct clock_event_device *evt);
4037
static int systick_shutdown(struct clock_event_device *evt);
4138

4239
static int systick_next_event(unsigned long delta,
43-
struct clock_event_device *evt)
40+
struct clock_event_device *evt)
4441
{
4542
struct systick_device *sdev;
4643
u32 count;
@@ -60,7 +57,7 @@ static void systick_event_handler(struct clock_event_device *dev)
6057

6158
static irqreturn_t systick_interrupt(int irq, void *dev_id)
6259
{
63-
struct clock_event_device *dev = (struct clock_event_device *) dev_id;
60+
struct clock_event_device *dev = (struct clock_event_device *)dev_id;
6461

6562
dev->event_handler(dev);
6663

0 commit comments

Comments
 (0)