From: Andrew Lunn <andrew@lunn.ch>
To: Nicolai Buchwitz <nb@tipi-net.de>
Cc: netdev@vger.kernel.org, Phil Elwell <phil@raspberrypi.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] net: phy: microchip: add downshift tunable support for LAN88xx
Date: Mon, 30 Mar 2026 15:02:58 +0200 [thread overview]
Message-ID: <30e7b68e-b7fb-44d6-83bf-e6acd09e7fd8@lunn.ch> (raw)
In-Reply-To: <20260329224202.500229-2-nb@tipi-net.de>
> +static int lan88xx_set_downshift(struct phy_device *phydev, u8 cnt)
> +{
> + u32 mask = LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_MASK |
> + LAN78XX_PHY_CTRL3_AUTO_DOWNSHIFT;
> + u32 val;
> +
> + if (cnt == DOWNSHIFT_DEV_DISABLE)
> + return phy_modify_paged(phydev, 1, LAN78XX_PHY_CTRL3,
> + LAN78XX_PHY_CTRL3_AUTO_DOWNSHIFT, 0);
> +
> + if (cnt == DOWNSHIFT_DEV_DEFAULT_COUNT)
> + cnt = 2;
> +
> + switch (cnt) {
> + case 2:
> + val = LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_2;
> + break;
> + case 3:
> + val = LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_3;
> + break;
> + case 4:
> + val = LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_4;
> + break;
> + case 5:
> + val = LAN78XX_PHY_CTRL3_DOWNSHIFT_CTRL_5;
> + break;
> + default:
> + return -EINVAL;
And this could be a range check followed by a FIELD_PREP(cnt - 2);
Andrew
next prev parent reply other threads:[~2026-03-30 13:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-29 22:41 [PATCH net-next 0/2] net: phy: microchip: add downshift support for LAN88xx Nicolai Buchwitz
2026-03-29 22:41 ` [PATCH 1/2] net: phy: microchip: add downshift tunable " Nicolai Buchwitz
2026-03-30 13:01 ` Andrew Lunn
2026-03-30 13:02 ` Andrew Lunn [this message]
2026-03-29 22:42 ` [PATCH 2/2] net: phy: microchip: enable downshift by default on LAN88xx Nicolai Buchwitz
2026-03-30 13:03 ` Andrew Lunn
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=30e7b68e-b7fb-44d6-83bf-e6acd09e7fd8@lunn.ch \
--to=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=phil@raspberrypi.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