Kevin Hilman | 7c6337e | 2007-04-30 19:37:19 +0100 | [diff] [blame] | 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 | |
Thomas Koeller | 280faff | 2010-04-21 15:33:32 +0200 | [diff] [blame] | 15 | #include <linux/compiler.h> |
| 16 | #include <linux/types.h> |
| 17 | |
Kevin Hilman | 7c6337e | 2007-04-30 19:37:19 +0100 | [diff] [blame] | 18 | struct sys_timer; |
| 19 | |
| 20 | extern struct sys_timer davinci_timer; |
| 21 | |
Kevin Hilman | d0e47fb | 2009-04-14 11:30:11 -0500 | [diff] [blame] | 22 | extern void davinci_irq_init(void); |
Mark A. Greer | 673dd36 | 2009-04-15 12:40:00 -0700 | [diff] [blame] | 23 | extern void __iomem *davinci_intc_base; |
Mark A. Greer | 0b0c4c2 | 2009-04-15 12:41:40 -0700 | [diff] [blame] | 24 | extern int davinci_intc_type; |
Kevin Hilman | d0e47fb | 2009-04-14 11:30:11 -0500 | [diff] [blame] | 25 | |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 26 | struct davinci_timer_instance { |
Cyril Chemparathy | 1bcd38a | 2010-05-07 17:06:35 -0400 | [diff] [blame] | 27 | u32 base; |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 28 | u32 bottom_irq; |
| 29 | u32 top_irq; |
Mark A. Greer | 3abd5ac | 2009-04-15 12:41:54 -0700 | [diff] [blame] | 30 | unsigned long cmp_off; |
| 31 | unsigned int cmp_irq; |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | struct davinci_timer_info { |
| 35 | struct davinci_timer_instance *timers; |
| 36 | unsigned int clockevent_id; |
| 37 | unsigned int clocksource_id; |
| 38 | }; |
| 39 | |
Cyril Chemparathy | c12f415 | 2010-05-01 18:37:53 -0400 | [diff] [blame] | 40 | struct davinci_gpio_controller; |
| 41 | |
Cyril Chemparathy | bcd6a1c | 2010-05-07 17:06:39 -0400 | [diff] [blame] | 42 | /* |
| 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. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 49 | struct davinci_soc_info { |
| 50 | struct map_desc *io_desc; |
| 51 | unsigned long io_desc_num; |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 52 | u32 cpu_id; |
| 53 | u32 jtag_id; |
Cyril Chemparathy | 3347db8 | 2010-05-07 17:06:34 -0400 | [diff] [blame] | 54 | u32 jtag_id_reg; |
Mark A. Greer | b9ab127 | 2009-04-15 12:39:09 -0700 | [diff] [blame] | 55 | struct davinci_id *ids; |
| 56 | unsigned long ids_num; |
Kevin Hilman | 08aca08 | 2010-01-11 08:22:23 -0800 | [diff] [blame] | 57 | struct clk_lookup *cpu_clks; |
Cyril Chemparathy | e4c822c | 2010-05-07 17:06:36 -0400 | [diff] [blame] | 58 | u32 *psc_bases; |
Mark A. Greer | d81d188 | 2009-04-15 12:39:33 -0700 | [diff] [blame] | 59 | unsigned long psc_bases_num; |
Cyril Chemparathy | 779b0d5 | 2010-05-07 17:06:38 -0400 | [diff] [blame] | 60 | u32 pinmux_base; |
Mark A. Greer | 0e58595 | 2009-04-15 12:39:48 -0700 | [diff] [blame] | 61 | const struct mux_config *pinmux_pins; |
| 62 | unsigned long pinmux_pins_num; |
Cyril Chemparathy | bd80894 | 2010-05-07 17:06:37 -0400 | [diff] [blame] | 63 | u32 intc_base; |
Mark A. Greer | 673dd36 | 2009-04-15 12:40:00 -0700 | [diff] [blame] | 64 | int intc_type; |
| 65 | u8 *intc_irq_prios; |
| 66 | unsigned long intc_irq_num; |
Cyril Chemparathy | bd80894 | 2010-05-07 17:06:37 -0400 | [diff] [blame] | 67 | u32 *intc_host_map; |
Mark A. Greer | f64691b | 2009-04-15 12:40:11 -0700 | [diff] [blame] | 68 | struct davinci_timer_info *timer_info; |
Cyril Chemparathy | 686b634 | 2010-05-01 18:37:54 -0400 | [diff] [blame] | 69 | int gpio_type; |
Cyril Chemparathy | b8d4429 | 2010-05-07 17:06:32 -0400 | [diff] [blame] | 70 | u32 gpio_base; |
Mark A. Greer | a994955 | 2009-04-15 12:40:35 -0700 | [diff] [blame] | 71 | unsigned gpio_num; |
| 72 | unsigned gpio_irq; |
David Brownell | 7a36071 | 2009-06-25 17:01:31 -0700 | [diff] [blame] | 73 | unsigned gpio_unbanked; |
Cyril Chemparathy | c12f415 | 2010-05-01 18:37:53 -0400 | [diff] [blame] | 74 | struct davinci_gpio_controller *gpio_ctlrs; |
| 75 | int gpio_ctlrs_num; |
Mark A. Greer | 65e866a | 2009-03-18 12:36:08 -0500 | [diff] [blame] | 76 | struct platform_device *serial_dev; |
Mark A. Greer | 972412b | 2009-04-15 12:40:56 -0700 | [diff] [blame] | 77 | struct emac_platform_data *emac_pdata; |
David Brownell | 0d04eb4 | 2009-04-30 17:35:48 -0700 | [diff] [blame] | 78 | dma_addr_t sram_dma; |
| 79 | unsigned sram_len; |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | extern struct davinci_soc_info davinci_soc_info; |
| 83 | |
| 84 | extern void davinci_common_init(struct davinci_soc_info *soc_info); |
Sergei Shtylyov | 7a9978a | 2010-04-21 18:11:33 +0400 | [diff] [blame] | 85 | extern void davinci_init_ide(void); |
Sekhar Nori | c6121dd | 2011-12-05 11:29:46 +0100 | [diff] [blame] | 86 | void davinci_restart(char mode, const char *cmd); |
Shawn Guo | 3aa3e84 | 2012-04-26 09:45:39 +0800 | [diff] [blame] | 87 | void davinci_init_late(void); |
| 88 | |
| 89 | #ifdef CONFIG_DAVINCI_RESET_CLOCKS |
| 90 | int davinci_clk_disable_unused(void); |
| 91 | #else |
| 92 | static inline int davinci_clk_disable_unused(void) { return 0; } |
| 93 | #endif |
| 94 | |
| 95 | #ifdef CONFIG_CPU_FREQ |
| 96 | int davinci_cpufreq_init(void); |
| 97 | #else |
| 98 | static inline int davinci_cpufreq_init(void) { return 0; } |
| 99 | #endif |
| 100 | |
| 101 | #ifdef CONFIG_SUSPEND |
| 102 | int davinci_pm_init(void); |
| 103 | #else |
| 104 | static inline int davinci_pm_init(void) { return 0; } |
| 105 | #endif |
Mark A. Greer | 79c3c0b | 2009-04-15 12:38:58 -0700 | [diff] [blame] | 106 | |
David Brownell | 0d04eb4 | 2009-04-30 17:35:48 -0700 | [diff] [blame] | 107 | #define SRAM_SIZE SZ_128K |
| 108 | |
Kevin Hilman | 7c6337e | 2007-04-30 19:37:19 +0100 | [diff] [blame] | 109 | #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */ |