ARM: tegra12: set CPU rate to 2.2GHz for sku 0x87
[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-2014, NVIDIA CORPORATION.  All rights reserved.
6  *
7  * Author:
8  *      Colin Cross <ccross@google.com>
9  *      Erik Gilling <konkers@google.com>
10  *
11  * This program is free software; you can redistribute it and/or modify it
12  * under the terms and conditions of the GNU General Public License,
13  * version 2, as published by the Free Software Foundation.
14  *
15  * This program is distributed in the hope it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
18  * more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22  */
23
24 #ifndef __MACH_TEGRA_BOARD_H
25 #define __MACH_TEGRA_BOARD_H
26
27 #include <linux/types.h>
28 #include <linux/errno.h>
29 #include <linux/power_supply.h>
30 #include <linux/memory.h>
31
32 #include <mach/tegra_smmu.h>
33
34 #ifdef CONFIG_TEGRA_NVDUMPER
35 #define NVDUMPER_RESERVED_SIZE 4096UL
36 #endif
37
38 #define ADD_FIXED_VOLTAGE_REG(_name)    (&_name##_fixed_voltage_device)
39
40 /* Macro for defining fixed voltage regulator */
41 #define FIXED_VOLTAGE_REG_INIT(_id, _name, _microvolts, _gpio,          \
42                 _startup_delay, _enable_high, _enabled_at_boot,         \
43                 _valid_ops_mask, _always_on)                            \
44         static struct regulator_init_data _name##_initdata = {          \
45                 .consumer_supplies = _name##_consumer_supply,           \
46                 .num_consumer_supplies =                                \
47                                 ARRAY_SIZE(_name##_consumer_supply),    \
48                 .constraints = {                                        \
49                         .valid_ops_mask = _valid_ops_mask ,             \
50                         .always_on = _always_on,                        \
51                 },                                                      \
52         };                                                              \
53         static struct fixed_voltage_config _name##_config = {           \
54                 .supply_name            = #_name,                       \
55                 .microvolts             = _microvolts,                  \
56                 .gpio                   = _gpio,                        \
57                 .startup_delay          = _startup_delay,               \
58                 .enable_high            = _enable_high,                 \
59                 .enabled_at_boot        = _enabled_at_boot,             \
60                 .init_data              = &_name##_initdata,            \
61         };                                                              \
62         static struct platform_device _name##_fixed_voltage_device = {  \
63                 .name                   = "reg-fixed-voltage",          \
64                 .id                     = _id,                          \
65                 .dev                    = {                             \
66                         .platform_data  = &_name##_config,              \
67                 },                                                      \
68         }
69
70 #if defined(CONFIG_TEGRA_NVMAP)
71 #define NVMAP_HEAP_CARVEOUT_IRAM_INIT   \
72         {       .name           = "iram",                                       \
73                 .usage_mask     = NVMAP_HEAP_CARVEOUT_IRAM,                     \
74                 .base           = TEGRA_IRAM_BASE + TEGRA_RESET_HANDLER_SIZE,   \
75                 .size           = TEGRA_IRAM_SIZE - TEGRA_RESET_HANDLER_SIZE,   \
76                 .buddy_size     = 0, /* no buddy allocation for IRAM */         \
77         }
78 #endif
79
80 /* This information is passed by bootloader */
81 #define COMMCHIP_DEFAULT                0
82 #define COMMCHIP_NOCHIP                 1
83 #define COMMCHIP_BROADCOM_BCM4329       2
84 #define COMMCHIP_BROADCOM_BCM4330       3
85 #define COMMCHIP_MARVELL_SD8797         4
86 #define COMMCHIP_TI_WL18XX              5
87 #define COMMCHIP_BROADCOM_BCM43241      6
88
89 struct memory_accessor;
90
91 void tegra_assert_system_reset(char mode, const char *cmd);
92
93 void __init tegra20_init_early(void);
94 void __init tegra30_init_early(void);
95 void __init tegra11x_init_early(void);
96 void __init tegra12x_init_early(void);
97 void __init tegra14x_init_early(void);
98 void __init tegra_map_common_io(void);
99 void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
100         unsigned long fb2_size);
101 int __init tegra_release_bootloader_fb(void);
102 void __init tegra_protected_aperture_init(unsigned long aperture);
103 int  __init tegra_init_board_info(void);
104 void __tegra_move_framebuffer(struct platform_device *pdev,
105                               phys_addr_t to, phys_addr_t from,
106                               size_t size);
107 static inline void tegra_move_framebuffer(phys_addr_t to, phys_addr_t from,
108                                           size_t size)
109 {
110         __tegra_move_framebuffer(NULL, to, from, size);
111 }
112 void __tegra_clear_framebuffer(struct platform_device *pdev,
113                                unsigned long to, unsigned long size);
114 static inline void tegra_clear_framebuffer(unsigned long to, unsigned long size)
115 {
116         __tegra_clear_framebuffer(NULL, to, size);
117 }
118 bool is_tegra_debug_uartport_hs(void);
119 int get_tegra_uart_debug_port_id(void);
120 bool is_uart_over_sd_enabled(void);
121 int get_sd_uart_port_id(void);
122 void set_sd_uart_port_id(int);
123 int __init tegra_register_fuse(void);
124
125 extern phys_addr_t tegra_bootloader_fb_start;
126 extern phys_addr_t tegra_bootloader_fb_size;
127 extern phys_addr_t tegra_bootloader_fb2_start;
128 extern phys_addr_t tegra_bootloader_fb2_size;
129 extern phys_addr_t tegra_fb_start;
130 extern phys_addr_t tegra_fb_size;
131 extern phys_addr_t tegra_fb2_start;
132 extern phys_addr_t tegra_fb2_size;
133 extern phys_addr_t tegra_carveout_start;
134 extern phys_addr_t tegra_carveout_size;
135 extern phys_addr_t tegra_vpr_start;
136 extern phys_addr_t tegra_vpr_size;
137 extern phys_addr_t tegra_lp0_vec_start;
138 extern phys_addr_t tegra_lp0_vec_size;
139 #if defined(CONFIG_ARCH_TEGRA_14x_SOC)
140 extern phys_addr_t tegra_wb0_params_address;
141 extern phys_addr_t tegra_wb0_params_instances;
142 extern phys_addr_t tegra_wb0_params_block_size;
143 #endif
144 #ifdef CONFIG_TEGRA_NVDUMPER
145 extern unsigned long nvdumper_reserved;
146 #endif
147 extern bool tegra_lp0_vec_relocate;
148 extern unsigned long tegra_grhost_aperture;
149 #ifdef CONFIG_TEGRA_USE_NCT
150 /* info for NCK(NCT for Kernel) carveout area */
151 extern unsigned long tegra_nck_start;
152 extern unsigned long tegra_nck_size;
153 #endif
154
155 #ifdef CONFIG_TEGRA_IOMMU_SMMU
156 void tegra_fb_linear_set(struct iommu_linear_map *map);
157 #else
158 static inline void tegra_fb_linear_set(struct iommu_linear_map *map) {}
159 #endif
160
161 #ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
162 void carveout_linear_set(struct device *cma_dev);
163 #else
164 static inline void carveout_linear_set(struct device *cma_dev) {}
165 #endif
166
167 void tegra_init_late(void);
168
169 #ifdef CONFIG_DEBUG_FS
170 int tegra_clk_debugfs_init(void);
171 #else
172 static inline int tegra_clk_debugfs_init(void) { return 0; }
173 #endif
174
175 #if defined(CONFIG_DEBUG_FS)
176 int __init tegra_powergate_debugfs_init(void);
177 #else
178 static inline int tegra_powergate_debugfs_init(void) { return 0; }
179 #endif
180
181 int __init harmony_regulator_init(void);
182 #ifdef CONFIG_TEGRA_PCI
183 int __init harmony_pcie_init(void);
184 #else
185 static inline int harmony_pcie_init(void) { return 0; }
186 #endif
187
188 void __init tegra_paz00_wifikill_init(void);
189
190 enum board_fab {
191         BOARD_FAB_A = 0,
192         BOARD_FAB_B,
193         BOARD_FAB_C,
194         BOARD_FAB_D,
195 };
196
197 struct board_info {
198         u16 board_id;
199         u16 sku;
200         u8  fab;
201         u8  major_revision;
202         u8  minor_revision;
203 };
204
205 enum panel_type {
206         panel_type_lvds = 0,
207         panel_type_dsi,
208 };
209
210 enum touch_vendor {
211         RAYDIUM_TOUCH = 0,
212         SYNAPTIC_TOUCH,
213         MAXIM_TOUCH,
214         VENDOR_NONE,
215 };
216
217 enum touch_panel {
218         TOUCHPANEL_RESERVED = 0,
219         TOUCHPANEL_WINTEK,
220         TOUCHPANEL_TPK,
221         TOUCHPANEL_TOUCHTURNS,
222         TOUCHPANEL_THOR_WINTEK,
223         TOUCHPANEL_LOKI_WINTEK_5_66_UNLAMIN,
224         TOUCHPANEL_TN7,
225         TOUCHPANEL_TN8,
226 };
227
228 enum audio_codec_type {
229         audio_codec_none,
230         audio_codec_wm8903,
231 };
232
233 enum image_type {
234         system_image = 0,
235         rck_image,
236 };
237
238 void tegra_get_board_info(struct board_info *);
239 void tegra_get_pmu_board_info(struct board_info *bi);
240 void tegra_get_display_board_info(struct board_info *bi);
241 void tegra_get_camera_board_info(struct board_info *bi);
242 void tegra_get_io_board_info(struct board_info *bi);
243 void tegra_get_button_board_info(struct board_info *bi);
244 void tegra_get_joystick_board_info(struct board_info *bi);
245 void tegra_get_rightspeaker_board_info(struct board_info *bi);
246 void tegra_get_leftspeaker_board_info(struct board_info *bi);
247 int tegra_get_board_panel_id(void);
248 int tegra_get_touch_vendor_id(void);
249 int tegra_get_touch_panel_id(void);
250
251 int get_core_edp(void);
252 enum panel_type get_panel_type(void);
253 int tegra_get_usb_port_owner_info(void);
254 int tegra_get_modem_id(void);
255 int tegra_get_commchip_id(void);
256 u8 get_power_config(void);
257 u8 get_display_config(void);
258 enum power_supply_type get_power_supply_type(void);
259 enum audio_codec_type get_audio_codec_type(void);
260 int get_maximum_cpu_current_supported(void);
261 int get_maximum_core_current_supported(void);
262 int get_emc_max_dvfs(void);
263 int tegra_get_memory_type(void);
264 enum image_type get_tegra_image_type(void);
265 int tegra_get_cvb_alignment_uV(void);
266 int tegra_soc_device_init(const char *machine);
267 int get_pwr_i2c_clk_rate(void);
268 bool is_pmic_wdt_disabled_at_boot(void);
269
270 extern void tegra_set_usb_vbus_internal_wake(bool enable);
271 extern void tegra_set_usb_id_internal_wake(bool enable);
272 #endif