From: <Arun.Ramadoss@microchip.com>
To: <olteanv@gmail.com>, <UNGLinuxDriver@microchip.com>,
<vivien.didelot@gmail.com>, <andrew@lunn.ch>,
<f.fainelli@gmail.com>, <kuba@kernel.org>, <edumazet@google.com>,
<pabeni@redhat.com>, <o.rempel@pengutronix.de>,
<Woojung.Huh@microchip.com>, <davem@davemloft.net>
Cc: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
<kernel@pengutronix.de>
Subject: Re: [PATCH net-next v2 2/4] net: phy: micrel: add EEE configuration support for KSZ9477 variants of PHYs
Date: Fri, 20 Jan 2023 14:30:17 +0000 [thread overview]
Message-ID: <56ffbba6f3ef52949252a5ad5e83122332b076f8.camel@microchip.com> (raw)
In-Reply-To: <20230120092059.347734-3-o.rempel@pengutronix.de>
Hi Oleksij,
On Fri, 2023-01-20 at 10:20 +0100, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> KSZ9477 variants of PHYs are not completely compatible with generic
> phy_ethtool_get/set_eee() handlers. For example MDIO_PCS_EEE_ABLE
> acts
> like a mirror of MDIO_AN_EEE_ADV register. If MDIO_AN_EEE_ADV set to
> 0,
> MDIO_PCS_EEE_ABLE will be 0 too. It means, if we do
> "ethtool --set-eee lan2 eee off", we won't be able to enable it
> again.
>
> With this patch, instead of reading MDIO_PCS_EEE_ABLE register, the
> driver will provide proper abilities.
>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
> drivers/net/phy/micrel.c | 81
> ++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 81 insertions(+)
>
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index d5b80c31ab91..dca61a73c144 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -1370,6 +1370,85 @@ static int ksz9131_config_aneg(struct
> phy_device *phydev)
> return genphy_config_aneg(phydev);
> }
>
> +static int ksz9477_set_eee(struct phy_device *phydev, struct
> ethtool_eee *data)
> +{
> + int old_adv, adv = 0, ret;
nit: you can consider declaring variable in two lines, one with
initialized and other with uninitialized.
int old_adv, ret;
int adv = 0;
> +
> + ksz9477_get_eee_caps(phydev, data);
> +
> + old_adv = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_EEE_ADV);
> + if (old_adv < 0)
> + return old_adv;
> +
> + if (data->eee_enabled) {
> + if (!data->advertised)
> + adv = ethtool_adv_to_mmd_eee_adv_t(data-
> >supported);
> + else
> + adv = ethtool_adv_to_mmd_eee_adv_t(data-
> >advertised &
> + data-
> >supported);
> + /* Mask prohibited EEE modes */
> + adv &= ~phydev->eee_broken_modes;
> + }
> +
> + if (old_adv != adv) {
> + ret = phy_write_mmd(phydev, MDIO_MMD_AN,
> MDIO_AN_EEE_ADV, adv);
> + if (ret < 0)
> + return ret;
> +
> + /* Restart autonegotiation so the new modes get sent
> to the
> + * link partner.
> + */
> + if (phydev->autoneg == AUTONEG_ENABLE) {
> + ret = phy_restart_aneg(phydev);
> + if (ret < 0)
> + return ret;
> + }
> + }
> +
> + return 0;
> +}
> +
>
>
next prev parent reply other threads:[~2023-01-20 14:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-20 9:20 [PATCH net-next v2 0/4] net: add EEE support for KSZ9477 switch series Oleksij Rempel
2023-01-20 9:20 ` [PATCH net-next v2 1/4] net: phy: add driver specific get/set_eee support Oleksij Rempel
2023-01-20 9:20 ` [PATCH net-next v2 2/4] net: phy: micrel: add EEE configuration support for KSZ9477 variants of PHYs Oleksij Rempel
2023-01-20 14:30 ` Arun.Ramadoss [this message]
2023-01-20 9:20 ` [PATCH net-next v2 3/4] net: phy: micrel: disable 1000Mbit EEE support if 1000Mbit is not supported Oleksij Rempel
2023-01-20 9:20 ` [PATCH net-next v2 4/4] net: dsa: microchip: enable EEE support Oleksij Rempel
2023-01-20 14:25 ` Arun.Ramadoss
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=56ffbba6f3ef52949252a5ad5e83122332b076f8.camel@microchip.com \
--to=arun.ramadoss@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=Woojung.Huh@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=o.rempel@pengutronix.de \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=vivien.didelot@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
all inboxes | Powered by JetHome®