From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Arun Ramadoss <arun.ramadoss@microchip.com>
Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
Woojung Huh <woojung.huh@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
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>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>
Subject: Re: [Patch net-next v14 11/13] net: dsa: microchip: lan937x: add phylink_mac_link_up support
Date: Thu, 30 Jun 2022 12:42:26 +0100 [thread overview]
Message-ID: <Yr2MImcS9lzr3yx9@shell.armlinux.org.uk> (raw)
In-Reply-To: <20220630102041.25555-12-arun.ramadoss@microchip.com>
On Thu, Jun 30, 2022 at 03:50:39PM +0530, Arun Ramadoss wrote:
> +static void lan937x_config_gbit(struct ksz_device *dev, bool gbit, u8 *data)
> +{
> + if (gbit)
> + *data &= ~PORT_MII_NOT_1GBIT;
> + else
> + *data |= PORT_MII_NOT_1GBIT;
> +}
> +
> +static void lan937x_config_interface(struct ksz_device *dev, int port,
> + int speed, int duplex,
> + bool tx_pause, bool rx_pause)
> +{
> + u8 xmii_ctrl0, xmii_ctrl1;
> +
> + ksz_pread8(dev, port, REG_PORT_XMII_CTRL_0, &xmii_ctrl0);
> + ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &xmii_ctrl1);
> +
> + switch (speed) {
> + case SPEED_1000:
> + lan937x_config_gbit(dev, true, &xmii_ctrl1);
> + break;
> + case SPEED_100:
> + lan937x_config_gbit(dev, false, &xmii_ctrl1);
> + xmii_ctrl0 |= PORT_MII_100MBIT;
> + break;
> + case SPEED_10:
> + lan937x_config_gbit(dev, false, &xmii_ctrl1);
> + xmii_ctrl0 &= ~PORT_MII_100MBIT;
> + break;
> + default:
> + dev_err(dev->dev, "Unsupported speed on port %d: %d\n",
> + port, speed);
> + return;
> + }
Isn't this:
if (speed == SPEED_1000)
xmii_ctrl1 &= ~PORT_MII_NOT_1GBIT;
else
xmii_ctrl1 |= PORT_MII_NOT_1GBIT;
if (speed == SPEED_100)
xmii_ctrl0 |= PORT_MII_100MBIT;
else
xmii_ctrl0 &= ~PORT_MII_100MBIT;
There isn't much need to validate that "speed" is correct, you've
already told phylink that you only support 1G, 100M and 10M so you're
not going to get called with anything except one of those.
> +
> + if (duplex)
> + xmii_ctrl0 |= PORT_MII_FULL_DUPLEX;
> + else
> + xmii_ctrl0 &= ~PORT_MII_FULL_DUPLEX;
> +
> + if (tx_pause)
> + xmii_ctrl0 |= PORT_MII_TX_FLOW_CTRL;
> + else
> + xmii_ctrl1 &= ~PORT_MII_TX_FLOW_CTRL;
It seems weird to set a bit in one register and clear it in a different
register. I suspect you mean xmii_ctrl0 here.
> +
> + if (rx_pause)
> + xmii_ctrl0 |= PORT_MII_RX_FLOW_CTRL;
> + else
> + xmii_ctrl0 &= ~PORT_MII_RX_FLOW_CTRL;
> +
> + ksz_pwrite8(dev, port, REG_PORT_XMII_CTRL_0, xmii_ctrl0);
> + ksz_pwrite8(dev, port, REG_PORT_XMII_CTRL_1, xmii_ctrl1);
> +}
> +
Thanks!
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2022-06-30 11:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-30 10:20 [Patch net-next v14 00/13] net: dsa: microchip: DSA Driver support for LAN937x Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 01/13] dt-bindings: net: make internal-delay-ps based on phy-mode Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 02/13] dt-bindings: net: dsa: dt bindings for microchip lan937x Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 03/13] net: dsa: tag_ksz: add tag handling for Microchip LAN937x Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 04/13] net: dsa: microchip: generic access to ksz9477 static and reserved table Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 05/13] net: dsa: microchip: add DSA support for microchip LAN937x Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 06/13] net: dsa: microchip: lan937x: add dsa_tag_protocol Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 07/13] net: dsa: microchip: lan937x: add phy read and write support Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 08/13] net: dsa: microchip: lan937x: register mdio-bus Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 09/13] net: dsa: microchip: lan937x: add MTU and fast_age support Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 10/13] net: dsa: microchip: lan937x: add phylink_get_caps support Arun Ramadoss
2022-06-30 11:36 ` Russell King (Oracle)
2022-07-01 5:51 ` Arun.Ramadoss
2022-07-01 8:07 ` Russell King (Oracle)
2022-07-01 8:37 ` Arun.Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 11/13] net: dsa: microchip: lan937x: add phylink_mac_link_up support Arun Ramadoss
2022-06-30 11:42 ` Russell King (Oracle) [this message]
2022-07-01 5:44 ` Arun.Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 12/13] net: dsa: microchip: lan937x: add phylink_mac_config support Arun Ramadoss
2022-06-30 10:20 ` [Patch net-next v14 13/13] net: dsa: microchip: add LAN937x in the ksz spi probe 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=Yr2MImcS9lzr3yx9@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=andrii@kernel.org \
--cc=arun.ramadoss@microchip.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
--cc=songliubraving@fb.com \
--cc=vivien.didelot@gmail.com \
--cc=woojung.huh@microchip.com \
--cc=yhs@fb.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;
as well as URLs for NNTP newsgroup(s).