Merge "platform: msm_shared: Enable crypto clocks only once"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 7ff5fae..df9a6be 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -76,6 +76,7 @@
#include <wdog.h>
#endif
+#include <reboot.h>
#include "image_verify.h"
#include "recovery.h"
#include "bootimg.h"
@@ -122,14 +123,6 @@
#define MAX_TAGS_SIZE 1024
-#define RECOVERY_HARD_RESET_MODE 0x01
-#define FASTBOOT_HARD_RESET_MODE 0x02
-#define RTC_HARD_RESET_MODE 0x03
-
-#define RECOVERY_MODE 0x77665502
-#define FASTBOOT_MODE 0x77665500
-#define ALARM_BOOT 0x77665503
-
/* make 4096 as default size to ensure EFS,EXT4's erasing */
#define DEFAULT_ERASE_SIZE 4096
#define MAX_PANEL_BUF_SIZE 128
@@ -3180,7 +3173,6 @@
void aboot_init(const struct app_descriptor *app)
{
unsigned reboot_mode = 0;
- unsigned hard_reboot_mode = 0;
bool boot_into_fastboot = false;
/* Setup page size information for nv storage */
@@ -3260,16 +3252,21 @@
boot_into_fastboot = true;
#endif
+#if USE_PON_REBOOT_REG
+ reboot_mode = check_hard_reboot_mode();
+#else
reboot_mode = check_reboot_mode();
- hard_reboot_mode = check_hard_reboot_mode();
- if (reboot_mode == RECOVERY_MODE ||
- hard_reboot_mode == RECOVERY_HARD_RESET_MODE) {
+#endif
+ if (reboot_mode == RECOVERY_MODE)
+ {
boot_into_recovery = 1;
- } else if(reboot_mode == FASTBOOT_MODE ||
- hard_reboot_mode == FASTBOOT_HARD_RESET_MODE) {
+ }
+ else if(reboot_mode == FASTBOOT_MODE)
+ {
boot_into_fastboot = true;
- } else if(reboot_mode == ALARM_BOOT ||
- hard_reboot_mode == RTC_HARD_RESET_MODE) {
+ }
+ else if(reboot_mode == ALARM_BOOT)
+ {
boot_reason_alarm = true;
}
diff --git a/dev/gcdb/display/include/panel_hx8394d_720p_video.h b/dev/gcdb/display/include/panel_hx8394d_720p_video.h
index ac4806f..1c05b35 100644
--- a/dev/gcdb/display/include/panel_hx8394d_720p_video.h
+++ b/dev/gcdb/display/include/panel_hx8394d_720p_video.h
@@ -47,7 +47,7 @@
static struct panel_config hx8394d_720p_video_panel_data = {
"qcom,mdss_dsi_hx8394d_720p_video", "dsi:0:", "qcom,mdss-dsi-panel",
- 10, 0, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+ 10, 0, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL
};
/*---------------------------------------------------------------------------*/
@@ -259,14 +259,6 @@
0x79, 0x1a, 0x12, 0x00, 0x3e, 0x42, 0x16, 0x1e, 0x15, 0x03, 0x04, 0x00
};
-
-
-static struct mipi_dsi_cmd hx8394d_720p_video_rotation[] = {
-
-};
-#define HX8394D_720P_VIDEO_ROTATION 0
-
-
static struct panel_timing hx8394d_720p_video_timing_info = {
0, 4, 0x04, 0x1b
};
diff --git a/dev/gcdb/display/include/panel_hx8399a_1080p_video.h b/dev/gcdb/display/include/panel_hx8399a_1080p_video.h
index 0ac37ac..f2d828e 100644
--- a/dev/gcdb/display/include/panel_hx8399a_1080p_video.h
+++ b/dev/gcdb/display/include/panel_hx8399a_1080p_video.h
@@ -40,7 +40,7 @@
/*---------------------------------------------------------------------------*/
static struct panel_config hx8399a_1080p_video_panel_data = {
"qcom,mdss_dsi_hx8399a_1080p_video", "dsi:0:", "qcom,mdss-dsi-panel",
- 10, 0, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL
+ 10, 0, "DISPLAY_1", 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 866400000, 0, 0, 0, NULL
};
/*---------------------------------------------------------------------------*/
diff --git a/include/platform.h b/include/platform.h
index 50ef337..9c8e698 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -71,4 +71,5 @@
uint32_t platform_get_max_periph();
int platform_is_msm8996();
uint64_t platform_get_ddr_start();
+bool platform_use_qmp_misc_settings();
#endif
diff --git a/platform/msm8996/platform.c b/platform/msm8996/platform.c
index 090e81c..08c0025 100644
--- a/platform/msm8996/platform.c
+++ b/platform/msm8996/platform.c
@@ -222,3 +222,11 @@
{
return ddr_start;
}
+
+bool platform_use_qmp_misc_settings()
+{
+ if (board_soc_version() < 0x30000)
+ return true;
+
+ return false;
+}
diff --git a/platform/msm_shared/bam.c b/platform/msm_shared/bam.c
index 723ce00..ef39321 100644
--- a/platform/msm_shared/bam.c
+++ b/platform/msm_shared/bam.c
@@ -139,16 +139,7 @@
/* Reset and initialize the bam module */
void bam_init(struct bam_instance *bam)
{
- /* Check for only one pipe's direction.
- * The other is assumed to be the opposite system
- * transaction.
- */
- if (bam->pipe[0].trans_type == SYS2BAM ||
- bam->pipe[0].trans_type == BAM2SYS)
- {
- /* Program the threshold count */
- writel(bam->threshold, BAM_DESC_CNT_TRSHLD_REG(bam->base));
- }
+ /* bam is initialized by TZ, so nothing needs to be done here */
}
/* Funtion to setup a simple fifo structure.
diff --git a/platform/msm_shared/include/bam.h b/platform/msm_shared/include/bam.h
index bfeb34b..67b2f5f 100644
--- a/platform/msm_shared/include/bam.h
+++ b/platform/msm_shared/include/bam.h
@@ -71,7 +71,6 @@
#define BAM_DATA_READ 0
#define BAM_DATA_WRITE 1
-#define BAM_DESC_CNT_TRSHLD_REG(x) (0x0008 + (x))
#define COUNT_TRESHOLD_MASK 0xFF
#define BAM_IRQ_MASK (1 << 31)
#define P_IRQ_MASK (1)
diff --git a/platform/msm_shared/qmp_usb30_phy.c b/platform/msm_shared/qmp_usb30_phy.c
index 54a8831..91aed89 100644
--- a/platform/msm_shared/qmp_usb30_phy.c
+++ b/platform/msm_shared/qmp_usb30_phy.c
@@ -36,6 +36,7 @@
#include <clock.h>
#include <debug.h>
#include <qtimer.h>
+#include <platform.h>
#define HS_PHY_COMMON_CTRL 0xEC
#define USE_CORECLK BIT(14)
@@ -64,15 +65,11 @@
{0x174, 0x30}, /* QSERDES_COM_CLK_SELECT */
{0x194, 0x06}, /* QSERDES_COM_CMN_CONFIG */
{0x19c, 0x01}, /* QSERDES_COM_SVS_MODE_CLK_SEL */
- {0x178, 0x01}, /* QSERDES_COM_HSCLK_SEL */
+ {0x178, 0x00}, /* QSERDES_COM_HSCLK_SEL */
{0x70, 0x0F}, /* USB3PHY_QSERDES_COM_BG_TRIM */
{0x48, 0x0F}, /* USB3PHY_QSERDES_COM_PLL_IVCO */
{0x3C, 0x04}, /* QSERDES_COM_SYS_CLK_CTRL */
- /* Res_code Settings */
- {0xC4, 0x15}, /* USB3PHY_QSERDES_COM_RESCODE_DIV_NUM */
- {0x1B8, 0x1F}, /* QSERDES_COM_CMN_MISC2 */
-
/* PLL & Loop filter settings */
{0xd0, 0x82}, /* QSERDES_COM_DEC_START_MODE0 */
{0xdc, 0x55}, /* QSERDES_COM_DIV_FRAC_START1_MODE0 */
@@ -134,6 +131,15 @@
{0x600, 0x00}, /* USB3_PHY_SW_RESET */
};
+#if PLATFORM_USE_QMP_MISC
+struct qmp_reg qmp_misc_settings_rev2[] =
+{
+ {0x178, 0x01}, /* QSERDES_COM_HSCLK_SEL */
+ {0xC4, 0x15}, /* USB3PHY_QSERDES_COM_RESCODE_DIV_NUM */
+ {0x1B8, 0x1F}, /* QSERDES_COM_CMN_MISC2 */
+};
+#endif
+
__WEAK uint32_t target_override_pll()
{
return 0;
@@ -265,6 +271,11 @@
for (i = 0 ; i < qmp_reg_size; i++)
writel(qmp_settings_rev2[i].val, QMP_PHY_BASE + qmp_settings_rev2[i].off);
+#if PLATFORM_USE_QMP_MISC
+ if (platform_use_qmp_misc_settings())
+ for (i = 0; i < ARRAY_SIZE(qmp_misc_settings_rev2); i++)
+ writel(qmp_misc_settings_rev2[i].val, QMP_PHY_BASE + qmp_misc_settings_rev2[i].off);
+#endif
if (target_override_pll())
{
qmp_reg_size = sizeof(qmp_override_pll_rev2) / sizeof(struct qmp_reg);
diff --git a/platform/msm_shared/reboot.c b/platform/msm_shared/reboot.c
index 2fe514e..8f53633 100644
--- a/platform/msm_shared/reboot.c
+++ b/platform/msm_shared/reboot.c
@@ -69,14 +69,12 @@
unsigned check_hard_reboot_mode(void)
{
uint8_t hard_restart_reason = 0;
- uint8_t value = 0;
/* Read reboot reason and scrub it
* Bit-5, bit-6 and bit-7 of SOFT_RB_SPARE for hard reset reason
*/
- value = REG_READ(PON_SOFT_RB_SPARE);
- hard_restart_reason = value >> 5;
- REG_WRITE(PON_SOFT_RB_SPARE, value & 0x1f);
+ hard_restart_reason = REG_READ(PON_SOFT_RB_SPARE);
+ REG_WRITE(PON_SOFT_RB_SPARE, hard_restart_reason & 0x1f);
return hard_restart_reason;
}
@@ -112,7 +110,7 @@
#if USE_PON_REBOOT_REG
value = REG_READ(PON_SOFT_RB_SPARE);
- value |= ((reboot_reason << 5) & 0xff);
+ value |= reboot_reason;
REG_WRITE(PON_SOFT_RB_SPARE, value);
#else
writel(reboot_reason, RESTART_REASON_ADDR);
diff --git a/platform/msm_shared/reboot.h b/platform/msm_shared/reboot.h
index c87f9d8..bf39988 100644
--- a/platform/msm_shared/reboot.h
+++ b/platform/msm_shared/reboot.h
@@ -26,9 +26,15 @@
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#if USE_PON_REBOOT_REG
+#define RECOVERY_MODE 0x20
+#define FASTBOOT_MODE 0x40
+#define ALARM_BOOT 0x60
+#else
#define FASTBOOT_MODE 0x77665500
#define RECOVERY_MODE 0x77665502
#define ALARM_BOOT 0x77665503
+#endif
#define RTC_TRG 4
#define PON_SOFT_RB_SPARE 0x88F
diff --git a/project/msm8996.mk b/project/msm8996.mk
index 4f6d1db..0484d6e 100644
--- a/project/msm8996.mk
+++ b/project/msm8996.mk
@@ -87,3 +87,7 @@
ENABLE_REBOOT_MODULE := 1
#fuse for Qusb tun2 config
DEFINES += QFPROM_CORR_CALIB_ROW12_MSB=0x0007424C
+#Use misc settings for qmp
+DEFINES += PLATFORM_USE_QMP_MISC=1
+#Use PON register for reboot reason
+DEFINES += USE_PON_REBOOT_REG=1
diff --git a/target/msm8909/init.c b/target/msm8909/init.c
index b115bf8..bfceeea 100644
--- a/target/msm8909/init.c
+++ b/target/msm8909/init.c
@@ -548,7 +548,7 @@
if (is_cold_boot &&
(!(pon_reason & HARD_RST)) &&
(!(pon_reason & KPDPWR_N)) &&
- ((pon_reason & USB_CHG) || (pon_reason & DC_CHG)))
+ ((pon_reason & USB_CHG) || (pon_reason & DC_CHG) || (pon_reason & CBLPWR_N)))
return 1;
else
return 0;
diff --git a/target/msm8952/oem_panel.c b/target/msm8952/oem_panel.c
index 57e069f..4d448bf 100644
--- a/target/msm8952/oem_panel.c
+++ b/target/msm8952/oem_panel.c
@@ -53,6 +53,7 @@
#include "include/panel_hx8399a_1080p_video.h"
#include "include/panel_nt35597_wqxga_dsc_video.h"
#include "include/panel_nt35597_wqxga_dsc_cmd.h"
+#include "include/panel_hx8394d_720p_video.h"
/*---------------------------------------------------------------------------*/
/* static panel selection variable */
@@ -67,6 +68,7 @@
HX8399A_1080P_VIDEO_PANEL,
NT35597_WQXGA_DSC_VIDEO_PANEL,
NT35597_WQXGA_DSC_CMD_PANEL,
+ HX8394D_720P_VIDEO_PANEL,
UNKNOWN_PANEL
};
@@ -88,6 +90,7 @@
{"hx8399a_1080p_video", HX8399A_1080P_VIDEO_PANEL},
{"nt35597_wqxga_dsc_video", NT35597_WQXGA_DSC_VIDEO_PANEL},
{"nt35597_wqxga_dsc_cmd", NT35597_WQXGA_DSC_CMD_PANEL},
+ {"hx8394d_720p_video", HX8394D_720P_VIDEO_PANEL},
};
static uint32_t panel_id;
@@ -403,6 +406,31 @@
pinfo->dsc.dsi_dsc_config = mdss_dsc_dsi_config;
pinfo->dsc.mdp_dsc_config = mdss_dsc_mdp_config;
break;
+ case HX8394D_720P_VIDEO_PANEL:
+ panelstruct->paneldata = &hx8394d_720p_video_panel_data;
+ panelstruct->panelres = &hx8394d_720p_video_panel_res;
+ panelstruct->color = &hx8394d_720p_video_color;
+ panelstruct->videopanel = &hx8394d_720p_video_video_panel;
+ panelstruct->commandpanel = &hx8394d_720p_video_command_panel;
+ panelstruct->state = &hx8394d_720p_video_state;
+ panelstruct->laneconfig = &hx8394d_720p_video_lane_config;
+ panelstruct->paneltiminginfo
+ = &hx8394d_720p_video_timing_info;
+ panelstruct->panelresetseq
+ = &hx8394d_720p_video_panel_reset_seq;
+ panelstruct->backlightinfo = &hx8394d_720p_video_backlight;
+ pinfo->mipi.panel_on_cmds
+ = hx8394d_720p_video_on_command;
+ pinfo->mipi.num_of_panel_on_cmds
+ = HX8394D_720P_VIDEO_ON_COMMAND;
+ pinfo->mipi.panel_off_cmds
+ = hx8394d_720p_video_off_command;
+ pinfo->mipi.num_of_panel_off_cmds
+ = HX8394D_720P_VIDEO_OFF_COMMAND;
+ memcpy(phy_db->timing,
+ hx8394d_720p_video_timings, TIMING_SIZE);
+ pinfo->mipi.signature = HX8394D_720P_VIDEO_SIGNATURE;
+ break;
case UNKNOWN_PANEL:
default:
memset(panelstruct, 0, sizeof(struct panel_struct));