All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Ardelean <alexandru.ardelean@analog.com>
To: <linux-clk@vger.kernel.org>, <linux-fpga@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <mturquette@baylibre.com>, <sboyd@kernel.org>, <mdf@kernel.org>,
	<ardeleanalex@gmail.com>, Lars-Peter Clausen <lars@metafoo.de>,
	"Alexandru Ardelean" <alexandru.ardelean@analog.com>
Subject: [PATCH v4 2/7] clk: axi-clkgen: Set power bits for fractional mode
Date: Tue, 29 Sep 2020 17:44:04 +0300	[thread overview]
Message-ID: <20200929144417.89816-3-alexandru.ardelean@analog.com> (raw)
In-Reply-To: <20200929144417.89816-1-alexandru.ardelean@analog.com>

From: Lars-Peter Clausen <lars@metafoo.de>

Using the fractional dividers requires some additional power bits to be
set.

The fractional power bits are not documented and the current heuristic
for setting them seems be insufficient for some cases. Just always set all
the fractional power bits when in fractional mode.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/clk/clk-axi-clkgen.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/clk/clk-axi-clkgen.c b/drivers/clk/clk-axi-clkgen.c
index 1df03cc6d089..14d803e6af62 100644
--- a/drivers/clk/clk-axi-clkgen.c
+++ b/drivers/clk/clk-axi-clkgen.c
@@ -37,6 +37,7 @@
 #define MMCM_REG_LOCK1		0x18
 #define MMCM_REG_LOCK2		0x19
 #define MMCM_REG_LOCK3		0x1a
+#define MMCM_REG_POWER		0x28
 #define MMCM_REG_FILTER1	0x4e
 #define MMCM_REG_FILTER2	0x4f
 
@@ -320,6 +321,7 @@ static int axi_clkgen_set_rate(struct clk_hw *clk_hw,
 	struct axi_clkgen *axi_clkgen = clk_hw_to_axi_clkgen(clk_hw);
 	unsigned int d, m, dout;
 	struct axi_clkgen_div_params params;
+	uint32_t power = 0;
 	uint32_t filter;
 	uint32_t lock;
 
@@ -331,6 +333,11 @@ static int axi_clkgen_set_rate(struct clk_hw *clk_hw,
 	if (d == 0 || dout == 0 || m == 0)
 		return -EINVAL;
 
+	if ((dout & 0x7) != 0 || (m & 0x7) != 0)
+		power |= 0x9800;
+
+	axi_clkgen_mmcm_write(axi_clkgen, MMCM_REG_POWER, power, 0x9800);
+
 	filter = axi_clkgen_lookup_filter(m - 1);
 	lock = axi_clkgen_lookup_lock(m - 1);
 
-- 
2.17.1


  parent reply	other threads:[~2020-09-29 14:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 14:44 [PATCH v4 0/7] clk: axi-clk-gen: misc updates to the driver Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 1/7] clk: axi-clkgen: Add support for fractional dividers Alexandru Ardelean
2020-09-29 14:44 ` Alexandru Ardelean [this message]
2020-09-29 14:44 ` [PATCH v4 3/7] clk: axi-clkgen: add support for ZynqMP (UltraScale) Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 4/7] clk: axi-clkgen: wrap limits in a struct and keep copy on the state object Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 5/7] clk: axi-clkgen: Respect ZYNQMP PFD/VCO frequency limits Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 6/7] include: fpga: adi-axi-common.h: add definitions for supported FPGAs Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 7/7] clk: axi-clkgen: Add support for FPGA info Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 0/7] clk: axi-clk-gen: misc updates to the driver Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 1/7] clk: axi-clkgen: Add support for fractional dividers Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 2/7] clk: axi-clkgen: Set power bits for fractional mode Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 3/7] clk: axi-clkgen: add support for ZynqMP (UltraScale) Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 4/7] clk: axi-clkgen: wrap limits in a struct and keep copy on the state object Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 5/7] clk: axi-clkgen: Respect ZYNQMP PFD/VCO frequency limits Alexandru Ardelean
2020-09-29 15:30   ` Moritz Fischer
2020-09-30  5:22     ` Alexandru Ardelean
2020-09-30 17:16       ` Moritz Fischer
2020-10-01  5:18         ` Alexandru Ardelean
2020-10-01  8:37           ` Alexandru Ardelean
2020-10-01 19:08           ` Moritz Fischer
2020-09-29 14:44 ` [PATCH v4 6/7] include: fpga: adi-axi-common.h: add definitions for supported FPGAs Alexandru Ardelean
2020-09-29 14:44 ` [PATCH v4 7/7] clk: axi-clkgen: Add support for FPGA info Alexandru Ardelean

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=20200929144417.89816-3-alexandru.ardelean@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=ardeleanalex@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@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.