From: Harry Austen <hpausten@protonmail.com>
To: Stephen Boyd <sboyd@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Michal Simek <michal.simek@amd.com>,
Rob Herring <robh@kernel.org>
Cc: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 5/7] clk: clocking-wizard: add user clock monitor support
Date: Thu, 25 Jul 2024 18:05:48 +0000 [thread overview]
Message-ID: <D2YTI7LU63SW.3BD4V6FCRKQ60@protonmail.com> (raw)
In-Reply-To: <1cacce63c7263a3532cca148ad2c567f.sboyd@kernel.org>
On Wed Jul 24, 2024 at 12:29 AM BST, Stephen Boyd wrote:
> Quoting Harry Austen (2024-07-20 05:01:53)
> > Xilinx clocking wizard IP core supports monitoring of up to four
> > optional user clock inputs, with a corresponding interrupt for
> > notification in change of clock state (stop, underrun, overrun or
> > glitch). Give userspace access to this monitor logic through use of the
> > UIO framework.
> >
> > Use presence of the user monitor interrupt description in devicetree to
> > indicate whether or not the UIO device should be registered. Also, this
> > functionality is only supported from v6.0 onwards, so add indication of
> > support to the device match data, in order to be tied to the utilised
> > compatible string.
> >
> > Signed-off-by: Harry Austen <hpausten@protonmail.com>
> > ---
> > diff --git a/drivers/clk/xilinx/Kconfig b/drivers/clk/xilinx/Kconfig
> > index 051756953558b..907a435694687 100644
> > --- a/drivers/clk/xilinx/Kconfig
> > +++ b/drivers/clk/xilinx/Kconfig
> > @@ -21,6 +21,7 @@ config COMMON_CLK_XLNX_CLKWZRD
> > tristate "Xilinx Clocking Wizard"
> > depends on OF
> > depends on HAS_IOMEM
> > + depends on UIO
>
> If I have a pre-v6.0 device I probably don't want UIO though. Perhaps
> you should use the auxiliary bus framework to register a device that is
> otherwise unused and then have the uio driver live in drivers/uio and
> match that device made here. I think you can have 'imply UIO' if you
> like to put a weak Kconfig dependency.
Yeah I wasn't particularly happy about the UIO usage here. It seems like a
nice way to leave control up to the user in userspace though, rather than
adding a bunch of device attributes to read status registers, configure
interrupts etc. but I agree the dependency isn't good here. Will look into
your suggestion for v2.
>
> > help
> > Support for the Xilinx Clocking Wizard IP core clock generator.
> > Adds support for clocking wizard and compatible.
> > diff --git a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
> > index 7b262d73310fe..2d419e8ad4419 100644
> > --- a/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
> > +++ b/drivers/clk/xilinx/clk-xlnx-clock-wizard.c
> > @@ -1165,6 +1209,17 @@ static int clk_wzrd_probe(struct platform_device *pdev)
> > return -EINVAL;
> > }
> >
> > + data = device_get_match_data(&pdev->dev);
> > + if (data && data->supports_monitor) {
> > + irq = platform_get_irq(pdev, 0);
> > + if (irq > 0) {
> > + ret = clk_wzrd_setup_monitor(&pdev->dev, irq,
> > + platform_get_resource(pdev, IORESOURCE_IO, 0));
>
> Any reason this can't be
>
> ret = clk_wzrd_setup_monitor(pdev);
> if (ret)
> return ret;
>
> and then all the surrounding code be moved into the function, including
> the dev_err_probe()?
That makes a lot more sense. Don't know what I was doing. Thanks!
>
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret, "failed to setup monitor\n");
> > + }
> > + }
> > +
> > ret = of_property_read_u32(np, "xlnx,nr-outputs", &nr_outputs);
next prev parent reply other threads:[~2024-07-25 18:06 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-20 12:01 [PATCH 0/7] clk: clocking-wizard: add user clock monitor support Harry Austen
2024-07-20 12:01 ` [PATCH 1/7] clk: clocking-wizard: simplify probe/remove with devres helpers Harry Austen
2024-07-23 23:07 ` Stephen Boyd
2024-07-20 12:01 ` [PATCH 2/7] clk: clocking-wizard: use newer clk_hw API Harry Austen
2024-07-23 23:14 ` Stephen Boyd
2024-07-25 17:57 ` Harry Austen
2024-07-20 12:01 ` [PATCH 3/7] clk: clocking-wizard: move clock registration to separate function Harry Austen
2024-07-20 12:01 ` [PATCH 4/7] dt-bindings: clock: xilinx: add description of user monitor interrupt Harry Austen
2024-07-20 14:30 ` Rob Herring (Arm)
2024-07-20 14:37 ` Rob Herring
2024-07-20 20:00 ` Harry Austen
2024-07-20 12:01 ` [PATCH 5/7] clk: clocking-wizard: add user clock monitor support Harry Austen
2024-07-23 23:29 ` Stephen Boyd
2024-07-25 18:05 ` Harry Austen [this message]
2024-07-20 12:01 ` [PATCH 6/7] dt-bindings: clock: xilinx: describe whether dynamic reconfig is enabled Harry Austen
2024-07-22 17:13 ` Conor Dooley
2024-07-25 17:53 ` Harry Austen
2024-07-20 12:02 ` [PATCH 7/7] clk: clocking-wizard: move dynamic reconfig setup behind flag Harry Austen
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=D2YTI7LU63SW.3BD4V6FCRKQ60@protonmail.com \
--to=hpausten@protonmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=mturquette@baylibre.com \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=shubhrajyoti.datta@amd.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).