From patchwork Thu Oct 3 20:13:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Kryger X-Patchwork-Id: 20816 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F106C25CAB for ; Thu, 3 Oct 2013 20:13:59 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id f12sf5672017vbg.11 for ; Thu, 03 Oct 2013 13:13:59 -0700 (PDT) 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 :content-transfer-encoding; bh=YNSlhdNfv7x0pF2crQgETfBLSVdyHDCiXsdczj3Nggs=; b=bt03bJ5yzkmHalStuJ1SPy0pBiQxFG6bQ98jAfyVEH5RsTrhAVxu9va1KDxdZrHzFw YcBY3ugCU9+Kmq95SeyjDBhWLGZp2WtdRrGZ2p8muYgxdlbQ95FIUtEw+lyuiV9qLPb1 Gft9HSCDgV8prx8rrA2Y9UN4NNqBU9UkznFq4veTwYgA9zpF7bX2QWrOjnjkaGIDwUIS sZzHTtA4KixnmgMD7nzdSbCxGWL6xDKHQ1ADWUObxvtO1NEQciEZHaYe8aI+oNLbI8si +HhPahjQwZVrSadMR68EJoote7HfLePRziVH+mwNZbyI4AsJs3E8cEUgmpj3IQcuhdKu x5kQ== X-Received: by 10.58.238.199 with SMTP id vm7mr1715357vec.17.1380831239836; Thu, 03 Oct 2013 13:13:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.49.42 with SMTP id r10ls1141778qen.86.gmail; Thu, 03 Oct 2013 13:13:59 -0700 (PDT) X-Received: by 10.52.228.137 with SMTP id si9mr1878219vdc.29.1380831239705; Thu, 03 Oct 2013 13:13:59 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id cl2si2112909vdc.10.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 03 Oct 2013 13:13:59 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ia10so1287359vcb.34 for ; Thu, 03 Oct 2013 13:13:59 -0700 (PDT) X-Gm-Message-State: ALoCoQnGe7ZeOJxbjKI6bBWm6SLKBFkfth3HSLr4zAUlBtl4pIETGZXth1IJSMLX79KMwnzjssLL X-Received: by 10.58.75.131 with SMTP id c3mr9033679vew.12.1380831239622; Thu, 03 Oct 2013 13:13:59 -0700 (PDT) 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 u4csp206851vcz; Thu, 3 Oct 2013 13:13:59 -0700 (PDT) X-Received: by 10.42.90.202 with SMTP id l10mr1864121icm.64.1380831235802; Thu, 03 Oct 2013 13:13:55 -0700 (PDT) Received: from mms1.broadcom.com (mms1.broadcom.com. [216.31.210.17]) by mx.google.com with ESMTP id yw6si9076080icb.59.1969.12.31.16.00.00; Thu, 03 Oct 2013 13:13:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of tkryger@broadcom.com designates 216.31.210.17 as permitted sender) client-ip=216.31.210.17; Received: from [10.9.208.57] by mms1.broadcom.com with ESMTP (Broadcom SMTP Relay (Email Firewall v6.5)); Thu, 03 Oct 2013 13:13:46 -0700 X-Server-Uuid: 06151B78-6688-425E-9DE2-57CB27892261 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.1.438.0; Thu, 3 Oct 2013 13:13:45 -0700 Received: from mail-sj1-12.sj.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.1.438.0; Thu, 3 Oct 2013 13:13:45 -0700 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 39716207CF; Thu, 3 Oct 2013 13:13:43 -0700 (PDT) Received: by mps-infra-lab3.broadcom.com (Postfix, from userid 1004) id ECC854589E4; Thu, 3 Oct 2013 13:13:43 -0700 (PDT) From: "Tim Kryger" To: "Christian Daudt" , "Rob Herring" , "Pawel Moll" , "Mark Rutland" , "Stephen Warren" , "Ian Campbell" , "Daniel Lezcano" , "Thomas Gleixner" , "Chris Ball" cc: "Tim Kryger" , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, patches@linaro.org Subject: [PATCH 4/6] clocksource: kona: Add basic use of external clock Date: Thu, 3 Oct 2013 13:13:12 -0700 Message-ID: <1380831194-27238-5-git-send-email-tim.kryger@linaro.org> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1380831194-27238-1-git-send-email-tim.kryger@linaro.org> References: <1380831194-27238-1-git-send-email-tim.kryger@linaro.org> MIME-Version: 1.0 X-WSS-ID: 7E5310700UO13716387-01-01 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.220.175 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 handle 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 --- 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..fd11f96 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("neither clock-frequency or clocks handle in .dts file"); + } /* Setup IRQ numbers */ timers.tmr_irq = irq_of_parse_and_map(node, 0);