blob: 9044bac1291cf3029ae419cd65c0cc5778f6d65f [file] [log] [blame]
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -07001/*
2 * Copyright (c) 2008 Travis Geiselbrecht
3 *
Mayank Groverf75ddaf2019-12-27 15:00:24 +05304 * Copyright (c) 2014-2016,2019-2020 The Linux Foundation. All rights reserved.
Sundarajan Srinivasan79e5f512014-03-28 16:43:06 -07005 *
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 <platform.h>
Amol Jadi02ca2ee2013-03-15 16:06:34 -070028#include <boot_stats.h>
Sundarajan Srinivasan79e5f512014-03-28 16:43:06 -070029#include <platform/iomap.h>
P.V. Phani Kumar68d13012016-04-05 17:30:17 +053030#include <image_verify.h>
Mayank Grover324a9772019-05-08 16:06:19 +053031#include <target.h>
32#include <boot_device.h>
33#include <mmc_wrapper.h>
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070034
Amol Jadi4421e652011-06-16 15:00:48 -070035/*
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070036 * default implementations of these routines, if the platform code
37 * chooses not to implement.
38 */
Deepa Dinamani20cb9e52012-10-18 12:20:47 -070039__WEAK int platform_use_identity_mmu_mappings(void)
40{
41 return 1;
42}
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070043
44__WEAK void platform_init_mmu_mappings(void)
45{
46}
47
Deepa Dinamani20cb9e52012-10-18 12:20:47 -070048__WEAK addr_t platform_get_virt_to_phys_mapping(addr_t virt_addr)
49{
50 ASSERT(platform_use_identity_mmu_mappings());
51
52 return virt_addr;
53}
54
55__WEAK addr_t platform_get_phys_to_virt_mapping(addr_t phys_addr)
56{
57 ASSERT(platform_use_identity_mmu_mappings());
58
59 return phys_addr;
60}
61
Travis Geiselbrecht1d0df692008-09-01 02:26:09 -070062__WEAK void platform_early_init(void)
63{
64}
65
66__WEAK void platform_init(void)
67{
68}
69
Chandan Uddaraju24120502009-12-12 19:17:04 -080070__WEAK void display_init(void)
71{
72}
Shashank Mittal23b8f422010-04-16 19:27:21 -070073
Shashank Mittalc648e712010-10-06 18:37:42 -070074__WEAK void display_shutdown(void)
75{
76}
77
Chandan Uddaraju14e57eb2010-06-28 12:11:06 -070078__WEAK void platform_config_interleaved_mode_gpios(void)
79{
80}
Shashank Mittaled177732011-05-06 19:12:59 -070081
82__WEAK void uart_clock_init(void)
83{
84}
85
Amol Jadi4421e652011-06-16 15:00:48 -070086__WEAK void platform_uninit(void)
87{
88}
Shashank Mittalcd98d472011-08-02 14:29:24 -070089
90__WEAK int image_verify(unsigned char * image_ptr,
91 unsigned char * signature_ptr,
92 unsigned int image_size,
93 unsigned hash_type)
94{
95 return 0;
96}
Deepa Dinamani5e5c21a2012-02-16 18:59:57 -080097
Pavel Nedev36c23372013-03-19 15:38:53 +020098__WEAK void ce_clock_init(void)
Deepa Dinamani5e5c21a2012-02-16 18:59:57 -080099{
100}
Amol Jadi02ca2ee2013-03-15 16:06:34 -0700101
sundarajan srinivasancaab0f42013-05-10 14:21:30 -0700102__WEAK addr_t get_bs_info_addr()
Amol Jadi02ca2ee2013-03-15 16:06:34 -0700103{
Unnati Gandhie12c2bf2014-07-17 15:07:44 +0530104 return 0;
sundarajan srinivasancaab0f42013-05-10 14:21:30 -0700105}
106
107__WEAK uint32_t platform_get_sclk_count(void)
108{
109 return 0;
Amol Jadi02ca2ee2013-03-15 16:06:34 -0700110}
Channagoud Kadabi071b2d82013-08-20 15:31:32 -0700111
Unnati Gandhie12c2bf2014-07-17 15:07:44 +0530112__WEAK void clock_config_cdc(uint32_t slot)
Channagoud Kadabi071b2d82013-08-20 15:31:32 -0700113{
Unnati Gandhie12c2bf2014-07-17 15:07:44 +0530114
Channagoud Kadabi071b2d82013-08-20 15:31:32 -0700115}
Joonwoo Park61112782013-10-02 19:50:39 -0700116
117__WEAK int get_target_boot_params(const char *cmdline, const char *part,
vijay kumar870515d2015-08-31 16:37:24 +0530118 char **buf)
Joonwoo Park61112782013-10-02 19:50:39 -0700119{
120 return -1;
121}
Sundarajan Srinivasan79e5f512014-03-28 16:43:06 -0700122
123__WEAK uint32_t platform_get_smem_base_addr()
124{
125 return (uint32_t)MSM_SHARED_BASE;
126}
Sundarajan Srinivasan1f5fa152014-03-21 17:30:52 -0700127
128__WEAK uint32_t platform_boot_dev_isemmc()
129{
130 return 1;
131}
132
Anmolpreet Kaur6281f362019-03-08 17:56:06 +0530133__WEAK uint32_t platform_boot_dev_is_nand()
134{
135 return 0;
136}
137
Sundarajan Srinivasan1f5fa152014-03-21 17:30:52 -0700138__WEAK uint32_t platform_get_boot_dev()
139{
140 return 0;
141}
Channagoud Kadabi000e8b32014-12-08 16:48:52 -0800142
143__WEAK int boot_device_mask(int val)
144{
145 return ((val & 0x3E) >> 1);
146}
Unnati Gandhi24885052014-11-27 16:57:49 +0530147
148__WEAK uint32_t platform_detect_panel()
149{
150 return 0;
151}
Channagoud Kadabid0395a52015-02-18 11:08:36 -0800152
Mayank Grover324a9772019-05-08 16:06:19 +0530153__WEAK bool use_hsonly_mode()
Channagoud Kadabid0395a52015-02-18 11:08:36 -0800154{
155 return 0;
156}
lijuangdc20de12015-02-11 12:09:57 +0800157
158__WEAK uint32_t check_alarm_boot()
159{
160 return 0;
161}
Aparna Mallavarapu711119b2015-03-29 03:35:07 +0530162__WEAK uint32_t platform_get_max_periph()
163{
164 return 128;
165}
P.V. Phani Kumar68d13012016-04-05 17:30:17 +0530166
167/* This function definition should not be used if VERIFIED_BOOT
168is enabled. And this is expected to be called only for MDM Targets */
169__WEAK uint32_t read_der_message_length(unsigned char* input, unsigned sz)
170{
171 return SIGNATURE_SIZE;
172}
Mayank Grover90457012016-12-29 18:24:04 +0530173
174/* Check if glink is supported or not */
175__WEAK bool platform_is_glink_enabled()
176{
177#if GLINK_SUPPORT
178 return 1;
179#else
180 return 0;
181#endif
182}
Mayank Groverf75ddaf2019-12-27 15:00:24 +0530183__WEAK void *target_mmc_device()
184{
185 return NULL;
186}
Mayank Grover90457012016-12-29 18:24:04 +0530187
Mayank Grover324a9772019-05-08 16:06:19 +0530188/* function to update boot device base, for emmc targets. */
189__WEAK void platform_boot_dev_cmdline(char *buf)
190{
191 struct mmc_device *dev = NULL;
192 uint32_t boot_dev_str_sz = 0;
193
194 if (!buf) {
195 dprintf(CRITICAL,"ERROR: Invalid args- Failed to populate boot device");
196 return;
197 }
198
199 dev = (struct mmc_device *)target_mmc_device();
Mayank Groverf75ddaf2019-12-27 15:00:24 +0530200 if (!dev) {
201 dprintf(CRITICAL,"ERROR: Invalid mmc device");
202 return;
203 }
204
Mayank Grover324a9772019-05-08 16:06:19 +0530205 boot_dev_str_sz = ((sizeof(dev->host.base))*2) + 7;
206 if (boot_dev_str_sz > sizeof(char) * BOOT_DEV_MAX_LEN) {
207 dprintf(CRITICAL,"ERROR: Invalid buf sz - Failed to populate boot device");
208 return;
209 }
210
211 snprintf(buf, boot_dev_str_sz, "%x.sdhci", dev->host.base);
212 return;
213}