From patchwork Wed Jul 23 10:53:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 34140 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f200.google.com (mail-ig0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7B91C2061E for ; Wed, 23 Jul 2014 10:57:19 +0000 (UTC) Received: by mail-ig0-f200.google.com with SMTP id uq10sf5078868igb.7 for ; Wed, 23 Jul 2014 03:57:19 -0700 (PDT) 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: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=nOJgA92guQRIfTM799Nx0ODiqRgOENI8w9pgW1sJ3z4=; b=JgTogLsktMVpsokFM0e6t8R4sWKAehhFdG0nITeOn1FHaH/a78IWCRxqHGDVNHHPpx SEMCB5IJv+c0mZ4jqWh1/n5qJrcXM1qnEaTluKaMxFyDzDzN7/pZrOq6I6tgZglsEFA9 fp3PLJvDV82sRR6GxLwvfX9f0bXPDKOOBIxVjuPv39mC8ubE0IF+xDha9nA4kumKJlcj qedPDGjzsTN4HkDq159tDLALsphWNChL9jibX+VLgox/KWtdwiCqkgGy1UM/H70vORRL 3pSNKXKEZ2Ri+indFz3XmkGKH14jwA8sjTRgCyajZAp0PKTtN+PjyzaOaLjtj5EXfiZM T97g== X-Gm-Message-State: ALoCoQmM7oylb613uBtG5JFpgFGuwbmn4hZsvQy95ZWPi0nKU3gTavTz28EUQwfdizyta60rSkhP X-Received: by 10.182.123.232 with SMTP id md8mr135439obb.41.1406113039004; Wed, 23 Jul 2014 03:57:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.20.23 with SMTP id 23ls344670qgi.26.gmail; Wed, 23 Jul 2014 03:57:18 -0700 (PDT) X-Received: by 10.52.164.11 with SMTP id ym11mr629310vdb.74.1406113038887; Wed, 23 Jul 2014 03:57:18 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id lz6si1535024vec.15.2014.07.23.03.57.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jul 2014 03:57:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.172 as permitted sender) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id im17so1733026vcb.31 for ; Wed, 23 Jul 2014 03:57:18 -0700 (PDT) X-Received: by 10.221.26.10 with SMTP id rk10mr952254vcb.0.1406113038787; Wed, 23 Jul 2014 03:57:18 -0700 (PDT) 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.221.37.5 with SMTP id tc5csp268935vcb; Wed, 23 Jul 2014 03:57:18 -0700 (PDT) X-Received: by 10.70.37.129 with SMTP id y1mr644203pdj.12.1406113037992; Wed, 23 Jul 2014 03:57:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qo1si1079184pdb.95.2014.07.23.03.57.17 for ; Wed, 23 Jul 2014 03:57:17 -0700 (PDT) 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 S1758042AbaGWK5M (ORCPT + 15 others); Wed, 23 Jul 2014 06:57:12 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:52108 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757293AbaGWKy3 (ORCPT ); Wed, 23 Jul 2014 06:54:29 -0400 Received: by mail-wi0-f172.google.com with SMTP id n3so7541023wiv.5 for ; Wed, 23 Jul 2014 03:54:27 -0700 (PDT) X-Received: by 10.180.187.197 with SMTP id fu5mr8903696wic.64.1406112867556; Wed, 23 Jul 2014 03:54:27 -0700 (PDT) Received: from localhost.localdomain (AToulouse-654-1-406-71.w82-125.abo.wanadoo.fr. [82.125.33.71]) by mx.google.com with ESMTPSA id es9sm1112100wjd.1.2014.07.23.03.54.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 23 Jul 2014 03:54:26 -0700 (PDT) From: Daniel Lezcano To: linux-kernel@vger.kernel.org Subject: [PATCH 17/25] clocksource: sirf: Fix incorrect clock enable counter for timer Date: Wed, 23 Jul 2014 12:53:59 +0200 Message-Id: <1406112847-26275-17-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1406112847-26275-1-git-send-email-daniel.lezcano@linaro.org> References: <53CF93B2.6040903@linaro.org> <1406112847-26275-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.220.172 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: Zhiwu Song In the clocksource driver, we didn't explicitly enable the clock. it makes the clk reference counter wrong. We didn't encounter any hang issue because the tick's clock input has been open and is shared by some other hardware components, but if we don't enable those components in kernel, in the stage of disabling unused clk in kernel boot, Linux tick hangs. This patch fixes it. it does an explicit prepare and enable to the clock input, and increases the usage counter of the clk. Signed-off-by: Zhiwu Song Signed-off-by: Barry Song Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-marco.c | 3 +++ drivers/clocksource/timer-prima2.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/clocksource/timer-marco.c b/drivers/clocksource/timer-marco.c index dbd3039..330e930 100644 --- a/drivers/clocksource/timer-marco.c +++ b/drivers/clocksource/timer-marco.c @@ -260,6 +260,9 @@ static void __init sirfsoc_marco_timer_init(struct device_node *np) clk = of_clk_get(np, 0); BUG_ON(IS_ERR(clk)); + + BUG_ON(clk_prepare_enable(clk)); + rate = clk_get_rate(clk); BUG_ON(rate < MARCO_CLOCK_FREQ); diff --git a/drivers/clocksource/timer-prima2.c b/drivers/clocksource/timer-prima2.c index a722aac..ce18d57 100644 --- a/drivers/clocksource/timer-prima2.c +++ b/drivers/clocksource/timer-prima2.c @@ -200,6 +200,9 @@ static void __init sirfsoc_prima2_timer_init(struct device_node *np) clk = of_clk_get(np, 0); BUG_ON(IS_ERR(clk)); + + BUG_ON(clk_prepare_enable(clk)); + rate = clk_get_rate(clk); BUG_ON(rate < PRIMA2_CLOCK_FREQ);