lkml.org 
[lkml]   [2019]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 7/7] clk: qcom: apcs-msm8916: use clk_parent_data to specify the parent
On Wed, Dec 18, 2019 at 10:23:39PM -0800, Stephen Boyd wrote:
> Quoting Niklas Cassel (2019-11-25 05:59:09)
> > diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c
> > index 46061b3d230e..bb91644edc00 100644
> > --- a/drivers/clk/qcom/apcs-msm8916.c
> > +++ b/drivers/clk/qcom/apcs-msm8916.c
> > @@ -51,6 +51,19 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev)
> > struct clk_init_data init = { };
> > int ret = -ENODEV;
> >
> > + /*
> > + * This driver is defined by the devicetree binding
> > + * Documentation/devicetree/bindings/mailbox/qcom,apcs-kpss-global.txt,
> > + * however, this driver is registered as a platform device by
> > + * qcom-apcs-ipc-mailbox.c. Because of this, when this driver
> > + * uses dev_get_regmap() and devm_clk_get(), it has to send the parent
> > + * device as argument.
> > + * When registering with the clock framework, we cannot use this trick,
> > + * since the clock framework always looks at dev->of_node when it tries
> > + * to find parent clock names using clk_parent_data.
> > + */
> > + dev->of_node = parent->of_node;
>
> This is odd. The clks could be registered with of_clk_hw_register() but
> then we lose the device provider information. Maybe we should search up
> one level to the parent node and if that has a DT node but the
> clk controller device doesn't we should use that instead?

Hello Stephen,

Having this in the clk core is totally fine with me,
since it solves my problem.

Will you cook up a patch, or do you want me to do it?

Kind regards,
Niklas

>
> ----8<-----
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index b68e200829f2..c8745c415c04 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -3669,7 +3669,7 @@ __clk_register(struct device *dev, struct device_node *np, struct clk_hw *hw)
> if (dev && pm_runtime_enabled(dev))
> core->rpm_enabled = true;
> core->dev = dev;
> - core->of_node = np;
> + core->of_node = np ? : dev_of_node(dev->parent);
> if (dev && dev->driver)
> core->owner = dev->driver->owner;
> core->hw = hw;

\
 
 \ /
  Last update: 2019-12-20 18:56    [W:0.058 / U:8.868 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site