8b2a51ad945f31e8cc25c5909267013413d71d49
[linux-3.10.git] / arch / arm / mach-tegra / board.h
1 /*
2  * arch/arm/mach-tegra/board.h
3  *
4  * Copyright (C) 2010 Google, Inc.
5  * Copyright (C) 2011-2012 NVIDIA Corporation.
6  *
7  * Author:
8  *      Colin Cross <ccross@google.com>
9  *      Erik Gilling <konkers@google.com>
10  *
11  * This software is licensed under the terms of the GNU General Public
12  * License version 2, as published by the Free Software Foundation, and
13  * may be copied, distributed, and modified under those terms.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  */
21
22 #ifndef __MACH_TEGRA_BOARD_H
23 #define __MACH_TEGRA_BOARD_H
24
25 #include <linux/types.h>
26 #include <linux/power_supply.h>
27
28 #define ADD_FIXED_VOLTAGE_REG(_name)    (&_name##_fixed_voltage_device)
29
30 /* Macro for defining fixed voltage regulator */
31 #define FIXED_VOLTAGE_REG_INIT(_id, _name, _microvolts, _gpio,          \
32                 _startup_delay, _enable_high, _enabled_at_boot,         \
33                 _valid_ops_mask, _always_on)                            \
34         static struct regulator_init_data _name##_initdata = {          \
35                 .consumer_supplies = _name##_consumer_supply,           \
36                 .num_consumer_supplies =                                \
37                                 ARRAY_SIZE(_name##_consumer_supply),    \
38                 .constraints = {                                        \
39                         .valid_ops_mask = _valid_ops_mask ,             \
40                         .always_on = _always_on,                        \
41                 },                                                      \
42         };                                                              \
43         static struct fixed_voltage_config _name##_config = {           \
44                 .supply_name            = #_name,                       \
45                 .microvolts             = _microvolts,                  \
46                 .gpio                   = _gpio,                        \
47                 .startup_delay          = _startup_delay,               \
48                 .enable_high            = _enable_high,                 \
49                 .enabled_at_boot        = _enabled_at_boot,             \
50                 .init_data              = &_name##_initdata,            \
51         };                                                              \
52         static struct platform_device _name##_fixed_voltage_device = {  \
53                 .name                   = "reg-fixed-voltage",          \
54                 .id                     = _id,                          \
55                 .dev                    = {                             \
56                         .platform_data  = &_name##_config,              \
57                 },                                                      \
58         }
59
60 #if defined(CONFIG_TEGRA_NVMAP)
61 #define NVMAP_HEAP_CARVEOUT_IRAM_INIT   \
62         {       .name           = "iram",                                       \
63                 .usage_mask     = NVMAP_HEAP_CARVEOUT_IRAM,                     \
64                 .base           = TEGRA_IRAM_BASE + TEGRA_RESET_HANDLER_SIZE,   \
65                 .size           = TEGRA_IRAM_SIZE - TEGRA_RESET_HANDLER_SIZE,   \
66                 .buddy_size     = 0, /* no buddy allocation for IRAM */         \
67         }
68 #endif
69
70 struct memory_accessor;
71
72 void tegra_assert_system_reset(char mode, const char *cmd);
73
74 void __init tegra20_init_early(void);
75 void __init tegra30_init_early(void);
76 void __init tegra_map_common_io(void);
77 void __init tegra_init_irq(void);
78 void __init tegra_dt_init_irq(void);
79 void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
80         unsigned long fb2_size);
81 /* FIXME: The following needs to move common.h when arm_soc_desc is
82           introduced in a future version of the kernel */
83 #ifdef CONFIG_CACHE_L2X0
84 void tegra_init_cache(bool init);
85 #else
86 static inline void tegra_init_cache(bool init) {}
87 #endif
88 void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size);
89 void __init tegra_ram_console_debug_init(void);
90 void __init tegra_release_bootloader_fb(void);
91 void __init tegra_protected_aperture_init(unsigned long aperture);
92 int  __init tegra_init_board_info(void);
93 void tegra_move_framebuffer(unsigned long to, unsigned long from,
94         unsigned long size);
95 bool is_tegra_debug_uartport_hs(void);
96 int get_tegra_uart_debug_port_id(void);
97
98 extern unsigned long tegra_bootloader_fb_start;
99 extern unsigned long tegra_bootloader_fb_size;
100 extern unsigned long tegra_fb_start;
101 extern unsigned long tegra_fb_size;
102 extern unsigned long tegra_fb2_start;
103 extern unsigned long tegra_fb2_size;
104 extern unsigned long tegra_carveout_start;
105 extern unsigned long tegra_carveout_size;
106 extern unsigned long tegra_vpr_start;
107 extern unsigned long tegra_vpr_size;
108 extern unsigned long tegra_lp0_vec_start;
109 extern unsigned long tegra_lp0_vec_size;
110 extern bool tegra_lp0_vec_relocate;
111 extern unsigned long tegra_grhost_aperture;
112
113 void tegra_init_late(void);
114
115 #ifdef CONFIG_DEBUG_FS
116 int tegra_clk_debugfs_init(void);
117 #else
118 static inline int tegra_clk_debugfs_init(void) { return 0; }
119 #endif
120
121 #if defined(CONFIG_ARCH_TEGRA_2x_SOC) && defined(CONFIG_DEBUG_FS)
122 int __init tegra_powergate_debugfs_init(void);
123 #else
124 static inline int tegra_powergate_debugfs_init(void) { return 0; }
125 #endif
126
127 int __init harmony_regulator_init(void);
128 #ifdef CONFIG_TEGRA_PCI
129 int __init harmony_pcie_init(void);
130 #else
131 static inline int harmony_pcie_init(void) { return 0; }
132 #endif
133
134 void __init tegra_paz00_wifikill_init(void);
135
136 extern void tegra_init_timer(void);
137
138 enum board_fab {
139         BOARD_FAB_A = 0,
140         BOARD_FAB_B,
141         BOARD_FAB_C,
142         BOARD_FAB_D,
143 };
144
145 struct board_info {
146         u16 board_id;
147         u16 sku;
148         u8  fab;
149         u8  major_revision;
150         u8  minor_revision;
151 };
152
153 enum panel_type {
154         panel_type_lvds = 0,
155         panel_type_dsi,
156 };
157
158 enum audio_codec_type {
159         audio_codec_none,
160         audio_codec_wm8903,
161 };
162
163 enum image_type {
164         system_image = 0,
165         rck_image,
166 };
167
168 void tegra_get_board_info(struct board_info *);
169 void tegra_get_pmu_board_info(struct board_info *bi);
170 void tegra_get_display_board_info(struct board_info *bi);
171 void tegra_get_camera_board_info(struct board_info *bi);
172
173 int get_core_edp(void);
174 enum panel_type get_panel_type(void);
175 int tegra_get_modem_id(void);
176 enum power_supply_type get_power_supply_type(void);
177 enum audio_codec_type get_audio_codec_type(void);
178 int get_maximum_cpu_current_supported(void);
179 void tegra_enable_pinmux(void);
180 enum image_type get_tegra_image_type(void);
181
182 #endif