From patchwork Sat Apr 27 21:10:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olof Johansson X-Patchwork-Id: 2497461 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id D10473FC64 for ; Sat, 27 Apr 2013 21:10:31 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UWCO6-0004dU-5I; Sat, 27 Apr 2013 21:10:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UWCO3-0002Bm-Ou; Sat, 27 Apr 2013 21:10:27 +0000 Received: from mail-da0-x22d.google.com ([2607:f8b0:400e:c00::22d]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UWCO1-0002BB-Rk for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2013 21:10:26 +0000 Received: by mail-da0-f45.google.com with SMTP id v40so431073dad.32 for ; Sat, 27 Apr 2013 14:10:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent:x-gm-message-state; bh=DTWTFN+mg6xUThwat4P52tY6XPV3xrIUUc6Xq44LGHs=; b=n2LClBskngW2KYFwwbJuqMppPFzKo9QXyQ0if8AVNerJW0OlO+k45z4aLnsTx97NCs bHoFHAPcHzxQqpHk8BYZKWCCPyI8IYNpPe67o/34mHIoAP3aTPV5iN8csL3zU4fVg3/m SxhpKfZhxzYOyi9S+CtRA3RV8b0OopAbQmFg7HvQ5AhtmyzIHcNvklk8QmbdBZTkR+cU 7WgeqIL8emjlVyoVNxVjT0vQTQt0fxyqQUPgrfVhSh/8/MT3OPe0n6yG8IBwfOpiNkgP v5bKafSwwG9gjQZ104wrI3v6be+D6b3lkYsmW0lzMXeTIDs+k623CvgvPVaF4sJHBOQ7 sn1A== X-Received: by 10.68.172.5 with SMTP id ay5mr65296024pbc.73.1367097023166; Sat, 27 Apr 2013 14:10:23 -0700 (PDT) Received: from localhost ([2001:470:1f05:1640:c01f:8244:f6f5:8caf]) by mx.google.com with ESMTPSA id al2sm17175420pbc.25.2013.04.27.14.10.20 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 27 Apr 2013 14:10:21 -0700 (PDT) Date: Sat, 27 Apr 2013 14:10:18 -0700 From: Olof Johansson To: Mike Turquette Subject: [PATCH v2] clk: add clk_ignore_unused option to keep boot clocks on Message-ID: <20130427211018.GA9376@quad.lixom.net> References: <1367019591-31685-1-git-send-email-olof@lixom.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1367019591-31685-1-git-send-email-olof@lixom.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQmqcmOWp4fvfRArso3+UsEBQ3KmxkitXNwdsnytNalPg5d54RW4s3UT5nt+vo8XW0ZFsz/s X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130427_171025_973804_F1DDBDF3 X-CRM114-Status: GOOD ( 16.49 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Randy Dunlap , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This is primarily useful when there's a driver that doesn't claim clocks properly, but the bootloader leaves them on. It's not expected to be used in normal cases, but for bringup and debug it's very useful to have the option to not gate unclaimed clocks that are still on. Signed-off-by: Olof Johansson --- Documentation/clk.txt | 11 +++++++++++ Documentation/kernel-parameters.txt | 8 ++++++++ drivers/clk/clk.c | 13 +++++++++++++ 3 files changed, 32 insertions(+) diff --git a/Documentation/clk.txt b/Documentation/clk.txt index 4274a54..b9911c2 100644 --- a/Documentation/clk.txt +++ b/Documentation/clk.txt @@ -231,3 +231,14 @@ To better enforce this policy, always follow this simple rule: any statically initialized clock data MUST be defined in a separate file from the logic that implements its ops. Basically separate the logic from the data and all is well. + + Part 6 - Disabling clock gating of unused clocks + +Sometimes during development it can be useful to be able to bypass the +default disabling of unused clocks. For example, if drivers aren't enabling +clocks properly but rely on them being on from the bootloader, bypassing +the disabling means that the driver will remain functional while the issues +are sorted out. + +To bypass this disabling, include "clk_ignore_unused" in the bootargs to the +kernel. diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index c4fa000..c3bfacb 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -44,6 +44,7 @@ parameter is applicable: AVR32 AVR32 architecture is enabled. AX25 Appropriate AX.25 support is enabled. BLACKFIN Blackfin architecture is enabled. + CLK Common clock infrastructure is enabled. CMA Contiguous Memory Area support is enabled. DRM Direct Rendering Management support is enabled. DYNAMIC_DEBUG Build in debug messages and enable them at runtime @@ -473,6 +474,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. cio_ignore= [S390] See Documentation/s390/CommonIO for details. + clk_ignore_unused + [CLK] + Keep all clocks already enabled by bootloader on, + even if no driver has claimed them. This is useful + for debug and development, but should not be + needed on a platform with proper driver support. + For more information, see Documentation/clk.txt. clock= [BUGS=X86-32, HW] gettimeofday clocksource override. [Deprecated] diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 20ce67f..934cfd1 100644 --- a/drivers/clk/clk.c +++ b/drivers/clk/clk.c @@ -499,10 +499,23 @@ out: return; } +static bool clk_ignore_unused; +static int __init clk_ignore_unused_setup(char *__unused) +{ + clk_ignore_unused = true; + return 1; +} +__setup("clk_ignore_unused", clk_ignore_unused_setup); + static int clk_disable_unused(void) { struct clk *clk; + if (clk_ignore_unused) { + pr_warn("clk: Not disabling unused clocks\n"); + return 0; + } + clk_prepare_lock(); hlist_for_each_entry(clk, &clk_root_list, child_node)