Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 2 | /* |
Anson Huang | df59574 | 2014-01-17 11:39:05 +0800 | [diff] [blame] | 3 | * Copyright 2004-2014 Freescale Semiconductor, Inc. All Rights Reserved. |
Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 4 | */ |
| 5 | |
Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 6 | |
| 7 | #ifndef __ASM_ARCH_MXC_COMMON_H__ |
| 8 | #define __ASM_ARCH_MXC_COMMON_H__ |
| 9 | |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 10 | #include <linux/reboot.h> |
| 11 | |
Shawn Guo | d48866f | 2013-10-16 19:52:00 +0800 | [diff] [blame] | 12 | struct irq_data; |
Sascha Hauer | 282b13d | 2008-09-09 10:19:40 +0200 | [diff] [blame] | 13 | struct platform_device; |
Shawn Guo | 009e63f | 2013-05-08 21:05:53 +0800 | [diff] [blame] | 14 | struct pt_regs; |
Sascha Hauer | 30c730f | 2009-02-16 14:36:49 +0100 | [diff] [blame] | 15 | struct clk; |
Gilles Chanteperdrix | 876292d | 2014-04-05 17:57:45 +0200 | [diff] [blame] | 16 | struct device_node; |
Shawn Guo | a1f1c7e | 2011-09-06 15:08:40 +0800 | [diff] [blame] | 17 | enum mxc_cpu_pwr_mode; |
Steffen Trumtrar | e57e4ab | 2014-07-07 11:41:26 +0200 | [diff] [blame] | 18 | struct of_device_id; |
Sascha Hauer | 282b13d | 2008-09-09 10:19:40 +0200 | [diff] [blame] | 19 | |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 20 | void mx31_map_io(void); |
| 21 | void mx35_map_io(void); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 22 | void imx21_init_early(void); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 23 | void imx31_init_early(void); |
| 24 | void imx35_init_early(void); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 25 | void mxc_init_irq(void __iomem *); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 26 | void mx31_init_irq(void); |
| 27 | void mx35_init_irq(void); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 28 | void mxc_set_cpu_type(unsigned int type); |
| 29 | void mxc_restart(enum reboot_mode, const char *); |
| 30 | void mxc_arch_reset_init(void __iomem *); |
Arnd Bergmann | 6f98cb2 | 2016-06-24 12:49:56 +0200 | [diff] [blame] | 31 | void imx1_reset_init(void __iomem *); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 32 | void imx_set_aips(void __iomem *); |
Steffen Trumtrar | e57e4ab | 2014-07-07 11:41:26 +0200 | [diff] [blame] | 33 | void imx_aips_allow_unprivileged_access(const char *compat); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 34 | int mxc_device_init(void); |
Shawn Guo | bfefdff | 2013-08-13 13:54:02 +0800 | [diff] [blame] | 35 | void imx_set_soc_revision(unsigned int rev); |
Shawn Guo | f1c6f31 | 2013-08-13 14:59:43 +0800 | [diff] [blame] | 36 | void imx_init_revision_from_anatop(void); |
Anson Huang | 05136f0 | 2014-12-17 12:24:12 +0800 | [diff] [blame] | 37 | void imx6_enable_rbc(bool enable); |
Marc Zyngier | 1451756 | 2015-03-13 16:05:37 +0000 | [diff] [blame] | 38 | void imx_gpc_check_dt(void); |
Anson Huang | 05136f0 | 2014-12-17 12:24:12 +0800 | [diff] [blame] | 39 | void imx_gpc_set_arm_power_in_lpm(bool power_off); |
Anson Huang | c791bbbf | 2018-06-03 10:33:44 +0800 | [diff] [blame] | 40 | void imx_gpc_set_l2_mem_power_in_lpm(bool power_off); |
Anson Huang | 05136f0 | 2014-12-17 12:24:12 +0800 | [diff] [blame] | 41 | void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw); |
| 42 | void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw); |
Fabio Estevam | 8c4300c | 2016-02-02 19:45:38 -0200 | [diff] [blame] | 43 | void imx25_pm_init(void); |
Arnd Bergmann | 48e076d | 2016-06-28 10:22:16 +0800 | [diff] [blame] | 44 | void imx27_pm_init(void); |
Fabio Estevam | 26b754f | 2018-07-10 13:31:48 -0300 | [diff] [blame] | 45 | void imx5_pmu_init(void); |
Shawn Guo | 73d2b4c | 2011-10-17 08:42:16 +0800 | [diff] [blame] | 46 | |
Shawn Guo | 41e7daf | 2011-09-28 17:16:06 +0800 | [diff] [blame] | 47 | enum 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 Huang | 6d45a40 | 2019-01-14 08:54:59 +0800 | [diff] [blame] | 55 | enum 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 Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 64 | void imx_enable_cpu(int cpu, bool enable); |
| 65 | void imx_set_cpu_jump(int cpu, void *jump_addr); |
| 66 | u32 imx_get_cpu_arg(int cpu); |
| 67 | void imx_set_cpu_arg(int cpu, u32 arg); |
Shawn Guo | 69c31b7 | 2011-09-06 14:59:40 +0800 | [diff] [blame] | 68 | #ifdef CONFIG_SMP |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 69 | void v7_secondary_startup(void); |
| 70 | void imx_scu_map_io(void); |
| 71 | void imx_smp_prepare(void); |
Shawn Guo | 13eed98 | 2011-09-06 15:05:25 +0800 | [diff] [blame] | 72 | #else |
| 73 | static inline void imx_scu_map_io(void) {} |
Shawn Guo | a1f1c7e | 2011-09-06 15:08:40 +0800 | [diff] [blame] | 74 | static inline void imx_smp_prepare(void) {} |
Shawn Guo | 69c31b7 | 2011-09-06 14:59:40 +0800 | [diff] [blame] | 75 | #endif |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 76 | void imx_src_init(void); |
Anson Huang | 80c0ecd | 2014-06-23 16:42:44 +0800 | [diff] [blame] | 77 | void imx_gpc_pre_suspend(bool arm_power_off); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 78 | void imx_gpc_post_resume(void); |
| 79 | void imx_gpc_mask_all(void); |
| 80 | void imx_gpc_restore_all(void); |
Marc Zyngier | 65bb688 | 2014-12-02 16:05:26 +0000 | [diff] [blame] | 81 | void imx_gpc_hwirq_mask(unsigned int hwirq); |
| 82 | void imx_gpc_hwirq_unmask(unsigned int hwirq); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 83 | void imx_anatop_init(void); |
| 84 | void imx_anatop_pre_suspend(void); |
| 85 | void imx_anatop_post_resume(void); |
Shawn Guo | 8fb76a0 | 2015-04-25 22:59:19 +0800 | [diff] [blame] | 86 | int imx6_set_lpm(enum mxc_cpu_pwr_mode mode); |
Anson Huang | 8765caa | 2016-08-29 21:49:56 +0800 | [diff] [blame] | 87 | void imx6_set_int_mem_clk_lpm(bool enable); |
Anson Huang | ec336b2 | 2014-09-17 11:11:45 +0800 | [diff] [blame] | 88 | int imx_mmdc_get_ddr_type(void); |
Anson Huang | 6d45a40 | 2019-01-14 08:54:59 +0800 | [diff] [blame] | 89 | int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode); |
Eric Miao | 46ec1b2 | 2011-12-21 22:38:23 +0800 | [diff] [blame] | 90 | |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 91 | void imx_cpu_die(unsigned int cpu); |
| 92 | int imx_cpu_kill(unsigned int cpu); |
Marc Zyngier | e4f2d97 | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 93 | |
Shawn Guo | c356bdb | 2014-02-26 19:48:33 +0800 | [diff] [blame] | 94 | #ifdef CONFIG_SUSPEND |
Martin Fuzzey | 1579c7b | 2015-05-12 15:31:03 +0200 | [diff] [blame] | 95 | void imx53_suspend(void __iomem *ocram_vbase); |
| 96 | extern const u32 imx53_suspend_sz; |
Anson Huang | df59574 | 2014-01-17 11:39:05 +0800 | [diff] [blame] | 97 | void imx6_suspend(void __iomem *ocram_vbase); |
Shawn Guo | c356bdb | 2014-02-26 19:48:33 +0800 | [diff] [blame] | 98 | #else |
Martin Fuzzey | 1579c7b | 2015-05-12 15:31:03 +0200 | [diff] [blame] | 99 | static inline void imx53_suspend(void __iomem *ocram_vbase) {} |
| 100 | static const u32 imx53_suspend_sz; |
Shawn Guo | c356bdb | 2014-02-26 19:48:33 +0800 | [diff] [blame] | 101 | static inline void imx6_suspend(void __iomem *ocram_vbase) {} |
| 102 | #endif |
| 103 | |
Ahmad Fatoum | 512a928 | 2020-01-16 15:18:49 +0100 | [diff] [blame] | 104 | void v7_cpu_resume(void); |
| 105 | |
Shawn Guo | 35e2916 | 2015-04-29 13:07:03 +0800 | [diff] [blame] | 106 | void imx6_pm_ccm_init(const char *ccm_compat); |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 107 | void imx6q_pm_init(void); |
Anson Huang | df59574 | 2014-01-17 11:39:05 +0800 | [diff] [blame] | 108 | void imx6dl_pm_init(void); |
| 109 | void imx6sl_pm_init(void); |
Anson Huang | ff843d6 | 2014-06-20 13:20:54 +0800 | [diff] [blame] | 110 | void imx6sx_pm_init(void); |
Anson Huang | ee4a5f8 | 2015-08-05 01:48:37 +0800 | [diff] [blame] | 111 | void imx6ul_pm_init(void); |
A.s. Dong | de70d0e | 2018-11-10 15:13:04 +0000 | [diff] [blame] | 112 | void imx7ulp_pm_init(void); |
Anson Huang | df59574 | 2014-01-17 11:39:05 +0800 | [diff] [blame] | 113 | |
Shawn Guo | 28a9f3b | 2014-02-18 10:35:05 +0800 | [diff] [blame] | 114 | #ifdef CONFIG_PM |
Shawn Guo | 36b66c3 | 2014-05-20 14:55:15 +0800 | [diff] [blame] | 115 | void imx51_pm_init(void); |
| 116 | void imx53_pm_init(void); |
Eric Miao | 46ec1b2 | 2011-12-21 22:38:23 +0800 | [diff] [blame] | 117 | #else |
Shawn Guo | 36b66c3 | 2014-05-20 14:55:15 +0800 | [diff] [blame] | 118 | static inline void imx51_pm_init(void) {} |
| 119 | static inline void imx53_pm_init(void) {} |
Eric Miao | 46ec1b2 | 2011-12-21 22:38:23 +0800 | [diff] [blame] | 120 | #endif |
| 121 | |
Shawn Guo | 8321b75 | 2012-04-26 11:42:34 +0800 | [diff] [blame] | 122 | #ifdef CONFIG_NEON |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 123 | int mx51_neon_fixup(void); |
Shawn Guo | 8321b75 | 2012-04-26 11:42:34 +0800 | [diff] [blame] | 124 | #else |
| 125 | static inline int mx51_neon_fixup(void) { return 0; } |
| 126 | #endif |
| 127 | |
Shawn Guo | e6a0756 | 2013-07-08 21:45:20 +0800 | [diff] [blame] | 128 | #ifdef CONFIG_CACHE_L2X0 |
Shawn Guo | 803648d | 2013-10-16 21:05:35 +0800 | [diff] [blame] | 129 | void imx_init_l2cache(void); |
Shawn Guo | e6a0756 | 2013-07-08 21:45:20 +0800 | [diff] [blame] | 130 | #else |
| 131 | static inline void imx_init_l2cache(void) {} |
| 132 | #endif |
| 133 | |
Masahiro Yamada | 7530527 | 2015-11-15 10:39:53 +0900 | [diff] [blame] | 134 | extern const struct smp_operations imx_smp_ops; |
| 135 | extern const struct smp_operations ls1021a_smp_ops; |
Marc Zyngier | e4f2d97 | 2011-09-08 13:15:22 +0100 | [diff] [blame] | 136 | |
Quinn Jensen | 52c543f | 2007-07-09 22:06:53 +0100 | [diff] [blame] | 137 | #endif |