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/20160810.050017~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bed13664795cc5c70f4847aa5c12d3c0154dd85f;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 a0b81e41e4..8b944d3d89 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 cd2d6618ac..f6b32ec481 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); +}