[RFC PATCH 2/4] ARM: DRA7: Add omap revision detection under soc_is function

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

 



omap_type can be determined at the init time based on the device
tree compatible string. This will avoid checking again for soc string.

Signed-off-by: Keerthy <j-keerthy@xxxxxx>
---
 arch/arm/mach-omap2/id.c | 38 +++++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 19289df..885416d 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -45,6 +45,7 @@ static char soc_rev[OMAP_SOC_MAX_NAME_LENGTH];
 u32 omap_features;
 
 static int soc_ids[MAX_ID];
+static int omap_type_val = OMAP2_DEVICETYPE_MASK;
 
 unsigned int omap_rev(void)
 {
@@ -54,8 +55,13 @@ EXPORT_SYMBOL(omap_rev);
 
 void init_dra_soc_id(void)
 {
-	if (of_machine_is_compatible("ti,dra7"))
+	if (of_machine_is_compatible("ti,dra7")) {
+		omap_type_val = omap_ctrl_readl(OMAP5XXX_CONTROL_STATUS);
+		omap_type_val &= OMAP5_DEVICETYPE_MASK;
+		omap_type_val >>= 6;
 		soc_ids[DRA7XX] = 1;
+	}
+
 	if (of_machine_is_compatible("ti,dra74"))
 		soc_ids[DRA74X] = 1;
 	if (of_machine_is_compatible("ti,dra72"))
@@ -69,36 +75,34 @@ int check_dra_soc(int id)
 
 int omap_type(void)
 {
-	static u32 val = OMAP2_DEVICETYPE_MASK;
-
-	if (val < OMAP2_DEVICETYPE_MASK)
-		return val;
+	if (omap_type_val < OMAP2_DEVICETYPE_MASK)
+		return omap_type_val;
 
 	if (cpu_is_omap24xx()) {
-		val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
+		omap_type_val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
 	} else if (cpu_is_ti81xx()) {
-		val = omap_ctrl_readl(TI81XX_CONTROL_STATUS);
+		omap_type_val = omap_ctrl_readl(TI81XX_CONTROL_STATUS);
 	} else if (soc_is_am33xx() || soc_is_am43xx()) {
-		val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
+		omap_type_val = omap_ctrl_readl(AM33XX_CONTROL_STATUS);
 	} else if (cpu_is_omap34xx()) {
-		val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
+		omap_type_val = omap_ctrl_readl(OMAP343X_CONTROL_STATUS);
 	} else if (cpu_is_omap44xx()) {
-		val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS);
-	} else if (soc_is_omap54xx() || soc_is_dra7xx()) {
-		val = omap_ctrl_readl(OMAP5XXX_CONTROL_STATUS);
-		val &= OMAP5_DEVICETYPE_MASK;
-		val >>= 6;
+		omap_type_val = omap_ctrl_readl(OMAP4_CTRL_MODULE_CORE_STATUS);
+	} else if (soc_is_omap54xx()) {
+		omap_type_val = omap_ctrl_readl(OMAP5XXX_CONTROL_STATUS);
+		omap_type_val &= OMAP5_DEVICETYPE_MASK;
+		omap_type_val >>= 6;
 		goto out;
 	} else {
 		pr_err("Cannot detect omap type!\n");
 		goto out;
 	}
 
-	val &= OMAP2_DEVICETYPE_MASK;
-	val >>= 8;
+	omap_type_val &= OMAP2_DEVICETYPE_MASK;
+	omap_type_val >>= 8;
 
 out:
-	return val;
+	return omap_type_val;
 }
 EXPORT_SYMBOL(omap_type);
 
-- 
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