From patchwork Mon Oct 19 23:26:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 54857 Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9JNTLfC021405 for ; Mon, 19 Oct 2009 23:29:22 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9JNQmmA018585 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 19 Oct 2009 18:26:48 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n9JNQm2N010685; Mon, 19 Oct 2009 18:26:48 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 66C3080627; Mon, 19 Oct 2009 18:26:47 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id 51BB780626 for ; Mon, 19 Oct 2009 18:26:45 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id n9JNQiPY008417 for ; Mon, 19 Oct 2009 18:26:44 -0500 (CDT) Received: from mail84-tx2-R.bigfish.com (mail-tx2.bigfish.com [65.55.88.112]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id n9JNQieO008109 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Mon, 19 Oct 2009 18:26:44 -0500 Received: from mail84-tx2 (localhost.localdomain [127.0.0.1]) by mail84-tx2-R.bigfish.com (Postfix) with ESMTP id 441CB2A0493 for ; Mon, 19 Oct 2009 23:26:44 +0000 (UTC) X-SpamScore: -26 X-BigFish: vps-26(zz1432R98dN1447Rzz1202hzzz2dh6bh61h) X-Spam-TCS-SCL: 0:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 209.85.219.210; Service: EHS Received: by mail84-tx2 (MessageSwitch) id 1255994802482609_9792; Mon, 19 Oct 2009 23:26:42 +0000 (UCT) Received: from TX2EHSMHS029.bigfish.com (unknown [10.9.14.236]) by mail84-tx2.bigfish.com (Postfix) with ESMTP id 66A9F1B38053 for ; Mon, 19 Oct 2009 23:26:42 +0000 (UTC) Received: from mail-ew0-f210.google.com (209.85.219.210) by TX2EHSMHS029.bigfish.com (10.9.99.129) with Microsoft SMTP Server id 14.0.482.32; Mon, 19 Oct 2009 23:26:40 +0000 Received: by ewy6 with SMTP id 6so1632565ewy.6 for ; Mon, 19 Oct 2009 16:26:38 -0700 (PDT) Received: by 10.216.90.133 with SMTP id e5mr2067326wef.23.1255994798722; Mon, 19 Oct 2009 16:26:38 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id 7sm3390818eyg.4.2009.10.19.16.26.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 19 Oct 2009 16:26:37 -0700 (PDT) To: Russell King - ARM Linux References: <1255720190-7452-6-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-7-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-8-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-9-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-10-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-11-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-12-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-13-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-14-git-send-email-khilman@deeprootsystems.com> <1255720190-7452-15-git-send-email-khilman@deeprootsystems.com> <20091019140540.GB13614@n2100.arm.linux.org.uk> From: Kevin Hilman Organization: Deep Root Systems, LLC Date: Mon, 19 Oct 2009 16:26:33 -0700 In-Reply-To: <20091019140540.GB13614@n2100.arm.linux.org.uk> (Russell King's message of "Mon\, 19 Oct 2009 15\:05\:40 +0100") Message-ID: <87pr8jq82e.fsf@deeprootsystems.com> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 X-Reverse-DNS: mail-ew0-f210.google.com Cc: davinci-linux-open-source@linux.davincidsp.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 13/46] davinci: support re-parenting a clock in the clock framework X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c index 09e0e1c..e7696fc 100644 --- a/arch/arm/mach-davinci/clock.c +++ b/arch/arm/mach-davinci/clock.c @@ -141,6 +141,33 @@ int clk_set_rate(struct clk *clk, unsigned long rate) } EXPORT_SYMBOL(clk_set_rate); +int clk_set_parent(struct clk *clk, struct clk *parent) +{ + unsigned long flags; + + if (clk == NULL || IS_ERR(clk)) + return -EINVAL; + + /* Cannot change parent on enabled clock */ + if (WARN_ON(clk->usecount)) + return -EINVAL; + + mutex_lock(&clocks_mutex); + clk->parent = parent; + list_del_init(&clk->childnode); + list_add(&clk->childnode, &clk->parent->children); + mutex_unlock(&clocks_mutex); + + spin_lock_irqsave(&clockfw_lock, flags); + if (clk->recalc) + clk->rate = clk->recalc(clk); + propagate_rate(clk); + spin_unlock_irqrestore(&clockfw_lock, flags); + + return 0; +} +EXPORT_SYMBOL(clk_set_parent); + int clk_register(struct clk *clk) { if (clk == NULL || IS_ERR(clk))