Convert some basic type clks to new parent way
Subsystems (4)
Stephen Boyd
maintainercover Convert some basic type clks to new parent way
This series converts most of the basic clk types to support the new way of specifying parents. There's still the composite and fixed-factor types to convert. Sending now because I'm internally debating having the big multiplexer function take only arguments that would correspond to the parent_data structure instead of passing down the three different ways of specifying parents.
Stephen Boyd (12):
clk: gpio: Use DT way of specifying parents
clk: fixed-rate: Convert to clk_hw based APIs
clk: fixed-rate: Remove clk_register_fixed_rate_with_accuracy()
clk: fixed-rate: Move to_clk_fixed_rate() to C file
clk: fixed-rate: Document accuracy member
clk: fixed-rate: Add support for specifying parents via DT/pointers
clk: fixed-rate: Add clk flags for parent accuracy
clk: fixed-rate: Document that accuracy isn't a rate
clk: asm9260: Use parent accuracy in fixed rate clk
clk: mux: Add support for specifying parents via DT/pointers
clk: gate: Add support for specifying parents via DT/pointers
clk: divider: Add support for specifying parents via DT/pointers
drivers/clk/clk-asm9260.c | 8 +- drivers/clk/clk-divider.c | 84 +---- drivers/clk/clk-fixed-rate.c | 113 +++--- drivers/clk/clk-gate.c | 35 +- drivers/clk/clk-gpio.c | 171 +++------ drivers/clk/clk-mux.c | 58 +-- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 4 +- drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.c | 4 +- include/linux/clk-provider.h | 416 +++++++++++++++++---- 9 files changed, 490 insertions(+), 403 deletions(-)
base-commit: 5f9e832c137075045d15cd6899ab0505cfb2ca4b
Signature · 1 line
Sent by a computer through tubes
Stephen Boyd
maintainerPATCH 1/12 clk: gpio: Use DT way of specifying parents
Nobody has used the gpio clk registration functions nor the gpio clk_ops exposed by the basic gpio clk type. Let's remove all those APIs and move the gpio clk support into the C file. Since nothing is using the exported APIs, simplify the driver to be a platform driver that uses clk_parent_data to pick 0th or 1st cell of the node's clocks property.
--- drivers/clk/clk-gpio.c | 171 ++++++++++++----------------------- include/linux/clk-provider.h | 38 -------- 2 files changed, 58 insertions(+), 151 deletions(-)
drivers/clk/clk-gpio.c +58 -113
@@ -28,6 +28,26 @@* parent - fixed parent. No clk_set_parent support */ +/** +* struct clk_gpio - gpio gated clock +* +* @hw: handle between common and hardware-specific interfaces +* @gpiod: gpio descriptor +* +* Clock with a gpio control for enabling and disabling the parent clock +* or switching between two parents by asserting or deasserting the gpio. +* +* Implements .enable, .disable and .is_enabled or +* .get_parent, .set_parent and .determine_rate depending on which clk_ops +* is used. +*/ +struct clk_gpio { +struct clk_hw hw; +struct gpio_desc *gpiod; +}; + +#define to_clk_gpio (_hw) container_of(_hw, struct clk_gpio, hw) +static int clk_gpio_gate_enable (struct clk_hw *hw) {struct clk_gpio *clk =to_clk_gpio (hw);
@@ -51,12 +71,11 @@ static int clk_gpio_gate_is_enabled(struct clk_hw *hw)return gpiod_get_value (clk->gpiod); } -const struct clk_ops clk_gpio_gate_ops = { +static const struct clk_ops clk_gpio_gate_ops = { .enable = clk_gpio_gate_enable, .disable = clk_gpio_gate_disable, .is_enabled = clk_gpio_gate_is_enabled, }; -EXPORT_SYMBOL_GPL (clk_gpio_gate_ops);static int clk_sleeping_gpio_gate_prepare (struct clk_hw *hw) {
@@ -111,67 +130,48 @@ static int clk_gpio_mux_set_parent(struct clk_hw *hw, u8 index)return 0 ; } -const struct clk_ops clk_gpio_mux_ops = { +static const struct clk_ops clk_gpio_mux_ops = { .get_parent = clk_gpio_mux_get_parent, .set_parent = clk_gpio_mux_set_parent, .determine_rate = __clk_mux_determine_rate, }; -EXPORT_SYMBOL_GPL (clk_gpio_mux_ops); -static struct clk_hw *clk_register_gpio (struct device *dev,const char *name, -const char *const *parent_names,u8 num_parents,struct gpio_desc *gpiod, -unsigned long flags,const struct clk_ops *clk_gpio_ops) +static struct clk_hw *clk_register_gpio (struct device *dev,u8 num_parents, +struct gpio_desc *gpiod, +const struct clk_ops *clk_gpio_ops) {struct clk_gpio *clk_gpio;struct clk_hw *hw;struct clk_init_data init = {};int err; +const struct clk_parent_data gpio_parent_data[] = { + { .index =0 }, + { .index =1 }, + }; -if (dev) - clk_gpio =devm_kzalloc (dev,sizeof (*clk_gpio),GFP_KERNEL ); -else - clk_gpio =kzalloc (sizeof (*clk_gpio),GFP_KERNEL ); - + clk_gpio =devm_kzalloc (dev,sizeof (*clk_gpio),GFP_KERNEL );if (!clk_gpio)return ERR_PTR (-ENOMEM ); - init.name = name; + init.name = dev->of_node->name; init.ops = clk_gpio_ops; - init.flags = flags; - init.parent_names = parent_names; + init.parent_data = gpio_parent_data; init.num_parents = num_parents; clk_gpio->gpiod = gpiod; clk_gpio->hw.init = &init; hw = &clk_gpio->hw; -if (dev) - err =devm_clk_hw_register (dev, hw); -else - err =clk_hw_register (NULL , hw); - -if (!err) -return hw; - -if (!dev) { -kfree (clk_gpio); - } + err =devm_clk_hw_register (dev, hw); +if (err) +return ERR_PTR (err); -return ERR_PTR (err); +return hw; } -/** -* clk_hw_register_gpio_gate - register a gpio clock gate with the clock -* framework -* @dev: device that is registering this clock -* @name: name of this clock -* @parent_name: name of this clock's parent -* @gpiod: gpio descriptor to gate this clock -* @flags: clock flags -*/ -struct clk_hw *clk_hw_register_gpio_gate (struct device *dev,const char *name, -const char *parent_name,struct gpio_desc *gpiod, -unsigned long flags) +static struct clk_hw *clk_hw_register_gpio_gate (struct device *dev, +int num_parents, +struct gpio_desc *gpiod) {const struct clk_ops *ops;
@@ -180,88 +180,36 @@ struct clk_hw *clk_hw_register_gpio_gate(struct device *dev, const char *name,else ops = &clk_gpio_gate_ops; -return clk_register_gpio (dev, name, - (parent_name ? &parent_name :NULL ), - (parent_name ?1 :0 ), gpiod, flags, ops); +return clk_register_gpio (dev, num_parents, gpiod, ops); } -EXPORT_SYMBOL_GPL (clk_hw_register_gpio_gate); -struct clk *clk_register_gpio_gate (struct device *dev,const char *name, -const char *parent_name,struct gpio_desc *gpiod, -unsigned long flags) +static struct clk_hw *clk_hw_register_gpio_mux (struct device *dev, +struct gpio_desc *gpiod) { -struct clk_hw *hw; - - hw =clk_hw_register_gpio_gate (dev, name, parent_name, gpiod, flags); -if (IS_ERR (hw)) -return ERR_CAST (hw); -return hw->clk; +return clk_register_gpio (dev,2 , gpiod, &clk_gpio_mux_ops); } -EXPORT_SYMBOL_GPL (clk_register_gpio_gate); - -/** -* clk_hw_register_gpio_mux - register a gpio clock mux with the clock framework -* @dev: device that is registering this clock -* @name: name of this clock -* @parent_names: names of this clock's parents -* @num_parents: number of parents listed in @parent_names -* @gpiod: gpio descriptor to gate this clock -* @flags: clock flags -*/ -struct clk_hw *clk_hw_register_gpio_mux (struct device *dev,const char *name, -const char *const *parent_names,u8 num_parents,struct gpio_desc *gpiod, -unsigned long flags) -{ -if (num_parents !=2 ) { -pr_err ("mux-clock %s must have 2 parents\n" , name); -return ERR_PTR (-EINVAL ); - } - -return clk_register_gpio (dev, name, parent_names, num_parents, - gpiod, flags, &clk_gpio_mux_ops); -} -EXPORT_SYMBOL_GPL (clk_hw_register_gpio_mux); - -struct clk *clk_register_gpio_mux (struct device *dev,const char *name, -const char *const *parent_names,u8 num_parents,struct gpio_desc *gpiod, -unsigned long flags) -{ -struct clk_hw *hw; - - hw =clk_hw_register_gpio_mux (dev, name, parent_names, num_parents, - gpiod, flags); -if (IS_ERR (hw)) -return ERR_CAST (hw); -return hw->clk; -} -EXPORT_SYMBOL_GPL (clk_register_gpio_mux);static int gpio_clk_driver_probe (struct platform_device *pdev) { -struct device_node *node = pdev->dev.of_node; -const char **parent_names, *gpio_name; +struct device *dev = &pdev->dev; +struct device_node *node = dev->of_node; +const char *gpio_name;unsigned int num_parents;struct gpio_desc *gpiod; -struct clk *clk; +struct clk_hw *hw;bool is_mux;int ret; + is_mux =of_device_is_compatible (node,"gpio-mux-clock" ); + num_parents =of_clk_get_parent_count (node); -if (num_parents) { - parent_names =devm_kcalloc (&pdev->dev, num_parents, -sizeof (char *),GFP_KERNEL ); -if (!parent_names) -return -ENOMEM ; - -of_clk_parent_fill (node, parent_names, num_parents); - }else { - parent_names =NULL ; +if (is_mux && num_parents !=2 ) { +dev_err (dev,"mux-clock must have 2 parents\n" ); +return -EINVAL ; } - is_mux =of_device_is_compatible (node,"gpio-mux-clock" ); - gpio_name = is_mux ?"select" :"enable" ; - gpiod =devm_gpiod_get (&pdev->dev, gpio_name,GPIOD_OUT_LOW ); + gpiod =devm_gpiod_get (dev, gpio_name,GPIOD_OUT_LOW );if (IS_ERR (gpiod)) { ret =PTR_ERR (gpiod);if (ret == -EPROBE_DEFER )
@@ -275,16 +223,13 @@ static int gpio_clk_driver_probe(struct platform_device *pdev) }if (is_mux) - clk =clk_register_gpio_mux (&pdev->dev, node->name, - parent_names, num_parents, gpiod,0 ); + hw =clk_hw_register_gpio_mux (dev, gpiod);else - clk =clk_register_gpio_gate (&pdev->dev, node->name, - parent_names ? parent_names[0 ] :NULL , gpiod, -0 ); -if (IS_ERR (clk)) -return PTR_ERR (clk); + hw =clk_hw_register_gpio_gate (dev, num_parents, gpiod); +if (IS_ERR (hw)) +return PTR_ERR (hw); -return of_clk_add_provider (node, of_clk_src_simple_get, clk); +return devm_of_clk_add_hw_provider (dev, of_clk_hw_simple_get, hw); }static const struct of_device_id gpio_clk_match_table[] = {
include/linux/clk-provider.h +0 -38
@@ -751,44 +751,6 @@ struct clk_hw *clk_hw_register_composite(struct device *dev, const char *name, unsigned long flags);void clk_hw_unregister_composite (struct clk_hw *hw); -/** -* struct clk_gpio - gpio gated clock -* -* @hw: handle between common and hardware-specific interfaces -* @gpiod: gpio descriptor -* -* Clock with a gpio control for enabling and disabling the parent clock -* or switching between two parents by asserting or deasserting the gpio. -* -* Implements .enable, .disable and .is_enabled or -* .get_parent, .set_parent and .determine_rate depending on which clk_ops -* is used. -*/ -struct clk_gpio { -struct clk_hw hw; -struct gpio_desc *gpiod; -}; - -#define to_clk_gpio (_hw) container_of(_hw, struct clk_gpio, hw) - -extern const struct clk_ops clk_gpio_gate_ops; -struct clk *clk_register_gpio_gate (struct device *dev,const char *name, -const char *parent_name,struct gpio_desc *gpiod, -unsigned long flags); -struct clk_hw *clk_hw_register_gpio_gate (struct device *dev,const char *name, -const char *parent_name,struct gpio_desc *gpiod, -unsigned long flags); -void clk_hw_unregister_gpio_gate (struct clk_hw *hw); - -extern const struct clk_ops clk_gpio_mux_ops; -struct clk *clk_register_gpio_mux (struct device *dev,const char *name, -const char *const *parent_names,u8 num_parents,struct gpio_desc *gpiod, -unsigned long flags); -struct clk_hw *clk_hw_register_gpio_mux (struct device *dev,const char *name, -const char *const *parent_names,u8 num_parents,struct gpio_desc *gpiod, -unsigned long flags); -void clk_hw_unregister_gpio_mux (struct clk_hw *hw); -struct clk *clk_register (struct device *dev,struct clk_hw *hw);struct clk *devm_clk_register (struct device *dev,struct clk_hw *hw);
base-commit: 5f9e832c137075045d15cd6899ab0505cfb2ca4b
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 01/12] clk: gpio: Use DT way of specifying parents
Quoting Stephen Boyd (2019-08-30 08:09:12)
Quoted 6 lines
Nobody has used the gpio clk registration functions nor the gpio
clk_opsexposed by the basic gpio clk type. Let's remove all those APIs and move the gpio clk support into the C file. Since nothing is using the exported APIs, simplify the driver to be a platform driver that usesclk_parent_datato pick 0th or 1st cell of the node's clocks property.
Quoted 8 lines
Cc Simon Horman <[email protected]>Cc Magnus Damm <[email protected]>Cc Geert Uytterhoeven <[email protected]>Cc Enric Balletbo i Serra <[email protected]>Cc Tony Lindgren <[email protected]>Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 2/12 clk: fixed-rate: Convert to clk_hw based APIs
In reply to Stephen BoydThis code still uses struct clk to register clks from the probe path. Migrate this to the clk_hw based APIs to modernize the code. Also, this isn't a module and it can't be one because the driver is always builtin so drop the module table.
--- drivers/clk/clk-fixed-rate.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/clk/clk-fixed-rate.c +15 -16
@@ -155,9 +155,9 @@ void clk_hw_unregister_fixed_rate(struct clk_hw *hw)EXPORT_SYMBOL_GPL (clk_hw_unregister_fixed_rate);#ifdef CONFIG_OF -static struct clk *_of_fixed_clk_setup (struct device_node *node) +static struct clk_hw *_of_fixed_clk_setup (struct device_node *node) { -struct clk *clk; +struct clk_hw *hw;const char *clk_name = node->name;u32 rate;u32 accuracy =0 ;
@@ -170,18 +170,18 @@ static struct clk *_of_fixed_clk_setup(struct device_node *node)of_property_read_string (node,"clock-output-names" , &clk_name); - clk =clk_register_fixed_rate_with_accuracy (NULL , clk_name,NULL , + hw =clk_hw_register_fixed_rate_with_accuracy (NULL , clk_name,NULL ,0 , rate, accuracy); -if (IS_ERR (clk)) -return clk; +if (IS_ERR (hw)) +return hw; - ret =of_clk_add_provider (node, of_clk_src_simple_get, clk); + ret =of_clk_add_hw_provider (node, of_clk_hw_simple_get, hw);if (ret) { -clk_unregister (clk); +clk_hw_unregister_fixed_rate (hw);return ERR_PTR (ret); } -return clk; +return hw; }/**
@@ -195,27 +195,27 @@ CLK_OF_DECLARE(fixed_clk, "fixed-clock", of_fixed_clk_setup);static int of_fixed_clk_remove (struct platform_device *pdev) { -struct clk *clk =platform_get_drvdata (pdev); +struct clk_hw *hw =platform_get_drvdata (pdev);of_clk_del_provider (pdev->dev.of_node); -clk_unregister_fixed_rate (clk); +clk_hw_unregister_fixed_rate (hw);return 0 ; }static int of_fixed_clk_probe (struct platform_device *pdev) { -struct clk *clk; +struct clk_hw *hw;/* * This function is not executed when of_fixed_clk_setup * succeeded. */ - clk =_of_fixed_clk_setup (pdev->dev.of_node); -if (IS_ERR (clk)) -return PTR_ERR (clk); + hw =_of_fixed_clk_setup (pdev->dev.of_node); +if (IS_ERR (hw)) +return PTR_ERR (hw); -platform_set_drvdata (pdev, clk); +platform_set_drvdata (pdev, hw);return 0 ; }
@@ -224,7 +224,6 @@ static const struct of_device_id of_fixed_clk_ids[] = { { .compatible = "fixed-clock" }, { } }; -MODULE_DEVICE_TABLE (of, of_fixed_clk_ids);static struct platform_driver of_fixed_clk_driver = { .driver = {
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 02/12] clk: fixed-rate: Convert to clk_hw based APIs
Quoting Stephen Boyd (2019-08-30 08:09:13)
Quoted 8 lines
This code still uses struct clk to register clks from the probe path. Migrate this to the
clk_hwbased APIs to modernize the code. Also, this isn't a module and it can't be one because the driver is always builtin so drop the module table.Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 3/12 clk: fixed-rate: Remove clk_register_fixed_rate_with_accuracy()
In reply to Stephen BoydThere aren't any users of this API anymore. Remove it.
--- drivers/clk/clk-fixed-rate.c | 23 +++++++---------------- include/linux/clk-provider.h | 3 --- 2 files changed, 7 insertions(+), 19 deletions(-)
drivers/clk/clk-fixed-rate.c +7 -16
@@ -89,20 +89,6 @@ struct clk_hw *clk_hw_register_fixed_rate_with_accuracy(struct device *dev, }EXPORT_SYMBOL_GPL (clk_hw_register_fixed_rate_with_accuracy); -struct clk *clk_register_fixed_rate_with_accuracy (struct device *dev, -const char *name,const char *parent_name,unsigned long flags, -unsigned long fixed_rate,unsigned long fixed_accuracy) -{ -struct clk_hw *hw; - - hw =clk_hw_register_fixed_rate_with_accuracy (dev, name, parent_name, - flags, fixed_rate, fixed_accuracy); -if (IS_ERR (hw)) -return ERR_CAST (hw); -return hw->clk; -} -EXPORT_SYMBOL_GPL (clk_register_fixed_rate_with_accuracy); -/** * clk_hw_register_fixed_rate - register fixed-rate clock with the clock * framework
@@ -125,8 +111,13 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name, const char *parent_name, unsigned long flags, unsigned long fixed_rate) { - return clk_register_fixed_rate_with_accuracy(dev, name, parent_name, - flags, fixed_rate, 0); + struct clk_hw *hw; + + hw =clk_hw_register_fixed_rate_with_accuracy (dev, name, parent_name, + flags, fixed_rate,0 ); +if (IS_ERR (hw)) +return ERR_CAST (hw); +return hw->clk; }EXPORT_SYMBOL_GPL (clk_register_fixed_rate);
include/linux/clk-provider.h +0 -3
@@ -336,9 +336,6 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,struct clk_hw *clk_hw_register_fixed_rate (struct device *dev,const char *name,const char *parent_name,unsigned long flags,unsigned long fixed_rate); -struct clk *clk_register_fixed_rate_with_accuracy (struct device *dev, -const char *name,const char *parent_name,unsigned long flags, -unsigned long fixed_rate,unsigned long fixed_accuracy);void clk_unregister_fixed_rate (struct clk *clk); struct clk_hw *clk_hw_register_fixed_rate_with_accuracy(struct device *dev, const char *name, const char *parent_name, unsigned long flags,
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 03/12] clk: fixed-rate: Remove clk_register_fixed_rate_with_accuracy()
Quoting Stephen Boyd (2019-08-30 08:09:14)
Quoted 5 lines
There aren't any users of this API anymore. Remove it.
Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 4/12 clk: fixed-rate: Move to_clk_fixed_rate() to C file
In reply to Stephen BoydThe only user of this macro is the fixed rate basic type. Move it there to avoid polluting provider drivers.
--- drivers/clk/clk-fixed-rate.c | 2 ++ include/linux/clk-provider.h | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/clk/clk-fixed-rate.c +2 -0
@@ -24,6 +24,8 @@* parent - fixed parent. No clk_set_parent support */ +#define to_clk_fixed_rate (_hw) container_of(_hw, struct clk_fixed_rate, hw) +static unsigned long clk_fixed_rate_recalc_rate (struct clk_hw *hw,unsigned long parent_rate) {
include/linux/clk-provider.h +0 -2
@@ -327,8 +327,6 @@ struct clk_fixed_rate {unsigned long fixed_accuracy; }; -#define to_clk_fixed_rate (_hw) container_of(_hw, struct clk_fixed_rate, hw) -extern const struct clk_ops clk_fixed_rate_ops; struct clk *clk_register_fixed_rate(struct device *dev, const char *name, const char *parent_name, unsigned long flags,
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 04/12] clk: fixed-rate: Move to_clk_fixed_rate() to C file
Quoting Stephen Boyd (2019-08-30 08:09:15)
Quoted 6 lines
The only user of this macro is the fixed rate basic type. Move it there to avoid polluting provider drivers.
Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 5/12 clk: fixed-rate: Document accuracy member
In reply to Stephen BoydThis member isn't documented, leading to kernel-doc warnings. Document it.
--- include/linux/clk-provider.h | 1 + 1 file changed, 1 insertion(+)
include/linux/clk-provider.h +1 -0
@@ -320,6 +320,7 @@ struct clk_hw {* struct clk_fixed_rate - fixed-rate clock * @hw: handle between common and hardware-specific interfaces * @fixed_rate: constant frequency of clock +* @fixed_accuracy: constant accuracy of clock in ppb (parts per billion) */ struct clk_fixed_rate {struct clk_hw hw;
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 05/12] clk: fixed-rate: Document accuracy member
Quoting Stephen Boyd (2019-08-30 08:09:16)
Quoted 6 lines
This member isn't documented, leading to kernel-doc warnings. Document it.
Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 6/12 clk: fixed-rate: Add support for specifying parents via DT/pointers
In reply to Stephen BoydAfter commit fc0c209c147f ("clk: Allow parents to be specified without string names") we can use DT or direct clk_hw pointers to specify parents. Create a generic function that shouldn't be used very often to encode the multitude of ways of registering a fixed rate clk with different parent information. Then add a bunch of wrapper macros that only pass down what needs to be passed down to the generic function to support this with less arguments.
--- drivers/clk/clk-fixed-rate.c | 56 +++++++------------- include/linux/clk-provider.h | 100 ++++++++++++++++++++++++++++++++--- 2 files changed, 114 insertions(+), 42 deletions(-)
drivers/clk/clk-fixed-rate.c +20 -36
@@ -44,24 +44,17 @@ const struct clk_ops clk_fixed_rate_ops = { };EXPORT_SYMBOL_GPL (clk_fixed_rate_ops); -/** -* clk_hw_register_fixed_rate_with_accuracy - register fixed-rate clock with -* the clock framework -* @dev: device that is registering this clock -* @name: name of this clock -* @parent_name: name of clock's parent -* @flags: framework-specific flags -* @fixed_rate: non-adjustable clock rate -* @fixed_accuracy: non-adjustable clock rate -*/ -struct clk_hw *clk_hw_register_fixed_rate_with_accuracy (struct device *dev, -const char *name,const char *parent_name,unsigned long flags, -unsigned long fixed_rate,unsigned long fixed_accuracy) +struct clk_hw *__clk_hw_register_fixed_rate (struct device *dev, +struct device_node *np,const char *name, +const char *parent_name,const struct clk_hw *parent_hw, +const struct clk_parent_data *parent_data,unsigned long flags, +unsigned long fixed_rate,unsigned long fixed_accuracy, +unsigned long clk_fixed_flags) {struct clk_fixed_rate *fixed;struct clk_hw *hw;struct clk_init_data init; -int ret; +int ret = -EINVAL ;/* allocate fixed-rate clock */ fixed =kzalloc (sizeof (*fixed),GFP_KERNEL );
@@ -71,17 +64,26 @@ struct clk_hw *clk_hw_register_fixed_rate_with_accuracy(struct device *dev, init.name = name; init.ops = &clk_fixed_rate_ops; init.flags = flags; - init.parent_names = (parent_name ? &parent_name:NULL ); - init.num_parents = (parent_name ?1 :0 ); + init.parent_names = parent_name ? &parent_name :NULL ; + init.parent_hws = parent_hw ? &parent_hw :NULL ; + init.parent_data = parent_data; +if (parent_name || parent_hw || parent_data) + init.num_parents =1 ; +else + init.num_parents =0 ;/* struct clk_fixed_rate assignments */ + fixed->flags = clk_fixed_flags; fixed->fixed_rate = fixed_rate; fixed->fixed_accuracy = fixed_accuracy; fixed->hw.init = &init;/* register the clock */ hw = &fixed->hw; - ret =clk_hw_register (dev, hw); +if (dev || !np) + ret =clk_hw_register (dev, hw); +else if (np) + ret =of_clk_hw_register (np, hw);if (ret) {kfree (fixed); hw =ERR_PTR (ret);
@@ -89,25 +91,7 @@ struct clk_hw *clk_hw_register_fixed_rate_with_accuracy(struct device *dev,return hw; } -EXPORT_SYMBOL_GPL (clk_hw_register_fixed_rate_with_accuracy); - -/** -* clk_hw_register_fixed_rate - register fixed-rate clock with the clock -* framework -* @dev: device that is registering this clock -* @name: name of this clock -* @parent_name: name of clock's parent -* @flags: framework-specific flags -* @fixed_rate: non-adjustable clock rate -*/ -struct clk_hw *clk_hw_register_fixed_rate (struct device *dev,const char *name, -const char *parent_name,unsigned long flags, -unsigned long fixed_rate) -{ -return clk_hw_register_fixed_rate_with_accuracy (dev, name, parent_name, - flags, fixed_rate,0 ); -} -EXPORT_SYMBOL_GPL (clk_hw_register_fixed_rate); +EXPORT_SYMBOL_GPL (__clk_hw_register_fixed_rate); struct clk *clk_register_fixed_rate(struct device *dev, const char *name, const char *parent_name, unsigned long flags,
include/linux/clk-provider.h +94 -6
118 lines not on this page · raw message
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 06/12] clk: fixed-rate: Add support for specifying parents via DT/pointers
Quoting Stephen Boyd (2019-08-30 08:09:17)
Quoted 11 lines
After commit
fc0c209c147f("clk: Allow parents to be specified without string names") we can use DT or directclk_hwpointers to specify parents. Create a generic function that shouldn't be used very often to encode the multitude of ways of registering a fixed rate clk with different parent information. Then add a bunch of wrapper macros that only pass down what needs to be passed down to the generic function to support this with less arguments.Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 7/12 clk: fixed-rate: Add clk flags for parent accuracy
In reply to Stephen BoydSome clk providers want to use the accuracy of the parent clk and use the fixed rate basic type clk to do that. This requires getting the parent clk and extracting the accuracy before registering the fixed rate clk. Let's add a flag for this and update the clk_ops to support this.
--- drivers/clk/clk-fixed-rate.c | 7 ++++++- include/linux/clk-provider.h | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-)
drivers/clk/clk-fixed-rate.c +6 -1
@@ -35,7 +35,12 @@ static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw,static unsigned long clk_fixed_rate_recalc_accuracy (struct clk_hw *hw,unsigned long parent_accuracy) { -return to_clk_fixed_rate (hw)->fixed_accuracy; +struct clk_fixed_rate *fixed =to_clk_fixed_rate (hw); + +if (fixed->flags &CLK_FIXED_RATE_PARENT_ACCURACY ) +return parent_accuracy; + +return fixed->fixed_accuracy; }const struct clk_ops clk_fixed_rate_ops = {
include/linux/clk-provider.h +6 -0
@@ -322,6 +322,10 @@ struct clk_hw {* @fixed_rate: constant frequency of clock * @fixed_accuracy: constant accuracy of clock in ppb (parts per billion) * @flags: hardware specific flags +* +* Flags: +* CLK_FIXED_RATE_PARENT_ACCURACY - Use the accuracy of the parent clk +* instead of what's set in @fixed_accuracy. */ struct clk_fixed_rate {struct clk_hw hw;
@@ -330,6 +334,8 @@ struct clk_fixed_rate {unsigned long flags; }; +#define CLK_FIXED_RATE_PARENT_ACCURACY BIT(0) +extern const struct clk_ops clk_fixed_rate_ops; struct clk_hw *__clk_hw_register_fixed_rate(struct device *dev, struct device_node *np, const char *name,
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 07/12] clk: fixed-rate: Add clk flags for parent accuracy
Quoting Stephen Boyd (2019-08-30 08:09:18)
Quoted 8 lines
Some clk providers want to use the accuracy of the parent clk and use the fixed rate basic type clk to do that. This requires getting the parent clk and extracting the accuracy before registering the fixed rate clk. Let's add a flag for this and update the
clk_opsto support this.Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 8/12 clk: fixed-rate: Document that accuracy isn't a rate
In reply to Stephen BoydThis kernel-doc talks about a rate for the accuracy. That's wrong.
--- include/linux/clk-provider.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/clk-provider.h +1 -1
@@ -393,7 +393,7 @@ struct clk *clk_register_fixed_rate(struct device *dev, const char *name,* @parent_name: name of clock's parent * @flags: framework-specific flags * @fixed_rate: non-adjustable clock rate -* @fixed_accuracy: non-adjustable clock rate +* @fixed_accuracy: non-adjustable clock accuracy */ #define clk_hw_register_fixed_rate_with_accuracy(dev, name, parent_name, \ flags, fixed_rate, \
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 08/12] clk: fixed-rate: Document that accuracy isn't a rate
Quoting Stephen Boyd (2019-08-30 08:09:19)
Quoted 5 lines
This kernel-doc talks about a rate for the accuracy. That's wrong.
Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 9/12 clk: asm9260: Use parent accuracy in fixed rate clk
In reply to Stephen BoydThis fixed rate clk is registered with the accuracy of the parent. Use CLK_FIXED_RATE_PARENT_ACCURACY for that instead of getting the parent clk and finding out the accuracy that way.
--- drivers/clk/clk-asm9260.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/clk-asm9260.c +4 -4
@@ -260,7 +260,6 @@ static void __init asm9260_acc_init(struct device_node *np)const char *ref_clk, *pll_clk ="pll" ;u32 rate;int n; -u32 accuracy =0 ; clk_data =kzalloc (struct_size (clk_data, hws,MAX_CLKS ),GFP_KERNEL );if (!clk_data)
@@ -275,10 +274,11 @@ static void __init asm9260_acc_init(struct device_node *np)/* register pll */ rate = (ioread32 (base +HW_SYSPLLCTRL ) &0xffff ) *1000000 ; +/* TODO: Convert to DT parent scheme */ ref_clk =of_clk_get_parent_name (np,0 ); - accuracy =clk_get_accuracy (__clk_lookup (ref_clk)); - hw =clk_hw_register_fixed_rate_with_accuracy (NULL , pll_clk, - ref_clk,0 , rate, accuracy); + hw =__clk_hw_register_fixed_rate_with_accuracy (NULL ,NULL , pll_clk, + ref_clk,NULL ,NULL ,0 , rate,0 , +CLK_FIXED_RATE_PARENT_ACCURACY );if (IS_ERR (hw))panic ("%pOFn: can't register REFCLK. Check DT!" , np);
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 09/12] clk: asm9260: Use parent accuracy in fixed rate clk
Quoting Stephen Boyd (2019-08-30 08:09:20)
Quoted 7 lines
This fixed rate clk is registered with the accuracy of the parent. Use
CLK_FIXED_RATE_PARENT_ACCURACYfor that instead of getting the parent clk and finding out the accuracy that way.Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 10/12 clk: mux: Add support for specifying parents via DT/pointers
In reply to Stephen BoydAfter commit fc0c209c147f ("clk: Allow parents to be specified without string names") we can use DT or direct clk_hw pointers to specify parents. Create a generic function that shouldn't be used very often to encode the multitude of ways of registering a mux clk with different parent information. Then add a bunch of wrapper macros that only pass down what needs to be passed down to the generic function to support this with less arguments.
Note: the msm drm driver passes an anonymous array through the macro which seems to confuse my compiler. Adding a parenthesis around the whole thing at the call site seems to fix it but it must be wrong. Maybe it's better to split this patch and pick out the array bits there?
--- drivers/clk/clk-mux.c | 58 +++++++--------------- drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c | 4 +- drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.c | 4 +- include/linux/clk-provider.h | 56 ++++++++++++++------- 4 files changed, 60 insertions(+), 62 deletions(-)
drivers/clk/clk-mux.c +18 -40
@@ -145,17 +145,19 @@ const struct clk_ops clk_mux_ro_ops = { };EXPORT_SYMBOL_GPL (clk_mux_ro_ops); -struct clk_hw *clk_hw_register_mux_table (struct device *dev,const char *name, -const char *const *parent_names,u8 num_parents, -unsigned long flags, -void __iomem *reg,u8 shift,u32 mask, +struct clk_hw *__clk_hw_register_mux (struct device *dev,struct device_node *np, +const char *name,u8 num_parents, +const char *const *parent_names, +const struct clk_hw **parent_hws, +const struct clk_parent_data *parent_data, +unsigned long flags,void __iomem *reg,u8 shift,u32 mask,u8 clk_mux_flags,u32 *table,spinlock_t *lock) {struct clk_mux *mux;struct clk_hw *hw;struct clk_init_data init;u8 width =0 ; -int ret; +int ret = -EINVAL ;if (clk_mux_flags &CLK_MUX_HIWORD_MASK ) { width =fls (mask) -ffs (mask) +1 ;
@@ -177,6 +179,8 @@ struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name, init.ops = &clk_mux_ops; init.flags = flags; init.parent_names = parent_names; + init.parent_data = parent_data; + init.parent_hws = parent_hws; init.num_parents = num_parents;/* struct clk_mux assignments */
@@ -189,7 +193,10 @@ struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name, mux->hw.init = &init; hw = &mux->hw; - ret =clk_hw_register (dev, hw); +if (dev || !np) + ret =clk_hw_register (dev, hw); +else if (np) + ret =of_clk_hw_register (np, hw);if (ret) {kfree (mux); hw =ERR_PTR (ret);
@@ -197,53 +204,24 @@ struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name,return hw; } -EXPORT_SYMBOL_GPL (clk_hw_register_mux_table); +EXPORT_SYMBOL_GPL (__clk_hw_register_mux);struct clk *clk_register_mux_table (struct device *dev,const char *name,const char *const *parent_names,u8 num_parents, -unsigned long flags, -void __iomem *reg,u8 shift,u32 mask, +unsigned long flags,void __iomem *reg,u8 shift,u32 mask,u8 clk_mux_flags,u32 *table,spinlock_t *lock) {struct clk_hw *hw; - hw =clk_hw_register_mux_table (dev, name, parent_names, num_parents, - flags, reg, shift, mask, clk_mux_flags, - table, lock); + hw =clk_hw_register_mux_table (dev, name, parent_names, + num_parents, flags, reg, shift, mask, + clk_mux_flags, table, lock);if (IS_ERR (hw))return ERR_CAST (hw);return hw->clk; }EXPORT_SYMBOL_GPL (clk_register_mux_table); -struct clk *clk_register_mux (struct device *dev,const char *name, -const char *const *parent_names,u8 num_parents, -unsigned long flags, -void __iomem *reg,u8 shift,u8 width, -u8 clk_mux_flags,spinlock_t *lock) -{ -u32 mask =BIT (width) -1 ; - -return clk_register_mux_table (dev, name, parent_names, num_parents, - flags, reg, shift, mask, clk_mux_flags, -NULL , lock); -} -EXPORT_SYMBOL_GPL (clk_register_mux); - -struct clk_hw *clk_hw_register_mux (struct device *dev,const char *name, -const char *const *parent_names,u8 num_parents, -unsigned long flags, -void __iomem *reg,u8 shift,u8 width, -u8 clk_mux_flags,spinlock_t *lock) -{ -u32 mask =BIT (width) -1 ; - -return clk_hw_register_mux_table (dev, name, parent_names, num_parents, - flags, reg, shift, mask, clk_mux_flags, -NULL , lock); -} -EXPORT_SYMBOL_GPL (clk_hw_register_mux); -void clk_unregister_mux (struct clk *clk) {struct clk_mux *mux;
drivers/gpu/drm/msm/dsi/pll/dsi_pll_10nm.c +2 -2
@@ -751,9 +751,9 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm)snprintf (parent4,32 ,"dsi%d_pll_post_out_div_clk" , pll_10nm->id); hw =clk_hw_register_mux (dev, clk_name, - (const char *[]){ + ((const char *[]){ parent, parent2, parent3, parent4 - },4 ,0 , pll_10nm->phy_cmn_mmio + + }),4 ,0 , pll_10nm->phy_cmn_mmio + REG_DSI_10nm_PHY_CMN_CLK_CFG1,0 ,2 ,0 ,NULL );if (IS_ERR (hw)) {
drivers/gpu/drm/msm/dsi/pll/dsi_pll_28nm.c +2 -2
@@ -554,9 +554,9 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm)snprintf (parent1,32 ,"dsi%dvco_clk" , pll_28nm->id);snprintf (parent2,32 ,"dsi%dindirect_path_div2_clk" , pll_28nm->id); clks[num++] =clk_register_mux (dev, clk_name, - (const char *[]){ + ((const char *[]){ parent1, parent2 - },2 ,CLK_SET_RATE_PARENT , pll_28nm->mmio + + }),2 ,CLK_SET_RATE_PARENT , pll_28nm->mmio + REG_DSI_28nm_PHY_PLL_VREG_CFG,1 ,1 ,0 ,NULL );snprintf (clk_name,32 ,"dsi%dpllbyte" , pll_28nm->id);
include/linux/clk-provider.h +38 -18
66 lines not on this page · raw message
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 10/12] clk: mux: Add support for specifying parents via DT/pointers
Quoting Stephen Boyd (2019-08-30 08:09:21)
Quoted 13 lines
After commit
fc0c209c147f("clk: Allow parents to be specified without string names") we can use DT or directclk_hwpointers to specify parents. Create a generic function that shouldn't be used very often to encode the multitude of ways of registering a mux clk with different parent information. Then add a bunch of wrapper macros that only pass down what needs to be passed down to the generic function to support this with less arguments.Note: the msm drm driver passes an anonymous array through the macro which seems to confuse my compiler. Adding a parenthesis around the whole thing at the call site seems to fix it but it must be wrong. Maybe it's better to split this patch and pick out the array bits there?
Quoted 5 lines
Cc Rob Clark <[email protected]>Cc Sean Paul <[email protected]>Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 11/12 clk: gate: Add support for specifying parents via DT/pointers
In reply to Stephen BoydAfter commit fc0c209c147f ("clk: Allow parents to be specified without string names") we can use DT or direct clk_hw pointers to specify parents. Create a generic function that shouldn't be used very often to encode the multitude of ways of registering a gate clk with different parent information. Then add a bunch of wrapper macros that only pass down what needs to be passed down to the generic function to support this with less arguments.
---
I'm debating having the multiplexer function take a DT index, clk_hw pointer, fw_name and name as different parameters. Then we can just always use the parent_data approach and cover all bases.
drivers/clk/clk-gate.c | 35 ++++++++++----------- include/linux/clk-provider.h | 59 ++++++++++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 20 deletions(-)
drivers/clk/clk-gate.c +18 -17
@@ -123,26 +123,18 @@ const struct clk_ops clk_gate_ops = { };EXPORT_SYMBOL_GPL (clk_gate_ops); -/** -* clk_hw_register_gate - register a gate clock with the clock framework -* @dev: device that is registering this clock -* @name: name of this clock -* @parent_name: name of this clock's parent -* @flags: framework-specific flags for this clock -* @reg: register address to control gating of this clock -* @bit_idx: which bit in the register controls gating of this clock -* @clk_gate_flags: gate-specific flags for this clock -* @lock: shared register lock for this clock -*/ -struct clk_hw *clk_hw_register_gate (struct device *dev,const char *name, -const char *parent_name,unsigned long flags, +struct clk_hw *__clk_hw_register_gate (struct device *dev, +struct device_node *np,const char *name, +const char *parent_name,const struct clk_hw *parent_hw, +const struct clk_parent_data *parent_data, +unsigned long flags,void __iomem *reg,u8 bit_idx,u8 clk_gate_flags,spinlock_t *lock) {struct clk_gate *gate;struct clk_hw *hw;struct clk_init_data init; -int ret; +int ret = -EINVAL ;if (clk_gate_flags &CLK_GATE_HIWORD_MASK ) {if (bit_idx >15 ) {
@@ -160,7 +152,12 @@ struct clk_hw *clk_hw_register_gate(struct device *dev, const char *name, init.ops = &clk_gate_ops; init.flags = flags; init.parent_names = parent_name ? &parent_name :NULL ; - init.num_parents = parent_name ?1 :0 ; + init.parent_hws = parent_hw ? &parent_hw :NULL ; + init.parent_data = parent_data; +if (parent_name || parent_hw || parent_data) + init.num_parents =1 ; +else + init.num_parents =0 ;/* struct clk_gate assignments */ gate->reg = reg;
@@ -170,15 +167,19 @@ struct clk_hw *clk_hw_register_gate(struct device *dev, const char *name, gate->hw.init = &init; hw = &gate->hw; - ret =clk_hw_register (dev, hw); +if (dev || !np) + ret =clk_hw_register (dev, hw); +else if (np) + ret =of_clk_hw_register (np, hw);if (ret) {kfree (gate); hw =ERR_PTR (ret); }return hw; + } -EXPORT_SYMBOL_GPL (clk_hw_register_gate); +EXPORT_SYMBOL_GPL (__clk_hw_register_gate); struct clk *clk_register_gate(struct device *dev, const char *name, const char *parent_name, unsigned long flags,
include/linux/clk-provider.h +56 -3
70 lines not on this page · raw message
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 11/12] clk: gate: Add support for specifying parents via DT/pointers
Quoting Stephen Boyd (2019-08-30 08:09:22)
Quoted 11 lines
After commit
fc0c209c147f("clk: Allow parents to be specified without string names") we can use DT or directclk_hwpointers to specify parents. Create a generic function that shouldn't be used very often to encode the multitude of ways of registering a gate clk with different parent information. Then add a bunch of wrapper macros that only pass down what needs to be passed down to the generic function to support this with less arguments.Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next
Stephen Boyd
maintainerPATCH 12/12 clk: divider: Add support for specifying parents via DT/pointers
In reply to Stephen BoydAfter commit fc0c209c147f ("clk: Allow parents to be specified without string names") we can use DT or direct clk_hw pointers to specify parents. Create a generic function that shouldn't be used very often to encode the multitude of ways of registering a divider clk with different parent information. Then add a bunch of wrapper macros that only pass down what needs to be passed down to the generic function to support this with less arguments.
--- drivers/clk/clk-divider.c | 84 ++----------------- include/linux/clk-provider.h | 153 ++++++++++++++++++++++++++++++++--- 2 files changed, 147 insertions(+), 90 deletions(-)
drivers/clk/clk-divider.c +6 -78
@@ -463,8 +463,9 @@ const struct clk_ops clk_divider_ro_ops = { };EXPORT_SYMBOL_GPL (clk_divider_ro_ops); -static struct clk_hw *_register_divider (struct device *dev,const char *name, -const char *parent_name,unsigned long flags, +struct clk_hw *__clk_hw_register_divider (struct device *dev,struct device_node *np, +const char *name,const char *parent_name,const struct clk_hw *parent_hw, +const struct clk_parent_data *parent_data,unsigned long flags,void __iomem *reg,u8 shift,u8 width,u8 clk_divider_flags,const struct clk_div_table *table,spinlock_t *lock)
@@ -515,55 +516,6 @@ static struct clk_hw *_register_divider(struct device *dev, const char *name,return hw; } -/** -* clk_register_divider - register a divider clock with the clock framework -* @dev: device registering this clock -* @name: name of this clock -* @parent_name: name of clock's parent -* @flags: framework-specific flags -* @reg: register address to adjust divider -* @shift: number of bits to shift the bitfield -* @width: width of the bitfield -* @clk_divider_flags: divider-specific flags for this clock -* @lock: shared register lock for this clock -*/ -struct clk *clk_register_divider (struct device *dev,const char *name, -const char *parent_name,unsigned long flags, -void __iomem *reg,u8 shift,u8 width, -u8 clk_divider_flags,spinlock_t *lock) -{ -struct clk_hw *hw; - - hw =_register_divider (dev, name, parent_name, flags, reg, shift, - width, clk_divider_flags,NULL , lock); -if (IS_ERR (hw)) -return ERR_CAST (hw); -return hw->clk; -} -EXPORT_SYMBOL_GPL (clk_register_divider); - -/** -* clk_hw_register_divider - register a divider clock with the clock framework -* @dev: device registering this clock -* @name: name of this clock -* @parent_name: name of clock's parent -* @flags: framework-specific flags -* @reg: register address to adjust divider -* @shift: number of bits to shift the bitfield -* @width: width of the bitfield -* @clk_divider_flags: divider-specific flags for this clock -* @lock: shared register lock for this clock -*/ -struct clk_hw *clk_hw_register_divider (struct device *dev,const char *name, -const char *parent_name,unsigned long flags, -void __iomem *reg,u8 shift,u8 width, -u8 clk_divider_flags,spinlock_t *lock) -{ -return _register_divider (dev, name, parent_name, flags, reg, shift, - width, clk_divider_flags,NULL , lock); -} -EXPORT_SYMBOL_GPL (clk_hw_register_divider); -/** * clk_register_divider_table - register a table based divider clock with * the clock framework
@@ -586,39 +538,15 @@ struct clk *clk_register_divider_table(struct device *dev, const char *name, {struct clk_hw *hw; - hw =_register_divider (dev, name, parent_name, flags, reg, shift, - width, clk_divider_flags, table, lock); + hw =__clk_hw_register_divider (dev,NULL , name, parent_name,NULL , +NULL , flags, reg, shift, width, clk_divider_flags, + table, lock);if (IS_ERR (hw))return ERR_CAST (hw);return hw->clk; }EXPORT_SYMBOL_GPL (clk_register_divider_table); -/** -* clk_hw_register_divider_table - register a table based divider clock with -* the clock framework -* @dev: device registering this clock -* @name: name of this clock -* @parent_name: name of clock's parent -* @flags: framework-specific flags -* @reg: register address to adjust divider -* @shift: number of bits to shift the bitfield -* @width: width of the bitfield -* @clk_divider_flags: divider-specific flags for this clock -* @table: array of divider/value pairs ending with a div set to 0 -* @lock: shared register lock for this clock -*/ -struct clk_hw *clk_hw_register_divider_table (struct device *dev, -const char *name,const char *parent_name,unsigned long flags, -void __iomem *reg,u8 shift,u8 width, -u8 clk_divider_flags,const struct clk_div_table *table, -spinlock_t *lock) -{ -return _register_divider (dev, name, parent_name, flags, reg, shift, - width, clk_divider_flags, table, lock); -} -EXPORT_SYMBOL_GPL (clk_hw_register_divider_table); -void clk_unregister_divider (struct clk *clk) {struct clk_divider *div;
include/linux/clk-provider.h +141 -12
165 lines not on this page · raw message
Signature · 1 line
Sent by a computer through tubes
Re: [PATCH 12/12] clk: divider: Add support for specifying parents via DT/pointers
Quoting Stephen Boyd (2019-08-30 08:09:23)
Quoted 11 lines
After commit
fc0c209c147f("clk: Allow parents to be specified without string names") we can use DT or directclk_hwpointers to specify parents. Create a generic function that shouldn't be used very often to encode the multitude of ways of registering a divider clk with different parent information. Then add a bunch of wrapper macros that only pass down what needs to be passed down to the generic function to support this with less arguments.Cc Manivannan Sadhasivam <[email protected]>Signed-off-by Stephen Boyd <[email protected]>---
Applied to clk-next