rk808: rtc: set rtc stopped by default
authorElaine Zhang <zhangqing@rock-chips.com>
Mon, 27 Mar 2017 02:55:16 +0000 (10:55 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Tue, 28 Mar 2017 03:14:53 +0000 (11:14 +0800)
set rtc stopped by default, start rtc in rtc device probe.
add rtc node, whether RTC need to initialize.

Change-Id: Ifab269786f316d33149a50a18e23af1b6206d57d
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
drivers/mfd/rk808.c
drivers/rtc/rtc-rk808.c
include/linux/mfd/rk808.h

index 25ce26546cf0e26cd2d7e0d9af1791f19d939dfd..313963c9aa729e51a4f6a63c984010134dd19ca5 100644 (file)
@@ -184,6 +184,7 @@ static const struct rk808_reg_data rk808_pre_init_reg[] = {
        { RK808_BUCK1_CONFIG_REG, BUCK1_RATE_MASK,  BUCK_ILMIN_200MA },
        { RK808_BUCK2_CONFIG_REG, BUCK2_RATE_MASK,  BUCK_ILMIN_200MA },
        { RK808_DCDC_UV_ACT_REG,  BUCK_UV_ACT_MASK, BUCK_UV_ACT_DISABLE},
+       { RK808_RTC_CTRL_REG, RTC_STOP, RTC_STOP},
        { RK808_VB_MON_REG,       MASK_ALL,         VB_LO_ACT |
                                                    VB_LO_SEL_3500MV },
 };
@@ -269,6 +270,7 @@ static const struct rk808_reg_data rk818_pre_init_reg[] = {
                                        BOOST_EN_ENABLE | SWITCH_EN_ENABLE },
        { RK818_SLEEP_SET_OFF_REG1, OTG_SLP_SET_MASK, OTG_SLP_SET_OFF },
        { RK818_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK,  BUCK_ILMIN_250MA },
+       { RK808_RTC_CTRL_REG, RTC_STOP, RTC_STOP},
 };
 
 static const struct regmap_irq rk818_irqs[] = {
@@ -416,6 +418,7 @@ static const struct mfd_cell rk805s[] = {
 static const struct rk808_reg_data rk805_pre_init_reg[] = {
        {RK805_BUCK4_CONFIG_REG, BUCK_ILMIN_MASK, BUCK_ILMIN_400MA},
        {RK805_GPIO_IO_POL_REG, SLP_SD_MSK, SLEEP_FUN},
+       {RK808_RTC_CTRL_REG, RTC_STOP, RTC_STOP},
        {RK805_THERMAL_REG, TEMP_HOTDIE_MSK, TEMP115C},
 };
 
index e6274327b43d6c2fd211b9399233e93c20c1a764..13610ff513778db2ae02bc48d4236353ea6d2a88 100644 (file)
@@ -387,6 +387,20 @@ static int rk808_rtc_probe(struct platform_device *pdev)
                        return -EINVAL;
                }
                break;
+       case RK808_ID:
+               np = of_get_child_by_name(pdev->dev.parent->of_node, "rtc");
+               if (np && !of_device_is_available(np)) {
+                       dev_info(&pdev->dev, "device is disabled\n");
+                       return -EINVAL;
+               }
+               break;
+       case RK818_ID:
+               np = of_get_child_by_name(pdev->dev.parent->of_node, "rtc");
+               if (np && !of_device_is_available(np)) {
+                       dev_info(&pdev->dev, "device is disabled\n");
+                       return -EINVAL;
+               }
+               break;
        default:
                break;
        }
index fa86cea4f67a0aca329765498569aafde2c10bfa..d8f766135867b3c73e7dc5a5b149c48dcf5b702e 100644 (file)
@@ -327,6 +327,7 @@ enum rk805_reg {
 #define SWITCH1_EN     BIT(5)
 #define DEV_OFF_RST    BIT(3)
 #define DEV_OFF                BIT(0)
+#define RTC_STOP       BIT(0)
 
 #define VB_LO_ACT              BIT(4)
 #define VB_LO_SEL_3500MV       (7 << 0)