From patchwork Wed Jun 25 14:03:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 4421031 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 CE93DBEEAA for ; Wed, 25 Jun 2014 14:08:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AC1F420386 for ; Wed, 25 Jun 2014 14:08:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C8672017A for ; Wed, 25 Jun 2014 14:08:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757177AbaFYOGx (ORCPT ); Wed, 25 Jun 2014 10:06:53 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:56253 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757165AbaFYOGv (ORCPT ); Wed, 25 Jun 2014 10:06:51 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7Q000S19VD8710@mailout2.samsung.com>; Wed, 25 Jun 2014 23:06:49 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 75.9C.14704.977DAA35; Wed, 25 Jun 2014 23:06:49 +0900 (KST) X-AuditID: cbfee68f-b7fef6d000003970-c4-53aad779fbd9 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 84.E5.05196.877DAA35; Wed, 25 Jun 2014 23:06:49 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N7Q00ED99U2BQ40@mmp2.samsung.com>; Wed, 25 Jun 2014 23:06:48 +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 v5 1/5] ARM: EXYNOS: Add support for mapping PMU base address via DT Date: Wed, 25 Jun 2014 19:33:48 +0530 Message-id: <1403705032-14835-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1403705032-14835-1-git-send-email-pankaj.dubey@samsung.com> References: <1403705032-14835-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupgkeLIzCtJLcpLzFFi42JZI2JSq1t5fVWwQfcPAYtlk+6yWXzf9YXd onfBVTaLTY+vsVpc3jWHzWLG+X1MFrcv81p8Ovqf1WLRVqCK9TNes1h0LGO0uPlsO5MDj0dL cw+bx+Yl9R59W1YxenzeJBfAEsVlk5Kak1mWWqRvl8CV0X/7ImPBM7GKu5cvMzUwNgp3MXJy SAiYSOy7084CYYtJXLi3nq2LkYtDSGApo8TvrztYYIruP1jMCpGYzijx6MAWqKoJTBILrq1h BKliE9CVePJ+LjOILSKQLdF/ezULSBGzwGNGiTcrj4IVCQuESSzaexasiEVAVeL3nynsIDav gIfE1/vPgVZwAK1TkJgzyQYkzCngKfFp5newEiGQkpn7mUFmSghsY5f4cvY6K8QcAYlvkw+x QPTKSmw6wAxxtaTEwRU3WCYwCi9gZFjFKJpakFxQn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uVu5bOy97QxlRbLHfo1DffFbP+dEetiLcTPXB/33qRY0f+sX7I2HKG/eKnBWLdzIbd 2ue8A6/MPsQ5/d3uhj3mJ8N1rk1eESP51efi/Nduew9smLr08o7rVa9fRuvY7Hac+UMr2NFC iaU4I9FQi7moOBEAlIHHy8oCAAA= 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=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 --- arch/arm/mach-exynos/common.h | 1 + arch/arm/mach-exynos/exynos.c | 45 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 3f25f89..f3114be 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_firmware_init(void); diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 4a69b3f..82dabc8 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -19,6 +19,8 @@ #include #include #include +#include +#include #include #include @@ -31,6 +33,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, @@ -231,6 +235,46 @@ 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" }, + {}, +}; + +static void exynos_map_pmu(void) +{ + struct device_node *np = NULL; + + np = of_find_matching_node(NULL, exynos_dt_pmu_match); + + if (!np) { + pr_err("Failed to find PMU node\n"); + return; + } + + pmu_base_addr = of_iomap(np, 0); + + if (!pmu_base_addr) + panic("failed to find exynos pmu register\n"); +} + +static void __init exynos_init_time(void) +{ + /* Nothing to do timer specific. + * Since platsmp.c needs pmu base address by the time + * DT is not unflatten so we can't use DT APIs before + * init_time + */ + exynos_map_pmu(); + + of_clk_init(NULL); + clocksource_of_init(); +} + static void __init exynos_dt_machine_init(void) { struct device_node *i2c_np; @@ -306,6 +350,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_time = exynos_init_time, .init_machine = exynos_dt_machine_init, .init_late = exynos_init_late, .dt_compat = exynos_dt_compat,