ARM: exynos: power: add the functions for controlling INFORM register
authorJaehoon Chung <jh80.chung@samsung.com>
Mon, 25 Jul 2016 11:34:35 +0000 (20:34 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 20 Oct 2020 01:35:20 +0000 (10:35 +0900)
To control the INFORM register, add the some functions.
There are INFORM0~3 in exynos5, and there are INFORM0~7 in Exynos4.

Change-Id: I43d9ed09c97e91af2f0aecfb80266b66e0493e0d
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
arch/arm/mach-exynos/include/mach/power.h
arch/arm/mach-exynos/power.c

index d97393359371ceea746cfd4c4547c615683bb7ee..260984203c0e1933754b36d58aed4a1e6bb84679 100644 (file)
@@ -1920,6 +1920,8 @@ enum {
 };
 
 unsigned int get_boot_mode(void);
+unsigned int get_inform_value(int num);
+void clear_inform_value(int num);
 
 void set_mipi_phy_ctrl(unsigned int dev_index, unsigned int enable);
 
index f2a6c00dd629cfdd48146abdee06eb1cea6f572d..ad2019d7db6b6c21048345d358d361df3954cc74 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <errno.h>
 #include <asm/io.h>
 #include <asm/arch/power.h>
 
@@ -259,3 +260,65 @@ unsigned int get_boot_mode(void)
 
        return readl(om_pin) & OM_PIN_MASK;
 }
+
+unsigned int exynos5_get_inform_value(int num)
+{
+       struct exynos5_power *power =
+               (struct exynos5_power *)samsung_get_base_power();
+
+       if (num < 0 || num > 3)
+               return -EINVAL;
+       return readl(&power->inform0 + num);
+}
+
+unsigned int exynos4_get_inform_value(int num)
+{
+       struct exynos4_power *power =
+               (struct exynos4_power *)samsung_get_base_power();
+
+       if (num < 0 || num > 7)
+               return -EINVAL;
+       return readl(&power->inform0 + num);
+}
+
+unsigned int get_inform_value(int num)
+{
+       if (cpu_is_exynos5())
+               return exynos5_get_inform_value(num);
+       else
+               return exynos4_get_inform_value(num);
+}
+
+void exynos5_clear_inform(int num)
+{
+       struct exynos5_power *power =
+               (struct exynos5_power *)samsung_get_base_power();
+
+       /* Exynos5 has from INFORM0 to INFORM3 */
+       if (num < 0 || num > 3)
+               return;
+
+       /* Clear to 0 */
+       writel(0, &power->inform0 + num);
+}
+
+void exynos4_clear_inform(int num)
+{
+       struct exynos4_power *power =
+               (struct exynos4_power *)samsung_get_base_power();
+
+       /* Exynos4 has from INFORM0 to INFORM7 */
+       if (num < 0 || num > 7)
+               return;
+
+       /* Clear to 0 */
+       writel(0, &power->inform0 + num);
+}
+
+void clear_inform_value(int num)
+{
+       if (cpu_is_exynos5())
+               exynos5_clear_inform(num);
+       else
+               exynos4_clear_inform(num);
+}