[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/boot/common/src/uboot/drivers/peripheral/Makefile b/boot/common/src/uboot/drivers/peripheral/Makefile
new file mode 100755
index 0000000..8ecd566
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/Makefile
@@ -0,0 +1,61 @@
+#
+# (C) Copyright 2000-2007
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB := $(obj)libperipheral.o
+
+COBJS-$(CONFIG_ZX297520V3E_CPE) += peripheral.o
+COBJS-$(CONFIG_ZX297520V3E_CPE_SWITCH) += peripheral_cpe_switch.o
+COBJS-$(CONFIG_ZX297520V3E_EVB) += peripheral.o
+COBJS-$(CONFIG_ZX297520V3E_FWP) += peripheral_fwp.o
+COBJS-$(CONFIG_ZX297520V3E_MDL) += peripheral.o
+COBJS-$(CONFIG_ZX297520V3E_MDL_MINI) += peripheral.o
+COBJS-$(CONFIG_ZX297520V3E_MDL_MINI_64) += peripheral.o
+COBJS-$(CONFIG_ZX297520V3E_MIFI) += peripheral_mifi.o
+COBJS-$(CONFIG_ZX297520V3E_MIFI_MINI) += peripheral_mifi_mini.o
+COBJS-$(CONFIG_ZX297520V3E_MIFI_MINI_XR819) += peripheral_mifi_mini_xr819.o
+COBJS-$(CONFIG_ZX297520V3E_PHONE) += peripheral_phone.o
+COBJS-$(CONFIG_ZX297520V3E_WATCH) += peripheral_watch.o
+COBJS-$(CONFIG_ZX297520V3E_WATCH_CAP) += peripheral_watch.o
+COBJS-$(CONFIG_ZX297520V3E_UFI_MINI) += peripheral.o
+COBJS-$(CONFIG_ZX297520V3E_MDL_AB) += peripheral.o
+COBJS-$(CONFIG_ZX297520V3E_VEHICLE_DC) += peripheral.o
+
+COBJS := $(sort $(COBJS-y))
+SRCS := $(COBJS:.o=.c)
+OBJS := $(addprefix $(obj),$(COBJS))
+
+all: $(LIB)
+
+$(LIB): $(obj).depend $(OBJS)
+ $(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral.c b/boot/common/src/uboot/drivers/peripheral/peripheral.c
new file mode 100644
index 0000000..564c2ca
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral.c
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZIXC Corporation.
+ *
+ * File Name: hal_led.c
+ * File Mark:
+ * Description: This file contains the hal layer routines for i2c driver.
+ * Others:
+ * Version: V1.0
+ * Author: yx
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+//#include "drvs_general.h"
+//#include "drvs_i2c.h"
+#include <linux/types.h>
+#include <zx234290.h>
+#include <led.h>
+#include "common.h"
+//#include <gpio.h>
+
+/****************************************************************************
+* Local Macros
+****************************************************************************/
+#define SD1_IO_1V8_EN 0x13c830
+#define REG32(x) (*(volatile u32*)(x))
+
+/****************************************************************************
+* Local Types
+****************************************************************************/
+
+/****************************************************************************
+* Local Constants
+****************************************************************************/
+
+
+/****************************************************************************
+ * Function: peripheral_init
+ * Description: init the peripheral include pmu\charger\led\lcd etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int peripheral_init(void)
+{
+ int ret = 0;
+ ret = power_init();
+
+/*led*/
+
+/*lcd*/
+
+ /* jtagµ÷ÊÔ */
+#if 0
+ jtag_init();
+#endif
+
+#if 0//ref need ldo8 2.85V
+/*set mmc io and vccQ*/
+ zx234290_set_ldo8_voltage(VLDOD_1_800);
+ zx234290_set_ldo8_sleep_voltage(VLDOD_1_800);
+ zx234290_ldo8_enable(1);
+
+ REG32(SD1_IO_1V8_EN) |=(1<<1);
+#endif
+ zx234502_charger_enable();
+
+ return ret ;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateWait
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateWait(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateSucc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateSucc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateFail
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateFail(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_LowPower
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_LowPower(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_No_Battery
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_No_Battery(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_PowerOn_Normal(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Fota(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+
+/****************************************************************************
+ * Function: Show_Charging
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_Charging(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: zx_get_vbat_voltage
+ * Description: .
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int zx_get_vbat_voltage(void)
+{
+ // int ret = 0;
+
+ return zx234290_get_adc1_voltage();
+}
+
+/****************************************************************************
+ * Function: zx_get_battery_Status
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+unsigned int zx_get_battery_Status(void)
+{
+ int ret = 0;
+ int boost_flag = 1;
+
+ zx234502_battery_status(&boost_flag);
+ if(boost_flag){
+ return 0;/*battery uninstall*/
+ }
+ else
+ return 1;/*battery install*/
+}
+
+
+
+
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral_cpe_switch.c b/boot/common/src/uboot/drivers/peripheral/peripheral_cpe_switch.c
new file mode 100644
index 0000000..1c37dfe
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral_cpe_switch.c
@@ -0,0 +1,62 @@
+/*
+ ******************************************************************************
+ * Copyright (C) 2016, ZIXC Corporation.
+ *
+ * File Name: hal_led.c
+ * File Mark:
+ * Description: This file contains the hal layer routines for i2c driver.
+ * Others:
+ * Version: V1.0
+ * Author: yx
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ *****************************************************************************
+ */
+
+/*
+***************************************************************************
+* Include files
+***************************************************************************
+*/
+#include <linux/types.h>
+#include <zx234290.h>
+#include <led.h>
+
+/*
+***************************************************************************
+* Local Macros
+***************************************************************************
+*/
+
+
+/*
+ ***************************************************************************
+ * Function: peripheral_init
+ * Description: init the peripheral include pmu\charger\led\lcd etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ **************************************************************************
+ */
+int peripheral_init(void)
+{
+ int ret = 0;
+ ret = power_init();
+
+ zx29_led_init();
+
+ return ret ;
+}
+
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral_fwp.c b/boot/common/src/uboot/drivers/peripheral/peripheral_fwp.c
new file mode 100644
index 0000000..6a09eee
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral_fwp.c
@@ -0,0 +1,385 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: hal_led.c
+ * File Mark:
+ * Description: This file contains the hal layer routines for i2c driver.
+ * Others:
+ * Version: V1.0
+ * Author: yx
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include <common.h>
+//#include "drvs_general.h"
+//#include "drvs_i2c.h"
+#include <linux/types.h>
+#include <power.h>
+#include <zx234290.h>
+#include <led.h>
+#include <lcd.h>
+//#include <lcd_blg.h>
+#include <charge.h>
+#include <zx234502.h>
+#include <partition_table.h>
+#include <linux/mtd/compat.h>
+/****************************************************************************
+* Local Macros
+****************************************************************************/
+#define CHARGER_EN_GPIO GPIO40
+#define CHARGER_EN_GPIO_FUN GPIO40_GPIO40
+/****************************************************************************
+* Local Types
+****************************************************************************/
+
+/****************************************************************************
+* Local Constants
+****************************************************************************/
+static void ms_delay(unsigned long ms)
+{
+ volatile int i = 0;
+ while (i < (50000 * ms)) {i++;}
+}
+
+/****************************************************************************
+ * Function: peripheral_init
+ * Description: init the peripheral include pmu\charger\led\lcd etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int peripheral_init(void)
+{
+ int ret = 0;
+ ret = power_init();
+
+ /*charger enable*/
+ zDrvGpio_SetFunc(CHARGER_EN_GPIO,CHARGER_EN_GPIO_FUN);
+ zDrvGpio_SetDirection(CHARGER_EN_GPIO,GPIO_OUT);
+ zDrvGpio_SetOutputValue(CHARGER_EN_GPIO,GPIO_HIGH);
+
+ /*reset for the TF card LD08 */
+ zx234290_ldo8_enable(0);
+ udelay(100000/20); /*50ms*/
+ zx234290_ldo8_enable(1);
+
+ return ret ;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateWait
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateWait(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateSucc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateSucc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateFail
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateFail(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_LowPower
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_LowPower(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowLowBattery();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+ zDrvLcd_SetPulseLevel(14);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_No_Battery
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_No_Battery(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowNoBattery();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+ zDrvLcd_SetPulseLevel(14);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_PowerOn_Normal(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+ zDrvLcd_SetPulseLevel(14);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Fota
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Fota(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowUpdateWait();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+ zDrvLcd_SetPulseLevel(14);
+
+ return ret;
+}
+
+
+/****************************************************************************
+ * Function: Show_Charging
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_Charging(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+ zDrvLcd_SetPulseLevel(14);
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Rtc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Rtc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ return ret;
+}
+
+/****************************************************************************
+ * Function: zx_get_vbat_voltage
+ * Description: .
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int zx_get_vbat_voltage(void)
+{
+ // int ret = 0;
+
+ return zx234290_get_adc1_voltage();
+}
+
+/****************************************************************************
+ * Function: zx_get_battery_Status
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+unsigned int zx_get_battery_Status(void)
+{
+ int ret = 0;
+ int battery_status = 0;
+
+ ret = zx234290_get_adc2_voltage();
+ if (ret < 0)
+ {
+ printf("\t[zx234290_get_adc2_voltage] return [%d] in [%s]\n", ret, __FUNCTION__);
+ return ret;
+ }
+
+ battery_status = (ret < 1670);
+
+ return battery_status;
+}
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral_mifi.c b/boot/common/src/uboot/drivers/peripheral/peripheral_mifi.c
new file mode 100644
index 0000000..94b76e5
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral_mifi.c
@@ -0,0 +1,430 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZIXC Corporation.
+ *
+ * File Name: hal_led.c
+ * File Mark:
+ * Description: This file contains the hal layer routines for i2c driver.
+ * Others:
+ * Version: V1.0
+ * Author: yx
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+#include <common.h>
+//#include "drvs_general.h"
+//#include "drvs_i2c.h"
+#include <linux/types.h>
+#include <power.h>
+#include <zx234290.h>
+#include <led.h>
+#include <lcd.h>
+//#include <lcd_blg.h>
+#include <charge.h>
+#include <zx234502.h>
+#include <partition_table.h>
+#include <linux/mtd/compat.h>
+/****************************************************************************
+* Local Macros
+****************************************************************************/
+
+
+/****************************************************************************
+* Local Types
+****************************************************************************/
+
+/****************************************************************************
+* Local Constants
+****************************************************************************/
+extern volatile T_ZDrvLcd_Info s_lcd_info;
+
+/****************************************************************************
+ * Function: peripheral_init
+ * Description: init the peripheral include pmu\charger\led\lcd etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int peripheral_init(void)
+{
+ int ret = 0;
+ ret = power_init();
+/*led*/
+ zx29_led_init();
+/*lcd*/
+ //ret |= zDrvLcd_Initiate();
+#if 0
+ usb_charger_init();
+#endif
+ zx234502_charger_enable();
+
+ /* jtagµ÷ÊÔ */
+#if 0
+ jtag_init();
+#endif
+
+ return ret ;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateWait
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateWait(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateSucc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateSucc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateFail
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateFail(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_LowPower
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_LowPower(void)
+{
+ int ret = 0;
+
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_ShowLowBattery();
+
+ udelay(300);
+ zx29_led_PowerOnLedOff();
+
+ /*lcd*/
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_No_Battery
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_No_Battery(void)
+{
+ int ret = 0;
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_ShowNoBattery();
+
+ udelay(300);
+ /*led*/
+ zx29_led_PowerOnLedOff();
+
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_PowerOn_Normal(void)
+{
+ int ret = 0;
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_PowerOnLogo();
+ udelay(300);
+ zx29_led_PowerOnLedOff();
+
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Fota(void)
+{
+ int ret = 0;
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_ShowUpdateWait();
+
+ udelay(300);
+ zx29_led_PowerOnLedOff();
+
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+
+/****************************************************************************
+ * Function: Show_Charging
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_Charging(void)
+{
+ int ret = 0;
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_ShowCharging();
+ udelay(300);
+ zx29_led_PowerOnLedOff();
+
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: zx_get_vbat_voltage
+ * Description: .
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int zx_get_vbat_voltage(void)
+{
+ // int ret = 0;
+
+ return zx234290_get_adc1_voltage();
+}
+
+/****************************************************************************
+ * Function: zx_get_battery_Status
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+unsigned int zx_get_battery_Status(void)
+{
+#if 0
+ int ret = 0;
+ int boost_flag = 1;
+
+ zx234502_battery_status(&boost_flag);
+ if(boost_flag){
+ return 0;/*battery uninstall*/
+ }
+ else
+ return 1;/*battery install*/
+#else
+ int ret = 0;
+ int battery_status = 0;
+
+ ret = zx234290_get_adc2_voltage();
+ if (ret < 0)
+ {
+ printf("\t[zx234290_get_adc2_voltage] return [%d] in [%s]\n", ret, __FUNCTION__);
+ return ret;
+ }
+
+ battery_status = (ret < 1770);
+
+#if 0
+ if (battery_status)
+ printf("\t[%s] get %d and return battery connected\n", __FUNCTION__, ret);
+ else
+ printf("\t[%s] get %d and return battery disconnected\n", __FUNCTION__, ret);
+#endif
+
+ return battery_status;
+#endif
+}
+
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral_mifi_mini.c b/boot/common/src/uboot/drivers/peripheral/peripheral_mifi_mini.c
new file mode 100755
index 0000000..fb10b4b
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral_mifi_mini.c
@@ -0,0 +1,412 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZIXC Corporation.
+ *
+ * File Name: hal_led.c
+ * File Mark:
+ * Description: This file contains the hal layer routines for i2c driver.
+ * Others:
+ * Version: V1.0
+ * Author: yx
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+#include <common.h>
+//#include "drvs_general.h"
+//#include "drvs_i2c.h"
+#include <linux/types.h>
+#include <power.h>
+#include <zx234290.h>
+#include <led.h>
+#include <lcd.h>
+//#include <lcd_blg.h>
+#include <charge.h>
+//#include <zx234502.h>
+#include <partition_table.h>
+#include <linux/mtd/compat.h>
+/****************************************************************************
+* Local Macros
+****************************************************************************/
+#define CHARGER_EN_GPIO GPIO131
+#define CHARGER_EN_GPIO_FUN GPIO131_GPIO131
+/****************************************************************************
+* Local Types
+****************************************************************************/
+
+/****************************************************************************
+* Local Constants
+****************************************************************************/
+
+
+/****************************************************************************
+ * Function: peripheral_init
+ * Description: init the peripheral include pmu\charger\led\lcd etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int peripheral_init(void)
+{
+ int ret = 0;
+ ret = power_init();
+/*led*/
+ zx29_led_init();
+/*lcd*/
+ //ret |= zDrvLcd_Initiate();
+#if 0
+ usb_charger_init();
+#endif
+ //zx234502_charger_enable();
+ /*charger enable*/
+ zDrvGpio_SetFunc(CHARGER_EN_GPIO,CHARGER_EN_GPIO_FUN);
+ zDrvGpio_SetDirection(CHARGER_EN_GPIO,GPIO_OUT);
+ zDrvGpio_SetOutputValue(CHARGER_EN_GPIO,GPIO_LOW);
+
+ /* jtagµ÷ÊÔ */
+#if 0
+ jtag_init();
+#endif
+
+ return ret ;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateWait
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateWait(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateSucc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateSucc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateFail
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateFail(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_LowPower
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_LowPower(void)
+{
+ int ret = 0;
+
+/*led*/
+ zx29_led_PowerOnLedOn();
+/*lcd*/
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_ShowLowBattery();
+#endif
+ udelay(300);
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_TurnBacklightOnOff(1);
+#endif
+/*led*/
+ zx29_led_PowerOnLedOff();
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_No_Battery
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_No_Battery(void)
+{
+ int ret = 0;
+/*led*/
+ zx29_led_PowerOnLedOn();
+/*lcd*/
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_ShowNoBattery();
+#endif
+ udelay(300);
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_TurnBacklightOnOff(1);
+#endif
+/*led*/
+ zx29_led_PowerOnLedOff();
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_PowerOn_Normal(void)
+{
+ int ret = 0;
+
+/*led*/
+ zx29_led_PowerOnLedOn();
+/*lcd*/
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_PowerOnLogo();
+#endif
+ udelay(300);
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_TurnBacklightOnOff(1);
+#endif
+/*led*/
+ zx29_led_PowerOnLedOff();
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Fota(void)
+{
+ int ret = 0;
+
+/*led*/
+ zx29_led_PowerOnLedOn();
+
+/*lcd*/
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_ShowUpdateWait();
+#endif
+ udelay(300);
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_TurnBacklightOnOff(1);
+#endif
+/*led*/
+ zx29_led_PowerOnLedOff();
+
+ return ret;
+}
+
+
+/****************************************************************************
+ * Function: Show_Charging
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_Charging(void)
+{
+ int ret = 0;
+
+/*led*/
+ zx29_led_PowerOnLedOn();
+/*lcd*/
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_ShowCharging();
+#endif
+ udelay(300);
+#ifdef CONFIG_ZX297520V3_AIC8800
+ zDrvLcd_TurnBacklightOnOff(1);
+#endif
+/*led*/
+ zx29_led_PowerOnLedOff();
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: zx_get_vbat_voltage
+ * Description: .
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int zx_get_vbat_voltage(void)
+{
+ // int ret = 0;
+
+ return zx234290_get_adc1_voltage();
+}
+
+/****************************************************************************
+ * Function: zx_get_battery_Status
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+unsigned int zx_get_battery_Status(void)
+{
+#if 0
+ int ret = 0;
+ int boost_flag = 1;
+
+ zx234502_battery_status(&boost_flag);
+ if(boost_flag){
+ return 0;/*battery uninstall*/
+ }
+ else
+ return 1;/*battery install*/
+#else
+ int ret = 0;
+ int battery_status = 0;
+
+ ret = zx234290_get_adc2_voltage();
+ if (ret < 0)
+ {
+ printf("\t[zx234290_get_adc2_voltage] return [%d] in [%s]\n", ret, __FUNCTION__);
+ return ret;
+ }
+
+ battery_status = (ret < 1770);
+
+#if 0
+ if (battery_status)
+ printf("\t[%s] get %d and return battery connected\n", __FUNCTION__, ret);
+ else
+ printf("\t[%s] get %d and return battery disconnected\n", __FUNCTION__, ret);
+#endif
+
+ return battery_status;
+#endif
+}
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral_mifi_mini_xr819.c b/boot/common/src/uboot/drivers/peripheral/peripheral_mifi_mini_xr819.c
new file mode 100644
index 0000000..7b67715
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral_mifi_mini_xr819.c
@@ -0,0 +1,445 @@
+/*******************************************************************************
+ * Copyright (C) 2016, ZIXC Corporation.
+ *
+ * File Name: hal_led.c
+ * File Mark:
+ * Description: This file contains the hal layer routines for i2c driver.
+ * Others:
+ * Version: V1.0
+ * Author: yx
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+
+#include <common.h>
+//#include "drvs_general.h"
+//#include "drvs_i2c.h"
+#include <linux/types.h>
+#include <power.h>
+#include <zx234290.h>
+#include <led.h>
+#include <lcd.h>
+//#include <lcd_blg.h>
+#include <charge.h>
+//#include <zx234502.h>
+#include <partition_table.h>
+#include <linux/mtd/compat.h>
+/****************************************************************************
+* Local Macros
+****************************************************************************/
+#define CHARGER_EN_GPIO GPIO131
+#define CHARGER_EN_GPIO_FUN GPIO131_GPIO131
+
+#define LCD_WIFI_GPIO GPIO121
+#define LCD_WIFI_GPIO_FUN GPIO121_GPIO121
+
+/****************************************************************************
+* Local Types
+****************************************************************************/
+
+/****************************************************************************
+* Local Constants
+****************************************************************************/
+extern volatile T_ZDrvLcd_Info s_lcd_info;
+
+/****************************************************************************
+ * Function: peripheral_init
+ * Description: init the peripheral include pmu\charger\led\lcd etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int peripheral_init(void)
+{
+ int ret = 0;
+ ret = power_init();
+/*led*/
+ zx29_led_init();
+/*lcd*/
+ //ret |= zDrvLcd_Initiate();
+#if 0
+ usb_charger_init();
+#endif
+ //zx234502_charger_enable();
+ /*charger enable*/
+ zDrvGpio_SetFunc(CHARGER_EN_GPIO,CHARGER_EN_GPIO_FUN);
+ zDrvGpio_SetDirection(CHARGER_EN_GPIO,GPIO_OUT);
+ zDrvGpio_SetOutputValue(CHARGER_EN_GPIO,GPIO_LOW);
+
+ /*lcd wifi DCDC3 enable*/
+ zDrvGpio_SetFunc(LCD_WIFI_GPIO,LCD_WIFI_GPIO_FUN);
+ zDrvGpio_SetDirection(LCD_WIFI_GPIO,GPIO_OUT);
+ zDrvGpio_SetOutputValue(LCD_WIFI_GPIO,GPIO_LOW);
+ udelay(100*1000);/*wifi need*/
+ zDrvGpio_SetOutputValue(LCD_WIFI_GPIO,GPIO_HIGH);
+
+ /* jtagµ÷ÊÔ */
+#if 0
+ jtag_init();
+#endif
+
+ return ret ;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateWait
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateWait(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateSucc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateSucc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateFail
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateFail(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_LowPower
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_LowPower(void)
+{
+ int ret = 0;
+
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_ShowLowBattery();
+
+ udelay(300);
+ zx29_led_PowerOnLedOff();
+
+ /*lcd*/
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_No_Battery
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_No_Battery(void)
+{
+ int ret = 0;
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_ShowNoBattery();
+
+ udelay(300);
+ /*led*/
+ zx29_led_PowerOnLedOff();
+
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_PowerOn_Normal(void)
+{
+ int ret = 0;
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_PowerOnLogo();
+ udelay(300);
+ zx29_led_PowerOnLedOff();
+
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Fota(void)
+{
+ int ret = 0;
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_ShowUpdateWait();
+
+ udelay(300);
+ zx29_led_PowerOnLedOff();
+
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+
+/****************************************************************************
+ * Function: Show_Charging
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_Charging(void)
+{
+ int ret = 0;
+ /*led*/
+ zx29_led_PowerOnLedOn();
+
+ /*lcd*/
+ zDrvLcd_ShowCharging();
+ udelay(300);
+ zx29_led_PowerOnLedOff();
+
+ if (strcmp(s_lcd_info.lcm_info.name,"mifi_no_lcd") == 0)
+ {
+ zDrvLcd_TurnBacklightOnOff(0);
+ }
+ else
+ {
+ zDrvLcd_TurnBacklightOnOff(1);
+ }
+
+ return ret;
+}
+
+/****************************************************************************
+ * Function: zx_get_vbat_voltage
+ * Description: .
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int zx_get_vbat_voltage(void)
+{
+ // int ret = 0;
+
+ return zx234290_get_adc1_voltage();
+}
+
+/****************************************************************************
+ * Function: zx_get_battery_Status
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+unsigned int zx_get_battery_Status(void)
+{
+#if 0
+ int ret = 0;
+ int boost_flag = 1;
+
+ zx234502_battery_status(&boost_flag);
+ if(boost_flag){
+ return 0;/*battery uninstall*/
+ }
+ else
+ return 1;/*battery install*/
+#else
+ int ret = 0;
+ int battery_status = 0;
+
+ ret = zx234290_get_adc2_voltage();
+ if (ret < 0)
+ {
+ printf("\t[zx234290_get_adc2_voltage] return [%d] in [%s]\n", ret, __FUNCTION__);
+ return ret;
+ }
+
+ battery_status = (ret < 1770);
+
+#if 0
+ if (battery_status)
+ printf("\t[%s] get %d and return battery connected\n", __FUNCTION__, ret);
+ else
+ printf("\t[%s] get %d and return battery disconnected\n", __FUNCTION__, ret);
+#endif
+
+ return battery_status;
+#endif
+}
+
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral_phone.c b/boot/common/src/uboot/drivers/peripheral/peripheral_phone.c
new file mode 100644
index 0000000..a79b913
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral_phone.c
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: hal_led.c
+ * File Mark:
+ * Description: This file contains the hal layer routines for i2c driver.
+ * Others:
+ * Version: V1.0
+ * Author: yx
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include <common.h>
+//#include "drvs_general.h"
+//#include "drvs_i2c.h"
+#include <linux/types.h>
+#include <power.h>
+#include <zx234290.h>
+#include <led.h>
+#include <lcd.h>
+//#include <lcd_blg.h>
+#include <charge.h>
+#include <zx234502.h>
+#include <partition_table.h>
+#include <linux/mtd/compat.h>
+/****************************************************************************
+* Local Macros
+****************************************************************************/
+#define CHARGER_EN_GPIO GPIO131
+#define CHARGER_EN_GPIO_FUN GPIO131_GPIO131
+
+/****************************************************************************
+* Local Types
+****************************************************************************/
+
+/****************************************************************************
+* Local Constants
+****************************************************************************/
+static void ms_delay(unsigned long ms)
+{
+ volatile int i = 0;
+ while (i < (50000 * ms)) {i++;}
+}
+
+/****************************************************************************
+ * Function: peripheral_init
+ * Description: init the peripheral include pmu\charger\led\lcd etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int peripheral_init(void)
+{
+ int ret = 0;
+ ret = power_init();
+
+/*reset for the TF card LD08 */
+ zx234290_ldo8_enable(0);
+
+ udelay(100000/20); /*50ms*/
+ //zx234290_SetVldo8(VLDOD_2_800);
+ zx234290_ldo8_enable(1);
+
+/*led*/
+// ret |= zDrvLcdBlg_Initiate();
+/*lcd*/
+ //ret |= zDrvLcd_Initiate();
+#if 0
+ usb_charger_init();
+#endif
+ //zx234502_charger_enable();
+
+ /*charger enable*/
+ zDrvGpio_SetFunc(CHARGER_EN_GPIO,CHARGER_EN_GPIO_FUN);
+ zDrvGpio_SetDirection(CHARGER_EN_GPIO,GPIO_OUT);
+#if defined(CONFIG_LCD_240X320)
+ zDrvGpio_SetOutputValue(CHARGER_EN_GPIO,GPIO_HIGH);
+#else
+ zDrvGpio_SetOutputValue(CHARGER_EN_GPIO,GPIO_LOW);
+#endif
+
+ /* 0.2 for jtagµ÷ÊÔ */
+#if !CONFIG_MUTUAL_DEBUG
+// jtag_init();
+#endif
+
+ return ret ;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateWait
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateWait(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateSucc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateSucc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateFail
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateFail(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_LowPower
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_LowPower(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowLowBattery();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_No_Battery
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_No_Battery(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowNoBattery();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_PowerOn_Normal(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Fota
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Fota(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowUpdateWait();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+
+/****************************************************************************
+ * Function: Show_Charging
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_Charging(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ ms_delay(50);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Rtc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Rtc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ return ret;
+}
+
+/****************************************************************************
+ * Function: zx_get_vbat_voltage
+ * Description: .
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int zx_get_vbat_voltage(void)
+{
+ // int ret = 0;
+
+ return zx234290_get_adc1_voltage();
+}
+
+/****************************************************************************
+ * Function: zx_get_battery_Status
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+unsigned int zx_get_battery_Status(void)
+{
+#if 0
+ int ret = 0;
+ int boost_flag = 1;
+
+ zx234502_battery_status(&boost_flag);
+ if(boost_flag){
+ return 0;/*battery uninstall*/
+ }
+ else
+ return 1;/*battery install*/
+#else
+ int ret = 0;
+ int battery_status = 0;
+
+ ret = zx234290_get_adc2_voltage();
+ if (ret < 0)
+ {
+ printf("\t[zx234290_get_adc2_voltage] return [%d] in [%s]\n", ret, __FUNCTION__);
+ return ret;
+ }
+
+ battery_status = (ret < 1700);
+
+#if 0
+ if (battery_status)
+ printf("\t[%s] get %d and return battery connected\n", __FUNCTION__, ret);
+ else
+ printf("\t[%s] get %d and return battery disconnected\n", __FUNCTION__, ret);
+#endif
+
+ return battery_status;
+#endif
+}
diff --git a/boot/common/src/uboot/drivers/peripheral/peripheral_watch.c b/boot/common/src/uboot/drivers/peripheral/peripheral_watch.c
new file mode 100644
index 0000000..05cedf0
--- /dev/null
+++ b/boot/common/src/uboot/drivers/peripheral/peripheral_watch.c
@@ -0,0 +1,414 @@
+/*******************************************************************************
+ * Copyright (C) 2014, ZTE Corporation.
+ *
+ * File Name: hal_led.c
+ * File Mark:
+ * Description: This file contains the hal layer routines for i2c driver.
+ * Others:
+ * Version: V1.0
+ * Author: yx
+ * Date: 2014-07-03
+ * History 1:
+ * Date:
+ * Version:
+ * Author:
+ * Modification:
+ * History 2:
+ ******************************************************************************/
+
+/****************************************************************************
+* Include files
+****************************************************************************/
+#include <common.h>
+//#include "drvs_general.h"
+//#include "drvs_i2c.h"
+#include <linux/types.h>
+#include <power.h>
+#include <zx234290.h>
+#include <led.h>
+#include <lcd.h>
+//#include <lcd_blg.h>
+#include <charge.h>
+#include <zx234502.h>
+#include <partition_table.h>
+#include <linux/mtd/compat.h>
+/****************************************************************************
+* Local Macros
+****************************************************************************/
+#define CHARGER_EN_GPIO GPIO124
+#define CHARGER_EN_GPIO_FUN GPIO124_GPIO124
+
+/****************************************************************************
+* Local Types
+****************************************************************************/
+
+/****************************************************************************
+* Local Constants
+****************************************************************************/
+static void ms_delay(unsigned long ms)
+{
+ volatile int i = 0;
+ while (i < (50000 * ms)) {i++;}
+}
+
+/****************************************************************************
+ * Function: peripheral_init
+ * Description: init the peripheral include pmu\charger\led\lcd etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int peripheral_init(void)
+{
+ int ret = 0;
+ ret = power_init();
+
+/*reset for the TF card LD08 */
+ zx234290_ldo8_enable(0);
+
+ udelay(100000/20); /*50ms*/
+ //zx234290_SetVldo8(VLDOD_2_800);
+ zx234290_ldo8_enable(1);
+
+/*led*/
+// ret |= zDrvLcdBlg_Initiate();
+/*lcd*/
+ //ret |= zDrvLcd_Initiate();
+#if 0
+ usb_charger_init();
+#endif
+ //zx234502_charger_enable();
+ zDrvGpio_SetFunc(CHARGER_EN_GPIO,CHARGER_EN_GPIO_FUN);
+ zDrvGpio_SetDirection(CHARGER_EN_GPIO,GPIO_OUT);
+ zDrvGpio_SetOutputValue(CHARGER_EN_GPIO,GPIO_LOW);
+
+ /* 0.2 for jtagµ÷ÊÔ */
+#if !CONFIG_MUTUAL_DEBUG
+// jtag_init();
+#endif
+
+ return ret ;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateWait
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateWait(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateSucc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateSucc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_UpdateFail
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_UpdateFail(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ ;
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_LowPower
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_LowPower(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowLowBattery();
+ ms_delay(100);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_No_Battery
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_No_Battery(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowNoBattery();
+ ms_delay(100);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Normal
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_PowerOn_Normal(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ ms_delay(100);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Fota
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Fota(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_ShowUpdateWait();
+ ms_delay(100);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+
+/****************************************************************************
+ * Function: Show_Charging
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int Show_Charging(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ ms_delay(100);
+ zDrvLcd_TurnBacklightOnOff(1);
+// ret = zDrvLcdBlg_SetBlg(128);
+ return ret;
+}
+
+/****************************************************************************
+ * Function: Show_PowerOn_Rtc
+ * Description: show the logo when the local updataing through lcd/led etc.
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+
+int Show_PowerOn_Rtc(void)
+{
+ int ret = 0;
+/*led*/
+
+/*lcd*/
+ zDrvLcd_PowerOnLogo();
+ return ret;
+}
+
+/****************************************************************************
+ * Function: zx_get_vbat_voltage
+ * Description: .
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+int zx_get_vbat_voltage(void)
+{
+ // int ret = 0;
+
+ return zx234290_get_adc1_voltage();
+}
+
+/****************************************************************************
+ * Function: zx_get_battery_Status
+ * Description:
+ * Parameters:
+ * Input:
+ *
+ * Output:
+ *
+ *
+ * Returns:
+ * int
+ *
+ *
+ * Others:
+ ***************************************************************************/
+unsigned int zx_get_battery_Status(void)
+{
+#if 0
+ int ret = 0;
+ int boost_flag = 1;
+
+ zx234502_battery_status(&boost_flag);
+ if(boost_flag){
+ return 0;/*battery uninstall*/
+ }
+ else
+ return 1;/*battery install*/
+#else
+ int ret = 0;
+ int battery_status = 0;
+
+ ret = zx234290_get_adc2_voltage();
+ if (ret < 0)
+ {
+ printf("\t[zx234290_get_adc2_voltage] return [%d] in [%s]\n", ret, __FUNCTION__);
+ return ret;
+ }
+
+ battery_status = (ret < 1700);
+
+#if 0
+ if (battery_status)
+ printf("\t[%s] get %d and return battery connected\n", __FUNCTION__, ret);
+ else
+ printf("\t[%s] get %d and return battery disconnected\n", __FUNCTION__, ret);
+#endif
+
+ return battery_status;
+#endif
+}