[RFC PATCH 4/4] ARM: OMAP2: AM43XX: Modify optimize string comparisons in soc_is calls

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

 



Currently everytime soc_is calls are made, firstly device tree nodes
are parsed and then string comparisons are made to determine the
soc version. Optimizing it to be done one time and store the result.
Use the stored value in all the subsequent checks for soc_is calls.

Signed-off-by: Keerthy <j-keerthy@xxxxxx>
---
 arch/arm/mach-omap2/id.c  | 24 +++++++++++++++++++++++-
 arch/arm/mach-omap2/soc.h | 11 +++++++++--
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 885416d..f26e2bb 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -68,11 +68,32 @@ void init_dra_soc_id(void)
 		soc_ids[DRA72X] = 1;
 }
 
+void init_am43_soc_id(void)
+{
+	if (of_machine_is_compatible("ti,am43")) {
+		omap_type_val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
+		omap_type_val &= OMAP2_DEVICETYPE_MASK;
+		omap_type_val >>= 8;
+		soc_ids[AM43XX] = 1;
+	}
+
+	if (of_machine_is_compatible("ti,am4372"))
+		soc_ids[AM437X] = 1;
+
+	if (of_machine_is_compatible("ti,am438x"))
+		soc_ids[AM438X] = 1;
+}
+
 int check_dra_soc(int id)
 {
 	return soc_ids[id];
 }
 
+int check_am43_soc(int id)
+{
+	return soc_ids[id];
+}
+
 int omap_type(void)
 {
 	if (omap_type_val < OMAP2_DEVICETYPE_MASK)
@@ -82,7 +103,7 @@ int omap_type(void)
 		omap_type_val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
 	} else if (cpu_is_ti81xx()) {
 		omap_type_val = omap_ctrl_readl(TI81XX_CONTROL_STATUS);
-	} else if (soc_is_am33xx() || soc_is_am43xx()) {
+	} else if (soc_is_am33xx()) {
 		omap_type_val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
 	} else if (cpu_is_omap34xx()) {
 		omap_type_val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
@@ -362,6 +383,7 @@ void __init omap3xxx_check_revision(void)
 	u16 hawkeye;
 	u8 rev;
 
+	init_am43_soc_id();
 	/*
 	 * We cannot access revision registers on ES1.0.
 	 * If the processor type is Cortex-A8 and the revision is 0x0
diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h
index cd10260..f3b6522 100644
--- a/arch/arm/mach-omap2/soc.h
+++ b/arch/arm/mach-omap2/soc.h
@@ -42,10 +42,14 @@ enum soc_id_flags {
 	DRA7XX = 0,
 	DRA74X,
 	DRA72X,
+	AM43XX,
+	AM437X,
+	AM438X,
 	MAX_ID,
 };
 
 int check_dra_soc(int id);
+int check_am43_soc(int id);
 
 /*
  * Test if multicore OMAP support is needed
@@ -247,6 +251,7 @@ IS_AM_SUBCLASS(437x, 0x437)
 #define soc_is_am335x()			0
 #define soc_is_am43xx()			0
 #define soc_is_am437x()			0
+#define soc_is_am438x()			0
 #define cpu_is_omap44xx()		0
 #define cpu_is_omap443x()		0
 #define cpu_is_omap446x()		0
@@ -380,8 +385,10 @@ IS_OMAP_TYPE(3430, 0x3430)
 #ifdef	CONFIG_SOC_AM43XX
 # undef soc_is_am43xx
 # undef soc_is_am437x
-# define soc_is_am43xx()		is_am43xx()
-# define soc_is_am437x()		is_am437x()
+# undef soc_is_am438x
+# define soc_is_am43xx()		check_am43_soc(AM43XX)
+# define soc_is_am437x()		check_am43_soc(AM437X)
+# define soc_is_am438x()		check_am43_soc(AM438X)
 #endif
 
 # if defined(CONFIG_ARCH_OMAP4)
-- 
1.9.1

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



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux