blob: fba226c007db5bf74393f5cb2bc34c1ee0a4af30 [file] [log] [blame]
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07001/*
Casey Pipera277d882013-10-21 10:11:04 -07002 * Copyright (c) 2008 Travis Geiselbrecht
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07003 *
lijuangc518f5d2015-02-10 10:22:53 +08004 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
5 *
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07006 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files
8 * (the "Software"), to deal in the Software without restriction,
9 * including without limitation the rights to use, copy, modify, merge,
10 * publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25#include <err.h>
26#include <debug.h>
27#include <target.h>
28#include <compiler.h>
Pavel Nedeva4c9d3a2013-05-15 14:42:34 +030029#include <dload_util.h>
Channagoud Kadabi41c81a62014-10-08 19:55:30 -070030#include <sdhci_msm.h>
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070031
Subbaraman Narayanamurthyf17b4ae2011-02-16 20:19:56 -080032#define EXPAND(NAME) #NAME
33#define TARGET(NAME) EXPAND(NAME)
Amol Jadi57abe4c2011-05-24 15:47:27 -070034/*
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070035 * default implementations of these routines, if the target code
36 * chooses not to implement.
37 */
38
39__WEAK void target_early_init(void)
40{
41}
42
43__WEAK void target_init(void)
44{
45}
46
David Ng3679bc52010-02-09 15:43:43 -080047__WEAK void *target_get_scratch_address(void)
48{
49 return (void *)(SCRATCH_ADDR);
50}
51
Vivek Mehta5f1c9d42011-04-01 20:11:59 -070052__WEAK unsigned target_get_max_flash_size(void)
53{
54 return (120 * 1024 * 1024);
55}
56
Tanya Brokhman1c94f1a2015-02-15 09:05:03 +020057__WEAK int flash_ubi_img(void)
58{
59 return 0;
60}
61
Tanya Brokhman84eaaf62015-02-24 21:57:06 +020062__WEAK int update_ubi_vol(void)
63{
64 return 0;
65}
66
David Ng183a7422009-12-07 14:55:21 -080067__WEAK int target_is_emmc_boot(void)
68{
David Ng025c1d92009-12-09 23:46:00 -080069#if _EMMC_BOOT
70 return 1;
71#else
David Ng183a7422009-12-07 14:55:21 -080072 return 0;
David Ng025c1d92009-12-09 23:46:00 -080073#endif
David Ng183a7422009-12-07 14:55:21 -080074}
Chandan Uddarajude85d3f2010-01-05 16:32:33 -080075
76__WEAK unsigned check_reboot_mode(void)
77{
78 return 0;
79}
Chandan Uddaraju94183c02010-01-15 15:13:59 -080080
lijuangc518f5d2015-02-10 10:22:53 +080081__WEAK unsigned check_hard_reboot_mode(void)
82{
83 return 0;
84}
85
Chandan Uddaraju94183c02010-01-15 15:13:59 -080086__WEAK void reboot_device(unsigned reboot_reason)
87{
88}
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -080089
Matthew Qindefd5562014-07-11 18:02:40 +080090__WEAK uint32_t is_user_force_reset(void)
91{
92 return 0;
93}
94
Pavel Nedeva4c9d3a2013-05-15 14:42:34 +030095__WEAK int set_download_mode(enum dload_mode mode)
Pavel Nedev76a3e212013-05-09 10:37:21 +030096{
97 return -1;
98}
99
David Ngf773dde2010-07-26 19:55:08 -0700100__WEAK unsigned target_pause_for_battery_charge(void)
101{
102 return 0;
103}
Ajay Dudanid04110c2011-01-17 23:55:07 -0800104
105__WEAK unsigned target_baseband()
106{
107 return 0;
108}
Subbaraman Narayanamurthyf17b4ae2011-02-16 20:19:56 -0800109
110__WEAK void target_serialno(unsigned char *buf)
111{
Ajay Dudanif63d02f2011-10-01 08:29:53 -0700112 snprintf((char *) buf, 13, "%s",TARGET(BOARD));
Subbaraman Narayanamurthyf17b4ae2011-02-16 20:19:56 -0800113}
Amol Jadi57abe4c2011-05-24 15:47:27 -0700114
115__WEAK void target_fastboot_init()
116{
117}
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700118
119__WEAK int emmc_recovery_init(void)
120{
121 return 0;
122}
Shashank Mittalcd98d472011-08-02 14:29:24 -0700123
124__WEAK bool target_use_signed_kernel(void)
125{
126#if _SIGNED_KERNEL
127 return 1;
128#else
129 return 0;
130#endif
131}
Amol Jadi6834f1a2012-06-29 14:42:59 -0700132
Stanimir Varbanov8bc68c72013-07-08 18:22:04 +0300133__WEAK bool target_is_ssd_enabled(void)
134{
135#ifdef SSD_ENABLE
136 return 1;
137#else
138 return 0;
139#endif
140}
141
Stanimir Varbanov677001e2013-07-18 18:16:39 +0300142__WEAK void target_load_ssd_keystore(void)
143{
144}
Amol Jadi6834f1a2012-06-29 14:42:59 -0700145
146/* Default target does not support continuous splash screen feature. */
147__WEAK int target_cont_splash_screen()
148{
149 return 0;
150}
Amol Jadida118b92012-07-06 19:53:18 -0700151
152/* Default target specific initialization before using USB */
153__WEAK void target_usb_init(void)
154{
155}
156
157/* Default target specific usb shutdown */
158__WEAK void target_usb_stop(void)
159{
160}
Channagoud Kadabifa6179e2013-06-18 18:35:14 -0700161
162/* Default target specific target uninit */
163__WEAK void target_uninit(void)
164{
165}
Dhaval Patelcdcb6462013-07-18 14:46:57 -0700166
Padmanabhan Komandurubccbcdc2015-06-30 16:19:24 +0530167__WEAK bool target_display_panel_node(char *pbuf, uint16_t buf_size)
Dhaval Patelcdcb6462013-07-18 14:46:57 -0700168{
169 return false;
170}
Channagoud Kadabi9fbdcdf2013-09-19 16:24:16 -0700171
Aravind Venkateswaran6385f7e2014-02-25 16:45:11 -0800172__WEAK void target_display_init(const char *panel_name)
Aravind Venkateswarandd50c1a2014-02-25 14:42:43 -0800173{
174}
175
176__WEAK void target_display_shutdown(void)
177{
178}
179
Casey Piperf8cebb62013-09-11 15:56:17 -0700180__WEAK uint8_t target_panel_auto_detect_enabled()
181{
182 return 0;
183}
184
Casey Piper48bfc0d2013-11-18 13:24:35 -0800185__WEAK uint8_t target_is_edp()
186{
187 return 0;
188}
189
Amol Jadi417c7f22013-10-07 12:52:21 -0700190/* default usb controller to be used. */
191__WEAK const char * target_usb_controller()
192{
193 return "ci";
194}
Amol Jadi9ff7bb52013-10-11 14:11:45 -0700195
196/* override for target specific usb phy reset. */
197__WEAK void target_usb_phy_reset(void)
198{
199}
Hanumant Singh8e1ac232014-01-29 13:41:51 -0800200
201/* determine if target is in warm boot. */
202__WEAK bool target_warm_boot(void)
203{
204 return false;
205}
Aparna Mallavarapu373d38b2014-05-23 14:47:19 +0530206
207/* Determine the HLOS subtype of the target */
208__WEAK uint32_t target_get_hlos_subtype(void)
209{
210 return 0;
211}
Channagoud Kadabi82cf5c62014-08-24 22:17:34 -0700212
213/* Initialize crypto parameters */
214__WEAK void target_crypto_init_params()
215{
216}
Channagoud Kadabi41c81a62014-10-08 19:55:30 -0700217
218/* Default CFG delay value */
219__WEAK uint32_t target_ddr_cfg_val()
220{
221 return DDR_CONFIG_VAL;
222}
Channagoud Kadabi2021cef2015-02-25 12:08:32 -0800223
224/* Return Build variant */
225__WEAK bool target_build_variant_user()
226{
227#if USER_BUILD_VARIANT
228 return true;
229#else
230 return false;
231#endif
232}