[MTK] 如何让reset key重启, 而非关机

文摘 MediaTek 2020-05-7 阅读:5917

[DESCRIPTION]

某些產品會把SOC的reset pin拉出來作為實體按鍵. 當按下reset key時會強制讓soc reboot.

此時在preloader內會因找不到開機條件而關機.

[SOLUTION]

判斷前次關機是否由reset key引起的. 若是, 則繼續開機, 而非關機.

In vendor\mediatek\proprietary\bootable\bootloader\preloader\platform\mt6771\src\drivers\pmic.c

static U32 g_sts_crst;
static U32 g_sts_apwdt;
static U32 g_just_rst;
static U32 g_pwrkey_release;

U32 is_pmic_ap_wdt(void)
{
 return g_sts_apwdt;
}

...

void pmic_dbg_status(unsigned char option)
{
...
 g_sts_crst = (poff_sts >> PMIC_STS_CRST_SHIFT) & PMIC_STS_CRST_MASK;
 g_sts_apwdt = (poff_sts >> PMIC_STS_WDT_SHIFT) & PMIC_STS_WDT_MASK;
 pal_log_warn("[PMIC]POFFSTS[0x%x]=0x%x\n",
 MT6358_POFFSTS, poff_sts);
...
}

In vendor\mediatek\proprietary\bootable\bootloader\preloader\platform\mt6771\src\drivers\platform.c

static boot_reason_t platform_boot_status(void)
{
...
 if (is_pmic_ap_wdt()) {
  pal_log_err("PRESS RESET KEY, reset now\n");
  rtc_mark_bypass_pwrkey();
  return BR_WDT_BY_PASS_PWK;
 }

 if(drdi_get_hw_ver() == HW_VER_V1) {
...
}

0条评论

© 2024 芯缘异码. Powered by Typecho