u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@amd.com>
To: <u-boot@lists.denx.de>, <git@xilinx.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>
Subject: [PATCH] net: gem: Check rate before setting it up
Date: Fri, 26 Aug 2022 10:30:47 +0200	[thread overview]
Message-ID: <bc465ffd4904bfd65208b782daa06732b915db54.1661502645.git.michal.simek@amd.com> (raw)

On QEMU setting rate for fixed clock is failing. That's why check a rate
first if the rate is the same there is no need to ask for the change.

Signed-off-by: Michal Simek <michal.simek@amd.com>
---

 drivers/net/zynq_gem.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index 4e8dd4badd6b..61a6c83e335d 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -500,10 +500,13 @@ static int zynq_gem_init(struct udevice *dev)
 	}
 #endif
 
-	ret = clk_set_rate(&priv->tx_clk, clk_rate);
-	if (IS_ERR_VALUE(ret)) {
-		dev_err(dev, "failed to set tx clock rate\n");
-		return ret;
+	ret = clk_get_rate(&priv->tx_clk);
+	if (ret != clk_rate) {
+		ret = clk_set_rate(&priv->tx_clk, clk_rate);
+		if (IS_ERR_VALUE(ret)) {
+			dev_err(dev, "failed to set tx clock rate %ld\n", clk_rate);
+			return ret;
+		}
 	}
 
 	ret = clk_enable(&priv->tx_clk);
-- 
2.36.1


             reply	other threads:[~2022-08-26  8:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26  8:30 Michal Simek [this message]
2022-08-31  8:14 ` [PATCH] net: gem: Check rate before setting it up Michal Simek

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=bc465ffd4904bfd65208b782daa06732b915db54.1661502645.git.michal.simek@amd.com \
    --to=michal.simek@amd.com \
    --cc=git@xilinx.com \
    --cc=joe.hershberger@ni.com \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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).