From patchwork Thu Dec 5 19:20:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Kryger X-Patchwork-Id: 22087 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 19A5E24AAD for ; Thu, 5 Dec 2013 19:21:24 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id x13sf7785431qcv.11 for ; Thu, 05 Dec 2013 11:21:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=jYYJrnLDfGIxUJvwBVXykJ9KcLl1cyfCdkDm193kY/w=; b=UxkGfeIvFOPef7YhOnGhyT0ac+4HT7KJugSjognC3cvKw4m+4rssVq2BxHiApIacJj ddh4p+Nn8zdVY0ZRYTYZ8eFJI0lqqvvX6xoGxeK+psFmMwjo68icdHS5J5ABxjvq0cDC 8/eF1YDH88BbqFMCqq3LYY1KiN6ZWJkDbvqOnK4iMahzB7uOcBTzKc8/Lar2Q8ABvUR2 sgMD+sZ7yJrNA2csC/LCA47gKi44csLitVYXPjyhFeKua3sokFhLdXtcG+n5hOgtF0ta nWQc4TUmGPMh39KfNQPLvBdIQ6PhWdiAp5JQ6W9CkxtqGYMKp8PN9Ql6kspPGD5UsRJR /mvQ== X-Gm-Message-State: ALoCoQkAMI3UpZrhD+bJHTy0ZpGHWlBwDt6f97EDRzVnzkmHRrKP73pPN4S2T2CCcrE56KWOsrD5 X-Received: by 10.236.17.161 with SMTP id j21mr449815yhj.55.1386271283941; Thu, 05 Dec 2013 11:21:23 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.120.5 with SMTP id ky5ls888080qeb.26.gmail; Thu, 05 Dec 2013 11:21:23 -0800 (PST) X-Received: by 10.52.113.170 with SMTP id iz10mr2333987vdb.56.1386271283841; Thu, 05 Dec 2013 11:21:23 -0800 (PST) Received: from mail-ve0-f178.google.com (mail-ve0-f178.google.com [209.85.128.178]) by mx.google.com with ESMTPS id fx15si35262924vec.110.2013.12.05.11.21.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 11:21:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.178; Received: by mail-ve0-f178.google.com with SMTP id c14so14306455vea.37 for ; Thu, 05 Dec 2013 11:21:23 -0800 (PST) X-Received: by 10.220.47.10 with SMTP id l10mr4958261vcf.32.1386271283649; Thu, 05 Dec 2013 11:21:23 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp40660vcz; Thu, 5 Dec 2013 11:21:23 -0800 (PST) X-Received: by 10.60.51.196 with SMTP id m4mr69166761oeo.1.1386271281697; Thu, 05 Dec 2013 11:21:21 -0800 (PST) Received: from mail-gw1-out.broadcom.com (mail-gw1-out.broadcom.com. [216.31.210.62]) by mx.google.com with ESMTP id n6si57815956oeq.30.2013.12.05.11.21.20 for ; Thu, 05 Dec 2013 11:21:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of tkryger@broadcom.com designates 216.31.210.62 as permitted sender) client-ip=216.31.210.62; X-IronPort-AV: E=Sophos;i="4.93,835,1378882800"; d="scan'208";a="366953" Received: from irvexchcas07.broadcom.com (HELO IRVEXCHCAS07.corp.ad.broadcom.com) ([10.9.208.55]) by mail-gw1-out.broadcom.com with ESMTP; 05 Dec 2013 11:25:17 -0800 Received: from IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) by IRVEXCHCAS07.corp.ad.broadcom.com (10.9.208.55) with Microsoft SMTP Server (TLS) id 14.1.438.0; Thu, 5 Dec 2013 11:21:20 -0800 Received: from mail-sj1-12.sj.broadcom.com (10.10.10.20) by IRVEXCHSMTP1.corp.ad.broadcom.com (10.9.207.51) with Microsoft SMTP Server id 14.1.438.0; Thu, 5 Dec 2013 11:21:20 -0800 Received: from mps-infra-lab3.broadcom.com (mps-infra-lab3.sj.broadcom.com [10.19.114.109]) by mail-sj1-12.sj.broadcom.com (Postfix) with ESMTP id D0824207D5; Thu, 5 Dec 2013 11:21:18 -0800 (PST) Received: by mps-infra-lab3.broadcom.com (Postfix, from userid 1004) id A5C3A458A0E; Thu, 5 Dec 2013 11:21:18 -0800 (PST) From: Tim Kryger To: Christian Daudt , Rob Herring , Pawel Moll , Mark Rutland , Stephen Warren , Ian Campbell , Daniel Lezcano , Thomas Gleixner , Chris Ball , Axel Lin CC: Tim Kryger , Device Tree List , Linux ARM Kernel List , Linux Kernel Mailing List , Linux MMC List , Linaro Patches List Subject: [PATCH v4 7/8] clocksource: kona: Add basic use of external clock Date: Thu, 5 Dec 2013 11:20:43 -0800 Message-ID: <1386271244-3927-8-git-send-email-tim.kryger@linaro.org> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1386271244-3927-1-git-send-email-tim.kryger@linaro.org> References: <1386271244-3927-1-git-send-email-tim.kryger@linaro.org> MIME-Version: 1.0 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: tim.kryger@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.178 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When an clock is specified in the device tree, enable it and use it to determine the external clock frequency. Signed-off-by: Tim Kryger Reviewed-by: Markus Mayer Reviewed-by: Matt Porter Reviewed-by: Christian Daudt Acked-by: Daniel Lezcano --- drivers/clocksource/bcm_kona_timer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c index 0d7d8c3..8a4ab36 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -107,11 +108,18 @@ static const struct of_device_id bcm_timer_ids[] __initconst = { static void __init kona_timers_init(struct device_node *node) { u32 freq; + struct clk *external_clk; - if (!of_property_read_u32(node, "clock-frequency", &freq)) + external_clk = of_clk_get_by_name(node, NULL); + + if (!IS_ERR(external_clk)) { + arch_timer_rate = clk_get_rate(external_clk); + clk_prepare_enable(external_clk); + } else if (!of_property_read_u32(node, "clock-frequency", &freq)) { arch_timer_rate = freq; - else - panic("clock-frequency not set in the .dts file"); + } else { + panic("unable to determine clock-frequency"); + } /* Setup IRQ numbers */ timers.tmr_irq = irq_of_parse_and_map(node, 0);