Commit 2cd690ea authored by Vineet Gupta's avatar Vineet Gupta

ARC: timer: gfrc, rtc: deuglify big endian code

A standard "C" shift will be handled appropriately by the compiler
depending on the endian for the build. So we don't need the
explicit distinction in code
Signed-off-by: default avatarVineet Gupta <vgupta@synopsys.com>
parent 6a8b2ca7
...@@ -86,26 +86,19 @@ static int noinline arc_get_timer_clk(struct device_node *node) ...@@ -86,26 +86,19 @@ static int noinline arc_get_timer_clk(struct device_node *node)
static cycle_t arc_read_gfrc(struct clocksource *cs) static cycle_t arc_read_gfrc(struct clocksource *cs)
{ {
unsigned long flags; unsigned long flags;
union { u32 l, h;
#ifdef CONFIG_CPU_BIG_ENDIAN
struct { u32 h, l; };
#else
struct { u32 l, h; };
#endif
cycle_t full;
} stamp;
local_irq_save(flags); local_irq_save(flags);
__mcip_cmd(CMD_GFRC_READ_LO, 0); __mcip_cmd(CMD_GFRC_READ_LO, 0);
stamp.l = read_aux_reg(ARC_REG_MCIP_READBACK); l = read_aux_reg(ARC_REG_MCIP_READBACK);
__mcip_cmd(CMD_GFRC_READ_HI, 0); __mcip_cmd(CMD_GFRC_READ_HI, 0);
stamp.h = read_aux_reg(ARC_REG_MCIP_READBACK); h = read_aux_reg(ARC_REG_MCIP_READBACK);
local_irq_restore(flags); local_irq_restore(flags);
return stamp.full; return (((cycle_t)h) << 32) | l;
} }
static struct clocksource arc_counter_gfrc = { static struct clocksource arc_counter_gfrc = {
...@@ -143,14 +136,7 @@ CLOCKSOURCE_OF_DECLARE(arc_gfrc, "snps,archs-timer-gfrc", arc_cs_setup_gfrc); ...@@ -143,14 +136,7 @@ CLOCKSOURCE_OF_DECLARE(arc_gfrc, "snps,archs-timer-gfrc", arc_cs_setup_gfrc);
static cycle_t arc_read_rtc(struct clocksource *cs) static cycle_t arc_read_rtc(struct clocksource *cs)
{ {
unsigned long status; unsigned long status;
union { u32 l, h;
#ifdef CONFIG_CPU_BIG_ENDIAN
struct { u32 high, low; };
#else
struct { u32 low, high; };
#endif
cycle_t full;
} stamp;
/* /*
* hardware has an internal state machine which tracks readout of * hardware has an internal state machine which tracks readout of
...@@ -159,12 +145,12 @@ static cycle_t arc_read_rtc(struct clocksource *cs) ...@@ -159,12 +145,12 @@ static cycle_t arc_read_rtc(struct clocksource *cs)
* - high increments after low has been read * - high increments after low has been read
*/ */
do { do {
stamp.low = read_aux_reg(AUX_RTC_LOW); l = read_aux_reg(AUX_RTC_LOW);
stamp.high = read_aux_reg(AUX_RTC_HIGH); h = read_aux_reg(AUX_RTC_HIGH);
status = read_aux_reg(AUX_RTC_CTRL); status = read_aux_reg(AUX_RTC_CTRL);
} while (!(status & _BITUL(31))); } while (!(status & _BITUL(31)));
return stamp.full; return (((cycle_t)h) << 32) | l;
} }
static struct clocksource arc_counter_rtc = { static struct clocksource arc_counter_rtc = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment