From a2ba2ecf2671796a79e85781f7fbb3beefbcb129 Mon Sep 17 00:00:00 2001 From: "ctcaer@gmail.com" Date: Tue, 16 Apr 2019 19:58:12 +0300 Subject: [PATCH] Battery "desync" fix is now applied on boot --- bootloader/frontend/fe_emmc_tools.c | 2 +- bootloader/frontend/fe_tools.c | 12 ------------ bootloader/main.c | 1 - bootloader/soc/hw_init.c | 3 +++ 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/bootloader/frontend/fe_emmc_tools.c b/bootloader/frontend/fe_emmc_tools.c index f2d78b2..f3f1af3 100644 --- a/bootloader/frontend/fe_emmc_tools.c +++ b/bootloader/frontend/fe_emmc_tools.c @@ -52,8 +52,8 @@ static int _dump_emmc_verify(sdmmc_storage_t *storage, u32 lba_curr, char *outFi u8 sparseShouldVerify = 4; u32 btn = 0; u32 prevPct = 200; - int res = 0; u32 sdFileSector = 0; + int res = 0; u8 hashEm[0x20]; u8 hashSd[0x20]; diff --git a/bootloader/frontend/fe_tools.c b/bootloader/frontend/fe_tools.c index 6e7c43e..7a2ec64 100644 --- a/bootloader/frontend/fe_tools.c +++ b/bootloader/frontend/fe_tools.c @@ -458,18 +458,6 @@ void _fix_sd_attr(u32 type) void fix_sd_all_attr() { _fix_sd_attr(0); } void fix_sd_nin_attr() { _fix_sd_attr(1); } -void fix_battery_desync() -{ - gfx_clear_partial_grey(0x1B, 0, 1256); - gfx_con_setpos(0, 0); - - max77620_low_battery_monitor_config(); - - gfx_puts("\nDone!\n"); - - btn_wait(); -} - /* void fix_fuel_gauge_configuration() { gfx_clear_partial_grey(0x1B, 0, 1256); diff --git a/bootloader/main.c b/bootloader/main.c index db8e831..7601976 100644 --- a/bootloader/main.c +++ b/bootloader/main.c @@ -1081,7 +1081,6 @@ ment_t ment_tools[] = { MDEF_CHGLINE(), MDEF_CAPTION("-------- Misc --------", 0xFF0AB9E6), MDEF_HANDLER("Dump package1/2", dump_packages12), - MDEF_HANDLER("Fix battery de-sync", fix_battery_desync), MDEF_HANDLER("Fix archive bit (except Nintendo)", fix_sd_all_attr), MDEF_HANDLER("Fix archive bit (Nintendo only)", fix_sd_nin_attr), //MDEF_HANDLER("Fix fuel gauge configuration", fix_fuel_gauge_configuration), diff --git a/bootloader/soc/hw_init.c b/bootloader/soc/hw_init.c index 1c2e92a..2282435 100644 --- a/bootloader/soc/hw_init.c +++ b/bootloader/soc/hw_init.c @@ -239,6 +239,9 @@ void config_hw() i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_GPIO5, 2); i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_GPIO6, 2); + // Disable low battery shutdown monitor. + max77620_low_battery_monitor_config(); + _config_pmc_scratch(); // Missing from 4.x+ CLOCK(CLK_RST_CONTROLLER_SCLK_BURST_POLICY) = (CLOCK(CLK_RST_CONTROLLER_SCLK_BURST_POLICY) & 0xFFFF8888) | 0x3333;