From: Jaehoon Chung Date: Mon, 25 Jul 2016 11:34:35 +0000 (+0900) Subject: ARM: exynos: power: add the functions for controlling INFORM register X-Git-Tag: submit/tizen/20170414.042831~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b35d6f5e2e64801f70bf25971f2f638b4059c761;p=platform%2Fkernel%2Fu-boot.git ARM: exynos: power: add the functions for controlling INFORM register 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 --- diff --git a/arch/arm/mach-exynos/include/mach/power.h b/arch/arm/mach-exynos/include/mach/power.h index 6d87858270..89c790c3fe 100644 --- a/arch/arm/mach-exynos/include/mach/power.h +++ b/arch/arm/mach-exynos/include/mach/power.h @@ -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); diff --git a/arch/arm/mach-exynos/power.c b/arch/arm/mach-exynos/power.c index c923460275..d1fa3cf120 100644 --- a/arch/arm/mach-exynos/power.c +++ b/arch/arm/mach-exynos/power.c @@ -6,6 +6,7 @@ */ #include +#include #include #include @@ -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); +}