Commit 942e8911 authored by Christophe Leroy's avatar Christophe Leroy Committed by Michael Ellerman

powerpc/time: Avoid using get_tbl() and get_tbu() internally

get_tbl() is confusing as it returns the content of TBL register
on PPC32 but the concatenation of TBL and TBU on PPC64.

Use mftb() instead.

Do the same with get_tbu() for consistency allthough it's name
is less confusing.
Signed-off-by: default avatarChristophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/41573406a4eab98838decaa91649086fef1e6119.1601556145.git.christophe.leroy@csgroup.eu
parent ff125fbc
...@@ -54,7 +54,7 @@ extern void udelay(unsigned long usecs); ...@@ -54,7 +54,7 @@ extern void udelay(unsigned long usecs);
({ \ ({ \
typeof(condition) __ret; \ typeof(condition) __ret; \
unsigned long __loops = tb_ticks_per_usec * timeout; \ unsigned long __loops = tb_ticks_per_usec * timeout; \
unsigned long __start = get_tbl(); \ unsigned long __start = mftb(); \
\ \
if (delay) { \ if (delay) { \
while (!(__ret = (condition)) && \ while (!(__ret = (condition)) && \
......
...@@ -76,9 +76,9 @@ static inline u64 get_tb(void) ...@@ -76,9 +76,9 @@ static inline u64 get_tb(void)
unsigned int tbhi, tblo, tbhi2; unsigned int tbhi, tblo, tbhi2;
do { do {
tbhi = get_tbu(); tbhi = mftbu();
tblo = get_tbl(); tblo = mftb();
tbhi2 = get_tbu(); tbhi2 = mftbu();
} while (tbhi != tbhi2); } while (tbhi != tbhi2);
return ((u64)tbhi << 32) | tblo; return ((u64)tbhi << 32) | tblo;
...@@ -123,7 +123,7 @@ static inline void set_dec(u64 val) ...@@ -123,7 +123,7 @@ static inline void set_dec(u64 val)
static inline unsigned long tb_ticks_since(unsigned long tstamp) static inline unsigned long tb_ticks_since(unsigned long tstamp)
{ {
return get_tbl() - tstamp; return mftb() - tstamp;
} }
#define mulhwu(x,y) \ #define mulhwu(x,y) \
......
...@@ -448,8 +448,8 @@ void __delay(unsigned long loops) ...@@ -448,8 +448,8 @@ void __delay(unsigned long loops)
*/ */
spin_cpu_relax(); spin_cpu_relax();
} else { } else {
start = get_tbl(); start = mftb();
while (get_tbl() - start < loops) while (mftb() - start < loops)
spin_cpu_relax(); spin_cpu_relax();
} }
spin_end(); spin_end();
......
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