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, 11 Apr 2017 09:58:15 +0000 (18:58 +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 6d87858..89c790c 100644 (file)
@@ -1921,6 +1921,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 c923460..d1fa3cf 100644 (file)
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <errno.h>
 #include <asm/io.h>
 #include <asm/arch/power.h>
 
@@ -260,3 +261,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);
+}