From: Richard Leitner <richard.leitner@skidata.com>
To: Florian Fainelli <f.fainelli@gmail.com>, <fugang.duan@nxp.com>
Cc: Richard Leitner <dev@g0hl1n.net>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Richard Leitner <richard.leitner@skidata.com>
Subject: Re: [PATCH] net: ethernet: fsl: don't en/disable refclk on open/close
Date: Thu, 26 Oct 2017 10:28:41 +0200 [thread overview]
Message-ID: <b3d93ec0-395d-b0ef-0ba2-923cfecb36b1@skidata.com> (raw)
In-Reply-To: <154bc00e-cf87-6d8d-c3ad-8c3803104e90@g0hl1n.net>
On 10/23/2017 01:01 AM, Richard Leitner wrote:
> On 10/23/2017 12:48 AM, Florian Fainelli wrote
>> On 10/22/2017 03:30 PM, Richard Leitner wrote:
>>> On 10/22/2017 08:31 PM, Florian Fainelli wrote:
>>>> On 10/22/2017 06:11 AM, Richard Leitner wrote:
...
>>> But back to this patch: Is it OK the way it fixes the issue?
>>
>> Fugang and Andrew probably know this hardware a lot better, I would have
>> to look at the code path a bit more to understand if an alternative
>> solution is possible. It sounds like your patch could create a power
>> consumption regression, so maybe add a check for the PHY ID that is
>> problematic by doing something like:
>>
>> if (priv->phydev->drv && priv->phydev->drv->phy_id == XXXX_XXXX) where
>> XXXX_XXXX is the LAN870 PHY ID (obtained from MII register 2 & 3).
>
> I already had a patch which does this check and triggers a reset of the
> PHY after the refclk was enabled (in fec_enet_clk_enable) in case the
> phy_id matches. This would IMHO avoid all power consumption
> regressions... It was something like:
>
> switch (priv->phydev->drv->phy_id) {
> case XXXX:
> case XXXX:
> ret = fec_reset_phy(ndev);
> if (ret)
> goto failed_reset;
> if (ndev->phydev) {
> ret = phy_init_hw(ndev->phydev);
> if (ret)
> goto failed_reset;
> }
> }
Another possible solution that came to my mind is to add a flag called
something like "PHY_RST_AFTER_CLK_EN" to the flags variable in struct
phy_driver. This flag could then be set in the smsc PHY driver for
affected PHYs.
Then instead of comparing the phy_id in the MAC driver this flag could
be checked:
if (phydev->drv->flags & PHY_RST_AFTER_CLK_EN) {
ret = fec_reset_phy(ndev);
if (ret)
goto failed_reset;
if (ndev->phydev) {
ret = phy_init_hw(ndev->phydev);
if (ret)
goto failed_reset;
}
}
This approach would IMHO also be easier and less prune to erros for
porting to other MAC drivers (if needed).
So what would be the better approach in your opinion and how should I
procede here?
kind regards,
Richard.L
prev parent reply other threads:[~2017-10-26 8:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-22 13:11 [PATCH] net: ethernet: fsl: don't en/disable refclk on open/close Richard Leitner
2017-10-22 18:31 ` Florian Fainelli
2017-10-22 22:30 ` Richard Leitner
2017-10-22 22:48 ` Florian Fainelli
2017-10-22 23:01 ` Richard Leitner
2017-10-26 8:28 ` Richard Leitner [this message]
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=b3d93ec0-395d-b0ef-0ba2-923cfecb36b1@skidata.com \
--to=richard.leitner@skidata.com \
--cc=andrew@lunn.ch \
--cc=dev@g0hl1n.net \
--cc=f.fainelli@gmail.com \
--cc=fugang.duan@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.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