From patchwork Thu Oct 15 05:10:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J, KEERTHY" X-Patchwork-Id: 7401511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3185BBEEA4 for ; Thu, 15 Oct 2015 05:13:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39FE5209D8 for ; Thu, 15 Oct 2015 05:13:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87BD3209D4 for ; Thu, 15 Oct 2015 05:13:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmaoW-00065p-O0; Thu, 15 Oct 2015 05:10:52 +0000 Received: from arroyo.ext.ti.com ([192.94.94.40]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmaoK-000630-0K for linux-arm-kernel@lists.infradead.org; Thu, 15 Oct 2015 05:10:40 +0000 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id t9F5AHD4020939; Thu, 15 Oct 2015 00:10:17 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t9F5AH2C005941; Thu, 15 Oct 2015 00:10:17 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.224.2; Thu, 15 Oct 2015 00:10:17 -0500 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t9F5A9xs017215; Thu, 15 Oct 2015 00:10:15 -0500 From: Keerthy To: Subject: [PATCH v2 3/3] ARM: OMAP2: AM43XX: Modify optimize string comparisons in soc_is calls Date: Thu, 15 Oct 2015 10:40:08 +0530 Message-ID: <1444885808-6306-4-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444885808-6306-1-git-send-email-j-keerthy@ti.com> References: <1444885808-6306-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151014_221040_153180_5EE9AE2B X-CRM114-Status: GOOD ( 11.33 ) X-Spam-Score: -6.9 (------) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: j-keerthy@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- Changes in v2: * Rebased to latest 4.3-rc5 arch/arm/mach-omap2/id.c | 11 +++++++++++ arch/arm/mach-omap2/soc.h | 10 ++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 4f497cc..0d7ccd3 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -61,6 +61,16 @@ void init_dra_soc_id(void) soc_ids |= DRA72X; } +void init_am43_soc_id(void) +{ + if (of_machine_is_compatible("ti,am43")) + soc_ids |= AM43XX; + if (of_machine_is_compatible("ti,am4372")) + soc_ids |= AM437X; + if (of_machine_is_compatible("ti,am438x")) + soc_ids |= AM438X; +} + int check_soc_version(unsigned long id) { return soc_ids & id; @@ -357,6 +367,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 06d8c96..bf092d5 100644 --- a/arch/arm/mach-omap2/soc.h +++ b/arch/arm/mach-omap2/soc.h @@ -132,6 +132,9 @@ #define DRA7XX BIT(0) #define DRA74X BIT(1) #define DRA72X BIT(2) +#define AM43XX BIT(3) +#define AM437X BIT(4) +#define AM438X BIT(5) int check_soc_version(unsigned long id); int omap_type(void); @@ -266,6 +269,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 @@ -441,8 +445,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_soc_version(AM43XX) +# define soc_is_am437x() check_soc_version(AM437X) +# define soc_is_am438x() check_soc_version(AM438X) #endif # if defined(CONFIG_ARCH_OMAP4)