From: Moritz Fischer <mdf@kernel.org>
To: Alexandru Ardelean <ardeleanalex@gmail.com>
Cc: Moritz Fischer <mdf@kernel.org>,
Alexandru Ardelean <alexandru.ardelean@analog.com>,
linux-clk@vger.kernel.org, linux-fpga@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Mathias Tausen <mta@gomspace.com>
Subject: Re: [PATCH v4 5/7] clk: axi-clkgen: Respect ZYNQMP PFD/VCO frequency limits
Date: Wed, 30 Sep 2020 10:16:07 -0700 [thread overview]
Message-ID: <20200930171607.GA121420@archbook> (raw)
In-Reply-To: <CA+U=DspZ8cZzDDJWdbS=RkLifJRr7sjwQ9-ytMWkCqpfoCX6=w@mail.gmail.com>
On Wed, Sep 30, 2020 at 08:22:23AM +0300, Alexandru Ardelean wrote:
> On Tue, Sep 29, 2020 at 6:30 PM Moritz Fischer <mdf@kernel.org> wrote:
> >
> > Hi Alexandru,
> >
> > On Tue, Sep 29, 2020 at 05:44:15PM +0300, Alexandru Ardelean wrote:
> > > From: Mathias Tausen <mta@gomspace.com>
> > >
> > > Since axi-clkgen is now supported on ZYNQMP, make sure the max/min
> > > frequencies of the PFD and VCO are respected.
> > >
> > > Signed-off-by: Mathias Tausen <mta@gomspace.com>
> > > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
> >
> > This patch still does not cover the PCIe Zynq plugged into ZynqMP linux
> > machine case.
> >
> > > ---
> > > drivers/clk/clk-axi-clkgen.c | 9 +++++++++
> > > 1 file changed, 9 insertions(+)
> > >
> > > diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
> > > index 4342b7735590..2319bb1c5c08 100644
> > > --- a/drivers/clk/clk-axi-clkgen.c
> > > +++ b/drivers/clk/clk-axi-clkgen.c
> > > @@ -108,12 +108,21 @@ static uint32_t axi_clkgen_lookup_lock(unsigned int m)
> > > return 0x1f1f00fa;
> > > }
> > >
> > > +#ifdef ARCH_ZYNQMP
> > > +static const struct axi_clkgen_limits axi_clkgen_default_limits = {
> > > + .fpfd_min = 10000,
> > > + .fpfd_max = 450000,
> > > + .fvco_min = 800000,
> > > + .fvco_max = 1600000,
> > > +};
> > > +#else
> > > static const struct axi_clkgen_limits axi_clkgen_default_limits = {
> > > .fpfd_min = 10000,
> > > .fpfd_max = 300000,
> > > .fvco_min = 600000,
> > > .fvco_max = 1200000,
> > > };
> > > +#endif
> >
> > I still don't understand this. You have a way to determine which fabric
> > you are looking at with the FPGA info. Why not:
> >
> > [..] axi_clkgen_zynqmp_default_limits = {
> > };
> >
> > [..] axi_clkgen_default_limits = {
> > };
> >
> > Set them based on what you read back, i.e. determine which fabric you
> > are looking at *per clock gen* and use that info, rather than making a
> > compile time decision to support only one of them.
> >
> > Generally speaking #ifdef $ARCH should be a last resort solution.
>
> The support for reading back the fabric parameters is implemented in
> the AXI CLKGEN PCORE version starting with 5.0.a
> Links:
> https://github.com/analogdevicesinc/hdl/commits/master/library/common/up_clkgen.v
> https://github.com/analogdevicesinc/hdl/commit/66823682b63c1037abdc3fc1dd4d4e63d3cfbc1a
> https://github.com/analogdevicesinc/hdl/commit/7dcb2050c7946fab5ea5a273eda7c53ea7b969a6
>
> Before that version, these details aren't there, so the best you can
> do is assume compile-time ARCH defaults.
This is a property of the instance and not of the driver. If you can't
query the hardware to figure out what you're looking at, but have
different behaviours, please use different compatible strings and make
the default limits platform data.
Something like this:
static const struct of_device_id axi_clkgen_ids[] = {
{
.compatible = "foo-zynqmp",
.data = &zynqmp_default_limits,
},
{
.compatible = "bar-zynq",
.data = &zynq_default_limits,
},
{ },
};
And pull the info out in your probe function, then you can have both
configurations and select via device-tree.
Thanks,
Moritz
next prev parent reply other threads:[~2020-09-30 17:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-29 14:44 [PATCH v4 0/7] clk: axi-clk-gen: misc updates to the driver Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 1/7] clk: axi-clkgen: Add support for fractional dividers Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 2/7] clk: axi-clkgen: Set power bits for fractional mode Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 3/7] clk: axi-clkgen: add support for ZynqMP (UltraScale) Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 4/7] clk: axi-clkgen: wrap limits in a struct and keep copy on the state object Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 5/7] clk: axi-clkgen: Respect ZYNQMP PFD/VCO frequency limits Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 6/7] include: fpga: adi-axi-common.h: add definitions for supported FPGAs Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 7/7] clk: axi-clkgen: Add support for FPGA info Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 0/7] clk: axi-clk-gen: misc updates to the driver Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 1/7] clk: axi-clkgen: Add support for fractional dividers Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 2/7] clk: axi-clkgen: Set power bits for fractional mode Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 3/7] clk: axi-clkgen: add support for ZynqMP (UltraScale) Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 4/7] clk: axi-clkgen: wrap limits in a struct and keep copy on the state object Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 5/7] clk: axi-clkgen: Respect ZYNQMP PFD/VCO frequency limits Alexandru Ardelean
2020-09-29 15:30 ` Moritz Fischer
2020-09-30 5:22 ` Alexandru Ardelean
2020-09-30 17:16 ` Moritz Fischer [this message]
2020-10-01 5:18 ` Alexandru Ardelean
2020-10-01 8:37 ` Alexandru Ardelean
2020-10-01 19:08 ` Moritz Fischer
2020-09-29 14:44 ` [PATCH v4 6/7] include: fpga: adi-axi-common.h: add definitions for supported FPGAs Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 7/7] clk: axi-clkgen: Add support for FPGA info Alexandru Ardelean
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=20200930171607.GA121420@archbook \
--to=mdf@kernel.org \
--cc=alexandru.ardelean@analog.com \
--cc=ardeleanalex@gmail.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mta@gomspace.com \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
/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).