aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2016-11-03 14:38:52 -0400
committerVineet Gupta <vgupta@synopsys.com>2016-11-30 14:54:25 -0500
commit2cd690ea6d6b345265f2de8c40e4a003ed802002 (patch)
tree8bdb07ec0fd7a8cc482ea1d5a560443b121c5993
parent6a8b2ca702b279bea0e8f0363056439352e2081c (diff)
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: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/kernel/time.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c
index c10390d1ddb6..8d66bb446209 100644
--- a/arch/arc/kernel/time.c
+++ b/arch/arc/kernel/time.c
@@ -86,26 +86,19 @@ static int noinline arc_get_timer_clk(struct device_node *node)
86static cycle_t arc_read_gfrc(struct clocksource *cs) 86static cycle_t arc_read_gfrc(struct clocksource *cs)
87{ 87{
88 unsigned long flags; 88 unsigned long flags;
89 union { 89 u32 l, h;
90#ifdef CONFIG_CPU_BIG_ENDIAN
91 struct { u32 h, l; };
92#else
93 struct { u32 l, h; };
94#endif
95 cycle_t full;
96 } stamp;
97 90
98 local_irq_save(flags); 91 local_irq_save(flags);
99 92
100 __mcip_cmd(CMD_GFRC_READ_LO, 0); 93 __mcip_cmd(CMD_GFRC_READ_LO, 0);
101 stamp.l = read_aux_reg(ARC_REG_MCIP_READBACK); 94 l = read_aux_reg(ARC_REG_MCIP_READBACK);
102 95
103 __mcip_cmd(CMD_GFRC_READ_HI, 0); 96 __mcip_cmd(CMD_GFRC_READ_HI, 0);
104 stamp.h = read_aux_reg(ARC_REG_MCIP_READBACK); 97 h = read_aux_reg(ARC_REG_MCIP_READBACK);
105 98
106 local_irq_restore(flags); 99 local_irq_restore(flags);
107 100
108 return stamp.full; 101 return (((cycle_t)h) << 32) | l;
109} 102}
110 103
111static struct clocksource arc_counter_gfrc = { 104static struct clocksource arc_counter_gfrc = {
@@ -143,14 +136,7 @@ CLOCKSOURCE_OF_DECLARE(arc_gfrc, "snps,archs-timer-gfrc", arc_cs_setup_gfrc);
143static cycle_t arc_read_rtc(struct clocksource *cs) 136static cycle_t arc_read_rtc(struct clocksource *cs)
144{ 137{
145 unsigned long status; 138 unsigned long status;
146 union { 139 u32 l, h;
147#ifdef CONFIG_CPU_BIG_ENDIAN
148 struct { u32 high, low; };
149#else
150 struct { u32 low, high; };
151#endif
152 cycle_t full;
153 } stamp;
154 140
155 /* 141 /*
156 * hardware has an internal state machine which tracks readout of 142 * hardware has an internal state machine which tracks readout of
@@ -159,12 +145,12 @@ static cycle_t arc_read_rtc(struct clocksource *cs)
159 * - high increments after low has been read 145 * - high increments after low has been read
160 */ 146 */
161 do { 147 do {
162 stamp.low = read_aux_reg(AUX_RTC_LOW); 148 l = read_aux_reg(AUX_RTC_LOW);
163 stamp.high = read_aux_reg(AUX_RTC_HIGH); 149 h = read_aux_reg(AUX_RTC_HIGH);
164 status = read_aux_reg(AUX_RTC_CTRL); 150 status = read_aux_reg(AUX_RTC_CTRL);
165 } while (!(status & _BITUL(31))); 151 } while (!(status & _BITUL(31)));
166 152
167 return stamp.full; 153 return (((cycle_t)h) << 32) | l;
168} 154}
169 155
170static struct clocksource arc_counter_rtc = { 156static struct clocksource arc_counter_rtc = {