Re: [PATCH 3/3] clk: remove redundant clock parents lookup table allocations

2016-01-07 Thread Masahiro Yamada
clk_core *), > GFP_KERNEL); > if (!core->parents) { > ret = -ENOMEM; > goto out; You are doing the similar thing as mine. See https://patchwork.kernel.org/patch/7925571/ This series gives a big confli

[PATCH 1/2] clk: add clk_unregister_fixed_factor()

2016-01-05 Thread Masahiro Yamada
Allow to unregister fixed factor clock. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk-fixed-factor.c | 13 + include/linux/clk-provider.h | 1 + 2 files changed, 14 insertions(+) diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/c

[PATCH 2/2] clk: add clk_unregister_fixed_rate()

2016-01-05 Thread Masahiro Yamada
Allow to unregister fixed rate clock. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk-fixed-rate.c | 13 + include/linux/clk-provider.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/clk/clk-fixed-rate.c b/d

[PATCH] clk: optimize the divider walk in clk_divider_bestdiv()

2016-01-04 Thread Masahiro Yamada
Because _next_div() returns a valid divider, there is no need to consult _is_valid_div() for the validity of the divider in every iteration. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk-divider.c | 5 ++--- 1 file changed, 2 insertions(+), 3 del

Re: [PATCH v2,RESEND] clk: uniphier: add clock drivers for UniPhier SoCs

2016-01-01 Thread Masahiro Yamada
Hi Michael, 2015-12-31 10:35 GMT+09:00 Michael Turquette <mturque...@baylibre.com>: > Hello Yamada-san, > > Quoting Masahiro Yamada (2015-12-28 02:20:58) >> diff --git a/drivers/clk/uniphier/Kconfig b/drivers/clk/uniphier/Kconfig >> new file mode 100644 >> index

[PATCH v2,RESEND] clk: uniphier: add clock drivers for UniPhier SoCs

2015-12-28 Thread Masahiro Yamada
each SoC. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: - split emmc_hw_reset - make SD clock rate-controllable - add CLK_SET_RATE_PARENT flag to mux, gate, fixed-factor clocks MAINTAINERS | 1 + drivers/clk/K

[PATCH v2 03/16] clk: rename __clk_init() into __clk_core_init()

2015-12-28 Thread Masahiro Yamada
Now this function takes clk_core as its argument. __clk_core_init() would be more suitable for the name of this function. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)

[PATCH v2 15/16] clk: simplify clk_fetch_parent_index() function

2015-12-28 Thread Masahiro Yamada
The clk_core_get_parent_by_index can be used as a helper function to simplify the implementation of clk_fetch_parent_index(). Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 18 ++ 1 file changed, 2 insertions(

[PATCH v2 16/16] clk: slightly optimize clk_core_set_parent()

2015-12-28 Thread Masahiro Yamada
If clk_fetch_parent_index() fails, p_rate is unused. Move the assignment after the error checking. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/c

[PATCH v2 14/16] clk: make sure parent is not NULL in clk_fetch_parent_index()

2015-12-28 Thread Masahiro Yamada
If parent is given with NULL, clk_fetch_parent_index() could return a positive index value. Currently, parent is checked by the callers of this function, but it would be safer to do it in this function. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2:

[PATCH v2 07/16] clk: simplify clk_core_get_parent_by_index()

2015-12-28 Thread Masahiro Yamada
Drop the "if (!core->parents)" case and refactor the function a bit because core->parents is always allocated. (Strictly speaking, it is ZERO_SIZE_PTR if core->num_parents == 0, but such a case is omitted by the if-conditional above.) Signed-off-by: Masahiro Yamada <yamada.

[RESEND PATCH v2 09/16] clk: replace pr_warn() with pr_err() for fatal cases

2015-12-28 Thread Masahiro Yamada
These three cases let clk_register() fail. They should be considered as error messages. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/c

[RESEND PATCH v2 11/16] clk: simplify __clk_init_parent()

2015-12-28 Thread Masahiro Yamada
get_parent() is missing. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 38 -- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 4ad0a36

[RESEND PATCH v2 02/16] clk: change the argument of __clk_init() into pointer to clk_core

2015-12-28 Thread Masahiro Yamada
The argument clk_user is used only for the clk_user->core. The rest of this function only takes care of clk_core. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 13 + 1 file changed, 5 insertions(+), 8 deletions

[PATCH v2 08/16] clk: drop the initial core->parents look-ups from __clk_core_init()

2015-12-28 Thread Masahiro Yamada
The core->parents is a cache to save expensive clock parent look-ups. It will be filled as needed later. We do not have to do it here. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 11 --- 1 file changed, 11

[PATCH v2 09/16] clk: replace pr_warn() with pr_err() for fatal cases

2015-12-28 Thread Masahiro Yamada
These three cases let clk_register() fail. They should be considered as error messages. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/c

[PATCH v2 01/16] clk: remove unused first argument of __clk_init()

2015-12-28 Thread Masahiro Yamada
The "struct device *dev" is not used at all in this function. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk

[PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init()

2015-12-28 Thread Masahiro Yamada
The .git_parent is mandatory for multi-parent clocks. Move the check to __clk_core_init(), like other callback checkings. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 12 +--- 1 file changed, 5 insertions(+), 7 del

[PATCH v2 13/16] clk: walk the orphan clock list more simply

2015-12-28 Thread Masahiro Yamada
This loop can be much simpler. If a new parent is available for orphan clocks, __clk_init_parent(orphan) can detect it. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 21 ++--- 1 file changed, 6 insertions(

[PATCH v2 12/16] clk: avoid circular clock topology

2015-12-28 Thread Masahiro Yamada
n it were registered. That should be detected as an error. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 40 1 file changed, 40 insertions(+) diff --git a/drivers/clk/clk.c b/drivers/clk/cl

[PATCH v2 04/16] clk: remove unnecessary !core->parents conditional

2015-12-28 Thread Masahiro Yamada
This if-block has been here since the introduction of the common clock framework. Now no clock drivers are statically initialized. core->parent is always NULL at this point. Drop the redundant check and the confusing comment. Signed-off-by: Masahiro Yamada <yamada.masah...@socione

[RESEND PATCH v2 14/16] clk: make sure parent is not NULL in clk_fetch_parent_index()

2015-12-28 Thread Masahiro Yamada
If parent is given with NULL, clk_fetch_parent_index() could return a positive index value. Currently, parent is checked by the callers of this function, but it would be safer to do it in this function. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2:

[RESEND PATCH v2 13/16] clk: walk the orphan clock list more simply

2015-12-28 Thread Masahiro Yamada
This loop can be much simpler. If a new parent is available for orphan clocks, __clk_init_parent(orphan) can detect it. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 21 ++--- 1 file changed, 6 insertions(

[RESEND PATCH v2 15/16] clk: simplify clk_fetch_parent_index() function

2015-12-28 Thread Masahiro Yamada
The clk_core_get_parent_by_index can be used as a helper function to simplify the implementation of clk_fetch_parent_index(). Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 18 ++ 1 file changed, 2 insertions(

[RESEND PATCH v2 10/16] clk: move checking .git_parent to __clk_core_init()

2015-12-28 Thread Masahiro Yamada
The .git_parent is mandatory for multi-parent clocks. Move the check to __clk_core_init(), like other callback checkings. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 12 +--- 1 file changed, 5 insertions(+), 7 del

[RESEND PATCH v2 08/16] clk: drop the initial core->parents look-ups from __clk_core_init()

2015-12-28 Thread Masahiro Yamada
The core->parents is a cache to save expensive clock parent look-ups. It will be filled as needed later. We do not have to do it here. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- Changes in v2: None drivers/clk/clk.c | 11 --- 1 file changed, 11

[PATCH] clk: uniphier: add clock drivers for UniPhier SoCs

2015-12-02 Thread Masahiro Yamada
each SoC. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- MAINTAINERS | 1 + drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/uniphier/Kconfig | 35 ++ drive

[PATCH v3] clk: let of_clk_get_parent_name() fail for invalid clock-indices

2015-12-02 Thread Masahiro Yamada
lt; 1>; }; Currently, of_clk_get_parent_name(consumer_np, 0) returns "clka" (and of_clk_get_parent_name(consumer_np, 1) also returns "clka", this is correct). Because the "clock-indices" in the clock parent does not contain <0>, of_clk_get_parent_name(co

Re: [PATCH v2] clk: let of_clk_get_parent_name() fail for invalid clock-indices

2015-11-30 Thread Masahiro Yamada
Hi Stephen, 2015-12-01 9:58 GMT+09:00 Stephen Boyd <sb...@codeaurora.org>: > On 11/30, Masahiro Yamada wrote: >> Currently, of_clk_get_parent_name() returns a wrong parent clock name >> when "clock-indices" property exists and the target index is not >> found

Re: [PATCH 3/3] clk: split of_clk_get_parent_name() into two functions

2015-11-30 Thread Masahiro Yamada
2015-12-01 9:49 GMT+09:00 Stephen Boyd <sb...@codeaurora.org>: > On 11/24, Masahiro Yamada wrote: >> Hi Stephen, >> >> >> 2015-11-22 14:44 GMT+09:00 Masahiro Yamada <yamada.masah...@socionext.com>: >> > Hi Stephen, >> > >> >

Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices

2015-11-30 Thread Masahiro Yamada
*/ > if (!vp) > return NULL; > > I guess I prefer the latter approach here. > No. Neither of your two suggestions works because they are false positive. With your way, if "clock-indices" does not exist, of_clk_get_parent_name() would return NULL; in this cas

[PATCH v2] clk: let of_clk_get_parent_name() fail for invalid clock-indices

2015-11-30 Thread Masahiro Yamada
lt; 1>; }; Currently, of_clk_get_parent_name(consumer_np, 0) returns "clka" (and of_clk_get_parent_name(consumer_np, 1) also returns "clka", this is correct). Because the "clock-indices" in the clock parent does not contain <0>, of_clk_get_parent_name(co

[PATCH 16/16] clk: slightly optimize clk_core_set_parent()

2015-11-29 Thread Masahiro Yamada
If clk_fetch_parent_index() fails, p_rate is unused. Move the assignment after the error checking. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/clk.c b/drivers/clk

[PATCH 08/16] clk: drop the initial core->parents look-ups from __clk_core_init()

2015-11-29 Thread Masahiro Yamada
The core->parents is a cache to save expensive clock parent look-ups. It will be filled as needed later. We do not have to do it here. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk.c | 11 --- 1 file changed, 11 deletions(-) diff --git

[PATCH 09/16] clk: replace pr_warn() with pr_err() for fatal cases

2015-11-29 Thread Masahiro Yamada
These three cases let clk_register() fail. They should be considered as error messages. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk

[PATCH 02/16] clk: change the argument of __clk_init() into pointer to clk_core

2015-11-29 Thread Masahiro Yamada
The argument clk_user is used only for the clk_user->core. The rest of this function only takes care of clk_core. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/dr

[PATCH 10/16] clk: move checking .git_parent to __clk_core_init()

2015-11-29 Thread Masahiro Yamada
The .git_parent is mandatory for multi-parent clocks. Move the check to __clk_core_init(), like other callback checkings. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff

[PATCH 03/16] clk: rename __clk_init() into __clk_core_init()

2015-11-29 Thread Masahiro Yamada
Now this function takes clk_core as its argument. __clk_core_init() would be more suitable for the name of this function. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drive

[PATCH 11/16] clk: simplify __clk_init_parent()

2015-11-29 Thread Masahiro Yamada
get_parent() is missing. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk.c | 38 -- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c index 486f6d4..ef6fedb 100644 --- a/d

[PATCH 06/16] clk: move core->parents allocation to clk_register()

2015-11-29 Thread Masahiro Yamada
>num_parents. We want it even if core->num_parents == 1 because clk_fetch_parent_index() might be called against the clk_core with a single parent. If core->num_parents == 0, core->parents is set to ZERO_SIZE_PTR. It is harmless because no access happens to core->parents in such a cas

Re: [PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices

2015-11-21 Thread Masahiro Yamada
Hi Stephen, 2015-11-21 2:45 GMT+09:00 Stephen Boyd <sb...@codeaurora.org>: > On 11/20, Masahiro Yamada wrote: >> Currently, of_clk_get_parent_name() returns a wrong parent clock name >> when "clock-indices" property exists and the given index is not found >>

Re: [PATCH 3/3] clk: split of_clk_get_parent_name() into two functions

2015-11-21 Thread Masahiro Yamada
Hi Stephen, 2015-11-21 9:37 GMT+09:00 Stephen Boyd <sb...@codeaurora.org>: > On 11/20, Masahiro Yamada wrote: >> Currently, there is no function to get the clock name of the given >> node. Create a new helper function, of_clk_get_name(). This is >> useful to get

[PATCH] clk: use IS_ERR_OR_NULL(hw) instead of !hw || IS_ERR(hw)

2015-11-19 Thread Masahiro Yamada
This minor refactoring does not change the function behavior. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.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 f13c3f4..764aca2

[PATCH 3/3] clk: split of_clk_get_parent_name() into two functions

2015-11-19 Thread Masahiro Yamada
ame(): get the name of the parent clock Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- I want to use of_clk_get_name() for my clk drivers for my SoCs, which I will submit later. I found this helper function is useful. drivers/clk/clk.c

[PATCH 2/3] clk: let of_clk_get_parent_name() fail for invalid clock-indices

2015-11-19 Thread Masahiro Yamada
uot;myclocktype"; #clock-cells = <1>; clock-indices = <1>, <3>; clock-output-names = "clka", "clkb"; }; Currently, of_clk_get_parent_name(np, 0) returns "clka", but should return NULL because "clock-ind

[PATCH 1/3] clk: remove redundant negative index check in of_clk_get_parent_name()

2015-11-19 Thread Masahiro Yamada
This if-block can be dropped because the of_parse_phandle_with_args() in the following line returns -EINVAL for negative index. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/clk/clk.c b/d

How to implement common clk in multi function controller?

2015-11-10 Thread Masahiro Yamada
so I am wondering if it could be supported in common parts. Or, any other good solution exists? -- Best Regards Masahiro Yamada -- To unsubscribe from this list: send the line "unsubscribe linux-clk" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

[PATCH] clk: fix codying style of if ... else blocks

2015-11-05 Thread Masahiro Yamada
This code is unreadable due to the blank line between if and else blocks. Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com> --- drivers/clk/clk-mux.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 7

Re: ML for reset controller sub-system?

2015-11-02 Thread Masahiro Yamada
Hi Philipp, 2015-11-02 22:24 GMT+09:00 Philipp Zabel <p.za...@pengutronix.de>: > Hi Masahiro, > > Am Montag, den 02.11.2015, 22:05 +0900 schrieb Masahiro Yamada: >> Hi Philipp, >> >> >> I searched for the reset controller entry in MAINTAINERS. &