Merge "app: aboot: Fix ROUND_TO_PAGE macro which is causing boot failure."
diff --git a/app/aboot/mdtp_fs.c b/app/aboot/mdtp_fs.c
index 39f456a..1c1ea44 100644
--- a/app/aboot/mdtp_fs.c
+++ b/app/aboot/mdtp_fs.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2017, 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
@@ -147,7 +147,7 @@
}
image_sets_num = mdtp_fs_get_param(IMAGE_SETS_NUM);
- if (image_sets_num < 1) {
+ if ( (image_sets_num < 1) || (image_sets_num >= MAX_IMAGES) ) {
dprintf(CRITICAL, "ERROR: invalid number of image sets: %d\n", image_sets_num);
return -1;
}
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 2e0a270..5b1c20e 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -229,6 +229,7 @@
int pm8x41_ldo_control(struct pm8x41_ldo *ldo, uint8_t enable);
uint8_t pm8x41_get_pmic_rev();
uint8_t pm8x41_get_pon_reason();
+uint8_t pm660_get_pon_reason();
uint8_t pm8950_get_pon_reason();
uint8_t pm8x41_get_pon_poff_reason1();
uint8_t pm8x41_get_pon_poff_reason2();
@@ -237,6 +238,7 @@
void pm8x41_enable_mpp(struct pm8x41_mpp *mpp, enum mpp_en_ctl enable);
void pm8x41_enable_mvs(struct pm8x41_mvs *mvs, enum mvs_en_ctl enable);
uint8_t pm8x41_get_is_cold_boot();
+uint8_t pm660_get_is_cold_boot();
void pm8x41_diff_clock_ctrl(uint8_t enable);
void pm8x41_clear_pmic_watchdog(void);
void pm8x41_lnbb_clock_ctrl(uint8_t enable);
diff --git a/dev/pmic/pm8x41/include/pm8x41_hw.h b/dev/pmic/pm8x41/include/pm8x41_hw.h
index 6484a10..d213582 100644
--- a/dev/pmic/pm8x41/include/pm8x41_hw.h
+++ b/dev/pmic/pm8x41/include/pm8x41_hw.h
@@ -69,6 +69,8 @@
/* PON Peripheral registers */
#define PON_PON_REASON1 0x808
+#define PM660_PON_REASON1 0x8C0
+#define PM660_PON_WARMBOOT_STATUS1 0x8C2
#define PON_WARMBOOT_STATUS1 0x80A
#define PON_WARMBOOT_STATUS2 0x80B
#define PON_POFF_REASON1 0x80C
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index 51a0f96..0c389eb 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -581,6 +581,11 @@
return REG_READ(REVID_REVISION4);
}
+uint8_t pm660_get_pon_reason()
+{
+ return REG_READ(PM660_PON_REASON1);
+}
+
uint8_t pm8x41_get_pon_reason()
{
return REG_READ(PON_PON_REASON1);
@@ -631,6 +636,15 @@
REG_WRITE(((mpp->base + MPP_MODE_CTL) + (mpp_slave_id << 16)), mpp->mode | (MPP_DIGITAL_OUTPUT << MPP_MODE_CTL_MODE_SHIFT));
}
+uint8_t pm660_get_is_cold_boot()
+{
+ if (REG_READ(PM660_PON_WARMBOOT_STATUS1)) {
+ dprintf(INFO,"%s: Warm boot\n", __func__);
+ return 0;
+ }
+ return 1;
+}
+
uint8_t pm8x41_get_is_cold_boot()
{
if (REG_READ(PON_WARMBOOT_STATUS1) || REG_READ(PON_WARMBOOT_STATUS2)) {
diff --git a/platform/msm_shared/smem.h b/platform/msm_shared/smem.h
index 74e0688..b931ca4 100644
--- a/platform/msm_shared/smem.h
+++ b/platform/msm_shared/smem.h
@@ -514,6 +514,7 @@
HW_PLATFORM_SUBTYPE_SWOC_NOWGR_CIRC = 13,
HW_PLATFORM_SUBTYPE_8909_PM660 = 15,
HW_PLATFORM_SUBTYPE_8909_COMPAL_ALPHA = 19,
+ HW_PLATFORM_SUBTYPE_8909_PM660_V1 = 18,
HW_PLATFORM_SUBTYPE_32BITS = 0x7FFFFFFF
};
diff --git a/target/msm8909/init.c b/target/msm8909/init.c
index 268bdab..5289a6e 100644
--- a/target/msm8909/init.c
+++ b/target/msm8909/init.c
@@ -644,15 +644,28 @@
unsigned target_pause_for_battery_charge(void)
{
- uint8_t pon_reason = pm8x41_get_pon_reason();
- uint8_t is_cold_boot = pm8x41_get_is_cold_boot();
- dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
- pon_reason, is_cold_boot);
+ uint32_t pmic = target_get_pmic();
+ uint8_t pon_reason = 0;
+ uint8_t is_cold_boot = 0;
+
/* In case of fastboot reboot,adb reboot or if we see the power key
* pressed we do not want go into charger mode.
* fastboot reboot is warm boot with PON hard reset bit not set
* adb reboot is a cold boot with PON hard reset bit set
*/
+ if (pmic == PMIC_IS_PM660)
+ {
+ pon_reason = pm660_get_pon_reason();
+ is_cold_boot = pm660_get_is_cold_boot();
+ }
+ else
+ {
+ pon_reason = pm8x41_get_pon_reason();
+ is_cold_boot = pm8x41_get_is_cold_boot();
+ }
+ dprintf(INFO, "%s : pon_reason is %d cold_boot:%d\n", __func__,
+ pon_reason, is_cold_boot);
+
if (is_cold_boot &&
(!(pon_reason & HARD_RST)) &&
(!(pon_reason & KPDPWR_N)) &&
@@ -826,7 +839,8 @@
uint32_t target_get_pmic()
{
- if (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_8909_PM660)
+ if ((board_hardware_subtype() == HW_PLATFORM_SUBTYPE_8909_PM660) ||
+ (board_hardware_subtype() == HW_PLATFORM_SUBTYPE_8909_PM660_V1))
return PMIC_IS_PM660;
else
return PMIC_IS_PM8909;
diff --git a/target/msm8909/oem_panel.c b/target/msm8909/oem_panel.c
index e4da42e..051f3cb 100644
--- a/target/msm8909/oem_panel.c
+++ b/target/msm8909/oem_panel.c
@@ -62,6 +62,7 @@
enum {
BG_WTP = 0x0F,
+ WTP_V1 = 0x12,
};
/*---------------------------------------------------------------------------*/
/* static panel selection variable */
@@ -484,6 +485,7 @@
case HW_PLATFORM_RCM:
switch (platform_subtype) {
case BG_WTP:
+ case WTP_V1:
panel_id = AUO_390P_CMD_PANEL;
break;
default:
diff --git a/target/msm8909/target_display.c b/target/msm8909/target_display.c
index 526b138..cbb921c 100755
--- a/target/msm8909/target_display.c
+++ b/target/msm8909/target_display.c
@@ -201,7 +201,8 @@
if (bl->bl_interface_type == BL_DCS)
return 0;
- if (!((HW_PLATFORM_SUBTYPE_8909_PM660 == platform_subtype) &&
+ if (!(((HW_PLATFORM_SUBTYPE_8909_PM660 == platform_subtype) ||
+ (HW_PLATFORM_SUBTYPE_8909_PM660_V1 == platform_subtype)) &&
((MSM8909W == platform) || (APQ8009W == platform)) &&
(HW_PLATFORM_MTP == hw_id))) {
struct pm8x41_mpp mpp;
@@ -298,7 +299,8 @@
uint32_t hw_subtype = board_hardware_subtype();
uint32_t platform = board_platform_id();
- if ((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) &&
+ if (((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) ||
+ (HW_PLATFORM_SUBTYPE_8909_PM660_V1 == hw_subtype)) &&
((MSM8909W == platform) || (APQ8009W == platform)) &&
(HW_PLATFORM_MTP == hw_id)) {
struct pm8x41_gpio bobgpio_param = {
@@ -353,7 +355,8 @@
uint32_t platform = board_platform_id();
if (enable) {
- if ((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) &&
+ if (((HW_PLATFORM_SUBTYPE_8909_PM660 == hw_subtype) ||
+ (HW_PLATFORM_SUBTYPE_8909_PM660_V1 == hw_subtype)) &&
((MSM8909W == platform) || (APQ8009W == platform)) &&
(HW_PLATFORM_MTP == hw_id))
regulator_enable(REG_LDO12 | REG_LDO5 | REG_LDO11 | REG_LDO18);