From patchwork Sat May 10 06:56:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 4146881 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A3663C0ACC for ; Sat, 10 May 2014 06:41:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B3E5D202DD for ; Sat, 10 May 2014 06:41:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3036B20263 for ; Sat, 10 May 2014 06:41:23 +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 1Wj0w3-0008W3-Rt; Sat, 10 May 2014 06:39:03 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wj0vm-0008O9-Md for linux-arm-kernel@lists.infradead.org; Sat, 10 May 2014 06:38:47 +0000 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5C00820IG2OS00@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Sat, 10 May 2014 15:38:26 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [203.254.230.50]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id D8.B1.18501.269CD635; Sat, 10 May 2014 15:38:26 +0900 (KST) X-AuditID: cbfee68d-b7f4e6d000004845-ef-536dc9622aa4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id CA.94.27725.269CD635; Sat, 10 May 2014 15:38:26 +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 <0N5C00GCSIFT5B30@mmp2.samsung.com>; Sat, 10 May 2014 15:38:26 +0900 (KST) From: Pankaj Dubey To: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v4 06/11] ARM: EXYNOS: Add support for mapping PMU base address via DT Date: Sat, 10 May 2014 15:56:33 +0900 Message-id: <1399704998-13321-7-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1399704998-13321-1-git-send-email-pankaj.dubey@samsung.com> References: <1399704998-13321-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHLMWRmVeSWpSXmKPExsVy+t8zI92kk7nBBl3LNS2WTbrLZtG74Cqb xabH11gtLu+aw2Yx4/w+Jovbl3ktFm39wm6xfsZrFoubz7YzWexoWc3iwOXR0tzD5rF5Sb1H 35ZVjB6fN8kFsERx2aSk5mSWpRbp2yVwZdy/uoa9YIpUxZ37a9gbGK+LdjFycEgImEh8/RrU xcgJZIpJXLi3nq2LkYtDSGAZo8SnY69YIRImEo/PbmOESExnlJj5ciFUVRuTRPudycwgVWwC uhJP3s8Fs0UEsiWuNN5nBiliFtjNKNHYOI8NJCEsECGxY895RhCbRUBVYsr1aSwgNq+Ah8Tk zRsZIU5SkJgzyQYkzCngCXTdYiYQWwio5EH3UrCZEgLr2CVebGlih5gjIPFt8iEWiF5ZiU0H mCGulpQ4uOIGywRG4QWMDKsYRVMLkguKk9KLDPWKE3OLS/PS9ZLzczcxQsK+d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ofn/2WfyJzN7dGnt7zlwJ+Kz8vSm/a0174 1qLWK1ihYuPBFyLzXhV9tri8L3zK7TLXecenTa6VsGnikJrcdTB3w1ahtbF2fUeVWIozEg21 mIuKEwFoYk9n7wIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140509_233846_908823_0EC75821 X-CRM114-Status: GOOD ( 14.23 ) X-Spam-Score: -5.7 (-----) Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk, Pankaj Dubey , t.figa@samsung.com, yg1004.jang@samsung.com, vikas.sajjan@samsung.com, chow.kim@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,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 Samsung Power Management Unit (PMU) base address from device tree. This patch also adds helper function as "get_exynos_pmuregmap". This function can be used by other machine files such as "pm.c", "hotplug.c" for accessing PMU regmap handle. Signed-off-by: Young-Gun Jang Signed-off-by: Pankaj Dubey --- arch/arm/Kconfig | 1 + arch/arm/mach-exynos/common.h | 2 ++ arch/arm/mach-exynos/exynos.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 732a134..a4eac2f 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -855,6 +855,7 @@ config ARCH_EXYNOS select SPARSE_IRQ select SRAM select USE_OF + select MFD_SYSCON help Support for SAMSUNG's EXYNOS SoCs (EXYNOS4/5) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 69739e4..d533e2d 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -57,4 +57,6 @@ struct exynos_pmu_conf { extern void exynos_sys_powerdown_conf(enum sys_powerdown mode); extern void exynos_enter_aftr(void); +extern struct regmap *get_exynos_pmuregmap(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 e4a4be0..3b1d245 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,8 @@ #define L2_AUX_VAL 0x7C470001 #define L2_AUX_MASK 0xC200ffff +static struct regmap *exynos_pmu_regmap; + static struct map_desc exynos4_iodesc[] __initdata = { { .virtual = (unsigned long)S3C_VA_SYS, @@ -210,6 +213,14 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, return 1; } +static const struct of_device_id exynos_dt_pmu_match[] = { + { .compatible = "samsung,exynos4210-pmu" }, + { .compatible = "samsung,exynos4212-pmu" }, + { .compatible = "samsung,exynos4412-pmu" }, + { .compatible = "samsung,exynos5250-pmu" }, + {}, +}; + /* * exynos_map_io * @@ -263,6 +274,32 @@ static int __init exynos4_l2x0_cache_init(void) } early_initcall(exynos4_l2x0_cache_init); + +struct regmap *get_exynos_pmuregmap() +{ + return exynos_pmu_regmap; +} + +void __init exynos_map_pmu(void) +{ + struct device_node *np = NULL; + + early_syscon_init(); + + np = of_find_matching_node(NULL, exynos_dt_pmu_match); + + if (!np) { + pr_err("Failed to find PMU node\n"); + return; + } else { + exynos_pmu_regmap = syscon_early_regmap_lookup_by_phandle(np, + NULL); + } + + if (IS_ERR(exynos_pmu_regmap)) + pr_err("failed to find exynos_pmu_regmap\n"); +} + static void __init exynos_dt_machine_init(void) { struct device_node *i2c_np; @@ -291,6 +328,8 @@ static void __init exynos_dt_machine_init(void) } } + exynos_map_pmu(); + if (!soc_is_exynos5440()) platform_device_register(&exynos_cpuidle);