1 /*
2  * Header for code common to all DaVinci machines.
3  *
4  * Author: Kevin Hilman, MontaVista Software, Inc. <source@mvista.com>
5  *
6  * 2007 (c) MontaVista Software, Inc. This file is licensed under
7  * the terms of the GNU General Public License version 2. This program
8  * is licensed "as is" without any warranty of any kind, whether express
9  * or implied.
10  */
11 
12 #ifndef __ARCH_ARM_MACH_DAVINCI_COMMON_H
13 #define __ARCH_ARM_MACH_DAVINCI_COMMON_H
14 
15 #include <linux/clk.h>
16 #include <linux/compiler.h>
17 #include <linux/types.h>
18 #include <linux/reboot.h>
19 
20 #include <asm/irq.h>
21 
22 #define DAVINCI_INTC_START		NR_IRQS
23 #define DAVINCI_INTC_IRQ(_irqnum)	(DAVINCI_INTC_START + (_irqnum))
24 
25 void davinci_timer_init(struct clk *clk);
26 
27 struct davinci_timer_instance {
28 	u32		base;
29 	u32		bottom_irq;
30 	u32		top_irq;
31 	unsigned long	cmp_off;
32 	unsigned int	cmp_irq;
33 };
34 
35 struct davinci_timer_info {
36 	struct davinci_timer_instance	*timers;
37 	unsigned int			clockevent_id;
38 	unsigned int			clocksource_id;
39 };
40 
41 struct davinci_gpio_controller;
42 
43 /*
44  * SoC info passed into common davinci modules.
45  *
46  * Base addresses in this structure should be physical and not virtual.
47  * Modules that take such base addresses, should internally ioremap() them to
48  * use.
49  */
50 struct davinci_soc_info {
51 	struct map_desc			*io_desc;
52 	unsigned long			io_desc_num;
53 	u32				cpu_id;
54 	u32				jtag_id;
55 	u32				jtag_id_reg;
56 	struct davinci_id		*ids;
57 	unsigned long			ids_num;
58 	u32				pinmux_base;
59 	const struct mux_config		*pinmux_pins;
60 	unsigned long			pinmux_pins_num;
61 	struct davinci_timer_info	*timer_info;
62 	int				gpio_type;
63 	u32				gpio_base;
64 	unsigned			gpio_num;
65 	unsigned			gpio_irq;
66 	unsigned			gpio_unbanked;
67 	struct davinci_gpio_controller	*gpio_ctlrs;
68 	int				gpio_ctlrs_num;
69 	struct emac_platform_data	*emac_pdata;
70 	dma_addr_t			sram_dma;
71 	unsigned			sram_len;
72 };
73 
74 extern struct davinci_soc_info davinci_soc_info;
75 
76 extern void davinci_common_init(const struct davinci_soc_info *soc_info);
77 extern void davinci_init_ide(void);
78 void davinci_init_late(void);
79 
80 #ifdef CONFIG_CPU_FREQ
81 int davinci_cpufreq_init(void);
82 #else
davinci_cpufreq_init(void)83 static inline int davinci_cpufreq_init(void) { return 0; }
84 #endif
85 
86 #ifdef CONFIG_SUSPEND
87 int davinci_pm_init(void);
88 #else
davinci_pm_init(void)89 static inline int davinci_pm_init(void) { return 0; }
90 #endif
91 
92 void __init pdata_quirks_init(void);
93 
94 #define SRAM_SIZE	SZ_128K
95 
96 #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
97