diff options
Diffstat (limited to 'arch/arm/mach-imx/include/mach/imx6.h')
-rw-r--r-- | arch/arm/mach-imx/include/mach/imx6.h | 88 |
1 files changed, 51 insertions, 37 deletions
diff --git a/arch/arm/mach-imx/include/mach/imx6.h b/arch/arm/mach-imx/include/mach/imx6.h index 6b08e6a521..5701bd480c 100644 --- a/arch/arm/mach-imx/include/mach/imx6.h +++ b/arch/arm/mach-imx/include/mach/imx6.h @@ -16,7 +16,9 @@ void __noreturn imx6_pm_stby_poweroff(void); #define IMX6_CPUTYPE_IMX6DL 0x261 #define IMX6_CPUTYPE_IMX6SX 0x462 #define IMX6_CPUTYPE_IMX6D 0x263 +#define IMX6_CPUTYPE_IMX6DP 0x1263 #define IMX6_CPUTYPE_IMX6Q 0x463 +#define IMX6_CPUTYPE_IMX6QP 0x1463 #define IMX6_CPUTYPE_IMX6UL 0x164 #define IMX6_CPUTYPE_IMX6ULL 0x165 @@ -33,36 +35,51 @@ static inline int scu_get_core_count(void) return (ncores & 0x03) + 1; } -static inline int __imx6_cpu_type(void) +#define SI_REV_CPUTYPE(s) (((s) >> 16) & 0xff) +#define SI_REV_MAJOR(s) (((s) >> 8) & 0xf) +#define SI_REV_MINOR(s) ((s) & 0xf) + +static inline uint32_t __imx6_read_si_rev(void) { - uint32_t val; - - val = readl(MX6_ANATOP_BASE_ADDR + IMX6_ANATOP_SI_REV); - val = (val >> 16) & 0xff; - /* non-MX6-standard SI_REV reg offset for MX6SL */ - if (IS_ENABLED(CONFIG_ARCH_IMX6SL) && - val < (IMX6_CPUTYPE_IMX6S & 0xff)) { - uint32_t tmp; - tmp = readl(MX6_ANATOP_BASE_ADDR + IMX6SL_ANATOP_SI_REV); - tmp = (tmp >> 16) & 0xff; - if ((IMX6_CPUTYPE_IMX6SL & 0xff) == tmp) - /* intentionally skip scu_get_core_count() for MX6SL */ - return IMX6_CPUTYPE_IMX6SL; - } + uint32_t si_rev; + uint32_t cpu_type; + + si_rev = readl(MX6_ANATOP_BASE_ADDR + IMX6_ANATOP_SI_REV); + cpu_type = SI_REV_CPUTYPE(si_rev); - val |= scu_get_core_count() << 8; + if (cpu_type >= 0x61 && cpu_type <= 0x65) + return si_rev; - return val; + /* try non-MX6-standard SI_REV reg offset for MX6SL */ + si_rev = readl(MX6_ANATOP_BASE_ADDR + IMX6SL_ANATOP_SI_REV); + cpu_type = SI_REV_CPUTYPE(si_rev); + + if (si_rev == 0x60) + return si_rev; + + return 0; } -static inline int imx6_cpu_type(void) +static inline int __imx6_cpu_type(void) { - if (!cpu_is_mx6()) - return 0; + uint32_t si_rev = __imx6_read_si_rev(); + uint32_t cpu_type = SI_REV_CPUTYPE(si_rev); + + /* intentionally skip scu_get_core_count() for MX6SL */ + if (cpu_type == IMX6_CPUTYPE_IMX6SL) + return IMX6_CPUTYPE_IMX6SL; - return __imx6_cpu_type(); + cpu_type |= scu_get_core_count() << 8; + + if ((cpu_type == IMX6_CPUTYPE_IMX6D || cpu_type == IMX6_CPUTYPE_IMX6Q) && + SI_REV_MAJOR(si_rev) >= 1) + cpu_type |= 0x1000; + + return cpu_type; } +int imx6_cpu_type(void); + #define DEFINE_MX6_CPU_TYPE(str, type) \ static inline int cpu_mx6_is_##str(void) \ { \ @@ -76,10 +93,19 @@ static inline int imx6_cpu_type(void) return cpu_mx6_is_##str(); \ } +/* + * Below are defined: + * + * cpu_is_mx6s(), cpu_is_mx6dl(), cpu_is_mx6q(), cpu_is_mx6qp(), cpu_is_mx6d(), + * cpu_is_mx6dp(), cpu_is_mx6sx(), cpu_is_mx6sl(), cpu_is_mx6ul(), + * cpu_is_mx6ull() + */ DEFINE_MX6_CPU_TYPE(mx6s, IMX6_CPUTYPE_IMX6S); DEFINE_MX6_CPU_TYPE(mx6dl, IMX6_CPUTYPE_IMX6DL); DEFINE_MX6_CPU_TYPE(mx6q, IMX6_CPUTYPE_IMX6Q); +DEFINE_MX6_CPU_TYPE(mx6qp, IMX6_CPUTYPE_IMX6QP); DEFINE_MX6_CPU_TYPE(mx6d, IMX6_CPUTYPE_IMX6D); +DEFINE_MX6_CPU_TYPE(mx6dp, IMX6_CPUTYPE_IMX6DP); DEFINE_MX6_CPU_TYPE(mx6sx, IMX6_CPUTYPE_IMX6SX); DEFINE_MX6_CPU_TYPE(mx6sl, IMX6_CPUTYPE_IMX6SL); DEFINE_MX6_CPU_TYPE(mx6ul, IMX6_CPUTYPE_IMX6UL); @@ -87,27 +113,15 @@ DEFINE_MX6_CPU_TYPE(mx6ull, IMX6_CPUTYPE_IMX6ULL); static inline int __imx6_cpu_revision(void) { - uint32_t rev; - uint32_t si_rev_offset = IMX6_ANATOP_SI_REV; + uint32_t si_rev = __imx6_read_si_rev(); u8 major_part, minor_part; - if (IS_ENABLED(CONFIG_ARCH_IMX6SL) && cpu_mx6_is_mx6sl()) - si_rev_offset = IMX6SL_ANATOP_SI_REV; - - rev = readl(MX6_ANATOP_BASE_ADDR + si_rev_offset); - - major_part = (rev >> 8) & 0xf; - minor_part = rev & 0xf; + major_part = (si_rev >> 8) & 0xf; + minor_part = si_rev & 0xf; return ((major_part + 1) << 4) | minor_part; } -static inline int imx6_cpu_revision(void) -{ - if (!cpu_is_mx6()) - return 0; - - return __imx6_cpu_revision(); -} +int imx6_cpu_revision(void); #endif /* __MACH_IMX6_H */ |