* [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases @ 2013-03-13 13:58 Heiko Stübner 2013-03-13 13:59 ` [PATCH v2 1/4] clk: samsung: register clk_div_tables for divider clocks Heiko Stübner ` (4 more replies) 0 siblings, 5 replies; 8+ messages in thread From: Heiko Stübner @ 2013-03-13 13:58 UTC (permalink / raw) To: Kukjin Kim Cc: mturquette, linux-arm-kernel, linux-samsung-soc, Thomas Abraham, Sylwester Nawrocki, t.figa Second version of the fixes to address comments gathered from the first version, like not entering the dt code on non-dt platforms even if dt-support is present in the kernel. Patch 1 and 3 got "Reviewed-by" tags but I only included the one for patch 1, because patch 3 changed due to the changes in patch 2. Heiko Stuebner (4): clk: samsung: register clk_div_tables for divider clocks clk: samsung: fix pm init on non-dt platforms clk: samsung: always allocate the clk_table clk: samsung: add infrastructure to add separate aliases drivers/clk/samsung/clk.c | 72 +++++++++++++++++++++++++++++++++++--------- drivers/clk/samsung/clk.h | 34 ++++++++++++++++++-- 2 files changed, 87 insertions(+), 19 deletions(-) -- 1.7.2.3 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/4] clk: samsung: register clk_div_tables for divider clocks 2013-03-13 13:58 [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Heiko Stübner @ 2013-03-13 13:59 ` Heiko Stübner 2013-03-13 13:59 ` [PATCH v2 2/4] clk: samsung: fix pm init on non-dt platforms Heiko Stübner ` (3 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Heiko Stübner @ 2013-03-13 13:59 UTC (permalink / raw) To: Kukjin Kim Cc: mturquette, linux-arm-kernel, linux-samsung-soc, Thomas Abraham, Sylwester Nawrocki, t.figa On some Samsung platforms divider clocks only use specific divider combinations like the armdiv on s3c2443 and s3c2416. For these usecases the generic divider clock already provides the option of providing a lookup table mapping register values to divider values. Therefore add a new field to samsung_div_clock and if filled with a table, use clk_register_divider_table instead of clk_register_divider to register a divider clock Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Thomas Abraham <thomas.abraham@linaro.org> --- drivers/clk/samsung/clk.c | 14 +++++++++++--- drivers/clk/samsung/clk.h | 13 +++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index 91d12f3..d36cdd5 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -183,9 +183,17 @@ void __init samsung_clk_register_div(struct samsung_div_clock *list, unsigned int idx, ret; for (idx = 0; idx < nr_clk; idx++, list++) { - clk = clk_register_divider(NULL, list->name, list->parent_name, - list->flags, reg_base + list->offset, list->shift, - list->width, list->div_flags, &lock); + if (list->table) + clk = clk_register_divider_table(NULL, list->name, + list->parent_name, list->flags, + reg_base + list->offset, list->shift, + list->width, list->div_flags, + list->table, &lock); + else + clk = clk_register_divider(NULL, list->name, + list->parent_name, list->flags, + reg_base + list->offset, list->shift, + list->width, list->div_flags, &lock); if (IS_ERR(clk)) { pr_err("%s: failed to register clock %s\n", __func__, list->name); diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index 961192f..26a752b 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -150,9 +150,10 @@ struct samsung_div_clock { u8 width; u8 div_flags; const char *alias; + struct clk_div_table *table; }; -#define __DIV(_id, dname, cname, pname, o, s, w, f, df, a) \ +#define __DIV(_id, dname, cname, pname, o, s, w, f, df, a, t) \ { \ .id = _id, \ .dev_name = dname, \ @@ -164,16 +165,20 @@ struct samsung_div_clock { .width = w, \ .div_flags = df, \ .alias = a, \ + .table = t, \ } #define DIV(_id, cname, pname, o, s, w) \ - __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, NULL) + __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, NULL, NULL) #define DIV_A(_id, cname, pname, o, s, w, a) \ - __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, a) + __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, a, NULL) #define DIV_F(_id, cname, pname, o, s, w, f, df) \ - __DIV(_id, NULL, cname, pname, o, s, w, f, df, NULL) + __DIV(_id, NULL, cname, pname, o, s, w, f, df, NULL, NULL) + +#define DIV_T(_id, cname, pname, o, s, w, t) \ + __DIV(_id, NULL, cname, pname, o, s, w, 0, 0, NULL, t) /** * struct samsung_gate_clock: information about gate clock -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/4] clk: samsung: fix pm init on non-dt platforms 2013-03-13 13:58 [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Heiko Stübner 2013-03-13 13:59 ` [PATCH v2 1/4] clk: samsung: register clk_div_tables for divider clocks Heiko Stübner @ 2013-03-13 13:59 ` Heiko Stübner 2013-03-13 14:00 ` [PATCH v2 3/4] clk: samsung: always allocate the clk_table Heiko Stübner ` (2 subsequent siblings) 4 siblings, 0 replies; 8+ messages in thread From: Heiko Stübner @ 2013-03-13 13:59 UTC (permalink / raw) To: Kukjin Kim Cc: mturquette, linux-arm-kernel, linux-samsung-soc, Thomas Abraham, Sylwester Nawrocki, t.figa The clock_init function checked for a dt node, returning immediately for non-dt machines. This let to the suspend init never being reached on those non-DT machines. So fix this by moving the pm init code above the check. Signed-off-by: Heiko Stueber <heiko@sntech.de> --- changes since v1: instead of removing the np check, move the pm init above it, as suggested by Thomas Abraham. When removing the np check the dt code is wrongly entered on non-dt machines if dt support is enabled in the kernel drivers/clk/samsung/clk.c | 25 +++++++++++++------------ 1 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index d36cdd5..ca04b9e 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -57,18 +57,6 @@ void __init samsung_clk_init(struct device_node *np, void __iomem *base, unsigned long nr_rdump) { reg_base = base; - if (!np) - return; - -#ifdef CONFIG_OF - clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL); - if (!clk_table) - panic("could not allocate clock lookup table\n"); - - clk_data.clks = clk_table; - clk_data.clk_num = nr_clks; - of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); -#endif #ifdef CONFIG_PM_SLEEP if (rdump && nr_rdump) { @@ -87,6 +75,19 @@ void __init samsung_clk_init(struct device_node *np, void __iomem *base, register_syscore_ops(&samsung_clk_syscore_ops); } #endif + + if (!np) + return; + +#ifdef CONFIG_OF + clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL); + if (!clk_table) + panic("could not allocate clock lookup table\n"); + + clk_data.clks = clk_table; + clk_data.clk_num = nr_clks; + of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); +#endif } /* add a clock instance to the clock lookup table used for dt based lookup */ -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/4] clk: samsung: always allocate the clk_table 2013-03-13 13:58 [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Heiko Stübner 2013-03-13 13:59 ` [PATCH v2 1/4] clk: samsung: register clk_div_tables for divider clocks Heiko Stübner 2013-03-13 13:59 ` [PATCH v2 2/4] clk: samsung: fix pm init on non-dt platforms Heiko Stübner @ 2013-03-13 14:00 ` Heiko Stübner 2013-03-13 14:00 ` [PATCH 4/4] clk: samsung: add infrastructure to add separate aliases Heiko Stübner 2013-03-25 9:26 ` [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Kukjin Kim 4 siblings, 0 replies; 8+ messages in thread From: Heiko Stübner @ 2013-03-13 14:00 UTC (permalink / raw) To: Kukjin Kim Cc: mturquette, linux-arm-kernel, linux-samsung-soc, Thomas Abraham, Sylwester Nawrocki, t.figa This is needed to allow looking up previous created clocks when adding separate aliases to them. Signed-off-by: Heiko Stuebner <heiko@sntech.de> --- changes since v1: adapt to the changes in patch 2/4 drivers/clk/samsung/clk.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index ca04b9e..1ed5716 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -76,14 +76,14 @@ void __init samsung_clk_init(struct device_node *np, void __iomem *base, } #endif - if (!np) - return; - -#ifdef CONFIG_OF clk_table = kzalloc(sizeof(struct clk *) * nr_clks, GFP_KERNEL); if (!clk_table) panic("could not allocate clock lookup table\n"); + if (!np) + return; + +#ifdef CONFIG_OF clk_data.clks = clk_table; clk_data.clk_num = nr_clks; of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] clk: samsung: add infrastructure to add separate aliases 2013-03-13 13:58 [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Heiko Stübner ` (2 preceding siblings ...) 2013-03-13 14:00 ` [PATCH v2 3/4] clk: samsung: always allocate the clk_table Heiko Stübner @ 2013-03-13 14:00 ` Heiko Stübner 2013-03-25 9:26 ` [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Kukjin Kim 4 siblings, 0 replies; 8+ messages in thread From: Heiko Stübner @ 2013-03-13 14:00 UTC (permalink / raw) To: Kukjin Kim Cc: mturquette, linux-arm-kernel, linux-samsung-soc, Thomas Abraham, Sylwester Nawrocki, t.figa The current code adds aliases, if necessary, directly when adding the clock, limiting the number of possible aliases to one. Some platforms need more than one alias, like the hsmmc pclocks on s3c2416 which need a "hsmmc" and "mmc_busclk.0" alias for the s3c-sdhci driver. Therefore add the possibility to separately add clock aliases for previously created clocks. Signed-off-by: Heiko Stuebner <heiko@sntech.de> --- drivers/clk/samsung/clk.c | 33 +++++++++++++++++++++++++++++++++ drivers/clk/samsung/clk.h | 21 +++++++++++++++++++++ 2 files changed, 54 insertions(+), 0 deletions(-) diff --git a/drivers/clk/samsung/clk.c b/drivers/clk/samsung/clk.c index 1ed5716..82f27f6 100644 --- a/drivers/clk/samsung/clk.c +++ b/drivers/clk/samsung/clk.c @@ -97,6 +97,39 @@ void samsung_clk_add_lookup(struct clk *clk, unsigned int id) clk_table[id] = clk; } +/* register a list of aliases */ +void __init samsung_clk_register_alias(struct samsung_clock_alias *list, + unsigned int nr_clk) +{ + struct clk *clk; + unsigned int idx, ret; + + if (!clk_table) { + pr_err("%s: clock table missing\n", __func__); + return; + } + + for (idx = 0; idx < nr_clk; idx++, list++) { + if (!list->id) { + pr_err("%s: clock id missing for index %d\n", __func__, + idx); + continue; + } + + clk = clk_table[list->id]; + if (!clk) { + pr_err("%s: failed to find clock %d\n", __func__, + list->id); + continue; + } + + ret = clk_register_clkdev(clk, list->alias, list->dev_name); + if (ret) + pr_err("%s: failed to register lookup %s\n", + __func__, list->alias); + } +} + /* register a list of fixed clocks */ void __init samsung_clk_register_fixed_rate( struct samsung_fixed_rate_clock *list, unsigned int nr_clk) diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h index 26a752b..6bacd6f 100644 --- a/drivers/clk/samsung/clk.h +++ b/drivers/clk/samsung/clk.h @@ -23,6 +23,25 @@ #include <mach/map.h> /** + * struct samsung_clock_alias: information about mux clock + * @id: platform specific id of the clock. + * @dev_name: name of the device to which this clock belongs. + * @alias: optional clock alias name to be assigned to this clock. + */ +struct samsung_clock_alias { + unsigned int id; + const char *dev_name; + const char *alias; +}; + +#define ALIAS(_id, dname, a) \ + { \ + .id = _id, \ + .dev_name = dname, \ + .alias = a, \ + } + +/** * struct samsung_fixed_rate_clock: information about fixed-rate clock * @id: platform specific id of the clock. * @name: name of this fixed-rate clock. @@ -251,6 +270,8 @@ extern void __init samsung_clk_of_register_fixed_ext( extern void samsung_clk_add_lookup(struct clk *clk, unsigned int id); +extern void samsung_clk_register_alias(struct samsung_clock_alias *list, + unsigned int nr_clk); extern void __init samsung_clk_register_fixed_rate( struct samsung_fixed_rate_clock *clk_list, unsigned int nr_clk); extern void __init samsung_clk_register_fixed_factor( -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases 2013-03-13 13:58 [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Heiko Stübner ` (3 preceding siblings ...) 2013-03-13 14:00 ` [PATCH 4/4] clk: samsung: add infrastructure to add separate aliases Heiko Stübner @ 2013-03-25 9:26 ` Kukjin Kim 2013-03-27 0:59 ` Mike Turquette 4 siblings, 1 reply; 8+ messages in thread From: Kukjin Kim @ 2013-03-25 9:26 UTC (permalink / raw) To: 'Heiko Stübner' Cc: mturquette, linux-arm-kernel, linux-samsung-soc, 'Thomas Abraham', 'Sylwester Nawrocki', t.figa Heiko Stübner wrote: > > Second version of the fixes to address comments gathered from the first > version, like not entering the dt code on non-dt platforms even if > dt-support is present in the kernel. > > Patch 1 and 3 got "Reviewed-by" tags but I only included the one for > patch 1, because patch 3 changed due to the changes in patch 2. > > Heiko Stuebner (4): > clk: samsung: register clk_div_tables for divider clocks > clk: samsung: fix pm init on non-dt platforms > clk: samsung: always allocate the clk_table > clk: samsung: add infrastructure to add separate aliases > > drivers/clk/samsung/clk.c | 72 +++++++++++++++++++++++++++++++++++------ > --- > drivers/clk/samsung/clk.h | 34 ++++++++++++++++++-- > 2 files changed, 87 insertions(+), 19 deletions(-) > > -- > 1.7.2.3 Looks good to me and applied into samsung tree based on samsung common clock by Thomas P Abraham for testing. But would be helpful to me if I could get Mike's ack on this series. Thanks. - Kukjin ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: RE: [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases 2013-03-25 9:26 ` [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Kukjin Kim @ 2013-03-27 0:59 ` Mike Turquette 2013-04-04 4:06 ` Kukjin Kim 0 siblings, 1 reply; 8+ messages in thread From: Mike Turquette @ 2013-03-27 0:59 UTC (permalink / raw) To: Kukjin Kim, 'Heiko Stübner' Cc: linux-arm-kernel, linux-samsung-soc, 'Thomas Abraham', 'Sylwester Nawrocki', t.figa Quoting Kukjin Kim (2013-03-25 02:26:34) > Heiko Stübner wrote: > > > > Second version of the fixes to address comments gathered from the first > > version, like not entering the dt code on non-dt platforms even if > > dt-support is present in the kernel. > > > > Patch 1 and 3 got "Reviewed-by" tags but I only included the one for > > patch 1, because patch 3 changed due to the changes in patch 2. > > > > Heiko Stuebner (4): > > clk: samsung: register clk_div_tables for divider clocks > > clk: samsung: fix pm init on non-dt platforms > > clk: samsung: always allocate the clk_table > > clk: samsung: add infrastructure to add separate aliases > > > > drivers/clk/samsung/clk.c | 72 +++++++++++++++++++++++++++++++++++------ > > --- > > drivers/clk/samsung/clk.h | 34 ++++++++++++++++++-- > > 2 files changed, 87 insertions(+), 19 deletions(-) > > > > -- > > 1.7.2.3 > > Looks good to me and applied into samsung tree based on samsung common clock by Thomas P Abraham for testing. > > But would be helpful to me if I could get Mike's ack on this series. > Acked-by: Mike Turquette <mturquette@linaro.org> > Thanks. > > - Kukjin ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: RE: [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases 2013-03-27 0:59 ` Mike Turquette @ 2013-04-04 4:06 ` Kukjin Kim 0 siblings, 0 replies; 8+ messages in thread From: Kukjin Kim @ 2013-04-04 4:06 UTC (permalink / raw) To: 'Mike Turquette', 'Heiko Stübner' Cc: linux-arm-kernel, linux-samsung-soc, 'Thomas Abraham', 'Sylwester Nawrocki', t.figa Mike Turquette wrote: > > Quoting Kukjin Kim (2013-03-25 02:26:34) > > Heiko Stübner wrote: > > > > > > Second version of the fixes to address comments gathered from the > first > > > version, like not entering the dt code on non-dt platforms even if > > > dt-support is present in the kernel. > > > > > > Patch 1 and 3 got "Reviewed-by" tags but I only included the one for > > > patch 1, because patch 3 changed due to the changes in patch 2. > > > > > > Heiko Stuebner (4): > > > clk: samsung: register clk_div_tables for divider clocks > > > clk: samsung: fix pm init on non-dt platforms > > > clk: samsung: always allocate the clk_table > > > clk: samsung: add infrastructure to add separate aliases > > > > > > drivers/clk/samsung/clk.c | 72 +++++++++++++++++++++++++++++++++++-- > ---- > > > --- > > > drivers/clk/samsung/clk.h | 34 ++++++++++++++++++-- > > > 2 files changed, 87 insertions(+), 19 deletions(-) > > > > > > -- > > > 1.7.2.3 > > > > Looks good to me and applied into samsung tree based on samsung common > clock by Thomas P Abraham for testing. > > > > But would be helpful to me if I could get Mike's ack on this series. > > > > Acked-by: Mike Turquette <mturquette@linaro.org> > Applied, thanks. - Kukjin ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-04-04 4:06 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2013-03-13 13:58 [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Heiko Stübner 2013-03-13 13:59 ` [PATCH v2 1/4] clk: samsung: register clk_div_tables for divider clocks Heiko Stübner 2013-03-13 13:59 ` [PATCH v2 2/4] clk: samsung: fix pm init on non-dt platforms Heiko Stübner 2013-03-13 14:00 ` [PATCH v2 3/4] clk: samsung: always allocate the clk_table Heiko Stübner 2013-03-13 14:00 ` [PATCH 4/4] clk: samsung: add infrastructure to add separate aliases Heiko Stübner 2013-03-25 9:26 ` [PATCH v2 0/4] clk: samsung: pm fixes and multiple aliases Kukjin Kim 2013-03-27 0:59 ` Mike Turquette 2013-04-04 4:06 ` Kukjin Kim
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).