Skip to contentSkip to conversation

Tegra210 Clock Support

PATCH Superseded Rhyland Klein 5 participants 59 messages May 4, 2015 – May 7, 2015

Subsystems (4)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover Tegra210 Clock Support

This patch series updates the tegra common clock driver and adds support for the Tegra210 clocks. The clocks in Tegra210 changed significantly in some ways from earlier generations, so to support them, we need to extend our base framework a bit and add some new features.

Some patches here also address issues found while adding features and other cleanup type work.

v4:
- Fixed minor checkpatch errors and other typos
- Rebased ontop of linux-next 20150504

v3:
- Added a fix from Andrew Bresticker that was found while testing this code.

Andrew Bresticker (1):
clk: tegra: pll: Fix issues with rates for VCO PLLs

Bill Huang (7):
clk: tegra: pll-params: change misc_reg count from 3 -> 6
clk: tegra: pll: Add logic for SS
clk: tegra: pll: Add code to handle if resets are supported by PLL
clk: tegra: pll: Adjust vco_min if SDM present
clk: tegra: pll: Add dyn_ramp callback
clk: tegra: pll: Add Set_default logic
clk: tegra: Add Super Gen5 Logic

Rhyland Klein (12):
clk: tegra: Modify tegra_audio_clk_init to accept more plls
clk: tegra: periph: add new periph clks and muxes for Tegra210
clk: tegra: pll: add tegra_pll_wait_for_lock to clk header
clk: tegra: pll: simplify clk_enable_path
clk: tegra: pll: update warning msg
clk: tegra: pll: Don't unconditionally set LOCK flags
clk: tegra: pll: Add logic for handling SDM data
clk: tegra: pll: Add logic for out-of-table rates for T210
clk: tegra: pll: Add specialized logic for T210
clk: tegra: pll: Add support for PLLMB for T210
clk: tegra: pll: Fix _pll_ramp_calc_pll logic and
_calc_dynamic_ramp_rate
clk: tegra210: add support for Tegra210 clocks

 .../bindings/clock/nvidia,tegra210-car.txt         |   56 +
 drivers/clk/tegra/Makefile                         |    2 +
 drivers/clk/tegra/clk-id.h                         |   64 +-
 drivers/clk/tegra/clk-pll.c                        |  697 ++++-
 drivers/clk/tegra/clk-tegra-audio.c                |   25 +-
 drivers/clk/tegra/clk-tegra-periph.c               |  257 +-
 drivers/clk/tegra/clk-tegra-super-gen5.c           |  150 ++
 drivers/clk/tegra/clk-tegra114.c                   |   30 +-
 drivers/clk/tegra/clk-tegra124.c                   |   31 +-
 drivers/clk/tegra/clk-tegra20.c                    |   18 +-
 drivers/clk/tegra/clk-tegra210.c                   | 2761 ++++++++++++++++++++
 drivers/clk/tegra/clk-tegra30.c                    |   31 +-
 drivers/clk/tegra/clk.h                            |   90 +-
 include/dt-bindings/clock/tegra210-car.h           |  401 +++
 14 files changed, 4468 insertions(+), 145 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt
 create mode 100644 drivers/clk/tegra/clk-tegra-super-gen5.c
 create mode 100644 drivers/clk/tegra/clk-tegra210.c
 create mode 100644 include/dt-bindings/clock/tegra210-car.h
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v4 1/20 clk: tegra: Modify tegra_audio_clk_init to accept more plls

tegra_audio_clk_init was written expecting a single PLL to be passed in directly. Change this to accept an array which will allow for supporting multiple plls and specifying specific data about them, like their parent, which may change over time.

---
 drivers/clk/tegra/clk-tegra-audio.c |   25 ++++++++++++++++++-------
 drivers/clk/tegra/clk-tegra114.c    |    7 ++++++-
 drivers/clk/tegra/clk-tegra124.c    |    7 ++++++-
 drivers/clk/tegra/clk-tegra30.c     |    7 ++++++-
 drivers/clk/tegra/clk.h             |   18 +++++++++++++++++-
 5 files changed, 53 insertions(+), 11 deletions(-)
drivers/clk/tegra/clk-tegra-audio.c +18 -7
index 5c38aab2c5b8..b7b88660f261 100644
@@ -126,18 +126,29 @@ static struct tegra_audio2x_clk_initdata audio2x_clks[] = {
 
 void __init tegra_audio_clk_init(void __iomem *clk_base,
 			void __iomem *pmc_base, struct tegra_clk *tegra_clks,
-			struct tegra_clk_pll_params *pll_a_params)
+			struct tegra_audio_clk_info *audio_info,
+			int num_plls)
 {
 	struct clk *clk;
 	struct clk **dt_clk;
 	int i;
 
-	/* PLLA */
-	dt_clk = tegra_lookup_dt_id(tegra_clk_pll_a, tegra_clks);
-	if (dt_clk) {
-		clk = tegra_clk_register_pll("pll_a", "pll_p_out1", clk_base,
-				pmc_base, 0, pll_a_params, NULL);
-		*dt_clk = clk;
+	if (!audio_info || num_plls < 1) {
+		pr_err("No audio data passed to tegra_audio_clk_init\n");
+		WARN_ON(1);
+		return;
+	}
+
+	for (i = 0; i < num_plls; i++) {
+		struct tegra_audio_clk_info *info = &audio_info[i];
+
+		dt_clk = tegra_lookup_dt_id(info->clk_id, tegra_clks);
+		if (dt_clk) {
+			clk = tegra_clk_register_pll(info->name, info->parent,
+					clk_base, pmc_base, 0, info->pll_params,
+					NULL);
+			*dt_clk = clk;
+		}
 	}
 
 	/* PLLA_OUT0 */
drivers/clk/tegra/clk-tegra114.c +6 -1
index 8237d16b4075..0d67efb3dd6a 100644
@@ -935,6 +935,10 @@ static u32 mux_pllm_pllc2_c_c3_pllp_plla_idx[] = {
 	[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6,
 };
 
+static struct tegra_audio_clk_info tegra114_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 static struct clk **clks;
 
 static unsigned long osc_freq;
@@ -1483,7 +1487,8 @@ static void __init tegra114_clock_init(struct device_node *np)
 	tegra114_fixed_clk_init(clk_base);
 	tegra114_pll_init(clk_base, pmc_base);
 	tegra114_periph_clk_init(clk_base, pmc_base);
-	tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks,
+			     &tegra114_audio_plls, 1);
 	tegra_pmc_clk_init(pmc_base, tegra114_clks);
 	tegra_super_clk_gen4_init(clk_base, pmc_base, tegra114_clks,
 					&pll_x_params);
drivers/clk/tegra/clk-tegra124.c +6 -1
index 11f857cd5f6a..169e236f3627 100644
@@ -1413,6 +1413,10 @@ static struct tegra_clk_init_table tegra132_init_table[] __initdata = {
 	{TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0},
 };
 
+static struct tegra_audio_clk_info tegra124_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 /**
  * tegra124_clock_apply_init_table - initialize clocks on Tegra124 SoCs
  *
@@ -1489,7 +1493,8 @@ static void __init tegra124_132_clock_init_pre(struct device_node *np)
 	tegra_fixed_clk_init(tegra124_clks);
 	tegra124_pll_init(clk_base, pmc_base);
 	tegra124_periph_clk_init(clk_base, pmc_base);
-	tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks,
+			     tegra124_audio_plls, 1);
 	tegra_pmc_clk_init(pmc_base, tegra124_clks);
 
 	/* For Tegra124 & Tegra132, PLLD is the only source for DSIA & DSIB */
drivers/clk/tegra/clk-tegra30.c +6 -1
index 4b26509fc218..3198c7b7946c 100644
@@ -1406,6 +1406,10 @@ static const struct of_device_id pmc_match[] __initconst = {
 	{},
 };
 
+static struct tegra_audio_clk_info tegra30_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 static void __init tegra30_clock_init(struct device_node *np)
 {
 	struct device_node *node;
@@ -1443,7 +1447,8 @@ static void __init tegra30_clock_init(struct device_node *np)
 	tegra30_pll_init();
 	tegra30_super_clk_init();
 	tegra30_periph_clk_init();
-	tegra_audio_clk_init(clk_base, pmc_base, tegra30_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra30_clks,
+			     &tegra30_audio_plls, 1);
 	tegra_pmc_clk_init(pmc_base, tegra30_clks);
 
 	tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA30_CLK_CLK_MAX);
drivers/clk/tegra/clk.h +17 -1
index 9da799849e04..dfea6f367977 100644
@@ -258,6 +258,21 @@ struct tegra_clk_pll {
 
 #define to_clk_pll(_hw) container_of(_hw, struct tegra_clk_pll, hw)
 
+/**
+ * struct tegra_audio_clk_info - Tegra Audio Clk Information
+ *
+ * @name:	name for the audio pll
+ * @pll_params:	pll_params for audio pll
+ * @clk_id:	clk_ids for the audio pll
+ * @parent:	name of the parent of the audio pll
+ */
+struct tegra_audio_clk_info {
+	char *name;
+	struct tegra_clk_pll_params *pll_params;
+	int clk_id;
+	char *parent;
+};
+
 extern const struct clk_ops tegra_clk_pll_ops;
 extern const struct clk_ops tegra_clk_plle_ops;
 struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,
@@ -607,7 +622,8 @@ void tegra_register_devclks(struct tegra_devclk *dev_clks, int num);
 
 void tegra_audio_clk_init(void __iomem *clk_base,
 			void __iomem *pmc_base, struct tegra_clk *tegra_clks,
-			struct tegra_clk_pll_params *pll_params);
+			struct tegra_audio_clk_info *audio_info,
+			int num_plls);
 
 void tegra_periph_clk_init(void __iomem *clk_base, void __iomem *pmc_base,
 			struct tegra_clk *tegra_clks,
Signature · 1 line
1.7.9.5
Reviewed-by on v4 1/20
#2 lore raw

Re: [PATCH v4 01/20] clk: tegra: Modify tegra_audio_clk_init to accept more plls

Quoted 6 lines · Rhyland Klein

tegra_audio_clk_init was written expecting a single PLL to be passed in directly. Change this to accept an array which will allow for supporting multiple plls and specifying specific data about them, like their parent, which may change over time.

Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#3 lore raw

Re: [PATCH v4 01/20] clk: tegra: Modify tegra_audio_clk_init to accept more plls

In reply to Rhyland Klein

On Mon, May 04, 2015 at 12:37:21PM -0400, Rhyland Klein wrote:
[...]

Quoted 16 lines
drivers/clk/tegra/clk-tegra114.c +4 -0
index 8237d16b4075..0d67efb3dd6a 100644
@@ -935,6 +935,10 @@ static u32 mux_pllm_pllc2_c_c3_pllp_plla_idx[] = {
 	[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6,
 };
 
+static struct tegra_audio_clk_info tegra114_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 static struct clk **clks;
 
 static unsigned long osc_freq;

drivers/clk/tegra/clk-tegra114.c static void __init tegra114_clock_init(struct device_node *np) · line 1491

Quoted 6 lines
drivers/clk/tegra/clk-tegra114.c +2 -1
@@ -1483,7 +1487,8 @@ static void __init tegra114_clock_init(struct device_node *np)
 	tegra114_fixed_clk_init(clk_base);
 	tegra114_pll_init(clk_base, pmc_base);
 	tegra114_periph_clk_init(clk_base, pmc_base);
-	tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks,
+			     &tegra114_audio_plls, 1);

This throws a build warning, it should be tegra114_audio_plls (without the ampersand). Also I think you should use ARRAY_SIZE() instead of hard-coding the number of entries here.

Quoted 19 lines
drivers/clk/tegra/clk-tegra114.c +0 -0
 	tegra_pmc_clk_init(pmc_base, tegra114_clks);
 	tegra_super_clk_gen4_init(clk_base, pmc_base, tegra114_clks,
 					&pll_x_params);
drivers/clk/tegra/clk-tegra124.c +4 -0
index 11f857cd5f6a..169e236f3627 100644
@@ -1413,6 +1413,10 @@ static struct tegra_clk_init_table tegra132_init_table[] __initdata = {
 	{TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0},
 };
 
+static struct tegra_audio_clk_info tegra124_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 /**
  * tegra124_clock_apply_init_table - initialize clocks on Tegra124 SoCs
  *

drivers/clk/tegra/clk-tegra124.c static void __init tegra124_132_clock_init_pre(struct device_node *np) · line 1497

Quoted 6 lines
drivers/clk/tegra/clk-tegra124.c +2 -1
@@ -1489,7 +1493,8 @@ static void __init tegra124_132_clock_init_pre(struct device_node *np)
 	tegra_fixed_clk_init(tegra124_clks);
 	tegra124_pll_init(clk_base, pmc_base);
 	tegra124_periph_clk_init(clk_base, pmc_base);
-	tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks,
+			     tegra124_audio_plls, 1);

ARRAY_SIZE() here as well. The ampersand isn't there in this case...

Quoted 19 lines
drivers/clk/tegra/clk-tegra124.c +0 -0
 	tegra_pmc_clk_init(pmc_base, tegra124_clks);
 
 	/* For Tegra124 & Tegra132, PLLD is the only source for DSIA & DSIB */
drivers/clk/tegra/clk-tegra30.c +4 -0
index 4b26509fc218..3198c7b7946c 100644
@@ -1406,6 +1406,10 @@ static const struct of_device_id pmc_match[] __initconst = {
 	{},
 };
 
+static struct tegra_audio_clk_info tegra30_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 static void __init tegra30_clock_init(struct device_node *np)
 {
 	struct device_node *node;

drivers/clk/tegra/clk-tegra30.c static void __init tegra30_clock_init(struct device_node *np) · line 1451

Quoted 6 lines
drivers/clk/tegra/clk-tegra30.c +2 -1
@@ -1443,7 +1447,8 @@ static void __init tegra30_clock_init(struct device_node *np)
 	tegra30_pll_init();
 	tegra30_super_clk_init();
 	tegra30_periph_clk_init();
-	tegra_audio_clk_init(clk_base, pmc_base, tegra30_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra30_clks,
+			     &tegra30_audio_plls, 1);

Same comments as for Tegra114.

Quoted 1 line
drivers/clk/tegra/clk.h +0 -0

[...]

drivers/clk/tegra/clk.h void tegra_register_devclks(struct tegra_devclk *dev_clks, int num); · line 626

Quoted 7 lines
drivers/clk/tegra/clk.h +2 -1
@@ -607,7 +622,8 @@ void tegra_register_devclks(struct tegra_devclk *dev_clks, int num);
 
 void tegra_audio_clk_init(void __iomem *clk_base,
 			void __iomem *pmc_base, struct tegra_clk *tegra_clks,
-			struct tegra_clk_pll_params *pll_params);
+			struct tegra_audio_clk_info *audio_info,
+			int num_plls);

Oh, and make num_plls unsigned int, please.

Thierry

#4 lore raw

Re: [PATCH v4 01/20] clk: tegra: Modify tegra_audio_clk_init to accept more plls

Quoted 18 lines · Thierry Reding

* PGP Signed by an unknown key

On Mon, May 04, 2015 at 12:37:21PM -0400, Rhyland Klein wrote:
[...]

Quoted 14 lines
drivers/clk/tegra/clk-tegra114.c +4 -0
index 8237d16b4075..0d67efb3dd6a 100644
@@ -935,6 +935,10 @@ static u32 mux_pllm_pllc2_c_c3_pllp_plla_idx[] = {
 	[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6,
 };
 
+static struct tegra_audio_clk_info tegra114_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 static struct clk **clks;
 
Quoted 12 lines

drivers/clk/tegra/clk-tegra114.c static void __init tegra114_clock_init(struct device_node *np) · line 1491

Quoted 8 lines
drivers/clk/tegra/clk-tegra114.c +2 -1
 static unsigned long osc_freq;
@@ -1483,7 +1487,8 @@ static void __init tegra114_clock_init(struct device_node *np)
 	tegra114_fixed_clk_init(clk_base);
 	tegra114_pll_init(clk_base, pmc_base);
 	tegra114_periph_clk_init(clk_base, pmc_base);
-	tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra114_clks,
+			     &tegra114_audio_plls, 1);

This throws a build warning, it should be tegra114_audio_plls (without the ampersand). Also I think you should use ARRAY_SIZE() instead of hard-coding the number of entries here.

I swear I had changed those without the ampersand ... But yah ARRAY_SIZE makes much more sense. Will change throughout...

Quoted 61 lines
Quoted 20 lines
drivers/clk/tegra/clk-tegra114.c +0 -0
 	tegra_pmc_clk_init(pmc_base, tegra114_clks);
 	tegra_super_clk_gen4_init(clk_base, pmc_base, tegra114_clks,
 					&pll_x_params);
drivers/clk/tegra/clk-tegra124.c +4 -0
index 11f857cd5f6a..169e236f3627 100644
@@ -1413,6 +1413,10 @@ static struct tegra_clk_init_table tegra132_init_table[] __initdata = {
 	{TEGRA124_CLK_CLK_MAX, TEGRA124_CLK_CLK_MAX, 0, 0},
 };
 
+static struct tegra_audio_clk_info tegra124_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 /**
  * tegra124_clock_apply_init_table - initialize clocks on Tegra124 SoCs
  *

drivers/clk/tegra/clk-tegra124.c static void __init tegra124_132_clock_init_pre(struct device_node *np) · line 1497

Quoted 6 lines
drivers/clk/tegra/clk-tegra124.c +2 -1
@@ -1489,7 +1493,8 @@ static void __init tegra124_132_clock_init_pre(struct device_node *np)
 	tegra_fixed_clk_init(tegra124_clks);
 	tegra124_pll_init(clk_base, pmc_base);
 	tegra124_periph_clk_init(clk_base, pmc_base);
-	tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra124_clks,
+			     tegra124_audio_plls, 1);

ARRAY_SIZE() here as well. The ampersand isn't there in this case...

Quoted 19 lines
drivers/clk/tegra/clk-tegra124.c +0 -0
 	tegra_pmc_clk_init(pmc_base, tegra124_clks);
 
 	/* For Tegra124 & Tegra132, PLLD is the only source for DSIA & DSIB */
drivers/clk/tegra/clk-tegra30.c +4 -0
index 4b26509fc218..3198c7b7946c 100644
@@ -1406,6 +1406,10 @@ static const struct of_device_id pmc_match[] __initconst = {
 	{},
 };
 
+static struct tegra_audio_clk_info tegra30_audio_plls[] = {
+	{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
+};
+
 static void __init tegra30_clock_init(struct device_node *np)
 {
 	struct device_node *node;

drivers/clk/tegra/clk-tegra30.c static void __init tegra30_clock_init(struct device_node *np) · line 1451

Quoted 6 lines
drivers/clk/tegra/clk-tegra30.c +2 -1
@@ -1443,7 +1447,8 @@ static void __init tegra30_clock_init(struct device_node *np)
 	tegra30_pll_init();
 	tegra30_super_clk_init();
 	tegra30_periph_clk_init();
-	tegra_audio_clk_init(clk_base, pmc_base, tegra30_clks, &pll_a_params);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra30_clks,
+			     &tegra30_audio_plls, 1);

Same comments as for Tegra114.

Quoted 1 line
drivers/clk/tegra/clk.h +0 -0

[...]

Quoted 2 lines
drivers/clk/tegra/clk.h +0 -0
@@ -607,7 +622,8 @@ void tegra_register_devclks(struct tegra_devclk *dev_clks, int num);
 
Quoted 7 lines

drivers/clk/tegra/clk.h void tegra_register_devclks(struct tegra_devclk *dev_clks, int num); · line 626

Quoted 5 lines
drivers/clk/tegra/clk.h +2 -1
 void tegra_audio_clk_init(void __iomem *clk_base,
 			void __iomem *pmc_base, struct tegra_clk *tegra_clks,
-			struct tegra_clk_pll_params *pll_params);
+			struct tegra_audio_clk_info *audio_info,
+			int num_plls);

Oh, and make num_plls unsigned int, please.

Will do!

Thanks,
Rhyland

Quoted 6 lines

Thierry

* Unknown Key
* 0x7F3EB3A1

Signature · 1 line
nvpublic
#5 lore raw

PATCH v4 2/20 clk: tegra: periph: add new periph clks and muxes for Tegra210

In reply to Rhyland Klein

Tegra210 has significant differences in muxes for peripheral clocks. One of the most important changes is that pll_m isn't to be used as a source for peripherals. Therefore, we need to define the new muxes and new clocks to use those muxes for Tegra210 support.

---
 drivers/clk/tegra/clk-id.h           |   57 +++++++-
 drivers/clk/tegra/clk-tegra-periph.c |  257 +++++++++++++++++++++++++++++++++-
 2 files changed, 312 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-id.h +56 -1
index 60738cc954cb..ac6eaba5cc6e 100644
@@ -13,6 +13,7 @@ enum clk_id {
 	tegra_clk_amx1,
 	tegra_clk_apbdma,
 	tegra_clk_apbif,
+	tegra_clk_ape,
 	tegra_clk_audio0,
 	tegra_clk_audio0_2x,
 	tegra_clk_audio0_mux,
@@ -38,6 +39,7 @@ enum clk_id {
 	tegra_clk_cile,
 	tegra_clk_clk_32k,
 	tegra_clk_clk72Mhz,
+	tegra_clk_clk72Mhz_8,
 	tegra_clk_clk_m,
 	tegra_clk_clk_m_div2,
 	tegra_clk_clk_m_div4,
@@ -51,17 +53,21 @@ enum clk_id {
 	tegra_clk_cml1,
 	tegra_clk_csi,
 	tegra_clk_csite,
+	tegra_clk_csite_8,
 	tegra_clk_csus,
 	tegra_clk_cve,
 	tegra_clk_dam0,
 	tegra_clk_dam1,
 	tegra_clk_dam2,
 	tegra_clk_d_audio,
+	tegra_clk_dbgapb,
 	tegra_clk_dds,
 	tegra_clk_dfll_ref,
 	tegra_clk_dfll_soc,
 	tegra_clk_disp1,
+	tegra_clk_disp1_8,
 	tegra_clk_disp2,
+	tegra_clk_disp2_8,
 	tegra_clk_dp2,
 	tegra_clk_dpaux,
 	tegra_clk_dsialp,
@@ -71,6 +77,7 @@ enum clk_id {
 	tegra_clk_dtv,
 	tegra_clk_emc,
 	tegra_clk_entropy,
+	tegra_clk_entropy_8,
 	tegra_clk_epp,
 	tegra_clk_epp_8,
 	tegra_clk_extern1,
@@ -85,12 +92,15 @@ enum clk_id {
 	tegra_clk_gr3d_8,
 	tegra_clk_hclk,
 	tegra_clk_hda,
+	tegra_clk_hda_8,
 	tegra_clk_hda2codec_2x,
+	tegra_clk_hda2codec_2x_8,
 	tegra_clk_hda2hdmi,
 	tegra_clk_hdmi,
 	tegra_clk_hdmi_audio,
 	tegra_clk_host1x,
 	tegra_clk_host1x_8,
+	tegra_clk_host1x_9,
 	tegra_clk_i2c1,
 	tegra_clk_i2c2,
 	tegra_clk_i2c3,
@@ -110,11 +120,14 @@ enum clk_id {
 	tegra_clk_i2s4_sync,
 	tegra_clk_isp,
 	tegra_clk_isp_8,
+	tegra_clk_isp_9,
 	tegra_clk_ispb,
 	tegra_clk_kbc,
 	tegra_clk_kfuse,
 	tegra_clk_la,
+	tegra_clk_maud,
 	tegra_clk_mipi,
+	tegra_clk_mipibif,
 	tegra_clk_mipi_cal,
 	tegra_clk_mpe,
 	tegra_clk_mselect,
@@ -124,11 +137,16 @@ enum clk_id {
 	tegra_clk_ndspeed,
 	tegra_clk_ndspeed_8,
 	tegra_clk_nor,
+	tegra_clk_nvdec,
+	tegra_clk_nvenc,
+	tegra_clk_nvjpg,
 	tegra_clk_owr,
+	tegra_clk_owr_8,
 	tegra_clk_pcie,
 	tegra_clk_pclk,
 	tegra_clk_pll_a,
 	tegra_clk_pll_a_out0,
+	tegra_clk_pll_a1,
 	tegra_clk_pll_c,
 	tegra_clk_pll_c2,
 	tegra_clk_pll_c3,
@@ -140,8 +158,10 @@ enum clk_id {
 	tegra_clk_pll_d_out0,
 	tegra_clk_pll_dp,
 	tegra_clk_pll_e_out0,
+	tegra_clk_pll_g_ref,
 	tegra_clk_pll_m,
 	tegra_clk_pll_m_out1,
+	tegra_clk_pll_mb,
 	tegra_clk_pll_p,
 	tegra_clk_pll_p_out1,
 	tegra_clk_pll_p_out2,
@@ -160,52 +180,77 @@ enum clk_id {
 	tegra_clk_pll_x,
 	tegra_clk_pll_x_out0,
 	tegra_clk_pwm,
+	tegra_clk_qspi,
 	tegra_clk_rtc,
 	tegra_clk_sata,
+	tegra_clk_sata_8,
 	tegra_clk_sata_cold,
 	tegra_clk_sata_oob,
+	tegra_clk_sata_oob_8,
 	tegra_clk_sbc1,
 	tegra_clk_sbc1_8,
+	tegra_clk_sbc1_9,
 	tegra_clk_sbc2,
 	tegra_clk_sbc2_8,
+	tegra_clk_sbc2_9,
 	tegra_clk_sbc3,
 	tegra_clk_sbc3_8,
+	tegra_clk_sbc3_9,
 	tegra_clk_sbc4,
 	tegra_clk_sbc4_8,
+	tegra_clk_sbc4_9,
 	tegra_clk_sbc5,
 	tegra_clk_sbc5_8,
 	tegra_clk_sbc6,
 	tegra_clk_sbc6_8,
 	tegra_clk_sclk,
+	tegra_clk_sdmmc_legacy,
 	tegra_clk_sdmmc1,
 	tegra_clk_sdmmc1_8,
+	tegra_clk_sdmmc1_9,
 	tegra_clk_sdmmc2,
 	tegra_clk_sdmmc2_8,
+	tegra_clk_sdmmc2_9,
 	tegra_clk_sdmmc3,
 	tegra_clk_sdmmc3_8,
+	tegra_clk_sdmmc3_9,
 	tegra_clk_sdmmc4,
 	tegra_clk_sdmmc4_8,
+	tegra_clk_sdmmc4_9,
 	tegra_clk_se,
 	tegra_clk_soc_therm,
+	tegra_clk_soc_therm_8,
 	tegra_clk_sor0,
 	tegra_clk_sor0_lvds,
+	tegra_clk_sor1,
+	tegra_clk_sor1_brick,
+	tegra_clk_sor1_src,
 	tegra_clk_spdif,
 	tegra_clk_spdif_2x,
 	tegra_clk_spdif_in,
+	tegra_clk_spdif_in_8,
 	tegra_clk_spdif_in_sync,
 	tegra_clk_spdif_mux,
 	tegra_clk_spdif_out,
 	tegra_clk_timer,
 	tegra_clk_trace,
 	tegra_clk_tsec,
+	tegra_clk_tsec_8,
+	tegra_clk_tsecb,
 	tegra_clk_tsensor,
 	tegra_clk_tvdac,
 	tegra_clk_tvo,
 	tegra_clk_uarta,
+	tegra_clk_uarta_8,
 	tegra_clk_uartb,
+	tegra_clk_uartb_8,
 	tegra_clk_uartc,
+	tegra_clk_uartc_8,
 	tegra_clk_uartd,
+	tegra_clk_uartd_8,
 	tegra_clk_uarte,
+	tegra_clk_uarte_8,
+	tegra_clk_uartape,
 	tegra_clk_usb2,
 	tegra_clk_usb3,
 	tegra_clk_usbd,
@@ -216,22 +261,32 @@ enum clk_id {
 	tegra_clk_vi,
 	tegra_clk_vi_8,
 	tegra_clk_vi_9,
+	tegra_clk_vi_10,
+	tegra_clk_vi_i2c,
 	tegra_clk_vic03,
+	tegra_clk_vic03_8,
 	tegra_clk_vim2_clk,
 	tegra_clk_vimclk_sync,
 	tegra_clk_vi_sensor,
-	tegra_clk_vi_sensor2,
 	tegra_clk_vi_sensor_8,
+	tegra_clk_vi_sensor_9,
+	tegra_clk_vi_sensor2,
+	tegra_clk_vi_sensor2_8,
 	tegra_clk_xusb_dev,
 	tegra_clk_xusb_dev_src,
+	tegra_clk_xusb_dev_src_8,
 	tegra_clk_xusb_falcon_src,
+	tegra_clk_xusb_falcon_src_8,
 	tegra_clk_xusb_fs_src,
 	tegra_clk_xusb_host,
 	tegra_clk_xusb_host_src,
+	tegra_clk_xusb_host_src_8,
 	tegra_clk_xusb_hs_src,
 	tegra_clk_xusb_ss,
 	tegra_clk_xusb_ss_src,
+	tegra_clk_xusb_ss_src_8,
 	tegra_clk_xusb_ss_div2,
+	tegra_clk_sclk_mux,
 	tegra_clk_max,
 };
 
drivers/clk/tegra/clk-tegra-periph.c +256 -1

401 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#6 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

Quoted 243 lines · Rhyland Klein

Tegra210 has significant differences in muxes for peripheral clocks. One of the most important changes is that pll_m isn't to be used as a source for peripherals. Therefore, we need to define the new muxes and new clocks to use those muxes for Tegra210 support.

---
 drivers/clk/tegra/clk-id.h           |   57 +++++++-
 drivers/clk/tegra/clk-tegra-periph.c |  257 +++++++++++++++++++++++++++++++++-
 2 files changed, 312 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-id.h +56 -1
index 60738cc954cb..ac6eaba5cc6e 100644
@@ -13,6 +13,7 @@ enum clk_id {
        tegra_clk_amx1,
        tegra_clk_apbdma,
        tegra_clk_apbif,
+       tegra_clk_ape,
        tegra_clk_audio0,
        tegra_clk_audio0_2x,
        tegra_clk_audio0_mux,
@@ -38,6 +39,7 @@ enum clk_id {
        tegra_clk_cile,
        tegra_clk_clk_32k,
        tegra_clk_clk72Mhz,
+       tegra_clk_clk72Mhz_8,
        tegra_clk_clk_m,
        tegra_clk_clk_m_div2,
        tegra_clk_clk_m_div4,
@@ -51,17 +53,21 @@ enum clk_id {
        tegra_clk_cml1,
        tegra_clk_csi,
        tegra_clk_csite,
+       tegra_clk_csite_8,
        tegra_clk_csus,
        tegra_clk_cve,
        tegra_clk_dam0,
        tegra_clk_dam1,
        tegra_clk_dam2,
        tegra_clk_d_audio,
+       tegra_clk_dbgapb,
        tegra_clk_dds,
        tegra_clk_dfll_ref,
        tegra_clk_dfll_soc,
        tegra_clk_disp1,
+       tegra_clk_disp1_8,
        tegra_clk_disp2,
+       tegra_clk_disp2_8,
        tegra_clk_dp2,
        tegra_clk_dpaux,
        tegra_clk_dsialp,
@@ -71,6 +77,7 @@ enum clk_id {
        tegra_clk_dtv,
        tegra_clk_emc,
        tegra_clk_entropy,
+       tegra_clk_entropy_8,
        tegra_clk_epp,
        tegra_clk_epp_8,
        tegra_clk_extern1,
@@ -85,12 +92,15 @@ enum clk_id {
        tegra_clk_gr3d_8,
        tegra_clk_hclk,
        tegra_clk_hda,
+       tegra_clk_hda_8,
        tegra_clk_hda2codec_2x,
+       tegra_clk_hda2codec_2x_8,
        tegra_clk_hda2hdmi,
        tegra_clk_hdmi,
        tegra_clk_hdmi_audio,
        tegra_clk_host1x,
        tegra_clk_host1x_8,
+       tegra_clk_host1x_9,
        tegra_clk_i2c1,
        tegra_clk_i2c2,
        tegra_clk_i2c3,
@@ -110,11 +120,14 @@ enum clk_id {
        tegra_clk_i2s4_sync,
        tegra_clk_isp,
        tegra_clk_isp_8,
+       tegra_clk_isp_9,
        tegra_clk_ispb,
        tegra_clk_kbc,
        tegra_clk_kfuse,
        tegra_clk_la,
+       tegra_clk_maud,
        tegra_clk_mipi,
+       tegra_clk_mipibif,
        tegra_clk_mipi_cal,
        tegra_clk_mpe,
        tegra_clk_mselect,
@@ -124,11 +137,16 @@ enum clk_id {
        tegra_clk_ndspeed,
        tegra_clk_ndspeed_8,
        tegra_clk_nor,
+       tegra_clk_nvdec,
+       tegra_clk_nvenc,
+       tegra_clk_nvjpg,
        tegra_clk_owr,
+       tegra_clk_owr_8,
        tegra_clk_pcie,
        tegra_clk_pclk,
        tegra_clk_pll_a,
        tegra_clk_pll_a_out0,
+       tegra_clk_pll_a1,
        tegra_clk_pll_c,
        tegra_clk_pll_c2,
        tegra_clk_pll_c3,
@@ -140,8 +158,10 @@ enum clk_id {
        tegra_clk_pll_d_out0,
        tegra_clk_pll_dp,
        tegra_clk_pll_e_out0,
+       tegra_clk_pll_g_ref,
        tegra_clk_pll_m,
        tegra_clk_pll_m_out1,
+       tegra_clk_pll_mb,
        tegra_clk_pll_p,
        tegra_clk_pll_p_out1,
        tegra_clk_pll_p_out2,
@@ -160,52 +180,77 @@ enum clk_id {
        tegra_clk_pll_x,
        tegra_clk_pll_x_out0,
        tegra_clk_pwm,
+       tegra_clk_qspi,
        tegra_clk_rtc,
        tegra_clk_sata,
+       tegra_clk_sata_8,
        tegra_clk_sata_cold,
        tegra_clk_sata_oob,
+       tegra_clk_sata_oob_8,
        tegra_clk_sbc1,
        tegra_clk_sbc1_8,
+       tegra_clk_sbc1_9,
        tegra_clk_sbc2,
        tegra_clk_sbc2_8,
+       tegra_clk_sbc2_9,
        tegra_clk_sbc3,
        tegra_clk_sbc3_8,
+       tegra_clk_sbc3_9,
        tegra_clk_sbc4,
        tegra_clk_sbc4_8,
+       tegra_clk_sbc4_9,
        tegra_clk_sbc5,
        tegra_clk_sbc5_8,
        tegra_clk_sbc6,
        tegra_clk_sbc6_8,
        tegra_clk_sclk,
+       tegra_clk_sdmmc_legacy,
        tegra_clk_sdmmc1,
        tegra_clk_sdmmc1_8,
+       tegra_clk_sdmmc1_9,
        tegra_clk_sdmmc2,
        tegra_clk_sdmmc2_8,
+       tegra_clk_sdmmc2_9,
        tegra_clk_sdmmc3,
        tegra_clk_sdmmc3_8,
+       tegra_clk_sdmmc3_9,
        tegra_clk_sdmmc4,
        tegra_clk_sdmmc4_8,
+       tegra_clk_sdmmc4_9,
        tegra_clk_se,
        tegra_clk_soc_therm,
+       tegra_clk_soc_therm_8,
        tegra_clk_sor0,
        tegra_clk_sor0_lvds,
+       tegra_clk_sor1,
+       tegra_clk_sor1_brick,
+       tegra_clk_sor1_src,
        tegra_clk_spdif,
        tegra_clk_spdif_2x,
        tegra_clk_spdif_in,
+       tegra_clk_spdif_in_8,
        tegra_clk_spdif_in_sync,
        tegra_clk_spdif_mux,
        tegra_clk_spdif_out,
        tegra_clk_timer,
        tegra_clk_trace,
        tegra_clk_tsec,
+       tegra_clk_tsec_8,
+       tegra_clk_tsecb,
        tegra_clk_tsensor,
        tegra_clk_tvdac,
        tegra_clk_tvo,
        tegra_clk_uarta,
+       tegra_clk_uarta_8,
        tegra_clk_uartb,
+       tegra_clk_uartb_8,
        tegra_clk_uartc,
+       tegra_clk_uartc_8,
        tegra_clk_uartd,
+       tegra_clk_uartd_8,
        tegra_clk_uarte,
+       tegra_clk_uarte_8,
+       tegra_clk_uartape,
        tegra_clk_usb2,
        tegra_clk_usb3,
        tegra_clk_usbd,
@@ -216,22 +261,32 @@ enum clk_id {
        tegra_clk_vi,
        tegra_clk_vi_8,
        tegra_clk_vi_9,
+       tegra_clk_vi_10,
+       tegra_clk_vi_i2c,
        tegra_clk_vic03,
+       tegra_clk_vic03_8,
        tegra_clk_vim2_clk,
        tegra_clk_vimclk_sync,
        tegra_clk_vi_sensor,
-       tegra_clk_vi_sensor2,
        tegra_clk_vi_sensor_8,
+       tegra_clk_vi_sensor_9,
+       tegra_clk_vi_sensor2,
+       tegra_clk_vi_sensor2_8,
        tegra_clk_xusb_dev,
        tegra_clk_xusb_dev_src,
+       tegra_clk_xusb_dev_src_8,
        tegra_clk_xusb_falcon_src,
+       tegra_clk_xusb_falcon_src_8,
        tegra_clk_xusb_fs_src,
        tegra_clk_xusb_host,
        tegra_clk_xusb_host_src,
+       tegra_clk_xusb_host_src_8,
        tegra_clk_xusb_hs_src,
        tegra_clk_xusb_ss,
        tegra_clk_xusb_ss_src,
+       tegra_clk_xusb_ss_src_8,
        tegra_clk_xusb_ss_div2,
+       tegra_clk_sclk_mux,
        tegra_clk_max,
 };
 
drivers/clk/tegra/clk-tegra-periph.c +3 -0
index 46af9244ba74..bde7286bb16b 100644
@@ -125,6 +125,19 @@
 #define CLK_SOURCE_HDMI_AUDIO 0x668
 #define CLK_SOURCE_VIC03 0x678
 #define CLK_SOURCE_CLK72MHZ 0x66c
+#define CLK_SOURCE_DBGAPB 0x718
+#define CLK_SOURCE_NVENC 0x6a0
+#define CLK_SOURCE_NVDEC 0x698

drivers/clk/tegra/clk-tegra-periph.c line 140

Quoted 10 lines
drivers/clk/tegra/clk-tegra-periph.c +10 -0
+#define CLK_SOURCE_NVJPG 0x69c
+#define CLK_SOURCE_APE 0x6c0
+#define CLK_SOURCE_SOR1 0x410
+#define CLK_SOURCE_SDMMC_LEGACY 0x694
+#define CLK_SOURCE_QSPI 0x6c4
+#define CLK_SOURCE_VI_I2C 0x6c8
+#define CLK_SOURCE_MIPIBIF 0x660
+#define CLK_SOURCE_UARTAPE 0x710
+#define CLK_SOURCE_TSECB 0x6d8
+#define CLK_SOURCE_MAUD 0x6d4

It would be nice if this list was organized better. For example CLK_SOURCE_SOR1, could be next to existing define of SOR0, and the same for TSECB, the UARTAPE, and SDMMC_LEGACY.

It's unfortunate that the list of clock sources is not sorted by name, by offset value, nor by the way these show up in the TRM.

Quoted 407 lines
drivers/clk/tegra/clk-tegra-periph.c +243 -2
 #define MASK(x) (BIT(x) - 1)
 
@@ -183,6 +196,13 @@
                        TEGRA_DIVIDER_ROUND_UP, _clk_num, 0, _clk_id,\
                        _parents##_idx, 0, NULL)
 
+#define UART8(_name, _parents, _offset,\
+                            _clk_num, _clk_id)                 \
+       TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
+                       29, MASK(3), 0, 0, 16, 1, TEGRA_DIVIDER_UART| \
+                       TEGRA_DIVIDER_ROUND_UP, _clk_num, 0, _clk_id,\
+                       _parents##_idx, 0, NULL)
+
 #define I2C(_name, _parents, _offset,\
                             _clk_num, _clk_id)                 \
        TEGRA_INIT_DATA_TABLE(_name, NULL, NULL, _parents, _offset,\
@@ -235,6 +255,7 @@ static DEFINE_SPINLOCK(PLLP_OUTA_lock);
 static DEFINE_SPINLOCK(PLLP_OUTB_lock);
 static DEFINE_SPINLOCK(PLLP_OUTC_lock);
 static DEFINE_SPINLOCK(sor0_lock);
+static DEFINE_SPINLOCK(sor1_lock);
 
 #define MUX_I2S_SPDIF(_id)                                             \
 static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \
@@ -286,6 +307,68 @@ static u32 mux_pllp_clkm_idx[] = {
        [0] = 0, [1] = 3,
 };
 
+static const char *mux_pllp_clkm_2[] = {
+       "pll_p", "clk_m"
+};
+static u32 mux_pllp_clkm_2_idx[] = {
+       [0] = 2, [1] = 6,
+};
+
+static const char *mux_pllc2_c_c3_pllp_plla1_clkm[] = {
+       "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a1", "clk_m"
+};
+static u32 mux_pllc2_c_c3_pllp_plla1_clkm_idx[] = {
+       [0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 6, [5] = 7,
+};
+
+static const char *
+mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0[] = {
+       "pll_c4_out1", "pll_c", "pll_c4_out2", "pll_p", "clk_m",
+       "pll_a_out0", "pll_c4_out0"
+};
+static u32 mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0_idx[] = {
+       [0] = 0, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = 6, [6] = 7,
+};
+
+static const char *mux_pllc_pllp_plla[] = {
+       "pll_c", "pll_p", "pll_a_out0"
+};
+static u32 mux_pllc_pllp_plla_idx[] = {
+       [0] = 1, [1] = 2, [2] = 3,
+};
+
+static const char *mux_clkm_pllc_pllp_plla[] = {
+       "clk_m", "pll_c", "pll_p", "pll_a_out0"
+};
+#define mux_clkm_pllc_pllp_plla_idx NULL
+
+static const char *mux_pllc_pllp_plla1_pllc2_c3_clkm[] = {
+       "pll_c", "pll_p", "pll_a1", "pll_c2", "pll_c3", "clk_m"
+};
+static u32 mux_pllc_pllp_plla1_pllc2_c3_clkm_idx[] = {
+       [0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = 6,
+};
+
+static const char *mux_pllc2_c_c3_pllp_clkm_plla1_pllc4[] = {
+       "pll_c2", "pll_c", "pll_c3", "pll_p", "clk_m", "pll_a1", "pll_c4_out0",
+};
+static u32 mux_pllc2_c_c3_pllp_clkm_plla1_pllc4_idx[] = {
+       [0] = 1, [1] = 2, [2] = 3, [3] = 4, [4] = 5, [5] = 6, [6] = 7,
+};
+
+static const char *mux_pllc_pllp_plla1_pllc2_c3_clkm_pllc4[] = {
+       "pll_c", "pll_p", "pll_a1", "pll_c2", "pll_c3", "clk_m", "pll_c4_out0",
+};
+#define mux_pllc_pllp_plla1_pllc2_c3_clkm_pllc4_idx \
+       mux_pllc2_c_c3_pllp_clkm_plla1_pllc4_idx
+
+static const char *
+mux_plla_pllc4_out0_pllc_pllc4_out1_pllp_pllc4_out2_clkm[] = {
+       "pll_a_out0", "pll_c4_out0", "pll_c", "pll_c4_out1", "pll_p",
+       "pll_c4_out2", "clk_m"
+};
+#define mux_plla_pllc4_out0_pllc_pllc4_out1_pllp_pllc4_out2_clkm_idx NULL
+
 static const char *mux_pllm_pllc2_c_c3_pllp_plla[] = {
        "pll_m", "pll_c2", "pll_c", "pll_c3", "pll_p", "pll_a_out0"
 };
@@ -303,12 +386,93 @@ static const char *mux_pllm_pllc_pllp_plla[] = {
 #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx
 
 static const char *mux_pllp_pllc_clkm[] = {
-       "pll_p", "pll_c", "pll_m"
+       "pll_p", "pll_c", "clk_m"
 };
 static u32 mux_pllp_pllc_clkm_idx[] = {
        [0] = 0, [1] = 1, [2] = 3,
 };
 
+static const char *mux_pllp_pllc_clkm_1[] = {
+       "pll_p", "pll_c", "clk_m"
+};
+static u32 mux_pllp_pllc_clkm_1_idx[] = {
+       [0] = 0, [1] = 2, [2] = 5,
+};
+
+static const char *mux_pllp_pllc_plla_clkm[] = {
+       "pll_p", "pll_c", "pll_a_out0", "clk_m"
+};
+static u32 mux_pllp_pllc_plla_clkm_idx[] = {
+       [0] = 0, [1] = 2, [2] = 4, [3] = 6,
+};
+
+static const char *mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2[] = {
+       "pll_p", "pll_c", "pll_c4_out0", "pll_c4_out1", "clk_m", "pll_c4_out2"
+};
+static u32 mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2_idx[] = {
+       [0] = 0, [1] = 2, [2] = 3, [3] = 5, [4] = 6, [5] = 7,
+};
+
+static const char *
+mux_pllp_pllc_pllc_out1_pllc4_out2_pllc4_out1_clkm_pllc4_out0[] = {
+       "pll_p", "pll_c_out1", "pll_c", "pll_c4_out2", "pll_c4_out1",
+       "clk_m", "pll_c4_out0"
+};
+static u32
+mux_pllp_pllc_pllc_out1_pllc4_out2_pllc4_out1_clkm_pllc4_out0_idx[] = {
+       [0] = 0, [1] = 1, [2] = 2, [3] = 4, [4] = 5, [5] = 6, [6] = 7,
+};
+
+static const char *mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0[] = {
+       "pll_p", "pll_c4_out2", "pll_c4_out1", "clk_m", "pll_c4_out0"
+};
+static u32 mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0_idx[] = {
+       [0] = 0, [1] = 3, [2] = 4, [3] = 6, [4] = 7,
+};
+
+static const char *mux_pllp_clkm_pllc4_out2_out1_out0_lj[] = {
+       "pll_p",
+       "pll_c4_out2", "pll_c4_out0",   /* LJ input */
+       "pll_c4_out2", "pll_c4_out1",
+       "pll_c4_out1",                  /* LJ input */
+       "clk_m", "pll_c4_out0"
+};
+#define mux_pllp_clkm_pllc4_out2_out1_out0_lj_idx NULL
+
+static const char *mux_pllp_pllc2_c_c3_clkm[] = {
+       "pll_p", "pll_c2", "pll_c", "pll_c3", "clk_m"
+};
+static u32 mux_pllp_pllc2_c_c3_clkm_idx[] = {
+       [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 6,
+};
+
+static const char *mux_pllp_clkm_clk32_plle[] = {
+       "pll_p", "clk_m", "clk_32k", "pll_e"
+};
+static u32 mux_pllp_clkm_clk32_plle_idx[] = {
+       [0] = 0, [1] = 2, [2] = 4, [3] = 6,
+};
+
+static const char *mux_pllp_pllp_out3_clkm_clk32k_plla[] = {
+       "pll_p", "pll_p_out3", "clk_m", "clk_32k", "pll_a_out0"
+};
+#define mux_pllp_pllp_out3_clkm_clk32k_plla_idx NULL
+
+static const char *mux_pllp_out3_clkm_pllp_pllc4[] = {
+       "pll_p_out3", "clk_m", "pll_p", "pll_c4_out0", "pll_c4_out1",
+       "pll_c4_out2"
+};
+static u32 mux_pllp_out3_clkm_pllp_pllc4_idx[] = {
+       [0] = 0, [1] = 3, [2] = 4, [3] = 5, [4] = 6, [5] = 7,
+};
+
+static const char *mux_clkm_pllp_pllre[] = {
+       "clk_m", "pll_p_out_xusb", "pll_re_out"
+};
+static u32 mux_clkm_pllp_pllre_idx[] = {
+       [0] = 0, [1] = 1, [2] = 5,
+};
+
 static const char *mux_pllp_pllc_clkm_clk32[] = {
        "pll_p", "pll_c", "clk_m", "clk_32k"
 };
@@ -333,6 +497,11 @@ static u32 mux_clkm_48M_pllp_480M_idx[] = {
        [0] = 0, [1] = 2, [2] = 4, [3] = 6,
 };
 
+static const char *mux_clkm_pllre_clk32_480M[] = {
+       "clk_m", "pll_re_out", "clk_32k", "pll_u_480M"
+};
+#define mux_clkm_pllre_clk32_480M_idx NULL
+
 static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = {
        "clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref"
 };
@@ -340,6 +509,13 @@ static u32 mux_clkm_pllre_clk32_480M_pllc_ref_idx[] = {
        [0] = 0, [1] = 1, [2] = 3, [3] = 3, [4] = 4, [5] = 7,
 };
 
+static const char *mux_pllp_out3_pllp_pllc_clkm[] = {
+       "pll_p_out3", "pll_p", "pll_c", "clk_m"
+};
+static u32 mux_pllp_out3_pllp_pllc_clkm_idx[] = {
+       [0] = 0, [1] = 1, [2] = 2, [3] = 6,
+};
+
 static const char *mux_ss_60M[] = {
        "xusb_ss_div2", "pll_u_60M"
 };
@@ -387,6 +563,32 @@ static u32 mux_pllm_pllc2_c_c3_pllp_plla_pllc4_idx[] = {
        [0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, [6] = 7,
 };
 
+/* SOR1 mux'es */
+static const char *mux_pllp_plld_plld2_clkm[] = {
+       "pll_p", "pll_d_out0", "pll_d2", "clk_m"
+};
+static u32 mux_pllp_plld_plld2_clkm_idx[] = {
+       [0] = 0, [1] = 2, [2] = 5, [3] = 6
+};
+
+static const char *mux_plldp_sor1_src[] = {
+       "pll_dp", "clk_sor1_src"
+};
+#define mux_plldp_sor1_src_idx NULL
+
+static const char *mux_clkm_sor1_brick_sor1_src[] = {
+       "clk_m", "sor1_brick", "sor1_src", "sor1_brick"
+};
+#define mux_clkm_sor1_brick_sor1_src_idx NULL
+
+static const char *mux_pllp_pllre_clkm[] = {
+       "pll_p", "pll_re_out1", "clk_m"
+};
+
+static u32 mux_pllp_pllre_clkm_idx[] = {
+       [0] = 0, [1] = 2, [2] = 3,
+};
+
 static const char *mux_clkm_plldp_sor0lvds[] = {
        "clk_m", "pll_dp", "sor0_lvds",
 };
@@ -402,6 +604,7 @@ static struct tegra_periph_init_data periph_clks[] = {
        I2C("i2c3", mux_pllp_clkm, CLK_SOURCE_I2C3, 67, tegra_clk_i2c3),
        I2C("i2c4", mux_pllp_clkm, CLK_SOURCE_I2C4, 103, tegra_clk_i2c4),
        I2C("i2c5", mux_pllp_clkm, CLK_SOURCE_I2C5, 47, tegra_clk_i2c5),
+       I2C("i2c6", mux_pllp_clkm, CLK_SOURCE_I2C6, 166, tegra_clk_i2c6),
        INT("vde", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VDE, 61, 0, tegra_clk_vde),
        INT("vi", mux_pllm_pllc_pllp_plla, CLK_SOURCE_VI, 20, 0, tegra_clk_vi),
        INT("epp", mux_pllm_pllc_pllp_plla, CLK_SOURCE_EPP, 19, 0, tegra_clk_epp),
@@ -412,14 +615,19 @@ static struct tegra_periph_init_data periph_clks[] = {
        INT8("vde", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_VDE, 61, 0, tegra_clk_vde_8),
        INT8("vi", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_8),
        INT8("vi", mux_pllm_pllc2_c_c3_pllp_plla_pllc4, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_9),
+       INT8("vi", mux_pllc2_c_c3_pllp_clkm_plla1_pllc4, CLK_SOURCE_VI, 20, 0, tegra_clk_vi_10),
        INT8("epp", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_EPP, 19, 0, tegra_clk_epp_8),
        INT8("msenc", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_MSENC, 91, TEGRA_PERIPH_WAR_1005168, tegra_clk_msenc),
        INT8("tsec", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_TSEC, 83, 0, tegra_clk_tsec),
+       INT("tsec", mux_pllp_pllc_clkm, CLK_SOURCE_TSEC, 83, 0, tegra_clk_tsec_8),
        INT8("host1x", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_8),
+       INT8("host1x", mux_pllc4_out1_pllc_pllc4_out2_pllp_clkm_plla_pllc4_out0, CLK_SOURCE_HOST1X, 28, 0, tegra_clk_host1x_9),
        INT8("se", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
+       INT8("se", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_SE, 127, TEGRA_PERIPH_ON_APB, tegra_clk_se),
        INT8("2d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_2D, 21, 0, tegra_clk_gr2d_8),
        INT8("3d", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_3D, 24, 0, tegra_clk_gr3d_8),
        INT8("vic03", mux_pllm_pllc_pllp_plla_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03),
+       INT8("vic03", mux_pllc_pllp_plla1_pllc2_c3_clkm, CLK_SOURCE_VIC03, 178, 0, tegra_clk_vic03_8),
        INT_FLAGS("mselect", mux_pllp_clkm, CLK_SOURCE_MSELECT, 99, 0, tegra_clk_mselect, CLK_IGNORE_UNUSED),
        MUX("i2s0", mux_pllaout0_audio0_2x_pllp_clkm, CLK_SOURCE_I2S0, 30, TEGRA_PERIPH_ON_APB, tegra_clk_i2s0),
        MUX("i2s1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, TEGRA_PERIPH_ON_APB, tegra_clk_i2s1),
@@ -428,22 +636,31 @@ static struct tegra_periph_init_data periph_clks[] = {
        MUX("i2s4", mux_pllaout0_audio4_2x_pllp_clkm, CLK_SOURCE_I2S4, 102, TEGRA_PERIPH_ON_APB, tegra_clk_i2s4),
        MUX("spdif_out", mux_pllaout0_audio_2x_pllp_clkm, CLK_SOURCE_SPDIF_OUT, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_out),
        MUX("spdif_in", mux_pllp_pllc_pllm, CLK_SOURCE_SPDIF_IN, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_in),
+       MUX8("spdif_in", mux_pllp_pllc_clkm_1, CLK_SOURCE_SPDIF_IN, 10, TEGRA_PERIPH_ON_APB, tegra_clk_spdif_in_8),
        MUX("pwm", mux_pllp_pllc_clk32_clkm, CLK_SOURCE_PWM, 17, TEGRA_PERIPH_ON_APB, tegra_clk_pwm),
        MUX("adx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX, 154, TEGRA_PERIPH_ON_APB, tegra_clk_adx),
        MUX("amx", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX, 153, TEGRA_PERIPH_ON_APB, tegra_clk_amx),
        MUX("hda", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA, 125, TEGRA_PERIPH_ON_APB, tegra_clk_hda),
+       MUX("hda", mux_pllp_pllc_clkm, CLK_SOURCE_HDA, 125, TEGRA_PERIPH_ON_APB, tegra_clk_hda_8),
        MUX("hda2codec_2x", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, TEGRA_PERIPH_ON_APB, tegra_clk_hda2codec_2x),
+       MUX8("hda2codec_2x", mux_pllp_pllc_plla_clkm, CLK_SOURCE_HDA2CODEC_2X, 111, TEGRA_PERIPH_ON_APB, tegra_clk_hda2codec_2x_8),
        MUX("vfir", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_VFIR, 7, TEGRA_PERIPH_ON_APB, tegra_clk_vfir),
        MUX("sdmmc1", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC1, 14, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc1),
        MUX("sdmmc2", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC2, 9, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc2),
        MUX("sdmmc3", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC3, 69, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc3),
        MUX("sdmmc4", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SDMMC4, 15, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc4),
+       MUX8("sdmmc1", mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0, CLK_SOURCE_SDMMC1, 14, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc1_9),
+       MUX8("sdmmc2", mux_pllp_clkm_pllc4_out2_out1_out0_lj, CLK_SOURCE_SDMMC2, 9, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc2_9),
+       MUX8("sdmmc3", mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0, CLK_SOURCE_SDMMC3, 69, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc3_9),
+       MUX8("sdmmc4", mux_pllp_clkm_pllc4_out2_out1_out0_lj, CLK_SOURCE_SDMMC4, 15, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc4_9),
        MUX("la", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_LA, 76, TEGRA_PERIPH_ON_APB, tegra_clk_la),
        MUX("trace", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_TRACE, 77, TEGRA_PERIPH_ON_APB, tegra_clk_trace),
        MUX("owr", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_OWR, 71, TEGRA_PERIPH_ON_APB, tegra_clk_owr),
+       MUX("owr", mux_pllp_pllc_clkm, CLK_SOURCE_OWR, 71, TEGRA_PERIPH_ON_APB, tegra_clk_owr_8),
        MUX("nor", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NOR, 42, 0, tegra_clk_nor),
        MUX("mipi", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_MIPI, 50, TEGRA_PERIPH_ON_APB, tegra_clk_mipi),
        MUX("vi_sensor", mux_pllm_pllc_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor),
+       MUX("vi_sensor", mux_pllc_pllp_plla, CLK_SOURCE_VI_SENSOR, 20, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor_9),
        MUX("cilab", mux_pllp_pllc_clkm, CLK_SOURCE_CILAB, 144, 0, tegra_clk_cilab),
        MUX("cilcd", mux_pllp_pllc_clkm, CLK_SOURCE_CILCD, 145, 0, tegra_clk_cilcd),
        MUX("cile", mux_pllp_pllc_clkm, CLK_SOURCE_CILE, 146, 0, tegra_clk_cile),
@@ -466,10 +683,13 @@ static struct tegra_periph_init_data periph_clks[] = {
        MUX("ndflash", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, tegra_clk_ndflash),
        MUX("ndspeed", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, tegra_clk_ndspeed),
        MUX("sata_oob", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA_OOB, 123, TEGRA_PERIPH_ON_APB, tegra_clk_sata_oob),
+       MUX("sata_oob", mux_pllp_pllc_clkm, CLK_SOURCE_SATA_OOB, 123, TEGRA_PERIPH_ON_APB, tegra_clk_sata_oob_8),
        MUX("sata", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_SATA, 124, TEGRA_PERIPH_ON_APB, tegra_clk_sata),
+       MUX("sata", mux_pllp_pllc_clkm, CLK_SOURCE_SATA, 124, TEGRA_PERIPH_ON_APB, tegra_clk_sata_8),
        MUX("adx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_ADX1, 180, TEGRA_PERIPH_ON_APB, tegra_clk_adx1),
        MUX("amx1", mux_plla_pllc_pllp_clkm, CLK_SOURCE_AMX1, 185, TEGRA_PERIPH_ON_APB, tegra_clk_amx1),
        MUX("vi_sensor2", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR2, 165, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2),
+       MUX("vi_sensor2", mux_pllc_pllp_plla, CLK_SOURCE_VI_SENSOR2, 165, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor2_8),
        MUX8("sdmmc1", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC1, 14, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc1_8),
        MUX8("sdmmc2", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC2, 9, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc2_8),
        MUX8("sdmmc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SDMMC3, 69, TEGRA_PERIPH_ON_APB, tegra_clk_sdmmc3_8),
@@ -480,6 +700,10 @@ static struct tegra_periph_init_data periph_clks[] = {
        MUX8("sbc4", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4_8),
        MUX8("sbc5", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC5, 104, TEGRA_PERIPH_ON_APB, tegra_clk_sbc5_8),
        MUX8("sbc6", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC6, 105, TEGRA_PERIPH_ON_APB, tegra_clk_sbc6_8),
+       MUX("sbc1", mux_pllp_pllc_clkm, CLK_SOURCE_SBC1, 41, TEGRA_PERIPH_ON_APB, tegra_clk_sbc1_9),
+       MUX("sbc2", mux_pllp_pllc_clkm, CLK_SOURCE_SBC2, 44, TEGRA_PERIPH_ON_APB, tegra_clk_sbc2_9),
+       MUX("sbc3", mux_pllp_pllc_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_9),
+       MUX("sbc4", mux_pllp_pllc_clkm, CLK_SOURCE_SBC4, 68, TEGRA_PERIPH_ON_APB, tegra_clk_sbc4_9),
        MUX8("ndflash", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDFLASH, 13, TEGRA_PERIPH_ON_APB, tegra_clk_ndflash_8),
        MUX8("ndspeed", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_NDSPEED, 80, TEGRA_PERIPH_ON_APB, tegra_clk_ndspeed_8),
        MUX8("hdmi", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_HDMI, 51, 0, tegra_clk_hdmi),
@@ -487,27 +711,57 @@ static struct tegra_periph_init_data periph_clks[] = {
        MUX8("extern2", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN2, 121, 0, tegra_clk_extern2),
        MUX8("extern3", mux_plla_clk32_pllp_clkm_plle, CLK_SOURCE_EXTERN3, 122, 0, tegra_clk_extern3),
        MUX8("soc_therm", mux_pllm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, TEGRA_PERIPH_ON_APB, tegra_clk_soc_therm),
+       MUX8("soc_therm", mux_clkm_pllc_pllp_plla, CLK_SOURCE_SOC_THERM, 78, TEGRA_PERIPH_ON_APB, tegra_clk_soc_therm_8),
        MUX8("vi_sensor", mux_pllm_pllc2_c_c3_pllp_plla, CLK_SOURCE_VI_SENSOR, 164, TEGRA_PERIPH_NO_RESET, tegra_clk_vi_sensor_8),
        MUX8("isp", mux_pllm_pllc_pllp_plla_clkm_pllc4, CLK_SOURCE_ISP, 23, TEGRA_PERIPH_ON_APB, tegra_clk_isp_8),
+       MUX8("isp", mux_pllc_pllp_plla1_pllc2_c3_clkm_pllc4, CLK_SOURCE_ISP, 23, TEGRA_PERIPH_ON_APB, tegra_clk_isp_9),
        MUX8("entropy", mux_pllp_clkm1, CLK_SOURCE_ENTROPY, 149,  0, tegra_clk_entropy),
+       MUX8("entropy", mux_pllp_clkm_clk32_plle, CLK_SOURCE_ENTROPY, 149,  0, tegra_clk_entropy_8),
        MUX8("hdmi_audio", mux_pllp3_pllc_clkm, CLK_SOURCE_HDMI_AUDIO, 176, TEGRA_PERIPH_NO_RESET, tegra_clk_hdmi_audio),
        MUX8("clk72mhz", mux_pllp3_pllc_clkm, CLK_SOURCE_CLK72MHZ, 177, TEGRA_PERIPH_NO_RESET, tegra_clk_clk72Mhz),
+       MUX8("clk72mhz", mux_pllp_out3_pllp_pllc_clkm, CLK_SOURCE_CLK72MHZ, 177, TEGRA_PERIPH_NO_RESET, tegra_clk_clk72Mhz_8),
        MUX8_NOGATE_LOCK("sor0_lvds", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_SOR0, tegra_clk_sor0_lvds, &sor0_lock),
        MUX_FLAGS("csite", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_CSITE, 73, TEGRA_PERIPH_ON_APB, tegra_clk_csite, CLK_IGNORE_UNUSED),
+       MUX_FLAGS("csite", mux_pllp_pllre_clkm, CLK_SOURCE_CSITE, 73, TEGRA_PERIPH_ON_APB, tegra_clk_csite_8, CLK_IGNORE_UNUSED),
        NODIV("disp1", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, 0, tegra_clk_disp1, NULL),
+       NODIV("disp1", mux_pllp_plld_plld2_clkm, CLK_SOURCE_DISP1, 29, 7, 27, 0, tegra_clk_disp1_8, NULL),
        NODIV("disp2", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, 0, tegra_clk_disp2, NULL),
+       NODIV("disp2", mux_pllp_plld_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, 0, tegra_clk_disp2_8, NULL),
        NODIV("sor0", mux_clkm_plldp_sor0lvds, CLK_SOURCE_SOR0, 14, 3, 182, 0, tegra_clk_sor0, &sor0_lock),
        UART("uarta", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTA, 6, tegra_clk_uarta),
        UART("uartb", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTB, 7, tegra_clk_uartb),
        UART("uartc", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTC, 55, tegra_clk_uartc),
        UART("uartd", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTD, 65, tegra_clk_uartd),
        UART("uarte", mux_pllp_pllc_pllm_clkm, CLK_SOURCE_UARTE, 66, tegra_clk_uarte),
+       UART8("uarta", mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2, CLK_SOURCE_UARTA, 6, tegra_clk_uarta_8),
+       UART8("uartb", mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2, CLK_SOURCE_UARTB, 7, tegra_clk_uartb_8),
+       UART8("uartc", mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2, CLK_SOURCE_UARTC, 55, tegra_clk_uartc_8),
+       UART8("uartd", mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2, CLK_SOURCE_UARTD, 65, tegra_clk_uartd_8),
        XUSB("xusb_host_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src),
+       XUSB("xusb_host_src", mux_clkm_pllp_pllre, CLK_SOURCE_XUSB_HOST_SRC, 143, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_host_src_8),
        XUSB("xusb_falcon_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src),
+       XUSB("xusb_falcon_src", mux_clkm_pllp_pllre, CLK_SOURCE_XUSB_FALCON_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_falcon_src_8),
        XUSB("xusb_fs_src", mux_clkm_48M_pllp_480M, CLK_SOURCE_XUSB_FS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_fs_src),
        XUSB("xusb_ss_src", mux_clkm_pllre_clk32_480M_pllc_ref, CLK_SOURCE_XUSB_SS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_ss_src),
+       XUSB("xusb_ss_src", mux_clkm_pllre_clk32_480M, CLK_SOURCE_XUSB_SS_SRC, 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_ss_src_8),
        NODIV("xusb_hs_src", mux_ss_60M, CLK_SOURCE_XUSB_SS_SRC, 25, MASK(1), 143, TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_hs_src, NULL),
        XUSB("xusb_dev_src", mux_clkm_pllp_pllc_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_dev_src),
+       XUSB("xusb_dev_src", mux_clkm_pllp_pllre, CLK_SOURCE_XUSB_DEV_SRC, 95, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_xusb_dev_src_8),
+       MUX8("dbgapb", mux_pllp_clkm_2, CLK_SOURCE_DBGAPB, 185, TEGRA_PERIPH_NO_RESET, tegra_clk_dbgapb),
+       MUX8("msenc", mux_pllc2_c_c3_pllp_plla1_clkm, CLK_SOURCE_NVENC, 219, 0, tegra_clk_nvenc),
+       MUX8("nvdec", mux_pllc2_c_c3_pllp_plla1_clkm, CLK_SOURCE_NVDEC, 194, 0, tegra_clk_nvdec),
+       MUX8("nvjpg", mux_pllc2_c_c3_pllp_plla1_clkm, CLK_SOURCE_NVJPG, 195, 0, tegra_clk_nvjpg),
+       MUX8("ape", mux_plla_pllc4_out0_pllc_pllc4_out1_pllp_pllc4_out2_clkm, CLK_SOURCE_APE, 198, TEGRA_PERIPH_ON_APB, tegra_clk_ape),
+       MUX8_NOGATE_LOCK("sor1_src", mux_pllp_plld_plld2_clkm, CLK_SOURCE_SOR1, tegra_clk_sor1_src, &sor1_lock),
+       NODIV("sor1_brick", mux_plldp_sor1_src, CLK_SOURCE_SOR1, 14, MASK(1), 183, 0, tegra_clk_sor1_brick, &sor1_lock),
+       NODIV("sor1", mux_clkm_sor1_brick_sor1_src, CLK_SOURCE_SOR1, 15, MASK(1), 183, 0, tegra_clk_sor1, &sor1_lock),
+       MUX8("sdmmc_legacy", mux_pllp_out3_clkm_pllp_pllc4, CLK_SOURCE_SDMMC_LEGACY, 193, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_sdmmc_legacy),
+       MUX8("qspi", mux_pllp_pllc_pllc_out1_pllc4_out2_pllc4_out1_clkm_pllc4_out0, CLK_SOURCE_QSPI, 211, TEGRA_PERIPH_ON_APB, tegra_clk_qspi),
+       MUX("vii2c", mux_pllp_pllc_clkm, CLK_SOURCE_VI_I2C, 208, TEGRA_PERIPH_ON_APB, tegra_clk_vi_i2c),
+       MUX("mipibif", mux_pllp_clkm, CLK_SOURCE_MIPIBIF, 173, TEGRA_PERIPH_ON_APB, tegra_clk_mipibif),
+       MUX("uartape", mux_pllp_pllc_clkm, CLK_SOURCE_UARTAPE, 212, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_uartape),
+       MUX8("tsecb", mux_pllp_pllc2_c_c3_clkm, CLK_SOURCE_TSECB, 206, 0, tegra_clk_tsecb),
+       MUX8("maud", mux_pllp_pllp_out3_clkm_clk32k_plla, CLK_SOURCE_MAUD, 202, TEGRA_PERIPH_ON_APB | TEGRA_PERIPH_NO_RESET, tegra_clk_maud),
 };
 
 static struct tegra_periph_init_data gate_clks[] = {
@@ -544,6 +798,7 @@ static struct tegra_periph_init_data gate_clks[] = {
        GATE("pcie", "clk_m", 70, 0, tegra_clk_pcie, 0),
        GATE("dpaux", "clk_m", 181, 0, tegra_clk_dpaux, 0),
        GATE("gpu", "pll_ref", 184, 0, tegra_clk_gpu, 0),
+       GATE("pllg_ref", "pll_ref", 189, 0, tegra_clk_pll_g_ref, 0),
 };
 
 struct pll_out_data {
--

1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#7 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

Quoted 259 lines · Benson Leung
Quoted 243 lines · Rhyland Klein

Tegra210 has significant differences in muxes for peripheral clocks. One of the most important changes is that pll_m isn't to be used as a source for peripherals. Therefore, we need to define the new muxes and new clocks to use those muxes for Tegra210 support.

---
 drivers/clk/tegra/clk-id.h           |   57 +++++++-
 drivers/clk/tegra/clk-tegra-periph.c |  257 +++++++++++++++++++++++++++++++++-
 2 files changed, 312 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-id.h +56 -1
index 60738cc954cb..ac6eaba5cc6e 100644
@@ -13,6 +13,7 @@ enum clk_id {
        tegra_clk_amx1,
        tegra_clk_apbdma,
        tegra_clk_apbif,
+       tegra_clk_ape,
        tegra_clk_audio0,
        tegra_clk_audio0_2x,
        tegra_clk_audio0_mux,
@@ -38,6 +39,7 @@ enum clk_id {
        tegra_clk_cile,
        tegra_clk_clk_32k,
        tegra_clk_clk72Mhz,
+       tegra_clk_clk72Mhz_8,
        tegra_clk_clk_m,
        tegra_clk_clk_m_div2,
        tegra_clk_clk_m_div4,
@@ -51,17 +53,21 @@ enum clk_id {
        tegra_clk_cml1,
        tegra_clk_csi,
        tegra_clk_csite,
+       tegra_clk_csite_8,
        tegra_clk_csus,
        tegra_clk_cve,
        tegra_clk_dam0,
        tegra_clk_dam1,
        tegra_clk_dam2,
        tegra_clk_d_audio,
+       tegra_clk_dbgapb,
        tegra_clk_dds,
        tegra_clk_dfll_ref,
        tegra_clk_dfll_soc,
        tegra_clk_disp1,
+       tegra_clk_disp1_8,
        tegra_clk_disp2,
+       tegra_clk_disp2_8,
        tegra_clk_dp2,
        tegra_clk_dpaux,
        tegra_clk_dsialp,
@@ -71,6 +77,7 @@ enum clk_id {
        tegra_clk_dtv,
        tegra_clk_emc,
        tegra_clk_entropy,
+       tegra_clk_entropy_8,
        tegra_clk_epp,
        tegra_clk_epp_8,
        tegra_clk_extern1,
@@ -85,12 +92,15 @@ enum clk_id {
        tegra_clk_gr3d_8,
        tegra_clk_hclk,
        tegra_clk_hda,
+       tegra_clk_hda_8,
        tegra_clk_hda2codec_2x,
+       tegra_clk_hda2codec_2x_8,
        tegra_clk_hda2hdmi,
        tegra_clk_hdmi,
        tegra_clk_hdmi_audio,
        tegra_clk_host1x,
        tegra_clk_host1x_8,
+       tegra_clk_host1x_9,
        tegra_clk_i2c1,
        tegra_clk_i2c2,
        tegra_clk_i2c3,
@@ -110,11 +120,14 @@ enum clk_id {
        tegra_clk_i2s4_sync,
        tegra_clk_isp,
        tegra_clk_isp_8,
+       tegra_clk_isp_9,
        tegra_clk_ispb,
        tegra_clk_kbc,
        tegra_clk_kfuse,
        tegra_clk_la,
+       tegra_clk_maud,
        tegra_clk_mipi,
+       tegra_clk_mipibif,
        tegra_clk_mipi_cal,
        tegra_clk_mpe,
        tegra_clk_mselect,
@@ -124,11 +137,16 @@ enum clk_id {
        tegra_clk_ndspeed,
        tegra_clk_ndspeed_8,
        tegra_clk_nor,
+       tegra_clk_nvdec,
+       tegra_clk_nvenc,
+       tegra_clk_nvjpg,
        tegra_clk_owr,
+       tegra_clk_owr_8,
        tegra_clk_pcie,
        tegra_clk_pclk,
        tegra_clk_pll_a,
        tegra_clk_pll_a_out0,
+       tegra_clk_pll_a1,
        tegra_clk_pll_c,
        tegra_clk_pll_c2,
        tegra_clk_pll_c3,
@@ -140,8 +158,10 @@ enum clk_id {
        tegra_clk_pll_d_out0,
        tegra_clk_pll_dp,
        tegra_clk_pll_e_out0,
+       tegra_clk_pll_g_ref,
        tegra_clk_pll_m,
        tegra_clk_pll_m_out1,
+       tegra_clk_pll_mb,
        tegra_clk_pll_p,
        tegra_clk_pll_p_out1,
        tegra_clk_pll_p_out2,
@@ -160,52 +180,77 @@ enum clk_id {
        tegra_clk_pll_x,
        tegra_clk_pll_x_out0,
        tegra_clk_pwm,
+       tegra_clk_qspi,
        tegra_clk_rtc,
        tegra_clk_sata,
+       tegra_clk_sata_8,
        tegra_clk_sata_cold,
        tegra_clk_sata_oob,
+       tegra_clk_sata_oob_8,
        tegra_clk_sbc1,
        tegra_clk_sbc1_8,
+       tegra_clk_sbc1_9,
        tegra_clk_sbc2,
        tegra_clk_sbc2_8,
+       tegra_clk_sbc2_9,
        tegra_clk_sbc3,
        tegra_clk_sbc3_8,
+       tegra_clk_sbc3_9,
        tegra_clk_sbc4,
        tegra_clk_sbc4_8,
+       tegra_clk_sbc4_9,
        tegra_clk_sbc5,
        tegra_clk_sbc5_8,
        tegra_clk_sbc6,
        tegra_clk_sbc6_8,
        tegra_clk_sclk,
+       tegra_clk_sdmmc_legacy,
        tegra_clk_sdmmc1,
        tegra_clk_sdmmc1_8,
+       tegra_clk_sdmmc1_9,
        tegra_clk_sdmmc2,
        tegra_clk_sdmmc2_8,
+       tegra_clk_sdmmc2_9,
        tegra_clk_sdmmc3,
        tegra_clk_sdmmc3_8,
+       tegra_clk_sdmmc3_9,
        tegra_clk_sdmmc4,
        tegra_clk_sdmmc4_8,
+       tegra_clk_sdmmc4_9,
        tegra_clk_se,
        tegra_clk_soc_therm,
+       tegra_clk_soc_therm_8,
        tegra_clk_sor0,
        tegra_clk_sor0_lvds,
+       tegra_clk_sor1,
+       tegra_clk_sor1_brick,
+       tegra_clk_sor1_src,
        tegra_clk_spdif,
        tegra_clk_spdif_2x,
        tegra_clk_spdif_in,
+       tegra_clk_spdif_in_8,
        tegra_clk_spdif_in_sync,
        tegra_clk_spdif_mux,
        tegra_clk_spdif_out,
        tegra_clk_timer,
        tegra_clk_trace,
        tegra_clk_tsec,
+       tegra_clk_tsec_8,
+       tegra_clk_tsecb,
        tegra_clk_tsensor,
        tegra_clk_tvdac,
        tegra_clk_tvo,
        tegra_clk_uarta,
+       tegra_clk_uarta_8,
        tegra_clk_uartb,
+       tegra_clk_uartb_8,
        tegra_clk_uartc,
+       tegra_clk_uartc_8,
        tegra_clk_uartd,
+       tegra_clk_uartd_8,
        tegra_clk_uarte,
+       tegra_clk_uarte_8,
+       tegra_clk_uartape,
        tegra_clk_usb2,
        tegra_clk_usb3,
        tegra_clk_usbd,
@@ -216,22 +261,32 @@ enum clk_id {
        tegra_clk_vi,
        tegra_clk_vi_8,
        tegra_clk_vi_9,
+       tegra_clk_vi_10,
+       tegra_clk_vi_i2c,
        tegra_clk_vic03,
+       tegra_clk_vic03_8,
        tegra_clk_vim2_clk,
        tegra_clk_vimclk_sync,
        tegra_clk_vi_sensor,
-       tegra_clk_vi_sensor2,
        tegra_clk_vi_sensor_8,
+       tegra_clk_vi_sensor_9,
+       tegra_clk_vi_sensor2,
+       tegra_clk_vi_sensor2_8,
        tegra_clk_xusb_dev,
        tegra_clk_xusb_dev_src,
+       tegra_clk_xusb_dev_src_8,
        tegra_clk_xusb_falcon_src,
+       tegra_clk_xusb_falcon_src_8,
        tegra_clk_xusb_fs_src,
        tegra_clk_xusb_host,
        tegra_clk_xusb_host_src,
+       tegra_clk_xusb_host_src_8,
        tegra_clk_xusb_hs_src,
        tegra_clk_xusb_ss,
        tegra_clk_xusb_ss_src,
+       tegra_clk_xusb_ss_src_8,
        tegra_clk_xusb_ss_div2,
+       tegra_clk_sclk_mux,
        tegra_clk_max,
 };
 
drivers/clk/tegra/clk-tegra-periph.c +3 -0
index 46af9244ba74..bde7286bb16b 100644
@@ -125,6 +125,19 @@
 #define CLK_SOURCE_HDMI_AUDIO 0x668
 #define CLK_SOURCE_VIC03 0x678
 #define CLK_SOURCE_CLK72MHZ 0x66c
+#define CLK_SOURCE_DBGAPB 0x718
+#define CLK_SOURCE_NVENC 0x6a0
+#define CLK_SOURCE_NVDEC 0x698

drivers/clk/tegra/clk-tegra-periph.c line 140

Quoted 10 lines
drivers/clk/tegra/clk-tegra-periph.c +10 -0
+#define CLK_SOURCE_NVJPG 0x69c
+#define CLK_SOURCE_APE 0x6c0
+#define CLK_SOURCE_SOR1 0x410
+#define CLK_SOURCE_SDMMC_LEGACY 0x694
+#define CLK_SOURCE_QSPI 0x6c4
+#define CLK_SOURCE_VI_I2C 0x6c8
+#define CLK_SOURCE_MIPIBIF 0x660
+#define CLK_SOURCE_UARTAPE 0x710
+#define CLK_SOURCE_TSECB 0x6d8
+#define CLK_SOURCE_MAUD 0x6d4

It would be nice if this list was organized better. For example CLK_SOURCE_SOR1, could be next to existing define of SOR0, and the same for TSECB, the UARTAPE, and SDMMC_LEGACY.

Quoted 3 lines

It's unfortunate that the list of clock sources is not sorted by name, by offset value, nor by the way these show up in the TRM.

I'll make a cleanup patchset after this set lands to handle some things like sorting fields like the above, filling in missing kerneldocs for existing fields, etc...

-rhyland

Signature · 1 line
nvpublic
#8 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

Quoted 260 lines · Rhyland Klein
Quoted 259 lines · Benson Leung
Quoted 243 lines · Rhyland Klein

Tegra210 has significant differences in muxes for peripheral clocks. One of the most important changes is that pll_m isn't to be used as a source for peripherals. Therefore, we need to define the new muxes and new clocks to use those muxes for Tegra210 support.

---
 drivers/clk/tegra/clk-id.h           |   57 +++++++-
 drivers/clk/tegra/clk-tegra-periph.c |  257 +++++++++++++++++++++++++++++++++-
 2 files changed, 312 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-id.h +56 -1
index 60738cc954cb..ac6eaba5cc6e 100644
@@ -13,6 +13,7 @@ enum clk_id {
        tegra_clk_amx1,
        tegra_clk_apbdma,
        tegra_clk_apbif,
+       tegra_clk_ape,
        tegra_clk_audio0,
        tegra_clk_audio0_2x,
        tegra_clk_audio0_mux,
@@ -38,6 +39,7 @@ enum clk_id {
        tegra_clk_cile,
        tegra_clk_clk_32k,
        tegra_clk_clk72Mhz,
+       tegra_clk_clk72Mhz_8,
        tegra_clk_clk_m,
        tegra_clk_clk_m_div2,
        tegra_clk_clk_m_div4,
@@ -51,17 +53,21 @@ enum clk_id {
        tegra_clk_cml1,
        tegra_clk_csi,
        tegra_clk_csite,
+       tegra_clk_csite_8,
        tegra_clk_csus,
        tegra_clk_cve,
        tegra_clk_dam0,
        tegra_clk_dam1,
        tegra_clk_dam2,
        tegra_clk_d_audio,
+       tegra_clk_dbgapb,
        tegra_clk_dds,
        tegra_clk_dfll_ref,
        tegra_clk_dfll_soc,
        tegra_clk_disp1,
+       tegra_clk_disp1_8,
        tegra_clk_disp2,
+       tegra_clk_disp2_8,
        tegra_clk_dp2,
        tegra_clk_dpaux,
        tegra_clk_dsialp,
@@ -71,6 +77,7 @@ enum clk_id {
        tegra_clk_dtv,
        tegra_clk_emc,
        tegra_clk_entropy,
+       tegra_clk_entropy_8,
        tegra_clk_epp,
        tegra_clk_epp_8,
        tegra_clk_extern1,
@@ -85,12 +92,15 @@ enum clk_id {
        tegra_clk_gr3d_8,
        tegra_clk_hclk,
        tegra_clk_hda,
+       tegra_clk_hda_8,
        tegra_clk_hda2codec_2x,
+       tegra_clk_hda2codec_2x_8,
        tegra_clk_hda2hdmi,
        tegra_clk_hdmi,
        tegra_clk_hdmi_audio,
        tegra_clk_host1x,
        tegra_clk_host1x_8,
+       tegra_clk_host1x_9,
        tegra_clk_i2c1,
        tegra_clk_i2c2,
        tegra_clk_i2c3,
@@ -110,11 +120,14 @@ enum clk_id {
        tegra_clk_i2s4_sync,
        tegra_clk_isp,
        tegra_clk_isp_8,
+       tegra_clk_isp_9,
        tegra_clk_ispb,
        tegra_clk_kbc,
        tegra_clk_kfuse,
        tegra_clk_la,
+       tegra_clk_maud,
        tegra_clk_mipi,
+       tegra_clk_mipibif,
        tegra_clk_mipi_cal,
        tegra_clk_mpe,
        tegra_clk_mselect,
@@ -124,11 +137,16 @@ enum clk_id {
        tegra_clk_ndspeed,
        tegra_clk_ndspeed_8,
        tegra_clk_nor,
+       tegra_clk_nvdec,
+       tegra_clk_nvenc,
+       tegra_clk_nvjpg,
        tegra_clk_owr,
+       tegra_clk_owr_8,
        tegra_clk_pcie,
        tegra_clk_pclk,
        tegra_clk_pll_a,
        tegra_clk_pll_a_out0,
+       tegra_clk_pll_a1,
        tegra_clk_pll_c,
        tegra_clk_pll_c2,
        tegra_clk_pll_c3,
@@ -140,8 +158,10 @@ enum clk_id {
        tegra_clk_pll_d_out0,
        tegra_clk_pll_dp,
        tegra_clk_pll_e_out0,
+       tegra_clk_pll_g_ref,
        tegra_clk_pll_m,
        tegra_clk_pll_m_out1,
+       tegra_clk_pll_mb,
        tegra_clk_pll_p,
        tegra_clk_pll_p_out1,
        tegra_clk_pll_p_out2,
@@ -160,52 +180,77 @@ enum clk_id {
        tegra_clk_pll_x,
        tegra_clk_pll_x_out0,
        tegra_clk_pwm,
+       tegra_clk_qspi,
        tegra_clk_rtc,
        tegra_clk_sata,
+       tegra_clk_sata_8,
        tegra_clk_sata_cold,
        tegra_clk_sata_oob,
+       tegra_clk_sata_oob_8,
        tegra_clk_sbc1,
        tegra_clk_sbc1_8,
+       tegra_clk_sbc1_9,
        tegra_clk_sbc2,
        tegra_clk_sbc2_8,
+       tegra_clk_sbc2_9,
        tegra_clk_sbc3,
        tegra_clk_sbc3_8,
+       tegra_clk_sbc3_9,
        tegra_clk_sbc4,
        tegra_clk_sbc4_8,
+       tegra_clk_sbc4_9,
        tegra_clk_sbc5,
        tegra_clk_sbc5_8,
        tegra_clk_sbc6,
        tegra_clk_sbc6_8,
        tegra_clk_sclk,
+       tegra_clk_sdmmc_legacy,
        tegra_clk_sdmmc1,
        tegra_clk_sdmmc1_8,
+       tegra_clk_sdmmc1_9,
        tegra_clk_sdmmc2,
        tegra_clk_sdmmc2_8,
+       tegra_clk_sdmmc2_9,
        tegra_clk_sdmmc3,
        tegra_clk_sdmmc3_8,
+       tegra_clk_sdmmc3_9,
        tegra_clk_sdmmc4,
        tegra_clk_sdmmc4_8,
+       tegra_clk_sdmmc4_9,
        tegra_clk_se,
        tegra_clk_soc_therm,
+       tegra_clk_soc_therm_8,
        tegra_clk_sor0,
        tegra_clk_sor0_lvds,
+       tegra_clk_sor1,
+       tegra_clk_sor1_brick,
+       tegra_clk_sor1_src,
        tegra_clk_spdif,
        tegra_clk_spdif_2x,
        tegra_clk_spdif_in,
+       tegra_clk_spdif_in_8,
        tegra_clk_spdif_in_sync,
        tegra_clk_spdif_mux,
        tegra_clk_spdif_out,
        tegra_clk_timer,
        tegra_clk_trace,
        tegra_clk_tsec,
+       tegra_clk_tsec_8,
+       tegra_clk_tsecb,
        tegra_clk_tsensor,
        tegra_clk_tvdac,
        tegra_clk_tvo,
        tegra_clk_uarta,
+       tegra_clk_uarta_8,
        tegra_clk_uartb,
+       tegra_clk_uartb_8,
        tegra_clk_uartc,
+       tegra_clk_uartc_8,
        tegra_clk_uartd,
+       tegra_clk_uartd_8,
        tegra_clk_uarte,
+       tegra_clk_uarte_8,
+       tegra_clk_uartape,
        tegra_clk_usb2,
        tegra_clk_usb3,
        tegra_clk_usbd,
@@ -216,22 +261,32 @@ enum clk_id {
        tegra_clk_vi,
        tegra_clk_vi_8,
        tegra_clk_vi_9,
+       tegra_clk_vi_10,
+       tegra_clk_vi_i2c,
        tegra_clk_vic03,
+       tegra_clk_vic03_8,
        tegra_clk_vim2_clk,
        tegra_clk_vimclk_sync,
        tegra_clk_vi_sensor,
-       tegra_clk_vi_sensor2,
        tegra_clk_vi_sensor_8,
+       tegra_clk_vi_sensor_9,
+       tegra_clk_vi_sensor2,
+       tegra_clk_vi_sensor2_8,
        tegra_clk_xusb_dev,
        tegra_clk_xusb_dev_src,
+       tegra_clk_xusb_dev_src_8,
        tegra_clk_xusb_falcon_src,
+       tegra_clk_xusb_falcon_src_8,
        tegra_clk_xusb_fs_src,
        tegra_clk_xusb_host,
        tegra_clk_xusb_host_src,
+       tegra_clk_xusb_host_src_8,
        tegra_clk_xusb_hs_src,
        tegra_clk_xusb_ss,
        tegra_clk_xusb_ss_src,
+       tegra_clk_xusb_ss_src_8,
        tegra_clk_xusb_ss_div2,
+       tegra_clk_sclk_mux,
        tegra_clk_max,
 };
 
drivers/clk/tegra/clk-tegra-periph.c +3 -0
index 46af9244ba74..bde7286bb16b 100644
@@ -125,6 +125,19 @@
 #define CLK_SOURCE_HDMI_AUDIO 0x668
 #define CLK_SOURCE_VIC03 0x678
 #define CLK_SOURCE_CLK72MHZ 0x66c
+#define CLK_SOURCE_DBGAPB 0x718
+#define CLK_SOURCE_NVENC 0x6a0
+#define CLK_SOURCE_NVDEC 0x698

drivers/clk/tegra/clk-tegra-periph.c line 140

Quoted 10 lines
drivers/clk/tegra/clk-tegra-periph.c +10 -0
+#define CLK_SOURCE_NVJPG 0x69c
+#define CLK_SOURCE_APE 0x6c0
+#define CLK_SOURCE_SOR1 0x410
+#define CLK_SOURCE_SDMMC_LEGACY 0x694
+#define CLK_SOURCE_QSPI 0x6c4
+#define CLK_SOURCE_VI_I2C 0x6c8
+#define CLK_SOURCE_MIPIBIF 0x660
+#define CLK_SOURCE_UARTAPE 0x710
+#define CLK_SOURCE_TSECB 0x6d8
+#define CLK_SOURCE_MAUD 0x6d4

It would be nice if this list was organized better. For example CLK_SOURCE_SOR1, could be next to existing define of SOR0, and the same for TSECB, the UARTAPE, and SDMMC_LEGACY.

Quoted 7 lines
Quoted 3 lines

It's unfortunate that the list of clock sources is not sorted by name, by offset value, nor by the way these show up in the TRM.

I'll make a cleanup patchset after this set lands to handle some things like sorting fields like the above, filling in missing kerneldocs for existing fields, etc...

I sent a patch to fix up the stale kerneldoc that Benson pointed out before I read this, so hopefully you're going to see this before you start working on that part.

Thierry

#9 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

Quoted 271 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 260 lines · Rhyland Klein
Quoted 259 lines · Benson Leung
Quoted 243 lines · Rhyland Klein

Tegra210 has significant differences in muxes for peripheral clocks. One of the most important changes is that pll_m isn't to be used as a source for peripherals. Therefore, we need to define the new muxes and new clocks to use those muxes for Tegra210 support.

---
 drivers/clk/tegra/clk-id.h           |   57 +++++++-
 drivers/clk/tegra/clk-tegra-periph.c |  257 +++++++++++++++++++++++++++++++++-
 2 files changed, 312 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-id.h +56 -1
index 60738cc954cb..ac6eaba5cc6e 100644
@@ -13,6 +13,7 @@ enum clk_id {
        tegra_clk_amx1,
        tegra_clk_apbdma,
        tegra_clk_apbif,
+       tegra_clk_ape,
        tegra_clk_audio0,
        tegra_clk_audio0_2x,
        tegra_clk_audio0_mux,
@@ -38,6 +39,7 @@ enum clk_id {
        tegra_clk_cile,
        tegra_clk_clk_32k,
        tegra_clk_clk72Mhz,
+       tegra_clk_clk72Mhz_8,
        tegra_clk_clk_m,
        tegra_clk_clk_m_div2,
        tegra_clk_clk_m_div4,
@@ -51,17 +53,21 @@ enum clk_id {
        tegra_clk_cml1,
        tegra_clk_csi,
        tegra_clk_csite,
+       tegra_clk_csite_8,
        tegra_clk_csus,
        tegra_clk_cve,
        tegra_clk_dam0,
        tegra_clk_dam1,
        tegra_clk_dam2,
        tegra_clk_d_audio,
+       tegra_clk_dbgapb,
        tegra_clk_dds,
        tegra_clk_dfll_ref,
        tegra_clk_dfll_soc,
        tegra_clk_disp1,
+       tegra_clk_disp1_8,
        tegra_clk_disp2,
+       tegra_clk_disp2_8,
        tegra_clk_dp2,
        tegra_clk_dpaux,
        tegra_clk_dsialp,
@@ -71,6 +77,7 @@ enum clk_id {
        tegra_clk_dtv,
        tegra_clk_emc,
        tegra_clk_entropy,
+       tegra_clk_entropy_8,
        tegra_clk_epp,
        tegra_clk_epp_8,
        tegra_clk_extern1,
@@ -85,12 +92,15 @@ enum clk_id {
        tegra_clk_gr3d_8,
        tegra_clk_hclk,
        tegra_clk_hda,
+       tegra_clk_hda_8,
        tegra_clk_hda2codec_2x,
+       tegra_clk_hda2codec_2x_8,
        tegra_clk_hda2hdmi,
        tegra_clk_hdmi,
        tegra_clk_hdmi_audio,
        tegra_clk_host1x,
        tegra_clk_host1x_8,
+       tegra_clk_host1x_9,
        tegra_clk_i2c1,
        tegra_clk_i2c2,
        tegra_clk_i2c3,
@@ -110,11 +120,14 @@ enum clk_id {
        tegra_clk_i2s4_sync,
        tegra_clk_isp,
        tegra_clk_isp_8,
+       tegra_clk_isp_9,
        tegra_clk_ispb,
        tegra_clk_kbc,
        tegra_clk_kfuse,
        tegra_clk_la,
+       tegra_clk_maud,
        tegra_clk_mipi,
+       tegra_clk_mipibif,
        tegra_clk_mipi_cal,
        tegra_clk_mpe,
        tegra_clk_mselect,
@@ -124,11 +137,16 @@ enum clk_id {
        tegra_clk_ndspeed,
        tegra_clk_ndspeed_8,
        tegra_clk_nor,
+       tegra_clk_nvdec,
+       tegra_clk_nvenc,
+       tegra_clk_nvjpg,
        tegra_clk_owr,
+       tegra_clk_owr_8,
        tegra_clk_pcie,
        tegra_clk_pclk,
        tegra_clk_pll_a,
        tegra_clk_pll_a_out0,
+       tegra_clk_pll_a1,
        tegra_clk_pll_c,
        tegra_clk_pll_c2,
        tegra_clk_pll_c3,
@@ -140,8 +158,10 @@ enum clk_id {
        tegra_clk_pll_d_out0,
        tegra_clk_pll_dp,
        tegra_clk_pll_e_out0,
+       tegra_clk_pll_g_ref,
        tegra_clk_pll_m,
        tegra_clk_pll_m_out1,
+       tegra_clk_pll_mb,
        tegra_clk_pll_p,
        tegra_clk_pll_p_out1,
        tegra_clk_pll_p_out2,
@@ -160,52 +180,77 @@ enum clk_id {
        tegra_clk_pll_x,
        tegra_clk_pll_x_out0,
        tegra_clk_pwm,
+       tegra_clk_qspi,
        tegra_clk_rtc,
        tegra_clk_sata,
+       tegra_clk_sata_8,
        tegra_clk_sata_cold,
        tegra_clk_sata_oob,
+       tegra_clk_sata_oob_8,
        tegra_clk_sbc1,
        tegra_clk_sbc1_8,
+       tegra_clk_sbc1_9,
        tegra_clk_sbc2,
        tegra_clk_sbc2_8,
+       tegra_clk_sbc2_9,
        tegra_clk_sbc3,
        tegra_clk_sbc3_8,
+       tegra_clk_sbc3_9,
        tegra_clk_sbc4,
        tegra_clk_sbc4_8,
+       tegra_clk_sbc4_9,
        tegra_clk_sbc5,
        tegra_clk_sbc5_8,
        tegra_clk_sbc6,
        tegra_clk_sbc6_8,
        tegra_clk_sclk,
+       tegra_clk_sdmmc_legacy,
        tegra_clk_sdmmc1,
        tegra_clk_sdmmc1_8,
+       tegra_clk_sdmmc1_9,
        tegra_clk_sdmmc2,
        tegra_clk_sdmmc2_8,
+       tegra_clk_sdmmc2_9,
        tegra_clk_sdmmc3,
        tegra_clk_sdmmc3_8,
+       tegra_clk_sdmmc3_9,
        tegra_clk_sdmmc4,
        tegra_clk_sdmmc4_8,
+       tegra_clk_sdmmc4_9,
        tegra_clk_se,
        tegra_clk_soc_therm,
+       tegra_clk_soc_therm_8,
        tegra_clk_sor0,
        tegra_clk_sor0_lvds,
+       tegra_clk_sor1,
+       tegra_clk_sor1_brick,
+       tegra_clk_sor1_src,
        tegra_clk_spdif,
        tegra_clk_spdif_2x,
        tegra_clk_spdif_in,
+       tegra_clk_spdif_in_8,
        tegra_clk_spdif_in_sync,
        tegra_clk_spdif_mux,
        tegra_clk_spdif_out,
        tegra_clk_timer,
        tegra_clk_trace,
        tegra_clk_tsec,
+       tegra_clk_tsec_8,
+       tegra_clk_tsecb,
        tegra_clk_tsensor,
        tegra_clk_tvdac,
        tegra_clk_tvo,
        tegra_clk_uarta,
+       tegra_clk_uarta_8,
        tegra_clk_uartb,
+       tegra_clk_uartb_8,
        tegra_clk_uartc,
+       tegra_clk_uartc_8,
        tegra_clk_uartd,
+       tegra_clk_uartd_8,
        tegra_clk_uarte,
+       tegra_clk_uarte_8,
+       tegra_clk_uartape,
        tegra_clk_usb2,
        tegra_clk_usb3,
        tegra_clk_usbd,
@@ -216,22 +261,32 @@ enum clk_id {
        tegra_clk_vi,
        tegra_clk_vi_8,
        tegra_clk_vi_9,
+       tegra_clk_vi_10,
+       tegra_clk_vi_i2c,
        tegra_clk_vic03,
+       tegra_clk_vic03_8,
        tegra_clk_vim2_clk,
        tegra_clk_vimclk_sync,
        tegra_clk_vi_sensor,
-       tegra_clk_vi_sensor2,
        tegra_clk_vi_sensor_8,
+       tegra_clk_vi_sensor_9,
+       tegra_clk_vi_sensor2,
+       tegra_clk_vi_sensor2_8,
        tegra_clk_xusb_dev,
        tegra_clk_xusb_dev_src,
+       tegra_clk_xusb_dev_src_8,
        tegra_clk_xusb_falcon_src,
+       tegra_clk_xusb_falcon_src_8,
        tegra_clk_xusb_fs_src,
        tegra_clk_xusb_host,
        tegra_clk_xusb_host_src,
+       tegra_clk_xusb_host_src_8,
        tegra_clk_xusb_hs_src,
        tegra_clk_xusb_ss,
        tegra_clk_xusb_ss_src,
+       tegra_clk_xusb_ss_src_8,
        tegra_clk_xusb_ss_div2,
+       tegra_clk_sclk_mux,
        tegra_clk_max,
 };
 
drivers/clk/tegra/clk-tegra-periph.c +3 -0
index 46af9244ba74..bde7286bb16b 100644
@@ -125,6 +125,19 @@
 #define CLK_SOURCE_HDMI_AUDIO 0x668
 #define CLK_SOURCE_VIC03 0x678
 #define CLK_SOURCE_CLK72MHZ 0x66c
+#define CLK_SOURCE_DBGAPB 0x718
+#define CLK_SOURCE_NVENC 0x6a0
+#define CLK_SOURCE_NVDEC 0x698

drivers/clk/tegra/clk-tegra-periph.c line 140

Quoted 10 lines
drivers/clk/tegra/clk-tegra-periph.c +10 -0
+#define CLK_SOURCE_NVJPG 0x69c
+#define CLK_SOURCE_APE 0x6c0
+#define CLK_SOURCE_SOR1 0x410
+#define CLK_SOURCE_SDMMC_LEGACY 0x694
+#define CLK_SOURCE_QSPI 0x6c4
+#define CLK_SOURCE_VI_I2C 0x6c8
+#define CLK_SOURCE_MIPIBIF 0x660
+#define CLK_SOURCE_UARTAPE 0x710
+#define CLK_SOURCE_TSECB 0x6d8
+#define CLK_SOURCE_MAUD 0x6d4

It would be nice if this list was organized better. For example CLK_SOURCE_SOR1, could be next to existing define of SOR0, and the same for TSECB, the UARTAPE, and SDMMC_LEGACY.

Quoted 7 lines
Quoted 3 lines

It's unfortunate that the list of clock sources is not sorted by name, by offset value, nor by the way these show up in the TRM.

I'll make a cleanup patchset after this set lands to handle some things like sorting fields like the above, filling in missing kerneldocs for existing fields, etc...

Quoted 5 lines

I sent a patch to fix up the stale kerneldoc that Benson pointed out before I read this, so hopefully you're going to see this before you start working on that part.

Thierry

Yep. Thanks! I'll pull that into my series to handle dependencies.

-rhyland

Quoted 4 lines

* Unknown Key
* 0x7F3EB3A1

Signature · 1 line
nvpublic
#10 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

In reply to Rhyland Klein

Hi Rhyland,

Quoted 6 lines · Rhyland Klein

Tegra210 has significant differences in muxes for peripheral clocks. One of the most important changes is that pll_m isn't to be used as a source for peripherals. Therefore, we need to define the new muxes and new clocks to use those muxes for Tegra210 support.

A couple more clocks worth adding here are HSIC_TRK (clock 209), USB2_TRK (clock 210), and their divider in CLK_SOURCE_USB2_HSIC_TRK.

-Andrew

#11 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

In reply to Rhyland Klein
Quoted 116 lines · Rhyland Klein

Tegra210 has significant differences in muxes for peripheral clocks. One of the most important changes is that pll_m isn't to be used as a source for peripherals. Therefore, we need to define the new muxes and new clocks to use those muxes for Tegra210 support.

---
  drivers/clk/tegra/clk-id.h           |   57 +++++++-
  drivers/clk/tegra/clk-tegra-periph.c |  257 +++++++++++++++++++++++++++++++++-
  2 files changed, 312 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-id.h +0 -0
index 60738cc954cb..ac6eaba5cc6e 100644
drivers/clk/tegra/clk-tegra-periph.c +82 -1
index 46af9244ba74..bde7286bb16b 100644
@@ -303,12 +386,93 @@ static const char *mux_pllm_pllc_pllp_plla[] = {
  #define mux_pllm_pllc_pllp_plla_idx mux_pllp_pllc_pllm_clkm_idx
 
  static const char *mux_pllp_pllc_clkm[] = {
-	"pll_p", "pll_c", "pll_m"
+	"pll_p", "pll_c", "clk_m"
  };
  static u32 mux_pllp_pllc_clkm_idx[] = {
  	[0] = 0, [1] = 1, [2] = 3,
  };
 
+static const char *mux_pllp_pllc_clkm_1[] = {
+	"pll_p", "pll_c", "clk_m"
+};
+static u32 mux_pllp_pllc_clkm_1_idx[] = {
+	[0] = 0, [1] = 2, [2] = 5,
+};
+
+static const char *mux_pllp_pllc_plla_clkm[] = {
+	"pll_p", "pll_c", "pll_a_out0", "clk_m"
+};
+static u32 mux_pllp_pllc_plla_clkm_idx[] = {
+	[0] = 0, [1] = 2, [2] = 4, [3] = 6,
+};
+
+static const char *mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2[] = {
+	"pll_p", "pll_c", "pll_c4_out0", "pll_c4_out1", "clk_m", "pll_c4_out2"
+};
+static u32 mux_pllp_pllc_pllc4_out0_pllc4_out1_clkm_pllc4_out2_idx[] = {
+	[0] = 0, [1] = 2, [2] = 3, [3] = 5, [4] = 6, [5] = 7,
+};
+
+static const char *
+mux_pllp_pllc_pllc_out1_pllc4_out2_pllc4_out1_clkm_pllc4_out0[] = {
+	"pll_p", "pll_c_out1", "pll_c", "pll_c4_out2", "pll_c4_out1",
+	"clk_m", "pll_c4_out0"
+};
+static u32
+mux_pllp_pllc_pllc_out1_pllc4_out2_pllc4_out1_clkm_pllc4_out0_idx[] = {
+	[0] = 0, [1] = 1, [2] = 2, [3] = 4, [4] = 5, [5] = 6, [6] = 7,
+};
+
+static const char *mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0[] = {
+	"pll_p", "pll_c4_out2", "pll_c4_out1", "clk_m", "pll_c4_out0"
+};
+static u32 mux_pllp_pllc4_out2_pllc4_out1_clkm_pllc4_out0_idx[] = {
+	[0] = 0, [1] = 3, [2] = 4, [3] = 6, [4] = 7,
+};
+
+static const char *mux_pllp_clkm_pllc4_out2_out1_out0_lj[] = {
+	"pll_p",
+	"pll_c4_out2", "pll_c4_out0",	/* LJ input */
+	"pll_c4_out2", "pll_c4_out1",
+	"pll_c4_out1",			/* LJ input */
+	"clk_m", "pll_c4_out0"
+};
+#define mux_pllp_clkm_pllc4_out2_out1_out0_lj_idx NULL
+
+static const char *mux_pllp_pllc2_c_c3_clkm[] = {
+	"pll_p", "pll_c2", "pll_c", "pll_c3", "clk_m"
+};
+static u32 mux_pllp_pllc2_c_c3_clkm_idx[] = {
+	[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 6,
+};
+
+static const char *mux_pllp_clkm_clk32_plle[] = {
+	"pll_p", "clk_m", "clk_32k", "pll_e"
+};
+static u32 mux_pllp_clkm_clk32_plle_idx[] = {
+	[0] = 0, [1] = 2, [2] = 4, [3] = 6,
+};
+
+static const char *mux_pllp_pllp_out3_clkm_clk32k_plla[] = {
+	"pll_p", "pll_p_out3", "clk_m", "clk_32k", "pll_a_out0"
+};
+#define mux_pllp_pllp_out3_clkm_clk32k_plla_idx NULL
+
+static const char *mux_pllp_out3_clkm_pllp_pllc4[] = {
+	"pll_p_out3", "clk_m", "pll_p", "pll_c4_out0", "pll_c4_out1",
+	"pll_c4_out2"
+};
+static u32 mux_pllp_out3_clkm_pllp_pllc4_idx[] = {
+	[0] = 0, [1] = 3, [2] = 4, [3] = 5, [4] = 6, [5] = 7,
+};
+
+static const char *mux_clkm_pllp_pllre[] = {
+	"clk_m", "pll_p_out_xusb", "pll_re_out"
+};
+static u32 mux_clkm_pllp_pllre_idx[] = {
+	[0] = 0, [1] = 1, [2] = 5,
+};
+
  static const char *mux_pllp_pllc_clkm_clk32[] = {
  	"pll_p", "pll_c", "clk_m", "clk_32k"
  };

drivers/clk/tegra/clk-tegra-periph.c static u32 mux_clkm_48M_pllp_480M_idx[] = { · line 503

Quoted 7 lines
drivers/clk/tegra/clk-tegra-periph.c +4 -0
@@ -333,6 +497,11 @@ static u32 mux_clkm_48M_pllp_480M_idx[] = {
  	[0] = 0, [1] = 2, [2] = 4, [3] = 6,
  };
 
+static const char *mux_clkm_pllre_clk32_480M[] = {
+	"clk_m", "pll_re_out", "clk_32k", "pll_u_480M"
+};
+#define mux_clkm_pllre_clk32_480M_idx NULL

Please help to replace above

#define mux_clkm_pllre_clk32_480M_idx NULL

with

static u32 mux_clkm_pllre_clk32_480M_idx[] = {

       [0] = 0, [1] = 1, [2] = 2, [3] = 3,
};

Thanks.

drivers/clk/tegra/clk-tegra-periph.c static u32 mux_clkm_48M_pllp_480M_idx[] = { · line 507

Quoted 5 lines
drivers/clk/tegra/clk-tegra-periph.c +1 -0
+
  static const char *mux_clkm_pllre_clk32_480M_pllc_ref[] = {
  	"clk_m", "pll_re_out", "clk_32k", "pll_u_480M", "pll_c", "pll_ref"
  };

--nvpublic

#12 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

Quoted 1 line · Jim Lin

On 05/05/2015 12:37 AM, Rhyland Klein wrote:

[...]

Quoted 1 line
Quoted 1 line
drivers/clk/tegra/clk-tegra-periph.c +0 -0

[...]

Quoted 9 lines

drivers/clk/tegra/clk-tegra-periph.c static u32 mux_clkm_48M_pllp_480M_idx[] = { · line 502

Quoted 7 lines
drivers/clk/tegra/clk-tegra-periph.c +4 -0
@@ -333,6 +497,11 @@ static u32 mux_clkm_48M_pllp_480M_idx[] = {
 	[0] = 0, [1] = 2, [2] = 4, [3] = 6,
 };
+static const char *mux_clkm_pllre_clk32_480M[] = {
+	"clk_m", "pll_re_out", "clk_32k", "pll_u_480M"
+};
+#define mux_clkm_pllre_clk32_480M_idx NULL

Please help to replace above

Quoted 8 lines

#define mux_clkm_pllre_clk32_480M_idx NULL

with

static u32 mux_clkm_pllre_clk32_480M_idx[] = {

       [0] = 0, [1] = 1, [2] = 2, [3] = 3,
};

Isn't that the default already if you specify NULL as index table?

Thierry

#13 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

Quoted 18 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 1 line · Jim Lin

On 05/05/2015 12:37 AM, Rhyland Klein wrote:

[...]

Quoted 1 line
Quoted 1 line
drivers/clk/tegra/clk-tegra-periph.c +0 -0

[...]

Quoted 11 lines

drivers/clk/tegra/clk-tegra-periph.c static u32 mux_clkm_48M_pllp_480M_idx[] = { · line 502

Quoted 7 lines
drivers/clk/tegra/clk-tegra-periph.c +4 -0
@@ -333,6 +497,11 @@ static u32 mux_clkm_48M_pllp_480M_idx[] = {
 	[0] = 0, [1] = 2, [2] = 4, [3] = 6,
 };
+static const char *mux_clkm_pllre_clk32_480M[] = {
+	"clk_m", "pll_re_out", "clk_32k", "pll_u_480M"
+};
+#define mux_clkm_pllre_clk32_480M_idx NULL

Please help to replace above

#define mux_clkm_pllre_clk32_480M_idx NULL

Quoted 8 lines
Quoted 6 lines

with

static u32 mux_clkm_pllre_clk32_480M_idx[] = {

       [0] = 0, [1] = 1, [2] = 2, [3] = 3,
};

Isn't that the default already if you specify NULL as index table?

It should be, so there shouldn't be a need to explicitly define this.

-rhyland

Quoted 6 lines

Thierry

* Unknown Key
* 0x7F3EB3A1

Signature · 1 line
nvpublic
#14 lore raw

Re: [PATCH v4 02/20] clk: tegra: periph: add new periph clks and muxes for Tegra210

In reply to Rhyland Klein

On Mon, May 04, 2015 at 12:37:22PM -0400, Rhyland Klein wrote:
[...]

Quoted 1 line
drivers/clk/tegra/clk-tegra-periph.c +0 -0

[...]

drivers/clk/tegra/clk-tegra-periph.c static u32 mux_pllm_pllc2_c_c3_pllp_plla_pllc4_idx[] = { · line 569

Quoted 8 lines
drivers/clk/tegra/clk-tegra-periph.c +4 -0
@@ -387,6 +563,32 @@ static u32 mux_pllm_pllc2_c_c3_pllp_plla_pllc4_idx[] = {
 	[0] = 0, [1] = 1, [2] = 2, [3] = 3, [4] = 4, [5] = 6, [6] = 7,
 };
 
+/* SOR1 mux'es */
+static const char *mux_pllp_plld_plld2_clkm[] = {
+	"pll_p", "pll_d_out0", "pll_d2", "clk_m"
+};

I think "pll_d2" above needs to be "pll_d2_out0". Otherwise we're not going to be able to make HDMI work.

drivers/clk/tegra/clk-tegra-periph.c static u32 mux_pllm_pllc2_c_c3_pllp_plla_pllc4_idx[] = { · line 572

Quoted 3 lines
drivers/clk/tegra/clk-tegra-periph.c +3 -0
+static u32 mux_pllp_plld_plld2_clkm_idx[] = {
+	[0] = 0, [1] = 2, [2] = 5, [3] = 6
+};

I also think the below...

drivers/clk/tegra/clk-tegra-periph.c static u32 mux_pllm_pllc2_c_c3_pllp_plla_pllc4_idx[] = { · line 582

Quoted 9 lines
drivers/clk/tegra/clk-tegra-periph.c +9 -0
+static const char *mux_plldp_sor1_src[] = {
+	"pll_dp", "clk_sor1_src"
+};
+#define mux_plldp_sor1_src_idx NULL
+
+static const char *mux_clkm_sor1_brick_sor1_src[] = {
+	"clk_m", "sor1_brick", "sor1_src", "sor1_brick"
+};
+#define mux_clkm_sor1_brick_sor1_src_idx NULL

... aren't going to cut it. The problem is that we now have a three level hierarchy, which makes it very cumbersome to set the correct parent from the display driver. I have a local patch that implements this by adding a new type of mux which works on a mask rather than a single bitfield so that we can represent the various parents of the SOR1 clock in a single level.

I think for now we can leave this in place and apply my patch on top after everybody agrees it's the right thing to do.

Thierry

#15 lore raw

PATCH v4 3/20 clk: tegra: pll: add tegra_pll_wait_for_lock to clk header

In reply to Rhyland Klein

Create a wrapper interface to make use of the existing clk_pll_wait_for_lock. This will be useful for implementations of callbacks in Tegra SoC specific clock drivers.

---
 drivers/clk/tegra/clk-pll.c |    5 +++++
 drivers/clk/tegra/clk.h     |    1 +
 2 files changed, 6 insertions(+)
drivers/clk/tegra/clk-pll.c +5 -0
index 05c6d08a6695..b9a739ce4b98 100644
@@ -269,6 +269,11 @@ static int clk_pll_wait_for_lock(struct tegra_clk_pll *pll)
 	return -1;
 }
 
+int tegra_pll_wait_for_lock(struct tegra_clk_pll *pll)
+{
+	return clk_pll_wait_for_lock(pll);
+}
+
 static int clk_pll_is_enabled(struct clk_hw *hw)
 {
 	struct tegra_clk_pll *pll = to_clk_pll(hw);
drivers/clk/tegra/clk.h +1 -0
index dfea6f367977..5759b8bfb80e 100644
@@ -647,5 +647,6 @@ void tegra114_clock_deassert_dfll_dvco_reset(void);
 
 typedef void (*tegra_clk_apply_init_table_func)(void);
 extern tegra_clk_apply_init_table_func tegra_clk_apply_init_table;
+int tegra_pll_wait_for_lock(struct tegra_clk_pll *pll);
 
 #endif /* TEGRA_CLK_H */
Signature · 1 line
1.7.9.5
#16 lore raw

PATCH v4 4/20 clk: tegra: pll: simplify clk_enable_path

In reply to Rhyland Klein

Instead of having multiple similar wrapper functions for _clk_pll_[enable|disable], we can simplify it to single wrappers and use checks to avoid the logic we don't want to use.

---
v2:
- Moved the iddq settings into _clk_pll_enable/disable. This is because some places in this file call directly into these internal functions, but still need the iddq/reset logic to happen.

 drivers/clk/tegra/clk-pll.c |   76 +++++++++++++------------------------------
 1 file changed, 22 insertions(+), 54 deletions(-)
drivers/clk/tegra/clk-pll.c +22 -54
index b9a739ce4b98..1e1018dd466f 100644
@@ -295,6 +295,13 @@ static void _clk_pll_enable(struct clk_hw *hw)
 	struct tegra_clk_pll *pll = to_clk_pll(hw);
 	u32 val;
 
+	if (pll->params->iddq_reg) {
+		val = pll_readl(pll->params->iddq_reg, pll);
+		val &= ~BIT(pll->params->iddq_bit_idx);
+		pll_writel(val, pll->params->iddq_reg, pll);
+		udelay(2);
+	}
+
 	clk_pll_enable_lock(pll);
 
 	val = pll_readl_base(pll);
@@ -326,6 +333,13 @@ static void _clk_pll_disable(struct clk_hw *hw)
 		val &= ~PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE;
 		writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE);
 	}
+
+	if (pll->params->iddq_reg) {
+		val = pll_readl(pll->params->iddq_reg, pll);
+		val |= BIT(pll->params->iddq_bit_idx);
+		pll_writel(val, pll->params->iddq_reg, pll);
+		udelay(2);
+	}
 }
 
 static int clk_pll_enable(struct clk_hw *hw)
@@ -876,52 +890,6 @@ static int _setup_dynamic_ramp(struct tegra_clk_pll_params *pll_params,
 	return 0;
 }
 
-static int clk_pll_iddq_enable(struct clk_hw *hw)
-{
-	struct tegra_clk_pll *pll = to_clk_pll(hw);
-	unsigned long flags = 0;
-
-	u32 val;
-	int ret;
-
-	if (pll->lock)
-		spin_lock_irqsave(pll->lock, flags);
-
-	val = pll_readl(pll->params->iddq_reg, pll);
-	val &= ~BIT(pll->params->iddq_bit_idx);
-	pll_writel(val, pll->params->iddq_reg, pll);
-	udelay(2);
-
-	_clk_pll_enable(hw);
-
-	ret = clk_pll_wait_for_lock(pll);
-
-	if (pll->lock)
-		spin_unlock_irqrestore(pll->lock, flags);
-
-	return 0;
-}
-
-static void clk_pll_iddq_disable(struct clk_hw *hw)
-{
-	struct tegra_clk_pll *pll = to_clk_pll(hw);
-	unsigned long flags = 0;
-	u32 val;
-
-	if (pll->lock)
-		spin_lock_irqsave(pll->lock, flags);
-
-	_clk_pll_disable(hw);
-
-	val = pll_readl(pll->params->iddq_reg, pll);
-	val |= BIT(pll->params->iddq_bit_idx);
-	pll_writel(val, pll->params->iddq_reg, pll);
-	udelay(2);
-
-	if (pll->lock)
-		spin_unlock_irqrestore(pll->lock, flags);
-}
-
 static int _calc_dynamic_ramp_rate(struct clk_hw *hw,
 				struct tegra_clk_pll_freq_table *cfg,
 				unsigned long rate, unsigned long parent_rate)
@@ -1518,8 +1486,8 @@ struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,
 	defined(CONFIG_ARCH_TEGRA_132_SOC)
 static const struct clk_ops tegra_clk_pllxc_ops = {
 	.is_enabled = clk_pll_is_enabled,
-	.enable = clk_pll_iddq_enable,
-	.disable = clk_pll_iddq_disable,
+	.enable = clk_pll_enable,
+	.disable = clk_pll_disable,
 	.recalc_rate = clk_pll_recalc_rate,
 	.round_rate = clk_pll_ramp_round_rate,
 	.set_rate = clk_pllxc_set_rate,
@@ -1527,8 +1495,8 @@ static const struct clk_ops tegra_clk_pllxc_ops = {
 
 static const struct clk_ops tegra_clk_pllm_ops = {
 	.is_enabled = clk_pll_is_enabled,
-	.enable = clk_pll_iddq_enable,
-	.disable = clk_pll_iddq_disable,
+	.enable = clk_pll_enable,
+	.disable = clk_pll_disable,
 	.recalc_rate = clk_pll_recalc_rate,
 	.round_rate = clk_pll_ramp_round_rate,
 	.set_rate = clk_pllm_set_rate,
@@ -1545,8 +1513,8 @@ static const struct clk_ops tegra_clk_pllc_ops = {
 
 static const struct clk_ops tegra_clk_pllre_ops = {
 	.is_enabled = clk_pll_is_enabled,
-	.enable = clk_pll_iddq_enable,
-	.disable = clk_pll_iddq_disable,
+	.enable = clk_pll_enable,
+	.disable = clk_pll_disable,
 	.recalc_rate = clk_pllre_recalc_rate,
 	.round_rate = clk_pllre_round_rate,
 	.set_rate = clk_pllre_set_rate,
@@ -1815,8 +1783,8 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,
 #if defined(CONFIG_ARCH_TEGRA_124_SOC) || defined(CONFIG_ARCH_TEGRA_132_SOC)
 static const struct clk_ops tegra_clk_pllss_ops = {
 	.is_enabled = clk_pll_is_enabled,
-	.enable = clk_pll_iddq_enable,
-	.disable = clk_pll_iddq_disable,
+	.enable = clk_pll_enable,
+	.disable = clk_pll_disable,
 	.recalc_rate = clk_pll_recalc_rate,
 	.round_rate = clk_pll_ramp_round_rate,
 	.set_rate = clk_pllxc_set_rate,
Signature · 1 line
1.7.9.5
Reviewed-by on v4 4/20
#17 lore raw

Re: [PATCH v4 04/20] clk: tegra: pll: simplify clk_enable_path

Quoted 5 lines · Rhyland Klein

Instead of having multiple similar wrapper functions for _clk_pll_[enable|disable], we can simplify it to single wrappers and use checks to avoid the logic we don't want to use.

Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#18 lore raw

PATCH v4 5/20 clk: tegra: pll: update warning msg

In reply to Rhyland Klein

Swap out the generic WARN_ON with a WARN which gives more information about what is happening.

---
 drivers/clk/tegra/clk-pll.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-pll.c +2 -1
index 1e1018dd466f..0282d9f4f2d7 100644
@@ -692,7 +692,8 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
 
 	pdiv = _hw_to_p_div(hw, cfg.p);
 	if (pdiv < 0) {
-		WARN_ON(1);
+		WARN(1, "Clock %s has invalid pdiv value : 0x%x\n",
+			__clk_get_name(hw->clk), cfg.p);
 		pdiv = 1;
 	}
 
Signature · 1 line
1.7.9.5
#20 lore raw

PATCH v4 6/20 clk: tegra: pll-params: change misc_reg count from 3 -> 6

In reply to Rhyland Klein

From: Bill Huang <[email protected]>

New SoC's may have more then 3 MISC registers, so bump up the array size and use a #define to be more informative about the value.

---
 drivers/clk/tegra/clk.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk.h +3 -1
index 5759b8bfb80e..8e7361886cf9 100644
@@ -156,6 +156,8 @@ struct div_nmp {
 	u8		override_divp_shift;
 };
 
+#define MAX_PLL_MISC_REG_COUNT	6
+
 /**
  * struct clk_pll_params - PLL parameters
  *
@@ -213,7 +215,7 @@ struct tegra_clk_pll_params {
 	u32		iddq_bit_idx;
 	u32		aux_reg;
 	u32		dyn_ramp_reg;
-	u32		ext_misc_reg[3];
+	u32		ext_misc_reg[MAX_PLL_MISC_REG_COUNT];
 	u32		pmc_divnm_reg;
 	u32		pmc_divp_reg;
 	u32		flags;
Signature · 1 line
1.7.9.5
Reviewed-by on v4 6/20
#21 lore raw

Re: [PATCH v4 06/20] clk: tegra: pll-params: change misc_reg count from 3 -> 6

Quoted 24 lines · Rhyland Klein

From: Bill Huang <[email protected]>

New SoC's may have more then 3 MISC registers, so bump up the array size and use a #define to be more informative about the value.

---
 drivers/clk/tegra/clk.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk.h +2 -0
index 5759b8bfb80e..8e7361886cf9 100644
@@ -156,6 +156,8 @@ struct div_nmp {
        u8              override_divp_shift;
 };
 
+#define MAX_PLL_MISC_REG_COUNT 6
+
 /**
  * struct clk_pll_params - PLL parameters
  *

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 221

Quoted 8 lines
drivers/clk/tegra/clk.h +1 -1
@@ -213,7 +215,7 @@ struct tegra_clk_pll_params {
        u32             iddq_bit_idx;
        u32             aux_reg;
        u32             dyn_ramp_reg;
-       u32             ext_misc_reg[3];
+       u32             ext_misc_reg[MAX_PLL_MISC_REG_COUNT];
        u32             pmc_divnm_reg;
        u32             pmc_divp_reg;
        u32             flags;

Missing kernel doc above for ext_misc_reg and some other surrounding members.

Otherwise,

Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#22 lore raw

Re: [PATCH v4 06/20] clk: tegra: pll-params: change misc_reg count from 3 -> 6

Quoted 28 lines · Benson Leung
Quoted 27 lines · Rhyland Klein

From: Bill Huang <[email protected]>

New SoC's may have more then 3 MISC registers, so bump up the array size and use a #define to be more informative about the value.

---
 drivers/clk/tegra/clk.h |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk.h +2 -0
index 5759b8bfb80e..8e7361886cf9 100644
@@ -156,6 +156,8 @@ struct div_nmp {
        u8              override_divp_shift;
 };
 
+#define MAX_PLL_MISC_REG_COUNT 6
+
 /**
  * struct clk_pll_params - PLL parameters
  *
@@ -213,7 +215,7 @@ struct tegra_clk_pll_params {
        u32             iddq_bit_idx;
        u32             aux_reg;
        u32             dyn_ramp_reg;
Quoted 8 lines

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 221

Quoted 5 lines
drivers/clk/tegra/clk.h +1 -1
-       u32             ext_misc_reg[3];
+       u32             ext_misc_reg[MAX_PLL_MISC_REG_COUNT];
        u32             pmc_divnm_reg;
        u32             pmc_divp_reg;
        u32             flags;

Missing kernel doc above for ext_misc_reg and some other surrounding members.

I added the missing kerneldoc in that patch I sent out earlier. The problem is preexisting for this field, so doing it in a separate patch is fine in my opinion.

Thierry

#23 lore raw

PATCH v4 7/20 clk: tegra: pll: Don't unconditionally set LOCK flags

In reply to Rhyland Klein

SoC specific drivers should define the appropriate flags for each PLL rather than relying on the registration functions to automatically set flags on their behalf. This will properly allow for changes between SoC generations where flags might be different and allow sharing the same logic functions.

---
 drivers/clk/tegra/clk-pll.c      |   11 ++---------
 drivers/clk/tegra/clk-tegra114.c |   23 +++++++++++++----------
 drivers/clk/tegra/clk-tegra124.c |   24 +++++++++++++++---------
 drivers/clk/tegra/clk-tegra20.c  |   18 ++++++++++--------
 drivers/clk/tegra/clk-tegra30.c  |   24 +++++++++++++++---------
 5 files changed, 55 insertions(+), 45 deletions(-)
drivers/clk/tegra/clk-pll.c +2 -9
index 0282d9f4f2d7..13d86c5b234d 100644
@@ -1434,7 +1434,7 @@ struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,
 	struct clk *clk;
 
 	pll_params->flags |= TEGRA_PLL_BYPASS;
-	pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
+
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
 	if (IS_ERR(pll))
 		return ERR_CAST(pll);
@@ -1464,8 +1464,7 @@ struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,
 	struct tegra_clk_pll *pll;
 	struct clk *clk;
 
-	pll_params->flags |= TEGRA_PLL_LOCK_MISC | TEGRA_PLL_BYPASS;
-	pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
+	pll_params->flags |= TEGRA_PLL_BYPASS;
 
 	if (!pll_params->div_nmp)
 		pll_params->div_nmp = &pll_e_nmp;
@@ -1569,7 +1568,6 @@ struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
 		writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg);
 	}
 
-	pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
 	if (IS_ERR(pll))
 		return ERR_CAST(pll);
@@ -1592,8 +1590,6 @@ struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name,
 	struct tegra_clk_pll *pll;
 	struct clk *clk;
 
-	pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_LOCK_MISC;
-
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
@@ -1653,7 +1649,6 @@ struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
 	pll_params->flags |= TEGRA_PLL_BYPASS;
-	pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
 	pll_params->flags |= TEGRA_PLLM;
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
 	if (IS_ERR(pll))
@@ -1751,7 +1746,6 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,
 	struct clk *clk;
 	u32 val, val_aux;
 
-	pll_params->flags |= TEGRA_PLL_HAS_LOCK_ENABLE;
 	pll = _tegra_init_pll(clk_base, NULL, pll_params, lock);
 	if (IS_ERR(pll))
 		return ERR_CAST(pll);
@@ -1813,7 +1807,6 @@ struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name,
 		return ERR_PTR(-EINVAL);
 	}
 
-	pll_params->flags = TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_USE_LOCK;
 	pll = _tegra_init_pll(clk_base, NULL, pll_params, lock);
 	if (IS_ERR(pll))
 		return ERR_CAST(pll);
drivers/clk/tegra/clk-tegra114.c +13 -10
index 0d67efb3dd6a..5830c921c847 100644
@@ -234,7 +234,7 @@ static struct tegra_clk_pll_params pll_c_params = {
 	.pdiv_tohw = pllxc_p,
 	.div_nmp = &pllxc_nmp,
 	.freq_table = pll_c_freq_table,
-	.flags = TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct div_nmp pllcx_nmp = {
@@ -353,7 +353,7 @@ static struct tegra_clk_pll_params pll_m_params = {
 	.pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE,
 	.pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2,
 	.freq_table = pll_m_freq_table,
-	.flags = TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct div_nmp pllp_nmp = {
@@ -388,7 +388,8 @@ static struct tegra_clk_pll_params pll_p_params = {
 	.lock_delay = 300,
 	.div_nmp = &pllp_nmp,
 	.freq_table = pll_p_freq_table,
-	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 	.fixed_rate = 408000000,
 };
 
@@ -418,7 +419,8 @@ static struct tegra_clk_pll_params pll_a_params = {
 	.lock_delay = 300,
 	.div_nmp = &pllp_nmp,
 	.freq_table = pll_a_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_freq_table pll_d_freq_table[] = {
@@ -457,7 +459,7 @@ static struct tegra_clk_pll_params pll_d_params = {
 	.div_nmp = &pllp_nmp,
 	.freq_table = pll_d_freq_table,
 	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_d2_params = {
@@ -475,7 +477,7 @@ static struct tegra_clk_pll_params pll_d2_params = {
 	.div_nmp = &pllp_nmp,
 	.freq_table = pll_d_freq_table,
 	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct pdiv_map pllu_p[] = {
@@ -518,7 +520,7 @@ static struct tegra_clk_pll_params pll_u_params = {
 	.div_nmp = &pllu_nmp,
 	.freq_table = pll_u_freq_table,
 	.flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_freq_table pll_x_freq_table[] = {
@@ -553,7 +555,7 @@ static struct tegra_clk_pll_params pll_x_params = {
 	.pdiv_tohw = pllxc_p,
 	.div_nmp = &pllxc_nmp,
 	.freq_table = pll_x_freq_table,
-	.flags = TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
@@ -588,7 +590,7 @@ static struct tegra_clk_pll_params pll_e_params = {
 	.lock_delay = 300,
 	.div_nmp = &plle_nmp,
 	.freq_table = pll_e_freq_table,
-	.flags = TEGRA_PLL_FIXED,
+	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_LOCK_ENABLE,
 	.fixed_rate = 100000000,
 };
 
@@ -616,7 +618,8 @@ static struct tegra_clk_pll_params pll_re_vco_params = {
 	.iddq_reg = PLLRE_MISC,
 	.iddq_bit_idx = PLLRE_IDDQ_BIT,
 	.div_nmp = &pllre_nmp,
-	.flags = TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE |
+		 TEGRA_PLL_LOCK_MISC,
 };
 
 /* possible OSC frequencies in Hz */
drivers/clk/tegra/clk-tegra124.c +15 -9
index 169e236f3627..44b3cc4a0aa0 100644
@@ -216,7 +216,7 @@ static struct tegra_clk_pll_params pll_x_params = {
 	.pdiv_tohw = pllxc_p,
 	.div_nmp = &pllxc_nmp,
 	.freq_table = pll_x_freq_table,
-	.flags = TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_freq_table pll_c_freq_table[] = {
@@ -250,7 +250,7 @@ static struct tegra_clk_pll_params pll_c_params = {
 	.pdiv_tohw = pllxc_p,
 	.div_nmp = &pllxc_nmp,
 	.freq_table = pll_c_freq_table,
-	.flags = TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct div_nmp pllcx_nmp = {
@@ -384,6 +384,7 @@ static struct tegra_clk_pll_params pll_c4_params = {
 	.ext_misc_reg[1] = 0x5b0,
 	.ext_misc_reg[2] = 0x5b4,
 	.freq_table = pll_c4_freq_table,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct pdiv_map pllm_p[] = {
@@ -431,7 +432,7 @@ static struct tegra_clk_pll_params pll_m_params = {
 	.pmc_divnm_reg = PMC_PLLM_WB0_OVERRIDE,
 	.pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE_2,
 	.freq_table = pll_m_freq_table,
-	.flags = TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_freq_table pll_e_freq_table[] = {
@@ -467,7 +468,7 @@ static struct tegra_clk_pll_params pll_e_params = {
 	.lock_delay = 300,
 	.div_nmp = &plle_nmp,
 	.freq_table = pll_e_freq_table,
-	.flags = TEGRA_PLL_FIXED,
+	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_LOCK_ENABLE,
 	.fixed_rate = 100000000,
 };
 
@@ -505,7 +506,8 @@ static struct tegra_clk_pll_params pll_re_vco_params = {
 	.iddq_reg = PLLRE_MISC,
 	.iddq_bit_idx = PLLRE_IDDQ_BIT,
 	.div_nmp = &pllre_nmp,
-	.flags = TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE |
+		 TEGRA_PLL_LOCK_MISC,
 };
 
 static struct div_nmp pllp_nmp = {
@@ -541,7 +543,8 @@ static struct tegra_clk_pll_params pll_p_params = {
 	.div_nmp = &pllp_nmp,
 	.freq_table = pll_p_freq_table,
 	.fixed_rate = 408000000,
-	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_USE_LOCK |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_freq_table pll_a_freq_table[] = {
@@ -569,7 +572,8 @@ static struct tegra_clk_pll_params pll_a_params = {
 	.lock_delay = 300,
 	.div_nmp = &pllp_nmp,
 	.freq_table = pll_a_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct div_nmp plld_nmp = {
@@ -617,7 +621,7 @@ static struct tegra_clk_pll_params pll_d_params = {
 	.div_nmp = &plld_nmp,
 	.freq_table = pll_d_freq_table,
 	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_freq_table tegra124_pll_d2_freq_table[] = {
@@ -650,6 +654,7 @@ static struct tegra_clk_pll_params tegra124_pll_d2_params = {
 	.ext_misc_reg[2] = 0x578,
 	.max_p = 15,
 	.freq_table = tegra124_pll_d2_freq_table,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_freq_table pll_dp_freq_table[] = {
@@ -682,6 +687,7 @@ static struct tegra_clk_pll_params pll_dp_params = {
 	.ext_misc_reg[2] = 0x5a0,
 	.max_p = 5,
 	.freq_table = pll_dp_freq_table,
+	.flags = TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct pdiv_map pllu_p[] = {
@@ -724,7 +730,7 @@ static struct tegra_clk_pll_params pll_u_params = {
 	.div_nmp = &pllu_nmp,
 	.freq_table = pll_u_freq_table,
 	.flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 struct utmi_clk_param {
drivers/clk/tegra/clk-tegra20.c +10 -8
index 41272dcc9e22..98ed1a9b8f65 100644
@@ -303,7 +303,7 @@ static struct tegra_clk_pll_params pll_c_params = {
 	.lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_c_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_m_params = {
@@ -319,7 +319,7 @@ static struct tegra_clk_pll_params pll_m_params = {
 	.lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_m_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_p_params = {
@@ -335,7 +335,8 @@ static struct tegra_clk_pll_params pll_p_params = {
 	.lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_p_freq_table,
-	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON,
+	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 	.fixed_rate =  216000000,
 };
 
@@ -352,7 +353,7 @@ static struct tegra_clk_pll_params pll_a_params = {
 	.lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_a_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_d_params = {
@@ -368,7 +369,7 @@ static struct tegra_clk_pll_params pll_d_params = {
 	.lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE,
 	.lock_delay = 1000,
 	.freq_table = pll_d_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct pdiv_map pllu_p[] = {
@@ -391,7 +392,7 @@ static struct tegra_clk_pll_params pll_u_params = {
 	.lock_delay = 1000,
 	.pdiv_tohw = pllu_p,
 	.freq_table = pll_u_freq_table,
-	.flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON,
+	.flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_x_params = {
@@ -407,7 +408,7 @@ static struct tegra_clk_pll_params pll_x_params = {
 	.lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_x_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_e_params = {
@@ -423,7 +424,8 @@ static struct tegra_clk_pll_params pll_e_params = {
 	.lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE,
 	.lock_delay = 0,
 	.freq_table = pll_e_freq_table,
-	.flags = TEGRA_PLL_FIXED,
+	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_LOCK_MISC |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 	.fixed_rate = 100000000,
 };
 
drivers/clk/tegra/clk-tegra30.c +15 -9
index 3198c7b7946c..0d84e7ee10cd 100644
@@ -423,7 +423,8 @@ static struct tegra_clk_pll_params pll_c_params = {
 	.lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_c_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct div_nmp pllm_nmp = {
@@ -455,7 +456,8 @@ static struct tegra_clk_pll_params pll_m_params = {
 	.pmc_divp_reg = PMC_PLLM_WB0_OVERRIDE,
 	.freq_table = pll_m_freq_table,
 	.flags = TEGRA_PLLM | TEGRA_PLL_HAS_CPCON |
-		 TEGRA_PLL_SET_DCCON | TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_SET_DCCON | TEGRA_PLL_USE_LOCK |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_p_params = {
@@ -471,7 +473,8 @@ static struct tegra_clk_pll_params pll_p_params = {
 	.lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_p_freq_table,
-	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_FIXED | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 	.fixed_rate = 408000000,
 };
 
@@ -488,7 +491,8 @@ static struct tegra_clk_pll_params pll_a_params = {
 	.lock_enable_bit_idx = PLL_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_a_freq_table,
-	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK,
+	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_USE_LOCK |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_d_params = {
@@ -505,7 +509,7 @@ static struct tegra_clk_pll_params pll_d_params = {
 	.lock_delay = 1000,
 	.freq_table = pll_d_freq_table,
 	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 
 };
 
@@ -523,7 +527,7 @@ static struct tegra_clk_pll_params pll_d2_params = {
 	.lock_delay = 1000,
 	.freq_table = pll_d_freq_table,
 	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
-		 TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_u_params = {
@@ -540,7 +544,8 @@ static struct tegra_clk_pll_params pll_u_params = {
 	.lock_delay = 1000,
 	.pdiv_tohw = pllu_p,
 	.freq_table = pll_u_freq_table,
-	.flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON,
+	.flags = TEGRA_PLLU | TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_LFCON |
+		 TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_x_params = {
@@ -557,7 +562,7 @@ static struct tegra_clk_pll_params pll_x_params = {
 	.lock_delay = 300,
 	.freq_table = pll_x_freq_table,
 	.flags = TEGRA_PLL_HAS_CPCON | TEGRA_PLL_SET_DCCON |
-		 TEGRA_PLL_USE_LOCK,
+		 TEGRA_PLL_USE_LOCK | TEGRA_PLL_HAS_LOCK_ENABLE,
 };
 
 static struct tegra_clk_pll_params pll_e_params = {
@@ -573,7 +578,8 @@ static struct tegra_clk_pll_params pll_e_params = {
 	.lock_enable_bit_idx = PLLE_MISC_LOCK_ENABLE,
 	.lock_delay = 300,
 	.freq_table = pll_e_freq_table,
-	.flags = TEGRA_PLLE_CONFIGURE | TEGRA_PLL_FIXED,
+	.flags = TEGRA_PLLE_CONFIGURE | TEGRA_PLL_FIXED |
+		 TEGRA_PLL_HAS_LOCK_ENABLE | TEGRA_PLL_LOCK_MISC,
 	.fixed_rate = 100000000,
 };
 
Signature · 1 line
1.7.9.5
Reviewed-by on v4 7/20
#24 lore raw

Re: [PATCH v4 07/20] clk: tegra: pll: Don't unconditionally set LOCK flags

Quoted 7 lines · Rhyland Klein

SoC specific drivers should define the appropriate flags for each PLL rather than relying on the registration functions to automatically set flags on their behalf. This will properly allow for changes between SoC generations where flags might be different and allow sharing the same logic functions.

Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#25 lore raw

PATCH v4 8/20 clk: tegra: pll: Add logic for handling SDM data

In reply to Rhyland Klein

This adds logic for taking SDM_DIN (Sigma Delta Modulator) setting into the equation to calculate the effective N value for PLL which supports fractional divider.

The effective N = NDIV + 1/2 + SDM_DIN/2^13, where NDIV is the integer feedback divider.

---
 drivers/clk/tegra/clk-pll.c |   52 ++++++++++++++++++++++++++++++++++++++++++-
 drivers/clk/tegra/clk.h     |    9 +++++++-
 2 files changed, 59 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-pll.c +51 -1
index 13d86c5b234d..c64b75185d6b 100644
@@ -187,17 +187,23 @@
 #define pll_readl_base(p) pll_readl(p->params->base_reg, p)
 #define pll_readl_misc(p) pll_readl(p->params->misc_reg, p)
 #define pll_override_readl(offset, p) readl_relaxed(p->pmc + offset)
+#define pll_readl_sdm_din(p) pll_readl(p->params->sdm_din_reg, p)
+#define pll_readl_sdm_ctrl(p) pll_readl(p->params->sdm_ctrl_reg, p)
 
 #define pll_writel(val, offset, p) writel_relaxed(val, p->clk_base + offset)
 #define pll_writel_base(val, p) pll_writel(val, p->params->base_reg, p)
 #define pll_writel_misc(val, p) pll_writel(val, p->params->misc_reg, p)
 #define pll_override_writel(val, offset, p) writel(val, p->pmc + offset)
+#define pll_writel_sdm_din(val, p) pll_writel(val, p->params->sdm_din_reg, p)
+#define pll_writel_sdm_ctrl(val, p) pll_writel(val, p->params->sdm_ctrl_reg, p)
 
 #define mask(w) ((1 << (w)) - 1)
 #define divm_mask(p) mask(p->params->div_nmp->divm_width)
 #define divn_mask(p) mask(p->params->div_nmp->divn_width)
 #define divp_mask(p) (p->params->flags & TEGRA_PLLU ? PLLU_POST_DIVP_MASK :\
 		      mask(p->params->div_nmp->divp_width))
+#define sdm_din_mask(p) p->params->sdm_din_mask
+#define sdm_en_mask(p) p->params->sdm_ctrl_en_mask
 
 #define divm_shift(p) (p)->params->div_nmp->divm_shift
 #define divn_shift(p) (p)->params->div_nmp->divn_shift
@@ -211,6 +217,9 @@
 #define divn_max(p) (divn_mask(p))
 #define divp_max(p) (1 << (divp_mask(p)))
 
+#define sdin_din_to_data(din)	((u16)((din) ? : 0xFFFFU))
+#define sdin_data_to_din(dat)	(((dat) == 0xFFFFU) ? 0 : (s16)dat)
+
 static struct div_nmp default_nmp = {
 	.divn_shift = PLL_BASE_DIVN_SHIFT,
 	.divn_width = PLL_BASE_DIVN_WIDTH,
@@ -429,6 +438,7 @@ static int _get_table_rate(struct clk_hw *hw,
 	cfg->n = sel->n;
 	cfg->p = sel->p;
 	cfg->cpcon = sel->cpcon;
+	cfg->sdm_data = sel->sdm_data;
 
 	return 0;
 }
@@ -495,6 +505,28 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
 	return 0;
 }
 
+static void clk_pll_set_sdm_data(struct clk_hw *hw,
+				 struct tegra_clk_pll_freq_table *cfg)
+{
+	struct tegra_clk_pll *pll = to_clk_pll(hw);
+	u32 val;
+
+	if (!pll->params->sdm_din_reg)
+		return;
+
+	if (cfg->sdm_data) {
+		val = pll_readl_sdm_din(pll) & (~sdm_din_mask(pll));
+		val |= sdin_data_to_din(cfg->sdm_data) & sdm_din_mask(pll);
+		pll_writel_sdm_din(val, pll);
+	}
+
+	val = pll_readl_sdm_ctrl(pll);
+	if (!cfg->sdm_data != !(val & pll->params->sdm_ctrl_en_mask)) {
+		val ^= pll->params->sdm_ctrl_en_mask;
+		pll_writel_sdm_ctrl(val, pll);
+	}
+}
+
 static void _update_pll_mnp(struct tegra_clk_pll *pll,
 			    struct tegra_clk_pll_freq_table *cfg)
 {
@@ -527,6 +559,8 @@ static void _update_pll_mnp(struct tegra_clk_pll *pll,
 		       (cfg->p << divp_shift(pll));
 
 		pll_writel_base(val, pll);
+
+		clk_pll_set_sdm_data(&pll->hw, cfg);
 	}
 }
 
@@ -552,6 +586,14 @@ static void _get_pll_mnp(struct tegra_clk_pll *pll,
 		cfg->m = (val >> div_nmp->divm_shift) & divm_mask(pll);
 		cfg->n = (val >> div_nmp->divn_shift) & divn_mask(pll);
 		cfg->p = (val >> div_nmp->divp_shift) & divp_mask(pll);
+
+		if (pll->params->sdm_din_reg) {
+			if (sdm_en_mask(pll) & pll_readl_sdm_ctrl(pll)) {
+				val = pll_readl_sdm_din(pll);
+				cfg->sdm_data = val & sdm_din_mask(pll);
+				cfg->sdm_data = sdin_din_to_data(cfg->sdm_data);
+			}
+		}
 	}
 }
 
@@ -633,7 +675,8 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 
 	_get_pll_mnp(pll, &old_cfg);
 
-	if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p)
+	if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p ||
+		old_cfg.sdm_data != cfg.sdm_data)
 		ret = _program_pll(hw, &cfg, rate);
 
 	if (pll->lock)
@@ -697,6 +740,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
 		pdiv = 1;
 	}
 
+	if (pll->params->set_gain)
+		pll->params->set_gain(&cfg);
+
 	cfg.m *= pdiv;
 
 	rate *= cfg.n;
@@ -978,6 +1024,7 @@ static int clk_pllxc_set_rate(struct clk_hw *hw, unsigned long rate,
 static long clk_pll_ramp_round_rate(struct clk_hw *hw, unsigned long rate,
 				unsigned long *prate)
 {
+	struct tegra_clk_pll *pll = to_clk_pll(hw);
 	struct tegra_clk_pll_freq_table cfg;
 	int ret, p_div;
 	u64 output_rate = *prate;
@@ -990,6 +1037,9 @@ static long clk_pll_ramp_round_rate(struct clk_hw *hw, unsigned long rate,
 	if (p_div < 0)
 		return p_div;
 
+	if (pll->params->set_gain)
+		pll->params->set_gain(&cfg);
+
 	output_rate *= cfg.n;
 	do_div(output_rate, cfg.m * p_div);
 
drivers/clk/tegra/clk.h +8 -1
index 8e7361886cf9..eb8103ec335e 100644
@@ -110,14 +110,16 @@ struct clk *tegra_clk_register_mc(const char *name, const char *parent_name,
  * @m:			input divider
  * @p:			post divider
  * @cpcon:		charge pump current
+ * @sdm_data:		fraction divider setting (0 = disabled)
  */
 struct tegra_clk_pll_freq_table {
 	unsigned long	input_rate;
 	unsigned long	output_rate;
-	u16		n;
+	u32		n;
 	u16		m;
 	u8		p;
 	u8		cpcon;
+	u16		sdm_data;
 };
 
 /**
@@ -213,6 +215,10 @@ struct tegra_clk_pll_params {
 	u32		lock_enable_bit_idx;
 	u32		iddq_reg;
 	u32		iddq_bit_idx;
+	u32		sdm_din_reg;
+	u32		sdm_din_mask;
+	u32		sdm_ctrl_reg;
+	u32		sdm_ctrl_en_mask;
 	u32		aux_reg;
 	u32		dyn_ramp_reg;
 	u32		ext_misc_reg[MAX_PLL_MISC_REG_COUNT];
@@ -227,6 +233,7 @@ struct tegra_clk_pll_params {
 	struct div_nmp	*div_nmp;
 	struct tegra_clk_pll_freq_table	*freq_table;
 	unsigned long	fixed_rate;
+	void	(*set_gain)(struct tegra_clk_pll_freq_table *cfg);
 };
 
 #define TEGRA_PLL_USE_LOCK BIT(0)
Signature · 1 line
1.7.9.5
#26 lore raw

Re: [PATCH v4 08/20] clk: tegra: pll: Add logic for handling SDM data

Quoted 11 lines · Rhyland Klein
drivers/clk/tegra/clk-pll.c +7 -0
@@ -495,6 +505,28 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
        return 0;
 }
 
+static void clk_pll_set_sdm_data(struct clk_hw *hw,
+                                struct tegra_clk_pll_freq_table *cfg)
+{
+       struct tegra_clk_pll *pll = to_clk_pll(hw);
+       u32 val;
+
+       if (!pll->params->sdm_din_reg)

drivers/clk/tegra/clk-pll.c static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, · line 524

Quoted 10 lines
drivers/clk/tegra/clk-pll.c +10 -0
+               return;
+
+       if (cfg->sdm_data) {
+               val = pll_readl_sdm_din(pll) & (~sdm_din_mask(pll));
+               val |= sdin_data_to_din(cfg->sdm_data) & sdm_din_mask(pll);
+               pll_writel_sdm_din(val, pll);
+       }
+
+       val = pll_readl_sdm_ctrl(pll);
+       if (!cfg->sdm_data != !(val & pll->params->sdm_ctrl_en_mask)) {

You can use sdm_en_mask(pll) here.

I'm not super clear about what you're trying to accomplish here with !cfg->sdm_data != !(val & mask).
Are you just checking if the masked value is different from sdm_data, but accounting for the integer widths being different (u16 vs u32)?

drivers/clk/tegra/clk-pll.c static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, · line 525

Quoted 1 line
drivers/clk/tegra/clk-pll.c +1 -0
+               val ^= pll->params->sdm_ctrl_en_mask;

You can use sdm_en_mask(pll) here.

Quoted 6 lines
drivers/clk/tegra/clk-pll.c +4 -0
+               pll_writel_sdm_ctrl(val, pll);
+       }
+}
+
 

drivers/clk/tegra/clk-pll.c static void _get_pll_mnp(struct tegra_clk_pll *pll, · line 594

Quoted 9 lines
drivers/clk/tegra/clk-pll.c +6 -0
@@ -552,6 +586,14 @@ static void _get_pll_mnp(struct tegra_clk_pll *pll,
                cfg->m = (val >> div_nmp->divm_shift) & divm_mask(pll);
                cfg->n = (val >> div_nmp->divn_shift) & divn_mask(pll);
                cfg->p = (val >> div_nmp->divp_shift) & divp_mask(pll);
+
+               if (pll->params->sdm_din_reg) {
+                       if (sdm_en_mask(pll) & pll_readl_sdm_ctrl(pll)) {
+                               val = pll_readl_sdm_din(pll);
+                               cfg->sdm_data = val & sdm_din_mask(pll);
+                               cfg->sdm_data = sdin_din_to_data(cfg->sdm_data);

Maybe this is tighter?

val = pll_readl_sdm_din(pll);
val &= sdm_din_mask(pll);
cfg->sdm_data = sdin_din_to_data(val);

drivers/clk/tegra/clk-pll.c static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, · line 745

Quoted 7 lines
drivers/clk/tegra/clk-pll.c +3 -0
@@ -697,6 +740,9 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
                pdiv = 1;
        }
 
+       if (pll->params->set_gain)
+               pll->params->set_gain(&cfg);
+

It's not really clear from this commit alone how set_gain relates to the sdm stuff.

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 221

Quoted 13 lines
drivers/clk/tegra/clk.h +4 -0
index 8e7361886cf9..eb8103ec335e 100644
 /**
@@ -213,6 +215,10 @@ struct tegra_clk_pll_params {
        u32             lock_enable_bit_idx;
        u32             iddq_reg;
        u32             iddq_bit_idx;
+       u32             sdm_din_reg;
+       u32             sdm_din_mask;
+       u32             sdm_ctrl_reg;
+       u32             sdm_ctrl_en_mask;

Please add kerneldoc for these members as well.

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 236

Quoted 8 lines
drivers/clk/tegra/clk.h +1 -0
        u32             aux_reg;
        u32             dyn_ramp_reg;
        u32             ext_misc_reg[MAX_PLL_MISC_REG_COUNT];
@@ -227,6 +233,7 @@ struct tegra_clk_pll_params {
        struct div_nmp  *div_nmp;
        struct tegra_clk_pll_freq_table *freq_table;
        unsigned long   fixed_rate;
+       void    (*set_gain)(struct tegra_clk_pll_freq_table *cfg);

This one too.

Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#27 lore raw

Re: [PATCH v4 08/20] clk: tegra: pll: Add logic for handling SDM data

Quoted 25 lines · Benson Leung
Quoted 11 lines · Rhyland Klein
drivers/clk/tegra/clk-pll.c +7 -0
@@ -495,6 +505,28 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
        return 0;
 }
 
+static void clk_pll_set_sdm_data(struct clk_hw *hw,
+                                struct tegra_clk_pll_freq_table *cfg)
+{
+       struct tegra_clk_pll *pll = to_clk_pll(hw);
+       u32 val;
+
+       if (!pll->params->sdm_din_reg)

drivers/clk/tegra/clk-pll.c static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, · line 524

Quoted 10 lines
drivers/clk/tegra/clk-pll.c +10 -0
+               return;
+
+       if (cfg->sdm_data) {
+               val = pll_readl_sdm_din(pll) & (~sdm_din_mask(pll));
+               val |= sdin_data_to_din(cfg->sdm_data) & sdm_din_mask(pll);
+               pll_writel_sdm_din(val, pll);
+       }
+
+       val = pll_readl_sdm_ctrl(pll);
+       if (!cfg->sdm_data != !(val & pll->params->sdm_ctrl_en_mask)) {

You can use sdm_en_mask(pll) here.

Quoted 4 lines

I'm not super clear about what you're trying to accomplish here with !cfg->sdm_data != !(val & mask).
Are you just checking if the masked value is different from sdm_data, but accounting for the integer widths being different (u16 vs u32)?

So I got clarification from the downstream author to be sure, and this is the answer to what this is checking:

(<Configuration has non zero SDM_DATA> AND <sdm control is disabled>) OR
(<Configuration has zero SDM_DATA> AND <sdm control is enabled>)

So the check is correct, just a complicated way of expressing it.

-rhyland

Signature · 1 line
nvpublic
#28 lore raw

Re: [PATCH v4 08/20] clk: tegra: pll: Add logic for handling SDM data

Quoted 31 lines · Rhyland Klein
Quoted 25 lines · Benson Leung
Quoted 11 lines · Rhyland Klein
drivers/clk/tegra/clk-pll.c +7 -0
@@ -495,6 +505,28 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
        return 0;
 }
 
+static void clk_pll_set_sdm_data(struct clk_hw *hw,
+                                struct tegra_clk_pll_freq_table *cfg)
+{
+       struct tegra_clk_pll *pll = to_clk_pll(hw);
+       u32 val;
+
+       if (!pll->params->sdm_din_reg)

drivers/clk/tegra/clk-pll.c static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, · line 524

Quoted 10 lines
drivers/clk/tegra/clk-pll.c +10 -0
+               return;
+
+       if (cfg->sdm_data) {
+               val = pll_readl_sdm_din(pll) & (~sdm_din_mask(pll));
+               val |= sdin_data_to_din(cfg->sdm_data) & sdm_din_mask(pll);
+               pll_writel_sdm_din(val, pll);
+       }
+
+       val = pll_readl_sdm_ctrl(pll);
+       if (!cfg->sdm_data != !(val & pll->params->sdm_ctrl_en_mask)) {

You can use sdm_en_mask(pll) here.

Quoted 4 lines

I'm not super clear about what you're trying to accomplish here with !cfg->sdm_data != !(val & mask).
Are you just checking if the masked value is different from sdm_data, but accounting for the integer widths being different (u16 vs u32)?

Quoted 8 lines

So I got clarification from the downstream author to be sure, and this is the answer to what this is checking:

(<Configuration has non zero SDM_DATA> AND <sdm control is disabled>) OR
(<Configuration has zero SDM_DATA> AND <sdm control is enabled>)

So the check is correct, just a complicated way of expressing it.

Can it be rewritten to be less complicated? I hate it when I have to look at code for several seconds and still not understand what it's doing. Why not something that is closer to the pseudo code you gave:

	bool enabled = (val & pll->params->sdm_ctrl_en_mask) != 0;

	if ((enabled && cfg->sdm_data == 0) || (!enabled && cfg->sdm_data != 0))

? Also I think this could use some could comments explaining what's going on. Perhaps this could be simplified even further:

	if (cfg->sdm_data == 0 && enabled)
		val &= ~pll->params->sdm_ctrl_en_mask;

	if (cfg->sdm_data != 0 && !enabled)
		val |= pll->params->sdm_ctrl_en_mask;

	pll_writel_sdm_ctrl(val, pll);

Now that I have a /much/ easier time reading and understanding. That may not even require comments because it's pretty plain what's going on. But there may be some advantage in adding comments about SDM in general. The comment could be something like what you have in the commit message, so that people don't have to go find the commit that added the code to find out what this is doing.

Thierry

#29 lore raw

Re: [PATCH v4 08/20] clk: tegra: pll: Add logic for handling SDM data

Quoted 62 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 31 lines · Rhyland Klein
Quoted 25 lines · Benson Leung
Quoted 11 lines · Rhyland Klein
drivers/clk/tegra/clk-pll.c +7 -0
@@ -495,6 +505,28 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
        return 0;
 }
 
+static void clk_pll_set_sdm_data(struct clk_hw *hw,
+                                struct tegra_clk_pll_freq_table *cfg)
+{
+       struct tegra_clk_pll *pll = to_clk_pll(hw);
+       u32 val;
+
+       if (!pll->params->sdm_din_reg)

drivers/clk/tegra/clk-pll.c static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, · line 524

Quoted 10 lines
drivers/clk/tegra/clk-pll.c +10 -0
+               return;
+
+       if (cfg->sdm_data) {
+               val = pll_readl_sdm_din(pll) & (~sdm_din_mask(pll));
+               val |= sdin_data_to_din(cfg->sdm_data) & sdm_din_mask(pll);
+               pll_writel_sdm_din(val, pll);
+       }
+
+       val = pll_readl_sdm_ctrl(pll);
+       if (!cfg->sdm_data != !(val & pll->params->sdm_ctrl_en_mask)) {

You can use sdm_en_mask(pll) here.

Quoted 4 lines

I'm not super clear about what you're trying to accomplish here with !cfg->sdm_data != !(val & mask).
Are you just checking if the masked value is different from sdm_data, but accounting for the integer widths being different (u16 vs u32)?

Quoted 8 lines

So I got clarification from the downstream author to be sure, and this is the answer to what this is checking:

(<Configuration has non zero SDM_DATA> AND <sdm control is disabled>) OR
(<Configuration has zero SDM_DATA> AND <sdm control is enabled>)

So the check is correct, just a complicated way of expressing it.

Can it be rewritten to be less complicated? I hate it when I have to look at code for several seconds and still not understand what it's doing. Why not something that is closer to the pseudo code you gave:

	bool enabled = (val & pll->params->sdm_ctrl_en_mask) != 0;

	if ((enabled && cfg->sdm_data == 0) || (!enabled && cfg->sdm_data != 0))

? Also I think this could use some could comments explaining what's going on. Perhaps this could be simplified even further:

	if (cfg->sdm_data == 0 && enabled)
		val &= ~pll->params->sdm_ctrl_en_mask;

	if (cfg->sdm_data != 0 && !enabled)
		val |= pll->params->sdm_ctrl_en_mask;

	pll_writel_sdm_ctrl(val, pll);
Quoted 8 lines

Now that I have a /much/ easier time reading and understanding. That may not even require comments because it's pretty plain what's going on. But there may be some advantage in adding comments about SDM in general. The comment could be something like what you have in the commit message, so that people don't have to go find the commit that added the code to find out what this is doing.

Thierry

I agree that the original statement was confusing. I'll replace it with a simpler version, and comments never hurt :)

-rhyland

Quoted 4 lines

* Unknown Key
* 0x7F3EB3A1

Signature · 1 line
nvpublic
#30 lore raw

PATCH v4 9/20 clk: tegra: pll: Add logic for SS

In reply to Rhyland Klein

From: Bill Huang <[email protected]>

Add some logic for Spread Spectrum control. It is used in conjuncture with SDM fractional dividers. SSC has to be disabled when we configure the divider settings.

---
 drivers/clk/tegra/clk-pll.c |   25 ++++++++++++++++++++++++-
 drivers/clk/tegra/clk.h     |    2 ++
 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-pll.c +24 -1
index c64b75185d6b..2a559408cee1 100644
@@ -621,6 +621,26 @@ static void _update_pll_cpcon(struct tegra_clk_pll *pll,
 	pll_writel_misc(val, pll);
 }
 
+static void pll_clk_start_ss(struct tegra_clk_pll *pll)
+{
+	if (pll->params->defaults_set && pll->params->ssc_ctrl_en_mask) {
+		u32 val = pll_readl(pll->params->ssc_ctrl_reg, pll);
+
+		val |= pll->params->ssc_ctrl_en_mask;
+		pll_writel(val, pll->params->ssc_ctrl_reg, pll);
+	}
+}
+
+static void pll_clk_stop_ss(struct tegra_clk_pll *pll)
+{
+	if (pll->params->defaults_set && pll->params->ssc_ctrl_en_mask) {
+		u32 val = pll_readl(pll->params->ssc_ctrl_reg, pll);
+
+		val &= ~pll->params->ssc_ctrl_en_mask;
+		pll_writel(val, pll->params->ssc_ctrl_reg, pll);
+	}
+}
+
 static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
 			unsigned long rate)
 {
@@ -629,8 +649,10 @@ static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
 
 	state = clk_pll_is_enabled(hw);
 
-	if (state)
+	if (state) {
+		pll_clk_stop_ss(pll);
 		_clk_pll_disable(hw);
+	}
 
 	_update_pll_mnp(pll, cfg);
 
@@ -640,6 +662,7 @@ static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
 	if (state) {
 		_clk_pll_enable(hw);
 		ret = clk_pll_wait_for_lock(pll);
+		pll_clk_start_ss(pll);
 	}
 
 	return ret;
drivers/clk/tegra/clk.h +2 -0
index eb8103ec335e..3f92f1ad3961 100644
@@ -219,6 +219,8 @@ struct tegra_clk_pll_params {
 	u32		sdm_din_mask;
 	u32		sdm_ctrl_reg;
 	u32		sdm_ctrl_en_mask;
+	u32		ssc_ctrl_reg;
+	u32		ssc_ctrl_en_mask;
 	u32		aux_reg;
 	u32		dyn_ramp_reg;
 	u32		ext_misc_reg[MAX_PLL_MISC_REG_COUNT];
Signature · 1 line
1.7.9.5
#31 lore raw

Re: [PATCH v4 09/20] clk: tegra: pll: Add logic for SS

Quoted 17 lines · Rhyland Klein

From: Bill Huang <[email protected]>

Add some logic for Spread Spectrum control. It is used in conjuncture with SDM fractional dividers. SSC has to be disabled when we configure the divider settings.

---
 drivers/clk/tegra/clk-pll.c |   25 ++++++++++++++++++++++++-
 drivers/clk/tegra/clk.h     |    2 ++
 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-pll.c +0 -0
index c64b75185d6b..2a559408cee1 100644

drivers/clk/tegra/clk-pll.c static void _update_pll_cpcon(struct tegra_clk_pll *pll, · line 626

Quoted 6 lines
drivers/clk/tegra/clk-pll.c +3 -0
@@ -621,6 +621,26 @@ static void _update_pll_cpcon(struct tegra_clk_pll *pll,
        pll_writel_misc(val, pll);
 }
 
+static void pll_clk_start_ss(struct tegra_clk_pll *pll)
+{
+       if (pll->params->defaults_set && pll->params->ssc_ctrl_en_mask) {

defaults_set looks like it's introduced later (patch 16/20). Can you remove references to that, or reorder the patches if that makes more sense?

drivers/clk/tegra/clk-pll.c static void _update_pll_cpcon(struct tegra_clk_pll *pll, · line 636

Quoted 10 lines
drivers/clk/tegra/clk-pll.c +10 -0
+               u32 val = pll_readl(pll->params->ssc_ctrl_reg, pll);
+
+               val |= pll->params->ssc_ctrl_en_mask;
+               pll_writel(val, pll->params->ssc_ctrl_reg, pll);
+       }
+}
+
+static void pll_clk_stop_ss(struct tegra_clk_pll *pll)
+{
+       if (pll->params->defaults_set && pll->params->ssc_ctrl_en_mask) {

Ditto here for defaults_set.

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 223

Quoted 10 lines
drivers/clk/tegra/clk.h +2 -0
index eb8103ec335e..3f92f1ad3961 100644
@@ -219,6 +219,8 @@ struct tegra_clk_pll_params {
        u32             sdm_din_mask;
        u32             sdm_ctrl_reg;
        u32             sdm_ctrl_en_mask;
+       u32             ssc_ctrl_reg;
+       u32             ssc_ctrl_en_mask;

Please add kerneldoc for these.

Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#32 lore raw

Re: [PATCH v4 09/20] clk: tegra: pll: Add logic for SS

Quoted 21 lines · Benson Leung
Quoted 20 lines · Rhyland Klein

From: Bill Huang <[email protected]>

Add some logic for Spread Spectrum control. It is used in conjuncture with SDM fractional dividers. SSC has to be disabled when we configure the divider settings.

---
 drivers/clk/tegra/clk-pll.c |   25 ++++++++++++++++++++++++-
 drivers/clk/tegra/clk.h     |    2 ++
 2 files changed, 26 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-pll.c +0 -0
index c64b75185d6b..2a559408cee1 100644
@@ -621,6 +621,26 @@ static void _update_pll_cpcon(struct tegra_clk_pll *pll,
        pll_writel_misc(val, pll);
 }
 
Quoted 8 lines

drivers/clk/tegra/clk-pll.c static void _update_pll_cpcon(struct tegra_clk_pll *pll, · line 626

Quoted 3 lines
drivers/clk/tegra/clk-pll.c +3 -0
+static void pll_clk_start_ss(struct tegra_clk_pll *pll)
+{
+       if (pll->params->defaults_set && pll->params->ssc_ctrl_en_mask) {

defaults_set looks like it's introduced later (patch 16/20). Can you remove references to that, or reorder the patches if that makes more sense?

I'll reorder this after set_defaults is added.

-rhyland

Signature · 1 line
nvpublic
#33 lore raw

PATCH v4 10/20 clk: tegra: pll: Add logic for out-of-table rates for T210

In reply to Rhyland Klein

For Tegra210, the logic to calculate out-of-table rates is different from previous generations. Add callbacks that can be overridden to allow for different ways of calculating rates. Default to _cal_rate when not specified.

Based on original work by Aleksandr Frid <[email protected]>

---
 drivers/clk/tegra/clk-pll.c |   24 ++++++++++++++++++++++--
 drivers/clk/tegra/clk.h     |   10 ++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-pll.c +22 -2
index 2a559408cee1..0b9cbe12a3eb 100644
@@ -687,7 +687,7 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 	}
 
 	if (_get_table_rate(hw, &cfg, rate, parent_rate) &&
-	    _calc_rate(hw, &cfg, rate, parent_rate)) {
+	    pll->params->calc_rate(hw, &cfg, rate, parent_rate)) {
 		pr_err("%s: Failed to set %s rate %lu\n", __func__,
 		       __clk_get_name(hw->clk), rate);
 		WARN_ON(1);
@@ -722,7 +722,7 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 		return __clk_get_rate(hw->clk);
 
 	if (_get_table_rate(hw, &cfg, rate, *prate) &&
-	    _calc_rate(hw, &cfg, rate, *prate))
+	    pll->params->calc_rate(hw, &cfg, rate, *prate))
 		return -EINVAL;
 
 	return cfg.output_rate;
@@ -912,12 +912,28 @@ const struct clk_ops tegra_clk_plle_ops = {
 static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params,
 			   unsigned long parent_rate)
 {
+	u16 mdiv = parent_rate / pll_params->cf_min;
+
+	if (pll_params->flags & TEGRA_MDIV_NEW)
+		return (!pll_params->mdiv_default ? mdiv :
+			min(mdiv, pll_params->mdiv_default));
+
+	if (pll_params->mdiv_default)
+		return pll_params->mdiv_default;
+
 	if (parent_rate > pll_params->cf_max)
 		return 2;
 	else
 		return 1;
 }
 
+u16 tegra_pll_get_fixed_mdiv(struct clk_hw *hw, unsigned long input_rate)
+{
+	struct tegra_clk_pll *pll = to_clk_pll(hw);
+
+	return (u16)_pll_fixed_mdiv(pll->params, input_rate);
+}
+
 static unsigned long _clip_vco_min(unsigned long vco_min,
 				   unsigned long parent_rate)
 {
@@ -1492,6 +1508,10 @@ static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll,
 	init.parent_names = (parent_name ? &parent_name : NULL);
 	init.num_parents = (parent_name ? 1 : 0);
 
+	/* Default to _calc_rate if unspecified */
+	if (!pll->params->calc_rate)
+		pll->params->calc_rate = _calc_rate;
+
 	/* Data in .init is copied by clk_register(), so stack variable OK */
 	pll->hw.init = &init;
 
drivers/clk/tegra/clk.h +10 -0
index 3f92f1ad3961..b63ef31a2d7a 100644
@@ -199,6 +199,8 @@ struct div_nmp {
  *     base register.
  * TEGRA_PLL_BYPASS - PLL has bypass bit
  * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring
+ * TEGRA_MDIV_NEW - Switch to new method for calculating fixed mdiv
+ *     it may be more accurate (especially if SDM present)
  */
 struct tegra_clk_pll_params {
 	unsigned long	input_min;
@@ -235,7 +237,13 @@ struct tegra_clk_pll_params {
 	struct div_nmp	*div_nmp;
 	struct tegra_clk_pll_freq_table	*freq_table;
 	unsigned long	fixed_rate;
+	bool		vco_out;
+	u16		mdiv_default;
+	u32	(*round_p_to_pdiv)(u32 p, u32 *pdiv);
 	void	(*set_gain)(struct tegra_clk_pll_freq_table *cfg);
+	int	(*calc_rate)(struct clk_hw *hw,
+			struct tegra_clk_pll_freq_table *cfg,
+			unsigned long rate, unsigned long parent_rate);
 };
 
 #define TEGRA_PLL_USE_LOCK BIT(0)
@@ -249,6 +257,7 @@ struct tegra_clk_pll_params {
 #define TEGRA_PLL_LOCK_MISC BIT(8)
 #define TEGRA_PLL_BYPASS BIT(9)
 #define TEGRA_PLL_HAS_LOCK_ENABLE BIT(10)
+#define TEGRA_MDIV_NEW BIT(11)
 
 /**
  * struct tegra_clk_pll - Tegra PLL clock
@@ -659,5 +668,6 @@ void tegra114_clock_deassert_dfll_dvco_reset(void);
 typedef void (*tegra_clk_apply_init_table_func)(void);
 extern tegra_clk_apply_init_table_func tegra_clk_apply_init_table;
 int tegra_pll_wait_for_lock(struct tegra_clk_pll *pll);
+u16 tegra_pll_get_fixed_mdiv(struct clk_hw *hw, unsigned long input_rate);
 
 #endif /* TEGRA_CLK_H */
Signature · 1 line
1.7.9.5
#34 lore raw

Re: [PATCH v4 10/20] clk: tegra: pll: Add logic for out-of-table rates for T210

Quoted 4 lines · Rhyland Klein

For Tegra210, the logic to calculate out-of-table rates is different from previous generations. Add callbacks that can be overridden to allow for different ways of calculating rates. Default to _cal_rate when not specified.

You should mention that you're adding a new flag and new members that may override mdiv as well.

Quoted 19 lines

Based on original work by Aleksandr Frid <[email protected]>

---

drivers/clk/tegra/clk.h +2 -0
index 3f92f1ad3961..b63ef31a2d7a 100644
@@ -199,6 +199,8 @@ struct div_nmp {
  *     base register.
  * TEGRA_PLL_BYPASS - PLL has bypass bit
  * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring
+ * TEGRA_MDIV_NEW - Switch to new method for calculating fixed mdiv
+ *     it may be more accurate (especially if SDM present)
  */
 struct tegra_clk_pll_params {
        unsigned long   input_min;

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 240

Quoted 4 lines
drivers/clk/tegra/clk.h +1 -0
@@ -235,7 +237,13 @@ struct tegra_clk_pll_params {
        struct div_nmp  *div_nmp;
        struct tegra_clk_pll_freq_table *freq_table;
        unsigned long   fixed_rate;
+       bool            vco_out;

vco_out is unused and unrelated to this change?

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 246

Quoted 6 lines
drivers/clk/tegra/clk.h +5 -0
+       u16             mdiv_default;
+       u32     (*round_p_to_pdiv)(u32 p, u32 *pdiv);
        void    (*set_gain)(struct tegra_clk_pll_freq_table *cfg);
+       int     (*calc_rate)(struct clk_hw *hw,
+                       struct tegra_clk_pll_freq_table *cfg,
+                       unsigned long rate, unsigned long parent_rate);

Add kerneldoc for new members.

Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#35 lore raw

Re: [PATCH v4 10/20] clk: tegra: pll: Add logic for out-of-table rates for T210

Quoted 8 lines · Benson Leung
Quoted 4 lines · Rhyland Klein

For Tegra210, the logic to calculate out-of-table rates is different from previous generations. Add callbacks that can be overridden to allow for different ways of calculating rates. Default to _cal_rate when not specified.

You should mention that you're adding a new flag and new members that may override mdiv as well.

Yes, will add that.

Quoted 18 lines
Quoted 18 lines

Based on original work by Aleksandr Frid <[email protected]>

---

drivers/clk/tegra/clk.h +2 -0
index 3f92f1ad3961..b63ef31a2d7a 100644
@@ -199,6 +199,8 @@ struct div_nmp {
  *     base register.
  * TEGRA_PLL_BYPASS - PLL has bypass bit
  * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring
+ * TEGRA_MDIV_NEW - Switch to new method for calculating fixed mdiv
+ *     it may be more accurate (especially if SDM present)
  */
 struct tegra_clk_pll_params {
Quoted 8 lines

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 240

Quoted 6 lines
drivers/clk/tegra/clk.h +1 -0
        unsigned long   input_min;
@@ -235,7 +237,13 @@ struct tegra_clk_pll_params {
        struct div_nmp  *div_nmp;
        struct tegra_clk_pll_freq_table *freq_table;
        unsigned long   fixed_rate;
+       bool            vco_out;

vco_out is unused and unrelated to this change?

vco_out is used to mark which PLL's have a vco_out, and is going to be used in the new out-of-table rate calculation in tegra210, so I will move adding this member until that patch.

Quoted 9 lines

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 246

Quoted 7 lines
drivers/clk/tegra/clk.h +5 -0
+       u16             mdiv_default;
+       u32     (*round_p_to_pdiv)(u32 p, u32 *pdiv);
        void    (*set_gain)(struct tegra_clk_pll_freq_table *cfg);
+       int     (*calc_rate)(struct clk_hw *hw,
+                       struct tegra_clk_pll_freq_table *cfg,
+                       unsigned long rate, unsigned long parent_rate);

Add kerneldoc for new members.

Will do, thanks!

-rhyland

Signature · 1 line
nvpublic
#36 lore raw

PATCH v4 11/20 clk: tegra: pll: Add code to handle if resets are supported by PLL

In reply to Rhyland Klein

From: Bill Huang <[email protected]>

If a PLL has a reset_reg specified, properly handle that in the enable/disable logic paths.

---
v2:
- Moved reset logic to _clk_pll_enable/disable as well

 drivers/clk/tegra/clk-pll.c |   12 ++++++++++++
 drivers/clk/tegra/clk.h     |    2 ++
 2 files changed, 14 insertions(+)
drivers/clk/tegra/clk-pll.c +12 -0
index 0b9cbe12a3eb..3c40a8136136 100644
@@ -311,6 +311,12 @@ static void _clk_pll_enable(struct clk_hw *hw)
 		udelay(2);
 	}
 
+	if (pll->params->reset_reg) {
+		val = pll_readl(pll->params->reset_reg, pll);
+		val &= ~BIT(pll->params->reset_bit_idx);
+		pll_writel(val, pll->params->reset_reg, pll);
+	}
+
 	clk_pll_enable_lock(pll);
 
 	val = pll_readl_base(pll);
@@ -343,6 +349,12 @@ static void _clk_pll_disable(struct clk_hw *hw)
 		writel_relaxed(val, pll->pmc + PMC_PLLP_WB0_OVERRIDE);
 	}
 
+	if (pll->params->reset_reg) {
+		val = pll_readl(pll->params->reset_reg, pll);
+		val |= BIT(pll->params->reset_bit_idx);
+		pll_writel(val, pll->params->reset_reg, pll);
+	}
+
 	if (pll->params->iddq_reg) {
 		val = pll_readl(pll->params->iddq_reg, pll);
 		val |= BIT(pll->params->iddq_bit_idx);
drivers/clk/tegra/clk.h +2 -0
index b63ef31a2d7a..0146c91df635 100644
@@ -217,6 +217,8 @@ struct tegra_clk_pll_params {
 	u32		lock_enable_bit_idx;
 	u32		iddq_reg;
 	u32		iddq_bit_idx;
+	u32		reset_reg;
+	u32		reset_bit_idx;
 	u32		sdm_din_reg;
 	u32		sdm_din_mask;
 	u32		sdm_ctrl_reg;
Signature · 1 line
1.7.9.5
Reviewed-by on v4 11/20
#37 lore raw

Re: [PATCH v4 11/20] clk: tegra: pll: Add code to handle if resets are supported by PLL

Quoted 6 lines · Rhyland Klein

From: Bill Huang <[email protected]>

If a PLL has a reset_reg specified, properly handle that in the enable/disable logic paths.

Minor nit to add kerneldoc for params. Otherwise, LGTM.

drivers/clk/tegra/clk.h struct tegra_clk_pll_params { · line 221

Quoted 10 lines
drivers/clk/tegra/clk.h +2 -0
index b63ef31a2d7a..0146c91df635 100644
@@ -217,6 +217,8 @@ struct tegra_clk_pll_params {
        u32             lock_enable_bit_idx;
        u32             iddq_reg;
        u32             iddq_bit_idx;
+       u32             reset_reg;
+       u32             reset_bit_idx;

Kerneldoc for these two.

Quoted 3 lines
drivers/clk/tegra/clk.h +0 -0
        u32             sdm_din_reg;
        u32             sdm_din_mask;
        u32             sdm_ctrl_reg;
Signature · 3 lines
Benson Leung
Software Engineer, Chrom* OS
[email protected]
#38 lore raw

PATCH v4 12/20 clk: tegra: pll: Add specialized logic for T210

In reply to Rhyland Klein

On Tegra210 SoC's, the logic to enable several of the plls is different from previous generations. Therefore, add registeration functions specific to Tegra210 which will handle them appropriately.

---
v4:
- Fixed plle_tegra210_is_enabled callback typos

v2:
- Fixed plle logic. PLLE on Tegra210 has had its enable bit moved, so we can't use the default _clk_pll_enable/disable routines. Instead, manually set/clear the correct bit for PLLE within its functions.

 drivers/clk/tegra/clk-pll.c |  348 ++++++++++++++++++++++++++++++++++++++++++-
 drivers/clk/tegra/clk.h     |   24 +++
 2 files changed, 370 insertions(+), 2 deletions(-)
drivers/clk/tegra/clk-pll.c +346 -2
index 3c40a8136136..9224c9c7c497 100644
@@ -65,6 +65,7 @@
 #define PLLE_BASE_DIVN_WIDTH 8
 #define PLLE_BASE_DIVM_SHIFT 0
 #define PLLE_BASE_DIVM_WIDTH 8
+#define PLLE_BASE_ENABLE BIT(31)
 
 #define PLLE_MISC_SETUP_BASE_SHIFT 16
 #define PLLE_MISC_SETUP_BASE_MASK (0xffff << PLLE_MISC_SETUP_BASE_SHIFT)
@@ -919,7 +920,8 @@ const struct clk_ops tegra_clk_plle_ops = {
 
 #if defined(CONFIG_ARCH_TEGRA_114_SOC) || \
 	defined(CONFIG_ARCH_TEGRA_124_SOC) || \
-	defined(CONFIG_ARCH_TEGRA_132_SOC)
+	defined(CONFIG_ARCH_TEGRA_132_SOC) || \
+	defined(CONFIG_ARCH_TEGRA_210_SOC)
 
 static int _pll_fixed_mdiv(struct tegra_clk_pll_params *pll_params,
 			   unsigned long parent_rate)
@@ -1588,7 +1590,8 @@ struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,
 
 #if defined(CONFIG_ARCH_TEGRA_114_SOC) || \
 	defined(CONFIG_ARCH_TEGRA_124_SOC) || \
-	defined(CONFIG_ARCH_TEGRA_132_SOC)
+	defined(CONFIG_ARCH_TEGRA_132_SOC) || \
+	defined(CONFIG_ARCH_TEGRA_210_SOC)
 static const struct clk_ops tegra_clk_pllxc_ops = {
 	.is_enabled = clk_pll_is_enabled,
 	.enable = clk_pll_enable,
@@ -1967,3 +1970,344 @@ struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name,
 	return clk;
 }
 #endif
+
+#if defined(CONFIG_ARCH_TEGRA_210_SOC)
+static int clk_plle_tegra210_enable(struct clk_hw *hw)
+{
+	struct tegra_clk_pll *pll = to_clk_pll(hw);
+	struct tegra_clk_pll_freq_table sel;
+	u32 val;
+	int ret;
+	unsigned long flags = 0;
+	unsigned long input_rate = clk_get_rate(clk_get_parent(hw->clk));
+
+	if (_get_table_rate(hw, &sel, pll->params->fixed_rate, input_rate))
+		return -EINVAL;
+
+	if (pll->lock)
+		spin_lock_irqsave(pll->lock, flags);
+
+	val = pll_readl_base(pll);
+	val &= ~BIT(29); /* Disable lock override */
+	pll_writel_base(val, pll);
+
+	val = pll_readl(pll->params->aux_reg, pll);
+	val |= PLLE_AUX_ENABLE_SWCTL;
+	val &= ~PLLE_AUX_SEQ_ENABLE;
+	pll_writel(val, pll->params->aux_reg, pll);
+	udelay(1);
+
+	val = pll_readl_misc(pll);
+	val |= PLLE_MISC_LOCK_ENABLE;
+	val |= PLLE_MISC_IDDQ_SW_CTRL;
+	val &= ~PLLE_MISC_IDDQ_SW_VALUE;
+	val |= PLLE_MISC_PLLE_PTS;
+	val |= PLLE_MISC_VREG_BG_CTRL_MASK | PLLE_MISC_VREG_CTRL_MASK;
+	pll_writel_misc(val, pll);
+	udelay(5);
+
+	val = pll_readl(PLLE_SS_CTRL, pll);
+	val |= PLLE_SS_DISABLE;
+	pll_writel(val, PLLE_SS_CTRL, pll);
+
+	val = pll_readl_base(pll);
+	val &= ~(divp_mask_shifted(pll) | divn_mask_shifted(pll) |
+		 divm_mask_shifted(pll));
+	val &= ~(PLLE_BASE_DIVCML_MASK << PLLE_BASE_DIVCML_SHIFT);
+	val |= sel.m << divm_shift(pll);
+	val |= sel.n << divn_shift(pll);
+	val |= sel.cpcon << PLLE_BASE_DIVCML_SHIFT;
+	pll_writel_base(val, pll);
+	udelay(1);
+
+	val = pll_readl_base(pll);
+	val |= PLLE_BASE_ENABLE;
+	pll_writel_base(val, pll);
+
+	ret = clk_pll_wait_for_lock(pll);
+
+	if (ret < 0)
+		goto out;
+
+	val = pll_readl(PLLE_SS_CTRL, pll);
+	val &= ~(PLLE_SS_CNTL_CENTER | PLLE_SS_CNTL_INVERT);
+	val &= ~PLLE_SS_COEFFICIENTS_MASK;
+	val |= PLLE_SS_COEFFICIENTS_VAL;
+	pll_writel(val, PLLE_SS_CTRL, pll);
+	val &= ~(PLLE_SS_CNTL_SSC_BYP | PLLE_SS_CNTL_BYPASS_SS);
+	pll_writel(val, PLLE_SS_CTRL, pll);
+	udelay(1);
+	val &= ~PLLE_SS_CNTL_INTERP_RESET;
+	pll_writel(val, PLLE_SS_CTRL, pll);
+	udelay(1);
+
+	/* Enable hw control of xusb brick pll */
+	val = pll_readl_misc(pll);
+	val &= ~PLLE_MISC_IDDQ_SW_CTRL;
+	pll_writel_misc(val, pll);
+
+	val = pll_readl(pll->params->aux_reg, pll);
+	val |= (PLLE_AUX_USE_LOCKDET | PLLE_AUX_SEQ_START_STATE);
+	val &= ~(PLLE_AUX_ENABLE_SWCTL | PLLE_AUX_SS_SWCTL);
+	pll_writel(val, pll->params->aux_reg, pll);
+	udelay(1);
+	val |= PLLE_AUX_SEQ_ENABLE;
+	pll_writel(val, pll->params->aux_reg, pll);
+
+	val = pll_readl(XUSBIO_PLL_CFG0, pll);
+	val |= (XUSBIO_PLL_CFG0_PADPLL_USE_LOCKDET |
+		XUSBIO_PLL_CFG0_SEQ_START_STATE);
+	val &= ~(XUSBIO_PLL_CFG0_CLK_ENABLE_SWCTL |
+		 XUSBIO_PLL_CFG0_PADPLL_RESET_SWCTL);
+	pll_writel(val, XUSBIO_PLL_CFG0, pll);
+	udelay(1);
+	val |= XUSBIO_PLL_CFG0_SEQ_ENABLE;
+	pll_writel(val, XUSBIO_PLL_CFG0, pll);
+
+	/* Enable hw control of SATA pll */
+	val = pll_readl(SATA_PLL_CFG0, pll);
+	val &= ~SATA_PLL_CFG0_PADPLL_RESET_SWCTL;
+	val |= SATA_PLL_CFG0_PADPLL_USE_LOCKDET;
+	val |= SATA_PLL_CFG0_SEQ_START_STATE;
+	pll_writel(val, SATA_PLL_CFG0, pll);
+
+	udelay(1);
+
+	val = pll_readl(SATA_PLL_CFG0, pll);
+	val |= SATA_PLL_CFG0_SEQ_ENABLE;
+	pll_writel(val, SATA_PLL_CFG0, pll);
+
+out:
+	if (pll->lock)
+		spin_unlock_irqrestore(pll->lock, flags);
+
+	return ret;
+}
+
+static void clk_plle_tegra210_disable(struct clk_hw *hw)
+{
+	struct tegra_clk_pll *pll = to_clk_pll(hw);
+	unsigned long flags = 0;
+	u32 val;
+
+	if (pll->lock)
+		spin_lock_irqsave(pll->lock, flags);
+
+	val = pll_readl_base(pll);
+	val &= ~PLLE_BASE_ENABLE;
+	pll_writel_base(val, pll);
+
+	val = pll_readl_misc(pll);
+	val |= PLLE_MISC_IDDQ_SW_CTRL | PLLE_MISC_IDDQ_SW_VALUE;
+	pll_writel_misc(val, pll);
+	udelay(1);
+
+	if (pll->lock)
+		spin_unlock_irqrestore(pll->lock, flags);
+}
+
+static int clk_plle_tegra210_is_enabled(struct clk_hw *hw)
+{
+	struct tegra_clk_pll *pll = to_clk_pll(hw);
+	u32 val;
+
+	val = pll_readl_base(pll);
+
+	return val & PLLE_BASE_ENABLE ? 1 : 0;
+}
+
+static const struct clk_ops tegra_clk_plle_tegra210_ops = {
+	.is_enabled =  clk_plle_tegra210_is_enabled,
+	.enable = clk_plle_tegra210_enable,
+	.disable = clk_plle_tegra210_disable,
+	.recalc_rate = clk_pll_recalc_rate,
+};
+
+struct clk *tegra_clk_register_plle_tegra210(const char *name,
+				const char *parent_name,
+				void __iomem *clk_base, unsigned long flags,
+				struct tegra_clk_pll_params *pll_params,
+				spinlock_t *lock)
+{
+	struct tegra_clk_pll *pll;
+	struct clk *clk;
+	u32 val, val_aux;
+
+	pll = _tegra_init_pll(clk_base, NULL, pll_params, lock);
+	if (IS_ERR(pll))
+		return ERR_CAST(pll);
+
+	/* ensure parent is set to pll_re_vco */
+
+	val = pll_readl_base(pll);
+	val_aux = pll_readl(pll_params->aux_reg, pll);
+
+	if (val & PLLE_BASE_ENABLE) {
+		if ((val_aux & PLLE_AUX_PLLRE_SEL) ||
+			(val_aux & PLLE_AUX_PLLP_SEL))
+			WARN(1, "pll_e enabled with unsupported parent %s\n",
+			  (val_aux & PLLE_AUX_PLLP_SEL) ? "pllp_out0" :
+					"pll_re_vco");
+	} else {
+		val_aux &= ~(PLLE_AUX_PLLRE_SEL | PLLE_AUX_PLLP_SEL);
+		pll_writel(val_aux, pll_params->aux_reg, pll);
+	}
+
+	clk = _tegra_clk_register_pll(pll, name, parent_name, flags,
+				      &tegra_clk_plle_tegra210_ops);
+	if (IS_ERR(clk))
+		kfree(pll);
+
+	return clk;
+}
+
+struct clk *tegra_clk_register_pllc_tegra210(const char *name,
+			const char *parent_name, void __iomem *clk_base,
+			void __iomem *pmc, unsigned long flags,
+			struct tegra_clk_pll_params *pll_params,
+			spinlock_t *lock)
+{
+	struct clk *parent, *clk;
+	struct pdiv_map *p_tohw = pll_params->pdiv_tohw;
+	struct tegra_clk_pll *pll;
+	unsigned long parent_rate;
+
+	if (!p_tohw)
+		return ERR_PTR(-EINVAL);
+
+	parent = __clk_lookup(parent_name);
+	if (!parent) {
+		WARN(1, "parent clk %s of %s must be registered first\n",
+			name, parent_name);
+		return ERR_PTR(-EINVAL);
+	}
+
+	parent_rate = __clk_get_rate(parent);
+
+	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+	pll_params->flags |= TEGRA_PLL_BYPASS;
+	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
+	if (IS_ERR(pll))
+		return ERR_CAST(pll);
+
+	clk = _tegra_clk_register_pll(pll, name, parent_name, flags,
+				      &tegra_clk_pll_ops);
+	if (IS_ERR(clk))
+		kfree(pll);
+
+	return clk;
+}
+
+struct clk *tegra_clk_register_pllxc_tegra210(const char *name,
+			const char *parent_name, void __iomem *clk_base,
+			void __iomem *pmc, unsigned long flags,
+			struct tegra_clk_pll_params *pll_params,
+			spinlock_t *lock)
+{
+	struct tegra_clk_pll *pll;
+	struct clk *clk, *parent;
+	unsigned long parent_rate;
+	u32 val, val_iddq;
+
+	parent = __clk_lookup(parent_name);
+	if (!parent) {
+		WARN(1, "parent clk %s of %s must be registered first\n",
+			name, parent_name);
+		return ERR_PTR(-EINVAL);
+	}
+
+	if (!pll_params->pdiv_tohw)
+		return ERR_PTR(-EINVAL);
+
+	parent_rate = __clk_get_rate(parent);
+
+	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
+	if (IS_ERR(pll))
+		return ERR_CAST(pll);
+
+	clk = _tegra_clk_register_pll(pll, name, parent_name, flags,
+				      &tegra_clk_pll_ops);
+	if (IS_ERR(clk))
+		kfree(pll);
+
+	return clk;
+}
+
+struct clk *tegra_clk_register_pllss_tegra210(const char *name,
+				const char *parent_name, void __iomem *clk_base,
+				unsigned long flags,
+				struct tegra_clk_pll_params *pll_params,
+				spinlock_t *lock)
+{
+	struct tegra_clk_pll *pll;
+	struct clk *clk, *parent;
+	struct tegra_clk_pll_freq_table cfg;
+	unsigned long parent_rate;
+	u32 val;
+	int i;
+
+	if (!pll_params->div_nmp)
+		return ERR_PTR(-EINVAL);
+
+	parent = __clk_lookup(parent_name);
+	if (!parent) {
+		WARN(1, "parent clk %s of %s must be registered first\n",
+			name, parent_name);
+		return ERR_PTR(-EINVAL);
+	}
+
+	pll = _tegra_init_pll(clk_base, NULL, pll_params, lock);
+	if (IS_ERR(pll))
+		return ERR_CAST(pll);
+
+	val = pll_readl_base(pll);
+	val &= ~PLLSS_REF_SRC_SEL_MASK;
+	pll_writel_base(val, pll);
+
+	parent_rate = __clk_get_rate(parent);
+
+	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+	/* initialize PLL to minimum rate */
+
+	cfg.m = _pll_fixed_mdiv(pll_params, parent_rate);
+	cfg.n = cfg.m * pll_params->vco_min / parent_rate;
+
+	for (i = 0; pll_params->pdiv_tohw[i].pdiv; i++)
+		;
+	if (!i) {
+		kfree(pll);
+		return ERR_PTR(-EINVAL);
+	}
+
+	cfg.p = pll_params->pdiv_tohw[i-1].hw_val;
+
+	_update_pll_mnp(pll, &cfg);
+
+	pll_writel_misc(PLLSS_MISC_DEFAULT, pll);
+
+	val = pll_readl_base(pll);
+	if (val & PLL_BASE_ENABLE) {
+		if (val & BIT(pll_params->iddq_bit_idx)) {
+			WARN(1, "%s is on but IDDQ set\n", name);
+			kfree(pll);
+			return ERR_PTR(-EINVAL);
+		}
+	} else
+		val |= BIT(pll_params->iddq_bit_idx);
+
+	val &= ~PLLSS_LOCK_OVERRIDE;
+	pll_writel_base(val, pll);
+
+	clk = _tegra_clk_register_pll(pll, name, parent_name, flags,
+					&tegra_clk_pll_ops);
+
+	if (IS_ERR(clk))
+		kfree(pll);
+
+	return clk;
+}
+#endif
drivers/clk/tegra/clk.h +24 -0
index 0146c91df635..86f4b84de5df 100644
@@ -313,6 +313,12 @@ struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
 			    struct tegra_clk_pll_params *pll_params,
 			    spinlock_t *lock);
 
+struct clk *tegra_clk_register_pllxc_tegra210(const char *name,
+			const char *parent_name, void __iomem *clk_base,
+			void __iomem *pmc, unsigned long flags,
+			struct tegra_clk_pll_params *pll_params,
+			spinlock_t *lock);
+
 struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,
 			   void __iomem *clk_base, void __iomem *pmc,
 			   unsigned long flags,
@@ -337,6 +343,24 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,
 				struct tegra_clk_pll_params *pll_params,
 				spinlock_t *lock);
 
+struct clk *tegra_clk_register_plle_tegra210(const char *name,
+				const char *parent_name,
+				void __iomem *clk_base, unsigned long flags,
+				struct tegra_clk_pll_params *pll_params,
+				spinlock_t *lock);
+
+struct clk *tegra_clk_register_pllc_tegra210(const char *name,
+				const char *parent_name, void __iomem *clk_base,
+				void __iomem *pmc, unsigned long flags,
+				struct tegra_clk_pll_params *pll_params,
+				spinlock_t *lock);
+
+struct clk *tegra_clk_register_pllss_tegra210(const char *name,
+				const char *parent_name, void __iomem *clk_base,
+				unsigned long flags,
+				struct tegra_clk_pll_params *pll_params,
+				spinlock_t *lock);
+
 struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name,
 			   void __iomem *clk_base, unsigned long flags,
 			   struct tegra_clk_pll_params *pll_params,
Signature · 1 line
1.7.9.5
#39 lore raw

Re: [PATCH v4 12/20] clk: tegra: pll: Add specialized logic for T210

On Mon, May 04, 2015 at 12:37:32PM -0400, Rhyland Klein wrote:
[...]

Quoted 1 line
drivers/clk/tegra/clk-pll.c +0 -0

[...]

drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name, · line 2211

Quoted 10 lines
drivers/clk/tegra/clk-pll.c +10 -0
+struct clk *tegra_clk_register_pllxc_tegra210(const char *name,
+			const char *parent_name, void __iomem *clk_base,
+			void __iomem *pmc, unsigned long flags,
+			struct tegra_clk_pll_params *pll_params,
+			spinlock_t *lock)
+{
+	struct tegra_clk_pll *pll;
+	struct clk *clk, *parent;
+	unsigned long parent_rate;
+	u32 val, val_iddq;

These two variables don't seem to be used.

Thierry

#40 lore raw

PATCH v4 13/20 clk: tegra: pll: Add support for PLLMB for T210

In reply to Rhyland Klein

Tegra210 SoC's have 2 PLLS for memory usage. Add plumbing to register and handle PLLMB.

PLLMB is used to allow switching between 2 PLLM's without having to use and intermediate backup PLL, as we need to lock the PLL before we can switch to it.

---
v3:
- Flushed out comment more.

v2:
- Fixed commit description as suggested.

 drivers/clk/tegra/clk-pll.c |   46 +++++++++++++++++++++++++++++++++++++++----
 drivers/clk/tegra/clk.h     |    9 +++++++++
 2 files changed, 51 insertions(+), 4 deletions(-)
drivers/clk/tegra/clk-pll.c +42 -4
index 9224c9c7c497..b16263e978d7 100644
@@ -547,7 +547,7 @@ static void _update_pll_mnp(struct tegra_clk_pll *pll,
 	struct tegra_clk_pll_params *params = pll->params;
 	struct div_nmp *div_nmp = params->div_nmp;
 
-	if ((params->flags & TEGRA_PLLM) &&
+	if ((params->flags & (TEGRA_PLLM | TEGRA_PLLMB)) &&
 		(pll_override_readl(PMC_PLLP_WB0_OVERRIDE, pll) &
 			PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)) {
 		val = pll_override_readl(params->pmc_divp_reg, pll);
@@ -584,7 +584,7 @@ static void _get_pll_mnp(struct tegra_clk_pll *pll,
 	struct tegra_clk_pll_params *params = pll->params;
 	struct div_nmp *div_nmp = params->div_nmp;
 
-	if ((params->flags & TEGRA_PLLM) &&
+	if ((params->flags & (TEGRA_PLLM | TEGRA_PLLMB)) &&
 		(pll_override_readl(PMC_PLLP_WB0_OVERRIDE, pll) &
 			PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE)) {
 		val = pll_override_readl(params->pmc_divp_reg, pll);
@@ -730,8 +730,8 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
 	if (pll->params->flags & TEGRA_PLL_FIXED)
 		return pll->params->fixed_rate;
 
-	/* PLLM is used for memory; we do not change rate */
-	if (pll->params->flags & TEGRA_PLLM)
+	/* PLLM/MB are used for memory; we do not change rate */
+	if (pll->params->flags & (TEGRA_PLLM | TEGRA_PLLMB))
 		return __clk_get_rate(hw->clk);
 
 	if (_get_table_rate(hw, &cfg, rate, *prate) &&
@@ -2310,4 +2310,42 @@ struct clk *tegra_clk_register_pllss_tegra210(const char *name,
 
 	return clk;
 }
+
+struct clk *tegra_clk_register_pllmb(const char *name, const char *parent_name,
+			  void __iomem *clk_base, void __iomem *pmc,
+			  unsigned long flags,
+			  struct tegra_clk_pll_params *pll_params,
+			  spinlock_t *lock)
+{
+	struct tegra_clk_pll *pll;
+	struct clk *clk, *parent;
+	unsigned long parent_rate;
+
+	if (!pll_params->pdiv_tohw)
+		return ERR_PTR(-EINVAL);
+
+	parent = __clk_lookup(parent_name);
+	if (!parent) {
+		WARN(1, "parent clk %s of %s must be registered first\n",
+			name, parent_name);
+		return ERR_PTR(-EINVAL);
+	}
+
+	parent_rate = __clk_get_rate(parent);
+
+	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
+
+	pll_params->flags |= TEGRA_PLL_BYPASS;
+	pll_params->flags |= TEGRA_PLLMB;
+	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
+	if (IS_ERR(pll))
+		return ERR_CAST(pll);
+
+	clk = _tegra_clk_register_pll(pll, name, parent_name, flags,
+				      &tegra_clk_pllm_ops);
+	if (IS_ERR(clk))
+		kfree(pll);
+
+	return clk;
+}
 #endif
drivers/clk/tegra/clk.h +9 -0
index 86f4b84de5df..4644f43ca100 100644
@@ -201,6 +201,8 @@ struct div_nmp {
  * TEGRA_PLL_HAS_LOCK_ENABLE - PLL has bit to enable lock monitoring
  * TEGRA_MDIV_NEW - Switch to new method for calculating fixed mdiv
  *     it may be more accurate (especially if SDM present)
+ * TEGRA_PLLMB - PLLMB has should be treated similar to PLLM. This
+ *     flag indicated that it is PLLMB.
  */
 struct tegra_clk_pll_params {
 	unsigned long	input_min;
@@ -260,6 +262,7 @@ struct tegra_clk_pll_params {
 #define TEGRA_PLL_BYPASS BIT(9)
 #define TEGRA_PLL_HAS_LOCK_ENABLE BIT(10)
 #define TEGRA_MDIV_NEW BIT(11)
+#define TEGRA_PLLMB BIT(12)
 
 /**
  * struct tegra_clk_pll - Tegra PLL clock
@@ -366,6 +369,12 @@ struct clk *tegra_clk_register_pllss(const char *name, const char *parent_name,
 			   struct tegra_clk_pll_params *pll_params,
 			   spinlock_t *lock);
 
+struct clk *tegra_clk_register_pllmb(const char *name, const char *parent_name,
+			   void __iomem *clk_base, void __iomem *pmc,
+			   unsigned long flags,
+			   struct tegra_clk_pll_params *pll_params,
+			   spinlock_t *lock);
+
 /**
  * struct tegra_clk_pll_out - PLL divider down clock
  *
Signature · 1 line
1.7.9.5
#41 lore raw

PATCH v4 14/20 clk: tegra: pll: Adjust vco_min if SDM present

In reply to Rhyland Klein

From: Bill Huang <[email protected]>

This code makes use of the SDM fractional divider if present to contrain the allowable programming range of the PLL divider register bitfields to take advantage of higher frequency granularity that can be induced by the SDM divider.

Based on original work by Aleksandr Frid <[email protected]>

---
 drivers/clk/tegra/clk-pll.c |   29 ++++++++++++++++++++++++++++-
 drivers/clk/tegra/clk.h     |    2 ++
 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/clk/tegra/clk-pll.c +28 -1
index b16263e978d7..94416018e35c 100644
@@ -1635,7 +1635,6 @@ static const struct clk_ops tegra_clk_plle_tegra114_ops = {
 	.recalc_rate = clk_pll_recalc_rate,
 };
 
-
 struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
 			  void __iomem *clk_base, void __iomem *pmc,
 			  unsigned long flags,
@@ -1662,6 +1661,10 @@ struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
 
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
+	if (pll_params->adjust_vco)
+		pll_params->vco_min = pll_params->adjust_vco(pll_params,
+							     parent_rate);
+
 	err = _setup_dynamic_ramp(pll_params, clk_base, parent_rate);
 	if (err)
 		return ERR_PTR(err);
@@ -1700,6 +1703,10 @@ struct clk *tegra_clk_register_pllre(const char *name, const char *parent_name,
 
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
+	if (pll_params->adjust_vco)
+		pll_params->vco_min = pll_params->adjust_vco(pll_params,
+							     parent_rate);
+
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
 	if (IS_ERR(pll))
 		return ERR_CAST(pll);
@@ -1756,6 +1763,10 @@ struct clk *tegra_clk_register_pllm(const char *name, const char *parent_name,
 
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
+	if (pll_params->adjust_vco)
+		pll_params->vco_min = pll_params->adjust_vco(pll_params,
+							     parent_rate);
+
 	pll_params->flags |= TEGRA_PLL_BYPASS;
 	pll_params->flags |= TEGRA_PLLM;
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
@@ -2186,6 +2197,10 @@ struct clk *tegra_clk_register_pllc_tegra210(const char *name,
 
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
+	if (pll_params->adjust_vco)
+		pll_params->vco_min = pll_params->adjust_vco(pll_params,
+							     parent_rate);
+
 	pll_params->flags |= TEGRA_PLL_BYPASS;
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
 	if (IS_ERR(pll))
@@ -2224,6 +2239,10 @@ struct clk *tegra_clk_register_pllxc_tegra210(const char *name,
 
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
+	if (pll_params->adjust_vco)
+		pll_params->vco_min = pll_params->adjust_vco(pll_params,
+							     parent_rate);
+
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
 	if (IS_ERR(pll))
 		return ERR_CAST(pll);
@@ -2271,6 +2290,10 @@ struct clk *tegra_clk_register_pllss_tegra210(const char *name,
 
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
+	if (pll_params->adjust_vco)
+		pll_params->vco_min = pll_params->adjust_vco(pll_params,
+							     parent_rate);
+
 	/* initialize PLL to minimum rate */
 
 	cfg.m = _pll_fixed_mdiv(pll_params, parent_rate);
@@ -2335,6 +2358,10 @@ struct clk *tegra_clk_register_pllmb(const char *name, const char *parent_name,
 
 	pll_params->vco_min = _clip_vco_min(pll_params->vco_min, parent_rate);
 
+	if (pll_params->adjust_vco)
+		pll_params->vco_min = pll_params->adjust_vco(pll_params,
+							     parent_rate);
+
 	pll_params->flags |= TEGRA_PLL_BYPASS;
 	pll_params->flags |= TEGRA_PLLMB;
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
drivers/clk/tegra/clk.h +2 -0
index 4644f43ca100..fb4caa510583 100644
@@ -248,6 +248,8 @@ struct tegra_clk_pll_params {
 	int	(*calc_rate)(struct clk_hw *hw,
 			struct tegra_clk_pll_freq_table *cfg,
 			unsigned long rate, unsigned long parent_rate);
+	unsigned long	(*adjust_vco)(struct tegra_clk_pll_params *pll_params,
+				unsigned long parent_rate);
 };
 
 #define TEGRA_PLL_USE_LOCK BIT(0)
Signature · 1 line
1.7.9.5
#42 lore raw

PATCH v4 15/20 clk: tegra: pll: Add dyn_ramp callback

In reply to Rhyland Klein

From: Bill Huang <[email protected]>

Add a callback to the pll_params for custom dynamic ramping functions which can be specified per PLL.

---
 drivers/clk/tegra/clk.h |    4 ++++
 1 file changed, 4 insertions(+)
drivers/clk/tegra/clk.h +4 -0
index fb4caa510583..74cf6242a57a 100644
@@ -160,6 +160,8 @@ struct div_nmp {
 
 #define MAX_PLL_MISC_REG_COUNT	6
 
+struct tegra_clk_pll;
+
 /**
  * struct clk_pll_params - PLL parameters
  *
@@ -250,6 +252,8 @@ struct tegra_clk_pll_params {
 			unsigned long rate, unsigned long parent_rate);
 	unsigned long	(*adjust_vco)(struct tegra_clk_pll_params *pll_params,
 				unsigned long parent_rate);
+	int	(*dyn_ramp)(struct tegra_clk_pll *pll,
+			struct tegra_clk_pll_freq_table *cfg);
 };
 
 #define TEGRA_PLL_USE_LOCK BIT(0)
Signature · 1 line
1.7.9.5
#43 lore raw

PATCH v4 16/20 clk: tegra: pll: Add Set_default logic

In reply to Rhyland Klein

From: Bill Huang <[email protected]>

Add logic which (if specified for a pll) can verify that a PLL is set to the proper default value and if not can set it. This can be specified per PLL as each will have different default values.

Based on original work by Aleksandr Frid <[email protected]>

---
v2:
- Remove MACRO for PLL_MISC_CHECK_DEFAULT as suggested, and instead the tegra210 driver will include an inline version of this function.

 drivers/clk/tegra/clk-pll.c |   46 ++++++++++++++++++++++++++++++++-----------
 drivers/clk/tegra/clk.h     |    2 ++
 2 files changed, 37 insertions(+), 11 deletions(-)
drivers/clk/tegra/clk-pll.c +35 -11
index 94416018e35c..778f2de0045e 100644
@@ -658,15 +658,28 @@ static int _program_pll(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,
 			unsigned long rate)
 {
 	struct tegra_clk_pll *pll = to_clk_pll(hw);
+	struct tegra_clk_pll_freq_table old_cfg;
 	int state, ret = 0;
 
 	state = clk_pll_is_enabled(hw);
 
+	_get_pll_mnp(pll, &old_cfg);
+
+	if (state && pll->params->defaults_set && pll->params->dyn_ramp &&
+			(cfg->m == old_cfg.m) && (cfg->p == old_cfg.p)) {
+		ret = pll->params->dyn_ramp(pll, cfg);
+		if (!ret)
+			return 0;
+	}
+
 	if (state) {
 		pll_clk_stop_ss(pll);
 		_clk_pll_disable(hw);
 	}
 
+	if (!pll->params->defaults_set && pll->params->set_defaults)
+		pll->params->set_defaults(pll);
+
 	_update_pll_mnp(pll, cfg);
 
 	if (pll->params->flags & TEGRA_PLL_HAS_CPCON)
@@ -1526,6 +1539,9 @@ static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll,
 	if (!pll->params->calc_rate)
 		pll->params->calc_rate = _calc_rate;
 
+	if (pll->params->set_defaults)
+		pll->params->set_defaults(pll);
+
 	/* Data in .init is copied by clk_register(), so stack variable OK */
 	pll->hw.init = &init;
 
@@ -1644,7 +1660,6 @@ struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
 	struct tegra_clk_pll *pll;
 	struct clk *clk, *parent;
 	unsigned long parent_rate;
-	int err;
 	u32 val, val_iddq;
 
 	parent = __clk_lookup(parent_name);
@@ -1665,18 +1680,27 @@ struct clk *tegra_clk_register_pllxc(const char *name, const char *parent_name,
 		pll_params->vco_min = pll_params->adjust_vco(pll_params,
 							     parent_rate);
 
-	err = _setup_dynamic_ramp(pll_params, clk_base, parent_rate);
-	if (err)
-		return ERR_PTR(err);
+	/*
+	 * If the pll has a set_defaults callback, it will take care of
+	 * configuring dynamic ramping and setting IDDQ in that path.
+	 */
+	if (!pll_params->set_defaults) {
+		int err;
 
-	val = readl_relaxed(clk_base + pll_params->base_reg);
-	val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg);
+		err = _setup_dynamic_ramp(pll_params, clk_base, parent_rate);
+		if (err)
+			return ERR_PTR(err);
 
-	if (val & PLL_BASE_ENABLE)
-		WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx));
-	else {
-		val_iddq |= BIT(pll_params->iddq_bit_idx);
-		writel_relaxed(val_iddq, clk_base + pll_params->iddq_reg);
+		val = readl_relaxed(clk_base + pll_params->base_reg);
+		val_iddq = readl_relaxed(clk_base + pll_params->iddq_reg);
+
+		if (val & PLL_BASE_ENABLE)
+			WARN_ON(val_iddq & BIT(pll_params->iddq_bit_idx));
+		else {
+			val_iddq |= BIT(pll_params->iddq_bit_idx);
+			writel_relaxed(val_iddq,
+				       clk_base + pll_params->iddq_reg);
+		}
 	}
 
 	pll = _tegra_init_pll(clk_base, pmc, pll_params, lock);
drivers/clk/tegra/clk.h +2 -0
index 74cf6242a57a..c111a89bb5ea 100644
@@ -239,6 +239,7 @@ struct tegra_clk_pll_params {
 	int		stepb_shift;
 	int		lock_delay;
 	int		max_p;
+	bool		defaults_set;
 	struct pdiv_map *pdiv_tohw;
 	struct div_nmp	*div_nmp;
 	struct tegra_clk_pll_freq_table	*freq_table;
@@ -254,6 +255,7 @@ struct tegra_clk_pll_params {
 				unsigned long parent_rate);
 	int	(*dyn_ramp)(struct tegra_clk_pll *pll,
 			struct tegra_clk_pll_freq_table *cfg);
+	void	(*set_defaults)(struct tegra_clk_pll *pll);
 };
 
 #define TEGRA_PLL_USE_LOCK BIT(0)
Signature · 1 line
1.7.9.5
#44 lore raw

PATCH v4 17/20 clk: tegra: pll: Fix _pll_ramp_calc_pll logic and _calc_dynamic_ramp_rate

In reply to Rhyland Klein

This removes the conversion from pdiv to hw, which is already taken care of by _get_table_rate before this code is run. This avoids incorrectly converting pdiv to hw twice and getting the wrong hw value.

Also set the input_rate in the freq cfg in _calc_dynamic_ramp_rate while setting all the other fields.

---
v2:
- Added fix for _calc_dynamic_ramp_rate where input_rate wasn't ever populated in the cfg, which could cause problems later if/when accessed.

 drivers/clk/tegra/clk-pll.c |    8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/clk/tegra/clk-pll.c +2 -6
index 778f2de0045e..a8d5399bff1b 100644
@@ -1018,6 +1018,7 @@ static int _calc_dynamic_ramp_rate(struct clk_hw *hw,
 	cfg->m = _pll_fixed_mdiv(pll->params, parent_rate);
 	cfg->output_rate = rate * p;
 	cfg->n = cfg->output_rate * cfg->m / parent_rate;
+	cfg->input_rate = parent_rate;
 
 	p_div = _p_div_to_hw(hw, p);
 	if (p_div < 0)
@@ -1036,7 +1037,7 @@ static int _pll_ramp_calc_pll(struct clk_hw *hw,
 			      unsigned long rate, unsigned long parent_rate)
 {
 	struct tegra_clk_pll *pll = to_clk_pll(hw);
-	int err = 0, p_div;
+	int err = 0;
 
 	err = _get_table_rate(hw, cfg, rate, parent_rate);
 	if (err < 0)
@@ -1047,11 +1048,6 @@ static int _pll_ramp_calc_pll(struct clk_hw *hw,
 			err = -EINVAL;
 			goto out;
 		}
-		p_div = _p_div_to_hw(hw, cfg->p);
-		if (p_div < 0)
-			return p_div;
-		else
-			cfg->p = p_div;
 	}
 
 	if (cfg->p >  pll->params->max_p)
Signature · 1 line
1.7.9.5
#45 lore raw

PATCH v4 18/20 clk: tegra: Add Super Gen5 Logic

In reply to Rhyland Klein

From: Bill Huang <[email protected]>

Super clock divider control and clock source mux of Tegra210 has changed a little against prior SoCs, this patch adds Gen5 logic to address those differences.

---
v2:
- Fixed sclk divider address (0x370 -> 0x2c)

 drivers/clk/tegra/Makefile               |    1 +
 drivers/clk/tegra/clk-tegra-super-gen5.c |  150 ++++++++++++++++++++++++++++++
 drivers/clk/tegra/clk.h                  |    3 +
 3 files changed, 154 insertions(+)
 create mode 100644 drivers/clk/tegra/clk-tegra-super-gen5.c
drivers/clk/tegra/Makefile +1 -0
index edb8358fa6ce..ff0c3e205db6 100644
@@ -11,6 +11,7 @@ obj-y					+= clk-tegra-periph.o
 obj-y					+= clk-tegra-pmc.o
 obj-y					+= clk-tegra-fixed.o
 obj-y					+= clk-tegra-super-gen4.o
+obj-y					+= clk-tegra-super-gen5.o
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)         += clk-tegra20.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)         += clk-tegra30.o
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= clk-tegra114.o
drivers/clk/tegra/clk-tegra-super-gen5.c new file +150 -0

150 lines not on this page · raw message

drivers/clk/tegra/clk.h +3 -0
index c111a89bb5ea..530cc92066d6 100644
@@ -701,6 +701,9 @@ int tegra_osc_clk_init(void __iomem *clk_base, struct tegra_clk *clks,
 void tegra_super_clk_gen4_init(void __iomem *clk_base,
 			void __iomem *pmc_base, struct tegra_clk *tegra_clks,
 			struct tegra_clk_pll_params *pll_params);
+void tegra_super_clk_gen5_init(void __iomem *clk_base,
+			void __iomem *pmc_base, struct tegra_clk *tegra_clks,
+			struct tegra_clk_pll_params *pll_params);
 
 void tegra114_clock_tune_cpu_trimmers_high(void);
 void tegra114_clock_tune_cpu_trimmers_low(void);
Signature · 1 line
1.7.9.5
#46 lore raw

PATCH v4 19/20 clk: tegra210: add support for Tegra210 clocks

In reply to Rhyland Klein

Implement clock support for Tegra210.

---
v4:
- Fixed checkpatch errors
- Fixed pllx_dyn_ramp error (missing ->params)

v3:
- Fixed pll_u hierarchy. PLL_U has a vco output now, and out1 and out2 clocks which are used to generate 60M and 48M clocks. VCO is used for 480M clock and the pll_u_out clock generates the 240M clock.
- Renamed pll_u -> pll_u_vco
- Removed 12M clock which doesn't exist anymore
- Renamed pll_re_c4_div_table -> pll_vco_post_div_table
- Set initial rates for pll_u_out1/2 for 48M/60M respectively.

v2:
- Fixed pll_a sdm_din_reg address (MISC0 -> MISC1)
- Fixed plld_set_defaults to not override DSI_CLKENABLE
- Fixed error in pll_e_freq table where cml divider was set into wrong field
- Removed freq comments based on previous review comments
- Removed freq for FPGA as suggested
- Added _pll_misc_chk_default inline function
- Fixed error in pllx dynamic ramp logic

 .../bindings/clock/nvidia,tegra210-car.txt         |   56 +
 drivers/clk/tegra/Makefile                         |    1 +
 drivers/clk/tegra/clk-id.h                         |    7 +
 drivers/clk/tegra/clk-tegra210.c                   | 2761 ++++++++++++++++++++
 include/dt-bindings/clock/tegra210-car.h           |  401 +++
 5 files changed, 3226 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt
 create mode 100644 drivers/clk/tegra/clk-tegra210.c
 create mode 100644 include/dt-bindings/clock/tegra210-car.h
Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt new file +56 -0
new file mode 100644
index 000000000000..26f237f641b7
@@ -0,0 +1,56 @@
+NVIDIA Tegra210 Clock And Reset Controller
+
+This binding uses the common clock binding:
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+The CAR (Clock And Reset) Controller on Tegra is the HW module responsible
+for muxing and gating Tegra's clocks, and setting their rates.
+
+Required properties :
+- compatible : Should be "nvidia,tegra210-car"
+- reg : Should contain CAR registers location and length
+- clocks : Should contain phandle and clock specifiers for two clocks:
+  the 32 KHz "32k_in".
+- #clock-cells : Should be 1.
+  In clock consumers, this cell represents the clock ID exposed by the
+  CAR. The assignments may be found in header file
+  <dt-bindings/clock/tegra210-car.h>.
+- #reset-cells : Should be 1.
+  In clock consumers, this cell represents the bit number in the CAR's
+  array of CLK_RST_CONTROLLER_RST_DEVICES_* registers.
+
+Example SoC include file:
+
+/ {
+	tegra_car: clock {
+		compatible = "nvidia,tegra210-car";
+		reg = <0x60006000 0x1000>;
+		#clock-cells = <1>;
+		#reset-cells = <1>;
+	};
+
+	usb@c5004000 {
+		clocks = <&tegra_car TEGRA210_CLK_USB2>;
+	};
+};
+
+Example board file:
+
+/ {
+	clocks {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		clk_32k: clock@1 {
+			compatible = "fixed-clock";
+			reg = <1>;
+			#clock-cells = <0>;
+			clock-frequency = <32768>;
+		};
+	};
+
+	&tegra_car {
+		clocks = <&clk_32k>;
+	};
+};
drivers/clk/tegra/Makefile +1 -0
index ff0c3e205db6..3b868f41926a 100644
@@ -17,3 +17,4 @@ obj-$(CONFIG_ARCH_TEGRA_3x_SOC)         += clk-tegra30.o
 obj-$(CONFIG_ARCH_TEGRA_114_SOC)	+= clk-tegra114.o
 obj-$(CONFIG_ARCH_TEGRA_124_SOC)	+= clk-tegra124.o
 obj-$(CONFIG_ARCH_TEGRA_132_SOC)	+= clk-tegra124.o
+obj-$(CONFIG_ARCH_TEGRA_210_SOC)	+= clk-tegra210.o
drivers/clk/tegra/clk-id.h +7 -0
index ac6eaba5cc6e..4f267cf2434d 100644
@@ -151,6 +151,10 @@ enum clk_id {
 	tegra_clk_pll_c2,
 	tegra_clk_pll_c3,
 	tegra_clk_pll_c4,
+	tegra_clk_pll_c4_out0,
+	tegra_clk_pll_c4_out1,
+	tegra_clk_pll_c4_out2,
+	tegra_clk_pll_c4_out3,
 	tegra_clk_pll_c_out1,
 	tegra_clk_pll_d,
 	tegra_clk_pll_d2,
@@ -173,6 +177,9 @@ enum clk_id {
 	tegra_clk_pll_re_out,
 	tegra_clk_pll_re_vco,
 	tegra_clk_pll_u,
+	tegra_clk_pll_u_out,
+	tegra_clk_pll_u_out1,
+	tegra_clk_pll_u_out2,
 	tegra_clk_pll_u_12m,
 	tegra_clk_pll_u_480m,
 	tegra_clk_pll_u_48m,
drivers/clk/tegra/clk-tegra210.c new file +2761 -0

2,761 lines not on this page · raw message

include/dt-bindings/clock/tegra210-car.h new file +401 -0

160 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
1.7.9.5

Part of the diff is not shown here. View the raw message.

#47 lore raw

Re: [PATCH v4 19/20] clk: tegra210: add support for Tegra210 clocks

On Mon, May 04, 2015 at 12:37:39PM -0400, Rhyland Klein wrote:
[...]

Quoted 1 line
drivers/clk/tegra/clk-tegra210.c +0 -0

[...]

drivers/clk/tegra/clk-tegra210.c line 1775

Quoted 8 lines
drivers/clk/tegra/clk-tegra210.c +8 -0
+static struct div_nmp plld_nmp = {
+	.divm_shift = 0,
+	.divm_width = 8,
+	.divn_shift = 11,
+	.divn_width = 8,
+	.divp_shift = 20,
+	.divp_width = 3,
+};

I think we need to add the SDM shift and width fields here:

	.sdm_shift = 0,
	.sdm_width = 16,

Otherwise pll_d can't take advantage of the fractional divider.

[...]

Quoted 1 line

+static struct tegra_clk tegra210_clks[tegra_clk_max] __initdata = {

[...]

drivers/clk/tegra/clk-tegra210.c line 2051

Quoted 1 line
drivers/clk/tegra/clk-tegra210.c +1 -0
+	[tegra_clk_clk72Mhz] = { .dt_id = TEGRA210_CLK_CLK72MHZ, .present = true },

I think you want to use the _8 variant here that you specifically introduced for Tegra210 in an earlier patch.

Quoted 14 lines
drivers/clk/tegra/clk-tegra210.c +14 -0
+static __init void tegra210_periph_clk_init(void __iomem *clk_base,
+					    void __iomem *pmc_base)
+{
+	struct clk *clk;
+
+	/* xusb_ss_div2 */
+	clk = clk_register_fixed_factor(NULL, "xusb_ss_div2", "xusb_ss_src", 0,
+					1, 2);
+	clks[TEGRA210_CLK_XUSB_SS_DIV2] = clk;
+
+	/* plld_dsi */
+	clk = clk_register_gate(NULL, "pll_d_dsi", "pll_d_out0", 0,
+				clk_base + PLLD_MISC0, 21, 0, &pll_d_lock);
+	clks[TEGRA210_CLK_PLLD_DSI] = clk;

drivers/clk/tegra/clk-tegra210.c line 2343

Quoted 10 lines
drivers/clk/tegra/clk-tegra210.c +10 -0
+
+	/* dsia */
+	clk = tegra_clk_register_periph_gate("dsia", "pll_d_dsi", 0, clk_base,
+					     0, 48, periph_clk_enb_refcnt);
+	clks[TEGRA210_CLK_DSIA] = clk;
+
+	/* dsib */
+	clk = tegra_clk_register_periph_gate("dsib", "pll_d_dsi", 0, clk_base,
+					     0, 82, periph_clk_enb_refcnt);
+	clks[TEGRA210_CLK_DSIB] = clk;

Can we rename pll_d_dsi to pll_d_dsi_out for consistency with earlier SoC generations, please? Also, don't forget the /* plld_dsi */ comment.

In retrospect I'm not sure we've got this clock right. The (public) documentation is a little sparse, but I think this bit actually enables the fast and slow clocks to the MIPI pad macros. If you look at the register documentation for Tegra30 and Tegra114 they use a similarly named register with a more verbose description. I've also seen a couple of clock diagrams that indicate where these actually are.

Now what I wonder is if it makes any sense to represent this as a parent clock for DSI, because it really isn't. But if it isn't then we need to find another way of enabling this. Presumably turning this off saves power if pll_d is used for non-DSI/CSI purposes, so we'd want to disable it when we can. We could export this as a separate clock and add it to the DSI driver.

Rhyland, can you file an internal bug to track this, so that we get the documentation updated. Peter, can you help find out what the real story is with this clock?

Quoted 1 line
include/dt-bindings/clock/tegra210-car.h +0 -0

[...]

Quoted 1 line

+#define TEGRA210_CLK_PLLD_DSI 307

This would be TEGRA210_CLK_PLL_D_DSI_OUT after the rename suggested above.

I have a couple of other clocks that need to be added, but I think we can do that in separate patches, especially since some require changes to the drivers for previous SoCs.

Thierry

#48 lore raw

Re: [PATCH v4 19/20] clk: tegra210: add support for Tegra210 clocks

Quoted 49 lines · Thierry Reding

* PGP Signed by an unknown key

On Mon, May 04, 2015 at 12:37:39PM -0400, Rhyland Klein wrote:
[...]

Quoted 1 line
drivers/clk/tegra/clk-tegra210.c +0 -0

[...]

drivers/clk/tegra/clk-tegra210.c line 1775

Quoted 8 lines
drivers/clk/tegra/clk-tegra210.c +8 -0
+static struct div_nmp plld_nmp = {
+	.divm_shift = 0,
+	.divm_width = 8,
+	.divn_shift = 11,
+	.divn_width = 8,
+	.divp_shift = 20,
+	.divp_width = 3,
+};

I think we need to add the SDM shift and width fields here:

	.sdm_shift = 0,
	.sdm_width = 16,

Otherwise pll_d can't take advantage of the fractional divider.

[...]

Quoted 1 line

+static struct tegra_clk tegra210_clks[tegra_clk_max] __initdata = {

[...]

drivers/clk/tegra/clk-tegra210.c line 2051

Quoted 1 line
drivers/clk/tegra/clk-tegra210.c +1 -0
+	[tegra_clk_clk72Mhz] = { .dt_id = TEGRA210_CLK_CLK72MHZ, .present = true },

I think you want to use the _8 variant here that you specifically introduced for Tegra210 in an earlier patch.

Quoted 19 lines
drivers/clk/tegra/clk-tegra210.c +19 -0
+static __init void tegra210_periph_clk_init(void __iomem *clk_base,
+					    void __iomem *pmc_base)
+{
+	struct clk *clk;
+
+	/* xusb_ss_div2 */
+	clk = clk_register_fixed_factor(NULL, "xusb_ss_div2", "xusb_ss_src", 0,
+					1, 2);
+	clks[TEGRA210_CLK_XUSB_SS_DIV2] = clk;
+
+	/* plld_dsi */
+	clk = clk_register_gate(NULL, "pll_d_dsi", "pll_d_out0", 0,
+				clk_base + PLLD_MISC0, 21, 0, &pll_d_lock);
+	clks[TEGRA210_CLK_PLLD_DSI] = clk;
+
+	/* dsia */
+	clk = tegra_clk_register_periph_gate("dsia", "pll_d_dsi", 0, clk_base,
+					     0, 48, periph_clk_enb_refcnt);
+	clks[TEGRA210_CLK_DSIA] = clk;
Quoted 8 lines

drivers/clk/tegra/clk-tegra210.c line 2343

Quoted 5 lines
drivers/clk/tegra/clk-tegra210.c +5 -0
+
+	/* dsib */
+	clk = tegra_clk_register_periph_gate("dsib", "pll_d_dsi", 0, clk_base,
+					     0, 82, periph_clk_enb_refcnt);
+	clks[TEGRA210_CLK_DSIB] = clk;

Can we rename pll_d_dsi to pll_d_dsi_out for consistency with earlier SoC generations, please? Also, don't forget the /* plld_dsi */ comment.

sure

Quoted 15 lines

In retrospect I'm not sure we've got this clock right. The (public) documentation is a little sparse, but I think this bit actually enables the fast and slow clocks to the MIPI pad macros. If you look at the register documentation for Tegra30 and Tegra114 they use a similarly named register with a more verbose description. I've also seen a couple of clock diagrams that indicate where these actually are.

Now what I wonder is if it makes any sense to represent this as a parent clock for DSI, because it really isn't. But if it isn't then we need to find another way of enabling this. Presumably turning this off saves power if pll_d is used for non-DSI/CSI purposes, so we'd want to disable it when we can. We could export this as a separate clock and add it to the DSI driver.

Quoted 4 lines

Rhyland, can you file an internal bug to track this, so that we get the documentation updated. Peter, can you help find out what the real story is with this clock?

I'll file the bug and look into it some more.

-rhyland

Quoted 16 lines
Quoted 1 line
include/dt-bindings/clock/tegra210-car.h +0 -0

[...]

Quoted 1 line

+#define TEGRA210_CLK_PLLD_DSI 307

This would be TEGRA210_CLK_PLL_D_DSI_OUT after the rename suggested above.

I have a couple of other clocks that need to be added, but I think we can do that in separate patches, especially since some require changes to the drivers for previous SoCs.

Thierry

* Unknown Key
* 0x7F3EB3A1

Signature · 1 line
nvpublic
#49 lore raw

Re: [PATCH v4 19/20] clk: tegra210: add support for Tegra210 clocks

In reply to Thierry Reding
Quoted 17 lines · Thierry Reding

* PGP Signed by an unknown key

On Mon, May 04, 2015 at 12:37:39PM -0400, Rhyland Klein wrote:
[...]

Quoted 1 line
drivers/clk/tegra/clk-tegra210.c +0 -0

[...]

drivers/clk/tegra/clk-tegra210.c line 1775

Quoted 8 lines
drivers/clk/tegra/clk-tegra210.c +8 -0
+static struct div_nmp plld_nmp = {
+	.divm_shift = 0,
+	.divm_width = 8,
+	.divn_shift = 11,
+	.divn_width = 8,
+	.divp_shift = 20,
+	.divp_width = 3,
+};

I think we need to add the SDM shift and width fields here:

Quoted 5 lines
	.sdm_shift = 0,
	.sdm_width = 16,

Otherwise pll_d can't take advantage of the fractional divider.

Actually, sdm_shift/width aren't used. I originally added them to handle SDM data, but eventually I switched to using a reg/mask combo. So this isn't needed.

-rhyland

Signature · 1 line
nvpublic
#50 lore raw

Re: [PATCH v4 19/20] clk: tegra210: add support for Tegra210 clocks

Quoted 18 lines · Rhyland Klein
Quoted 17 lines · Thierry Reding

* PGP Signed by an unknown key

On Mon, May 04, 2015 at 12:37:39PM -0400, Rhyland Klein wrote:
[...]

Quoted 1 line
drivers/clk/tegra/clk-tegra210.c +0 -0

[...]

drivers/clk/tegra/clk-tegra210.c line 1775

Quoted 8 lines
drivers/clk/tegra/clk-tegra210.c +8 -0
+static struct div_nmp plld_nmp = {
+	.divm_shift = 0,
+	.divm_width = 8,
+	.divn_shift = 11,
+	.divn_width = 8,
+	.divp_shift = 20,
+	.divp_width = 3,
+};

I think we need to add the SDM shift and width fields here:

Quoted 8 lines
Quoted 5 lines
	.sdm_shift = 0,
	.sdm_width = 16,

Otherwise pll_d can't take advantage of the fractional divider.

Actually, sdm_shift/width aren't used. I originally added them to handle SDM data, but eventually I switched to using a reg/mask combo. So this isn't needed.

Right, I hadn't noticed that this had changed from your earlier drafts.

Thierry

#51 lore raw

Re: [PATCH v4 19/20] clk: tegra210: add support for Tegra210 clocks

In reply to Rhyland Klein
Quoted 154 lines · Rhyland Klein
drivers/clk/tegra/clk-tegra210.c new file +148 -0
new file mode 100644
index 000000000000..07382a473e22
@@ -0,0 +1,2761 @@
+/*
+ * Copyright (c) 2012-2014 NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+#include <dt-bindings/clock/tegra210-car.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+/*
+ * TEGRA210_CAR_BANK_COUNT: the number of peripheral clock register
+ * banks present in the Tegra210 CAR IP block.  The banks are
+ * identified by single letters, e.g.: L, H, U, V, W, X, Y.  See
+ * periph_regs[] in drivers/clk/tegra/clk.c
+ */
+#define TEGRA210_CAR_BANK_COUNT			7
+
+#define CLK_SOURCE_CSITE 0x1d4
+#define CLK_SOURCE_EMC 0x19c
+
+#define PLLC_BASE 0x80
+#define PLLC_OUT 0x84
+#define PLLC_MISC0 0x88
+#define PLLC_MISC1 0x8c
+#define PLLC_MISC2 0x5d0
+#define PLLC_MISC3 0x5d4
+
+#define PLLC2_BASE 0x4e8
+#define PLLC2_MISC0 0x4ec
+#define PLLC2_MISC1 0x4f0
+#define PLLC2_MISC2 0x4f4
+#define PLLC2_MISC3 0x4f8
+
+#define PLLC3_BASE 0x4fc
+#define PLLC3_MISC0 0x500
+#define PLLC3_MISC1 0x504
+#define PLLC3_MISC2 0x508
+#define PLLC3_MISC3 0x50c
+
+#define PLLM_BASE 0x90
+#define PLLM_MISC0 0x9c
+#define PLLM_MISC1 0x98
+#define PLLP_BASE 0xa0
+#define PLLP_MISC0 0xac
+#define PLLP_MISC1 0x680
+#define PLLA_BASE 0xb0
+#define PLLA_MISC0 0xbc
+#define PLLA_MISC1 0xb8
+#define PLLA_MISC2 0x5d8
+#define PLLD_BASE 0xd0
+#define PLLD_MISC0 0xdc
+#define PLLD_MISC1 0xd8
+#define PLLU_BASE 0xc0
+#define PLLU_OUTA 0xc4
+#define PLLU_MISC0 0xcc
+#define PLLU_MISC1 0xc8
+#define PLLX_BASE 0xe0
+#define PLLX_MISC0 0xe4
+#define PLLX_MISC1 0x510
+#define PLLX_MISC2 0x514
+#define PLLX_MISC3 0x518
+#define PLLX_MISC4 0x5f0
+#define PLLX_MISC5 0x5f4
+#define PLLE_BASE 0xe8
+#define PLLE_MISC0 0xec
+#define PLLD2_BASE 0x4b8
+#define PLLD2_MISC0 0x4bc
+#define PLLD2_MISC1 0x570
+#define PLLD2_MISC2 0x574
+#define PLLD2_MISC3 0x578
+#define PLLE_AUX 0x48c
+#define PLLRE_BASE 0x4c4
+#define PLLRE_MISC0 0x4c8
+#define PLLDP_BASE 0x590
+#define PLLDP_MISC 0x594
+
+#define PLLC4_BASE 0x5a4
+#define PLLC4_MISC0 0x5a8
+#define PLLC4_OUT 0x5e4
+#define PLLMB_BASE 0x5e8
+#define PLLMB_MISC0 0x5ec
+#define PLLA1_BASE 0x6a4
+#define PLLA1_MISC0 0x6a8
+#define PLLA1_MISC1 0x6ac
+#define PLLA1_MISC2 0x6b0
+#define PLLA1_MISC3 0x6b4
+
+#define PLLU_IDDQ_BIT 31
+#define PLLCX_IDDQ_BIT 27
+#define PLLRE_IDDQ_BIT 24
+#define PLLA_IDDQ_BIT 25
+#define PLLD_IDDQ_BIT 20
+#define PLLSS_IDDQ_BIT 18
+#define PLLM_IDDQ_BIT 5
+#define PLLMB_IDDQ_BIT 17
+#define PLLXP_IDDQ_BIT 3
+
+#define PLLCX_RESET_BIT 30
+
+#define PLL_BASE_LOCK BIT(27)
+#define PLLCX_BASE_LOCK BIT(26)
+#define PLLE_MISC_LOCK BIT(11)
+#define PLLRE_MISC_LOCK BIT(27)
+
+#define PLL_MISC_LOCK_ENABLE 18
+#define PLLC_MISC_LOCK_ENABLE 24
+#define PLLDU_MISC_LOCK_ENABLE 22
+#define PLLU_MISC_LOCK_ENABLE 29
+#define PLLE_MISC_LOCK_ENABLE 9
+#define PLLRE_MISC_LOCK_ENABLE 30
+#define PLLSS_MISC_LOCK_ENABLE 30
+#define PLLP_MISC_LOCK_ENABLE 18
+#define PLLM_MISC_LOCK_ENABLE 4
+#define PLLMB_MISC_LOCK_ENABLE 16
+#define PLLA_MISC_LOCK_ENABLE 28
+#define PLLU_MISC_LOCK_ENABLE 29
+#define PLLD_MISC_LOCK_ENABLE 18
+
+#define PLLA_SDM_DIN_MASK 0xffff
+#define PLLA_SDM_EN_MASK BIT(26)
+
+#define PLLD_SDM_EN_MASK BIT(16)
+
+#define PLLD2_SDM_EN_MASK BIT(31)
+#define PLLD2_SSC_EN_MASK BIT(30)
+
+#define PLLDP_SS_CFG	0x598

drivers/clk/tegra/clk-tegra210.c line 158

Quoted 10 lines
drivers/clk/tegra/clk-tegra210.c new file +10 -0
+#define PLLDP_SDM_EN_MASK BIT(31)
+#define PLLDP_SSC_EN_MASK BIT(30)
+#define PLLDP_SS_CTRL1	0x59c
+#define PLLDP_SS_CTRL2	0x5a0
+
+#define PMC_PLLM_WB0_OVERRIDE 0x1dc
+#define PMC_PLLM_WB0_OVERRIDE_2 0x2b0
+
+#define UTMIP_PLL_CFG2 0x488
+#define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6)

This line should be corrected as

+#define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xfff) << 6)

STABLE_COUNT has 12 bits.

drivers/clk/tegra/clk-tegra210.c line 165

Quoted 7 lines
drivers/clk/tegra/clk-tegra210.c new file +7 -0
+#define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4)
+
+#define UTMIP_PLL_CFG1 0x484
+#define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6)

This line should be corrected as

+#define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 27)

ENABLE_DLY_COUNT starts from bit 27.

--nvpublic

#52 lore raw

Re: [PATCH v4 19/20] clk: tegra210: add support for Tegra210 clocks

Quoted 167 lines · Jim Lin
Quoted 154 lines · Rhyland Klein
drivers/clk/tegra/clk-tegra210.c new file +148 -0
new file mode 100644
index 000000000000..07382a473e22
@@ -0,0 +1,2761 @@
+/*
+ * Copyright (c) 2012-2014 NVIDIA CORPORATION.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/io.h>
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/clkdev.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
+#include <linux/export.h>
+#include <linux/clk/tegra.h>
+#include <dt-bindings/clock/tegra210-car.h>
+
+#include "clk.h"
+#include "clk-id.h"
+
+/*
+ * TEGRA210_CAR_BANK_COUNT: the number of peripheral clock register
+ * banks present in the Tegra210 CAR IP block.  The banks are
+ * identified by single letters, e.g.: L, H, U, V, W, X, Y.  See
+ * periph_regs[] in drivers/clk/tegra/clk.c
+ */
+#define TEGRA210_CAR_BANK_COUNT			7
+
+#define CLK_SOURCE_CSITE 0x1d4
+#define CLK_SOURCE_EMC 0x19c
+
+#define PLLC_BASE 0x80
+#define PLLC_OUT 0x84
+#define PLLC_MISC0 0x88
+#define PLLC_MISC1 0x8c
+#define PLLC_MISC2 0x5d0
+#define PLLC_MISC3 0x5d4
+
+#define PLLC2_BASE 0x4e8
+#define PLLC2_MISC0 0x4ec
+#define PLLC2_MISC1 0x4f0
+#define PLLC2_MISC2 0x4f4
+#define PLLC2_MISC3 0x4f8
+
+#define PLLC3_BASE 0x4fc
+#define PLLC3_MISC0 0x500
+#define PLLC3_MISC1 0x504
+#define PLLC3_MISC2 0x508
+#define PLLC3_MISC3 0x50c
+
+#define PLLM_BASE 0x90
+#define PLLM_MISC0 0x9c
+#define PLLM_MISC1 0x98
+#define PLLP_BASE 0xa0
+#define PLLP_MISC0 0xac
+#define PLLP_MISC1 0x680
+#define PLLA_BASE 0xb0
+#define PLLA_MISC0 0xbc
+#define PLLA_MISC1 0xb8
+#define PLLA_MISC2 0x5d8
+#define PLLD_BASE 0xd0
+#define PLLD_MISC0 0xdc
+#define PLLD_MISC1 0xd8
+#define PLLU_BASE 0xc0
+#define PLLU_OUTA 0xc4
+#define PLLU_MISC0 0xcc
+#define PLLU_MISC1 0xc8
+#define PLLX_BASE 0xe0
+#define PLLX_MISC0 0xe4
+#define PLLX_MISC1 0x510
+#define PLLX_MISC2 0x514
+#define PLLX_MISC3 0x518
+#define PLLX_MISC4 0x5f0
+#define PLLX_MISC5 0x5f4
+#define PLLE_BASE 0xe8
+#define PLLE_MISC0 0xec
+#define PLLD2_BASE 0x4b8
+#define PLLD2_MISC0 0x4bc
+#define PLLD2_MISC1 0x570
+#define PLLD2_MISC2 0x574
+#define PLLD2_MISC3 0x578
+#define PLLE_AUX 0x48c
+#define PLLRE_BASE 0x4c4
+#define PLLRE_MISC0 0x4c8
+#define PLLDP_BASE 0x590
+#define PLLDP_MISC 0x594
+
+#define PLLC4_BASE 0x5a4
+#define PLLC4_MISC0 0x5a8
+#define PLLC4_OUT 0x5e4
+#define PLLMB_BASE 0x5e8
+#define PLLMB_MISC0 0x5ec
+#define PLLA1_BASE 0x6a4
+#define PLLA1_MISC0 0x6a8
+#define PLLA1_MISC1 0x6ac
+#define PLLA1_MISC2 0x6b0
+#define PLLA1_MISC3 0x6b4
+
+#define PLLU_IDDQ_BIT 31
+#define PLLCX_IDDQ_BIT 27
+#define PLLRE_IDDQ_BIT 24
+#define PLLA_IDDQ_BIT 25
+#define PLLD_IDDQ_BIT 20
+#define PLLSS_IDDQ_BIT 18
+#define PLLM_IDDQ_BIT 5
+#define PLLMB_IDDQ_BIT 17
+#define PLLXP_IDDQ_BIT 3
+
+#define PLLCX_RESET_BIT 30
+
+#define PLL_BASE_LOCK BIT(27)
+#define PLLCX_BASE_LOCK BIT(26)
+#define PLLE_MISC_LOCK BIT(11)
+#define PLLRE_MISC_LOCK BIT(27)
+
+#define PLL_MISC_LOCK_ENABLE 18
+#define PLLC_MISC_LOCK_ENABLE 24
+#define PLLDU_MISC_LOCK_ENABLE 22
+#define PLLU_MISC_LOCK_ENABLE 29
+#define PLLE_MISC_LOCK_ENABLE 9
+#define PLLRE_MISC_LOCK_ENABLE 30
+#define PLLSS_MISC_LOCK_ENABLE 30
+#define PLLP_MISC_LOCK_ENABLE 18
+#define PLLM_MISC_LOCK_ENABLE 4
+#define PLLMB_MISC_LOCK_ENABLE 16
+#define PLLA_MISC_LOCK_ENABLE 28
+#define PLLU_MISC_LOCK_ENABLE 29
+#define PLLD_MISC_LOCK_ENABLE 18
+
+#define PLLA_SDM_DIN_MASK 0xffff
+#define PLLA_SDM_EN_MASK BIT(26)
+
+#define PLLD_SDM_EN_MASK BIT(16)
+
+#define PLLD2_SDM_EN_MASK BIT(31)
+#define PLLD2_SSC_EN_MASK BIT(30)
+
+#define PLLDP_SS_CFG	0x598

drivers/clk/tegra/clk-tegra210.c line 158

Quoted 10 lines
drivers/clk/tegra/clk-tegra210.c new file +10 -0
+#define PLLDP_SDM_EN_MASK BIT(31)
+#define PLLDP_SSC_EN_MASK BIT(30)
+#define PLLDP_SS_CTRL1	0x59c
+#define PLLDP_SS_CTRL2	0x5a0
+
+#define PMC_PLLM_WB0_OVERRIDE 0x1dc
+#define PMC_PLLM_WB0_OVERRIDE_2 0x2b0
+
+#define UTMIP_PLL_CFG2 0x488
+#define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xffff) << 6)

This line should be corrected as

Quoted 3 lines

+#define UTMIP_PLL_CFG2_STABLE_COUNT(x) (((x) & 0xfff) << 6)

STABLE_COUNT has 12 bits.

Indeed, good catch!

Quoted 10 lines

drivers/clk/tegra/clk-tegra210.c line 165

Quoted 8 lines
drivers/clk/tegra/clk-tegra210.c new file +7 -0
+#define UTMIP_PLL_CFG2_ACTIVE_DLY_COUNT(x) (((x) & 0x3f) << 18)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_A_POWERDOWN BIT(0)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_B_POWERDOWN BIT(2)
+#define UTMIP_PLL_CFG2_FORCE_PD_SAMP_C_POWERDOWN BIT(4)
+
+#define UTMIP_PLL_CFG1 0x484
+#define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 6)

This line should be corrected as

Quoted 5 lines

+#define UTMIP_PLL_CFG1_ENABLE_DLY_COUNT(x) (((x) & 0x1f) << 27)

ENABLE_DLY_COUNT starts from bit 27.

Yep. Thanks Jim!

-rhyland

Quoted 3 lines

--nvpublic

Signature · 1 line
nvpublic
#53 lore raw

Re: [PATCH v4 19/20] clk: tegra210: add support for Tegra210 clocks

In reply to Rhyland Klein

On Mon, May 04, 2015 at 12:37:39PM -0400, Rhyland Klein wrote:
[...]

Quoted 1 line
drivers/clk/tegra/clk-tegra210.c +0 -0

[...]

Quoted 2 lines
drivers/clk/tegra/clk-tegra210.c +2 -0
+static void __init tegra210_clock_init(struct device_node *np)
+{

[...]

drivers/clk/tegra/clk-tegra210.c line 2744

Quoted 5 lines
drivers/clk/tegra/clk-tegra210.c +5 -0
+	tegra_fixed_clk_init(tegra210_clks);
+	tegra210_pll_init(clk_base, pmc_base);
+	tegra210_periph_clk_init(clk_base, pmc_base);
+	tegra_audio_clk_init(clk_base, pmc_base, tegra210_clks,
+			     tegra210_audio_plls, 2);

Should use ARRAY_SIZE() here as well.

Thierry

#54 lore raw

PATCH v4 20/20 clk: tegra: pll: Fix issues with rates for VCO PLLs

In reply to Rhyland Klein

From: Andrew Bresticker <[email protected]>

Without this change clk_get_rate would return the final output rather than the VCO output as it would factor in the pdiv when it shouldn't. This will cause problems for all dividers in the subtree of the VCO PLL.

---
v3:
- Added fix for this bug which was found during testing

 drivers/clk/tegra/clk-pll.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/clk/tegra/clk-pll.c +12 -4
index a8d5399bff1b..8464992852b4 100644
@@ -723,6 +723,8 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate,
 		spin_lock_irqsave(pll->lock, flags);
 
 	_get_pll_mnp(pll, &old_cfg);
+	if (pll->params->vco_out)
+		cfg.p = old_cfg.p;
 
 	if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p ||
 		old_cfg.sdm_data != cfg.sdm_data)
@@ -782,11 +784,15 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,
 
 	_get_pll_mnp(pll, &cfg);
 
-	pdiv = _hw_to_p_div(hw, cfg.p);
-	if (pdiv < 0) {
-		WARN(1, "Clock %s has invalid pdiv value : 0x%x\n",
-			__clk_get_name(hw->clk), cfg.p);
+	if (pll->params->vco_out) {
 		pdiv = 1;
+	} else {
+		pdiv = _hw_to_p_div(hw, cfg.p);
+		if (pdiv < 0) {
+			WARN(1, "Clock %s has invalid pdiv value : 0x%x\n",
+				__clk_get_name(hw->clk), cfg.p);
+			pdiv = 1;
+		}
 	}
 
 	if (pll->params->set_gain)
@@ -1073,6 +1079,8 @@ static int clk_pllxc_set_rate(struct clk_hw *hw, unsigned long rate,
 		spin_lock_irqsave(pll->lock, flags);
 
 	_get_pll_mnp(pll, &old_cfg);
+	if (pll->params->vco_out)
+		cfg.p = old_cfg.p;
 
 	if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p)
 		ret = _program_pll(hw, &cfg, rate);
Signature · 1 line
1.7.9.5
#55 lore raw
In reply to Rhyland Klein
Quoted 6 lines · Rhyland Klein

This patch series updates the tegra common clock driver and adds support for the Tegra210 clocks. The clocks in Tegra210 changed significantly in some ways from earlier generations, so to support them, we need to extend our base framework a bit and add some new features.

Quoted 6 lines

Some patches here also address issues found while adding features and other cleanup type work.

v4:
- Fixed minor checkpatch errors and other typos
- Rebased ontop of linux-next 20150504

Are you sure about this? It still doesn't apply cleanly to next-20150504 for me.

Thierry

Quoted 55 lines

v3:
- Added a fix from Andrew Bresticker that was found while testing this code.

Andrew Bresticker (1):
clk: tegra: pll: Fix issues with rates for VCO PLLs

Bill Huang (7):
clk: tegra: pll-params: change misc_reg count from 3 -> 6
clk: tegra: pll: Add logic for SS
clk: tegra: pll: Add code to handle if resets are supported by PLL
clk: tegra: pll: Adjust vco_min if SDM present
clk: tegra: pll: Add dyn_ramp callback
clk: tegra: pll: Add Set_default logic
clk: tegra: Add Super Gen5 Logic

Rhyland Klein (12):
clk: tegra: Modify tegra_audio_clk_init to accept more plls
clk: tegra: periph: add new periph clks and muxes for Tegra210
clk: tegra: pll: add tegra_pll_wait_for_lock to clk header
clk: tegra: pll: simplify clk_enable_path
clk: tegra: pll: update warning msg
clk: tegra: pll: Don't unconditionally set LOCK flags
clk: tegra: pll: Add logic for handling SDM data
clk: tegra: pll: Add logic for out-of-table rates for T210
clk: tegra: pll: Add specialized logic for T210
clk: tegra: pll: Add support for PLLMB for T210
clk: tegra: pll: Fix _pll_ramp_calc_pll logic and
_calc_dynamic_ramp_rate
clk: tegra210: add support for Tegra210 clocks

 .../bindings/clock/nvidia,tegra210-car.txt         |   56 +
 drivers/clk/tegra/Makefile                         |    2 +
 drivers/clk/tegra/clk-id.h                         |   64 +-
 drivers/clk/tegra/clk-pll.c                        |  697 ++++-
 drivers/clk/tegra/clk-tegra-audio.c                |   25 +-
 drivers/clk/tegra/clk-tegra-periph.c               |  257 +-
 drivers/clk/tegra/clk-tegra-super-gen5.c           |  150 ++
 drivers/clk/tegra/clk-tegra114.c                   |   30 +-
 drivers/clk/tegra/clk-tegra124.c                   |   31 +-
 drivers/clk/tegra/clk-tegra20.c                    |   18 +-
 drivers/clk/tegra/clk-tegra210.c                   | 2761 ++++++++++++++++++++
 drivers/clk/tegra/clk-tegra30.c                    |   31 +-
 drivers/clk/tegra/clk.h                            |   90 +-
 include/dt-bindings/clock/tegra210-car.h           |  401 +++
 14 files changed, 4468 insertions(+), 145 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt
 create mode 100644 drivers/clk/tegra/clk-tegra-super-gen5.c
 create mode 100644 drivers/clk/tegra/clk-tegra210.c
 create mode 100644 include/dt-bindings/clock/tegra210-car.h
Signature · 1 line
1.7.9.5
#56 lore raw
Quoted 12 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 9 lines · Rhyland Klein

This patch series updates the tegra common clock driver and adds support for the Tegra210 clocks. The clocks in Tegra210 changed significantly in some ways from earlier generations, so to support them, we need to extend our base framework a bit and add some new features.

Some patches here also address issues found while adding features and other cleanup type work.

Quoted 6 lines
Quoted 3 lines

v4:
- Fixed minor checkpatch errors and other typos
- Rebased ontop of linux-next 20150504

Are you sure about this? It still doesn't apply cleanly to next-20150504 for me.

It is based off c9256b89d92154cffd36697b412d0a0176a8e2d2 "Add linux-next specific files for 20150504"

What types of problems are you running into?

-rhyland

Quoted 62 lines

Thierry

Quoted 43 lines

v3:
- Added a fix from Andrew Bresticker that was found while testing this code.

Andrew Bresticker (1):
clk: tegra: pll: Fix issues with rates for VCO PLLs

Bill Huang (7):
clk: tegra: pll-params: change misc_reg count from 3 -> 6
clk: tegra: pll: Add logic for SS
clk: tegra: pll: Add code to handle if resets are supported by PLL
clk: tegra: pll: Adjust vco_min if SDM present
clk: tegra: pll: Add dyn_ramp callback
clk: tegra: pll: Add Set_default logic
clk: tegra: Add Super Gen5 Logic

Rhyland Klein (12):
clk: tegra: Modify tegra_audio_clk_init to accept more plls
clk: tegra: periph: add new periph clks and muxes for Tegra210
clk: tegra: pll: add tegra_pll_wait_for_lock to clk header
clk: tegra: pll: simplify clk_enable_path
clk: tegra: pll: update warning msg
clk: tegra: pll: Don't unconditionally set LOCK flags
clk: tegra: pll: Add logic for handling SDM data
clk: tegra: pll: Add logic for out-of-table rates for T210
clk: tegra: pll: Add specialized logic for T210
clk: tegra: pll: Add support for PLLMB for T210
clk: tegra: pll: Fix _pll_ramp_calc_pll logic and
_calc_dynamic_ramp_rate
clk: tegra210: add support for Tegra210 clocks

 .../bindings/clock/nvidia,tegra210-car.txt         |   56 +
 drivers/clk/tegra/Makefile                         |    2 +
 drivers/clk/tegra/clk-id.h                         |   64 +-
 drivers/clk/tegra/clk-pll.c                        |  697 ++++-
 drivers/clk/tegra/clk-tegra-audio.c                |   25 +-
 drivers/clk/tegra/clk-tegra-periph.c               |  257 +-
 drivers/clk/tegra/clk-tegra-super-gen5.c           |  150 ++
 drivers/clk/tegra/clk-tegra114.c                   |   30 +-
 drivers/clk/tegra/clk-tegra124.c                   |   31 +-
 drivers/clk/tegra/clk-tegra20.c                    |   18 +-
 drivers/clk/tegra/clk-tegra210.c                   | 2761 ++++++++++++++++++++
Quoted 12 lines
 drivers/clk/tegra/clk-tegra30.c                    |   31 +-
 drivers/clk/tegra/clk.h                            |   90 +-
 include/dt-bindings/clock/tegra210-car.h           |  401 +++
 14 files changed, 4468 insertions(+), 145 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra210-car.txt
 create mode 100644 drivers/clk/tegra/clk-tegra-super-gen5.c
 create mode 100644 drivers/clk/tegra/clk-tegra210.c
 create mode 100644 include/dt-bindings/clock/tegra210-car.h
Signature · 1 line
1.7.9.5

* Unknown Key
* 0x7F3EB3A1

Signature · 1 line
nvpublic
#57 lore raw
Quoted 17 lines · Rhyland Klein
Quoted 16 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 12 lines · Rhyland Klein

This patch series updates the tegra common clock driver and adds support for the Tegra210 clocks. The clocks in Tegra210 changed significantly in some ways from earlier generations, so to support them, we need to extend our base framework a bit and add some new features.

Some patches here also address issues found while adding features and other cleanup type work.

v4:
- Fixed minor checkpatch errors and other typos
- Rebased ontop of linux-next 20150504

Quoted 7 lines
Quoted 2 lines

Are you sure about this? It still doesn't apply cleanly to next-20150504 for me.

It is based off c9256b89d92154cffd36697b412d0a0176a8e2d2 "Add linux-next specific files for 20150504"

What types of problems are you running into?

I get this when applying the first patch:

Applying: clk: tegra: Modify tegra_audio_clk_init to accept more plls
error: patch failed: drivers/clk/tegra/clk.h:258
error: drivers/clk/tegra/clk.h: patch does not apply
Patch failed at 0001 clk: tegra: Modify tegra_audio_clk_init to accept more plls The copy of the patch that failed is found in:
/home/thierry.reding/src/kernel/linux-work.git/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Comparing again and looking at your internal tree it seems that in addition to next-20150504 you also have this patch in your tree:

clk: tegra: Fix comments for structure definitions

After applying that I can apply the series without problems. I've picked that patch up and will carry it in the Tegra clock branch. Hopefully the Tegra210 clock patches will be ready in time for v4.2 so that I can take them into the same branch.

Thierry

#58 lore raw
Quoted 43 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 17 lines · Rhyland Klein
Quoted 16 lines · Thierry Reding
Quoted 1 line

Old Signed by an unknown key

Quoted 12 lines · Rhyland Klein

This patch series updates the tegra common clock driver and adds support for the Tegra210 clocks. The clocks in Tegra210 changed significantly in some ways from earlier generations, so to support them, we need to extend our base framework a bit and add some new features.

Some patches here also address issues found while adding features and other cleanup type work.

v4:
- Fixed minor checkpatch errors and other typos
- Rebased ontop of linux-next 20150504

Quoted 7 lines
Quoted 2 lines

Are you sure about this? It still doesn't apply cleanly to next-20150504 for me.

It is based off c9256b89d92154cffd36697b412d0a0176a8e2d2 "Add linux-next specific files for 20150504"

What types of problems are you running into?

I get this when applying the first patch:

Applying: clk: tegra: Modify tegra_audio_clk_init to accept more plls
error: patch failed: drivers/clk/tegra/clk.h:258
error: drivers/clk/tegra/clk.h: patch does not apply
Patch failed at 0001 clk: tegra: Modify tegra_audio_clk_init to accept more plls The copy of the patch that failed is found in:
/home/thierry.reding/src/kernel/linux-work.git/.git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Comparing again and looking at your internal tree it seems that in addition to next-20150504 you also have this patch in your tree:

Quoted 8 lines

clk: tegra: Fix comments for structure definitions

After applying that I can apply the series without problems. I've picked that patch up and will carry it in the Tegra clock branch. Hopefully the Tegra210 clock patches will be ready in time for v4.2 so that I can take them into the same branch.

Thierry

Ahh yes. I sent that patch a while back and Peter added his ack, but it isn't present in linux-next, and I had it in my tree. Sorry for the confusion.

-rhyland

Quoted 4 lines

* Unknown Key
* 0x7F3EB3A1

Signature · 1 line
nvpublic