All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Tretter <m.tretter@pengutronix.de>
To: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org, dshah@xilinx.com,
	mturquette@baylibre.com, tejasp@xilinx.com, rajanv@xilinx.com,
	robh+dt@kernel.org, michals@xilinx.com, rvisaval@xilinx.com,
	kernel@pengutronix.de, linux-clk@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 08/12] soc: xilinx: vcu: implement clock provider for output clocks
Date: Mon, 21 Dec 2020 10:18:15 +0100	[thread overview]
Message-ID: <20201221091815.GA22033@pengutronix.de> (raw)
In-Reply-To: <160808099008.1580929.16611149064276335127@swboyd.mtv.corp.google.com>

On Tue, 15 Dec 2020 17:09:50 -0800, Stephen Boyd wrote:
> Quoting Michael Tretter (2020-12-15 03:38:09)
> > On Sat, 12 Dec 2020 21:55:34 -0800, Stephen Boyd wrote:
> > > Quoting Michael Tretter (2020-11-15 23:55:28)
> > > > +                          CLK_DIVIDER_ROUND_CLOSEST;
> > > > +       struct clk_hw *mux = NULL;
> > > > +       struct clk_hw *divider = NULL;
> > > > +       struct clk_hw *gate = NULL;
> > > > +       char *name_mux;
> > > > +       char *name_div;
> > > > +       int err;
> > > > +
> > > > +       name_mux = devm_kasprintf(dev, GFP_KERNEL, "%s%s", name, "_mux");
> > > > +       if (!name_mux) {
> > > > +               err = -ENOMEM;
> > > > +               goto err;
> > > > +       }
> > > > +       mux = clk_hw_register_mux(dev, name_mux, parent_names, num_parents,
> > > > +                                 flags, reg, 0, 1, 0, lock);
> > > > +       if (IS_ERR(mux)) {
> > > > +               err = PTR_ERR(divider);
> > > > +               goto err;
> > > > +       }
> > > > +       clk_hw_set_parent(mux, parent_default);
> > > 
> > > Can this be done from assigned-clock-parents binding?
> > 
> > Could be done, if the driver provides at least the PLL and the mux in addition
> > to the actual output clocks. Otherwise, it is not possible to reference the
> > PLL post divider and the mux from the device tree. I wanted to avoid to expose
> > the complexity to the device tree. Would you prefer, if all clocks are
> > provided instead of only the output clocks?
> 
> It is fine to do this in software too so not a big deal and no need to
> expose it from the device.
> 
> > 
> > > 
> > > > +
> > > > +static int xvcu_register_clock_provider(struct xvcu_device *xvcu)
> > > > +{
> > > > +       struct device *dev = xvcu->dev;
> > > > +       const char *parent_names[2];
> > > > +       struct clk_hw *parent_default;
> > > > +       struct clk_hw_onecell_data *data;
> > > > +       struct clk_hw **hws;
> > > > +       void __iomem *reg_base = xvcu->vcu_slcr_ba;
> > > > +
> > > > +       data = devm_kzalloc(dev, struct_size(data, hws, CLK_XVCU_NUM_CLOCKS), GFP_KERNEL);
> > > > +       if (!data)
> > > > +               return -ENOMEM;
> > > > +       data->num = CLK_XVCU_NUM_CLOCKS;
> > > > +       hws = data->hws;
> > > > +
> > > > +       xvcu->clk_data = data;
> > > > +
> > > > +       parent_default = xvcu->pll;
> > > > +       parent_names[0] = "dummy";
> > > 
> > > What is "dummy"?
> > 
> > According to the register reference [0], the output clocks can be driven by an
> > external clock instead of the PLL, but the VCU Product Guide [1] does not
> > mention any ports for actually driving the clock. From my understanding of the
> > IP core, this is a clock mux which has a not-connected first parent. Maybe
> > someone at Xilinx can clarify, what is happening here.
> > 
> > [0] https://www.xilinx.com/html_docs/registers/ug1087/ug1087-zynq-ultrascale-registers.html
> > [1] https://www.xilinx.com/support/documentation-navigation/see-all-versions.html?xlnxproducttypes=IP%20Cores&xlnxipcoresname=v-vcu
> > 
> > What would be a better way to handle this?
> > 
> > > 
> > > > +       parent_names[1] = clk_hw_get_name(parent_default);
> > > 
> > > Can we use the new way of specifying clk parents from DT or by using
> > > direct pointers instead of using string names? The idea is to get rid of
> > > clk_hw_get_name() eventually.
> > 
> > It should be possible to use the direct pointers, but this really depends on
> > how the "dummy" clock is handled.
> > 
> 
> I think if clk_parent_data is used then we can have the binding list the
> external clk as a 'clocks' property and then if it's not present in DT
> we will know that it can't ever be a parent. So it hopefully "just
> works" if clk_parent_data is used.

Thanks. It actually just works. I will send v2.

Michael

WARNING: multiple messages have this Message-ID (diff)
From: Michael Tretter <m.tretter@pengutronix.de>
To: Stephen Boyd <sboyd@kernel.org>
Cc: devicetree@vger.kernel.org, dshah@xilinx.com, tejasp@xilinx.com,
	mturquette@baylibre.com, rajanv@xilinx.com, robh+dt@kernel.org,
	michals@xilinx.com, linux-arm-kernel@lists.infradead.org,
	kernel@pengutronix.de, linux-clk@vger.kernel.org,
	rvisaval@xilinx.com
Subject: Re: [PATCH 08/12] soc: xilinx: vcu: implement clock provider for output clocks
Date: Mon, 21 Dec 2020 10:18:15 +0100	[thread overview]
Message-ID: <20201221091815.GA22033@pengutronix.de> (raw)
In-Reply-To: <160808099008.1580929.16611149064276335127@swboyd.mtv.corp.google.com>

On Tue, 15 Dec 2020 17:09:50 -0800, Stephen Boyd wrote:
> Quoting Michael Tretter (2020-12-15 03:38:09)
> > On Sat, 12 Dec 2020 21:55:34 -0800, Stephen Boyd wrote:
> > > Quoting Michael Tretter (2020-11-15 23:55:28)
> > > > +                          CLK_DIVIDER_ROUND_CLOSEST;
> > > > +       struct clk_hw *mux = NULL;
> > > > +       struct clk_hw *divider = NULL;
> > > > +       struct clk_hw *gate = NULL;
> > > > +       char *name_mux;
> > > > +       char *name_div;
> > > > +       int err;
> > > > +
> > > > +       name_mux = devm_kasprintf(dev, GFP_KERNEL, "%s%s", name, "_mux");
> > > > +       if (!name_mux) {
> > > > +               err = -ENOMEM;
> > > > +               goto err;
> > > > +       }
> > > > +       mux = clk_hw_register_mux(dev, name_mux, parent_names, num_parents,
> > > > +                                 flags, reg, 0, 1, 0, lock);
> > > > +       if (IS_ERR(mux)) {
> > > > +               err = PTR_ERR(divider);
> > > > +               goto err;
> > > > +       }
> > > > +       clk_hw_set_parent(mux, parent_default);
> > > 
> > > Can this be done from assigned-clock-parents binding?
> > 
> > Could be done, if the driver provides at least the PLL and the mux in addition
> > to the actual output clocks. Otherwise, it is not possible to reference the
> > PLL post divider and the mux from the device tree. I wanted to avoid to expose
> > the complexity to the device tree. Would you prefer, if all clocks are
> > provided instead of only the output clocks?
> 
> It is fine to do this in software too so not a big deal and no need to
> expose it from the device.
> 
> > 
> > > 
> > > > +
> > > > +static int xvcu_register_clock_provider(struct xvcu_device *xvcu)
> > > > +{
> > > > +       struct device *dev = xvcu->dev;
> > > > +       const char *parent_names[2];
> > > > +       struct clk_hw *parent_default;
> > > > +       struct clk_hw_onecell_data *data;
> > > > +       struct clk_hw **hws;
> > > > +       void __iomem *reg_base = xvcu->vcu_slcr_ba;
> > > > +
> > > > +       data = devm_kzalloc(dev, struct_size(data, hws, CLK_XVCU_NUM_CLOCKS), GFP_KERNEL);
> > > > +       if (!data)
> > > > +               return -ENOMEM;
> > > > +       data->num = CLK_XVCU_NUM_CLOCKS;
> > > > +       hws = data->hws;
> > > > +
> > > > +       xvcu->clk_data = data;
> > > > +
> > > > +       parent_default = xvcu->pll;
> > > > +       parent_names[0] = "dummy";
> > > 
> > > What is "dummy"?
> > 
> > According to the register reference [0], the output clocks can be driven by an
> > external clock instead of the PLL, but the VCU Product Guide [1] does not
> > mention any ports for actually driving the clock. From my understanding of the
> > IP core, this is a clock mux which has a not-connected first parent. Maybe
> > someone at Xilinx can clarify, what is happening here.
> > 
> > [0] https://www.xilinx.com/html_docs/registers/ug1087/ug1087-zynq-ultrascale-registers.html
> > [1] https://www.xilinx.com/support/documentation-navigation/see-all-versions.html?xlnxproducttypes=IP%20Cores&xlnxipcoresname=v-vcu
> > 
> > What would be a better way to handle this?
> > 
> > > 
> > > > +       parent_names[1] = clk_hw_get_name(parent_default);
> > > 
> > > Can we use the new way of specifying clk parents from DT or by using
> > > direct pointers instead of using string names? The idea is to get rid of
> > > clk_hw_get_name() eventually.
> > 
> > It should be possible to use the direct pointers, but this really depends on
> > how the "dummy" clock is handled.
> > 
> 
> I think if clk_parent_data is used then we can have the binding list the
> external clk as a 'clocks' property and then if it's not present in DT
> we will know that it can't ever be a parent. So it hopefully "just
> works" if clk_parent_data is used.

Thanks. It actually just works. I will send v2.

Michael

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-12-21 10:24 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16  7:55 [PATCH 00/12] soc: xilinx: vcu: Convert driver to clock provider Michael Tretter
2020-11-16  7:55 ` Michael Tretter
2020-11-16  7:55 ` [PATCH 01/12] ARM: dts: define indexes for output clocks Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-12-02 14:33   ` Michal Simek
2020-12-02 14:33     ` Michal Simek
2020-12-07 19:21   ` Rob Herring
2020-12-07 19:21     ` Rob Herring
2020-12-13  5:44   ` Stephen Boyd
2020-12-13  5:44     ` Stephen Boyd
2020-11-16  7:55 ` [PATCH 02/12] clk: divider: fix initialization with parent_hw Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-12-02 14:28   ` Michal Simek
2020-12-02 14:28     ` Michal Simek
2020-12-13  5:42   ` Stephen Boyd
2020-12-13  5:42     ` Stephen Boyd
2020-11-16  7:55 ` [PATCH 03/12] soc: xilinx: vcu: drop coreclk from struct xlnx_vcu Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-11-16  7:55 ` [PATCH 04/12] soc: xilinx: vcu: add helper to wait for PLL locked Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-11-16  7:55 ` [PATCH 05/12] soc: xilinx: vcu: add helpers for configuring PLL Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-11-16  7:55 ` [PATCH 06/12] soc: xilinx: vcu: implement PLL disable Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-11-16  7:55 ` [PATCH 07/12] soc: xilinx: vcu: register PLL as fixed rate clock Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-12-02 14:41   ` Michal Simek
2020-12-02 14:41     ` Michal Simek
2020-11-16  7:55 ` [PATCH 08/12] soc: xilinx: vcu: implement clock provider for output clocks Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-12-02 14:49   ` Michal Simek
2020-12-02 14:49     ` Michal Simek
2020-12-13  5:55   ` Stephen Boyd
2020-12-13  5:55     ` Stephen Boyd
2020-12-15 11:38     ` Michael Tretter
2020-12-15 11:38       ` Michael Tretter
2020-12-16  1:09       ` Stephen Boyd
2020-12-16  1:09         ` Stephen Boyd
2020-12-21  9:18         ` Michael Tretter [this message]
2020-12-21  9:18           ` Michael Tretter
2020-11-16  7:55 ` [PATCH 09/12] soc: xilinx: vcu: make pll post divider explicit Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-12-02 14:51   ` Michal Simek
2020-12-02 14:51     ` Michal Simek
2020-11-16  7:55 ` [PATCH 10/12] soc: xilinx: vcu: make the PLL configurable Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-12-02 14:54   ` Michal Simek
2020-12-02 14:54     ` Michal Simek
2020-11-16  7:55 ` [PATCH 11/12] soc: xilinx: vcu: remove calculation of PLL configuration Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-11-16  7:55 ` [PATCH 12/12] soc: xilinx: vcu: use bitfields for register definition Michael Tretter
2020-11-16  7:55   ` Michael Tretter
2020-12-13  5:47   ` Stephen Boyd
2020-12-13  5:47     ` Stephen Boyd
2020-12-03  7:46 ` [PATCH 00/12] soc: xilinx: vcu: Convert driver to clock provider Michal Simek
2020-12-03  7:46   ` Michal Simek
2020-12-03  9:00   ` Michael Tretter
2020-12-03  9:00     ` Michael Tretter
2020-12-03  9:14     ` Michal Simek
2020-12-03  9:14       ` Michal Simek
2020-12-13  5:50 ` Stephen Boyd
2020-12-13  5:50   ` Stephen Boyd
2020-12-15 11:56   ` Michael Tretter
2020-12-15 11:56     ` Michael Tretter
2020-12-16  2:37     ` Stephen Boyd
2020-12-16  2:37       ` Stephen Boyd
2020-12-21  9:19       ` Michael Tretter
2020-12-21  9:19         ` Michael Tretter

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=20201221091815.GA22033@pengutronix.de \
    --to=m.tretter@pengutronix.de \
    --cc=devicetree@vger.kernel.org \
    --cc=dshah@xilinx.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=michals@xilinx.com \
    --cc=mturquette@baylibre.com \
    --cc=rajanv@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=rvisaval@xilinx.com \
    --cc=sboyd@kernel.org \
    --cc=tejasp@xilinx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.