From patchwork Thu Apr 19 20:36:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 7968 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7FB9D23E20 for ; Thu, 19 Apr 2012 20:37:28 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 4D998A180E6 for ; Thu, 19 Apr 2012 20:37:28 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id l4so6001107yen.11 for ; Thu, 19 Apr 2012 13:37:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=sJo7qaEKLnG14lFrO6+tQwaclJodCIfFgFudD3JlZ2E=; b=TcNEjB+womjuSNf/LlZ/NK/qNWtq/5H7jvXiMjgXJ6UYlD3ZbF9LpwM692qXvk3i5u JcjgjrIHA5SiTlRDdJGZTV/JqkVrdgg/p2dJMzSlXL3iA3ucEs/LK4ZQMM87JGLtbtYH XnhKyNDlzuH7+VgvPhaoct1aRwo/hgRGP9Yt9jgVEzWiI9xEinFOp+TtYfAU14Bv+2Z4 vPk1zAaapmtYaJEdNGRIz1Dd53zvlr2XsZGOuWnS5OzKWdCSDLH3KlZGiNsa1h+RZ55d V3zhqvfUmHpxY2Q8016psFtw0M+Negit2jBdHpTGnOwvTJfy98Qy5RWlsFUZKUgpiH0J PuOQ== Received: by 10.50.17.201 with SMTP id q9mr3894005igd.19.1334867847874; Thu, 19 Apr 2012 13:37:27 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.137.198 with SMTP id x6csp317265ibt; Thu, 19 Apr 2012 13:37:27 -0700 (PDT) Received: by 10.180.87.106 with SMTP id w10mr8679425wiz.2.1334867846493; Thu, 19 Apr 2012 13:37:26 -0700 (PDT) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by mx.google.com with ESMTPS id l32si3780646weq.32.2012.04.19.13.37.26 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Apr 2012 13:37:26 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.172 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.172; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.172 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wi0-f172.google.com with SMTP id hj6so5508wib.13 for ; Thu, 19 Apr 2012 13:37:26 -0700 (PDT) Received: by 10.180.92.130 with SMTP id cm2mr8663681wib.4.1334867846030; Thu, 19 Apr 2012 13:37:26 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id h8sm345540wix.4.2012.04.19.13.37.24 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 19 Apr 2012 13:37:25 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, arnd@arndb.de, linus.walleij@stericsson.com, grant.likely@secretlab.ca, cjb@laptop.org, linux@arm.linux.org.uk Cc: Lee Jones , Samuel Ortiz Subject: [PATCH 15/15] ARM: ux500: Enable PRCMU Timer 4 (clocksource) via Device Tree Date: Thu, 19 Apr 2012 21:36:44 +0100 Message-Id: <1334867804-31942-16-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1334867804-31942-1-git-send-email-lee.jones@linaro.org> References: <1334867804-31942-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQkj2raC0zR4lPMDFF4iMl7uBRd5FD203cYN4WjNUJWLx2/eDGDlkUvrjE2DKToF10zaHvpP In dbx500 based devices the PRCMU Timer 4 is used as a clocksource and sched_clock. Here we fetch all necessary addressing information required for correct PRCMU initialisation from the Device Tree instead of using hard-coded values. CC: Samuel Ortiz Signed-off-by: Lee Jones --- arch/arm/boot/dts/db8500.dtsi | 8 +++++++- arch/arm/mach-ux500/timer.c | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletions(-) diff --git a/arch/arm/boot/dts/db8500.dtsi b/arch/arm/boot/dts/db8500.dtsi index f633210..9a62f86 100644 --- a/arch/arm/boot/dts/db8500.dtsi +++ b/arch/arm/boot/dts/db8500.dtsi @@ -189,7 +189,13 @@ reg = <0x80157000 0x1000>; interrupts = <46 47>; #address-cells = <1>; - #size-cells = <0>; + #size-cells = <1>; + ranges; + + prcmu-timer-4@80157450 { + compatible = "stericsson,db8500-prcmu-timer-4"; + reg = <0x80157450 0xC>; + }; ab8500@5 { compatible = "stericsson,ab8500"; diff --git a/arch/arm/mach-ux500/timer.c b/arch/arm/mach-ux500/timer.c index d37df98..885c742 100644 --- a/arch/arm/mach-ux500/timer.c +++ b/arch/arm/mach-ux500/timer.c @@ -8,6 +8,7 @@ #include #include #include +#include #include @@ -43,10 +44,17 @@ static void __init ux500_twd_init(void) #define ux500_twd_init() do { } while(0) #endif +const static struct of_device_id prcmu_timer_of_match[] __initconst = { + { .compatible = "stericsson,db8500-prcmu-timer-4", }, + { }, +}; + static void __init ux500_timer_init(void) { void __iomem *mtu_timer_base; void __iomem *prcmu_timer_base; + void __iomem *tmp_base; + struct device_node *np; if (cpu_is_u5500()) { mtu_timer_base = __io_address(U5500_MTU0_BASE); @@ -58,6 +66,22 @@ static void __init ux500_timer_init(void) ux500_unknown_soc(); } + /* TODO: Once MTU has been DT:ed place code above into else. */ + if (of_have_populated_dt()) { + np = of_find_matching_node(NULL, prcmu_timer_of_match); + if (!np) + goto dt_fail; + + tmp_base = of_iomap(np, 0); + if (!tmp_base) + goto dt_fail; + + prcmu_timer_base = tmp_base; + } + +dt_fail: + /* Doing it the old fashioned way. */ + /* * Here we register the timerblocks active in the system. * Localtimers (twd) is started when both cpu is up and running.