platform.c 30 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2015. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #include <debug.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34. #include <video.h>
  35. #include <dev/uart.h>
  36. #include <arch/arm.h>
  37. #include <arch/arm/mmu.h>
  38. #include <arch/ops.h>
  39. #include <target/board.h>
  40. #include <platform/mt_reg_base.h>
  41. #include <platform/mt_disp_drv.h>
  42. #include <platform/disp_drv.h>
  43. #include <platform/boot_mode.h>
  44. #include <platform/mt_logo.h>
  45. #include <platform/partition.h>
  46. #include <env.h>
  47. #include <platform/mt_gpio.h>
  48. #include <platform/mt_pmic.h>
  49. #include <platform/mt_pmic_wrap_init.h>
  50. #include <platform/mt_i2c.h>
  51. #include <platform/mtk_key.h>
  52. #include <platform/mt_rtc.h>
  53. #include <platform/mt_leds.h>
  54. #include <platform/upmu_common.h>
  55. #ifdef CFG_MTK_WDT_COMMON
  56. #include <mtk_wdt.h>
  57. #else
  58. #include <platform/mtk_wdt.h>
  59. #endif
  60. #include <platform/disp_drv_platform.h>
  61. #include <platform/verified_boot.h>
  62. #include <platform/sec_devinfo.h> // for internal_get_devinfo_with_index()
  63. #include <plinfo.h> // for plinfo_get_brom_header_block_size()
  64. #include <libfdt.h>
  65. #include <mt_gic.h> // for platform_init_interrupts()
  66. #include <mt_boot.h> // for bldr_load_dtb()
  67. #include <platform.h> // for platform_uninit()
  68. #include <mtk_smi.h> // for smi_apply_register_setting()
  69. #include <mtk_dcm.h> // for mt_dcm_init()
  70. #include <plat_debug_interface.h> // for mt_secure_call()
  71. #include <dev/aee_platform_debug.h> // for platform_lastpc_postinit()
  72. #include <profiling.h>
  73. #include <pal_assert.h>
  74. #include <platform/mt_gpt.h> // for get_timer()
  75. #include "mtk_secure_api.h"
  76. #include "memory_layout.h"
  77. #include "load_vfy_boot.h"
  78. #include <rsc.h>
  79. #include <fdt_op.h>
  80. #include <verified_boot_common.h>
  81. #include <fpga_boot_argument.h>
  82. #ifdef MTK_EMMC_SUPPORT
  83. #include "mmc_rpmb.h"
  84. #endif
  85. #define DEVAPC_TURN_ON 1
  86. #ifdef MTK_AB_OTA_UPDATER
  87. #include "bootctrl.h"
  88. #endif
  89. #if defined(MTK_SECURITY_SW_SUPPORT)
  90. #include "oemkey.h"
  91. #endif
  92. #ifdef MTK_UFS_BOOTING
  93. #include "ufs_aio_interface.h"
  94. #endif
  95. #ifdef MTK_CHARGER_NEW_ARCH
  96. #include <mtk_charger.h>
  97. #include <mtk_battery.h>
  98. #endif
  99. #ifdef MTK_SECURITY_SW_SUPPORT
  100. extern u8 g_oemkey[OEM_PUBK_SZ];
  101. #endif
  102. #ifdef LK_DL_CHECK
  103. /*block if check dl fail*/
  104. #undef LK_DL_CHECK_BLOCK_LEVEL
  105. #endif
  106. extern void platform_early_init_timer();
  107. extern void jump_da(u32 addr, u32 arg1, u32 arg2);
  108. extern int i2c_hw_init(void);
  109. extern int mboot_common_load_logo(unsigned long logo_addr, char* filename);
  110. extern int sec_func_init(u64 pl_start_addr);
  111. extern int sec_usbdl_enabled (void);
  112. extern unsigned int crypto_hw_engine_disable(void);
  113. extern void mtk_wdt_disable(void);
  114. extern void platform_deinit_interrupts(void);
  115. extern int mmc_get_dl_info(void);
  116. extern int mmc_legacy_init(int);
  117. extern void platform_clear_cache_retention_select(void);
  118. extern unsigned int crypto_hw_engine_disable(void);
  119. #ifdef MTK_AEE_PLATFORM_DEBUG_SUPPORT
  120. extern void latch_lastbus_init(void);
  121. #endif
  122. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  123. extern kal_bool is_low_battery(kal_int32 val);
  124. extern int hw_charging_get_charger_type(void);
  125. #endif
  126. void config_shared_SRAM_size(void);
  127. extern int dev_info_nr_cpu(void);
  128. extern void mt_pll_turn_off(void);
  129. extern void mt_pll_clk_bootargs(void);
  130. struct mmu_initial_mapping mmu_initial_mappings[] = {
  131. {
  132. .phys = (uint64_t)0,
  133. .virt = (uint32_t)0,
  134. .size = 0x40000000,
  135. .flags = MMU_MEMORY_TYPE_STRONGLY_ORDERED | MMU_MEMORY_AP_P_RW_U_NA,
  136. .name = "mcusys"
  137. },
  138. {
  139. .phys = (uint64_t)MEMBASE,
  140. .virt = (uint32_t)MEMBASE,
  141. .size = ROUNDUP(MEMSIZE, SECTION_SIZE),
  142. .flags = MMU_MEMORY_TYPE_NORMAL_WRITE_BACK | MMU_MEMORY_AP_P_RW_U_NA,
  143. .name = "ram"
  144. },
  145. {
  146. .phys = (uint64_t)SCRATCH_ADDR,
  147. .virt = (uint32_t)SCRATCH_ADDR,
  148. .size = SCRATCH_SIZE,
  149. .flags = MMU_MEMORY_TYPE_NORMAL_WRITE_BACK | MMU_MEMORY_AP_P_RW_U_NA,
  150. .name = "download"
  151. },
  152. /* null entry to terminate the list */
  153. { 0 }
  154. };
  155. BOOT_ARGUMENT *g_boot_arg;
  156. BOOT_ARGUMENT boot_addr;
  157. int g_nr_bank;
  158. BI_DRAM bi_dram[MAX_NR_BANK];
  159. unsigned int g_fb_base;
  160. unsigned int g_fb_size;
  161. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  162. unsigned int g_ext_fb_base;
  163. unsigned int g_ext_fb_size;
  164. #endif
  165. static int g_dram_init_ret;
  166. static unsigned int bootarg_addr;
  167. static unsigned int bootarg_size;
  168. extern unsigned int logo_lk_t;
  169. extern unsigned int boot_time;
  170. int dram_init(void)
  171. {
  172. unsigned int i;
  173. struct boot_tag *tags;
  174. /* Get parameters from pre-loader. Get as early as possible
  175. * The address of BOOT_ARGUMENT_LOCATION will be used by Linux later
  176. * So copy the parameters from BOOT_ARGUMENT_LOCATION to LK's memory region
  177. */
  178. g_boot_arg = &boot_addr;
  179. bootarg_addr = (unsigned int)((unsigned int *)BOOT_ARGUMENT_LOCATION);
  180. bootarg_size = 0;
  181. fpga_set_boot_argument((BOOT_ARGUMENT*)bootarg_addr);
  182. if (*(unsigned int *)BOOT_ARGUMENT_LOCATION == BOOT_ARGUMENT_MAGIC) {
  183. memcpy(g_boot_arg, (void*)BOOT_ARGUMENT_LOCATION, sizeof(BOOT_ARGUMENT));
  184. bootarg_size = sizeof(BOOT_ARGUMENT);
  185. } else {
  186. g_boot_arg->maggic_number = BOOT_ARGUMENT_MAGIC;
  187. for (tags = (void *)BOOT_ARGUMENT_LOCATION; tags->hdr.size; tags = boot_tag_next(tags)) {
  188. switch (tags->hdr.tag) {
  189. case BOOT_TAG_BOOT_REASON:
  190. g_boot_arg->boot_reason = tags->u.boot_reason.boot_reason;
  191. break;
  192. case BOOT_TAG_BOOT_MODE:
  193. g_boot_arg->boot_mode = tags->u.boot_mode.boot_mode;
  194. break;
  195. case BOOT_TAG_META_COM:
  196. g_boot_arg->meta_com_type = tags->u.meta_com.meta_com_type;
  197. g_boot_arg->meta_com_id = tags->u.meta_com.meta_com_id;
  198. g_boot_arg->meta_uart_port = tags->u.meta_com.meta_uart_port;
  199. g_boot_arg->meta_log_disable = tags->u.meta_com.meta_log_disable;
  200. g_boot_arg->fast_meta_gpio = tags->u.meta_com.fast_meta_gpio;
  201. break;
  202. case BOOT_TAG_LOG_COM:
  203. g_boot_arg->log_port = tags->u.log_com.log_port;
  204. g_boot_arg->log_baudrate = tags->u.log_com.log_baudrate;
  205. g_boot_arg->log_enable = tags->u.log_com.log_enable;
  206. g_boot_arg->log_dynamic_switch = tags->u.log_com.log_dynamic_switch;
  207. break;
  208. case BOOT_TAG_MEM:
  209. g_boot_arg->dram_rank_num = tags->u.mem.dram_rank_num;
  210. for (i = 0; i < tags->u.mem.dram_rank_num; i++) {
  211. g_boot_arg->dram_rank_size[i] = tags->u.mem.dram_rank_size[i];
  212. }
  213. g_boot_arg->mblock_info = tags->u.mem.mblock_info;
  214. g_boot_arg->orig_dram_info = tags->u.mem.orig_dram_info;
  215. g_boot_arg->lca_reserved_mem = tags->u.mem.lca_reserved_mem;
  216. g_boot_arg->tee_reserved_mem = tags->u.mem.tee_reserved_mem;
  217. break;
  218. case BOOT_TAG_MD_INFO:
  219. for (i = 0; i < 4; i++) {
  220. g_boot_arg->md_type[i] = tags->u.md_info.md_type[i];
  221. }
  222. break;
  223. case BOOT_TAG_BOOT_TIME:
  224. g_boot_arg->boot_time = tags->u.boot_time.boot_time;
  225. break;
  226. case BOOT_TAG_DA_INFO:
  227. memcpy(&g_boot_arg->da_info, &tags->u.da_info.da_info, sizeof(da_info_t));
  228. break;
  229. case BOOT_TAG_SEC_INFO:
  230. memcpy(&g_boot_arg->sec_limit, &tags->u.sec_info.sec_limit, sizeof(SEC_LIMIT));
  231. break;
  232. case BOOT_TAG_PART_NUM:
  233. g_boot_arg->part_num = tags->u.part_num.part_num;
  234. break;
  235. case BOOT_TAG_PART_INFO:
  236. g_boot_arg->part_info = tags->u.part_info.part_info; /* only copy the pointer but the contains*/
  237. break;
  238. case BOOT_TAG_EFLAG:
  239. g_boot_arg->e_flag = tags->u.eflag.e_flag;
  240. break;
  241. case BOOT_TAG_DDR_RESERVE:
  242. g_boot_arg->ddr_reserve_enable = tags->u.ddr_reserve.ddr_reserve_enable;
  243. g_boot_arg->ddr_reserve_success = tags->u.ddr_reserve.ddr_reserve_success;
  244. g_boot_arg->ddr_reserve_ready = tags->u.ddr_reserve.ddr_reserve_ready;
  245. break;
  246. case BOOT_TAG_DRAM_BUF:
  247. g_boot_arg->dram_buf_size = tags->u.dram_buf.dram_buf_size;
  248. break;
  249. case BOOT_TAG_SRAM_INFO:
  250. g_boot_arg->non_secure_sram_addr = tags->u.sram_info.non_secure_sram_addr;
  251. g_boot_arg->non_secure_sram_size = tags->u.sram_info.non_secure_sram_size;
  252. break;
  253. case BOOT_TAG_PLAT_DBG_INFO:
  254. g_boot_arg->plat_dbg_info_max = tags->u.plat_dbg_info.info_max;
  255. for (i = 0; (i < INFO_TYPE_MAX) && (i < g_boot_arg->plat_dbg_info_max); i++) {
  256. g_boot_arg->plat_dbg_info[i].key = tags->u.plat_dbg_info.info[i].key;
  257. g_boot_arg->plat_dbg_info[i].base = tags->u.plat_dbg_info.info[i].base;
  258. g_boot_arg->plat_dbg_info[i].size = tags->u.plat_dbg_info.info[i].size;
  259. }
  260. break;
  261. case BOOT_TAG_PTP:
  262. memcpy(&g_boot_arg->ptp_volt_info, &tags->u.ptp_volt.ptp_volt_info, sizeof(ptp_info_t));
  263. break;
  264. case BOOT_TAG_EMI_INFO:
  265. memcpy(&(g_boot_arg->emi_info), &(tags->u.emi_info), sizeof(emi_info_t));
  266. break;
  267. case BOOT_TAG_IMGVER_INFO:
  268. g_boot_arg->pl_imgver_status = tags->u.imgver_info.pl_imgver_status;
  269. break;
  270. case BOOT_TAG_MAX_CPUS:
  271. g_boot_arg->max_cpus = tags->u.max_cpus.max_cpus;
  272. break;
  273. case BOOT_TAG_CHR_INFO:
  274. g_boot_arg->charger_type = tags->u.chr_info.charger_type;
  275. break;
  276. case BOOT_TAG_RAM_CONSOLE_INFO:
  277. g_boot_arg->ram_console_sram_addr = tags->u.ram_console_info.sram_addr;
  278. g_boot_arg->ram_console_sram_size = tags->u.ram_console_info.sram_size;
  279. g_boot_arg->ram_console_def_type = tags->u.ram_console_info.def_type;
  280. g_boot_arg->ram_console_memory_info_offset = tags->u.ram_console_info.memory_info_offset;
  281. break;
  282. case BOOT_TAG_SOC_ID:
  283. memcpy(g_boot_arg->socid, tags->u.socid.id, SOC_ID_LEN);
  284. break;
  285. default:
  286. break;
  287. }
  288. bootarg_size += tags->hdr.size;
  289. }
  290. }
  291. fpga_copy_boot_argument(g_boot_arg);
  292. g_nr_bank = g_boot_arg->dram_rank_num;
  293. if (g_nr_bank == 0 || g_nr_bank > MAX_NR_BANK) {
  294. g_dram_init_ret = -1;
  295. //dprintf(CRITICAL, "[LK ERROR] DRAM bank number is not correct!!!");
  296. //while (1) ;
  297. return -1;
  298. }
  299. #ifndef CUSTOM_CONFIG_MAX_DRAM_SIZE
  300. /* return the actual DRAM info */
  301. for (i = 0; i < (unsigned int)(g_boot_arg->mblock_info.mblock_num); i++) {
  302. bi_dram[i].start = g_boot_arg->mblock_info.mblock[i].start;
  303. bi_dram[i].size = g_boot_arg->mblock_info.mblock[i].size;
  304. }
  305. //#elif (CUSTOM_CONFIG_MAX_DRAM_SIZE < 0x10000000)
  306. //#error "DRAM size < 0x10000000" /* DRAM is less than 256MB, trigger build error */
  307. #else
  308. #endif
  309. return 0;
  310. }
  311. unsigned int platform_get_bootarg_addr(void)
  312. {
  313. return bootarg_addr;
  314. }
  315. unsigned int platform_get_bootarg_size(void)
  316. {
  317. return bootarg_size;
  318. }
  319. /*******************************************************
  320. * Routine: memory_size
  321. * Description: return DRAM size to LCM driver
  322. ******************************************************/
  323. u32 ddr_enable_4gb(void)
  324. {
  325. u32 status;
  326. #define INFRA_MISC (INFRACFG_AO_BASE + 0x0F00)
  327. #define INFRA_4GB_EN (1 << 13)
  328. #define PERI_MISC (PERICFG_BASE + 0x0208)
  329. #define PERI_4GB_EN (1 << 15)
  330. status = ((DRV_Reg32(INFRA_MISC) & INFRA_4GB_EN) && (DRV_Reg32(PERI_MISC) & PERI_4GB_EN)) ? 1 : 0;
  331. dprintf(CRITICAL, "%s() status=%u\n", __func__, status);
  332. return status;
  333. }
  334. u64 physical_memory_size(void)
  335. {
  336. int i;
  337. unsigned long long size = 0;
  338. for (i = 0; i < (int)(g_boot_arg->orig_dram_info.rank_num); i++) {
  339. size += g_boot_arg->orig_dram_info.rank_info[i].size;
  340. }
  341. return size;
  342. }
  343. u32 memory_size(void)
  344. {
  345. unsigned long long size = physical_memory_size();
  346. while (((unsigned long long)DRAM_PHY_ADDR + size) > 0x100000000ULL) {
  347. size -= (unsigned long long)(1024*1024*1024);
  348. }
  349. return (unsigned int)size;
  350. }
  351. void sw_env()
  352. {
  353. #ifdef LK_DL_CHECK
  354. #if defined(MTK_EMMC_SUPPORT) || defined(MTK_UFS_BOOTING)
  355. int dl_status = 0;
  356. dl_status = mmc_get_dl_info();
  357. dprintf(INFO, "mt65xx_sw_env--dl_status: %d\n", dl_status);
  358. if (dl_status != 0) {
  359. video_printf("=> TOOL DL image Fail!\n");
  360. dprintf(CRITICAL, "TOOL DL image Fail\n");
  361. #ifdef LK_DL_CHECK_BLOCK_LEVEL
  362. dprintf(CRITICAL, "uboot is blocking by dl info\n");
  363. while (1) ;
  364. #endif
  365. }
  366. #endif
  367. #endif
  368. #ifndef MACH_FPGA_NO_DISPLAY
  369. #ifndef USER_BUILD
  370. switch (g_boot_mode) {
  371. case META_BOOT:
  372. video_printf(" => META MODE\n");
  373. break;
  374. case FACTORY_BOOT:
  375. video_printf(" => FACTORY MODE\n");
  376. break;
  377. case RECOVERY_BOOT:
  378. video_printf(" => RECOVERY MODE\n");
  379. break;
  380. case SW_REBOOT:
  381. //video_printf(" => SW RESET\n");
  382. break;
  383. case NORMAL_BOOT:
  384. //if(g_boot_arg->boot_reason != BR_RTC && get_env("hibboot") != NULL && atoi(get_env("hibboot")) == 1)
  385. if (get_env("hibboot") != NULL && atoi(get_env("hibboot")) == 1)
  386. video_printf(" => HIBERNATION BOOT\n");
  387. else
  388. video_printf(" => NORMAL BOOT\n");
  389. break;
  390. case ADVMETA_BOOT:
  391. video_printf(" => ADVANCED META MODE\n");
  392. break;
  393. case ATE_FACTORY_BOOT:
  394. video_printf(" => ATE FACTORY MODE\n");
  395. break;
  396. #ifdef MTK_KERNEL_POWER_OFF_CHARGING
  397. case KERNEL_POWER_OFF_CHARGING_BOOT:
  398. video_printf(" => POWER OFF CHARGING MODE\n");
  399. break;
  400. case LOW_POWER_OFF_CHARGING_BOOT:
  401. video_printf(" => LOW POWER OFF CHARGING MODE\n");
  402. break;
  403. #endif
  404. case ALARM_BOOT:
  405. video_printf(" => ALARM BOOT\n");
  406. break;
  407. case FASTBOOT:
  408. video_printf(" => FASTBOOT mode...\n");
  409. break;
  410. default:
  411. video_printf(" => UNKNOWN BOOT\n");
  412. }
  413. return;
  414. #endif
  415. #ifdef USER_BUILD
  416. /* it's ok to display META MODE since it already verfied by preloader */
  417. if (g_boot_mode == META_BOOT)
  418. video_printf(" => META MODE\n");
  419. if (g_boot_mode == FASTBOOT)
  420. video_printf(" => FASTBOOT mode...\n");
  421. return;
  422. #endif
  423. #endif
  424. }
  425. extern uint64_t ld_tt_l1[4];
  426. void platform_init_mmu(void)
  427. {
  428. /* configure available RAM banks */
  429. dram_init();
  430. /* Long-descriptor translation with lpae enable */
  431. arm_mmu_lpae_init();
  432. struct mmu_initial_mapping *m = mmu_initial_mappings;
  433. for (uint i = 0; i < countof(mmu_initial_mappings); i++, m++) {
  434. arch_mmu_map(m->phys, m->virt, m->flags, m->size);
  435. }
  436. arch_enable_mmu(); //enable mmu after setup page table to avoid cpu prefetch which may bring on emi violation
  437. }
  438. /******************************************************************************
  439. ******************************************************************************/
  440. void init_storage(void)
  441. {
  442. PROFILING_START("NAND/EMMC init");
  443. #if defined(MTK_EMMC_SUPPORT)
  444. mmc_legacy_init(1);
  445. #elif defined(MTK_UFS_BOOTING)
  446. ufs_lk_init();
  447. #else
  448. #ifndef MACH_FPGA
  449. nand_init();
  450. nand_driver_test();
  451. #endif // MACH_FPGA
  452. #endif // MTK_EMMC_SUPPORT
  453. #if defined(MTK_EMMC_SUPPORT) || defined(MTK_UFS_BOOTING)
  454. init_rpmb_sharemem();
  455. #endif
  456. PROFILING_END(); /* NAND/EMMC init */
  457. }
  458. /******************************************************************************
  459. ******************************************************************************/
  460. void platform_early_init(void)
  461. {
  462. PROFILING_START("platform_early_init");
  463. /* initialize the uart */
  464. uart_init_early();
  465. PROFILING_START("Devinfo Init");
  466. init_devinfo_data();
  467. PROFILING_END();
  468. platform_init_interrupts();
  469. platform_early_init_timer();
  470. #if !defined(USE_DTB_NO_DWS) && !defined(MACH_FPGA)
  471. mt_gpio_set_default();
  472. #endif // !defined(USE_DTB_NO_DWS) && !defined(MACH_FPGA)
  473. dprintf(SPEW, "bootarg_addr: 0x%x, bootarg_size: 0x%x\n", platform_get_bootarg_addr(), platform_get_bootarg_size());
  474. if (g_dram_init_ret < 0) {
  475. dprintf(CRITICAL, "[LK ERROR] DRAM bank number is not correct!!!\n");
  476. while (1) ;
  477. }
  478. //i2c_v1_init();
  479. PROFILING_START("WDT Init");
  480. mtk_wdt_init();
  481. PROFILING_END();
  482. //i2c init
  483. i2c_hw_init();
  484. #ifdef MACH_FPGA
  485. mtk_timer_init(); // GPT4 will be initialized at PL after
  486. mtk_wdt_disable(); // WDT will be triggered when uncompressing linux image on FPGA
  487. #endif
  488. pwrap_init_lk();
  489. #if !defined(MACH_FPGA) && !defined(NO_PMIC)
  490. PROFILING_START("pmic_init");
  491. pmic_init();
  492. PROFILING_END();
  493. #endif // !defined(MACH_FPGA) && !defined(NO_PMIC)
  494. PROFILING_END(); /* platform_early_init */
  495. }
  496. extern void mt65xx_bat_init(void);
  497. extern bool mtk_bat_allow_backlight_enable(void);
  498. #if defined (MTK_KERNEL_POWER_OFF_CHARGING)
  499. int kernel_charging_boot(void)
  500. {
  501. if ((g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT || g_boot_mode == LOW_POWER_OFF_CHARGING_BOOT) && upmu_is_chr_det() == KAL_TRUE) {
  502. dprintf(INFO,"[%s] Kernel Power Off Charging with Charger/Usb \n", __func__);
  503. return 1;
  504. } else if ((g_boot_mode == KERNEL_POWER_OFF_CHARGING_BOOT || g_boot_mode == LOW_POWER_OFF_CHARGING_BOOT) && upmu_is_chr_det() == KAL_FALSE) {
  505. dprintf(INFO,"[%s] Kernel Power Off Charging without Charger/Usb \n", __func__);
  506. return -1;
  507. } else
  508. return 0;
  509. }
  510. #endif
  511. static void lk_vb_init(void)
  512. {
  513. #ifdef MTK_SECURITY_SW_SUPPORT
  514. u64 pl_start_addr = 0;
  515. PROFILING_START("lk_vb_init");
  516. #ifdef MTK_VER_SIMPLE_TEST
  517. u32 ret = 0;
  518. ret = sec_mtk_internal_ver_test(MTK_VER_SIMPLE_TEST);
  519. if (ret)
  520. assert(0);
  521. #endif
  522. #ifdef MTK_OTP_FRAMEWORK_V2
  523. enable_anti_rollback_v2_framework();
  524. #endif
  525. /* get preloader start address */
  526. plinfo_get_brom_header_block_size(&pl_start_addr);
  527. /* initialize security library */
  528. sec_func_init(pl_start_addr);
  529. seclib_set_oemkey(g_oemkey, OEM_PUBK_SZ);
  530. PROFILING_END();
  531. #endif
  532. }
  533. static void lk_vb_vfy_logo(void)
  534. {
  535. #ifdef MTK_SECURITY_SW_SUPPORT
  536. /* bypass logo vfy in fast meta mode */
  537. if(g_boot_mode == META_BOOT)
  538. return;
  539. PROFILING_START("logo verify");
  540. /* Verify logo before use it */
  541. if ( 0 != img_auth_stor("logo", "logo", 0x0) ) {
  542. dprintf(CRITICAL,"<ASSERT> %s:line %d\n",__FILE__,__LINE__);
  543. PAL_ASSERT(0);
  544. }
  545. PROFILING_END();
  546. #endif
  547. }
  548. void platform_init(void)
  549. {
  550. bool bearly_backlight_on = false;
  551. int logo_size;
  552. PROFILING_START("platform_init");
  553. dprintf(CRITICAL, "platform_init()\n");
  554. init_storage();
  555. lk_vb_init();
  556. extern void dummy_ap_entry(void)__attribute__((weak)); /* This is empty function for normal load */
  557. if (dummy_ap_entry)
  558. dummy_ap_entry();
  559. #ifdef MTK_AB_OTA_UPDATER
  560. /* get A/B system parameter before load dtb from boot image */
  561. get_AB_OTA_param();
  562. #endif
  563. /*
  564. * RSC initialize. It must be done before load device tree.
  565. * rsc_init will ectract DTBO index, which will be used in device
  566. * tree overlay, from PARA partition
  567. */
  568. rsc_init();
  569. /* The device tree should be loaded as early as possible. */
  570. load_device_tree();
  571. #if defined(USE_DTB_NO_DWS) && !defined(MACH_FPGA)
  572. mt_gpio_set_default();
  573. #endif // defined(USE_DTB_NO_DWS) && !defined(MACH_FPGA)
  574. #ifndef MACH_FPGA
  575. PROFILING_START("led init");
  576. leds_init();
  577. PROFILING_END();
  578. #endif // MACH_FPGA
  579. #ifdef MTK_KERNEL_POWER_OFF_CHARGING
  580. if ((g_boot_arg->boot_reason == BR_USB) && (upmu_is_chr_det() == KAL_FALSE)) {
  581. dprintf(INFO, "[%s] Unplugged Charger/Usb between Pre-loader and Uboot in Kernel Charging Mode, Power Off \n", __func__);
  582. mt_power_off();
  583. }
  584. #endif // MTK_KERNEL_POWER_OFF_CHARGING
  585. PROFILING_START("ENV init");
  586. env_init();
  587. print_env();
  588. PROFILING_END();
  589. PROFILING_START("disp init");
  590. #if defined(MTK_SMI_SUPPORT) && !defined(MACH_FPGA)
  591. /* write SMI non on-the-fly register before DISP init */
  592. smi_apply_register_setting();
  593. #endif
  594. /* initialize the frame buffet information */
  595. g_fb_size = mt_disp_get_vram_size();
  596. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  597. g_ext_fb_size = mt_disp_get_ext_vram_size();
  598. #endif
  599. g_fb_base = mblock_reserve_ext(&g_boot_arg->mblock_info, g_fb_size, 0x10000, 0x80000000, 0, "framebuffer");
  600. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  601. g_ext_fb_base = mblock_reserve_ext(&g_boot_arg->mblock_info, g_ext_fb_size, 0x10000, 0x80000000, 0, "framebuffer_ext");
  602. if (!g_fb_base) {
  603. dprintf(CRITICAL, "reserve framebuffer failed\n");
  604. }
  605. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  606. if (!g_ext_fb_base) {
  607. dprintf(CRITICAL, "reserve framebuffer_ext failed\n");
  608. }
  609. #endif
  610. #endif
  611. dprintf(CRITICAL, "FB base = 0x%x, FB size = 0x%x (%d)\n", g_fb_base, g_fb_size, g_fb_size);
  612. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  613. dprintf(CRITICAL, "EXT_FB base = 0x%x, EXT_FB size = 0x%x (%d)\n", g_ext_fb_base, g_ext_fb_size, g_ext_fb_size);
  614. #endif
  615. #ifndef MACH_FPGA_NO_DISPLAY
  616. mt_disp_init((void *)g_fb_base);
  617. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  618. mt_ext_disp_init((void *)g_ext_fb_base);
  619. #endif
  620. drv_video_init();
  621. #endif
  622. PROFILING_END();
  623. /*for kpd pmic mode setting*/
  624. set_kpd_pmic_mode();
  625. #ifndef MACH_FPGA
  626. PROFILING_START("boot mode select");
  627. #if !defined(NO_BOOT_MODE_SEL)
  628. boot_mode_select();
  629. #endif
  630. #ifdef CFG_MTK_WDT_COMMON
  631. PROFILING_START("wdt_check_exception");
  632. wdt_check_exception();
  633. PROFILING_END();
  634. #endif
  635. #ifdef MTK_USB2JTAG_SUPPORT
  636. if (g_boot_mode != FASTBOOT) {
  637. extern void usb2jtag_init(void);
  638. usb2jtag_init();
  639. }
  640. #endif
  641. #ifdef MTK_AEE_PLATFORM_DEBUG_SUPPORT
  642. /* init lastbus: MUST call after kedump (in boot_mode_select) */
  643. latch_lastbus_init();
  644. #endif
  645. PROFILING_END(); /* boot mode select */
  646. #endif /*MACH_FPGA */
  647. #ifndef MACH_FPGA_NO_DISPLAY
  648. /* fast meta mode */
  649. if(g_boot_mode != META_BOOT){
  650. PROFILING_START("load_logo");
  651. logo_size = mboot_common_load_logo((unsigned long)mt_get_logo_db_addr_pa(), "logo");
  652. assert(logo_size <= LK_LOGO_MAX_SIZE);
  653. PROFILING_END();
  654. } else {
  655. /* Indicate logo lib that logo partition is not loaded */
  656. enable_logo(0);
  657. }
  658. #endif // MACH_FPGA_NO_DISPLAY
  659. lk_vb_vfy_logo();
  660. /*Show download logo & message on screen */
  661. if (g_boot_arg->boot_mode == DOWNLOAD_BOOT) {
  662. dprintf(CRITICAL, "[LK] boot mode is DOWNLOAD_BOOT\n");
  663. #ifndef MACH_FPGA_NO_DISPLAY
  664. PROFILING_START("show logo");
  665. mt_disp_show_boot_logo();
  666. PROFILING_END();
  667. #endif
  668. video_printf(" => Downloading...\n");
  669. dprintf(CRITICAL, "enable backlight after show bootlogo! \n");
  670. #ifndef MACH_FPGA
  671. PROFILING_START("backlight");
  672. mt65xx_backlight_on();
  673. PROFILING_END();
  674. #endif
  675. #ifndef MACH_FPGA_NO_DISPLAY
  676. /* pwm need display sof */
  677. PROFILING_START("disp update");
  678. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  679. PROFILING_END();
  680. #endif
  681. logo_lk_t = ((unsigned int)get_timer(boot_time));
  682. PROFILING_START("disable wdt, l2, cache, mmu");
  683. mtk_wdt_disable(); //Disable wdt before jump to DA
  684. platform_uninit();
  685. #ifdef HAVE_CACHE_PL310
  686. l2_disable();
  687. #endif
  688. arch_disable_cache(UCACHE);
  689. arch_disable_mmu();
  690. #ifdef ENABLE_L2_SHARING
  691. config_shared_SRAM_size();
  692. #endif
  693. PROFILING_END();
  694. jump_da(g_boot_arg->da_info.addr, g_boot_arg->da_info.arg1, g_boot_arg->da_info.arg2);
  695. }
  696. #ifdef MTK_KERNEL_POWER_OFF_CHARGING
  697. else if (g_boot_mode != ALARM_BOOT && g_boot_mode != FASTBOOT && g_boot_mode != KERNEL_POWER_OFF_CHARGING_BOOT && g_boot_mode != LOW_POWER_OFF_CHARGING_BOOT && mtk_bat_allow_backlight_enable()) {
  698. #ifndef MACH_FPGA_NO_DISPLAY
  699. /* fast meta mode */
  700. if(g_boot_mode != META_BOOT){
  701. PROFILING_START("show logo");
  702. mt_disp_show_boot_logo();
  703. PROFILING_END();
  704. }
  705. #endif // MACH_FPGA_NO_DISPLAY
  706. #ifndef MACH_FPGA
  707. PROFILING_START("backlight");
  708. mt65xx_backlight_on();
  709. PROFILING_END(); /* backlight */
  710. #endif // MACH_FPGA
  711. #ifndef MACH_FPGA_NO_DISPLAY
  712. /* fast meta mode */
  713. if(g_boot_mode != META_BOOT){
  714. PROFILING_START("disp update");
  715. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  716. PROFILING_END();
  717. }
  718. #endif // MACH_FPGA_NO_DISPLAY
  719. bearly_backlight_on = true;
  720. dprintf(INFO, "backlight enabled before battery init\n");
  721. logo_lk_t = ((unsigned int)get_timer(boot_time));
  722. }
  723. #endif // MTK_KERNEL_POWER_OFF_CHARGING
  724. PROFILING_START("battery init");
  725. #ifndef MACH_FPGA
  726. mt_pll_clk_bootargs();
  727. #if !defined(NO_PLL_TURN_OFF)
  728. mt_pll_turn_off();
  729. #endif // !defined(NO_PLL_TURN_OFF)
  730. #if !defined(NO_DCM)
  731. if (mt_dcm_init())
  732. dprintf(CRITICAL, "mt_dcm_init fail\n");
  733. #endif // !defined(NO_DCM)
  734. #if !defined(NO_BAT_INIT)
  735. #ifdef MTK_CHARGER_NEW_ARCH
  736. mtk_charger_init();
  737. pmic_dlpt_init();
  738. check_sw_ocv();
  739. mtk_charger_start();
  740. get_dlpt_imix_r();
  741. #else
  742. mt65xx_bat_init();
  743. #endif // MTK_CHARGER_NEW_ARCH
  744. #endif // !defined(NO_BAT_INIT)
  745. #endif // MACH_FPGA
  746. PROFILING_END(); /* battery init */
  747. #ifndef CFG_POWER_CHARGING
  748. PROFILING_START("RTC boot check Init");
  749. /* NOTE: if define CFG_POWER_CHARGING, will rtc_boot_check() in mt65xx_bat_init() */
  750. rtc_boot_check(false);
  751. PROFILING_END();
  752. #endif // CFG_POWER_CHARGING
  753. #ifdef MTK_KERNEL_POWER_OFF_CHARGING
  754. if (kernel_charging_boot() == 1) {
  755. PROFILING_START("show logo");
  756. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  757. CHARGER_TYPE CHR_Type_num = CHARGER_UNKNOWN;
  758. CHR_Type_num = hw_charging_get_charger_type();
  759. if ((g_boot_mode != LOW_POWER_OFF_CHARGING_BOOT) ||
  760. ((CHR_Type_num != STANDARD_HOST) && (CHR_Type_num != NONSTANDARD_CHARGER))) {
  761. #endif // MTK_BATLOWV_NO_PANEL_ON_EARLY
  762. mt_disp_power(TRUE);
  763. #ifndef MACH_FPGA_NO_DISPLAY
  764. mt_disp_show_low_battery();
  765. #endif
  766. mt65xx_leds_brightness_set(6, 110);
  767. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  768. }
  769. #endif
  770. PROFILING_END();
  771. } else if (g_boot_mode != KERNEL_POWER_OFF_CHARGING_BOOT && g_boot_mode != LOW_POWER_OFF_CHARGING_BOOT) {
  772. /* fast meta mode */
  773. if(g_boot_mode != META_BOOT)
  774. if (g_boot_mode != ALARM_BOOT && (g_boot_mode != FASTBOOT) && !bearly_backlight_on) {
  775. #ifndef MACH_FPGA_NO_DISPLAY
  776. PROFILING_START("show logo");
  777. mt_disp_show_boot_logo();
  778. PROFILING_END();
  779. #endif
  780. }
  781. }
  782. #else // MTK_KERNEL_POWER_OFF_CHARGING
  783. /* fast meta mode */
  784. if(g_boot_mode != META_BOOT)
  785. if (g_boot_mode != ALARM_BOOT && (g_boot_mode != FASTBOOT) && !bearly_backlight_on) {
  786. #ifndef MACH_FPGA_NO_DISPLAY
  787. PROFILING_START("show logo");
  788. mt_disp_show_boot_logo();
  789. PROFILING_END(); /* show logo */
  790. #endif
  791. }
  792. #endif // MTK_KERNEL_POWER_OFF_CHARGING
  793. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  794. if (!is_low_battery(0)) {
  795. #endif
  796. #ifndef MACH_FPGA
  797. PROFILING_START("backlight");
  798. mt65xx_backlight_on();
  799. PROFILING_END(); /* backlight */
  800. #endif
  801. //pwm need display sof
  802. #ifndef MACH_FPGA_NO_DISPLAY
  803. PROFILING_START("display update");
  804. mt_disp_update(0, 0, CFG_DISPLAY_WIDTH, CFG_DISPLAY_HEIGHT);
  805. PROFILING_END();
  806. if (!bearly_backlight_on)
  807. logo_lk_t = ((unsigned int)get_timer(boot_time));
  808. #endif
  809. #ifdef MTK_BATLOWV_NO_PANEL_ON_EARLY
  810. }
  811. #endif
  812. #ifndef MACH_FPGA
  813. PROFILING_START("sw_env");
  814. sw_env();
  815. PROFILING_END();
  816. #endif
  817. PROFILING_END(); /* platform_init */
  818. }
  819. void platform_uninit(void)
  820. {
  821. #if 0
  822. #if (MTK_DUAL_DISPLAY_SUPPORT == 2)
  823. /* mt_ext_disp_deinit();*/
  824. #endif
  825. leds_deinit();
  826. platform_lastpc_postinit();
  827. #endif
  828. platform_deinit_interrupts();
  829. return;
  830. }
  831. #ifdef ENABLE_L2_SHARING
  832. #define ADDR_CA7L_CACHE_CONFIG_MP(x) (CA7MCUCFG_BASE + 0x200 * x)
  833. #define L2C_SIZE_CFG_OFFSET 8
  834. #define L2C_SHARE_EN_OFFSET 12
  835. /* 4'b1111: 2048KB(not support)
  836. * 4'b0111: 1024KB(not support)
  837. * 4'b0011: 512KB
  838. * 4'b0001: 256KB
  839. * 4'b0000: 128KB (not support)
  840. */
  841. int is_l2_need_config(void)
  842. {
  843. volatile unsigned int cache_cfg, addr;
  844. addr = ADDR_CA7L_CACHE_CONFIG_MP(0);
  845. cache_cfg = DRV_Reg32(addr);
  846. cache_cfg = cache_cfg >> L2C_SIZE_CFG_OFFSET;
  847. /* only read 256KB need to be config.*/
  848. if ((cache_cfg &(0x7)) == 0x1) {
  849. return 1;
  850. }
  851. return 0;
  852. }
  853. void cluster_l2_share_enable(int cluster)
  854. {
  855. volatile unsigned int cache_cfg, addr;
  856. addr = ADDR_CA7L_CACHE_CONFIG_MP(cluster);
  857. /* set L2C size to 256KB */
  858. cache_cfg = DRV_Reg32(addr);
  859. cache_cfg &= (~0x7) << L2C_SIZE_CFG_OFFSET;
  860. cache_cfg |= 0x1 << L2C_SIZE_CFG_OFFSET;
  861. /* enable L2C_share_en. Sram only for other to use*/
  862. cache_cfg |= (0x1 << L2C_SHARE_EN_OFFSET);
  863. DRV_WriteReg32(addr, cache_cfg);
  864. }
  865. void cluster_l2_share_disable(int cluster)
  866. {
  867. volatile unsigned int cache_cfg, addr;
  868. addr = ADDR_CA7L_CACHE_CONFIG_MP(cluster);
  869. /* set L2C size to 512KB */
  870. cache_cfg = DRV_Reg32(addr);
  871. cache_cfg &= (~0x7) << L2C_SIZE_CFG_OFFSET;
  872. cache_cfg |= 0x3 << L2C_SIZE_CFG_OFFSET;
  873. DRV_WriteReg32(addr, cache_cfg);
  874. /* disable L2C_share_en. Sram only for cpu to use*/
  875. cache_cfg &= ~(0x1 << L2C_SHARE_EN_OFFSET);
  876. DRV_WriteReg32(addr, cache_cfg);
  877. }
  878. /* config L2 cache and sram to its size */
  879. void config_L2_size(void)
  880. {
  881. int cluster;
  882. if (is_l2_need_config()) {
  883. /*
  884. * Becuase mcu config is protected.
  885. * only can write in secutity mode
  886. */
  887. if (dev_info_nr_cpu() == 6) {
  888. cluster_l2_share_disable(0);
  889. cluster_l2_share_enable(1);
  890. }
  891. else {
  892. for (cluster = 0; cluster < 2; cluster++) {
  893. cluster_l2_share_disable(cluster);
  894. }
  895. }
  896. }
  897. }
  898. /* config SRAM back from L2 cache for DA relocation */
  899. void config_shared_SRAM_size(void)
  900. {
  901. int cluster;
  902. if (is_l2_need_config()) {
  903. /*
  904. * Becuase mcu config is protected.
  905. * only can write in secutity mode
  906. */
  907. for (cluster = 0; cluster < 2; cluster++) {
  908. cluster_l2_share_enable(cluster);
  909. }
  910. }
  911. }
  912. #endif
  913. void platform_sec_post_init(void)
  914. {
  915. unsigned int ret = 0;
  916. /* Lock Device APC in LK */
  917. dprintf(CRITICAL, "[DEVAPC] sec_post_init\n");
  918. ret = crypto_hw_engine_disable();
  919. if (ret) {
  920. dprintf(CRITICAL, "[SEC] crypto engine HW disable fail\n");
  921. }
  922. #if DEVAPC_TURN_ON
  923. dprintf(CRITICAL, "[DEVAPC] platform_sec_post_init - SMC call to ATF from LK\n");
  924. mt_secure_call(MTK_SIP_LK_DAPC_INIT, 0, 0, 0, 0);
  925. #endif
  926. }
  927. u32 get_devinfo_with_index(u32 index)
  928. {
  929. return internal_get_devinfo_with_index(index);
  930. }
  931. int platform_skip_hibernation(void)
  932. {
  933. switch (g_boot_arg->boot_reason) {
  934. #if 0 // let schedule power on to go hiberantion bootup process
  935. case BR_RTC:
  936. #endif
  937. case BR_WDT:
  938. case BR_WDT_BY_PASS_PWK:
  939. case BR_WDT_SW:
  940. case BR_WDT_HW:
  941. return 1;
  942. }
  943. return 0;
  944. }
  945. int is_meta_log_disable(void)
  946. {
  947. return g_boot_arg->meta_log_disable;
  948. }