linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Thierry Reding <thierry.reding@gmail.com>,
	Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org, Stephen Boyd <sboyd@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Jon Hunter <jonathanh@nvidia.com>, Joseph Lo <josephl@nvidia.com>,
	linux-tegra@vger.kernel.org, Dmitry Osipenko <digetx@gmail.com>,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 14/14] clk: tegra: Remove the old emc_mux clock for Tegra210
Date: Thu,  9 Apr 2020 19:52:38 +0200	[thread overview]
Message-ID: <20200409175238.3586487-15-thierry.reding@gmail.com> (raw)
In-Reply-To: <20200409175238.3586487-1-thierry.reding@gmail.com>

From: Joseph Lo <josephl@nvidia.com>

Remove the old emc_mux clock and don't use the common EMC clock
definition. This will be replaced by a new clock defined in the
EMC driver.

Signed-off-by: Joseph Lo <josephl@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/clk/tegra/clk-tegra210.c | 50 ++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 19 deletions(-)

diff --git a/drivers/clk/tegra/clk-tegra210.c b/drivers/clk/tegra/clk-tegra210.c
index 798920ec50e9..f2bb188fbc6a 100644
--- a/drivers/clk/tegra/clk-tegra210.c
+++ b/drivers/clk/tegra/clk-tegra210.c
@@ -319,12 +319,6 @@ static unsigned long tegra210_input_freq[] = {
 	[8] = 12000000,
 };
 
-static const char *mux_pllmcp_clkm[] = {
-	"pll_m", "pll_c", "pll_p", "clk_m", "pll_m_ud", "pll_mb", "pll_mb",
-	"pll_p",
-};
-#define mux_pllmcp_clkm_idx NULL
-
 #define PLL_ENABLE			(1 << 30)
 
 #define PLLCX_MISC1_IDDQ		(1 << 27)
@@ -2336,7 +2330,6 @@ static struct tegra_clk tegra210_clks[tegra_clk_max] __initdata = {
 	[tegra_clk_i2c2] = { .dt_id = TEGRA210_CLK_I2C2, .present = true },
 	[tegra_clk_uartc_8] = { .dt_id = TEGRA210_CLK_UARTC, .present = true },
 	[tegra_clk_mipi_cal] = { .dt_id = TEGRA210_CLK_MIPI_CAL, .present = true },
-	[tegra_clk_emc] = { .dt_id = TEGRA210_CLK_EMC, .present = true },
 	[tegra_clk_usb2] = { .dt_id = TEGRA210_CLK_USB2, .present = true },
 	[tegra_clk_bsev] = { .dt_id = TEGRA210_CLK_BSEV, .present = true },
 	[tegra_clk_uartd_8] = { .dt_id = TEGRA210_CLK_UARTD, .present = true },
@@ -2979,6 +2972,27 @@ static const char * const sor1_parents[] = {
 
 static u32 sor1_parents_idx[] = { 0, 2, 5, 6 };
 
+static const struct clk_div_table mc_div_table_tegra210[] = {
+	{ .val = 0, .div = 2 },
+	{ .val = 1, .div = 4 },
+	{ .val = 2, .div = 1 },
+	{ .val = 3, .div = 2 },
+	{ .val = 0, .div = 0 },
+};
+
+static void tegra210_clk_register_mc(const char *name,
+				     const char *parent_name)
+{
+	struct clk *clk;
+
+	clk = clk_register_divider_table(NULL, name, parent_name,
+					 CLK_IS_CRITICAL,
+					 clk_base + CLK_SOURCE_EMC,
+					 15, 2, CLK_DIVIDER_READ_ONLY,
+					 mc_div_table_tegra210, &emc_lock);
+	clks[TEGRA210_CLK_MC] = clk;
+}
+
 static const char * const sor1_out_parents[] = {
 	/*
 	 * Bit 0 of the mux selects sor1_pad_clkout, irrespective of bit 1, so
@@ -3021,7 +3035,8 @@ static const char * const la_parents[] = {
 static struct tegra_clk_periph tegra210_la =
 	TEGRA_CLK_PERIPH(29, 7, 9, 0, 8, 1, TEGRA_DIVIDER_ROUND_UP, 76, 0, NULL, NULL);
 
-static __init void tegra210_periph_clk_init(void __iomem *clk_base,
+static __init void tegra210_periph_clk_init(struct device_node *np,
+					    void __iomem *clk_base,
 					    void __iomem *pmc_base)
 {
 	struct clk *clk;
@@ -3067,16 +3082,6 @@ static __init void tegra210_periph_clk_init(void __iomem *clk_base,
 			CLK_SOURCE_LA, 0);
 	clks[TEGRA210_CLK_LA] = clk;
 
-	/* emc mux */
-	clk = clk_register_mux(NULL, "emc_mux", mux_pllmcp_clkm,
-			       ARRAY_SIZE(mux_pllmcp_clkm), 0,
-			       clk_base + CLK_SOURCE_EMC,
-			       29, 3, 0, &emc_lock);
-
-	clk = tegra_clk_register_mc("mc", "emc_mux", clk_base + CLK_SOURCE_EMC,
-				    &emc_lock);
-	clks[TEGRA210_CLK_MC] = clk;
-
 	/* cml0 */
 	clk = clk_register_gate(NULL, "cml0", "pll_e", 0, clk_base + PLLE_AUX,
 				0, 0, &pll_e_lock);
@@ -3119,6 +3124,13 @@ static __init void tegra210_periph_clk_init(void __iomem *clk_base,
 	}
 
 	tegra_periph_clk_init(clk_base, pmc_base, tegra210_clks, &pll_p_params);
+
+	/* emc */
+	clk = tegra210_clk_register_emc(np, clk_base);
+	clks[TEGRA210_CLK_EMC] = clk;
+
+	/* mc */
+	tegra210_clk_register_mc("mc", "emc");
 }
 
 static void __init tegra210_pll_init(void __iomem *clk_base,
@@ -3717,7 +3729,7 @@ static void __init tegra210_clock_init(struct device_node *np)
 
 	tegra_fixed_clk_init(tegra210_clks);
 	tegra210_pll_init(clk_base, pmc_base);
-	tegra210_periph_clk_init(clk_base, pmc_base);
+	tegra210_periph_clk_init(np, clk_base, pmc_base);
 	tegra_audio_clk_init(clk_base, pmc_base, tegra210_clks,
 			     tegra210_audio_plls,
 			     ARRAY_SIZE(tegra210_audio_plls), 24576000);
-- 
2.24.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

      parent reply	other threads:[~2020-04-09 17:56 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 17:52 [PATCH v6 00/14] Add EMC scaling support for Tegra210 Thierry Reding
2020-04-09 17:52 ` [PATCH v6 01/14] dt-bindings: reserved-memory: Introduce memory-region-names Thierry Reding
2020-04-15 16:23   ` Rob Herring
2020-04-09 17:52 ` [PATCH v6 02/14] of: reserved-memory: Support lookup of regions by name Thierry Reding
2020-04-15 16:24   ` Rob Herring
2020-04-15 23:35     ` Thierry Reding
2020-04-16  0:58       ` Rob Herring
2020-04-09 17:52 ` [PATCH v6 03/14] of: reserved-memory: Support multiple regions per device Thierry Reding
2020-04-15 16:25   ` Rob Herring
2020-04-09 17:52 ` [PATCH v6 04/14] clk: tegra: Rename Tegra124 EMC clock source file Thierry Reding
2020-04-14 16:48   ` Dmitry Osipenko
2020-04-14 17:14     ` Thierry Reding
2020-04-09 17:52 ` [PATCH v6 05/14] clk: tegra: Add PLLP_UD and PLLMB_UD for Tegra210 Thierry Reding
2020-04-09 17:52 ` [PATCH v6 06/14] clk: tegra: Export functions for EMC clock scaling Thierry Reding
2020-04-09 17:52 ` [PATCH v6 07/14] clk: tegra: Implement Tegra210 EMC clock Thierry Reding
2020-04-09 18:24   ` Dmitry Osipenko
2020-04-14 14:34     ` Thierry Reding
2020-04-14 15:18       ` Dmitry Osipenko
2020-04-14 17:10         ` Thierry Reding
2020-04-14 20:22           ` Dmitry Osipenko
2020-04-10 20:49   ` Dmitry Osipenko
2020-04-14 14:36     ` Thierry Reding
2020-04-09 17:52 ` [PATCH v6 08/14] dt-bindings: memory: tegra: Add external memory controller binding for Tegra210 Thierry Reding
2020-04-15 16:27   ` Rob Herring
2020-04-09 17:52 ` [PATCH v6 09/14] memory: tegra: Add EMC scaling support code " Thierry Reding
2020-04-09 19:00   ` Dmitry Osipenko
2020-04-14 14:45     ` Thierry Reding
2020-04-09 19:16   ` Dmitry Osipenko
2020-04-14 14:54     ` Thierry Reding
2020-04-14 20:50       ` Dmitry Osipenko
2020-04-09 23:56   ` Dmitry Osipenko
2020-04-11 20:39     ` Dmitry Osipenko
2020-04-14 15:05       ` Thierry Reding
2020-04-14 15:32         ` Dmitry Osipenko
2020-04-14 15:02     ` Thierry Reding
2020-04-10 14:25   ` Dmitry Osipenko
2020-04-14 15:08     ` Thierry Reding
2020-04-10 14:26   ` Dmitry Osipenko
2020-04-14 15:39     ` Thierry Reding
2020-04-10 20:46   ` Dmitry Osipenko
2020-04-14 15:41     ` Thierry Reding
2020-04-14 20:39   ` Dmitry Osipenko
2020-04-14 20:46   ` Dmitry Osipenko
2020-04-14 20:56     ` Dmitry Osipenko
2020-04-09 17:52 ` [PATCH v6 10/14] memory: tegra: Add EMC scaling sequence " Thierry Reding
2020-04-10 14:18   ` Dmitry Osipenko
2020-04-14 15:45     ` Thierry Reding
2020-04-14 16:27       ` Dmitry Osipenko
2020-04-14 20:03         ` Thierry Reding
2020-04-09 17:52 ` [PATCH v6 11/14] memory: tegra: Support derated timings on Tegra210 Thierry Reding
2020-04-09 23:44   ` Dmitry Osipenko
2020-04-14 15:47     ` Thierry Reding
2020-04-14 16:25       ` Dmitry Osipenko
2020-04-10 14:28   ` Dmitry Osipenko
2020-04-14 16:29     ` Thierry Reding
2020-04-14 16:40   ` Dmitry Osipenko
2020-04-14 16:48     ` Thierry Reding
2020-04-09 17:52 ` [PATCH v6 12/14] arm64: tegra: Add external memory controller node for Tegra210 Thierry Reding
2020-04-09 17:52 ` [PATCH v6 13/14] arm64: tegra: Hook up EMC cooling device Thierry Reding
2020-04-09 17:52 ` Thierry Reding [this message]

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=20200409175238.3586487-15-thierry.reding@gmail.com \
    --to=thierry.reding@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=josephl@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-tegra@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).