85d02d501b637aad6f3ef67232664d63ae567d76
[linux-2.6.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 #include <linux/memory.h>
28
29 #define ADD_FIXED_VOLTAGE_REG(_name)    (&_name##_fixed_voltage_device)
30
31 /* Macro for defining fixed voltage regulator */
32 #define FIXED_VOLTAGE_REG_INIT(_id, _name, _microvolts, _gpio,          \
33                 _startup_delay, _enable_high, _enabled_at_boot,         \
34                 _valid_ops_mask, _always_on)                            \
35         static struct regulator_init_data _name##_initdata = {          \
36                 .consumer_supplies = _name##_consumer_supply,           \
37                 .num_consumer_supplies =                                \
38                                 ARRAY_SIZE(_name##_consumer_supply),    \
39                 .constraints = {                                        \
40                         .valid_ops_mask = _valid_ops_mask ,             \
41                         .always_on = _always_on,                        \
42                 },                                                      \
43         };                                                              \
44         static struct fixed_voltage_config _name##_config = {           \
45                 .supply_name            = #_name,                       \
46                 .microvolts             = _microvolts,                  \
47                 .gpio                   = _gpio,                        \
48                 .startup_delay          = _startup_delay,               \
49                 .enable_high            = _enable_high,                 \
50                 .enabled_at_boot        = _enabled_at_boot,             \
51                 .init_data              = &_name##_initdata,            \
52         };                                                              \
53         static struct platform_device _name##_fixed_voltage_device = {  \
54                 .name                   = "reg-fixed-voltage",          \
55                 .id                     = _id,                          \
56                 .dev                    = {                             \
57                         .platform_data  = &_name##_config,              \
58                 },                                                      \
59         }
60
61 #if defined(CONFIG_TEGRA_NVMAP)
62 #define NVMAP_HEAP_CARVEOUT_IRAM_INIT   \
63         {       .name           = "iram",                                       \
64                 .usage_mask     = NVMAP_HEAP_CARVEOUT_IRAM,                     \
65                 .base           = TEGRA_IRAM_BASE + TEGRA_RESET_HANDLER_SIZE,   \
66                 .size           = TEGRA_IRAM_SIZE - TEGRA_RESET_HANDLER_SIZE,   \
67                 .buddy_size     = 0, /* no buddy allocation for IRAM */         \
68         }
69 #endif
70
71 /* This information is passed by bootloader */
72 #define COMMCHIP_UNKNOWN                0
73 #define COMMCHIP_NOCHIP                 1
74 #define COMMCHIP_BROADCOM_BCM4329       2
75 #define COMMCHIP_BROADCOM_BCM4330       3
76 #define COMMCHIP_MARVELL_SD8797         4
77 #define COMMCHIP_TI_WL18XX              5
78
79 struct memory_accessor;
80
81 void tegra_assert_system_reset(char mode, const char *cmd);
82 void get_mac_addr(struct memory_accessor *, void *);
83
84 void __init tegra_init_early(void);
85 void __init tegra_mc_init(void);
86 void __init tegra_map_common_io(void);
87 void __init tegra_init_irq(void);
88 void __init tegra_init_clock(void);
89 void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
90         unsigned long fb2_size);
91 /* FIXME: The following needs to move common.h when arm_soc_desc is
92           introduced in a future version of the kernel */
93 #ifdef CONFIG_CACHE_L2X0
94 void tegra_init_cache(bool init);
95 #else
96 static inline void tegra_init_cache(bool init) {}
97 #endif
98 void __init tegra_ram_console_debug_reserve(unsigned long ram_console_size);
99 void __init tegra_ram_console_debug_init(void);
100 void __init tegra_release_bootloader_fb(void);
101 void __init tegra_protected_aperture_init(unsigned long aperture);
102 int  __init tegra_init_board_info(void);
103 void tegra_move_framebuffer(unsigned long to, unsigned long from,
104         unsigned long size);
105 bool is_tegra_debug_uartport_hs(void);
106 int get_tegra_uart_debug_port_id(void);
107 int arb_lost_recovery(int scl_gpio, int sda_gpio);
108
109 extern unsigned long tegra_bootloader_fb_start;
110 extern unsigned long tegra_bootloader_fb_size;
111 extern unsigned long tegra_fb_start;
112 extern unsigned long tegra_fb_size;
113 extern unsigned long tegra_fb2_start;
114 extern unsigned long tegra_fb2_size;
115 extern unsigned long tegra_carveout_start;
116 extern unsigned long tegra_carveout_size;
117 extern unsigned long tegra_vpr_start;
118 extern unsigned long tegra_vpr_size;
119 extern unsigned long tegra_lp0_vec_start;
120 extern unsigned long tegra_lp0_vec_size;
121 extern bool tegra_lp0_vec_relocate;
122 extern unsigned long tegra_grhost_aperture;
123
124 extern struct sys_timer tegra_timer;
125
126 enum board_fab {
127         BOARD_FAB_A = 0,
128         BOARD_FAB_B,
129         BOARD_FAB_C,
130         BOARD_FAB_D,
131 };
132
133 struct board_info {
134         u16 board_id;
135         u16 sku;
136         u8  fab;
137         u8  major_revision;
138         u8  minor_revision;
139 };
140
141 enum panel_type {
142         panel_type_lvds = 0,
143         panel_type_dsi,
144 };
145
146 enum audio_codec_type {
147         audio_codec_none,
148         audio_codec_wm8903,
149 };
150
151 enum image_type {
152         system_image = 0,
153         rck_image,
154 };
155
156 void tegra_get_board_info(struct board_info *);
157 void tegra_get_pmu_board_info(struct board_info *bi);
158 void tegra_get_display_board_info(struct board_info *bi);
159 void tegra_get_camera_board_info(struct board_info *bi);
160
161 #ifdef CONFIG_TEGRA_CONVSERVATIVE_GOV_ON_EARLYSUPSEND
162 #define MAX_GOV_NAME_LEN 16
163 extern char cpufreq_default_gov[][MAX_GOV_NAME_LEN];
164 extern char *cpufreq_conservative_gov;
165
166 void cpufreq_store_default_gov(void);
167 void cpufreq_restore_default_gov(void);
168 void cpufreq_change_gov(char *target_gov);
169 #endif
170
171 int get_core_edp(void);
172 enum panel_type get_panel_type(void);
173 int tegra_get_modem_id(void);
174 int tegra_get_commchip_id(void);
175 enum power_supply_type get_power_supply_type(void);
176 enum audio_codec_type get_audio_codec_type(void);
177 int get_maximum_cpu_current_supported(void);
178 enum image_type get_tegra_image_type(void);
179
180 #endif