summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-07-14 11:32:18 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-07-16 09:46:02 +0200
commit5c7cd570a8921bf86fb0964f864e01feb57fff51 (patch)
treef6d214a5f75c3d0d1db8ac0ff0e344ebfcdf0697 /arch
parent8f25597491f39d8fc85e5ac1ba1f327dfd0d4094 (diff)
downloadbarebox-5c7cd570a8921bf86fb0964f864e01feb57fff51.tar.gz
barebox-5c7cd570a8921bf86fb0964f864e01feb57fff51.tar.xz
ARM: i.MX6: create cpu_is() functions for use in PBL
The current cpu_is_mx6x() functions need the imx6_cpu_type variable which make them unsuitable for PBL. Add a set of cpu_mx6_is_mx6x() functions which can be called from PBL aswell. Unlike the cpu_is_mx6x() functions the cpu_mx6_is_mx6x() functions assume that they are called on i.MX6 only. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-imx/include/mach/imx6.h41
1 files changed, 17 insertions, 24 deletions
diff --git a/arch/arm/mach-imx/include/mach/imx6.h b/arch/arm/mach-imx/include/mach/imx6.h
index 3b7542169e..3ddb6d2d0e 100644
--- a/arch/arm/mach-imx/include/mach/imx6.h
+++ b/arch/arm/mach-imx/include/mach/imx6.h
@@ -48,29 +48,22 @@ static inline int imx6_cpu_type(void)
return __imx6_cpu_type();
}
-static inline int cpu_is_mx6s(void)
-{
- return imx6_cpu_type() == IMX6_CPUTYPE_IMX6S;
-}
-
-static inline int cpu_is_mx6dl(void)
-{
- return imx6_cpu_type() == IMX6_CPUTYPE_IMX6DL;
-}
-
-static inline int cpu_is_mx6d(void)
-{
- return imx6_cpu_type() == IMX6_CPUTYPE_IMX6D;
-}
-
-static inline int cpu_is_mx6q(void)
-{
- return imx6_cpu_type() == IMX6_CPUTYPE_IMX6Q;
-}
-
-static inline int cpu_is_mx6sx(void)
-{
- return imx6_cpu_type() == IMX6_CPUTYPE_IMX6SX;
-}
+#define DEFINE_MX6_CPU_TYPE(str, type) \
+ static inline int cpu_mx6_is_##str(void) \
+ { \
+ return __imx6_cpu_type() == type; \
+ } \
+ \
+ static inline int cpu_is_##str(void) \
+ { \
+ if (!cpu_is_mx6()) \
+ return 0; \
+ return cpu_mx6_is_##str(); \
+ }
+
+DEFINE_MX6_CPU_TYPE(mx6dl, IMX6_CPUTYPE_IMX6DL);
+DEFINE_MX6_CPU_TYPE(mx6q, IMX6_CPUTYPE_IMX6Q);
+DEFINE_MX6_CPU_TYPE(mx6d, IMX6_CPUTYPE_IMX6D);
+DEFINE_MX6_CPU_TYPE(mx6sx, IMX6_CPUTYPE_IMX6SX);
#endif /* __MACH_IMX6_H */