linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: fix __clk_init_parent() for single parent clocks
@ 2016-02-09 11:19 Masahiro Yamada
  2016-02-09 18:18 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2016-02-09 11:19 UTC (permalink / raw)
  To: linux-clk; +Cc: Masahiro Yamada, Stephen Boyd, Michael Turquette, linux-kernel

Before commit b3d192d5121f ("clk: simplify __clk_init_parent()"),
__clk_init_parent() called .get_parent() only for multi-parent
clocks.  That commit changed the behavior to call .get_parent()
if available even for single-parent clocks and root clocks.

It turned out a problem because there are some single-parent clocks
that implement .get_parent() callback and return non-zero index.
The SOCFPGA clock is the case; the commit broke the SOCFPGA boards.

To keep the original behavior, invoke .get_parent() only when
num_parents is greater than 1.

Fixes: b3d192d5121f ("clk: simplify __clk_init_parent()")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reported-by: Dinh Nguyen <dinguyen@opensource.altera.com>
---

 drivers/clk/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index e2aa0bc..38515a9 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1662,7 +1662,7 @@ static struct clk_core *__clk_init_parent(struct clk_core *core)
 {
 	u8 index = 0;
 
-	if (core->ops->get_parent)
+	if (core->num_parents > 1 && core->ops->get_parent)
 		index = core->ops->get_parent(core->hw);
 
 	return clk_core_get_parent_by_index(core, index);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: fix __clk_init_parent() for single parent clocks
  2016-02-09 11:19 [PATCH] clk: fix __clk_init_parent() for single parent clocks Masahiro Yamada
@ 2016-02-09 18:18 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2016-02-09 18:18 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-clk, Michael Turquette, linux-kernel

On 02/09, Masahiro Yamada wrote:
> Before commit b3d192d5121f ("clk: simplify __clk_init_parent()"),
> __clk_init_parent() called .get_parent() only for multi-parent
> clocks.  That commit changed the behavior to call .get_parent()
> if available even for single-parent clocks and root clocks.
> 
> It turned out a problem because there are some single-parent clocks
> that implement .get_parent() callback and return non-zero index.
> The SOCFPGA clock is the case; the commit broke the SOCFPGA boards.
> 
> To keep the original behavior, invoke .get_parent() only when
> num_parents is greater than 1.
> 
> Fixes: b3d192d5121f ("clk: simplify __clk_init_parent()")
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> Reported-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-09 18:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-09 11:19 [PATCH] clk: fix __clk_init_parent() for single parent clocks Masahiro Yamada
2016-02-09 18:18 ` Stephen Boyd

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).