[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bcef90db-ca9d-4c52-9dc5-2f59ae858824@lunn.ch>
Date: Mon, 9 Dec 2024 14:17:04 +0100
From: Andrew Lunn <andrew@...n.ch>
To: dimitri.fedrau@...bherr.com
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Andrew Davis <afd@...com>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Dimitri Fedrau <dima.fedrau@...il.com>
Subject: Re: [PATCH net-next 2/2] net: phy: dp83822: Add support for GPIO2
clock output
> #define MII_DP83822_RCSR 0x17
> #define MII_DP83822_RESET_CTRL 0x1f
> #define MII_DP83822_GENCFG 0x465
> +#define MII_DP83822_IOCTRL2 0x463
> #define MII_DP83822_SOR1 0x467
These are sorted, so the MII_DP83822_IOCTRL2 should go before
MII_DP83822_GENCFG.
> + if (dp83822->set_gpio2_clk_out)
> + phy_modify_mmd(phydev, DP83822_DEVADDR, MII_DP83822_IOCTRL2,
I would of preferred MDIO_MMD_VEND2 rather than DP83822_DEVADDR, but
having just this one instance correct would look a bit odd.
> + ret = of_property_read_u32(dev->of_node, "ti,gpio2-clk-out",
> + &dp83822->gpio2_clk_out);
> + if (!ret) {
> + dp83822->set_gpio2_clk_out = true;
> + switch (dp83822->gpio2_clk_out) {
> + case DP83822_CLK_SRC_MAC_IF:
> + break;
> + case DP83822_CLK_SRC_XI:
> + break;
> + case DP83822_CLK_SRC_INT_REF:
> + break;
> + case DP83822_CLK_SRC_RMII_MASTER_MODE_REF:
> + break;
> + case DP83822_CLK_SRC_FREE_RUNNING:
> + break;
> + case DP83822_CLK_SRC_RECOVERED:
> + break;
You can list multiple case statements together, and have one break at
the end.
I would personally also only have:
> + dp83822->set_gpio2_clk_out = true;
if validation passes, not that it really matters because:
> + default:
> + phydev_err(phydev, "ti,gpio2-clk-out value %u not valid\n",
> + dp83822->gpio2_clk_out);
> + return -EINVAL;
> + }
> + }
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists