From patchwork Wed Apr 30 05:17:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 4091341 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 306B7BFF02 for ; Wed, 30 Apr 2014 05:03:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 46BAB201DE for ; Wed, 30 Apr 2014 05:03:22 +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 58B9B201F9 for ; Wed, 30 Apr 2014 05:03:21 +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 1WfMdE-0006oS-2e; Wed, 30 Apr 2014 05:00:32 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WfMcq-0005dl-F0 for linux-arm-kernel@lists.infradead.org; Wed, 30 Apr 2014 05:00:09 +0000 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N4T0082NV7IYUC0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 30 Apr 2014 13:59:42 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.49]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id AE.B7.18501.E3380635; Wed, 30 Apr 2014 13:59:42 +0900 (KST) X-AuditID: cbfee68d-b7f4e6d000004845-37-5360833e0c9a Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C0.E2.25708.E3380635; Wed, 30 Apr 2014 13:59:42 +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 <0N4T004J5V7A5170@mmp1.samsung.com>; Wed, 30 Apr 2014 13:59:42 +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 v3 07/12] ARM: EXYNOS: Add support for mapping PMU base address via DT Date: Wed, 30 Apr 2014 14:17:32 +0900 Message-id: <1398835057-3860-8-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1398835057-3860-1-git-send-email-pankaj.dubey@samsung.com> References: <1398835057-3860-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLLMWRmVeSWpSXmKPExsVy+t8zQ1275oRgg/krdCyWTbrLZtG74Cqb xabH11gtLu+aw2Yx4/w+Jovbl3ktFm39wm6xfsZrFoubz7YzWexoWc3iwOXR0tzD5rF5Sb1H 35ZVjB6fN8kFsERx2aSk5mSWpRbp2yVwZXzvO8tesFKm4uImqwbGk+JdjJwcEgImEs+WH2KC sMUkLtxbz9bFyMUhJLCMUWLpnzcsMEWP1s1mgUgsYpTo/9/KBOG0MUk8vj6fFaSKTUBX4sn7 ucwgtohAtsSVxvvMIEXMArsZJRob57GBJIQFIiRW7+wB6ubgYBFQlTjdoAYS5hVwl7h1oRUs LCGgIDFnkg1ImFPAQ2Lh7d9g44WAShoaehhBRkoIrGKX6N1/C2wXi4CAxLfJh1ggemUlNh1g hjhaUuLgihssExiFFzAyrGIUTS1ILihOSi8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vP/uVibLFMGO55cr8mq7I7y9ihu/BOaW+LGcay9vV/ytyiwgfHsL95Wo SKVEs+gZrMUzfCYoealw2DA94HWfJlm+qmTtq9hDkakuvNNvSh/uNosLv6DEUpyRaKjFXFSc CAARUiQ17QIAAA== 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-20140429_220008_693818_ACCC9E42 X-CRM114-Status: GOOD ( 13.67 ) 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/mach-exynos/Kconfig | 2 ++ arch/arm/mach-exynos/common.h | 2 ++ arch/arm/mach-exynos/exynos.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index fc8bf18..2f60c90 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -26,6 +26,7 @@ config ARCH_EXYNOS4 select PINCTRL select PM_GENERIC_DOMAINS if PM_RUNTIME select S5P_DEV_MFC + select MFD_SYSCON help Samsung EXYNOS4 SoCs based systems @@ -36,6 +37,7 @@ config ARCH_EXYNOS5 select HAVE_ARM_SCU if SMP select HAVE_SMP select PINCTRL + select MFD_SYSCON help Samsung EXYNOS5 (Cortex-A15) SoC based systems diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 8a4aa0b..33a2bee 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -55,4 +55,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 a7b45db..9045fd6 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, @@ -260,6 +263,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 * @@ -327,6 +338,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, + "samsung,syscon-phandle"); + } + + 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; @@ -355,6 +392,8 @@ static void __init exynos_dt_machine_init(void) } } + exynos_map_pmu(); + if (!soc_is_exynos5440()) platform_device_register(&exynos_cpuidle);