All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Tachici <alexandru.tachici@analog.com>
To: <andrew@lunn.ch>
Cc: <alexandru.tachici@analog.com>, <davem@davemloft.net>,
	<devicetree@vger.kernel.org>, <edumazet@google.com>,
	<krzysztof.kozlowski+dt@linaro.org>, <kuba@kernel.org>,
	<lennart@lfdomain.com>, <linux-kernel@vger.kernel.org>,
	<netdev@vger.kernel.org>, <pabeni@redhat.com>,
	<richardcochran@gmail.com>, <robh+dt@kernel.org>,
	<weiyongjun1@huawei.com>, <yangyingliang@huawei.com>
Subject: Re: [net-next 1/3] net: ethernet: adi: adin1110: add PTP clock support
Date: Thu, 26 Jan 2023 11:59:34 +0200	[thread overview]
Message-ID: <20230126095934.23107-1-alexandru.tachici@analog.com> (raw)
In-Reply-To: <Y889m+CUSTbuv9Db@lunn.ch>

> > +static int adin1110_enable_perout(struct adin1110_priv *priv,
> > +				  struct ptp_perout_request perout,
> > +				  int on)
> > +{
> > +	u32 on_nsec;
> > +	u32 phase;
> > +	u32 mask;
> > +	int ret;
> > +
> > +	if (priv->cfg->id == ADIN2111_MAC) {
> > +		ret = phy_clear_bits_mmd(priv->ports[0]->phydev, MDIO_MMD_VEND1,
> > +					 ADIN2111_LED_CNTRL,
> > +					 ADIN2111_LED_CNTRL_LED0_FUNCTION);
> > +		if (ret < 0)
> > +			return ret;
> > +
> > +		ret = phy_set_bits_mmd(priv->ports[0]->phydev, MDIO_MMD_VEND1,
> > +				       ADIN2111_LED_CNTRL,
> > +				       on ? ADIN2111_LED_CNTRL_TS_TIMER : 0);
> 
> I normally say a MAC driver should not be accessing PHY register...
> 
> You have the advantage of knowing it is integrated, so you know
> exactly what PHY it is. But you still have a potential race condition
> sometime in the future. You are not taking the phydev->lock, which is
> something phylib nearly always does before accessing a PHY. If you
> ever add control of the LEDs, that lack of locking could get you in
> trouble.
> 
> Is this functionality always on LED0? It cannot be LED1 or LED2?
> 
>    Andrew

Hi Andrew,

Thanks for the insight. Will add the phylib locking. Device only allows
LED0 pin or INTN pin to be converted to timer output. Can't lose IRQ capability
here so only LED0 could possibly be used.

Thanks,
Alexandru 
 

  reply	other threads:[~2023-01-26 10:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20  9:53 [net-next 0/3] net: ethernet: adi: adin1110: add PTP support Alexandru Tachici
2023-01-20  9:53 ` [net-next 1/3] net: ethernet: adi: adin1110: add PTP clock support Alexandru Tachici
2023-01-21 12:03   ` kernel test robot
2023-01-24  2:08   ` Andrew Lunn
2023-01-26  9:59     ` Alexandru Tachici [this message]
2023-01-20  9:53 ` [net-next 2/3] net: ethernet: adi: adin1110: add timestamping support Alexandru Tachici
2023-01-20  9:53 ` [net-next 3/3] dt-bindings: net: adin1110: Document ts-capt pin Alexandru Tachici
2023-01-22 11:59   ` Krzysztof Kozlowski
2023-01-21  5:55 ` [net-next 0/3] net: ethernet: adi: adin1110: add PTP support Jakub Kicinski

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=20230126095934.23107-1-alexandru.tachici@analog.com \
    --to=alexandru.tachici@analog.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=lennart@lfdomain.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=weiyongjun1@huawei.com \
    --cc=yangyingliang@huawei.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.