blob: 9c850e56bc31a68a2eff3c25fd357e40adf06de8 [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
David Ng183a7422009-12-07 14:55:21 -080062__WEAK int target_is_emmc_boot(void)
63{
David Ng025c1d92009-12-09 23:46:00 -080064#if _EMMC_BOOT
65 return 1;
66#else
David Ng183a7422009-12-07 14:55:21 -080067 return 0;
David Ng025c1d92009-12-09 23:46:00 -080068#endif
David Ng183a7422009-12-07 14:55:21 -080069}
Chandan Uddarajude85d3f2010-01-05 16:32:33 -080070
71__WEAK unsigned check_reboot_mode(void)
72{
73 return 0;
74}
Chandan Uddaraju94183c02010-01-15 15:13:59 -080075
lijuangc518f5d2015-02-10 10:22:53 +080076__WEAK unsigned check_hard_reboot_mode(void)
77{
78 return 0;
79}
80
Chandan Uddaraju94183c02010-01-15 15:13:59 -080081__WEAK void reboot_device(unsigned reboot_reason)
82{
83}
Chandan Uddaraju7f5b9012010-02-06 16:37:48 -080084
Matthew Qindefd5562014-07-11 18:02:40 +080085__WEAK uint32_t is_user_force_reset(void)
86{
87 return 0;
88}
89
Pavel Nedeva4c9d3a2013-05-15 14:42:34 +030090__WEAK int set_download_mode(enum dload_mode mode)
Pavel Nedev76a3e212013-05-09 10:37:21 +030091{
92 return -1;
93}
94
David Ngf773dde2010-07-26 19:55:08 -070095__WEAK unsigned target_pause_for_battery_charge(void)
96{
97 return 0;
98}
Ajay Dudanid04110c2011-01-17 23:55:07 -080099
100__WEAK unsigned target_baseband()
101{
102 return 0;
103}
Subbaraman Narayanamurthyf17b4ae2011-02-16 20:19:56 -0800104
105__WEAK void target_serialno(unsigned char *buf)
106{
Ajay Dudanif63d02f2011-10-01 08:29:53 -0700107 snprintf((char *) buf, 13, "%s",TARGET(BOARD));
Subbaraman Narayanamurthyf17b4ae2011-02-16 20:19:56 -0800108}
Amol Jadi57abe4c2011-05-24 15:47:27 -0700109
110__WEAK void target_fastboot_init()
111{
112}
Subbaraman Narayanamurthy0e445b02011-06-19 21:34:46 -0700113
114__WEAK int emmc_recovery_init(void)
115{
116 return 0;
117}
Shashank Mittalcd98d472011-08-02 14:29:24 -0700118
119__WEAK bool target_use_signed_kernel(void)
120{
121#if _SIGNED_KERNEL
122 return 1;
123#else
124 return 0;
125#endif
126}
Amol Jadi6834f1a2012-06-29 14:42:59 -0700127
Stanimir Varbanov8bc68c72013-07-08 18:22:04 +0300128__WEAK bool target_is_ssd_enabled(void)
129{
130#ifdef SSD_ENABLE
131 return 1;
132#else
133 return 0;
134#endif
135}
136
Stanimir Varbanov677001e2013-07-18 18:16:39 +0300137__WEAK void target_load_ssd_keystore(void)
138{
139}
Amol Jadi6834f1a2012-06-29 14:42:59 -0700140
141/* Default target does not support continuous splash screen feature. */
142__WEAK int target_cont_splash_screen()
143{
144 return 0;
145}
Amol Jadida118b92012-07-06 19:53:18 -0700146
147/* Default target specific initialization before using USB */
148__WEAK void target_usb_init(void)
149{
150}
151
152/* Default target specific usb shutdown */
153__WEAK void target_usb_stop(void)
154{
155}
Channagoud Kadabifa6179e2013-06-18 18:35:14 -0700156
157/* Default target specific target uninit */
158__WEAK void target_uninit(void)
159{
160}
Dhaval Patelcdcb6462013-07-18 14:46:57 -0700161
Ajay Singh Parmar430bbb32014-03-18 15:26:30 -0700162__WEAK bool target_display_panel_node(char *panel_name, char *pbuf,
163 uint16_t buf_size)
Dhaval Patelcdcb6462013-07-18 14:46:57 -0700164{
165 return false;
166}
Channagoud Kadabi9fbdcdf2013-09-19 16:24:16 -0700167
Aravind Venkateswaran6385f7e2014-02-25 16:45:11 -0800168__WEAK void target_display_init(const char *panel_name)
Aravind Venkateswarandd50c1a2014-02-25 14:42:43 -0800169{
170}
171
172__WEAK void target_display_shutdown(void)
173{
174}
175
Casey Piperf8cebb62013-09-11 15:56:17 -0700176__WEAK uint8_t target_panel_auto_detect_enabled()
177{
178 return 0;
179}
180
Casey Piper48bfc0d2013-11-18 13:24:35 -0800181__WEAK uint8_t target_is_edp()
182{
183 return 0;
184}
185
Amol Jadi417c7f22013-10-07 12:52:21 -0700186/* default usb controller to be used. */
187__WEAK const char * target_usb_controller()
188{
189 return "ci";
190}
Amol Jadi9ff7bb52013-10-11 14:11:45 -0700191
192/* override for target specific usb phy reset. */
193__WEAK void target_usb_phy_reset(void)
194{
195}
Hanumant Singh8e1ac232014-01-29 13:41:51 -0800196
197/* determine if target is in warm boot. */
198__WEAK bool target_warm_boot(void)
199{
200 return false;
201}
Aparna Mallavarapu373d38b2014-05-23 14:47:19 +0530202
203/* Determine the HLOS subtype of the target */
204__WEAK uint32_t target_get_hlos_subtype(void)
205{
206 return 0;
207}
Channagoud Kadabi82cf5c62014-08-24 22:17:34 -0700208
209/* Initialize crypto parameters */
210__WEAK void target_crypto_init_params()
211{
212}
Channagoud Kadabi41c81a62014-10-08 19:55:30 -0700213
214/* Default CFG delay value */
215__WEAK uint32_t target_ddr_cfg_val()
216{
217 return DDR_CONFIG_VAL;
218}