From patchwork Wed Feb 5 00:15:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Kryger X-Patchwork-Id: 24156 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f71.google.com (mail-pb0-f71.google.com [209.85.160.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 08FC4202FA for ; Wed, 5 Feb 2014 00:15:19 +0000 (UTC) Received: by mail-pb0-f71.google.com with SMTP id jt11sf23242189pbb.6 for ; Tue, 04 Feb 2014 16:15:19 -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 :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=TzQx5UTfWkNS7Ol6BVkH6utRjBNHPa8Ljy/bUfKnQl0=; b=IzmJMVCOo7IAupdg10FfC4FG1j0vdQX1L0OKvmffc8aHLPO7mh0K6ilinJ9F2VdNxB jDXn09MIpGgYyEUt/TELc40ap7/Ty/DLNZhBgn+FDzDg9KaeXqKgblmCfVn6S3qBk7YY ipy5x4AsHwUXbr/zYED3KfxJd6nekKLoHI/6p0RkYa1ILee1Gh9q1+Yn83v8OeEwkled rJIjF9+w7sDW5sbt4zf/DdRbSXl9Udz2kGCROMZFQIDBJR52HDLN9/WE/I3BKLbjRFUX 8r5mwbiGGd6AZduVno5r02WtKAsONkyELTGpl5Of90lMtkC53Pm2qiSQjrixX7w4TpAq eejQ== X-Gm-Message-State: ALoCoQlPzN09QX4hYX7UmyTmLFuARC9C1iEClhrprNQUuhhFTWb20cD1qbJF0XfBuToV0e6Sa6aE X-Received: by 10.68.197.73 with SMTP id is9mr17287430pbc.0.1391559319183; Tue, 04 Feb 2014 16:15:19 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.199 with SMTP id d65ls2538287qge.12.gmail; Tue, 04 Feb 2014 16:15:19 -0800 (PST) X-Received: by 10.52.248.138 with SMTP id ym10mr23547918vdc.18.1391559319059; Tue, 04 Feb 2014 16:15:19 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id kn3si8957384veb.130.2014.02.04.16.15.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Feb 2014 16:15:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 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.171; Received: by mail-ve0-f171.google.com with SMTP id pa12so6537872veb.2 for ; Tue, 04 Feb 2014 16:15:18 -0800 (PST) X-Received: by 10.58.54.15 with SMTP id f15mr12012003vep.5.1391559318750; Tue, 04 Feb 2014 16:15:18 -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 u4csp4395vcz; Tue, 4 Feb 2014 16:15:18 -0800 (PST) X-Received: by 10.50.28.72 with SMTP id z8mr355318igg.44.1391559318009; Tue, 04 Feb 2014 16:15:18 -0800 (PST) Received: from mail-gw2-out.broadcom.com (mail-gw2-out.broadcom.com. [216.31.210.63]) by mx.google.com with ESMTP id mg9si36135876icc.102.2014.02.04.16.15.17 for ; Tue, 04 Feb 2014 16:15:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of tkryger@broadcom.com designates 216.31.210.63 as permitted sender) client-ip=216.31.210.63; X-IronPort-AV: E=Sophos;i="4.95,783,1384329600"; d="scan'208";a="12967731" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw2-out.broadcom.com with ESMTP; 04 Feb 2014 16:28:36 -0800 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.3.174.1; Tue, 4 Feb 2014 16:15:16 -0800 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.3.174.1; Tue, 4 Feb 2014 16:15:16 -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 2855C207CF; Tue, 4 Feb 2014 16:15:16 -0800 (PST) Received: by mps-infra-lab3.broadcom.com (Postfix, from userid 1004) id F4124458A2E; Tue, 4 Feb 2014 16:15:15 -0800 (PST) From: Tim Kryger To: Christian Daudt , Daniel Lezcano , Thomas Gleixner CC: Tim Kryger , Broadcom Kernel Feedback List , Linux Kernel Mailing List , Linaro Patches List Subject: [PATCH v2] clocksource: kona: Print warning rather than panic Date: Tue, 4 Feb 2014 16:15:04 -0800 Message-ID: <1391559304-26558-1-git-send-email-tim.kryger@linaro.org> X-Mailer: git-send-email 1.8.0.1 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.171 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: , Since there may be other clocksources available, this driver should not trigger a panic simply because it can not determine the frequency of an external clock. This change refactors the driver to allow a warning to be printed in this case instead. Signed-off-by: Tim Kryger Reviewed-by: Markus Mayer Reviewed-by: Matt Porter --- Changes since v1: - Rebased on v3.14-rc1 drivers/clocksource/bcm_kona_timer.c | 54 +++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c index 974b2db..0595dc6 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c @@ -99,31 +99,6 @@ kona_timer_get_counter(void *timer_base, uint32_t *msw, uint32_t *lsw) return; } -static void __init kona_timers_init(struct device_node *node) -{ - u32 freq; - struct clk *external_clk; - - 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("unable to determine clock-frequency"); - } - - /* Setup IRQ numbers */ - timers.tmr_irq = irq_of_parse_and_map(node, 0); - - /* Setup IO addresses */ - timers.tmr_regs = of_iomap(node, 0); - - kona_timer_disable_and_clear(timers.tmr_regs); -} - static int kona_timer_set_next_event(unsigned long clc, struct clock_event_device *unused) { @@ -198,7 +173,34 @@ static struct irqaction kona_timer_irq = { static void __init kona_timer_init(struct device_node *node) { - kona_timers_init(node); + u32 freq; + struct clk *external_clk; + + if (!of_device_is_available(node)) { + pr_info("Kona Timer v1 marked as disabled in device tree\n"); + return; + } + + 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 { + pr_err("Kona Timer v1 unable to determine clock-frequency"); + return; + } + + /* Setup IRQ numbers */ + timers.tmr_irq = irq_of_parse_and_map(node, 0); + + /* Setup IO addresses */ + timers.tmr_regs = of_iomap(node, 0); + + kona_timer_disable_and_clear(timers.tmr_regs); + kona_timer_clockevents_init(); setup_irq(timers.tmr_irq, &kona_timer_irq); kona_timer_set_next_event((arch_timer_rate / HZ), NULL);