blob: cce316b92c06c03ce2669938f49a5bd8a2e7b4a3 [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>
Robin Holt7b6d8642013-07-08 16:01:40 -070017#include <linux/reboot.h>
Thomas Koeller280faff2010-04-21 15:33:32 +020018
Stephen Warren6bb27d72012-11-08 12:40:59 -070019extern void davinci_timer_init(void);
Kevin Hilman7c6337e2007-04-30 19:37:19 +010020
Kevin Hilmand0e47fb2009-04-14 11:30:11 -050021extern void davinci_irq_init(void);
Mark A. Greer673dd362009-04-15 12:40:00 -070022extern void __iomem *davinci_intc_base;
Mark A. Greer0b0c4c22009-04-15 12:41:40 -070023extern int davinci_intc_type;
Kevin Hilmand0e47fb2009-04-14 11:30:11 -050024
Mark A. Greerf64691b2009-04-15 12:40:11 -070025struct davinci_timer_instance {
Cyril Chemparathy1bcd38a2010-05-07 17:06:35 -040026 u32 base;
Mark A. Greerf64691b2009-04-15 12:40:11 -070027 u32 bottom_irq;
28 u32 top_irq;
Mark A. Greer3abd5ac2009-04-15 12:41:54 -070029 unsigned long cmp_off;
30 unsigned int cmp_irq;
Mark A. Greerf64691b2009-04-15 12:40:11 -070031};
32
33struct davinci_timer_info {
34 struct davinci_timer_instance *timers;
35 unsigned int clockevent_id;
36 unsigned int clocksource_id;
37};
38
Cyril Chemparathyc12f4152010-05-01 18:37:53 -040039struct davinci_gpio_controller;
40
Cyril Chemparathybcd6a1c2010-05-07 17:06:39 -040041/*
42 * SoC info passed into common davinci modules.
43 *
44 * Base addresses in this structure should be physical and not virtual.
45 * Modules that take such base addresses, should internally ioremap() them to
46 * use.
47 */
Mark A. Greer79c3c0b2009-04-15 12:38:58 -070048struct davinci_soc_info {
49 struct map_desc *io_desc;
50 unsigned long io_desc_num;
Mark A. Greerb9ab1272009-04-15 12:39:09 -070051 u32 cpu_id;
52 u32 jtag_id;
Cyril Chemparathy3347db82010-05-07 17:06:34 -040053 u32 jtag_id_reg;
Mark A. Greerb9ab1272009-04-15 12:39:09 -070054 struct davinci_id *ids;
55 unsigned long ids_num;
Kevin Hilman08aca082010-01-11 08:22:23 -080056 struct clk_lookup *cpu_clks;
Cyril Chemparathye4c822c2010-05-07 17:06:36 -040057 u32 *psc_bases;
Mark A. Greerd81d1882009-04-15 12:39:33 -070058 unsigned long psc_bases_num;
Cyril Chemparathy779b0d52010-05-07 17:06:38 -040059 u32 pinmux_base;
Mark A. Greer0e585952009-04-15 12:39:48 -070060 const struct mux_config *pinmux_pins;
61 unsigned long pinmux_pins_num;
Cyril Chemparathybd808942010-05-07 17:06:37 -040062 u32 intc_base;
Mark A. Greer673dd362009-04-15 12:40:00 -070063 int intc_type;
64 u8 *intc_irq_prios;
65 unsigned long intc_irq_num;
Cyril Chemparathybd808942010-05-07 17:06:37 -040066 u32 *intc_host_map;
Mark A. Greerf64691b2009-04-15 12:40:11 -070067 struct davinci_timer_info *timer_info;
Cyril Chemparathy686b6342010-05-01 18:37:54 -040068 int gpio_type;
Cyril Chemparathyb8d44292010-05-07 17:06:32 -040069 u32 gpio_base;
Mark A. Greera9949552009-04-15 12:40:35 -070070 unsigned gpio_num;
71 unsigned gpio_irq;
David Brownell7a360712009-06-25 17:01:31 -070072 unsigned gpio_unbanked;
Cyril Chemparathyc12f4152010-05-01 18:37:53 -040073 struct davinci_gpio_controller *gpio_ctlrs;
74 int gpio_ctlrs_num;
Mark A. Greer65e866a2009-03-18 12:36:08 -050075 struct platform_device *serial_dev;
Mark A. Greer972412b2009-04-15 12:40:56 -070076 struct emac_platform_data *emac_pdata;
David Brownell0d04eb42009-04-30 17:35:48 -070077 dma_addr_t sram_dma;
78 unsigned sram_len;
Mark A. Greer79c3c0b2009-04-15 12:38:58 -070079};
80
81extern struct davinci_soc_info davinci_soc_info;
82
83extern void davinci_common_init(struct davinci_soc_info *soc_info);
Sergei Shtylyov7a9978a2010-04-21 18:11:33 +040084extern void davinci_init_ide(void);
Robin Holt7b6d8642013-07-08 16:01:40 -070085void davinci_restart(enum reboot_mode mode, const char *cmd);
Shawn Guo3aa3e842012-04-26 09:45:39 +080086void davinci_init_late(void);
87
88#ifdef CONFIG_DAVINCI_RESET_CLOCKS
89int davinci_clk_disable_unused(void);
90#else
91static inline int davinci_clk_disable_unused(void) { return 0; }
92#endif
93
94#ifdef CONFIG_CPU_FREQ
95int davinci_cpufreq_init(void);
96#else
97static inline int davinci_cpufreq_init(void) { return 0; }
98#endif
99
100#ifdef CONFIG_SUSPEND
101int davinci_pm_init(void);
102#else
103static inline int davinci_pm_init(void) { return 0; }
104#endif
Mark A. Greer79c3c0b2009-04-15 12:38:58 -0700105
David Brownell0d04eb42009-04-30 17:35:48 -0700106#define SRAM_SIZE SZ_128K
107
Kevin Hilman7c6337e2007-04-30 19:37:19 +0100108#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */