From patchwork Wed Nov 26 13:08:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 41535 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E385425E80 for ; Wed, 26 Nov 2014 13:08:41 +0000 (UTC) Received: by mail-wi0-f198.google.com with SMTP id r20sf1927523wiv.9 for ; Wed, 26 Nov 2014 05:08:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=G/9gM59P1w1r+CVFj7fx+EtO/HN6RGb0sMu9w8xy8JM=; b=nJO03tREriMs0Nkvcs5d9sqNr2JN77CPaQ1vZa/G+mtf3k6C1IwAo4rHjheKHLNOXp M/VY3cXdeZMZxl5DzpapkoBC9SeWm5rAGtLF3ZVU51i4GxHIUjtKc9BaYQc0/bV/GDJ3 dnq9vtqi5oC8PeTZBGeKajTWHXfDS0msOUlvxxRLTf6IlA3DdqtkYT7XJH2NOPwzl9pr ocHJ4HeRQlyUFI9ci7aEvAoKg3kuinNCUd07cqa4/SfSuMweQfuyKqLA3F6dTQfztNzI w9X6cg4uuaM/4vTxBZxu3Zn3pRcnA5Q1URHNHQZrPz4Pr8Vzlh8vI4ETisjZr+bA2Az7 m+6g== X-Gm-Message-State: ALoCoQmYEYKm4PiJbqc6Q+xE8HbJv633yC3+p5KQJQqVCfyHi9Z4t97F2RqntjPMXGELQ8Ve13iC X-Received: by 10.112.151.38 with SMTP id un6mr9156957lbb.0.1417007321229; Wed, 26 Nov 2014 05:08:41 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.242.161 with SMTP id wr1ls290293lac.48.gmail; Wed, 26 Nov 2014 05:08:40 -0800 (PST) X-Received: by 10.112.130.65 with SMTP id oc1mr34247580lbb.7.1417007320573; Wed, 26 Nov 2014 05:08:40 -0800 (PST) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id kv10si4284452lac.131.2014.11.26.05.08.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Nov 2014 05:08:40 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by mail-lb0-f178.google.com with SMTP id f15so2677042lbj.9 for ; Wed, 26 Nov 2014 05:08:40 -0800 (PST) X-Received: by 10.112.14.69 with SMTP id n5mr33840367lbc.34.1417007320431; Wed, 26 Nov 2014 05:08:40 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp615695lbc; Wed, 26 Nov 2014 05:08:39 -0800 (PST) X-Received: by 10.66.165.200 with SMTP id za8mr53740927pab.156.1417007317914; Wed, 26 Nov 2014 05:08:37 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id on3si6742711pdb.111.2014.11.26.05.08.37 for ; Wed, 26 Nov 2014 05:08:37 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752559AbaKZNI3 (ORCPT + 26 others); Wed, 26 Nov 2014 08:08:29 -0500 Received: from mail-wg0-f48.google.com ([74.125.82.48]:33773 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751847AbaKZNI0 (ORCPT ); Wed, 26 Nov 2014 08:08:26 -0500 Received: by mail-wg0-f48.google.com with SMTP id y19so3630326wgg.21 for ; Wed, 26 Nov 2014 05:08:25 -0800 (PST) X-Received: by 10.194.48.116 with SMTP id k20mr49679364wjn.7.1417007305564; Wed, 26 Nov 2014 05:08:25 -0800 (PST) Received: from mai.lan (135-224-190-109.dsl.ovh.fr. [109.190.224.135]) by mx.google.com with ESMTPSA id c5sm7244307wik.3.2014.11.26.05.08.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Nov 2014 05:08:24 -0800 (PST) From: Daniel Lezcano To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ezequiel.garcia@free-electrons.com, yl22@csr.com Subject: [PATCH 4/4] clocksource: armada-370-xp: Use the reference clock on A375 SoC Date: Wed, 26 Nov 2014 14:08:14 +0100 Message-Id: <1417007294-19869-4-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417007294-19869-1-git-send-email-daniel.lezcano@linaro.org> References: <5475D044.5060607@linaro.org> <1417007294-19869-1-git-send-email-daniel.lezcano@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.lezcano@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Ezequiel Garcia The 25 MHz reference clock has better stability so its use is preferred over the core clock. This commit takes advantage of the already introduced Armada 375 devicetree compatible string and adds a new timer initialization. If available, the timer will use the reference clock (named as 'fixed'). Otherwise, it falls back to the previous behavior. Acked-by: Jason Cooper Acked-by: Gregory CLEMENT Acked-by: Wim Van Sebroeck Reviewed-by: Thomas Petazzoni Tested-by: Thomas Petazzoni Signed-off-by: Ezequiel Garcia Signed-off-by: Daniel Lezcano --- .../bindings/timer/marvell,armada-370-xp-timer.txt | 9 ++++--- drivers/clocksource/time-armada-370-xp.c | 28 ++++++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt b/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt index f455182..e9c78ce 100644 --- a/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt +++ b/Documentation/devicetree/bindings/timer/marvell,armada-370-xp-timer.txt @@ -2,8 +2,10 @@ Marvell Armada 370 and Armada XP Timers --------------------------------------- Required properties: -- compatible: Should be either "marvell,armada-370-timer" or - "marvell,armada-xp-timer" as appropriate. +- compatible: Should be one of the following + "marvell,armada-370-timer", + "marvell,armada-375-timer", + "marvell,armada-xp-timer". - interrupts: Should contain the list of Global Timer interrupts and then local timer interrupts - reg: Should contain location and length for timers register. First @@ -13,7 +15,8 @@ Required properties: Clocks required for compatible = "marvell,armada-370-timer": - clocks : Must contain a single entry describing the clock input -Clocks required for compatible = "marvell,armada-xp-timer": +Clocks required for compatibles = "marvell,armada-xp-timer", + "marvell,armada-375-timer": - clocks : Must contain an entry for each entry in clock-names. - clock-names : Must include the following entries: "nbclk" (L2/coherency fabric clock), diff --git a/drivers/clocksource/time-armada-370-xp.c b/drivers/clocksource/time-armada-370-xp.c index d8555f9..3a0704b 100644 --- a/drivers/clocksource/time-armada-370-xp.c +++ b/drivers/clocksource/time-armada-370-xp.c @@ -301,6 +301,34 @@ static void __init armada_xp_timer_init(struct device_node *np) CLOCKSOURCE_OF_DECLARE(armada_xp, "marvell,armada-xp-timer", armada_xp_timer_init); +static void __init armada_375_timer_init(struct device_node *np) +{ + struct clk *clk; + + clk = of_clk_get_by_name(np, "fixed"); + if (!IS_ERR(clk)) { + clk_prepare_enable(clk); + timer_clk = clk_get_rate(clk); + } else { + + /* + * This fallback is required in order to retain proper + * devicetree backwards compatibility. + */ + clk = of_clk_get(np, 0); + + /* Must have at least a clock */ + BUG_ON(IS_ERR(clk)); + clk_prepare_enable(clk); + timer_clk = clk_get_rate(clk) / TIMER_DIVIDER; + timer25Mhz = false; + } + + armada_370_xp_timer_common_init(np); +} +CLOCKSOURCE_OF_DECLARE(armada_375, "marvell,armada-375-timer", + armada_375_timer_init); + static void __init armada_370_timer_init(struct device_node *np) { struct clk *clk = of_clk_get(np, 0);