Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1634910 > unrolled thread
| Started by | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| First post | 2017-05-03 14:10 +0200 |
| Last post | 2017-05-04 05:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v2 5/20] clk: sunxi-ng: mux: split out the pre-divider computation code Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-03 14:10 +0200
Re: [PATCH v2 5/20] clk: sunxi-ng: mux: split out the pre-divider computation code Chen-Yu Tsai <wens@csie.org> - 2017-05-04 05:30 +0200
| From | Maxime Ripard <maxime.ripard@free-electrons.com> |
|---|---|
| Date | 2017-05-03 14:10 +0200 |
| Subject | [PATCH v2 5/20] clk: sunxi-ng: mux: split out the pre-divider computation code |
| Message-ID | <tD1gu-5a8-21@gated-at.bofh.it> |
The pre-divider retrieval code was merged into the function to apply the
current pre-divider onto the parent clock rate so that we can use that
adjusted value to do our factors computation.
However, since we'll need to do the reverse operation, we need to split out
that code into a function that will be shared.
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
drivers/clk/sunxi-ng/ccu_mux.c | 32 ++++++++++++++++++++------------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c
index 58b6e349a0ed..3eb23d4e6534 100644
--- a/drivers/clk/sunxi-ng/ccu_mux.c
+++ b/drivers/clk/sunxi-ng/ccu_mux.c
@@ -15,24 +15,20 @@
#include "ccu_gate.h"
#include "ccu_mux.h"
-void ccu_mux_helper_adjust_parent_for_prediv(struct ccu_common *common,
- struct ccu_mux_internal *cm,
- int parent_index,
- unsigned long *parent_rate)
+static u16 ccu_mux_get_prediv(struct ccu_common *common,
+ struct ccu_mux_internal *cm,
+ int parent_index)
{
u16 prediv = 1;
u32 reg;
- int i;
if (!((common->features & CCU_FEATURE_FIXED_PREDIV) ||
(common->features & CCU_FEATURE_VARIABLE_PREDIV) ||
(common->features & CCU_FEATURE_ALL_PREDIV)))
- return;
+ return 1;
- if (common->features & CCU_FEATURE_ALL_PREDIV) {
- *parent_rate = *parent_rate / common->prediv;
- return;
- }
+ if (common->features & CCU_FEATURE_ALL_PREDIV)
+ return common->prediv;
reg = readl(common->base + common->reg);
if (parent_index < 0) {
@@ -40,10 +36,13 @@ void ccu_mux_helper_adjust_parent_for_prediv(struct ccu_common *common,
parent_index &= (1 << cm->width) - 1;
}
- if (common->features & CCU_FEATURE_FIXED_PREDIV)
+ if (common->features & CCU_FEATURE_FIXED_PREDIV) {
+ int i;
+
for (i = 0; i < cm->n_predivs; i++)
if (parent_index == cm->fixed_predivs[i].index)
prediv = cm->fixed_predivs[i].div;
+ }
if (common->features & CCU_FEATURE_VARIABLE_PREDIV)
if (parent_index == cm->variable_prediv.index) {
@@ -54,7 +53,16 @@ void ccu_mux_helper_adjust_parent_for_prediv(struct ccu_common *common,
prediv = div + 1;
}
- *parent_rate = *parent_rate / prediv;
+ return prediv;
+}
+
+void ccu_mux_helper_adjust_parent_for_prediv(struct ccu_common *common,
+ struct ccu_mux_internal *cm,
+ int parent_index,
+ unsigned long *parent_rate)
+{
+ *parent_rate = *parent_rate / ccu_mux_get_prediv(common, cm,
+ parent_index);
}
int ccu_mux_helper_determine_rate(struct ccu_common *common,
--
git-series 0.8.11
[toc] | [next] | [standalone]
| From | Chen-Yu Tsai <wens@csie.org> |
|---|---|
| Date | 2017-05-04 05:30 +0200 |
| Subject | Re: [PATCH v2 5/20] clk: sunxi-ng: mux: split out the pre-divider computation code |
| Message-ID | <tDfCN-6fm-3@gated-at.bofh.it> |
| In reply to | #1634910 |
On Wed, May 3, 2017 at 7:59 PM, Maxime Ripard <maxime.ripard@free-electrons.com> wrote: > The pre-divider retrieval code was merged into the function to apply the > current pre-divider onto the parent clock rate so that we can use that > adjusted value to do our factors computation. > > However, since we'll need to do the reverse operation, we need to split out > that code into a function that will be shared. > > Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Acked-by: Chen-Yu Tsai <wens@csie.org> Seems this would conflict with my "clk: sunxi-ng: Support multiple variable pre-dividers" patch though. We'll see how this works out.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web