From: khilman@deeprootsystems.com (Kevin Hilman)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 13/46] davinci: support re-parenting a clock in the clock framework
Date: Mon, 19 Oct 2009 11:19:00 -0700 [thread overview]
Message-ID: <87ws2rs0vf.fsf@deeprootsystems.com> (raw)
In-Reply-To: <20091019140540.GB13614@n2100.arm.linux.org.uk> (Russell King's message of "Mon\, 19 Oct 2009 15\:05\:40 +0100")
Russell King - ARM Linux <linux@arm.linux.org.uk> writes:
> On Fri, Oct 16, 2009 at 12:09:17PM -0700, Kevin Hilman wrote:
>> From: Sekhar Nori <nsekhar@ti.com>
>>
>> The clk_set_parent() API is implemented to enable re-parenting
>> clocks in the clock tree.
>>
>> This is useful in DVFS and helps by shifting clocks to an asynchronous
>> domain where supported by hardware
>>
>> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
>> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
>> ---
>> arch/arm/mach-davinci/clock.c | 23 +++++++++++++++++++++++
>> 1 files changed, 23 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-davinci/clock.c b/arch/arm/mach-davinci/clock.c
>> index 09e0e1c..12ceeea 100644
>> --- a/arch/arm/mach-davinci/clock.c
>> +++ b/arch/arm/mach-davinci/clock.c
>> @@ -141,6 +141,29 @@ 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;
>> +
>> + mutex_lock(&clocks_mutex);
>> + clk->parent = parent;
>> + list_del_init(&clk->childnode);
>> + list_add(&clk->childnode, &clk->parent->children);
>> + mutex_unlock(&clocks_mutex);
>
> This is bad, and is suffering from precisely the same problem which
> OMAP suffered from:
>
> 1. it takes no notice of whether the clk is in use.
> 2. it takes no notice of whether the parent clocks are being used.
>
> The result is that using clk_set_parent() on a clk_enable()'d clock,
> you totally destroy the usecounting of the parent clocks, leading to
> the clock tree usecount becoming totally buggered up.
>
> Either refuse to change the parent of an already clk_enable()'d clock,
> or do proper usecount fixups when changing the parent.
On davinci, we only reparent during early init, so refusing to change
the parent of an enabled will suffice.
I've added a check (and warning) if the clock is already enabled as
well as a refusal to re-parent:
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;
}
next prev parent reply other threads:[~2009-10-19 18:19 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 19:09 [PATCH 00/46] davinci updates for 2.6.33 Kevin Hilman
2009-10-16 19:09 ` Kevin Hilman
2009-10-16 19:09 ` [PATCH 01/46] DaVinci: DM365: SDIO interrupt resource correction Kevin Hilman
2009-10-16 19:09 ` [PATCH 02/46] DaVinci: DM365: Correct USB parent clock Kevin Hilman
2009-10-16 19:09 ` [PATCH 03/46] Davinci: DM365: Add platform device for McBSP Kevin Hilman
2009-10-16 19:09 ` [PATCH 04/46] davinci: Move DA8xx/OMAP-L13x emac register routine Kevin Hilman
2009-10-16 19:09 ` [PATCH 05/46] davinci: Change DA8xx/OMAP-L13x McASP registration routine name Kevin Hilman
2009-10-16 19:09 ` [PATCH 06/46] davinci: Add DA830/OMAP-L137 EVM specific pinmux setting for McASP1 Kevin Hilman
2009-10-16 19:09 ` [PATCH 07/46] davinci: DA8XX/OMAP-L1XX: It's SYSCFG not BOOT_CFG Kevin Hilman
2009-10-16 19:09 ` [PATCH 08/46] davinci: DA8XX/OMAP-L1XX: Avoid use of IO_ADDRESS for SYSCFG module Kevin Hilman
2009-10-16 19:09 ` [PATCH 09/46] davinci: DA8XX/OMAP-L1XX: JTAG ID register should offset from SYSCFG base Kevin Hilman
2009-10-16 19:09 ` [PATCH 10/46] davinci: enable easy top down traversal of clock tree Kevin Hilman
2009-10-16 19:09 ` [PATCH 11/46] davinci: make clock rate re-calculation easy Kevin Hilman
2009-10-16 19:09 ` [PATCH 12/46] davinci: support changing the clock rate in clock framework Kevin Hilman
2009-10-16 19:09 ` [PATCH 13/46] davinci: support re-parenting a clock in the " Kevin Hilman
2009-10-16 19:09 ` [PATCH 14/46] davinci: DA850/OMAP-L138: allow async3 source to be changed Kevin Hilman
2009-10-16 19:09 ` [PATCH 15/46] davinci: dm646x: Add support for 3.x silicon revision Kevin Hilman
2009-10-16 19:09 ` [PATCH 16/46] davinci: Add MMC/SD support for DA830/OMAP-L137 EVM Kevin Hilman
2009-10-16 19:09 ` [PATCH 17/46] davinci: Add support for Sharp LCD035Q3DG01 graphical LCD Kevin Hilman
2009-10-16 19:09 ` [PATCH 18/46] davinci: Add LCD Graphics support for DA830/OMAP-L137 EVM Kevin Hilman
2009-10-16 19:09 ` [PATCH 19/46] davinci: Add RTC support for DA8xx/OMAP-L13x SoC's Kevin Hilman
2009-10-16 19:09 ` [PATCH 20/46] davinci: Correct the GPIO number for LCD panel power Kevin Hilman
2009-10-16 19:09 ` [PATCH 21/46] DaVinci: EDMA: Fix bug in edma_free_cont_slots API Kevin Hilman
2009-10-16 19:09 ` [PATCH 22/46] DaVinci: EDMA: Fix Bug in edma_alloc_cont_slots API Kevin Hilman
2009-10-16 19:09 ` [PATCH 23/46] davinci: DM355: Update NAND driver platform data Kevin Hilman
2009-10-16 19:09 ` [PATCH 24/46] davinci: DM365: " Kevin Hilman
2009-10-16 19:09 ` [PATCH 25/46] DaVinci: EDMA: Fix Bug while obtaining contiguous params Kevin Hilman
2009-10-16 19:09 ` [PATCH 26/46] DaVinci: EDMA: Updating terminlogy in EDMA driver Kevin Hilman
2009-10-16 19:09 ` [PATCH 27/46] davinci: DA8xx: CFGCHIP2 register definitions Kevin Hilman
2009-10-16 19:09 ` [PATCH 28/46] davinci: DA8xx: OHCI platform device Kevin Hilman
2009-10-16 19:09 ` [PATCH 29/46] davinci: DA830 EVM: OHCI platform code Kevin Hilman
2009-10-16 19:09 ` [PATCH 30/46] davinci: da830 EVM: make machine name string consistent with da850 Kevin Hilman
2009-10-16 19:09 ` [PATCH 31/46] davinci: da830: add support for new silicon revisions Kevin Hilman
2009-10-16 19:09 ` [PATCH 32/46] davinci: da830 EVM: remove #include <mach/gpio.h> Kevin Hilman
2009-10-16 19:09 ` [PATCH 33/46] davinci: add generic CPUFreq driver for DaVinci Kevin Hilman
2009-10-16 19:09 ` [PATCH 34/46] davinci: DA850/OMAP-L138: add frequency scaling support Kevin Hilman
2009-10-16 19:09 ` [PATCH 35/46] davinci: DA850/OMAP-L138: add voltage regulation support Kevin Hilman
2009-10-16 19:09 ` [PATCH 36/46] davinci: DA850/OMAP-L138 EVM: register for CPUFreq support Kevin Hilman
2009-10-16 19:09 ` [PATCH 37/46] davinci: DA850/OMAP-L138 EVM: add support for TPS65070 PMIC Kevin Hilman
2009-10-16 19:09 ` [PATCH 38/46] davinci: fix compilation error when using mach/system.h Kevin Hilman
2009-10-16 19:09 ` [PATCH 39/46] davinci: DA8xx: rename 'psc_ctlr' field into 'gpsc' Kevin Hilman
2009-10-16 19:09 ` [PATCH 40/46] davinci: DA850/OMAP-L138 EVM expander setup and UI card detection Kevin Hilman
2009-10-16 19:09 ` [PATCH 41/46] davinci: RMII support for DA850/OMAP-L138 EVM Kevin Hilman
2009-10-16 19:09 ` [PATCH 42/46] davinci: make it easier to identify SoC init failures Kevin Hilman
2009-10-16 19:09 ` [PATCH 43/46] DaVinci: remove unneeded #include's Kevin Hilman
2009-10-16 19:09 ` [PATCH 44/46] davinci: dm646x-evm: Add platform data for NAND Kevin Hilman
2009-10-16 19:09 ` [PATCH 45/46] davinci: DA850/OMAP-L138: Set ASYNC3 domain flag for McASP Kevin Hilman
2009-10-16 19:09 ` [PATCH 46/46] davinci: DMx and da8xx defconfig updates Kevin Hilman
2009-10-22 14:02 ` [PATCH 43/46] DaVinci: remove unneeded #include's Sergei Shtylyov
2009-10-23 20:49 ` Kevin Hilman
2009-10-19 14:13 ` [PATCH 38/46] davinci: fix compilation error when using mach/system.h Russell King - ARM Linux
2009-10-19 18:33 ` Kevin Hilman
2009-10-19 18:35 ` Russell King - ARM Linux
2009-10-20 12:59 ` Nori, Sekhar
2009-10-20 14:12 ` Kevin Hilman
2009-11-02 12:04 ` [PATCH 33/46] davinci: add generic CPUFreq driver for DaVinci Nori, Sekhar
2009-11-02 17:20 ` Kevin Hilman
2009-10-19 14:07 ` [PATCH 16/46] davinci: Add MMC/SD support for DA830/OMAP-L137 EVM Russell King - ARM Linux
2009-10-19 16:39 ` Mark A. Greer
2009-10-19 16:42 ` Mark A. Greer
2009-10-19 16:56 ` Russell King - ARM Linux
2009-10-19 23:52 ` Kevin Hilman
2009-10-20 0:15 ` H Hartley Sweeten
2009-10-20 15:06 ` Kevin Hilman
2009-10-19 14:05 ` [PATCH 13/46] davinci: support re-parenting a clock in the clock framework Russell King - ARM Linux
2009-10-19 18:19 ` Kevin Hilman [this message]
2009-10-19 23:26 ` Kevin Hilman
2009-10-19 13:58 ` [PATCH 01/46] DaVinci: DM365: SDIO interrupt resource correction Russell King - ARM Linux
2009-10-19 18:03 ` Kevin Hilman
-- strict thread matches above, loose matches on Subject: below --
2009-08-31 10:18 [PATCH 13/46] davinci: support re-parenting a clock in the clock framework Sekhar Nori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ws2rs0vf.fsf@deeprootsystems.com \
--to=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).