150f2de61SShawn Guo /* 25739b919SAnson Huang * Copyright 2004-2007, 2010-2015 Freescale Semiconductor, Inc. 350f2de61SShawn Guo * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) 450f2de61SShawn Guo * 550f2de61SShawn Guo * This program is free software; you can redistribute it and/or 650f2de61SShawn Guo * modify it under the terms of the GNU General Public License 750f2de61SShawn Guo * as published by the Free Software Foundation; either version 2 850f2de61SShawn Guo * of the License, or (at your option) any later version. 950f2de61SShawn Guo * This program is distributed in the hope that it will be useful, 1050f2de61SShawn Guo * but WITHOUT ANY WARRANTY; without even the implied warranty of 1150f2de61SShawn Guo * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1250f2de61SShawn Guo * GNU General Public License for more details. 1350f2de61SShawn Guo * 1450f2de61SShawn Guo * You should have received a copy of the GNU General Public License 1550f2de61SShawn Guo * along with this program; if not, write to the Free Software 1650f2de61SShawn Guo * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 1750f2de61SShawn Guo * MA 02110-1301, USA. 1850f2de61SShawn Guo */ 1950f2de61SShawn Guo 2050f2de61SShawn Guo #ifndef __ASM_ARCH_MXC_H__ 2150f2de61SShawn Guo #define __ASM_ARCH_MXC_H__ 2250f2de61SShawn Guo 2350f2de61SShawn Guo #include <linux/types.h> 2450f2de61SShawn Guo 2550f2de61SShawn Guo #ifndef __ASM_ARCH_MXC_HARDWARE_H__ 2650f2de61SShawn Guo #error "Do not include directly." 2750f2de61SShawn Guo #endif 2850f2de61SShawn Guo 2950f2de61SShawn Guo #define MXC_CPU_MX1 1 3050f2de61SShawn Guo #define MXC_CPU_MX21 21 3150f2de61SShawn Guo #define MXC_CPU_MX25 25 3250f2de61SShawn Guo #define MXC_CPU_MX27 27 3350f2de61SShawn Guo #define MXC_CPU_MX31 31 3450f2de61SShawn Guo #define MXC_CPU_MX35 35 3550f2de61SShawn Guo #define MXC_CPU_MX51 51 3650f2de61SShawn Guo #define MXC_CPU_MX53 53 37a2887546SShawn Guo #define MXC_CPU_IMX6SL 0x60 383c03a2feSShawn Guo #define MXC_CPU_IMX6DL 0x61 39d9654dceSShawn Guo #define MXC_CPU_IMX6SX 0x62 403c03a2feSShawn Guo #define MXC_CPU_IMX6Q 0x63 41*022d0716SFrank Li #define MXC_CPU_IMX6UL 0x64 425739b919SAnson Huang #define MXC_CPU_IMX7D 0x72 4350f2de61SShawn Guo 44ec336b28SAnson Huang #define IMX_DDR_TYPE_LPDDR2 1 45ec336b28SAnson Huang 4650f2de61SShawn Guo #ifndef __ASSEMBLY__ 4750f2de61SShawn Guo extern unsigned int __mxc_cpu_type; 4850f2de61SShawn Guo #endif 4950f2de61SShawn Guo 5050f2de61SShawn Guo #ifdef CONFIG_SOC_IMX1 5150f2de61SShawn Guo # ifdef mxc_cpu_type 5250f2de61SShawn Guo # undef mxc_cpu_type 5350f2de61SShawn Guo # define mxc_cpu_type __mxc_cpu_type 5450f2de61SShawn Guo # else 5550f2de61SShawn Guo # define mxc_cpu_type MXC_CPU_MX1 5650f2de61SShawn Guo # endif 5750f2de61SShawn Guo # define cpu_is_mx1() (mxc_cpu_type == MXC_CPU_MX1) 5850f2de61SShawn Guo #else 5950f2de61SShawn Guo # define cpu_is_mx1() (0) 6050f2de61SShawn Guo #endif 6150f2de61SShawn Guo 6250f2de61SShawn Guo #ifdef CONFIG_SOC_IMX21 6350f2de61SShawn Guo # ifdef mxc_cpu_type 6450f2de61SShawn Guo # undef mxc_cpu_type 6550f2de61SShawn Guo # define mxc_cpu_type __mxc_cpu_type 6650f2de61SShawn Guo # else 6750f2de61SShawn Guo # define mxc_cpu_type MXC_CPU_MX21 6850f2de61SShawn Guo # endif 6950f2de61SShawn Guo # define cpu_is_mx21() (mxc_cpu_type == MXC_CPU_MX21) 7050f2de61SShawn Guo #else 7150f2de61SShawn Guo # define cpu_is_mx21() (0) 7250f2de61SShawn Guo #endif 7350f2de61SShawn Guo 7450f2de61SShawn Guo #ifdef CONFIG_SOC_IMX25 7550f2de61SShawn Guo # ifdef mxc_cpu_type 7650f2de61SShawn Guo # undef mxc_cpu_type 7750f2de61SShawn Guo # define mxc_cpu_type __mxc_cpu_type 7850f2de61SShawn Guo # else 7950f2de61SShawn Guo # define mxc_cpu_type MXC_CPU_MX25 8050f2de61SShawn Guo # endif 8150f2de61SShawn Guo # define cpu_is_mx25() (mxc_cpu_type == MXC_CPU_MX25) 8250f2de61SShawn Guo #else 8350f2de61SShawn Guo # define cpu_is_mx25() (0) 8450f2de61SShawn Guo #endif 8550f2de61SShawn Guo 8650f2de61SShawn Guo #ifdef CONFIG_SOC_IMX27 8750f2de61SShawn Guo # ifdef mxc_cpu_type 8850f2de61SShawn Guo # undef mxc_cpu_type 8950f2de61SShawn Guo # define mxc_cpu_type __mxc_cpu_type 9050f2de61SShawn Guo # else 9150f2de61SShawn Guo # define mxc_cpu_type MXC_CPU_MX27 9250f2de61SShawn Guo # endif 9350f2de61SShawn Guo # define cpu_is_mx27() (mxc_cpu_type == MXC_CPU_MX27) 9450f2de61SShawn Guo #else 9550f2de61SShawn Guo # define cpu_is_mx27() (0) 9650f2de61SShawn Guo #endif 9750f2de61SShawn Guo 9850f2de61SShawn Guo #ifdef CONFIG_SOC_IMX31 9950f2de61SShawn Guo # ifdef mxc_cpu_type 10050f2de61SShawn Guo # undef mxc_cpu_type 10150f2de61SShawn Guo # define mxc_cpu_type __mxc_cpu_type 10250f2de61SShawn Guo # else 10350f2de61SShawn Guo # define mxc_cpu_type MXC_CPU_MX31 10450f2de61SShawn Guo # endif 10550f2de61SShawn Guo # define cpu_is_mx31() (mxc_cpu_type == MXC_CPU_MX31) 10650f2de61SShawn Guo #else 10750f2de61SShawn Guo # define cpu_is_mx31() (0) 10850f2de61SShawn Guo #endif 10950f2de61SShawn Guo 11050f2de61SShawn Guo #ifdef CONFIG_SOC_IMX35 11150f2de61SShawn Guo # ifdef mxc_cpu_type 11250f2de61SShawn Guo # undef mxc_cpu_type 11350f2de61SShawn Guo # define mxc_cpu_type __mxc_cpu_type 11450f2de61SShawn Guo # else 11550f2de61SShawn Guo # define mxc_cpu_type MXC_CPU_MX35 11650f2de61SShawn Guo # endif 11750f2de61SShawn Guo # define cpu_is_mx35() (mxc_cpu_type == MXC_CPU_MX35) 11850f2de61SShawn Guo #else 11950f2de61SShawn Guo # define cpu_is_mx35() (0) 12050f2de61SShawn Guo #endif 12150f2de61SShawn Guo 12250f2de61SShawn Guo #ifdef CONFIG_SOC_IMX51 12350f2de61SShawn Guo # ifdef mxc_cpu_type 12450f2de61SShawn Guo # undef mxc_cpu_type 12550f2de61SShawn Guo # define mxc_cpu_type __mxc_cpu_type 12650f2de61SShawn Guo # else 12750f2de61SShawn Guo # define mxc_cpu_type MXC_CPU_MX51 12850f2de61SShawn Guo # endif 12950f2de61SShawn Guo # define cpu_is_mx51() (mxc_cpu_type == MXC_CPU_MX51) 13050f2de61SShawn Guo #else 13150f2de61SShawn Guo # define cpu_is_mx51() (0) 13250f2de61SShawn Guo #endif 13350f2de61SShawn Guo 13450f2de61SShawn Guo #ifdef CONFIG_SOC_IMX53 13550f2de61SShawn Guo # ifdef mxc_cpu_type 13650f2de61SShawn Guo # undef mxc_cpu_type 13750f2de61SShawn Guo # define mxc_cpu_type __mxc_cpu_type 13850f2de61SShawn Guo # else 13950f2de61SShawn Guo # define mxc_cpu_type MXC_CPU_MX53 14050f2de61SShawn Guo # endif 14150f2de61SShawn Guo # define cpu_is_mx53() (mxc_cpu_type == MXC_CPU_MX53) 14250f2de61SShawn Guo #else 14350f2de61SShawn Guo # define cpu_is_mx53() (0) 14450f2de61SShawn Guo #endif 14550f2de61SShawn Guo 14650f2de61SShawn Guo #ifndef __ASSEMBLY__ 147a82eb09fSArnd Bergmann #ifdef CONFIG_SOC_IMX6SL 1489ba64fe3SShawn Guo static inline bool cpu_is_imx6sl(void) 1499ba64fe3SShawn Guo { 1509ba64fe3SShawn Guo return __mxc_cpu_type == MXC_CPU_IMX6SL; 1519ba64fe3SShawn Guo } 152a82eb09fSArnd Bergmann #else 153a82eb09fSArnd Bergmann static inline bool cpu_is_imx6sl(void) 154a82eb09fSArnd Bergmann { 155a82eb09fSArnd Bergmann return false; 156a82eb09fSArnd Bergmann } 157a82eb09fSArnd Bergmann #endif 1589ba64fe3SShawn Guo 1593c03a2feSShawn Guo static inline bool cpu_is_imx6dl(void) 1603c03a2feSShawn Guo { 1613c03a2feSShawn Guo return __mxc_cpu_type == MXC_CPU_IMX6DL; 1623c03a2feSShawn Guo } 1633c03a2feSShawn Guo 164d9654dceSShawn Guo static inline bool cpu_is_imx6sx(void) 165d9654dceSShawn Guo { 166d9654dceSShawn Guo return __mxc_cpu_type == MXC_CPU_IMX6SX; 167d9654dceSShawn Guo } 168d9654dceSShawn Guo 169*022d0716SFrank Li static inline bool cpu_is_imx6ul(void) 170*022d0716SFrank Li { 171*022d0716SFrank Li return __mxc_cpu_type == MXC_CPU_IMX6UL; 172*022d0716SFrank Li } 173*022d0716SFrank Li 1743c03a2feSShawn Guo static inline bool cpu_is_imx6q(void) 1753c03a2feSShawn Guo { 1763c03a2feSShawn Guo return __mxc_cpu_type == MXC_CPU_IMX6Q; 1773c03a2feSShawn Guo } 17850f2de61SShawn Guo 1795739b919SAnson Huang static inline bool cpu_is_imx7d(void) 1805739b919SAnson Huang { 1815739b919SAnson Huang return __mxc_cpu_type == MXC_CPU_IMX7D; 1825739b919SAnson Huang } 1835739b919SAnson Huang 18450f2de61SShawn Guo struct cpu_op { 18550f2de61SShawn Guo u32 cpu_rate; 18650f2de61SShawn Guo }; 18750f2de61SShawn Guo 18850f2de61SShawn Guo int tzic_enable_wake(void); 18950f2de61SShawn Guo 19050f2de61SShawn Guo extern struct cpu_op *(*get_cpu_op)(int *op); 19150f2de61SShawn Guo #endif 19250f2de61SShawn Guo 19350f2de61SShawn Guo #define cpu_is_mx3() (cpu_is_mx31() || cpu_is_mx35()) 19450f2de61SShawn Guo #define cpu_is_mx2() (cpu_is_mx21() || cpu_is_mx27()) 19550f2de61SShawn Guo 19650f2de61SShawn Guo #endif /* __ASM_ARCH_MXC_H__ */ 197