[PATCH v9 08/12] ARM: EXYNOS: move exynos_boot_vector_{addr,flag} ops to exynos_s2r_data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Various Exynos SoC needs different boot addresses and flags. Currently we
are handling this difference by adding lots of soc_is_exynosMMM checks in
the code, in an attempt to remove the dependency of such helper functions
specific to each SoC, let's separate helper functions for these helper
functions by moving them into SoC specific hooks in struct exynos_s2r_data.

Signed-off-by: Pankaj Dubey <pankaj.dubey@xxxxxxxxxxx>
---
 arch/arm/mach-exynos/pm.c | 60 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 50 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c
index fa24098..c3fa537 100644
--- a/arch/arm/mach-exynos/pm.c
+++ b/arch/arm/mach-exynos/pm.c
@@ -32,26 +32,56 @@
 #include "common.h"
 
 struct exynos_s2r_data {
+	void __iomem* (*boot_vector_addr)(void);
+	void __iomem* (*boot_vector_flag)(void);
 	void (*enter_aftr)(void);
 };
 
 static const struct exynos_s2r_data *s2r_data;
 
-static inline void __iomem *exynos_boot_vector_addr(void)
+static void __iomem *exynos_boot_vector_addr(void)
+{
+	if (s2r_data && s2r_data->boot_vector_addr)
+		return s2r_data->boot_vector_addr();
+
+	return NULL;
+}
+
+static inline void __iomem *exynos4210_rev11_boot_vector_addr(void)
+{
+	return pmu_base_addr + S5P_INFORM7;
+}
+
+static inline void __iomem *exynos4210_rev10_boot_vector_addr(void)
+{
+	return sysram_base_addr + 0x24;
+}
+
+static inline void __iomem *exynos_common_boot_vector_addr(void)
 {
-	if (samsung_rev() == EXYNOS4210_REV_1_1)
-		return pmu_base_addr + S5P_INFORM7;
-	else if (samsung_rev() == EXYNOS4210_REV_1_0)
-		return sysram_base_addr + 0x24;
 	return pmu_base_addr + S5P_INFORM0;
 }
 
-static inline void __iomem *exynos_boot_vector_flag(void)
+static void __iomem *exynos_boot_vector_flag(void)
+{
+	if (s2r_data && s2r_data->boot_vector_flag)
+		return s2r_data->boot_vector_flag();
+
+	return NULL;
+}
+
+static inline void __iomem *exynos4210_rev11_boot_vector_flag(void)
+{
+	return pmu_base_addr + S5P_INFORM6;
+}
+
+static inline void __iomem *exynos4210_rev10_boot_vector_flag(void)
+{
+	return sysram_base_addr + 0x20;
+}
+
+static inline void __iomem *exynos_common_boot_vector_flag(void)
 {
-	if (samsung_rev() == EXYNOS4210_REV_1_1)
-		return pmu_base_addr + S5P_INFORM6;
-	else if (samsung_rev() == EXYNOS4210_REV_1_0)
-		return sysram_base_addr + 0x20;
 	return pmu_base_addr + S5P_INFORM1;
 }
 
@@ -218,22 +248,32 @@ static void exynos5_enter_aftr(void)
 }
 
 static const struct exynos_s2r_data exynos_common_s2r_data = {
+	.boot_vector_addr	= exynos_common_boot_vector_addr,
+	.boot_vector_flag	= exynos_common_boot_vector_flag,
 	.enter_aftr		= exynos5_enter_aftr,
 };
 
 static const struct exynos_s2r_data exynos3250_s2r_data = {
+	.boot_vector_addr	= exynos_common_boot_vector_addr,
+	.boot_vector_flag	= exynos_common_boot_vector_flag,
 	.enter_aftr		= exynos3_enter_aftr,
 };
 
 static const struct exynos_s2r_data exynos4210_rev11_s2r_data = {
+	.boot_vector_addr	= exynos4210_rev11_boot_vector_addr,
+	.boot_vector_flag	= exynos4210_rev11_boot_vector_flag,
 	.enter_aftr		= exynos4_enter_aftr,
 };
 
 static const struct exynos_s2r_data exynos4210_rev10_s2r_data = {
+	.boot_vector_addr	= exynos4210_rev10_boot_vector_addr,
+	.boot_vector_flag	= exynos4210_rev10_boot_vector_flag,
 	.enter_aftr		= exynos4_enter_aftr,
 };
 
 static const struct exynos_s2r_data exynos4x12_s2r_data = {
+	.boot_vector_addr	= exynos_common_boot_vector_addr,
+	.boot_vector_flag	= exynos_common_boot_vector_flag,
 	.enter_aftr		= exynos4_enter_aftr,
 };
 
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux SoC Development]     [Linux Rockchip Development]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Linux SCSI]     [Yosemite News]

  Powered by Linux