From patchwork Thu Dec 5 22:13:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Kryger X-Patchwork-Id: 22114 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 135B5202E0 for ; Thu, 5 Dec 2013 22:13:52 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id oz11sf41602675veb.0 for ; Thu, 05 Dec 2013 14:13:52 -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=vPK/eDMYC/AWSB39OA8JIlmSnMXH5t/5gIeACQ4M1pY=; b=Klzf7CdP4LAv60jNKyrfkPdnlK5P4fYU0VgaVDfU6l4ZbSTBIr2a5OwE+pGdJL40GP wkjE015+HKzWjhnMEzsi/y7tmP+kK7w3EFPh2spyTr3gLfDVKidzu0w4YgBZ3ffzqZwM uUHenB1D7UR4RHuSyfYIqRmZQM2K/Y0dJeS458Pum5u3+GQcPQR64E1vpiKMaOoE3kwk 7JgwL73NIN5GhBkOg13fyfI7pxiYHDQ+H38Vnz/YRhZ7LafwzlePg8LgJOsEWxrHw5HF Wp/1zLD4ithUOzEdiZn2SJ7+u+e9FOCBV4nhuf2zVgi1TKkZVWpxTfx4QnuXsLc6IeAw z6Cw== X-Gm-Message-State: ALoCoQkNb4QDeAh2rzgPwlSYuZwB7EcUJjCxDbpXrRc7Qyv5PGc5Z+7VXfBvCj+qhxqzUWkoOaKP X-Received: by 10.236.18.196 with SMTP id l44mr37557yhl.52.1386281632181; Thu, 05 Dec 2013 14:13:52 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.58.229 with SMTP id u5ls1048366qeq.69.gmail; Thu, 05 Dec 2013 14:13:52 -0800 (PST) X-Received: by 10.220.95.201 with SMTP id e9mr174531vcn.71.1386281632073; Thu, 05 Dec 2013 14:13:52 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id d6si35452733veo.20.2013.12.05.14.13.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 05 Dec 2013 14:13:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id oz11so14777288veb.32 for ; Thu, 05 Dec 2013 14:13:52 -0800 (PST) X-Received: by 10.58.246.136 with SMTP id xw8mr3143724vec.41.1386281631865; Thu, 05 Dec 2013 14:13:51 -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 u4csp51560vcz; Thu, 5 Dec 2013 14:13:51 -0800 (PST) X-Received: by 10.182.255.137 with SMTP id aq9mr11552obd.80.1386281631403; Thu, 05 Dec 2013 14:13:51 -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 x6si2502747obl.101.2013.12.05.14.13.50 for ; Thu, 05 Dec 2013 14:13:51 -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.93,836,1378882800"; d="scan'208";a="379202" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw2-out.broadcom.com with ESMTP; 05 Dec 2013 14:18:11 -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.1.438.0; Thu, 5 Dec 2013 14:13:50 -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.1.438.0; Thu, 5 Dec 2013 14:13:50 -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 F01A6207C0; Thu, 5 Dec 2013 14:13:49 -0800 (PST) Received: by mps-infra-lab3.broadcom.com (Postfix, from userid 1004) id D6CE8458A0E; Thu, 5 Dec 2013 14:13:49 -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] clocksource: kona: Print warning rather than panic Date: Thu, 5 Dec 2013 14:13:41 -0800 Message-ID: <1386281621-5659-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.173 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 --- This patch depends on: https://lkml.org/lkml/2013/12/5/513 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 8a4ab36..75d26fe 100644 --- a/drivers/clocksource/bcm_kona_timer.c +++ b/drivers/clocksource/bcm_kona_timer.c @@ -105,31 +105,6 @@ 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; - - 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) { @@ -204,7 +179,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);