summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-09-26 20:29:49 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2011-09-27 09:44:54 +0200
commitbbbfb9f4f8a4951137ccd8495b97dfee927e7d80 (patch)
treef376e3387c346ed19eb03bd418ebd11eb5f2c0b3
parent9ff0bf82adea1a3c407bdd42e07d7aed53dd0287 (diff)
downloadbarebox-bbbfb9f4f8a4951137ccd8495b97dfee927e7d80.tar.gz
barebox-bbbfb9f4f8a4951137ccd8495b97dfee927e7d80.tar.xz
ppc: add a get_pc() function
Useful to determine whether sdram has to be setup or not. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/ppc/include/asm/common.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/ppc/include/asm/common.h b/arch/ppc/include/asm/common.h
index 96de5c6568..26876c748b 100644
--- a/arch/ppc/include/asm/common.h
+++ b/arch/ppc/include/asm/common.h
@@ -21,4 +21,21 @@ void trap_init (ulong);
int cpu_init_board_data(bd_t *bd);
int init_board_data(bd_t *bd);
+static inline unsigned long get_pc(void)
+{
+ unsigned long pc;
+
+ __asm__ __volatile__(
+ " mflr 0\n"
+ " bl 1f\n"
+ "1:\n"
+ " mflr %0\n"
+ " mtlr 0\n"
+ : "=r" (pc)
+ :
+ : "0", "memory");
+
+ return pc;
+}
+
#endif /* __ASM_COMMON_H */