public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@nabladev.com>
To: Fidelio Lawson <lawson.fidelio@gmail.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Marek Vasut <marex@denx.de>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Simon Horman <horms@kernel.org>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Tristram Ha <Tristram.Ha@microchip.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Fidelio Lawson <fidelio.lawson@exotec.com>
Subject: Re: [PATCH v5 1/3] net: dsa: microchip: implement KSZ87xx Module 3 low-loss cable errata
Date: Tue, 5 May 2026 15:23:57 +0200	[thread overview]
Message-ID: <6c3b4490-c618-4650-8b3d-7bb71da196d3@nabladev.com> (raw)
In-Reply-To: <20260505-ksz87xx_errata_low_loss_connections-v5-1-da4002b21c42@exotec.com>

On 5/5/26 1:42 PM, Fidelio Lawson wrote:

[...]

> @@ -2096,11 +2141,39 @@ int ksz8463_w_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 val)
>   	return 0;
>   }

Nitpick, either turn the "Apply the Microchip..." code comment into a 
kerneldoc for this function, or use netdev style multi-line comment.

> +int ksz87xx_apply_low_loss_preset(struct ksz_device *dev, bool enable)
> +{
> +	/* Apply the Microchip erratum short-cable preset (LPF 62 MHz, EQ init 0) */
> +	/* providing a conservative configuration for short or low-loss cables. */
> +	u8 lpf_bw, eq_init;
> +	int ret;
> +
> +	lpf_bw = KSZ87XX_PHY_LPF_62MHZ;
> +	eq_init = KSZ87XX_DSP_EQ_INIT_LOW_LOSS;
> +
> +	if (!ksz_is_ksz87xx(dev))
> +		return -EOPNOTSUPP;

Please add newline here.

> +	if (!enable)
> +		return 0;

Please add newline here.

> +	ret = ksz8_ind_write8(dev, TABLE_LINK_MD, KSZ87XX_REG_PHY_LPF, lpf_bw);
> +	if (ret)
> +		return ret;

Please add newline here.

> +	dev->lpf_bw = lpf_bw;
> +	ret = ksz8_ind_write8(dev, TABLE_LINK_MD, KSZ87XX_REG_DSP_EQ, eq_init);
> +	if (ret)
> +		return ret;

Please add newline here.

> +	dev->eq_init = eq_init;
> +
> +	return ret;
> +}
> +

[...]

> diff --git a/drivers/net/dsa/microchip/ksz8_reg.h b/drivers/net/dsa/microchip/ksz8_reg.h
> index 332408567b47..cd41214f874e 100644
> --- a/drivers/net/dsa/microchip/ksz8_reg.h
> +++ b/drivers/net/dsa/microchip/ksz8_reg.h

[...]

> @@ -729,6 +736,21 @@
>   #define PHY_POWER_SAVING_ENABLE		BIT(2)
>   #define PHY_REMOTE_LOOPBACK		BIT(1)
>   
> +/* Vendor-specific Clause 22 PHY registers (virtualized) */
> +#define PHY_REG_KSZ87XX_SHORT_CABLE		0x1A
> +#define PHY_REG_KSZ87XX_LPF_BW			0x1B
> +#define PHY_REG_KSZ87XX_EQ_INIT			0x1C
> +
> +/* LPF bandwidth bits [7:6]: 00 = 90MHz (default), 01 = 62MHz, 10 = 55MHz, 11 = 44MHz  */
> +#define KSZ87XX_PHY_LPF_90MHZ          0x00
> +#define KSZ87XX_PHY_LPF_62MHZ          0x40
> +#define KSZ87XX_PHY_LPF_55MHZ          0x80
> +#define KSZ87XX_PHY_LPF_44MHZ          0xC0

You could use GENMASK_U32() and FIELD_PREP() for these bitfields:

#define KSZ87XX_PHY_LPF_MASK     GENMASK(7, 6)
#define KSZ87XX_PHY_LPF_90MHZ    FIELD_PREP(KSZ87XX_PHY_LPF_MASK, 0)
#define KSZ87XX_PHY_LPF_62MHZ    FIELD_PREP(KSZ87XX_PHY_LPF_MASK, 1)
...

[...]

  reply	other threads:[~2026-05-05 13:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 11:42 [PATCH v5 0/3] ksz87xx: add support for low-loss cable equalizer errata Fidelio Lawson
2026-05-05 11:42 ` [PATCH v5 1/3] net: dsa: microchip: implement KSZ87xx Module 3 low-loss cable errata Fidelio Lawson
2026-05-05 13:23   ` Marek Vasut [this message]
2026-05-05 11:42 ` [PATCH v5 2/3] net: ethtool: add KSZ87xx low-loss cable PHY tunables Fidelio Lawson
2026-05-05 11:42 ` [PATCH v5 3/3] net: phy: micrel: expose KSZ87xx low-loss cable tunables Fidelio Lawson
2026-05-05 13:25   ` Marek Vasut
2026-05-05 13:26 ` [PATCH v5 0/3] ksz87xx: add support for low-loss cable equalizer errata 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=6c3b4490-c618-4650-8b3d-7bb71da196d3@nabladev.com \
    --to=marex@nabladev.com \
    --cc=Tristram.Ha@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fidelio.lawson@exotec.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=lawson.fidelio@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=marex@denx.de \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=woojung.huh@microchip.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