Skip to content

Commit

Permalink
hexagon: clean up timer-regs.h
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Nathan Chancellor <[email protected]>
Acked-by: Brian Cain <[email protected]>
Cc: Nick Desaulniers <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
nathanchance authored and torvalds committed Nov 20, 2021
1 parent ffb92ce commit 51f2ec5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 30 deletions.
26 changes: 0 additions & 26 deletions arch/hexagon/include/asm/timer-regs.h

This file was deleted.

3 changes: 1 addition & 2 deletions arch/hexagon/include/asm/timex.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
#define _ASM_TIMEX_H

#include <asm-generic/timex.h>
#include <asm/timer-regs.h>
#include <asm/hexagon_vm.h>

/* Using TCX0 as our clock. CLOCK_TICK_RATE scheduled to be removed. */
#define CLOCK_TICK_RATE TCX0_CLK_RATE
#define CLOCK_TICK_RATE 19200

#define ARCH_HAS_READ_CURRENT_TIMER

Expand Down
12 changes: 10 additions & 2 deletions arch/hexagon/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
#include <linux/of_irq.h>
#include <linux/module.h>

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

#define TIMER_ENABLE BIT(0)

/*
* For the clocksource we need:
* pcycle frequency (600MHz)
Expand All @@ -33,6 +34,13 @@ cycles_t pcycle_freq_mhz;
cycles_t thread_freq_mhz;
cycles_t sleep_clk_freq;

/*
* 8x50 HDD Specs 5-8. Simulator co-sim not fixed until
* release 1.1, and then it's "adjustable" and probably not defaulted.
*/
#define RTOS_TIMER_INT 3
#define RTOS_TIMER_REGS_ADDR 0xAB000000UL

static struct resource rtos_timer_resources[] = {
{
.start = RTOS_TIMER_REGS_ADDR,
Expand Down Expand Up @@ -80,7 +88,7 @@ static int set_next_event(unsigned long delta, struct clock_event_device *evt)
iowrite32(0, &rtos_timer->clear);

iowrite32(delta, &rtos_timer->match);
iowrite32(1 << TIMER_ENABLE, &rtos_timer->enable);
iowrite32(TIMER_ENABLE, &rtos_timer->enable);
return 0;
}

Expand Down

0 comments on commit 51f2ec5

Please sign in to comment.