From: Dimitri Fedrau <dima.fedrau@gmail.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Dimitri Fedrau <dimitri.fedrau@liebherr.com>,
Andrew Lunn <andrew+netdev@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>, Andrew Davis <afd@ti.com>,
Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 2/2] net: phy: dp83822: Add support for GPIO2 clock output
Date: Wed, 11 Dec 2024 11:52:42 +0100 [thread overview]
Message-ID: <20241211105242.GB4424@debian> (raw)
In-Reply-To: <qqqwdzmcnkuga6qvvszgg7o2myb26sld5i37e4konhln2n4cgc@mwtropwj3ywv>
Am Wed, Dec 11, 2024 at 10:45:53AM +0100 schrieb Krzysztof Kozlowski:
> On Wed, Dec 11, 2024 at 09:04:40AM +0100, Dimitri Fedrau wrote:
> > The GPIO2 pin on the DP83822 can be configured as clock output. Add support
> > for configuration via DT.
> >
> > Signed-off-by: Dimitri Fedrau <dimitri.fedrau@liebherr.com>
> > ---
> > drivers/net/phy/dp83822.c | 40 ++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 40 insertions(+)
> >
> > diff --git a/drivers/net/phy/dp83822.c b/drivers/net/phy/dp83822.c
> > index 25ee09c48027c86b7d8f4acb5cbe2e157c56a85a..dc5595eae6cc74e5c77914d53772c5fad64c3e70 100644
> > --- a/drivers/net/phy/dp83822.c
> > +++ b/drivers/net/phy/dp83822.c
> > @@ -14,6 +14,8 @@
> > #include <linux/netdevice.h>
> > #include <linux/bitfield.h>
> >
> > +#include <dt-bindings/net/ti-dp83822.h>
> > +
> > #define DP83822_PHY_ID 0x2000a240
> > #define DP83825S_PHY_ID 0x2000a140
> > #define DP83825I_PHY_ID 0x2000a150
> > @@ -30,6 +32,7 @@
> > #define MII_DP83822_FCSCR 0x14
> > #define MII_DP83822_RCSR 0x17
> > #define MII_DP83822_RESET_CTRL 0x1f
> > +#define MII_DP83822_IOCTRL2 0x463
> > #define MII_DP83822_GENCFG 0x465
> > #define MII_DP83822_SOR1 0x467
> >
> > @@ -104,6 +107,11 @@
> > #define DP83822_RX_CLK_SHIFT BIT(12)
> > #define DP83822_TX_CLK_SHIFT BIT(11)
> >
> > +/* IOCTRL2 bits */
> > +#define DP83822_IOCTRL2_GPIO2_CLK_SRC GENMASK(6, 4)
> > +#define DP83822_IOCTRL2_GPIO2_CTRL GENMASK(2, 0)
> > +#define DP83822_IOCTRL2_GPIO2_CTRL_CLK_REF GENMASK(1, 0)
> > +
> > /* SOR1 mode */
> > #define DP83822_STRAP_MODE1 0
> > #define DP83822_STRAP_MODE2 BIT(0)
> > @@ -139,6 +147,8 @@ struct dp83822_private {
> > u8 cfg_dac_minus;
> > u8 cfg_dac_plus;
> > struct ethtool_wolinfo wol;
> > + bool set_gpio2_clk_out;
> > + u32 gpio2_clk_out;
> > };
> >
> > static int dp83822_config_wol(struct phy_device *phydev,
> > @@ -413,6 +423,15 @@ static int dp83822_config_init(struct phy_device *phydev)
> > int err = 0;
> > int bmcr;
> >
> > + if (dp83822->set_gpio2_clk_out)
> > + phy_modify_mmd(phydev, MDIO_MMD_VEND2, MII_DP83822_IOCTRL2,
> > + DP83822_IOCTRL2_GPIO2_CTRL |
> > + DP83822_IOCTRL2_GPIO2_CLK_SRC,
> > + FIELD_PREP(DP83822_IOCTRL2_GPIO2_CTRL,
> > + DP83822_IOCTRL2_GPIO2_CTRL_CLK_REF) |
> > + FIELD_PREP(DP83822_IOCTRL2_GPIO2_CLK_SRC,
> > + dp83822->gpio2_clk_out));
>
> You include the header but you do not use the defines, so it's a proof
> these are register values. Register values are not bindings, they do not
> bind anything. Bindings are imaginary numbers starting from 0 or 1 which
> are used between drivers and DTS, serving as abstraction layer (or
> abstraction values) between these two.
>
> You do not have here abstraction. Drop the bindings header entirely.
>
Ok, thanks for the explanation.
Best regards,
Dimitri Fedrau
prev parent reply other threads:[~2024-12-11 10:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 8:04 [PATCH net-next v2 0/2] net: phy: dp83822: Add support for GPIO2 clock output Dimitri Fedrau
2024-12-11 8:04 ` Dimitri Fedrau via B4 Relay
2024-12-11 8:04 ` [PATCH net-next v2 1/2] dt-bindings: net: " Dimitri Fedrau
2024-12-11 8:04 ` Dimitri Fedrau via B4 Relay
2024-12-11 9:43 ` Krzysztof Kozlowski
2024-12-11 10:51 ` Dimitri Fedrau
2024-12-11 13:40 ` Krzysztof Kozlowski
2024-12-11 8:04 ` [PATCH net-next v2 2/2] net: phy: " Dimitri Fedrau
2024-12-11 8:04 ` Dimitri Fedrau via B4 Relay
2024-12-11 9:45 ` Krzysztof Kozlowski
2024-12-11 10:52 ` Dimitri Fedrau [this message]
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=20241211105242.GB4424@debian \
--to=dima.fedrau@gmail.com \
--cc=afd@ti.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dimitri.fedrau@liebherr.com \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.