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: 4146921 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 53AA9BFF02 for ; Sat, 10 May 2014 06:41:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7D2CF2017E for ; Sat, 10 May 2014 06:41:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 94E90201FA for ; Sat, 10 May 2014 06:41:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757282AbaEJGlM (ORCPT ); Sat, 10 May 2014 02:41:12 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:44378 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753059AbaEJGi2 (ORCPT ); Sat, 10 May 2014 02:38:28 -0400 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>; 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 Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk, t.figa@samsung.com, chow.kim@samsung.com, yg1004.jang@samsung.com, vikas.sajjan@samsung.com, Pankaj Dubey 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+dwfj7QPWhxiT gcZNZJYS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wJ+Kz8vSm/a0174 1qLWK1ihYuPBFyLzXhV9tri8L3zK7TLXecenTa6VsGnikJrcdTB3w1ahtbF2fUeVWIozEg21 mIuKEwFoYk9n7wIAAA== 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 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);