xref: /linux/arch/arm/mach-imx/mxc.h (revision 4b4193256c8d3bc3a5397b5cd9494c2ad386317d)
116216333SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
250f2de61SShawn Guo /*
35739b919SAnson Huang  * Copyright 2004-2007, 2010-2015 Freescale Semiconductor, Inc.
450f2de61SShawn Guo  * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
550f2de61SShawn Guo  */
650f2de61SShawn Guo 
750f2de61SShawn Guo #ifndef __ASM_ARCH_MXC_H__
850f2de61SShawn Guo #define __ASM_ARCH_MXC_H__
950f2de61SShawn Guo 
1050f2de61SShawn Guo #include <linux/types.h>
11*f72130c6SPeng Fan #include <soc/imx/cpu.h>
1250f2de61SShawn Guo 
1350f2de61SShawn Guo #ifndef __ASM_ARCH_MXC_HARDWARE_H__
1450f2de61SShawn Guo #error "Do not include directly."
1550f2de61SShawn Guo #endif
1650f2de61SShawn Guo 
17ec336b28SAnson Huang #define IMX_DDR_TYPE_LPDDR2		1
18ec336b28SAnson Huang 
1950f2de61SShawn Guo #ifndef __ASSEMBLY__
2050f2de61SShawn Guo 
21a82eb09fSArnd Bergmann #ifdef CONFIG_SOC_IMX6SL
cpu_is_imx6sl(void)229ba64fe3SShawn Guo static inline bool cpu_is_imx6sl(void)
239ba64fe3SShawn Guo {
249ba64fe3SShawn Guo 	return __mxc_cpu_type == MXC_CPU_IMX6SL;
259ba64fe3SShawn Guo }
26a82eb09fSArnd Bergmann #else
cpu_is_imx6sl(void)27a82eb09fSArnd Bergmann static inline bool cpu_is_imx6sl(void)
28a82eb09fSArnd Bergmann {
29a82eb09fSArnd Bergmann 	return false;
30a82eb09fSArnd Bergmann }
31a82eb09fSArnd Bergmann #endif
329ba64fe3SShawn Guo 
cpu_is_imx6dl(void)333c03a2feSShawn Guo static inline bool cpu_is_imx6dl(void)
343c03a2feSShawn Guo {
353c03a2feSShawn Guo 	return __mxc_cpu_type == MXC_CPU_IMX6DL;
363c03a2feSShawn Guo }
373c03a2feSShawn Guo 
cpu_is_imx6sx(void)38d9654dceSShawn Guo static inline bool cpu_is_imx6sx(void)
39d9654dceSShawn Guo {
40d9654dceSShawn Guo 	return __mxc_cpu_type == MXC_CPU_IMX6SX;
41d9654dceSShawn Guo }
42d9654dceSShawn Guo 
cpu_is_imx6ul(void)43022d0716SFrank Li static inline bool cpu_is_imx6ul(void)
44022d0716SFrank Li {
45022d0716SFrank Li 	return __mxc_cpu_type == MXC_CPU_IMX6UL;
46022d0716SFrank Li }
47022d0716SFrank Li 
cpu_is_imx6ull(void)48b3ea5757SLeonard Crestez static inline bool cpu_is_imx6ull(void)
49b3ea5757SLeonard Crestez {
50b3ea5757SLeonard Crestez 	return __mxc_cpu_type == MXC_CPU_IMX6ULL;
51b3ea5757SLeonard Crestez }
52b3ea5757SLeonard Crestez 
cpu_is_imx6ulz(void)53c90dec00SAnson Huang static inline bool cpu_is_imx6ulz(void)
54c90dec00SAnson Huang {
55c90dec00SAnson Huang 	return __mxc_cpu_type == MXC_CPU_IMX6ULZ;
56c90dec00SAnson Huang }
57c90dec00SAnson Huang 
cpu_is_imx6sll(void)58dee5dee2SBai Ping static inline bool cpu_is_imx6sll(void)
59dee5dee2SBai Ping {
60dee5dee2SBai Ping 	return __mxc_cpu_type == MXC_CPU_IMX6SLL;
61dee5dee2SBai Ping }
62dee5dee2SBai Ping 
cpu_is_imx6q(void)633c03a2feSShawn Guo static inline bool cpu_is_imx6q(void)
643c03a2feSShawn Guo {
653c03a2feSShawn Guo 	return __mxc_cpu_type == MXC_CPU_IMX6Q;
663c03a2feSShawn Guo }
6750f2de61SShawn Guo 
cpu_is_imx7d(void)685739b919SAnson Huang static inline bool cpu_is_imx7d(void)
695739b919SAnson Huang {
705739b919SAnson Huang 	return __mxc_cpu_type == MXC_CPU_IMX7D;
715739b919SAnson Huang }
725739b919SAnson Huang 
7350f2de61SShawn Guo struct cpu_op {
7450f2de61SShawn Guo 	u32 cpu_rate;
7550f2de61SShawn Guo };
7650f2de61SShawn Guo 
7750f2de61SShawn Guo int tzic_enable_wake(void);
7850f2de61SShawn Guo 
7950f2de61SShawn Guo extern struct cpu_op *(*get_cpu_op)(int *op);
8050f2de61SShawn Guo #endif
8150f2de61SShawn Guo 
82c553138fSJohannes Berg #define imx_readl	readl_relaxed
83c553138fSJohannes Berg #define imx_readw	readw_relaxed
84c553138fSJohannes Berg #define imx_writel	writel_relaxed
85c553138fSJohannes Berg #define imx_writew	writew_relaxed
86c553138fSJohannes Berg 
8750f2de61SShawn Guo #endif /*  __ASM_ARCH_MXC_H__ */
88