From: Vladimir Oltean <olteanv@gmail.com>
To: Daniel Golle <daniel@makrotopia.org>
Cc: Hauke Mehrtens <hauke@hauke-m.de>, Andrew Lunn <andrew@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/3] net: dsa: mxl-gsw1xx: configure PCS polarities
Date: Tue, 27 Jan 2026 15:25:44 +0200 [thread overview]
Message-ID: <20260127132544.2ga4wiwckovziylw@skbuf> (raw)
In-Reply-To: <db296e8f477f34498979cd580898170f8ae537e5.1769519758.git.daniel@makrotopia.org>
On Tue, Jan 27, 2026 at 01:18:45PM +0000, Daniel Golle wrote:
> @@ -229,11 +231,17 @@ static int gsw1xx_pcs_phy_xaui_write(struct gsw1xx_priv *priv, u16 addr,
> 1000, 100000);
> }
>
> -static int gsw1xx_pcs_reset(struct gsw1xx_priv *priv)
> +static int gsw1xx_pcs_reset(struct gsw1xx_priv *priv, phy_interface_t interface)
> {
> + struct dsa_port *pcs_port;
> + unsigned int pol;
> int ret;
> u16 val;
>
> + pcs_port = dsa_to_port(priv->gswip.ds, GSW1XX_SGMII_PORT);
> + if (!pcs_port)
> + return -EINVAL;
> +
> /* Assert and deassert SGMII shell reset */
> ret = regmap_set_bits(priv->shell, GSW1XX_SHELL_RST_REQ,
> GSW1XX_RST_REQ_SGMII_SHELL);
> @@ -260,15 +268,19 @@ static int gsw1xx_pcs_reset(struct gsw1xx_priv *priv)
> FIELD_PREP(GSW1XX_SGMII_PHY_RX0_CFG2_FILT_CNT,
> GSW1XX_SGMII_PHY_RX0_CFG2_FILT_CNT_DEF);
>
> + ret = phy_get_rx_polarity(of_fwnode_handle(pcs_port->dn),
> + phy_modes(interface),
> + BIT(PHY_POL_NORMAL) | BIT(PHY_POL_INVERT),
> + PHY_POL_NORMAL, &pol);
phy_get_manual_rx_polarity()
> + if (ret)
> + return ret;
> +
> /* RX lane seems to be inverted internally, so bit
> * GSW1XX_SGMII_PHY_RX0_CFG2_INVERT needs to be set for normal
> * (ie. non-inverted) operation.
> - *
> - * TODO: Take care of inverted RX pair once generic property is
> - * available
> */
> -
> - val |= GSW1XX_SGMII_PHY_RX0_CFG2_INVERT;
> + if (pol == PHY_POL_NORMAL)
> + val |= GSW1XX_SGMII_PHY_RX0_CFG2_INVERT;
>
> ret = regmap_write(priv->sgmii, GSW1XX_SGMII_PHY_RX0_CFG2, val);
> if (ret < 0)
> @@ -277,9 +289,15 @@ static int gsw1xx_pcs_reset(struct gsw1xx_priv *priv)
> val = FIELD_PREP(GSW1XX_SGMII_PHY_TX0_CFG3_VBOOST_LEVEL,
> GSW1XX_SGMII_PHY_TX0_CFG3_VBOOST_LEVEL_DEF);
>
> - /* TODO: Take care of inverted TX pair once generic property is
> - * available
> - */
> + ret = phy_get_tx_polarity(of_fwnode_handle(pcs_port->dn),
> + phy_modes(interface),
> + BIT(PHY_POL_NORMAL) | BIT(PHY_POL_INVERT),
> + PHY_POL_NORMAL, &pol);
phy_get_manual_tx_polarity()
> + if (ret)
> + return ret;
> +
> + if (pol == PHY_POL_INVERT)
> + val |= GSW1XX_SGMII_PHY_TX0_CFG3_INVERT;
>
> ret = regmap_write(priv->sgmii, GSW1XX_SGMII_PHY_TX0_CFG3, val);
> if (ret < 0)
> @@ -336,7 +354,7 @@ static int gsw1xx_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,
> priv->tbi_interface = PHY_INTERFACE_MODE_NA;
>
> if (!reconf)
> - ret = gsw1xx_pcs_reset(priv);
> + ret = gsw1xx_pcs_reset(priv, interface);
>
> if (ret)
> return ret;
> --
> 2.52.0
next prev parent reply other threads:[~2026-01-27 13:25 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-27 13:18 [PATCH net-next 0/3] net: dsa: mxl-gsw1xx: setup polarities and validate chip Daniel Golle
2026-01-27 13:18 ` [PATCH net-next 1/3] dt-bindings: net: dsa: lantiq,gswip: reference common PHY properties Daniel Golle
2026-01-27 13:29 ` Vladimir Oltean
2026-01-27 14:07 ` Daniel Golle
2026-01-27 15:07 ` Vladimir Oltean
2026-01-27 22:10 ` Daniel Golle
2026-01-27 22:25 ` Vladimir Oltean
2026-01-28 1:47 ` Daniel Golle
2026-01-27 15:21 ` Andrew Lunn
2026-01-27 16:22 ` Daniel Golle
2026-01-27 13:18 ` [PATCH net-next 2/3] net: dsa: mxl-gsw1xx: configure PCS polarities Daniel Golle
2026-01-27 13:25 ` Vladimir Oltean [this message]
2026-01-27 13:18 ` [PATCH net-next 3/3] net: dsa: mxl-gsw1xx: validate chip ID Daniel Golle
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=20260127132544.2ga4wiwckovziylw@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=daniel@makrotopia.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=hauke@hauke-m.de \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@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