xref: /linux/arch/arm/include/asm/smp_scu.h (revision fed3c15531a225d95ec9b0aba4ff01c38de7a1b9)
149613d4dSRussell King #ifndef __ASMARM_ARCH_SCU_H
249613d4dSRussell King #define __ASMARM_ARCH_SCU_H
349613d4dSRussell King 
4292ec42aSRussell King #define SCU_PM_NORMAL	0
5292ec42aSRussell King #define SCU_PM_DORMANT	2
6292ec42aSRussell King #define SCU_PM_POWEROFF	3
7292ec42aSRussell King 
8292ec42aSRussell King #ifndef __ASSEMBLER__
9e9d6b335SHiroshi Doyu 
10*fed3c155SJohan Hovold #include <linux/errno.h>
11e9d6b335SHiroshi Doyu #include <asm/cputype.h>
12e9d6b335SHiroshi Doyu 
13e9d6b335SHiroshi Doyu static inline bool scu_a9_has_base(void)
14e9d6b335SHiroshi Doyu {
15af040ffcSRussell King 	return read_cpuid_part() == ARM_CPU_PART_CORTEX_A9;
16e9d6b335SHiroshi Doyu }
17e9d6b335SHiroshi Doyu 
18e9d6b335SHiroshi Doyu static inline unsigned long scu_a9_get_base(void)
19e9d6b335SHiroshi Doyu {
20e9d6b335SHiroshi Doyu 	unsigned long pa;
21e9d6b335SHiroshi Doyu 
22e9d6b335SHiroshi Doyu 	asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (pa));
23e9d6b335SHiroshi Doyu 
24e9d6b335SHiroshi Doyu 	return pa;
25e9d6b335SHiroshi Doyu }
26e9d6b335SHiroshi Doyu 
272abc75a8SNishanth Menon #ifdef CONFIG_HAVE_ARM_SCU
28a8cbcd92SRussell King unsigned int scu_get_core_count(void __iomem *);
29292ec42aSRussell King int scu_power_mode(void __iomem *, unsigned int);
302abc75a8SNishanth Menon #else
312abc75a8SNishanth Menon static inline unsigned int scu_get_core_count(void __iomem *scu_base)
322abc75a8SNishanth Menon {
332abc75a8SNishanth Menon 	return 0;
342abc75a8SNishanth Menon }
352abc75a8SNishanth Menon static inline int scu_power_mode(void __iomem *scu_base, unsigned int mode)
362abc75a8SNishanth Menon {
372abc75a8SNishanth Menon 	return -EINVAL;
382abc75a8SNishanth Menon }
392abc75a8SNishanth Menon #endif
40eed88123SRob Herring 
412abc75a8SNishanth Menon #if defined(CONFIG_SMP) && defined(CONFIG_HAVE_ARM_SCU)
42eed88123SRob Herring void scu_enable(void __iomem *scu_base);
43eed88123SRob Herring #else
44eed88123SRob Herring static inline void scu_enable(void __iomem *scu_base) {}
45eed88123SRob Herring #endif
46eed88123SRob Herring 
47292ec42aSRussell King #endif
4849613d4dSRussell King 
4949613d4dSRussell King #endif
50