blob: bdc4aa8e672ac98349d10c9059e063b1294e40dc [file] [log] [blame]
Kevin Hilman7c6337e2007-04-30 19:37:19 +01001/*
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
Thomas Koeller280faff2010-04-21 15:33:32 +020015#include <linux/compiler.h>
16#include <linux/types.h>
17
Kevin Hilman7c6337e2007-04-30 19:37:19 +010018struct sys_timer;
19
20extern struct sys_timer davinci_timer;
21
Kevin Hilmand0e47fb2009-04-14 11:30:11 -050022extern void davinci_irq_init(void);
Mark A. Greer673dd362009-04-15 12:40:00 -070023extern void __iomem *davinci_intc_base;
Mark A. Greer0b0c4c22009-04-15 12:41:40 -070024extern int davinci_intc_type;
Kevin Hilmand0e47fb2009-04-14 11:30:11 -050025
Mark A. Greerf64691b2009-04-15 12:40:11 -070026struct davinci_timer_instance {
Cyril Chemparathy1bcd38a2010-05-07 17:06:35 -040027 u32 base;
Mark A. Greerf64691b2009-04-15 12:40:11 -070028 u32 bottom_irq;
29 u32 top_irq;
Mark A. Greer3abd5ac2009-04-15 12:41:54 -070030 unsigned long cmp_off;
31 unsigned int cmp_irq;
Mark A. Greerf64691b2009-04-15 12:40:11 -070032};
33
34struct davinci_timer_info {
35 struct davinci_timer_instance *timers;
36 unsigned int clockevent_id;
37 unsigned int clocksource_id;
38};
39
Cyril Chemparathyc12f4152010-05-01 18:37:53 -040040struct davinci_gpio_controller;
41
Cyril Chemparathybcd6a1c2010-05-07 17:06:39 -040042/*
43 * SoC info passed into common davinci modules.
44 *
45 * Base addresses in this structure should be physical and not virtual.
46 * Modules that take such base addresses, should internally ioremap() them to
47 * use.
48 */
Mark A. Greer79c3c0b2009-04-15 12:38:58 -070049struct davinci_soc_info {
50 struct map_desc *io_desc;
51 unsigned long io_desc_num;
Mark A. Greerb9ab1272009-04-15 12:39:09 -070052 u32 cpu_id;
53 u32 jtag_id;
Cyril Chemparathy3347db82010-05-07 17:06:34 -040054 u32 jtag_id_reg;
Mark A. Greerb9ab1272009-04-15 12:39:09 -070055 struct davinci_id *ids;
56 unsigned long ids_num;
Kevin Hilman08aca082010-01-11 08:22:23 -080057 struct clk_lookup *cpu_clks;
Cyril Chemparathye4c822c2010-05-07 17:06:36 -040058 u32 *psc_bases;
Mark A. Greerd81d1882009-04-15 12:39:33 -070059 unsigned long psc_bases_num;
Cyril Chemparathy779b0d52010-05-07 17:06:38 -040060 u32 pinmux_base;
Mark A. Greer0e585952009-04-15 12:39:48 -070061 const struct mux_config *pinmux_pins;
62 unsigned long pinmux_pins_num;
Cyril Chemparathybd808942010-05-07 17:06:37 -040063 u32 intc_base;
Mark A. Greer673dd362009-04-15 12:40:00 -070064 int intc_type;
65 u8 *intc_irq_prios;
66 unsigned long intc_irq_num;
Cyril Chemparathybd808942010-05-07 17:06:37 -040067 u32 *intc_host_map;
Mark A. Greerf64691b2009-04-15 12:40:11 -070068 struct davinci_timer_info *timer_info;
Cyril Chemparathy686b6342010-05-01 18:37:54 -040069 int gpio_type;
Cyril Chemparathyb8d44292010-05-07 17:06:32 -040070 u32 gpio_base;
Mark A. Greera9949552009-04-15 12:40:35 -070071 unsigned gpio_num;
72 unsigned gpio_irq;
David Brownell7a360712009-06-25 17:01:31 -070073 unsigned gpio_unbanked;
Cyril Chemparathyc12f4152010-05-01 18:37:53 -040074 struct davinci_gpio_controller *gpio_ctlrs;
75 int gpio_ctlrs_num;
Mark A. Greer65e866a2009-03-18 12:36:08 -050076 struct platform_device *serial_dev;
Mark A. Greer972412b2009-04-15 12:40:56 -070077 struct emac_platform_data *emac_pdata;
David Brownell0d04eb42009-04-30 17:35:48 -070078 dma_addr_t sram_dma;
79 unsigned sram_len;
Mark A. Greer79c3c0b2009-04-15 12:38:58 -070080};
81
82extern struct davinci_soc_info davinci_soc_info;
83
84extern void davinci_common_init(struct davinci_soc_info *soc_info);
Sergei Shtylyov7a9978a2010-04-21 18:11:33 +040085extern void davinci_init_ide(void);
Sekhar Noric6121dd2011-12-05 11:29:46 +010086void davinci_restart(char mode, const char *cmd);
Shawn Guo3aa3e842012-04-26 09:45:39 +080087void davinci_init_late(void);
88
89#ifdef CONFIG_DAVINCI_RESET_CLOCKS
90int davinci_clk_disable_unused(void);
91#else
92static inline int davinci_clk_disable_unused(void) { return 0; }
93#endif
94
95#ifdef CONFIG_CPU_FREQ
96int davinci_cpufreq_init(void);
97#else
98static inline int davinci_cpufreq_init(void) { return 0; }
99#endif
100
101#ifdef CONFIG_SUSPEND
102int davinci_pm_init(void);
103#else
104static inline int davinci_pm_init(void) { return 0; }
105#endif
Mark A. Greer79c3c0b2009-04-15 12:38:58 -0700106
David Brownell0d04eb42009-04-30 17:35:48 -0700107/* standard place to map on-chip SRAMs; they *may* support DMA */
108#define SRAM_VIRT 0xfffe0000
109#define SRAM_SIZE SZ_128K
110
Kevin Hilman7c6337e2007-04-30 19:37:19 +0100111#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */