[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YoZTj69Une9aKd2C@shell.armlinux.org.uk>
Date: Thu, 19 May 2022 15:26:23 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Maxime Chevallier <maxime.chevallier@...tlin.com>
Cc: davem@...emloft.net, Rob Herring <robh+dt@...nel.org>,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
devicetree@...r.kernel.org, thomas.petazzoni@...tlin.com,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Heiner Kallweit <hkallweit1@...il.com>,
linux-arm-kernel@...ts.infradead.org,
Richard Cochran <richardcochran@...il.com>,
Horatiu.Vultur@...rochip.com, Allan.Nielsen@...rochip.com,
UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH net-next 3/6] net: lan966x: Add QUSGMII support for
lan966x
Hi,
On Thu, May 19, 2022 at 03:56:44PM +0200, Maxime Chevallier wrote:
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
> index e6642083ab9e..304c784f48f6 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
> @@ -452,4 +452,10 @@ static inline void lan_rmw(u32 val, u32 mask, struct lan966x *lan966x,
> gcnt, gwidth, raddr, rinst, rcnt, rwidth));
> }
>
> +static inline bool lan966x_is_qsgmii(phy_interface_t mode)
> +{
> + return (mode == PHY_INTERFACE_MODE_QSGMII) ||
> + (mode == PHY_INTERFACE_MODE_QUSGMII);
> +}
Maybe linux/phy.h should provide a helper, something like:
phy_interface_serdes_lanes()
that returns how many serdes lanes the interface mode uses?
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
> index 38a7e95d69b4..96708352f53e 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
> @@ -28,11 +28,18 @@ static int lan966x_phylink_mac_prepare(struct phylink_config *config,
> phy_interface_t iface)
> {
> struct lan966x_port *port = netdev_priv(to_net_dev(config->dev));
> + phy_interface_t serdes_mode = iface;
> int err;
>
> if (port->serdes) {
> + /* As far as the SerDes is concerned, QUSGMII is the same as
> + * QSGMII.
> + */
> + if (lan966x_is_qsgmii(iface))
> + serdes_mode = PHY_INTERFACE_MODE_QSGMII;
> +
> err = phy_set_mode_ext(port->serdes, PHY_MODE_ETHERNET,
> - iface);
> + serdes_mode);
I don't think that the ethernet MAC driver should be changing the
interface mode before passing it down to the generic PHY layer -
phy_set_mode_ext() is defined to take the phy interface mode, and any
aliasing of modes should really be up to the generic PHY driver not
the ethernet MAC driver.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists