project: mdm9640: Enable the feature SCM DLOAD mode
Enable PLATFORM_USE_SCM_DLOAD to make scm calls to write the
dload misc to boot_misc_detect register. Also Disable the watch
dog S2 stage reset during the dload mode reset.
Change-Id: I3a466ff95dcbc422f462ee1a80be09551f28fb3f
diff --git a/platform/mdm9640/include/platform/iomap.h b/platform/mdm9640/include/platform/iomap.h
index 6981256..d8c3a0b 100644
--- a/platform/mdm9640/include/platform/iomap.h
+++ b/platform/mdm9640/include/platform/iomap.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2014-2016, 2021 The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -226,4 +226,5 @@
/* notify RPM via IPC interrupt*/
#define APCS_HLOS_IPC_INTERRUPT_0 APCS_ALIAS0_IPC_INTERRUPT
+#define TCSR_BOOT_MISC_DETECT 0x193D100
#endif
diff --git a/project/mdm9640.mk b/project/mdm9640.mk
index 19ef230..465cbdf 100644
--- a/project/mdm9640.mk
+++ b/project/mdm9640.mk
@@ -62,6 +62,9 @@
CFLAGS += -Werror
DEFINES += USE_TARGET_QMP_SETTINGS=1
+#SCM call before entering DLOAD mode
+DEFINES += PLATFORM_USE_SCM_DLOAD=1
+
#Use PON register for reboot reason
ENABLE_REBOOT_MODULE := 1
DEFINES += USE_PON_REBOOT_REG=1
\ No newline at end of file
diff --git a/target/mdm9640/init.c b/target/mdm9640/init.c
index 40cdf4d..a1bc39e 100644
--- a/target/mdm9640/init.c
+++ b/target/mdm9640/init.c
@@ -220,6 +220,16 @@
target_crypto_init_params();
}
+int set_download_mode(enum reboot_reason mode)
+{
+ int ret = 0;
+ ret = scm_dload_mode(mode);
+
+ pm8x41_clear_pmic_watchdog();
+
+ return ret;
+}
+
/* Identify the current target */
void target_detect(struct board_data *board)
{