lkml.org 
[lkml]   [2011]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] Add a common struct clk
On Wed, Jan 05, 2011 at 11:51:02AM +0800, Jeremy Kerr wrote:
> diff --git a/kernel/clk.c b/kernel/clk.c
> new file mode 100644
> index 0000000..8de8fe3
> --- /dev/null
> +++ b/kernel/clk.c
> @@ -0,0 +1,102 @@
> +/*
> + * Copyright (C) 2010 Canonical Ltd <jeremy.kerr@canonical.com>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * Standard functionality for the common clock API.
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/module.h>
> +

...

> +
> +int clk_set_parent(struct clk *clk, struct clk *parent)
> +{
> + if (clk->ops->set_parent)
> + return clk->ops->set_parent(clk, parent);
> + return -ENOSYS;
> +}
> +EXPORT_SYMBOL_GPL(clk_set_parent);

The i.MX clk implementation disables the old parent if clk is enabled
and enables the new parent if clk is enabled (modulo bugs). Shouldn't
we do this here aswell? Otherwise at least the enable_count of both the
old and the new parent will be wrong after calling clk_set_parent for an
enabled clk.

I thought about returning -EBUSY if clk_set_parent is called for an
enabled clk, but this way we could never reparent the cpu clock which I
think is done in the Freescale BSP for power saving.

Sascha


--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |

\
 
 \ /
  Last update: 2011-01-11 11:19    [from the cache]
©2003-2011 Jasper Spaans