Skip to content

Commit 51f2ec5

Browse files
nathanchancetorvalds
authored andcommitted
hexagon: clean up timer-regs.h
When building allmodconfig, there is a warning about TIMER_ENABLE being redefined: drivers/clocksource/timer-oxnas-rps.c:39:9: error: 'TIMER_ENABLE' macro redefined [-Werror,-Wmacro-redefined] #define TIMER_ENABLE BIT(7) ^ arch/hexagon/include/asm/timer-regs.h:13:9: note: previous definition is here #define TIMER_ENABLE 0 ^ 1 error generated. The values in this header are only used in one file each, if they are used at all. Remove the header and sink all of the constants into their respective files. TCX0_CLK_RATE is only used in arch/hexagon/include/asm/timex.h TIMER_ENABLE, RTOS_TIMER_INT, RTOS_TIMER_REGS_ADDR are only used in arch/hexagon/kernel/time.c. SLEEP_CLK_RATE and TIMER_CLR_ON_MATCH have both been unused since the file's introduction in commit 71e4a47 ("Hexagon: Add time and timer functions"). TIMER_ENABLE is redefined as BIT(0) so the shift is moved into the definition, rather than its use. Link: https://lkml.kernel.org/r/20211115174250.1994179-3-nathan@kernel.org Signed-off-by: Nathan Chancellor <nathan@kernel.org> Acked-by: Brian Cain <bcain@codeaurora.org> Cc: Nick Desaulniers <ndesaulniers@google.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent ffb92ce commit 51f2ec5

3 files changed

Lines changed: 11 additions & 30 deletions

File tree

arch/hexagon/include/asm/timer-regs.h

Lines changed: 0 additions & 26 deletions
This file was deleted.

arch/hexagon/include/asm/timex.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
#define _ASM_TIMEX_H
88

99
#include <asm-generic/timex.h>
10-
#include <asm/timer-regs.h>
1110
#include <asm/hexagon_vm.h>
1211

1312
/* Using TCX0 as our clock. CLOCK_TICK_RATE scheduled to be removed. */
14-
#define CLOCK_TICK_RATE TCX0_CLK_RATE
13+
#define CLOCK_TICK_RATE 19200
1514

1615
#define ARCH_HAS_READ_CURRENT_TIMER
1716

arch/hexagon/kernel/time.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
#include <linux/of_irq.h>
1818
#include <linux/module.h>
1919

20-
#include <asm/timer-regs.h>
2120
#include <asm/hexagon_vm.h>
2221

22+
#define TIMER_ENABLE BIT(0)
23+
2324
/*
2425
* For the clocksource we need:
2526
* pcycle frequency (600MHz)
@@ -33,6 +34,13 @@ cycles_t pcycle_freq_mhz;
3334
cycles_t thread_freq_mhz;
3435
cycles_t sleep_clk_freq;
3536

37+
/*
38+
* 8x50 HDD Specs 5-8. Simulator co-sim not fixed until
39+
* release 1.1, and then it's "adjustable" and probably not defaulted.
40+
*/
41+
#define RTOS_TIMER_INT 3
42+
#define RTOS_TIMER_REGS_ADDR 0xAB000000UL
43+
3644
static struct resource rtos_timer_resources[] = {
3745
{
3846
.start = RTOS_TIMER_REGS_ADDR,
@@ -80,7 +88,7 @@ static int set_next_event(unsigned long delta, struct clock_event_device *evt)
8088
iowrite32(0, &rtos_timer->clear);
8189

8290
iowrite32(delta, &rtos_timer->match);
83-
iowrite32(1 << TIMER_ENABLE, &rtos_timer->enable);
91+
iowrite32(TIMER_ENABLE, &rtos_timer->enable);
8492
return 0;
8593
}
8694

0 commit comments

Comments
 (0)