[Feature][ZXW-241]merge P56U01 version
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I7985538dde6951dd824c36149bf9a1e3ca23c734
diff --git a/boot/common/src/uboot/drivers/power/zx234290.c b/boot/common/src/uboot/drivers/power/zx234290.c
index 90a52e2..e8f083f 100755
--- a/boot/common/src/uboot/drivers/power/zx234290.c
+++ b/boot/common/src/uboot/drivers/power/zx234290.c
@@ -125,6 +125,43 @@
#endif
}
+
+void zx234290_set_rtc_alarm_off(void)
+{
+ int ret = 0;
+ uchar tmp = 0;
+
+ //set alarm active bit 1 disable
+ ret = zx234290_i2c_read_reg(ZX234290_REG_ADDR_ALARM_MINUTE, &tmp);
+ tmp |= (1<<ZX234290_RTC_AlARM_ACTIVATED_LSH);
+ ret |= zx234290_i2c_write_reg(ZX234290_REG_ADDR_ALARM_MINUTE, &tmp);
+
+ ret |= zx234290_i2c_read_reg(ZX234290_REG_ADDR_ALARM_HOUR, &tmp);
+ tmp |= (1<<ZX234290_RTC_AlARM_ACTIVATED_LSH);
+ ret |= zx234290_i2c_write_reg(ZX234290_REG_ADDR_ALARM_HOUR, &tmp);
+
+ ret |= zx234290_i2c_read_reg(ZX234290_REG_ADDR_ALARM_DAY, &tmp);
+ tmp |= (1<<ZX234290_RTC_AlARM_ACTIVATED_LSH);
+ ret |= zx234290_i2c_write_reg(ZX234290_REG_ADDR_ALARM_DAY, &tmp);
+
+ ret = zx234290_i2c_read_reg(ZX234290_REG_ADDR_ALARM_WEEK, &tmp);
+ tmp |= (1<<ZX234290_RTC_AlARM_ACTIVATED_LSH);
+ ret |= zx234290_i2c_write_reg(ZX234290_REG_ADDR_ALARM_WEEK, &tmp);
+
+
+ ret |= zx234290_i2c_read_reg(ZX234290_REG_ADDR_ALARM_SECOND, &tmp);
+ tmp |= (1<<ZX234290_RTC_AlARM_ACTIVATED_LSH);
+ ret |= zx234290_i2c_write_reg(ZX234290_REG_ADDR_ALARM_SECOND, &tmp);
+
+ /*disable AIE bit && AF*/
+ ret |= zx234290_i2c_read_reg(ZX234290_REG_RTC_CONTROL2, &tmp);
+ tmp &= ~(RTC_CONTROL2_AIE|RTC_CONTROL2_AF);
+ ret |= zx234290_i2c_write_reg(ZX234290_REG_RTC_CONTROL2, &tmp);
+
+ if(ret)
+ printf( "[%s] fail ret=%d...\n", __FUNCTION__, ret);
+
+}
/*******************************************************************************
* Function: zx234290_get_boot_reason
* Description:
@@ -222,6 +259,7 @@
if (rtc_ctrl2 & RTC_CONTROL2_AF) {
s_boot_reason = RB_RTC;
+ zx234290_set_rtc_alarm_off();
} else if (rtc_ctrl2 & RTC_CONTROL2_TF) {
s_boot_reason = RB_RESET_NOMAL;
}
@@ -375,12 +413,11 @@
pmu.ps_hold_pull_off = pmu_pull_off_ps_hold;
pmu.power_off = zx234290_power_off;
ret = register_pmu_opt(&pmu);
- /*
if( ret != 0 )
{
return -EIO;
}
- */
+
ret = zx234290_get_boot_reason_prev();
ret +=zx234290_i2c_read_reg(ZX234297_REG_ADDR_SINK_CONTROL,®_val);
if(reg_val==0x7f){//means 296G C