]> git.sur5r.net Git - u-boot/blobdiff - drivers/power/exynos-tmu.c
spi: xilinx_spi: Modify transfer logic xilinx_spi_xfer() function
[u-boot] / drivers / power / exynos-tmu.c
index 6d74bc74b5ffb50b73ef49decc9d7e504b551a2d..6a662677a7cb0133ef37b5f355ceee2cb9a9054c 100644 (file)
@@ -79,6 +79,8 @@ struct tmu_data {
 struct tmu_info {
        /* base Address for the TMU */
        struct exynos5_tmu_reg *tmu_base;
+       /* mux Address for the TMU */
+       int tmu_mux;
        /* pre-defined values for calibration and thresholds */
        struct tmu_data data;
        /* value required for triminfo_25 calibration */
@@ -178,7 +180,7 @@ enum tmu_status_t tmu_monitor(int *temp)
  */
 static int get_tmu_fdt_values(struct tmu_info *info, const void *blob)
 {
-#ifdef CONFIG_OF_CONTROL
+#if CONFIG_IS_ENABLED(OF_CONTROL)
        fdt_addr_t addr;
        int node;
        int error = 0;
@@ -188,7 +190,7 @@ static int get_tmu_fdt_values(struct tmu_info *info, const void *blob)
                                      COMPAT_SAMSUNG_EXYNOS_TMU);
        if (node < 0) {
                debug("EXYNOS_TMU: No node for tmu in device tree\n");
-               return -1;
+               return -ENODEV;
        }
 
        /*
@@ -200,10 +202,17 @@ static int get_tmu_fdt_values(struct tmu_info *info, const void *blob)
        addr = fdtdec_get_addr(blob, node, "reg");
        if (addr == FDT_ADDR_T_NONE) {
                debug("%s: Missing tmu-base\n", __func__);
-               return -1;
+               return -ENODEV;
        }
        info->tmu_base = (struct exynos5_tmu_reg *)addr;
 
+       /* Optional field. */
+       info->tmu_mux = fdtdec_get_int(blob,
+                               node, "samsung,mux", -1);
+       /* Take default value as per the user manual b(110) */
+       if (info->tmu_mux == -1)
+               info->tmu_mux = 0x6;
+
        info->data.ts.min_val = fdtdec_get_int(blob,
                                node, "samsung,min-temp", -1);
        error |= (info->data.ts.min_val == -1);
@@ -237,11 +246,11 @@ static int get_tmu_fdt_values(struct tmu_info *info, const void *blob)
 
        if (error) {
                debug("fail to get tmu node properties\n");
-               return -1;
+               return -EINVAL;
        }
 #else
        /* Non DT support may never be added. Just in case  */
-       return -1;
+       return -ENODEV;
 #endif
 
        return 0;
@@ -307,7 +316,7 @@ static void tmu_setup_parameters(struct tmu_info *info)
 
        /* TMU core enable */
        con = readl(&reg->tmu_control);
-       con |= THERM_TRIP_EN | CORE_EN;
+       con |= THERM_TRIP_EN | CORE_EN | (info->tmu_mux << 20);
 
        writel(con, &reg->tmu_control);