From: Adam Ford <aford173@gmail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
Adam Ford-BE <aford@beaconembedded.com>,
Charles Stevens <charles.stevens@logicpd.com>,
Sergei Shtylyov <sergei.shtylyov@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] ravb: Add support for optional txc_refclk
Date: Mon, 28 Dec 2020 07:49:39 -0600 [thread overview]
Message-ID: <CAHCN7x+jm8agBzqDqnkmW1Obtd0zL6EA_xbicvkroZ+kmgEqiA@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdUr5MWpa5fhpKgAm7zRgzzJga=pjNSVG3aoTvCmuq5poQ@mail.gmail.com>
On Mon, Dec 14, 2020 at 4:05 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Adam,
>
> On Sun, Dec 13, 2020 at 5:18 PM Adam Ford <aford173@gmail.com> wrote:
> > The SoC expects the txv_refclk is provided, but if it is provided
> > by a programmable clock, there needs to be a way to get and enable
> > this clock to operate. It needs to be optional since it's only
> > necessary for those with programmable clocks.
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
>
> Thanks for your patch!
>
> > --- a/drivers/net/ethernet/renesas/ravb.h
> > +++ b/drivers/net/ethernet/renesas/ravb.h
> > @@ -994,6 +994,7 @@ struct ravb_private {
> > struct platform_device *pdev;
> > void __iomem *addr;
> > struct clk *clk;
> > + struct clk *ref_clk;
> > struct mdiobb_ctrl mdiobb;
> > u32 num_rx_ring[NUM_RX_QUEUE];
> > u32 num_tx_ring[NUM_TX_QUEUE];
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> > index bd30505fbc57..4c3f95923ef2 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -2148,6 +2148,18 @@ static int ravb_probe(struct platform_device *pdev)
> > goto out_release;
> > }
> >
> > + priv->ref_clk = devm_clk_get(&pdev->dev, "txc_refclk");
>
> Please also update the DT bindings[1], to document the optional
> presence of the clock.
I am not all that familiar with the YAML syntax, but right now, the
clock-names property isn't in the binding, and the driver doesn't use
a name when requesting the single clock it's expecting.
Since the txc_refclk is optional, can the clock-names property allow
for 0-2 names while the number of clocks be 1-2?
clocks:
minItems: 1
maxItems: 2
clock-names:
minItems: 0
maxItems: 2
items:
enum:
- fck # AVB functional clock (optional if it is the only clock)
- txc_refclk # TXC reference clock
With the above proposal, the clock-names would only be necessary when
using the txc_refclk.
>
> > + if (IS_ERR(priv->ref_clk)) {
> > + if (PTR_ERR(priv->ref_clk) == -EPROBE_DEFER) {
> > + /* for Probe defer return error */
> > + error = PTR_ERR(priv->ref_clk);
> > + goto out_release;
> > + }
> > + /* Ignore other errors since it's optional */
> > + } else {
> > + (void)clk_prepare_enable(priv->ref_clk);
>
> This can fail.
> Does this clock need to be enabled all the time?
> At least it should be disabled in the probe failure path, and in
> ravb_remove().
I'll do that for the next rev.
thanks,
adam
>
> [1] Documentation/devicetree/bindings/net/renesas,etheravb.yaml
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> -- Linus Torvalds
next prev parent reply other threads:[~2020-12-28 15:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-12 16:56 [RFC] ravb: Add support for optional txc_refclk Adam Ford
2020-12-12 17:54 ` Sergei Shtylyov
2020-12-12 19:38 ` Adam Ford
2020-12-14 10:05 ` Geert Uytterhoeven
2020-12-28 13:49 ` Adam Ford [this message]
2020-12-28 16:17 ` Geert Uytterhoeven
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=CAHCN7x+jm8agBzqDqnkmW1Obtd0zL6EA_xbicvkroZ+kmgEqiA@mail.gmail.com \
--to=aford173@gmail.com \
--cc=aford@beaconembedded.com \
--cc=charles.stevens@logicpd.com \
--cc=davem@davemloft.net \
--cc=geert@linux-m68k.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@gmail.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).