blob: 13f3068e98459f727a8298902c37cb66c8e382ef [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 mx31_init_irq(void);
26void mx35_init_irq(void);
Shawn Guo803648d2013-10-16 21:05:35 +080027void mxc_set_cpu_type(unsigned int type);
28void mxc_restart(enum reboot_mode, const char *);
29void mxc_arch_reset_init(void __iomem *);
Arnd Bergmann6f98cb22016-06-24 12:49:56 +020030void imx1_reset_init(void __iomem *);
Shawn Guo803648d2013-10-16 21:05:35 +080031void imx_set_aips(void __iomem *);
Steffen Trumtrare57e4ab2014-07-07 11:41:26 +020032void imx_aips_allow_unprivileged_access(const char *compat);
Shawn Guo803648d2013-10-16 21:05:35 +080033int mxc_device_init(void);
Shawn Guobfefdff2013-08-13 13:54:02 +080034void imx_set_soc_revision(unsigned int rev);
Shawn Guof1c6f312013-08-13 14:59:43 +080035void imx_init_revision_from_anatop(void);
Anson Huang05136f02014-12-17 12:24:12 +080036void imx6_enable_rbc(bool enable);
Marc Zyngier14517562015-03-13 16:05:37 +000037void imx_gpc_check_dt(void);
Anson Huang05136f02014-12-17 12:24:12 +080038void imx_gpc_set_arm_power_in_lpm(bool power_off);
Anson Huangc791bbbf2018-06-03 10:33:44 +080039void imx_gpc_set_l2_mem_power_in_lpm(bool power_off);
Anson Huang05136f02014-12-17 12:24:12 +080040void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
41void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
Fabio Estevam8c4300c2016-02-02 19:45:38 -020042void imx25_pm_init(void);
Arnd Bergmann48e076d2016-06-28 10:22:16 +080043void imx27_pm_init(void);
Fabio Estevam26b754f2018-07-10 13:31:48 -030044void imx5_pmu_init(void);
Shawn Guo73d2b4c2011-10-17 08:42:16 +080045
Shawn Guo41e7daf2011-09-28 17:16:06 +080046enum mxc_cpu_pwr_mode {
47 WAIT_CLOCKED, /* wfi only */
48 WAIT_UNCLOCKED, /* WAIT */
49 WAIT_UNCLOCKED_POWER_OFF, /* WAIT + SRPG */
50 STOP_POWER_ON, /* just STOP */
51 STOP_POWER_OFF, /* STOP + SRPG */
52};
53
Anson Huang6d45a402019-01-14 08:54:59 +080054enum ulp_cpu_pwr_mode {
55 ULP_PM_HSRUN, /* High speed run mode */
56 ULP_PM_RUN, /* Run mode */
57 ULP_PM_WAIT, /* Wait mode */
58 ULP_PM_STOP, /* Stop mode */
59 ULP_PM_VLPS, /* Very low power stop mode */
60 ULP_PM_VLLS, /* very low leakage stop mode */
61};
62
Shawn Guo803648d2013-10-16 21:05:35 +080063void imx_enable_cpu(int cpu, bool enable);
64void imx_set_cpu_jump(int cpu, void *jump_addr);
65u32 imx_get_cpu_arg(int cpu);
66void imx_set_cpu_arg(int cpu, u32 arg);
Shawn Guo69c31b72011-09-06 14:59:40 +080067#ifdef CONFIG_SMP
Shawn Guo803648d2013-10-16 21:05:35 +080068void v7_secondary_startup(void);
69void imx_scu_map_io(void);
70void imx_smp_prepare(void);
Shawn Guo13eed982011-09-06 15:05:25 +080071#else
72static inline void imx_scu_map_io(void) {}
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080073static inline void imx_smp_prepare(void) {}
Shawn Guo69c31b72011-09-06 14:59:40 +080074#endif
Shawn Guo803648d2013-10-16 21:05:35 +080075void imx_src_init(void);
Anson Huange34645f2021-05-25 21:14:16 -030076void imx7_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);
Fabio Estevamfb1425b2021-06-17 11:54:15 -030083void imx_gpcv2_set_core1_pdn_pup_by_software(bool pdn);
Shawn Guo803648d2013-10-16 21:05:35 +080084void imx_anatop_init(void);
85void imx_anatop_pre_suspend(void);
86void imx_anatop_post_resume(void);
Shawn Guo8fb76a02015-04-25 22:59:19 +080087int imx6_set_lpm(enum mxc_cpu_pwr_mode mode);
Anson Huang8765caa2016-08-29 21:49:56 +080088void imx6_set_int_mem_clk_lpm(bool enable);
Anson Huangec336b22014-09-17 11:11:45 +080089int imx_mmdc_get_ddr_type(void);
Anson Huang6d45a402019-01-14 08:54:59 +080090int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode);
Eric Miao46ec1b22011-12-21 22:38:23 +080091
Shawn Guo803648d2013-10-16 21:05:35 +080092void imx_cpu_die(unsigned int cpu);
93int imx_cpu_kill(unsigned int cpu);
Marc Zyngiere4f2d972011-09-08 13:15:22 +010094
Shawn Guoc356bdb2014-02-26 19:48:33 +080095#ifdef CONFIG_SUSPEND
Martin Fuzzey1579c7b2015-05-12 15:31:03 +020096void imx53_suspend(void __iomem *ocram_vbase);
97extern const u32 imx53_suspend_sz;
Anson Huangdf595742014-01-17 11:39:05 +080098void imx6_suspend(void __iomem *ocram_vbase);
Shawn Guoc356bdb2014-02-26 19:48:33 +080099#else
Martin Fuzzey1579c7b2015-05-12 15:31:03 +0200100static inline void imx53_suspend(void __iomem *ocram_vbase) {}
101static const u32 imx53_suspend_sz;
Shawn Guoc356bdb2014-02-26 19:48:33 +0800102static inline void imx6_suspend(void __iomem *ocram_vbase) {}
103#endif
104
Ahmad Fatoum512a9282020-01-16 15:18:49 +0100105void v7_cpu_resume(void);
106
Shawn Guo35e29162015-04-29 13:07:03 +0800107void imx6_pm_ccm_init(const char *ccm_compat);
Shawn Guo803648d2013-10-16 21:05:35 +0800108void imx6q_pm_init(void);
Anson Huangdf595742014-01-17 11:39:05 +0800109void imx6dl_pm_init(void);
110void imx6sl_pm_init(void);
Anson Huangff843d62014-06-20 13:20:54 +0800111void imx6sx_pm_init(void);
Anson Huangee4a5f82015-08-05 01:48:37 +0800112void imx6ul_pm_init(void);
A.s. Dongde70d0e2018-11-10 15:13:04 +0000113void imx7ulp_pm_init(void);
Anson Huangdf595742014-01-17 11:39:05 +0800114
Shawn Guo28a9f3b2014-02-18 10:35:05 +0800115#ifdef CONFIG_PM
Shawn Guo36b66c32014-05-20 14:55:15 +0800116void imx51_pm_init(void);
117void imx53_pm_init(void);
Eric Miao46ec1b22011-12-21 22:38:23 +0800118#else
Shawn Guo36b66c32014-05-20 14:55:15 +0800119static inline void imx51_pm_init(void) {}
120static inline void imx53_pm_init(void) {}
Eric Miao46ec1b22011-12-21 22:38:23 +0800121#endif
122
Shawn Guo8321b752012-04-26 11:42:34 +0800123#ifdef CONFIG_NEON
Shawn Guo803648d2013-10-16 21:05:35 +0800124int mx51_neon_fixup(void);
Shawn Guo8321b752012-04-26 11:42:34 +0800125#else
126static inline int mx51_neon_fixup(void) { return 0; }
127#endif
128
Shawn Guoe6a07562013-07-08 21:45:20 +0800129#ifdef CONFIG_CACHE_L2X0
Shawn Guo803648d2013-10-16 21:05:35 +0800130void imx_init_l2cache(void);
Shawn Guoe6a07562013-07-08 21:45:20 +0800131#else
132static inline void imx_init_l2cache(void) {}
133#endif
134
Masahiro Yamada75305272015-11-15 10:39:53 +0900135extern const struct smp_operations imx_smp_ops;
Anson Huange34645f2021-05-25 21:14:16 -0300136extern const struct smp_operations imx7_smp_ops;
Masahiro Yamada75305272015-11-15 10:39:53 +0900137extern const struct smp_operations ls1021a_smp_ops;
Marc Zyngiere4f2d972011-09-08 13:15:22 +0100138
Quinn Jensen52c543f2007-07-09 22:06:53 +0100139#endif