Skip to content

Instantly share code, notes, and snippets.

@ave4
Created April 29, 2022 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ave4/b4ac6c8a3abd3fd5d5b9f255cb2719d3 to your computer and use it in GitHub Desktop.
Save ave4/b4ac6c8a3abd3fd5d5b9f255cb2719d3 to your computer and use it in GitHub Desktop.
From 8433594834dae6e1e4d159bb6a75b69fd05ab743 Mon Sep 17 00:00:00 2001
From: Maxim Kutnij <gtk3@inbox.ru>
Date: Wed, 27 Apr 2022 21:24:34 +0500
Subject: [PATCH 1/2] midas: enable ums by "power + home"
---
board/samsung/midas/midas.c | 14 ++++++++++++--
board/samsung/midas/midas.h | 1 +
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/board/samsung/midas/midas.c b/board/samsung/midas/midas.c
index 99aebb7d74..4df414edb7 100644
--- a/board/samsung/midas/midas.c
+++ b/board/samsung/midas/midas.c
@@ -41,6 +41,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define COMBO_RECOVERY (COMBO_POWER | COMBO_VOL_UP | COMBO_HOME)
#define COMBO_FASTBOOT (COMBO_POWER | COMBO_VOL_DOWN | COMBO_HOME)
#define COMBO_UBOOT_CONSOLE (COMBO_POWER | COMBO_VOL_UP | COMBO_VOL_DOWN)
+#define COMBO_UMS (COMBO_POWER | COMBO_HOME)
static uint64_t board_serial = 0;
static char board_rev = 0xff;
@@ -147,7 +148,7 @@ static void board_gpio_init(void)
static int midas_check_battery(void)
{
- struct udevice *bat, *extcon, *charger;
+ /*struct udevice *bat, *extcon, *charger;
int ret, state, current, old_soc, soc;
ret = uclass_get_device(UCLASS_BATTERY, 0, &bat);
@@ -215,7 +216,8 @@ static int midas_check_battery(void)
printf("error: battery too low - charger disconnected");
return BATTERY_ABORT;
}
- return BATTERY_LPM;
+ return BATTERY_LPM;*/
+ return 0;
}
static int midas_phy_control(int on)
@@ -417,6 +419,8 @@ static enum boot_mode midas_check_keycombo(void)
return MODE_FASTBOOT;
case COMBO_UBOOT_CONSOLE:
return MODE_CONSOLE;
+ case COMBO_UMS:
+ return MODE_UMS;
}
/* Power key pressed means that LPM should be skipped.
@@ -534,6 +538,12 @@ int exynos_late_init(void)
env_set("bootcmd", NULL);
env_set("bootmode", "console");
break;
+ case MODE_UMS:
+ printf("usb mass storage\n");
+ midas_led_action(LED_RED | LED_BLUE, LEDST_ON);
+ env_set("bootcmd", "ums 0 mmc 1");
+ env_set("bootmode", "recovery");
+ break;
default:
printf("Booting normally...\n");
midas_led_action(LED_GREEN | LED_RED, LEDST_ON);
diff --git a/board/samsung/midas/midas.h b/board/samsung/midas/midas.h
index bafd1f9739..aefd503923 100644
--- a/board/samsung/midas/midas.h
+++ b/board/samsung/midas/midas.h
@@ -18,6 +18,7 @@ enum boot_mode {
MODE_RECOVERY = 0x2,
MODE_CONSOLE = 0x3,
MODE_LAST = 0x4,
+ MODE_UMS = 0x5,
MODE_MAX = 0xf,
MODE_NONE = 0xff,
--
2.36.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment