netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Ryan.Wanner@microchip.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
	krzk+dt@kernel.org, conor+dt@kernel.org,
	nicolas.ferre@microchip.com, claudiu.beznea@tuxon.dev,
	netdev@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] net: cadence: macb: Expose REFCLK as a device tree property
Date: Fri, 20 Jun 2025 11:25:01 +0100	[thread overview]
Message-ID: <20250620102501.GF194429@horms.kernel.org> (raw)
In-Reply-To: <c5de54b31ed4a206827dfaf359b0bb9042aaca74.1750346271.git.Ryan.Wanner@microchip.com>

On Thu, Jun 19, 2025 at 10:04:14AM -0700, Ryan.Wanner@microchip.com wrote:
> From: Ryan Wanner <Ryan.Wanner@microchip.com>
> 
> The RMII and RGMII can both support internal or external provided
> REFCLKs 50MHz and 125MHz respectively. Since this is dependent on
> the board that the SoC is on this needs to be set via the device tree.
> 
> This property flag is checked in the MACB DT node so the REFCLK cap is
> configured the correct way for the RMII or RGMII is configured on the
> board.
> 
> Signed-off-by: Ryan Wanner <Ryan.Wanner@microchip.com>
> ---
>  drivers/net/ethernet/cadence/macb_main.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index d1f1ae5ea161..146e532543a1 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -4109,6 +4109,8 @@ static const struct net_device_ops macb_netdev_ops = {
>  static void macb_configure_caps(struct macb *bp,
>  				const struct macb_config *dt_conf)
>  {
> +	struct device_node *np = bp->pdev->dev.of_node;
> +	bool refclk_ext = of_property_present(np, "cdns,refclk-ext");
>  	u32 dcfg;

Hi Ryan,

Some minor feedback from my side.

1. of_property_read_bool() seems slightly more appropriate here
2. Please consider arranging local variables in Networking code
   in reverse xmas tree order - longest line to shortest.

   This tool can be helpful for this
   https://github.com/ecree-solarflare/xmastree

	struct device_node *np = bp->pdev->dev.of_node;
	bool refclk_ext;
	u32 dcfg;

	refclk_ext = of_property_read_bool(np, "cdns,refclk-ext");

...

  reply	other threads:[~2025-06-20 10:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19 17:04 [PATCH 0/3] Expose REFCLK for RMII and enable RMII Ryan.Wanner
2025-06-19 17:04 ` [PATCH 1/3] dt-bindings: net: cdns,macb: Add external REFCLK property Ryan.Wanner
2025-06-20 14:22   ` Conor Dooley
2025-06-19 17:04 ` [PATCH 2/3] net: cadence: macb: Expose REFCLK as a device tree property Ryan.Wanner
2025-06-20 10:25   ` Simon Horman [this message]
2025-06-19 17:04 ` [PATCH 3/3] net: cadence: macb: Enable RMII for SAMA7 gem Ryan.Wanner
2025-06-21  7:24 ` [PATCH 0/3] Expose REFCLK for RMII and enable RMII Andrew Lunn
2025-06-23 16:16   ` Ryan Wanner
2025-06-23 17:47     ` Andrew Lunn

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=20250620102501.GF194429@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=Ryan.Wanner@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --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 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).