blob: c51764a85fd75508edd1e2659ac6c9ba8fbad987 [file] [log] [blame]
Quinn Jensen52c543f2007-07-09 22:06:53 +01001/*
Anson Huangdf595742014-01-17 11:39:05 +08002 * Copyright 2004-2014 Freescale Semiconductor, Inc. All Rights Reserved.
Quinn Jensen52c543f2007-07-09 22:06:53 +01003 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_COMMON_H__
12#define __ASM_ARCH_MXC_COMMON_H__
13
Robin Holt7b6d8642013-07-08 16:01:40 -070014#include <linux/reboot.h>
15
Shawn Guod48866f2013-10-16 19:52:00 +080016struct irq_data;
Sascha Hauer282b13d2008-09-09 10:19:40 +020017struct platform_device;
Shawn Guo009e63f2013-05-08 21:05:53 +080018struct pt_regs;
Sascha Hauer30c730f2009-02-16 14:36:49 +010019struct clk;
Gilles Chanteperdrix876292d2014-04-05 17:57:45 +020020struct device_node;
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080021enum mxc_cpu_pwr_mode;
Steffen Trumtrare57e4ab2014-07-07 11:41:26 +020022struct of_device_id;
Sascha Hauer282b13d2008-09-09 10:19:40 +020023
Shawn Guo803648d2013-10-16 21:05:35 +080024void mx21_map_io(void);
Shawn Guo803648d2013-10-16 21:05:35 +080025void mx27_map_io(void);
26void mx31_map_io(void);
27void mx35_map_io(void);
Shawn Guo803648d2013-10-16 21:05:35 +080028void imx21_init_early(void);
Shawn Guo803648d2013-10-16 21:05:35 +080029void imx27_init_early(void);
30void imx31_init_early(void);
31void imx35_init_early(void);
Shawn Guo803648d2013-10-16 21:05:35 +080032void mxc_init_irq(void __iomem *);
Shawn Guo803648d2013-10-16 21:05:35 +080033void mx21_init_irq(void);
Shawn Guo803648d2013-10-16 21:05:35 +080034void mx27_init_irq(void);
35void mx31_init_irq(void);
36void mx35_init_irq(void);
Shawn Guo803648d2013-10-16 21:05:35 +080037void imx21_soc_init(void);
Shawn Guo803648d2013-10-16 21:05:35 +080038void imx27_soc_init(void);
39void imx31_soc_init(void);
40void imx35_soc_init(void);
Shawn Guo803648d2013-10-16 21:05:35 +080041int mx21_clocks_init(unsigned long lref, unsigned long fref);
Shawn Guo803648d2013-10-16 21:05:35 +080042int mx27_clocks_init(unsigned long fref);
43int mx31_clocks_init(unsigned long fref);
44int mx35_clocks_init(void);
Shawn Guo803648d2013-10-16 21:05:35 +080045struct platform_device *mxc_register_gpio(char *name, int id,
Shawn Guob78d8e52011-06-06 00:07:55 +080046 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
Shawn Guo803648d2013-10-16 21:05:35 +080047void mxc_set_cpu_type(unsigned int type);
48void mxc_restart(enum reboot_mode, const char *);
49void mxc_arch_reset_init(void __iomem *);
Arnd Bergmann6f98cb22016-06-24 12:49:56 +020050void imx1_reset_init(void __iomem *);
Shawn Guo803648d2013-10-16 21:05:35 +080051void imx_set_aips(void __iomem *);
Steffen Trumtrare57e4ab2014-07-07 11:41:26 +020052void imx_aips_allow_unprivileged_access(const char *compat);
Shawn Guo803648d2013-10-16 21:05:35 +080053int mxc_device_init(void);
Shawn Guobfefdff2013-08-13 13:54:02 +080054void imx_set_soc_revision(unsigned int rev);
Shawn Guof1c6f312013-08-13 14:59:43 +080055void imx_init_revision_from_anatop(void);
Shawn Guoa2887542013-08-13 16:59:28 +080056struct device *imx_soc_device_init(void);
Anson Huang05136f02014-12-17 12:24:12 +080057void imx6_enable_rbc(bool enable);
Marc Zyngier14517562015-03-13 16:05:37 +000058void imx_gpc_check_dt(void);
Anson Huang05136f02014-12-17 12:24:12 +080059void imx_gpc_set_arm_power_in_lpm(bool power_off);
Anson Huangc791bbbf2018-06-03 10:33:44 +080060void imx_gpc_set_l2_mem_power_in_lpm(bool power_off);
Anson Huang05136f02014-12-17 12:24:12 +080061void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw);
62void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw);
Fabio Estevam8c4300c2016-02-02 19:45:38 -020063void imx25_pm_init(void);
Arnd Bergmann48e076d2016-06-28 10:22:16 +080064void imx27_pm_init(void);
Fabio Estevam26b754f2018-07-10 13:31:48 -030065void imx5_pmu_init(void);
Shawn Guo73d2b4c2011-10-17 08:42:16 +080066
Shawn Guo41e7daf2011-09-28 17:16:06 +080067enum mxc_cpu_pwr_mode {
68 WAIT_CLOCKED, /* wfi only */
69 WAIT_UNCLOCKED, /* WAIT */
70 WAIT_UNCLOCKED_POWER_OFF, /* WAIT + SRPG */
71 STOP_POWER_ON, /* just STOP */
72 STOP_POWER_OFF, /* STOP + SRPG */
73};
74
Anson Huang6d45a402019-01-14 08:54:59 +080075enum ulp_cpu_pwr_mode {
76 ULP_PM_HSRUN, /* High speed run mode */
77 ULP_PM_RUN, /* Run mode */
78 ULP_PM_WAIT, /* Wait mode */
79 ULP_PM_STOP, /* Stop mode */
80 ULP_PM_VLPS, /* Very low power stop mode */
81 ULP_PM_VLLS, /* very low leakage stop mode */
82};
83
Shawn Guo803648d2013-10-16 21:05:35 +080084void imx_enable_cpu(int cpu, bool enable);
85void imx_set_cpu_jump(int cpu, void *jump_addr);
86u32 imx_get_cpu_arg(int cpu);
87void imx_set_cpu_arg(int cpu, u32 arg);
Shawn Guo69c31b72011-09-06 14:59:40 +080088#ifdef CONFIG_SMP
Shawn Guo803648d2013-10-16 21:05:35 +080089void v7_secondary_startup(void);
90void imx_scu_map_io(void);
91void imx_smp_prepare(void);
Shawn Guo13eed982011-09-06 15:05:25 +080092#else
93static inline void imx_scu_map_io(void) {}
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080094static inline void imx_smp_prepare(void) {}
Shawn Guo69c31b72011-09-06 14:59:40 +080095#endif
Shawn Guo803648d2013-10-16 21:05:35 +080096void imx_src_init(void);
Anson Huang80c0ecd2014-06-23 16:42:44 +080097void imx_gpc_pre_suspend(bool arm_power_off);
Shawn Guo803648d2013-10-16 21:05:35 +080098void imx_gpc_post_resume(void);
99void imx_gpc_mask_all(void);
100void imx_gpc_restore_all(void);
Marc Zyngier65bb6882014-12-02 16:05:26 +0000101void imx_gpc_hwirq_mask(unsigned int hwirq);
102void imx_gpc_hwirq_unmask(unsigned int hwirq);
Shawn Guo803648d2013-10-16 21:05:35 +0800103void imx_anatop_init(void);
104void imx_anatop_pre_suspend(void);
105void imx_anatop_post_resume(void);
Shawn Guo8fb76a02015-04-25 22:59:19 +0800106int imx6_set_lpm(enum mxc_cpu_pwr_mode mode);
Anson Huang8765caa2016-08-29 21:49:56 +0800107void imx6_set_int_mem_clk_lpm(bool enable);
Anson Huang751f7e92014-01-09 16:03:16 +0800108void imx6sl_set_wait_clk(bool enter);
Anson Huangec336b22014-09-17 11:11:45 +0800109int imx_mmdc_get_ddr_type(void);
Anson Huang6d45a402019-01-14 08:54:59 +0800110int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode);
Eric Miao46ec1b22011-12-21 22:38:23 +0800111
Shawn Guo803648d2013-10-16 21:05:35 +0800112void imx_cpu_die(unsigned int cpu);
113int imx_cpu_kill(unsigned int cpu);
Marc Zyngiere4f2d972011-09-08 13:15:22 +0100114
Shawn Guoc356bdb2014-02-26 19:48:33 +0800115#ifdef CONFIG_SUSPEND
116void v7_cpu_resume(void);
Martin Fuzzey1579c7b2015-05-12 15:31:03 +0200117void imx53_suspend(void __iomem *ocram_vbase);
118extern const u32 imx53_suspend_sz;
Anson Huangdf595742014-01-17 11:39:05 +0800119void imx6_suspend(void __iomem *ocram_vbase);
Shawn Guoc356bdb2014-02-26 19:48:33 +0800120#else
121static inline void v7_cpu_resume(void) {}
Martin Fuzzey1579c7b2015-05-12 15:31:03 +0200122static inline void imx53_suspend(void __iomem *ocram_vbase) {}
123static const u32 imx53_suspend_sz;
Shawn Guoc356bdb2014-02-26 19:48:33 +0800124static inline void imx6_suspend(void __iomem *ocram_vbase) {}
125#endif
126
Shawn Guo35e29162015-04-29 13:07:03 +0800127void imx6_pm_ccm_init(const char *ccm_compat);
Shawn Guo803648d2013-10-16 21:05:35 +0800128void imx6q_pm_init(void);
Anson Huangdf595742014-01-17 11:39:05 +0800129void imx6dl_pm_init(void);
130void imx6sl_pm_init(void);
Anson Huangff843d62014-06-20 13:20:54 +0800131void imx6sx_pm_init(void);
Anson Huangee4a5f82015-08-05 01:48:37 +0800132void imx6ul_pm_init(void);
A.s. Dongde70d0e2018-11-10 15:13:04 +0000133void imx7ulp_pm_init(void);
Anson Huangdf595742014-01-17 11:39:05 +0800134
Shawn Guo28a9f3b2014-02-18 10:35:05 +0800135#ifdef CONFIG_PM
Shawn Guo36b66c32014-05-20 14:55:15 +0800136void imx51_pm_init(void);
137void imx53_pm_init(void);
Eric Miao46ec1b22011-12-21 22:38:23 +0800138#else
Shawn Guo36b66c32014-05-20 14:55:15 +0800139static inline void imx51_pm_init(void) {}
140static inline void imx53_pm_init(void) {}
Eric Miao46ec1b22011-12-21 22:38:23 +0800141#endif
142
Shawn Guo8321b752012-04-26 11:42:34 +0800143#ifdef CONFIG_NEON
Shawn Guo803648d2013-10-16 21:05:35 +0800144int mx51_neon_fixup(void);
Shawn Guo8321b752012-04-26 11:42:34 +0800145#else
146static inline int mx51_neon_fixup(void) { return 0; }
147#endif
148
Shawn Guoe6a07562013-07-08 21:45:20 +0800149#ifdef CONFIG_CACHE_L2X0
Shawn Guo803648d2013-10-16 21:05:35 +0800150void imx_init_l2cache(void);
Shawn Guoe6a07562013-07-08 21:45:20 +0800151#else
152static inline void imx_init_l2cache(void) {}
153#endif
154
Masahiro Yamada75305272015-11-15 10:39:53 +0900155extern const struct smp_operations imx_smp_ops;
156extern const struct smp_operations ls1021a_smp_ops;
Marc Zyngiere4f2d972011-09-08 13:15:22 +0100157
Quinn Jensen52c543f2007-07-09 22:06:53 +0100158#endif