linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lubomir Rintel <lkundrak@v3.sk>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH v3 07/13] clk: mmp2: Add the I2S clocks
Date: Wed, 20 May 2020 00:41:45 +0200	[thread overview]
Message-ID: <20200519224151.2074597-8-lkundrak@v3.sk> (raw)
In-Reply-To: <20200519224151.2074597-1-lkundrak@v3.sk>

A pair of fractional clock sources for PLLs and gates.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

---
Changes since v2:
- s/I2C/I2S/

 drivers/clk/mmp/clk-of-mmp2.c | 46 +++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index ac88ea99b7c6..dcdff06a698a 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -67,6 +67,9 @@
 #define MPMU_POSR		0x10
 #define MPMU_UART_PLL		0x14
 #define MPMU_PLL2_CR		0x34
+#define MPMU_I2S0_PLL		0x40
+#define MPMU_I2S1_PLL		0x44
+#define MPMU_ACGR		0x1024
 /* MMP3 specific below */
 #define MPMU_PLL3_CR		0x50
 #define MPMU_PLL3_CTRL1		0x58
@@ -91,6 +94,7 @@ static struct mmp_param_fixed_rate_clk fixed_rate_clks[] = {
 	{MMP2_CLK_CLK32, "clk32", NULL, 0, 32768},
 	{MMP2_CLK_VCTCXO, "vctcxo", NULL, 0, 26000000},
 	{MMP2_CLK_USB_PLL, "usb_pll", NULL, 0, 480000000},
+	{0, "i2s_pll", NULL, 0, 99666667},
 };
 
 static struct mmp_param_pll_clk pll_clks[] = {
@@ -139,6 +143,34 @@ static struct mmp_clk_factor_tbl uart_factor_tbl[] = {
 	{.num = 3521, .den = 689},	/*19.23MHZ */
 };
 
+static struct mmp_clk_factor_masks i2s_factor_masks = {
+	.factor = 2,
+	.num_mask = 0x7fff,
+	.den_mask = 0x1fff,
+	.num_shift = 0,
+	.den_shift = 15,
+	.enable_mask = 0xd0000000,
+};
+
+static struct mmp_clk_factor_tbl i2s_factor_tbl[] = {
+	{.num = 24868, .den =  511},	/*  2.0480 MHz */
+	{.num = 28003, .den =  793},	/*  2.8224 MHz */
+	{.num = 24941, .den = 1025},	/*  4.0960 MHz */
+	{.num = 28003, .den = 1586},	/*  5.6448 MHz */
+	{.num = 31158, .den = 2561},	/*  8.1920 MHz */
+	{.num = 16288, .den = 1845},	/* 11.2896 MHz */
+	{.num = 20772, .den = 2561},	/* 12.2880 MHz */
+	{.num =  8144, .den = 1845},	/* 22.5792 MHz */
+	{.num = 10386, .den = 2561},	/* 24.5760 MHz */
+};
+
+static DEFINE_SPINLOCK(acgr_lock);
+
+static struct mmp_param_gate_clk mpmu_gate_clks[] = {
+	{MMP2_CLK_I2S0, "i2s0_clk", "i2s0_pll", CLK_SET_RATE_PARENT, MPMU_ACGR, 0x200000, 0x200000, 0x0, 0, &acgr_lock},
+	{MMP2_CLK_I2S1, "i2s1_clk", "i2s1_pll", CLK_SET_RATE_PARENT, MPMU_ACGR, 0x100000, 0x100000, 0x0, 0, &acgr_lock},
+};
+
 static void mmp2_main_clk_init(struct mmp2_clk_unit *pxa_unit)
 {
 	struct clk *clk;
@@ -166,6 +198,20 @@ static void mmp2_main_clk_init(struct mmp2_clk_unit *pxa_unit)
 				&uart_factor_masks, uart_factor_tbl,
 				ARRAY_SIZE(uart_factor_tbl), NULL);
 	mmp_clk_add(unit, MMP2_CLK_UART_PLL, clk);
+
+	mmp_clk_register_factor("i2s0_pll", "pll1_4",
+				CLK_SET_RATE_PARENT,
+				pxa_unit->mpmu_base + MPMU_I2S0_PLL,
+				&i2s_factor_masks, i2s_factor_tbl,
+				ARRAY_SIZE(i2s_factor_tbl), NULL);
+	mmp_clk_register_factor("i2s1_pll", "pll1_4",
+				CLK_SET_RATE_PARENT,
+				pxa_unit->mpmu_base + MPMU_I2S1_PLL,
+				&i2s_factor_masks, i2s_factor_tbl,
+				ARRAY_SIZE(i2s_factor_tbl), NULL);
+
+	mmp_register_gate_clks(unit, mpmu_gate_clks, pxa_unit->mpmu_base,
+				ARRAY_SIZE(mpmu_gate_clks));
 }
 
 static DEFINE_SPINLOCK(uart0_lock);
-- 
2.26.2


  parent reply	other threads:[~2020-05-19 22:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 22:41 [PATCH v3 00/13] MMP2 Clock Updates (GPU, Audio, Power Islands) Lubomir Rintel
2020-05-19 22:41 ` [PATCH v3 01/13] clk: mmp: frac: Do not lose last 4 digits of precision Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 02/13] clk: mmp: frac: Allow setting bits other than the numerator/denominator Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 03/13] dt-bindings: marvell,mmp2: Add clock id for the I2S clocks Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 04/13] dt-bindings: marvell,mmp2: Add clock id for the Audio clock Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 05/13] clk: mmp2: Move thermal register defines up a bit Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 06/13] clk: mmp2: Rename mmp2_pll_init() to mmp2_main_clk_init() Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` Lubomir Rintel [this message]
2020-05-28  1:01   ` [PATCH v3 07/13] clk: mmp2: Add the I2S clocks Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 08/13] clk: mmp2: Add the audio clock Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 09/13] dt-bindings: clock: Make marvell,mmp2-clock a power controller Lubomir Rintel
2020-05-26 23:05   ` Rob Herring
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 10/13] dt-bindings: marvell,mmp2: Add ids for the power domains Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 11/13] clk: mmp2: Add support for power islands Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd
2020-05-19 22:41 ` [PATCH v3 12/13] dt-bindings: clock: Add Marvell MMP Audio Clock Controller binding Lubomir Rintel
2020-05-26 23:06   ` Rob Herring
2020-05-28  1:01   ` Stephen Boyd
2020-06-04 20:47   ` Rob Herring
2020-05-19 22:41 ` [PATCH v3 13/13] clk: mmp2: Add audio clock controller driver Lubomir Rintel
2020-05-28  1:01   ` Stephen Boyd

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=20200519224151.2074597-8-lkundrak@v3.sk \
    --to=lkundrak@v3.sk \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).