Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1517407 > unrolled thread

[PATCH 1/10] clk: sunxi-ng: multiplier: Add fractionnal support

Started byMaxime Ripard <maxime.ripard@free-electrons.com>
First post2016-11-08 18:30 +0100
Last post2016-11-10 07:20 +0100
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.


Contents

  [PATCH 1/10] clk: sunxi-ng: multiplier: Add fractionnal support Maxime Ripard <maxime.ripard@free-electrons.com> - 2016-11-08 18:30 +0100
    Re: [PATCH 1/10] clk: sunxi-ng: multiplier: Add fractionnal support Chen-Yu Tsai <wens@csie.org> - 2016-11-10 07:20 +0100

#1517407 — [PATCH 1/10] clk: sunxi-ng: multiplier: Add fractionnal support

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2016-11-08 18:30 +0100
Subject[PATCH 1/10] clk: sunxi-ng: multiplier: Add fractionnal support
Message-ID<sBinD-3Pq-13@gated-at.bofh.it>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clk/sunxi-ng/ccu_mult.c | 8 ++++++++
 drivers/clk/sunxi-ng/ccu_mult.h | 2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mult.c
index 678b6cb49f01..826302464650 100644
--- a/drivers/clk/sunxi-ng/ccu_mult.c
+++ b/drivers/clk/sunxi-ng/ccu_mult.c
@@ -75,6 +75,9 @@ static unsigned long ccu_mult_recalc_rate(struct clk_hw *hw,
 	unsigned long val;
 	u32 reg;
 
+	if (ccu_frac_helper_is_enabled(&cm->common, &cm->frac))
+		return ccu_frac_helper_read_rate(&cm->common, &cm->frac);
+
 	reg = readl(cm->common.base + cm->common.reg);
 	val = reg >> cm->mult.shift;
 	val &= (1 << cm->mult.width) - 1;
@@ -102,6 +105,11 @@ static int ccu_mult_set_rate(struct clk_hw *hw, unsigned long rate,
 	unsigned long flags;
 	u32 reg;
 
+	if (ccu_frac_helper_has_rate(&cm->common, &cm->frac, rate))
+		return ccu_frac_helper_set_rate(&cm->common, &cm->frac, rate);
+	else
+		ccu_frac_helper_disable(&cm->common, &cm->frac);
+
 	ccu_mux_helper_adjust_parent_for_prediv(&cm->common, &cm->mux, -1,
 						&parent_rate);
 
diff --git a/drivers/clk/sunxi-ng/ccu_mult.h b/drivers/clk/sunxi-ng/ccu_mult.h
index c1a2134bdc71..bd2e38b5a32a 100644
--- a/drivers/clk/sunxi-ng/ccu_mult.h
+++ b/drivers/clk/sunxi-ng/ccu_mult.h
@@ -2,6 +2,7 @@
 #define _CCU_MULT_H_
 
 #include "ccu_common.h"
+#include "ccu_frac.h"
 #include "ccu_mux.h"
 
 struct ccu_mult_internal {
@@ -23,6 +24,7 @@ struct ccu_mult_internal {
 struct ccu_mult {
 	u32			enable;
 
+	struct ccu_frac_internal	frac;
 	struct ccu_mult_internal	mult;
 	struct ccu_mux_internal	mux;
 	struct ccu_common	common;
-- 
git-series 0.8.11

[toc] | [next] | [standalone]


#1518706

FromChen-Yu Tsai <wens@csie.org>
Date2016-11-10 07:20 +0100
Message-ID<sBQSl-1Ob-11@gated-at.bofh.it>
In reply to#1517407
On Wed, Nov 9, 2016 at 1:23 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Nit: Typo in the subject ("fractional"). Maybe mention what clock on what SoC
needs this in the commit message?

Otherwise,

Acked-by: Chen-Yu Tsai <wens@csie.org>

> ---
>  drivers/clk/sunxi-ng/ccu_mult.c | 8 ++++++++
>  drivers/clk/sunxi-ng/ccu_mult.h | 2 ++
>  2 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/clk/sunxi-ng/ccu_mult.c b/drivers/clk/sunxi-ng/ccu_mult.c
> index 678b6cb49f01..826302464650 100644
> --- a/drivers/clk/sunxi-ng/ccu_mult.c
> +++ b/drivers/clk/sunxi-ng/ccu_mult.c
> @@ -75,6 +75,9 @@ static unsigned long ccu_mult_recalc_rate(struct clk_hw *hw,
>         unsigned long val;
>         u32 reg;
>
> +       if (ccu_frac_helper_is_enabled(&cm->common, &cm->frac))
> +               return ccu_frac_helper_read_rate(&cm->common, &cm->frac);
> +
>         reg = readl(cm->common.base + cm->common.reg);
>         val = reg >> cm->mult.shift;
>         val &= (1 << cm->mult.width) - 1;
> @@ -102,6 +105,11 @@ static int ccu_mult_set_rate(struct clk_hw *hw, unsigned long rate,
>         unsigned long flags;
>         u32 reg;
>
> +       if (ccu_frac_helper_has_rate(&cm->common, &cm->frac, rate))
> +               return ccu_frac_helper_set_rate(&cm->common, &cm->frac, rate);
> +       else
> +               ccu_frac_helper_disable(&cm->common, &cm->frac);
> +
>         ccu_mux_helper_adjust_parent_for_prediv(&cm->common, &cm->mux, -1,
>                                                 &parent_rate);
>
> diff --git a/drivers/clk/sunxi-ng/ccu_mult.h b/drivers/clk/sunxi-ng/ccu_mult.h
> index c1a2134bdc71..bd2e38b5a32a 100644
> --- a/drivers/clk/sunxi-ng/ccu_mult.h
> +++ b/drivers/clk/sunxi-ng/ccu_mult.h
> @@ -2,6 +2,7 @@
>  #define _CCU_MULT_H_
>
>  #include "ccu_common.h"
> +#include "ccu_frac.h"
>  #include "ccu_mux.h"
>
>  struct ccu_mult_internal {
> @@ -23,6 +24,7 @@ struct ccu_mult_internal {
>  struct ccu_mult {
>         u32                     enable;
>
> +       struct ccu_frac_internal        frac;
>         struct ccu_mult_internal        mult;
>         struct ccu_mux_internal mux;
>         struct ccu_common       common;
> --
> git-series 0.8.11

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web