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

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 71e4a47f32f4 ("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>

authored by

Nathan Chancellor and committed by
Linus Torvalds
51f2ec59 ffb92ce8

+11 -30
-26
arch/hexagon/include/asm/timer-regs.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Timer support for Hexagon 4 - * 5 - * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. 6 - */ 7 - 8 - #ifndef _ASM_TIMER_REGS_H 9 - #define _ASM_TIMER_REGS_H 10 - 11 - /* This stuff should go into a platform specific file */ 12 - #define TCX0_CLK_RATE 19200 13 - #define TIMER_ENABLE 0 14 - #define TIMER_CLR_ON_MATCH 1 15 - 16 - /* 17 - * 8x50 HDD Specs 5-8. Simulator co-sim not fixed until 18 - * release 1.1, and then it's "adjustable" and probably not defaulted. 19 - */ 20 - #define RTOS_TIMER_INT 3 21 - #ifdef CONFIG_HEXAGON_COMET 22 - #define RTOS_TIMER_REGS_ADDR 0xAB000000UL 23 - #endif 24 - #define SLEEP_CLK_RATE 32000 25 - 26 - #endif
+1 -2
arch/hexagon/include/asm/timex.h
··· 7 7 #define _ASM_TIMEX_H 8 8 9 9 #include <asm-generic/timex.h> 10 - #include <asm/timer-regs.h> 11 10 #include <asm/hexagon_vm.h> 12 11 13 12 /* 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 15 14 16 15 #define ARCH_HAS_READ_CURRENT_TIMER 17 16
+10 -2
arch/hexagon/kernel/time.c
··· 17 17 #include <linux/of_irq.h> 18 18 #include <linux/module.h> 19 19 20 - #include <asm/timer-regs.h> 21 20 #include <asm/hexagon_vm.h> 21 + 22 + #define TIMER_ENABLE BIT(0) 22 23 23 24 /* 24 25 * For the clocksource we need: ··· 33 32 cycles_t pcycle_freq_mhz; 34 33 cycles_t thread_freq_mhz; 35 34 cycles_t sleep_clk_freq; 35 + 36 + /* 37 + * 8x50 HDD Specs 5-8. Simulator co-sim not fixed until 38 + * release 1.1, and then it's "adjustable" and probably not defaulted. 39 + */ 40 + #define RTOS_TIMER_INT 3 41 + #define RTOS_TIMER_REGS_ADDR 0xAB000000UL 36 42 37 43 static struct resource rtos_timer_resources[] = { 38 44 { ··· 88 80 iowrite32(0, &rtos_timer->clear); 89 81 90 82 iowrite32(delta, &rtos_timer->match); 91 - iowrite32(1 << TIMER_ENABLE, &rtos_timer->enable); 83 + iowrite32(TIMER_ENABLE, &rtos_timer->enable); 92 84 return 0; 93 85 } 94 86