From patchwork Sat May 3 06:11:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 4105671 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E223D9F1E1 for ; Sat, 3 May 2014 05:54:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F004220384 for ; Sat, 3 May 2014 05:54:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03D8720383 for ; Sat, 3 May 2014 05:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753076AbaECFyY (ORCPT ); Sat, 3 May 2014 01:54:24 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:54537 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751054AbaECFxh (ORCPT ); Sat, 3 May 2014 01:53:37 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4Z0035DHPC9P90@mailout3.samsung.com>; Sat, 03 May 2014 14:53:36 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.47]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 30.67.11496.06484635; Sat, 03 May 2014 14:53:36 +0900 (KST) X-AuditID: cbfee691-b7f3e6d000002ce8-b1-5364846094e7 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 63.40.25708.06484635; Sat, 03 May 2014 14:53:36 +0900 (KST) Received: from localhost.localdomain ([12.36.165.191]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N4Z00I5CHP82B50@mmp2.samsung.com>; Sat, 03 May 2014 14:53:36 +0900 (KST) From: Pankaj Dubey To: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk, t.figa@samsung.com, Pankaj Dubey , Heiko Stuebner , Thomas Abraham Subject: [PATCH 1/4] ARM: EXYNOS: remove soc_is_exynos4/5 from exynos.c Date: Sat, 03 May 2014 15:11:37 +0900 Message-id: <1399097500-4052-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1399097500-4052-1-git-send-email-pankaj.dubey@samsung.com> References: <1399097500-4052-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeLIzCtJLcpLzFFi42I5/e+Zvm5CS0qwwbtr/Bb/H71mtehdcJXN YtPja6wWl3fNYbOYcX4fk8Xty7wWi7Z+YbdYP+M1i8WxGUsYHTg9Wpp72DzuXNvD5rF5Sb1H 35ZVjB7br81j9vi8SS6ALYrLJiU1J7MstUjfLoErY+LKJcwF18Urbi3SaGD8L9zFyMkhIWAi 8byngRXCFpO4cG89WxcjF4eQwDJGiQWrrzHBFC3/0sQEkZjOKDH70UNmCKeNSeL2om2MIFVs AroST97PZQaxRQSyJa403gcrYhY4wCjx7clhsFHCAu4SH3e9B2rg4GARUJXo2isEYvIChc/N jwYxJQQUJOZMsgEp5hTwkPjycBcbiC0EVDF7/kRGkIkSApvYJa4tXAh2NYuAgMS3yYdYIHpl JTYdYIa4WVLi4IobLBMYhRcwMqxiFE0tSC4oTkovMtUrTswtLs1L10vOz93ECAn+iTsY7x+w PsSYDDRuIrOUaHI+MHrySuINjc2MLExNTI2NzC3NSBNWE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S+yimx46r+ndWSovb3zUK9z4vWu4flRDetbZD5p4SS3FG oqEWc1FxIgDgEUUu8QIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 This patch adds support for checking soc compatibility based on compatibility match. It will help us in removing soc_is_exynos4 and soc_is_exynos5 function usage and definition. CC: Russell King CC: Heiko Stuebner CC: Thomas Abraham Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/exynos.c | 30 +++++++++++++++++++++++++++--- arch/arm/plat-samsung/include/plat/cpu.h | 3 --- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 59eb1f1..93ae076 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -212,6 +212,30 @@ static const struct of_device_id exynos_dt_pmu_match[] = { {}, }; +static const struct of_device_id exynos5_device_ids[] = { + { .compatible = "samsung,exynos5250", }, + { .compatible = "samsung,exynos5420", }, + {}, +}; + +static const struct of_device_id exynos4_device_ids[] = { + { .compatible = "samsung,exynos4210", }, + { .compatible = "samsung,exynos4212", }, + { .compatible = "samsung,exynos4412", }, + {}, +}; + +static inline bool soc_is_compatible(const struct of_device_id *device_ids) +{ + unsigned long root = of_get_flat_dt_root(); + const struct of_device_id *matches = device_ids; + for (; matches->compatible[0]; matches++) { + if (of_flat_dt_is_compatible(root, matches->compatible)) + return true; + } + return false; +} + /* * exynos_map_io * @@ -219,10 +243,10 @@ static const struct of_device_id exynos_dt_pmu_match[] = { */ static void __init exynos_map_io(void) { - if (soc_is_exynos4()) + if (soc_is_compatible(exynos4_device_ids)) iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc)); - if (soc_is_exynos5()) + if (soc_is_compatible(exynos5_device_ids)) iotable_init(exynos5_iodesc, ARRAY_SIZE(exynos5_iodesc)); } @@ -306,7 +330,7 @@ static void __init exynos_dt_machine_init(void) * are available then re-configure the interrupts via the * system register. */ - if (soc_is_exynos5()) { + if (soc_is_compatible(exynos5_device_ids)) { for_each_compatible_node(i2c_np, NULL, i2c_compat) { if (of_device_is_available(i2c_np)) { id = of_alias_get_id(i2c_np, "i2c"); diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index 5992b8d..18a9a00 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h @@ -166,9 +166,6 @@ IS_SAMSUNG_CPU(exynos5440, EXYNOS5440_SOC_ID, EXYNOS5_SOC_MASK) # define soc_is_exynos5440() 0 #endif -#define soc_is_exynos4() (soc_is_exynos4210() || soc_is_exynos4212() || \ - soc_is_exynos4412()) -#define soc_is_exynos5() (soc_is_exynos5250() || soc_is_exynos5420()) #define IODESC_ENT(x) { (unsigned long)S3C24XX_VA_##x, __phys_to_pfn(S3C24XX_PA_##x), S3C24XX_SZ_##x, MT_DEVICE }