[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f8f60a03-b190-41ad-8b67-4c63fd43ae47@lunn.ch>
Date: Fri, 19 May 2023 18:21:39 +0200
From: Andrew Lunn <andrew@...n.ch>
To: alexis.lothore@...tlin.com
Cc: Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Richard Cochran <richardcochran@...il.com>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
thomas.petazzoni@...tlin.com, paul.arola@...us.com,
scott.roberts@...us.com,
Marek BehĂșn <kabel@...nel.org>
Subject: Re: [PATCH net-next v2 7/7] net: dsa: mv88e6xxx: enable support for
88E6361 switch
> @@ -421,9 +421,14 @@ phy_interface_t mv88e6390x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
> int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port,
> int speed, int duplex)
> {
> + bool is_6361 =
> + chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361;
> u16 reg, ctrl;
> int err;
>
> + if (is_6361 && speed > 2500)
> + return -EOPNOTSUPP;
I would move the comparison inside the if, so removing the ugly looking split is_6361 line.
> +
> if (speed == 200 && port != 0)
> return -EOPNOTSUPP;
>
> @@ -506,8 +511,12 @@ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port,
> phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip,
> int port)
> {
> + bool is_6361 =
> + chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361;
> +
> if (port == 0 || port == 9 || port == 10)
> - return PHY_INTERFACE_MODE_10GBASER;
> + return is_6361 ? PHY_INTERFACE_MODE_2500BASEX :
> + PHY_INTERFACE_MODE_10GBASER;
Please see if you can rearrange this code as well.
Thanks
Andrew
Powered by blists - more mailing lists