blob: 5eac3553f96d626b163bd6456614ff88a4166cf0 [file] [log] [blame]
Russell Kinga09e64f2008-08-05 16:14:15 +01001/*
2 * arch/arm/plat-omap/include/mach/common.h
3 *
4 * Header for code common to all OMAP machines.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
28#define __ARCH_ARM_MACH_OMAP_COMMON_H
29
Paul Walmsley59fb6592010-12-21 15:30:55 -070030#include <linux/delay.h>
31
Tony Lindgrenb63128e2009-12-11 16:16:32 -080032#include <plat/i2c.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010033
34struct sys_timer;
35
36extern void omap_map_common_io(void);
Tony Lindgrene74984e2011-03-29 15:54:48 -070037extern struct sys_timer omap1_timer;
38extern struct sys_timer omap2_timer;
39extern struct sys_timer omap3_timer;
40extern struct sys_timer omap3_secure_timer;
41extern struct sys_timer omap4_timer;
Tony Lindgren05b5ca92011-01-18 12:42:23 -080042extern bool omap_32k_timer_init(void);
Paul Walmsleyd8328f32011-01-15 21:32:01 -070043extern int __init omap_init_clocksource_32k(void);
Tony Lindgren4912cf02011-01-18 17:00:00 -080044extern unsigned long long notrace omap_32k_sched_clock(void);
Russell Kinga09e64f2008-08-05 16:14:15 +010045
Russell King71ee7da2010-05-23 10:18:16 +010046extern void omap_reserve(void);
47
Tony Lindgren8f5b5a42011-08-22 23:57:24 -070048void omap2420_init_early(void);
49void omap2430_init_early(void);
50void omap3430_init_early(void);
51void omap35xx_init_early(void);
52void omap3630_init_early(void);
Tony Lindgren7b250af2011-10-04 18:26:28 -070053void omap3_init_early(void); /* Do not use this one */
Tony Lindgren8f5b5a42011-08-22 23:57:24 -070054void am35xx_init_early(void);
55void ti816x_init_early(void);
56void omap4430_init_early(void);
57
Santosh Shilimkarb7ebb102010-02-15 18:03:37 +053058/*
59 * IO bases for various OMAP processors
60 * Except the tap base, rest all the io bases
61 * listed are physical addresses.
62 */
Russell Kinga09e64f2008-08-05 16:14:15 +010063struct omap_globals {
Tony Lindgren0e564842008-10-06 15:49:16 +030064 u32 class; /* OMAP class to detect */
Russell Kinga09e64f2008-08-05 16:14:15 +010065 void __iomem *tap; /* Control module ID code */
Santosh Shilimkarb7ebb102010-02-15 18:03:37 +053066 unsigned long sdrc; /* SDRAM Controller */
67 unsigned long sms; /* SDRAM Memory Scheduler */
68 unsigned long ctrl; /* System Control Module */
Santosh Shilimkar0c349242010-09-27 14:02:57 -060069 unsigned long ctrl_pad; /* PAD Control Module */
Santosh Shilimkarb7ebb102010-02-15 18:03:37 +053070 unsigned long prm; /* Power and Reset Management */
71 unsigned long cm; /* Clock Management */
72 unsigned long cm2;
Russell Kinga09e64f2008-08-05 16:14:15 +010073};
74
75void omap2_set_globals_242x(void);
76void omap2_set_globals_243x(void);
Sergio Aguirrec573bcf2010-08-04 14:43:18 +030077void omap2_set_globals_3xxx(void);
Santosh Shilimkar44169072009-05-28 14:16:04 -070078void omap2_set_globals_443x(void);
Hemant Pedanekar4bd7be22011-02-16 08:31:39 -080079void omap2_set_globals_ti816x(void);
Russell Kinga09e64f2008-08-05 16:14:15 +010080
81/* These get called from omap2_set_globals_xxxx(), do not call these */
Tony Lindgren0e564842008-10-06 15:49:16 +030082void omap2_set_globals_tap(struct omap_globals *);
Paul Walmsleyf2ab9972009-01-28 12:27:37 -070083void omap2_set_globals_sdrc(struct omap_globals *);
Russell Kinga09e64f2008-08-05 16:14:15 +010084void omap2_set_globals_control(struct omap_globals *);
85void omap2_set_globals_prcm(struct omap_globals *);
86
Benoit Cousson35549ec2011-09-23 22:23:09 +020087void omap242x_map_io(void);
88void omap243x_map_io(void);
Mike Rapoport869fef42010-08-04 14:43:18 +030089void omap3_map_io(void);
Benoit Cousson35549ec2011-09-23 22:23:09 +020090void omap4_map_io(void);
91
Mike Rapoport869fef42010-08-04 14:43:18 +030092
Paul Walmsley6f8b7ff2009-12-08 16:33:16 -070093/**
94 * omap_test_timeout - busy-loop, testing a condition
95 * @cond: condition to test until it evaluates to true
96 * @timeout: maximum number of microseconds in the timeout
97 * @index: loop index (integer)
98 *
99 * Loop waiting for @cond to become true or until at least @timeout
100 * microseconds have passed. To use, define some integer @index in the
101 * calling code. After running, if @index == @timeout, then the loop has
102 * timed out.
103 */
104#define omap_test_timeout(cond, timeout, index) \
105({ \
106 for (index = 0; index < timeout; index++) { \
107 if (cond) \
108 break; \
109 udelay(1); \
110 } \
111})
112
Kevin Hilman6f88e9b2010-07-26 16:34:31 -0600113extern struct device *omap2_get_mpuss_device(void);
Thara Gopinathb3294e22010-09-01 13:44:53 +0530114extern struct device *omap2_get_iva_device(void);
Kevin Hilman6f88e9b2010-07-26 16:34:31 -0600115extern struct device *omap2_get_l3_device(void);
Thara Gopinathb3294e22010-09-01 13:44:53 +0530116extern struct device *omap4_get_dsp_device(void);
Kevin Hilman6f88e9b2010-07-26 16:34:31 -0600117
Russell Kinga09e64f2008-08-05 16:14:15 +0100118#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */