From: Marek Vasut <marex@denx.de>
To: Florian Fainelli <f.fainelli@gmail.com>, netdev@vger.kernel.org
Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com>,
"David S . Miller" <davem@davemloft.net>,
NXP Linux Team <linux-imx@nxp.com>,
Richard Leitner <richard.leitner@skidata.com>,
Shawn Guo <shawnguo@kernel.org>
Subject: Re: [PATCH] net: fec: Fix phy_device lookup for phy_reset_after_clk_enable()
Date: Wed, 7 Oct 2020 00:02:42 +0200 [thread overview]
Message-ID: <9f882603-2419-5931-fe8f-03c2a28ac785@denx.de> (raw)
In-Reply-To: <110b63bb-9096-7ce0-530f-45dffed09077@gmail.com>
On 10/6/20 11:09 PM, Florian Fainelli wrote:
>
>
> On 10/6/2020 1:20 PM, Marek Vasut wrote:
>> The phy_reset_after_clk_enable() is always called with ndev->phydev,
>> however that pointer may be NULL even though the PHY device instance
>> already exists and is sufficient to perform the PHY reset.
>>
>> If the PHY still is not bound to the MAC, but there is OF PHY node
>> and a matching PHY device instance already, use the OF PHY node to
>> obtain the PHY device instance, and then use that PHY device instance
>> when triggering the PHY reset.
>>
>> Fixes: 1b0a83ac04e3 ("net: fec: add phy_reset_after_clk_enable()
>> support")
>> Signed-off-by: Marek Vasut <marex@denx.de>
>> Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com>
>> Cc: David S. Miller <davem@davemloft.net>
>> Cc: NXP Linux Team <linux-imx@nxp.com>
>> Cc: Richard Leitner <richard.leitner@skidata.com>
>> Cc: Shawn Guo <shawnguo@kernel.org>
>> ---
>> drivers/net/ethernet/freescale/fec_main.c | 22 ++++++++++++++++++++--
>> 1 file changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/freescale/fec_main.c
>> b/drivers/net/ethernet/freescale/fec_main.c
>> index 2d5433301843..5a4b20941aeb 100644
>> --- a/drivers/net/ethernet/freescale/fec_main.c
>> +++ b/drivers/net/ethernet/freescale/fec_main.c
>> @@ -1912,6 +1912,24 @@ static int fec_enet_mdio_write(struct mii_bus
>> *bus, int mii_id, int regnum,
>> return ret;
>> }
>> +static void fec_enet_phy_reset_after_clk_enable(struct net_device
>> *ndev)
>> +{
>> + struct fec_enet_private *fep = netdev_priv(ndev);
>> + struct phy_device *phy_dev = ndev->phydev;
>> +
>> + /*
>> + * If the PHY still is not bound to the MAC, but there is
>> + * OF PHY node and a matching PHY device instance already,
>> + * use the OF PHY node to obtain the PHY device instance,
>> + * and then use that PHY device instance when triggering
>> + * the PHY reset.
>> + */
>> + if (!phy_dev && fep->phy_node)
>> + phy_dev = of_phy_find_device(fep->phy_node);
>
> Don't you need to put the phy_dev reference at some point?
Probably, yes.
But first, does this approach and this patch even make sense ?
I mean, it fixes my problem, but is this right ?
next prev parent reply other threads:[~2020-10-06 22:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-06 20:20 [PATCH] net: fec: Fix phy_device lookup for phy_reset_after_clk_enable() Marek Vasut
2020-10-06 21:09 ` Florian Fainelli
2020-10-06 22:02 ` Marek Vasut [this message]
2020-10-09 0:46 ` Jakub Kicinski
2020-10-09 7:20 ` Marek Vasut
2020-10-09 15:15 ` Jakub Kicinski
2020-10-09 17:34 ` Marek Vasut
2020-10-09 18:02 ` Jakub Kicinski
2020-10-10 8:45 ` Marek Vasut
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=9f882603-2419-5931-fe8f-03c2a28ac785@denx.de \
--to=marex@denx.de \
--cc=cniedermaier@dh-electronics.com \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=linux-imx@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=richard.leitner@skidata.com \
--cc=shawnguo@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).