All of lore.kernel.org
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert+renesas@glider.be>
To: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>
Cc: Takeshi Kihara <takeshi.kihara.df@renesas.com>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>
Subject: [PATCH 01/11] clk: renesas: rcar-gen3: Add support for OSC EXTAL predivider
Date: Wed, 11 Jul 2018 16:20:50 +0200	[thread overview]
Message-ID: <20180711142100.3765-2-geert+renesas@glider.be> (raw)
In-Reply-To: <20180711142100.3765-1-geert+renesas@glider.be>

Add a clock type and macro for defining clocks using the OSC EXTAL
predivider combined with a fixed divider.

On most R-Car Gen3 SoCs, the predivider value depends on mode pins, and
thus must be specified in the configuration structure.

Inspired by a patch in the BSP by Takeshi Kihara
<takeshi.kihara.df@renesas.com>.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/clk/renesas/rcar-gen3-cpg.c | 7 +++++++
 drivers/clk/renesas/rcar-gen3-cpg.h | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/clk/renesas/rcar-gen3-cpg.c b/drivers/clk/renesas/rcar-gen3-cpg.c
index 628b63b85d3f09c5..7533a51c679bfd54 100644
--- a/drivers/clk/renesas/rcar-gen3-cpg.c
+++ b/drivers/clk/renesas/rcar-gen3-cpg.c
@@ -563,6 +563,13 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev,
 		return cpg_z_clk_register(core->name, __clk_get_name(parent),
 					  base, CPG_FRQCRC_Z2FC_MASK);
 
+	case CLK_TYPE_GEN3_OSC:
+		/*
+		 * Clock combining OSC EXTAL predivider and a fixed divider
+		 */
+		div = cpg_pll_config->osc_prediv * core->div;
+		break;
+
 	default:
 		return ERR_PTR(-EINVAL);
 	}
diff --git a/drivers/clk/renesas/rcar-gen3-cpg.h b/drivers/clk/renesas/rcar-gen3-cpg.h
index ea4f8fc3c4c972e7..d7d84d9e4a1c9c8b 100644
--- a/drivers/clk/renesas/rcar-gen3-cpg.h
+++ b/drivers/clk/renesas/rcar-gen3-cpg.h
@@ -23,6 +23,7 @@ enum rcar_gen3_clk_types {
 	CLK_TYPE_GEN3_PE,
 	CLK_TYPE_GEN3_Z,
 	CLK_TYPE_GEN3_Z2,
+	CLK_TYPE_GEN3_OSC,	/* OSC EXTAL predivider and fixed divider */
 };
 
 #define DEF_GEN3_SD(_name, _id, _parent, _offset)	\
@@ -33,6 +34,8 @@ enum rcar_gen3_clk_types {
 	DEF_BASE(_name, _id, CLK_TYPE_GEN3_PE,			\
 		 (_parent_sscg) << 16 | (_parent_clean),	\
 		 .div = (_div_sscg) << 16 | (_div_clean))
+#define DEF_GEN3_OSC(_name, _id, _parent, _div)		\
+	DEF_BASE(_name, _id, CLK_TYPE_GEN3_OSC, _parent, .div = _div)
 
 struct rcar_gen3_cpg_pll_config {
 	u8 extal_div;
@@ -40,6 +43,7 @@ struct rcar_gen3_cpg_pll_config {
 	u8 pll1_div;
 	u8 pll3_mult;
 	u8 pll3_div;
+	u8 osc_prediv;
 };
 
 #define CPG_RCKCR	0x240
-- 
2.17.1

  reply	other threads:[~2018-07-11 14:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 14:20 [PATCH 00/11] clk: renesas: rcar-gen3: OSC and RCLK improvements Geert Uytterhoeven
2018-07-11 14:20 ` Geert Uytterhoeven [this message]
2018-07-11 14:20 ` [PATCH 02/11] clk: renesas: r8a7795: Add OSC EXTAL predivider configuration Geert Uytterhoeven
2018-07-11 14:20 ` [PATCH 03/11] clk: renesas: r8a7796: " Geert Uytterhoeven
2018-07-11 14:20 ` [PATCH 04/11] clk: renesas: r8a77965: " Geert Uytterhoeven
2018-07-11 14:20 ` [PATCH 05/11] clk: renesas: r8a77980: Add OSC predivider configuration and clock Geert Uytterhoeven
2018-07-12 13:56   ` Simon Horman
2018-07-12 14:23     ` Geert Uytterhoeven
2018-07-11 14:20 ` [PATCH 06/11] clk: renesas: cpg-mssr: Add support for fixed rate clocks Geert Uytterhoeven
2018-07-11 14:20 ` [PATCH 07/11] clk: renesas: rcar-gen3: Add support for RCKSEL clock selection Geert Uytterhoeven
2018-07-12 14:02   ` Simon Horman
2018-07-11 14:20 ` [PATCH 08/11] clk: renesas: r8a77990: Correct RCLK handling Geert Uytterhoeven
2018-07-11 14:20 ` [PATCH 09/11] clk: renesas: r8a77995: " Geert Uytterhoeven
2018-07-11 14:20 ` [PATCH 10/11] clk: renesas: rcar-gen3: Add support for mode pin clock selection Geert Uytterhoeven
2018-07-11 14:21 ` [PATCH 11/11] clk: renesas: r8a77980: Add RCLK for watchdog timer Geert Uytterhoeven
2018-07-12 14:35 ` [PATCH 00/11] clk: renesas: rcar-gen3: OSC and RCLK improvements Simon Horman

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=20180711142100.3765-2-geert+renesas@glider.be \
    --to=geert+renesas@glider.be \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=takeshi.kihara.df@renesas.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.