From: Jerome Brunet <jbrunet@baylibre.com>
To: Stephen Boyd <sboyd@codeaurora.org>,
Michael Turquette <mturquette@baylibre.com>,
linux-clk@vger.kernel.org
Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
Vladimir Zapolskiy <vz@mleia.com>,
David Brown <david.brown@linaro.org>,
Sylvain Lemieux <slemieux.tyco@gmail.com>,
Andy Gross <andy.gross@linaro.org>,
linux-arm-kernel@lists.infradead.org,
Jerome Brunet <jbrunet@baylibre.com>
Subject: [PATCH 1/5] clk: divider: read-only divider can propagate rate change
Date: Fri, 5 Jan 2018 18:09:55 +0100 [thread overview]
Message-ID: <20180105170959.17266-2-jbrunet@baylibre.com> (raw)
In-Reply-To: <20180105170959.17266-1-jbrunet@baylibre.com>
When a divider clock has CLK_DIVIDER_READ_ONLY set, it means that the
register shall be left un-touched, but it does not mean the clock
should stop rate propagation if CLK_SET_RATE_PARENT is set
This is properly handled in qcom clk-regmap-divider but it was not in
the generic divider
Fixes: e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
drivers/clk/clk-divider.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index b49942b9fe50..a851d3e04c7f 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -348,6 +348,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
struct clk_divider *divider = to_clk_divider(hw);
+ struct clk_hw *hw_parent = clk_hw_get_parent(hw);
int bestdiv;
/* if read only, just return current value */
@@ -356,6 +357,15 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
bestdiv &= div_mask(divider->width);
bestdiv = _get_div(divider->table, bestdiv, divider->flags,
divider->width);
+
+ /* Even a read-only clock can propagate a rate change */
+ if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
+ if (!hw_parent)
+ return -EINVAL;
+
+ *prate = clk_hw_round_rate(hw_parent, rate * bestdiv);
+ }
+
return DIV_ROUND_UP_ULL((u64)*prate, bestdiv);
}
--
2.14.3
WARNING: multiple messages have this Message-ID (diff)
From: Jerome Brunet <jbrunet@baylibre.com>
To: Stephen Boyd <sboyd@codeaurora.org>,
Michael Turquette <mturquette@baylibre.com>,
linux-clk@vger.kernel.org
Cc: Jerome Brunet <jbrunet@baylibre.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, Vladimir Zapolskiy <vz@mleia.com>,
Sylvain Lemieux <slemieux.tyco@gmail.com>,
Andy Gross <andy.gross@linaro.org>,
David Brown <david.brown@linaro.org>
Subject: [PATCH 1/5] clk: divider: read-only divider can propagate rate change
Date: Fri, 5 Jan 2018 18:09:55 +0100 [thread overview]
Message-ID: <20180105170959.17266-2-jbrunet@baylibre.com> (raw)
In-Reply-To: <20180105170959.17266-1-jbrunet@baylibre.com>
When a divider clock has CLK_DIVIDER_READ_ONLY set, it means that the
register shall be left un-touched, but it does not mean the clock
should stop rate propagation if CLK_SET_RATE_PARENT is set
This is properly handled in qcom clk-regmap-divider but it was not in
the generic divider
Fixes: e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
drivers/clk/clk-divider.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index b49942b9fe50..a851d3e04c7f 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -348,6 +348,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
struct clk_divider *divider = to_clk_divider(hw);
+ struct clk_hw *hw_parent = clk_hw_get_parent(hw);
int bestdiv;
/* if read only, just return current value */
@@ -356,6 +357,15 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
bestdiv &= div_mask(divider->width);
bestdiv = _get_div(divider->table, bestdiv, divider->flags,
divider->width);
+
+ /* Even a read-only clock can propagate a rate change */
+ if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
+ if (!hw_parent)
+ return -EINVAL;
+
+ *prate = clk_hw_round_rate(hw_parent, rate * bestdiv);
+ }
+
return DIV_ROUND_UP_ULL((u64)*prate, bestdiv);
}
--
2.14.3
WARNING: multiple messages have this Message-ID (diff)
From: jbrunet@baylibre.com (Jerome Brunet)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5] clk: divider: read-only divider can propagate rate change
Date: Fri, 5 Jan 2018 18:09:55 +0100 [thread overview]
Message-ID: <20180105170959.17266-2-jbrunet@baylibre.com> (raw)
In-Reply-To: <20180105170959.17266-1-jbrunet@baylibre.com>
When a divider clock has CLK_DIVIDER_READ_ONLY set, it means that the
register shall be left un-touched, but it does not mean the clock
should stop rate propagation if CLK_SET_RATE_PARENT is set
This is properly handled in qcom clk-regmap-divider but it was not in
the generic divider
Fixes: e6d5e7d90be9 ("clk-divider: Fix READ_ONLY when divider > 1")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
---
drivers/clk/clk-divider.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index b49942b9fe50..a851d3e04c7f 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -348,6 +348,7 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *prate)
{
struct clk_divider *divider = to_clk_divider(hw);
+ struct clk_hw *hw_parent = clk_hw_get_parent(hw);
int bestdiv;
/* if read only, just return current value */
@@ -356,6 +357,15 @@ static long clk_divider_round_rate(struct clk_hw *hw, unsigned long rate,
bestdiv &= div_mask(divider->width);
bestdiv = _get_div(divider->table, bestdiv, divider->flags,
divider->width);
+
+ /* Even a read-only clock can propagate a rate change */
+ if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) {
+ if (!hw_parent)
+ return -EINVAL;
+
+ *prate = clk_hw_round_rate(hw_parent, rate * bestdiv);
+ }
+
return DIV_ROUND_UP_ULL((u64)*prate, bestdiv);
}
--
2.14.3
next prev parent reply other threads:[~2018-01-05 17:09 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-05 17:09 [PATCH 0/5] clk: read-only dividers and rate propagation fixup Jerome Brunet
2018-01-05 17:09 ` Jerome Brunet
2018-01-05 17:09 ` Jerome Brunet [this message]
2018-01-05 17:09 ` [PATCH 1/5] clk: divider: read-only divider can propagate rate change Jerome Brunet
2018-01-05 17:09 ` Jerome Brunet
2018-01-11 22:55 ` [1/5] " David Lechner
2018-01-11 22:55 ` David Lechner
2018-01-17 16:39 ` Jerome Brunet
2018-01-17 16:39 ` Jerome Brunet
2018-01-05 17:09 ` [PATCH 2/5] clk: lpc32xx: " Jerome Brunet
2018-01-05 17:09 ` Jerome Brunet
2018-01-05 18:12 ` Vladimir Zapolskiy
2018-01-05 18:12 ` Vladimir Zapolskiy
2018-01-05 19:40 ` Jerome Brunet
2018-01-05 19:40 ` Jerome Brunet
2018-01-06 14:04 ` Vladimir Zapolskiy
2018-01-06 14:04 ` Vladimir Zapolskiy
2018-01-08 9:10 ` Jerome Brunet
2018-01-08 9:10 ` Jerome Brunet
2018-01-05 17:09 ` [PATCH 3/5] clk: divider: add divider_ro_round_rate helper Jerome Brunet
2018-01-05 17:09 ` Jerome Brunet
2018-01-11 23:08 ` [3/5] " David Lechner
2018-01-11 23:08 ` David Lechner
2018-01-17 17:47 ` Jerome Brunet
2018-01-17 17:47 ` Jerome Brunet
2018-01-17 17:55 ` David Lechner
2018-01-17 17:55 ` David Lechner
2018-01-05 17:09 ` [PATCH 4/5] clk: lpc32xx: use " Jerome Brunet
2018-01-05 17:09 ` Jerome Brunet
2018-01-05 17:09 ` [PATCH 5/5] clk: qcom: " Jerome Brunet
2018-01-05 17:09 ` Jerome Brunet
2018-01-08 10:04 ` Jerome Brunet
2018-01-08 10:04 ` Jerome Brunet
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=20180105170959.17266-2-jbrunet@baylibre.com \
--to=jbrunet@baylibre.com \
--cc=andy.gross@linaro.org \
--cc=david.brown@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@codeaurora.org \
--cc=slemieux.tyco@gmail.com \
--cc=vz@mleia.com \
/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.