* [PATCH] clk-fixed-factor: Using parent flags
@ 2013-02-15 10:09 Alexander Shiyan
2013-02-15 12:28 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Shiyan @ 2013-02-15 10:09 UTC (permalink / raw)
To: barebox
This patch allow using parent flags for newly created clocks, so if
parent clock, for example, have flag CLK_ALWAYS_ENABLED, we will use it.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
drivers/clk/clk-fixed-factor.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
index 52e7c16..56aa63e 100644
--- a/drivers/clk/clk-fixed-factor.c
+++ b/drivers/clk/clk-fixed-factor.c
@@ -43,6 +43,7 @@ struct clk *clk_fixed_factor(const char *name,
const char *parent, unsigned int mult, unsigned int div)
{
struct clk_fixed_factor *f = xzalloc(sizeof(*f));
+ struct clk *parent_clk;
int ret;
f->mult = mult;
@@ -53,6 +54,10 @@ struct clk *clk_fixed_factor(const char *name,
f->clk.parent_names = &f->parent;
f->clk.num_parents = 1;
+ parent_clk = clk_lookup(parent);
+ if (!IS_ERR(parent_clk))
+ f->clk.flags = parent_clk->flags;
+
ret = clk_register(&f->clk);
if (ret) {
free(f);
--
1.7.3.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] clk-fixed-factor: Using parent flags
2013-02-15 10:09 [PATCH] clk-fixed-factor: Using parent flags Alexander Shiyan
@ 2013-02-15 12:28 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-02-15 12:28 UTC (permalink / raw)
To: Alexander Shiyan; +Cc: barebox
On Fri, Feb 15, 2013 at 02:09:35PM +0400, Alexander Shiyan wrote:
> This patch allow using parent flags for newly created clocks, so if
> parent clock, for example, have flag CLK_ALWAYS_ENABLED, we will use it.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> drivers/clk/clk-fixed-factor.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
> index 52e7c16..56aa63e 100644
> --- a/drivers/clk/clk-fixed-factor.c
> +++ b/drivers/clk/clk-fixed-factor.c
> @@ -43,6 +43,7 @@ struct clk *clk_fixed_factor(const char *name,
> const char *parent, unsigned int mult, unsigned int div)
> {
> struct clk_fixed_factor *f = xzalloc(sizeof(*f));
> + struct clk *parent_clk;
> int ret;
>
> f->mult = mult;
> @@ -53,6 +54,10 @@ struct clk *clk_fixed_factor(const char *name,
> f->clk.parent_names = &f->parent;
> f->clk.num_parents = 1;
>
> + parent_clk = clk_lookup(parent);
> + if (!IS_ERR(parent_clk))
> + f->clk.flags = parent_clk->flags;
> +
So we unconditionally overwrite the fixed factor clock flags. As long as
CLK_ALWAYS_ENABLED is the only flag we have this might be ok, but this
will lead to strange behaviour when we get other flags.
There should rather be some mechanism which detects that a clock must be
enabled because all parents have no disable callback or have the
CLK_ALWAYS_ENABLED flag set.
I have no idea currently though how to implement this.
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 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-02-15 12:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-15 10:09 [PATCH] clk-fixed-factor: Using parent flags Alexander Shiyan
2013-02-15 12:28 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox