From patchwork Wed Apr 2 07:50:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 3926841 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A0B1ABF540 for ; Wed, 2 Apr 2014 07:35:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0DF42022A for ; Wed, 2 Apr 2014 07:35:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ED0B520220 for ; Wed, 2 Apr 2014 07:35:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758066AbaDBHeT (ORCPT ); Wed, 2 Apr 2014 03:34:19 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:63643 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758064AbaDBHeP (ORCPT ); Wed, 2 Apr 2014 03:34:15 -0400 Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N3E006BB7ORPYD0@mailout1.samsung.com>; Wed, 02 Apr 2014 16:34:03 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.48]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id DD.82.09028.B6DBB335; Wed, 02 Apr 2014 16:34:03 +0900 (KST) X-AuditID: cbfee68e-b7f566d000002344-ba-533bbd6bf88b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id BC.5B.29263.A6DBB335; Wed, 02 Apr 2014 16:34:03 +0900 (KST) Received: from localhost.localdomain ([12.36.165.191]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N3E00KU17OBEN00@mmp1.samsung.com>; Wed, 02 Apr 2014 16:34:02 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk, chow.kim@samsung.com, Young-Gun Jang , Pankaj Dubey Subject: [PATCH 06/10] ARM: EXYNOS: Add support for mapping PMU base address via DT Date: Wed, 02 Apr 2014 16:50:57 +0900 Message-id: <1396425058-4012-7-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1396425058-4012-1-git-send-email-pankaj.dubey@samsung.com> References: <1396425058-4012-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrMLMWRmVeSWpSXmKPExsVy+t8zA93svdbBBou62C2WTbrLZtG74Cqb xabH11gtLu+aw2Yx4/w+Jovbl3ktFm39wm6xo2U1iwOHR0tzD5vH5iX1Hn1bVjF6fN4kF8AS xWWTkpqTWZZapG+XwJUxa9IEtoIfYhUdu/4yNjBOFe5i5OSQEDCRuLPgAyuELSZx4d56ti5G Lg4hgWWMEv1nWhlhim7uWM0OkVjEKHFh9WYmCKeNSaL58yY2kCo2AV2JJ+/nMoPYIgLZEpdm 3WIBKWIWmMcosetsJ1iRsECoxN6Ta4G6OThYBFQlNn91BAnzCrhLbN64lwUkLCGgIDFnkg1I mFPAQ+J+Sws7iC0EVDL3xk6oS+exS5x7wgFiswgISHybfAiqVVZi0wFmiBJJiYMrbrBMYBRe wMiwilE0tSC5oDgpvchIrzgxt7g0L10vOT93EyMkwPt2MN48YH2IMRlo3ERmKdHkfGCE5JXE GxqbGVmYmpgaG5lbm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ZO/Pe/onmlxIkV+czLdxYsVmIpzkg01GIuKk4EAFS/gQ3k AgAA 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 From: Young-Gun Jang Add support for mapping Exynos Power Management Unit (PMU) base address from device tree. Code will use existing samsung pmu binding information. This patch also adds "get_exynos_pmubase" a helper function to return mapped base address to various other files under "mach-exynos". Signed-off-by: Young-Gun Jang Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/common.h | 2 ++ arch/arm/mach-exynos/exynos.c | 44 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index ff28334..9a55cf6 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -61,4 +61,6 @@ struct exynos_pmu_conf { extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); +extern void __iomem *get_exynos_pmubase(void); + #endif /* __ARCH_ARM_MACH_EXYNOS_COMMON_H */ diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index a5e1349..a5127fb 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -35,6 +35,8 @@ #define L2_AUX_VAL 0x7C470001 #define L2_AUX_MASK 0xC200ffff +static void __iomem *exynos_pmu_base __initdata; + static struct map_desc exynos4_iodesc[] __initdata = { { .virtual = (unsigned long)S3C_VA_SYS, @@ -245,6 +247,47 @@ void __init exynos_init_late(void) exynos_pm_init(); } +static char const *exynos_dt_pmu_match[] __initconst = { + "samsung,exynos4210-pmu", + "samsung,exynos4212-pmu", + "samsung,exynos4412-pmu", + "samsung,exynos5250-pmu", + NULL +}; + +static int __init exynos_fdt_map_pmu(unsigned long node, + const char *uname, int depth, void *data) +{ + struct map_desc iodesc; + __be32 *reg; + unsigned long len; + + if (of_flat_dt_match(node, exynos_dt_pmu_match)) { + phys_addr_t phys_addr; + reg = of_get_flat_dt_prop(node, "reg", &len); + if (reg == NULL || len != (sizeof(unsigned long) * 2)) + return 0; + + phys_addr = be32_to_cpu(reg[0]); + iodesc.pfn = __phys_to_pfn(phys_addr); + iodesc.length = be32_to_cpu(reg[1]) - 1; + iodesc.virtual = (unsigned long)S5P_VA_PMU; + iodesc.type = MT_DEVICE; + iotable_init(&iodesc, 1); + + exynos_pmu_base = ioremap(phys_addr, be32_to_cpu(reg[1])); + if (WARN_ON(!exynos_pmu_base)) + return -EFAULT; + } + + return 0; +} + +inline void __iomem *get_exynos_pmubase() +{ + return exynos_pmu_base; +} + static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, int depth, void *data) { @@ -301,6 +344,7 @@ void __init exynos_init_io(void) debug_ll_io_init(); of_scan_flat_dt(exynos_fdt_map_chipid, NULL); + of_scan_flat_dt(exynos_fdt_map_pmu, NULL); /* detect cpu id and rev. */ s5p_init_cpu(S5P_VA_CHIPID);