blob: bcb11b1751d8797e4b1caeb5fa2dbc0d913208eb [file] [log] [blame]
Quinn Jensen52c543f2007-07-09 22:06:53 +01001/*
Anson Huange95dddb2013-03-20 19:39:42 -04002 * Copyright 2004-2013 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
Sascha Hauer282b13d2008-09-09 10:19:40 +020014struct platform_device;
Sascha Hauer30c730f2009-02-16 14:36:49 +010015struct clk;
Shawn Guoa1f1c7e2011-09-06 15:08:40 +080016enum mxc_cpu_pwr_mode;
Sascha Hauer282b13d2008-09-09 10:19:40 +020017
Sascha Hauercd4a05f2009-04-02 22:32:10 +020018extern void mx1_map_io(void);
19extern void mx21_map_io(void);
Sascha Hauer8c25c362009-06-04 11:32:12 +020020extern void mx25_map_io(void);
Sascha Hauercd4a05f2009-04-02 22:32:10 +020021extern void mx27_map_io(void);
22extern void mx31_map_io(void);
23extern void mx35_map_io(void);
Amit Kucheriaa329b482010-02-04 12:21:53 -080024extern void mx51_map_io(void);
Dinh Nguyenc0abefd2010-11-15 11:29:59 -060025extern void mx53_map_io(void);
Uwe Kleine-König3dac2192011-02-07 16:35:19 +010026extern void imx1_init_early(void);
27extern void imx21_init_early(void);
28extern void imx25_init_early(void);
29extern void imx27_init_early(void);
Uwe Kleine-König97976e22011-02-07 16:35:20 +010030extern void imx31_init_early(void);
31extern void imx35_init_early(void);
Uwe Kleine-Königab1304212011-02-07 16:35:21 +010032extern void imx51_init_early(void);
33extern void imx53_init_early(void);
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +020034extern void mxc_init_irq(void __iomem *);
Amit Kucheriaa0037082009-12-03 22:36:41 +020035extern void tzic_init_irq(void __iomem *);
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +020036extern void mx1_init_irq(void);
37extern void mx21_init_irq(void);
Sascha Hauer8c25c362009-06-04 11:32:12 +020038extern void mx25_init_irq(void);
Sascha Hauerc5aa0ad2009-05-25 17:36:19 +020039extern void mx27_init_irq(void);
40extern void mx31_init_irq(void);
41extern void mx35_init_irq(void);
Amit Kucheriaa329b482010-02-04 12:21:53 -080042extern void mx51_init_irq(void);
Dinh Nguyenc0abefd2010-11-15 11:29:59 -060043extern void mx53_init_irq(void);
Shawn Guob78d8e52011-06-06 00:07:55 +080044extern void imx1_soc_init(void);
45extern void imx21_soc_init(void);
46extern void imx25_soc_init(void);
47extern void imx27_soc_init(void);
48extern void imx31_soc_init(void);
49extern void imx35_soc_init(void);
Shawn Guob78d8e52011-06-06 00:07:55 +080050extern void imx51_soc_init(void);
Shawn Guo8321b752012-04-26 11:42:34 +080051extern void imx51_init_late(void);
Robert Leeaa96a182012-05-21 17:50:27 -050052extern void imx53_init_late(void);
Sascha Hauer2cfb4512012-05-16 12:29:53 +020053extern void epit_timer_init(void __iomem *base, int irq);
54extern void mxc_timer_init(void __iomem *, int);
Sascha Hauer30c730f2009-02-16 14:36:49 +010055extern int mx1_clocks_init(unsigned long fref);
Holger Schurigaa3b0a62009-01-26 16:34:54 +010056extern int mx21_clocks_init(unsigned long lref, unsigned long fref);
Baruch Siachfadc0952010-01-25 12:58:19 +020057extern int mx25_clocks_init(void);
Sascha Hauer30c730f2009-02-16 14:36:49 +010058extern int mx27_clocks_init(unsigned long fref);
59extern int mx31_clocks_init(unsigned long fref);
Sascha Hauer2cb536d2009-02-06 17:48:59 +010060extern int mx35_clocks_init(void);
Amit Kucheriaa329b482010-02-04 12:21:53 -080061extern int mx51_clocks_init(unsigned long ckil, unsigned long osc,
62 unsigned long ckih1, unsigned long ckih2);
Dinh Nguyenc0abefd2010-11-15 11:29:59 -060063extern int mx53_clocks_init(unsigned long ckil, unsigned long osc,
64 unsigned long ckih1, unsigned long ckih2);
Sascha Haueref4bac52012-09-20 14:59:36 +020065extern int mx25_clocks_init_dt(void);
Sascha Hauer9f0749e2012-02-28 21:57:50 +010066extern int mx27_clocks_init_dt(void);
Denis 'GNUtoo' Cariklid2a37b32012-07-09 21:39:12 +020067extern int mx31_clocks_init_dt(void);
Shawn Guo9daaf312011-10-17 08:42:17 +080068extern int mx51_clocks_init_dt(void);
Shawn Guo73d2b4c2011-10-17 08:42:16 +080069extern int mx53_clocks_init_dt(void);
Shawn Guo13eed982011-09-06 15:05:25 +080070extern int mx6q_clocks_init(void);
Shawn Guoe7fc6ae2011-07-07 00:37:41 +080071extern struct platform_device *mxc_register_gpio(char *name, int id,
Shawn Guob78d8e52011-06-06 00:07:55 +080072 resource_size_t iobase, resource_size_t iosize, int irq, int irq_high);
Sascha Hauer198016e2009-02-06 15:38:22 +010073extern void mxc_set_cpu_type(unsigned int type);
Russell King65ea7882011-11-06 17:12:08 +000074extern void mxc_restart(char, const char *);
Sascha Hauerbe124c92009-06-04 12:19:02 +020075extern void mxc_arch_reset_init(void __iomem *);
Dinh Nguyenc0abefd2010-11-15 11:29:59 -060076extern int mx53_revision(void);
Fabio Estevam2d953782011-03-25 12:52:47 -030077extern int mx53_display_revision(void);
Fabio Estevambb07d752012-02-29 10:28:08 -030078extern void imx_set_aips(void __iomem *);
Shawn Guo69ac71d2012-09-20 14:21:16 +080079extern int mxc_device_init(void);
Shawn Guo73d2b4c2011-10-17 08:42:16 +080080
Shawn Guo41e7daf2011-09-28 17:16:06 +080081enum mxc_cpu_pwr_mode {
82 WAIT_CLOCKED, /* wfi only */
83 WAIT_UNCLOCKED, /* WAIT */
84 WAIT_UNCLOCKED_POWER_OFF, /* WAIT + SRPG */
85 STOP_POWER_ON, /* just STOP */
86 STOP_POWER_OFF, /* STOP + SRPG */
87};
88
Fabio Estevam3ac804e2012-02-02 20:02:32 -020089enum mx3_cpu_pwr_mode {
90 MX3_RUN,
91 MX3_WAIT,
92 MX3_DOZE,
93 MX3_SLEEP,
94};
95
96extern void mx3_cpu_lp_set(enum mx3_cpu_pwr_mode mode);
Fabio Estevam059e58f2011-08-26 13:35:18 +080097extern void imx_print_silicon_rev(const char *cpu, int srev);
Sascha Hauerb6de9432011-09-20 14:28:17 +020098
99void avic_handle_irq(struct pt_regs *);
Sascha Hauer58a92602011-09-20 14:28:39 +0200100void tzic_handle_irq(struct pt_regs *);
Sascha Hauerb6de9432011-09-20 14:28:17 +0200101
102#define imx1_handle_irq avic_handle_irq
103#define imx21_handle_irq avic_handle_irq
104#define imx25_handle_irq avic_handle_irq
105#define imx27_handle_irq avic_handle_irq
106#define imx31_handle_irq avic_handle_irq
107#define imx35_handle_irq avic_handle_irq
Sascha Hauer58a92602011-09-20 14:28:39 +0200108#define imx51_handle_irq tzic_handle_irq
109#define imx53_handle_irq tzic_handle_irq
Sascha Hauerb6de9432011-09-20 14:28:17 +0200110
Shawn Guo69c31b72011-09-06 14:59:40 +0800111extern void imx_enable_cpu(int cpu, bool enable);
112extern void imx_set_cpu_jump(int cpu, void *jump_addr);
Shawn Guo2f3edfd2013-03-26 16:46:07 +0800113extern u32 imx_get_cpu_arg(int cpu);
114extern void imx_set_cpu_arg(int cpu, u32 arg);
Shawn Guoa1f1c7e2011-09-06 15:08:40 +0800115extern void v7_cpu_resume(void);
Shawn Guo69c31b72011-09-06 14:59:40 +0800116#ifdef CONFIG_SMP
117extern void v7_secondary_startup(void);
Shawn Guo13eed982011-09-06 15:05:25 +0800118extern void imx_scu_map_io(void);
Shawn Guoa1f1c7e2011-09-06 15:08:40 +0800119extern void imx_smp_prepare(void);
Shawn Guoe5f9dec2012-12-04 22:55:15 +0800120extern void imx_scu_standby_enable(void);
Shawn Guo13eed982011-09-06 15:05:25 +0800121#else
122static inline void imx_scu_map_io(void) {}
Shawn Guoa1f1c7e2011-09-06 15:08:40 +0800123static inline void imx_smp_prepare(void) {}
Shawn Guoe5f9dec2012-12-04 22:55:15 +0800124static inline void imx_scu_standby_enable(void) {}
Shawn Guo69c31b72011-09-06 14:59:40 +0800125#endif
Shawn Guo13eed982011-09-06 15:05:25 +0800126extern void imx_src_init(void);
Shawn Guo0575fb72011-12-09 00:51:26 +0100127extern void imx_src_prepare_restart(void);
Shawn Guo13eed982011-09-06 15:05:25 +0800128extern void imx_gpc_init(void);
Shawn Guoa1f1c7e2011-09-06 15:08:40 +0800129extern void imx_gpc_pre_suspend(void);
130extern void imx_gpc_post_resume(void);
Anson Huang263475d2013-03-21 10:58:06 -0400131extern void imx_gpc_mask_all(void);
132extern void imx_gpc_restore_all(void);
Anson Huange95dddb2013-03-20 19:39:42 -0400133extern void imx_anatop_init(void);
134extern void imx_anatop_pre_suspend(void);
135extern void imx_anatop_post_resume(void);
136extern void imx_anatop_usb_chrg_detect_disable(void);
137extern u32 imx_anatop_get_digprog(void);
Shawn Guoa1f1c7e2011-09-06 15:08:40 +0800138extern int imx6q_set_lpm(enum mxc_cpu_pwr_mode mode);
Shawn Guoe5f9dec2012-12-04 22:55:15 +0800139extern void imx6q_set_chicken_bit(void);
Eric Miao46ec1b22011-12-21 22:38:23 +0800140
Marc Zyngiere4f2d972011-09-08 13:15:22 +0100141extern void imx_cpu_die(unsigned int cpu);
Shawn Guo83757662013-01-14 14:08:50 +0800142extern int imx_cpu_kill(unsigned int cpu);
Marc Zyngiere4f2d972011-09-08 13:15:22 +0100143
Eric Miao46ec1b22011-12-21 22:38:23 +0800144#ifdef CONFIG_PM
145extern void imx6q_pm_init(void);
Robert Lee565fa912012-05-21 17:50:26 -0500146extern void imx51_pm_init(void);
Robert Leeaa96a182012-05-21 17:50:27 -0500147extern void imx53_pm_init(void);
Eric Miao46ec1b22011-12-21 22:38:23 +0800148#else
149static inline void imx6q_pm_init(void) {}
Robert Lee565fa912012-05-21 17:50:26 -0500150static inline void imx51_pm_init(void) {}
Robert Leeaa96a182012-05-21 17:50:27 -0500151static inline void imx53_pm_init(void) {}
Eric Miao46ec1b22011-12-21 22:38:23 +0800152#endif
153
Shawn Guo8321b752012-04-26 11:42:34 +0800154#ifdef CONFIG_NEON
155extern int mx51_neon_fixup(void);
156#else
157static inline int mx51_neon_fixup(void) { return 0; }
158#endif
159
Marc Zyngiere4f2d972011-09-08 13:15:22 +0100160extern struct smp_operations imx_smp_ops;
161
Quinn Jensen52c543f2007-07-09 22:06:53 +0100162#endif