blob: 2b004cc4f95e5637fef01a8dc6d25581ea7d5502 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Quinn Jensen52c543f2007-07-09 22:06:53 +01002/*
Anson Huangdf595742014-01-17 11:39:05 +08003 * Copyright 2004-2014 Freescale Semiconductor, Inc. All Rights Reserved.
Quinn Jensen52c543f2007-07-09 22:06:53 +01004 */
5
Quinn Jensen52c543f2007-07-09 22:06:53 +01006
7#ifndef __ASM_ARCH_MXC_COMMON_H__
8#define __ASM_ARCH_MXC_COMMON_H__
9
Robin Holt7b6d8642013-07-08 16:01:40 -070010#include <linux/reboot.h>
11
Shawn Guod48866f2013-10-16 19:52:00 +080012struct irq_data;
Sascha Hauer282b13d2008-09-09 10:19:40 +020013struct platform_device;
Shawn Guo009e63f2013-05-08 21:05:53 +080014struct pt_regs;
Sascha Hauer30c730f2009-02-16 14:36:49 +010015struct clk;
Gilles Chanteperdrix876292d2014-04-05 17:57:45 +020016struct device_node;
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080017enum mxc_cpu_pwr_mode;
Steffen Trumtrare57e4ab2014-07-07 11:41:26 +020018struct of_device_id;
Sascha Hauer282b13d2008-09-09 10:19:40 +020019
Shawn Guo803648d2013-10-16 21:05:35 +080020void mx31_map_io(void);
21void mx35_map_io(void);
Shawn Guo803648d2013-10-16 21:05:35 +080022void imx21_init_early(void);
Shawn Guo803648d2013-10-16 21:05:35 +080023void imx31_init_early(void);
24void imx35_init_early(void);
Shawn Guo803648d2013-10-16 21:05:35 +080025void mxc_init_irq(void __iomem *);
Shawn Guo803648d2013-10-16 21:05:35 +080026void mx31_init_irq(void);
27void mx35_init_irq(void);
Shawn Guo803648d2013-10-16 21:05:35 +080028void mxc_set_cpu_type(unsigned int type);
29void mxc_restart(enum reboot_mode, const char *);
30void mxc_arch_reset_init(void __iomem *);
Arnd Bergmann6f98cb22016-06-24 12:49:56 +020031void imx1_reset_init(void __iomem *);
Shawn Guo803648d2013-10-16 21:05:35 +080032void imx_set_aips(void __iomem *);
Steffen Trumtrare57e4ab2014-07-07 11:41:26 +020033void imx_aips_allow_unprivileged_access(const char *compat);
Shawn Guo803648d2013-10-16 21:05:35 +080034int mxc_device_init(void);
Shawn Guobfefdff2013-08-13 13:54:02 +080035void imx_set_soc_revision(unsigned int rev);
Shawn Guof1c6f312013-08-13 14:59:43 +080036void imx_init_revision_from_anatop(void);
Anson Huang05136f02014-12-17 12:24:12 +080037void imx6_enable_rbc(bool enable);
Marc Zyngier14517562015-03-13 16:05:37 +000038void imx_gpc_check_dt(void);
Anson Huang05136f02014-12-17 12:24:12 +080039void imx_gpc_set_arm_power_in_lpm(bool power_off);
Anson Huangc791bbbf2018-06-03 10:33:44 +080040void imx_gpc_set_l2_mem_power_in_lpm(bool power_off);
Anson Huang05136f02014-12-17 12:24:12 +080041void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
42void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
Fabio Estevam8c4300c2016-02-02 19:45:38 -020043void imx25_pm_init(void);
Arnd Bergmann48e076d2016-06-28 10:22:16 +080044void imx27_pm_init(void);
Fabio Estevam26b754f2018-07-10 13:31:48 -030045void imx5_pmu_init(void);
Shawn Guo73d2b4c2011-10-17 08:42:16 +080046
Shawn Guo41e7daf2011-09-28 17:16:06 +080047enum mxc_cpu_pwr_mode {
48 WAIT_CLOCKED, /* wfi only */
49 WAIT_UNCLOCKED, /* WAIT */
50 WAIT_UNCLOCKED_POWER_OFF, /* WAIT + SRPG */
51 STOP_POWER_ON, /* just STOP */
52 STOP_POWER_OFF, /* STOP + SRPG */
53};
54
Anson Huang6d45a402019-01-14 08:54:59 +080055enum ulp_cpu_pwr_mode {
56 ULP_PM_HSRUN, /* High speed run mode */
57 ULP_PM_RUN, /* Run mode */
58 ULP_PM_WAIT, /* Wait mode */
59 ULP_PM_STOP, /* Stop mode */
60 ULP_PM_VLPS, /* Very low power stop mode */
61 ULP_PM_VLLS, /* very low leakage stop mode */
62};
63
Shawn Guo803648d2013-10-16 21:05:35 +080064void imx_enable_cpu(int cpu, bool enable);
65void imx_set_cpu_jump(int cpu, void *jump_addr);
66u32 imx_get_cpu_arg(int cpu);
67void imx_set_cpu_arg(int cpu, u32 arg);
Shawn Guo69c31b72011-09-06 14:59:40 +080068#ifdef CONFIG_SMP
Shawn Guo803648d2013-10-16 21:05:35 +080069void v7_secondary_startup(void);
70void imx_scu_map_io(void);
71void imx_smp_prepare(void);
Shawn Guo13eed982011-09-06 15:05:25 +080072#else
73static inline void imx_scu_map_io(void) {}
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080074static inline void imx_smp_prepare(void) {}
Shawn Guo69c31b72011-09-06 14:59:40 +080075#endif
Shawn Guo803648d2013-10-16 21:05:35 +080076void imx_src_init(void);
Anson Huang80c0ecd2014-06-23 16:42:44 +080077void imx_gpc_pre_suspend(bool arm_power_off);
Shawn Guo803648d2013-10-16 21:05:35 +080078void imx_gpc_post_resume(void);
79void imx_gpc_mask_all(void);
80void imx_gpc_restore_all(void);
Marc Zyngier65bb6882014-12-02 16:05:26 +000081void imx_gpc_hwirq_mask(unsigned int hwirq);
82void imx_gpc_hwirq_unmask(unsigned int hwirq);
Shawn Guo803648d2013-10-16 21:05:35 +080083void imx_anatop_init(void);
84void imx_anatop_pre_suspend(void);
85void imx_anatop_post_resume(void);
Shawn Guo8fb76a02015-04-25 22:59:19 +080086int imx6_set_lpm(enum mxc_cpu_pwr_mode mode);
Anson Huang8765caa2016-08-29 21:49:56 +080087void imx6_set_int_mem_clk_lpm(bool enable);
Anson Huangec336b22014-09-17 11:11:45 +080088int imx_mmdc_get_ddr_type(void);
Anson Huang6d45a402019-01-14 08:54:59 +080089int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode);
Eric Miao46ec1b22011-12-21 22:38:23 +080090
Shawn Guo803648d2013-10-16 21:05:35 +080091void imx_cpu_die(unsigned int cpu);
92int imx_cpu_kill(unsigned int cpu);
Marc Zyngiere4f2d972011-09-08 13:15:22 +010093
Shawn Guoc356bdb2014-02-26 19:48:33 +080094#ifdef CONFIG_SUSPEND
Martin Fuzzey1579c7b2015-05-12 15:31:03 +020095void imx53_suspend(void __iomem *ocram_vbase);
96extern const u32 imx53_suspend_sz;
Anson Huangdf595742014-01-17 11:39:05 +080097void imx6_suspend(void __iomem *ocram_vbase);
Shawn Guoc356bdb2014-02-26 19:48:33 +080098#else
Martin Fuzzey1579c7b2015-05-12 15:31:03 +020099static inline void imx53_suspend(void __iomem *ocram_vbase) {}
100static const u32 imx53_suspend_sz;
Shawn Guoc356bdb2014-02-26 19:48:33 +0800101static inline void imx6_suspend(void __iomem *ocram_vbase) {}
102#endif
103
Ahmad Fatoum512a9282020-01-16 15:18:49 +0100104void v7_cpu_resume(void);
105
Shawn Guo35e29162015-04-29 13:07:03 +0800106void imx6_pm_ccm_init(const char *ccm_compat);
Shawn Guo803648d2013-10-16 21:05:35 +0800107void imx6q_pm_init(void);
Anson Huangdf595742014-01-17 11:39:05 +0800108void imx6dl_pm_init(void);
109void imx6sl_pm_init(void);
Anson Huangff843d62014-06-20 13:20:54 +0800110void imx6sx_pm_init(void);
Anson Huangee4a5f82015-08-05 01:48:37 +0800111void imx6ul_pm_init(void);
A.s. Dongde70d0e2018-11-10 15:13:04 +0000112void imx7ulp_pm_init(void);
Anson Huangdf595742014-01-17 11:39:05 +0800113
Shawn Guo28a9f3b2014-02-18 10:35:05 +0800114#ifdef CONFIG_PM
Shawn Guo36b66c32014-05-20 14:55:15 +0800115void imx51_pm_init(void);
116void imx53_pm_init(void);
Eric Miao46ec1b22011-12-21 22:38:23 +0800117#else
Shawn Guo36b66c32014-05-20 14:55:15 +0800118static inline void imx51_pm_init(void) {}
119static inline void imx53_pm_init(void) {}
Eric Miao46ec1b22011-12-21 22:38:23 +0800120#endif
121
Shawn Guo8321b752012-04-26 11:42:34 +0800122#ifdef CONFIG_NEON
Shawn Guo803648d2013-10-16 21:05:35 +0800123int mx51_neon_fixup(void);
Shawn Guo8321b752012-04-26 11:42:34 +0800124#else
125static inline int mx51_neon_fixup(void) { return 0; }
126#endif
127
Shawn Guoe6a07562013-07-08 21:45:20 +0800128#ifdef CONFIG_CACHE_L2X0
Shawn Guo803648d2013-10-16 21:05:35 +0800129void imx_init_l2cache(void);
Shawn Guoe6a07562013-07-08 21:45:20 +0800130#else
131static inline void imx_init_l2cache(void) {}
132#endif
133
Masahiro Yamada75305272015-11-15 10:39:53 +0900134extern const struct smp_operations imx_smp_ops;
135extern const struct smp_operations ls1021a_smp_ops;
Marc Zyngiere4f2d972011-09-08 13:15:22 +0100136
Quinn Jensen52c543f2007-07-09 22:06:53 +0100137#endif