linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
	"linux-devel@linux.nxdi.nxp.com" <linux-devel@linux.nxdi.nxp.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>, Shawn Guo <shawnguo@kernel.org>,
	Wen He <wen.he_1@nxp.com>
Cc: Leo Li <leoyang.li@nxp.com>, "liviu.dudau@arm.com" <liviu.dudau@arm.com>
Subject: RE: [EXT] Re: [v2 2/3] clk: ls1028a: Add clock driver for Display output interface
Date: Mon, 16 Sep 2019 11:32:52 -0700	[thread overview]
Message-ID: <20190916183252.E360720830@mail.kernel.org> (raw)
In-Reply-To: <DB7PR04MB519563FED2146F6D1327668AE2AB0@DB7PR04MB5195.eurprd04.prod.outlook.com>

Quoting Wen He (2019-08-19 19:24:25)
> 
> > 
> > > > > +
> > > > > +static int plldig_clk_probe(struct platform_device *pdev) {
> > > > > +       struct clk_plldig *data;
> > > > > +       struct resource *mem;
> > > > > +       const char *parent_name;
> > > > > +       struct clk_init_data init = {};
> > > > > +       struct device *dev = &pdev->dev;
> > > > > +       int ret;
> > > > > +
> > > > > +       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> > > > > +       if (!data)
> > > > > +               return -ENOMEM;
> > > > > +
> > > > > +       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > > > > +       data->regs = devm_ioremap_resource(dev, mem);
> > > > > +       if (IS_ERR(data->regs))
> > > > > +               return PTR_ERR(data->regs);
> > > > > +
> > > > > +       init.name = dev->of_node->name;
> > > > > +       init.ops = &plldig_clk_ops;
> > > > > +       parent_name = of_clk_get_parent_name(dev->of_node, 0);
> > > > > +       init.parent_names = &parent_name;
> > > >
> > > > Can you use the new way of specifying clk parents with the
> > > > parent_data member of clk_init?
> > >
> > > Of course, but I don't understand why need recommend to use this member?
> > > Is that the member parent_names will be discard in future?
> > >
> > > Here are definition of the clk-provider.h
> > > /* Only one of the following three should be assigned */
> > > const char              * const *parent_names;
> > > const struct clk_parent_data    *parent_data;
> > > const struct clk_hw             **parent_hws;
> > >
> > > For PLLDIG, it only has one parent.
> > 
> > Yes. Can you use clk_parent_data array and specify a DT index of 0 and some
> > name that would go into "clock-names" in the .fw_name member?
> 
> OK, but .fw_name used for to registering clk, current it registered with fixed clk in dts .
> I think should be specify a DT index of 0 and specify the unique name for .name member.
> 
> I found have two ways to specify:
> 1. declare clk_parent_data variable parent_data, and initialization with clk_init_data, like this:
>  
> parent_data.name = of_clk_get_parent_name(dev->of_node, 0); 

This isn't preferred because of_clk_get_parent_name() is DT specific and
relies on the parent clk being registered before calling the function so
that we can figure out the globally unique name.

> parent_data.index = 0;
> 
> init.name = dev->of_node->name;
> init.ops = &plldig_clk_ops;
> init.parent_data = &parent_data;
> init.num_parents = 1;
> 
> 2. Or use a static const array for here? And put the unique name and index like this.
> static const struct clk_parent_data parent_data[] = {
>         {.name = "phy_27m", .index = 0},
> };
> 
> After then initialization with macro CLK_HW_INIT_PARENTS_DATA?

Yes use option #2. But, don't even specify a .name if this is new code
because .name is a fallback mechanism that is supposed to be used if
you're migrating code from an older DT to a newer DT. I don't think
that's happening here.


  reply	other threads:[~2019-09-16 18:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-15 10:16 [v2 1/3] dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings Wen He
2019-08-15 10:16 ` [v2 2/3] clk: ls1028a: Add clock driver for Display output interface Wen He
2019-08-16 17:46   ` Stephen Boyd
2019-08-19  7:30     ` [EXT] " Wen He
2019-08-19 18:29       ` Stephen Boyd
2019-08-20  2:24         ` Wen He
2019-09-16 18:32           ` Stephen Boyd [this message]
2019-08-15 10:16 ` [v2 3/3] arm64: dts: ls1028a: Add properties node for Display output pixel clock Wen He
2019-08-15 13:49 ` [v2 1/3] dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings Rob Herring
2019-08-16 17:47 ` Stephen Boyd
2019-08-19  2:14   ` [EXT] " Wen He

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190916183252.E360720830@mail.kernel.org \
    --to=sboyd@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-devel@linux.nxdi.nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=wen.he_1@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).