blob: 0b3c169758edb8c1f0b059b273fcc9439f65bc44 [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. Greer972412b2009-04-15 12:40:56 -070075 struct emac_platform_data *emac_pdata;
David Brownell0d04eb42009-04-30 17:35:48 -070076 dma_addr_t sram_dma;
77 unsigned sram_len;
Mark A. Greer79c3c0b2009-04-15 12:38:58 -070078};
79
80extern struct davinci_soc_info davinci_soc_info;
81
82extern void davinci_common_init(struct davinci_soc_info *soc_info);
Sergei Shtylyov7a9978a2010-04-21 18:11:33 +040083extern void davinci_init_ide(void);
Robin Holt7b6d8642013-07-08 16:01:40 -070084void davinci_restart(enum reboot_mode mode, const char *cmd);
Shawn Guo3aa3e842012-04-26 09:45:39 +080085void davinci_init_late(void);
86
87#ifdef CONFIG_DAVINCI_RESET_CLOCKS
88int davinci_clk_disable_unused(void);
89#else
90static inline int davinci_clk_disable_unused(void) { return 0; }
91#endif
92
93#ifdef CONFIG_CPU_FREQ
94int davinci_cpufreq_init(void);
95#else
96static inline int davinci_cpufreq_init(void) { return 0; }
97#endif
98
99#ifdef CONFIG_SUSPEND
100int davinci_pm_init(void);
101#else
102static inline int davinci_pm_init(void) { return 0; }
103#endif
Mark A. Greer79c3c0b2009-04-15 12:38:58 -0700104
David Brownell0d04eb42009-04-30 17:35:48 -0700105#define SRAM_SIZE SZ_128K
106
Kevin Hilman7c6337e2007-04-30 19:37:19 +0100107#endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */