From patchwork Mon Jul 7 05:19: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: 4492621 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 E81D8BEEAA for ; Mon, 7 Jul 2014 05:23:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2335B20225 for ; Mon, 7 Jul 2014 05:23:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DA9920222 for ; Mon, 7 Jul 2014 05:23:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751352AbaGGFWf (ORCPT ); Mon, 7 Jul 2014 01:22:35 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:53219 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751022AbaGGFWR (ORCPT ); Mon, 7 Jul 2014 01:22:17 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8B002FJTL3GM70@mailout4.samsung.com>; Mon, 07 Jul 2014 14:22:15 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id EA.09.16580.68E2AB35; Mon, 07 Jul 2014 14:22:15 +0900 (KST) X-AuditID: cbfee691-b7f2f6d0000040c4-4d-53ba2e869ba6 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id D8.16.05196.68E2AB35; Mon, 07 Jul 2014 14:22:14 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8B000UKTKRMY90@mmp1.samsung.com>; Mon, 07 Jul 2014 14:22:14 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: kgene.kim@samsung.com, linux@arm.linux.org.uk, t.figa@samsung.com, vikas.sajjan@samsung.com, joshi@samsung.com, naushad@samsung.com, thomas.ab@samsung.com, chow.kim@samsung.com, Pankaj Dubey Subject: [PATCH v6 1/4] ARM: EXYNOS: Add support for mapping PMU base address via DT Date: Mon, 07 Jul 2014 10:49:33 +0530 Message-id: <1404710376-16448-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1404710376-16448-1-git-send-email-pankaj.dubey@samsung.com> References: <1404710376-16448-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42JZI2JSq9uutyvY4M0WNotlk+6yWXzf9YXd onfBVTaLTY+vsVpc3jWHzWLG+X1MFrcv81p8Ovqf1WLRVqCK9TNes1h0LGO0uPlsO5MDj0dL cw+bx+Yl9R59W1YxenzeJBfAEsVlk5Kak1mWWqRvl8CVMffIX/aCu6IV0w60MTYwThfqYuTk kBAwkXi+o4MdwhaTuHBvPVsXIxeHkMBSRomOt//YYIq+rj7EDJFYxChxa9cmqKoJTBKbG/uY QKrYBHQlnryfywxiiwhkS/TfXs0CUsQs8JhR4s3Ko4wgCWGBMImZPevAbBYBVYnDc2aDNfAK eEjcev0DaBAH0DoFiTmTbEDCnAKeEpNf7we7Qgio5O3SP0wgMyUEtrFLvLm9lRlijoDEt8mH WCB6ZSU2HWCGuFpS4uCKGywTGIUXM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nbPBYKBehKhBSx zVjHHmN+ccV5O57r4qwMGztX7tu7N+D4t03Xpz7ubdzbdWXeucpt747ITP939senPrF9KqEb MyfeDxQXqPS6l6d1pdDInO1EA9sPL9etZQIaDvF/7Hm3XI/xSUrw0XW4XrHJIfzEm38Pvyux FGckGmoxFxUnAgA8+xnAygIAAA== 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.6 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 Add support for mapping Samsung Power Management Unit (PMU) base address from device tree. Signed-off-by: Pankaj Dubey Reviewed-by: Tomasz Figa --- arch/arm/mach-exynos/common.h | 1 + arch/arm/mach-exynos/exynos.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 152b464..f8daa9c 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -113,6 +113,7 @@ IS_SAMSUNG_CPU(exynos5800, EXYNOS5800_SOC_ID, EXYNOS5_SOC_MASK) extern void __iomem *sysram_ns_base_addr; extern void __iomem *sysram_base_addr; +extern void __iomem *pmu_base_addr; void exynos_sysram_init(void); void exynos_firmware_init(void); diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 186f35d..173aac8 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 @@ -31,6 +32,8 @@ #include "regs-pmu.h" #include "regs-sys.h" +void __iomem *pmu_base_addr; + static struct map_desc exynos4_iodesc[] __initdata = { { .virtual = (unsigned long)S3C_VA_SYS, @@ -253,6 +256,39 @@ static void __init exynos_init_io(void) exynos_map_io(); } +static const struct of_device_id exynos_dt_pmu_match[] = { + { .compatible = "samsung,exynos3250-pmu" }, + { .compatible = "samsung,exynos4210-pmu" }, + { .compatible = "samsung,exynos4212-pmu" }, + { .compatible = "samsung,exynos4412-pmu" }, + { .compatible = "samsung,exynos5250-pmu" }, + { .compatible = "samsung,exynos5420-pmu" }, + { /*sentinel*/ }, +}; + +static void exynos_map_pmu(void) +{ + struct device_node *np; + + np = of_find_matching_node(NULL, exynos_dt_pmu_match); + if (np) + pmu_base_addr = of_iomap(np, 0); + + if (!pmu_base_addr) + panic("failed to find exynos pmu register\n"); +} + +static void __init exynos_init_irq(void) +{ + irqchip_init(); + /* + * Since platsmp.c needs pmu base address by the time + * DT is not unflatten so we can't use DT APIs before + * init_irq + */ + exynos_map_pmu(); +} + static void __init exynos_dt_machine_init(void) { struct device_node *i2c_np; @@ -336,6 +372,7 @@ DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)") .smp = smp_ops(exynos_smp_ops), .map_io = exynos_init_io, .init_early = exynos_firmware_init, + .init_irq = exynos_init_irq, .init_machine = exynos_dt_machine_init, .init_late = exynos_init_late, .dt_compat = exynos_dt_compat,