linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update
@ 2020-03-09 19:42 Lubomir Rintel
  2020-03-09 19:42 ` [PATCH v2 01/17] clk: mmp2: Remove a unused prototype Lubomir Rintel
                   ` (16 more replies)
  0 siblings, 17 replies; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel

Hi,

please consider applying this patch series, that includes fixes and
enhancements for the MMP2/MMP3 clock driver that I hope to get into 5.7.
Compared to first submission, patches 11/17 to 17/17 were added.
Details in changelogs of individual patches.

It starts off with a handful of cleanups:

  [PATCH v2 01/17] clk: mmp2: Remove a unused prototype
  [PATCH v2 02/17] clk: mmp2: Constify some strings
  [PATCH v2 03/17] dt-bindings: clock: Convert marvell,mmp2-clock to

The next patch adds the logic for calculating the rate of clock signals
coming from the PLLs dynamically. Currently they are hardcoded to more
or less wrong values (how wrong it is depends on how did firmware set
things up), which causes bad timings when they are used (e.g. to generate
display clock).

  [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources

Then MMP2 is switched over to use it:

  [PATCH v2 05/17] clk: mmp2: Stop pretending PLL outputs are constant

Switching MMP3 requires some more work, because until now, the driver
didn't distinguish between the versions of the SoC:

  [PATCH v2 06/17] dt-bindings: clock: Add MMP3 compatible string
  [PATCH v2 07/17] clk: mmp2: Check for MMP3
  [PATCH v2 08/17] dt-bindings: marvell,mmp2: Add clock ids for MMP3 PLLs
  [PATCH v2 09/17] clk: mmp2: Add PLLs that are available on MMP3
  [PATCH v2 10/17] ARM: dts: mmp3: Use the MMP3 compatible string for

Patches that follow add just add more clocks paired with DT bindings:

  [PATCH v2 11/17] dt-bindings: marvell,mmp2: Add clock ids for the GPU
  [PATCH v2 12/17] clk: mmp2: add the GPU clocks
  [PATCH v2 13/17] dt-bindings: marvell,mmp2: Add clock ids for the
  [PATCH v2 14/17] clk: mmp2: Add clocks for the thermal sensors
  [PATCH v2 15/17] dt-bindings: marvell,mmp2: Add clock id for the fifth
  [PATCH v2 16/17] clk: mmp2: Add clock for fifth SD HCI on MMP3

The last one is a straightforward bug fix, independent of the rest of the
patch set:

  [PATCH v2 17/17] clk: mmp2: Fix bit masks for LCDC I/O and pixel clocks

The hardware vendor doesn't supply documentation, so this is best-effort
work based on the code dump from Marvell and OLPC Open Firmware.

Tested on MMP2 and MMP3 based hardware I have; details in relevant
commit messages.

Thank you,
Lubo



^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH v2 01/17] clk: mmp2: Remove a unused prototype
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 02/17] clk: mmp2: Constify some strings Lubomir Rintel
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

There is no mmp_clk_register_pll2() routine.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/clk/mmp/clk.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/clk/mmp/clk.h b/drivers/clk/mmp/clk.h
index 70bb73257647a..5bcbced3f458e 100644
--- a/drivers/clk/mmp/clk.h
+++ b/drivers/clk/mmp/clk.h
@@ -124,9 +124,6 @@ extern struct clk *mmp_clk_register_gate(struct device *dev, const char *name,
 			u32 val_disable, unsigned int gate_flags,
 			spinlock_t *lock);
 
-
-extern struct clk *mmp_clk_register_pll2(const char *name,
-		const char *parent_name, unsigned long flags);
 extern struct clk *mmp_clk_register_apbc(const char *name,
 		const char *parent_name, void __iomem *base,
 		unsigned int delay, unsigned int apbc_flags, spinlock_t *lock);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 02/17] clk: mmp2: Constify some strings
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
  2020-03-09 19:42 ` [PATCH v2 01/17] clk: mmp2: Remove a unused prototype Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 03/17] dt-bindings: clock: Convert marvell,mmp2-clock to json-schema Lubomir Rintel
                   ` (14 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

All the parent clock names for the muxes are constant. Add const.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/clk/mmp/clk-mix.c     |  2 +-
 drivers/clk/mmp/clk-of-mmp2.c | 13 +++++++------
 drivers/clk/mmp/clk.h         |  4 ++--
 3 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/clk/mmp/clk-mix.c b/drivers/clk/mmp/clk-mix.c
index d2cd36c54474f..7a351ec65564e 100644
--- a/drivers/clk/mmp/clk-mix.c
+++ b/drivers/clk/mmp/clk-mix.c
@@ -441,7 +441,7 @@ const struct clk_ops mmp_clk_mix_ops = {
 
 struct clk *mmp_clk_register_mix(struct device *dev,
 					const char *name,
-					const char **parent_names,
+					const char * const *parent_names,
 					u8 num_parents,
 					unsigned long flags,
 					struct mmp_clk_mix_config *config,
diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 6e71591e63a00..ee086d9714160 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -127,16 +127,16 @@ static void mmp2_pll_init(struct mmp2_clk_unit *pxa_unit)
 static DEFINE_SPINLOCK(uart0_lock);
 static DEFINE_SPINLOCK(uart1_lock);
 static DEFINE_SPINLOCK(uart2_lock);
-static const char *uart_parent_names[] = {"uart_pll", "vctcxo"};
+static const char * const uart_parent_names[] = {"uart_pll", "vctcxo"};
 
 static DEFINE_SPINLOCK(ssp0_lock);
 static DEFINE_SPINLOCK(ssp1_lock);
 static DEFINE_SPINLOCK(ssp2_lock);
 static DEFINE_SPINLOCK(ssp3_lock);
-static const char *ssp_parent_names[] = {"vctcxo_4", "vctcxo_2", "vctcxo", "pll1_16"};
+static const char * const ssp_parent_names[] = {"vctcxo_4", "vctcxo_2", "vctcxo", "pll1_16"};
 
 static DEFINE_SPINLOCK(timer_lock);
-static const char *timer_parent_names[] = {"clk32", "vctcxo_4", "vctcxo_2", "vctcxo"};
+static const char * const timer_parent_names[] = {"clk32", "vctcxo_4", "vctcxo_2", "vctcxo"};
 
 static DEFINE_SPINLOCK(reset_lock);
 
@@ -190,7 +190,7 @@ static void mmp2_apb_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
 }
 
 static DEFINE_SPINLOCK(sdh_lock);
-static const char *sdh_parent_names[] = {"pll1_4", "pll2", "usb_pll", "pll1"};
+static const char * const sdh_parent_names[] = {"pll1_4", "pll2", "usb_pll", "pll1"};
 static struct mmp_clk_mix_config sdh_mix_config = {
 	.reg_info = DEFINE_MIX_REG_INFO(4, 10, 2, 8, 32),
 };
@@ -201,11 +201,12 @@ static DEFINE_SPINLOCK(usbhsic1_lock);
 
 static DEFINE_SPINLOCK(disp0_lock);
 static DEFINE_SPINLOCK(disp1_lock);
-static const char *disp_parent_names[] = {"pll1", "pll1_16", "pll2", "vctcxo"};
+static const char * const disp_parent_names[] = {"pll1", "pll1_16", "pll2", "vctcxo"};
 
 static DEFINE_SPINLOCK(ccic0_lock);
 static DEFINE_SPINLOCK(ccic1_lock);
-static const char *ccic_parent_names[] = {"pll1_2", "pll1_16", "vctcxo"};
+static const char * const ccic_parent_names[] = {"pll1_2", "pll1_16", "vctcxo"};
+
 static struct mmp_clk_mix_config ccic0_mix_config = {
 	.reg_info = DEFINE_MIX_REG_INFO(4, 17, 2, 6, 32),
 };
diff --git a/drivers/clk/mmp/clk.h b/drivers/clk/mmp/clk.h
index 5bcbced3f458e..37d1e1d7b664c 100644
--- a/drivers/clk/mmp/clk.h
+++ b/drivers/clk/mmp/clk.h
@@ -97,7 +97,7 @@ struct mmp_clk_mix {
 extern const struct clk_ops mmp_clk_mix_ops;
 extern struct clk *mmp_clk_register_mix(struct device *dev,
 					const char *name,
-					const char **parent_names,
+					const char * const *parent_names,
 					u8 num_parents,
 					unsigned long flags,
 					struct mmp_clk_mix_config *config,
@@ -193,7 +193,7 @@ void mmp_register_gate_clks(struct mmp_clk_unit *unit,
 struct mmp_param_mux_clk {
 	unsigned int id;
 	char *name;
-	const char **parent_name;
+	const char * const *parent_name;
 	u8 num_parents;
 	unsigned long flags;
 	unsigned long offset;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 03/17] dt-bindings: clock: Convert marvell,mmp2-clock to json-schema
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
  2020-03-09 19:42 ` [PATCH v2 01/17] clk: mmp2: Remove a unused prototype Lubomir Rintel
  2020-03-09 19:42 ` [PATCH v2 02/17] clk: mmp2: Constify some strings Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources Lubomir Rintel
                   ` (13 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel,
	Rob Herring

Convert the fixed-factor-clock binding to DT schema format using
json-schema.

While at that, fix a couple of small errors: make the file base name
match the compatible string, add an example and document the reg-names
property.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Rob Herring <robh@kernel.org>

---
Changes since v1:
- Collected Rob's Reviewed-by tag

 .../bindings/clock/marvell,mmp2-clock.yaml    | 62 +++++++++++++++++++
 .../bindings/clock/marvell,mmp2.txt           | 21 -------
 2 files changed, 62 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/marvell,mmp2-clock.yaml
 delete mode 100644 Documentation/devicetree/bindings/clock/marvell,mmp2.txt

diff --git a/Documentation/devicetree/bindings/clock/marvell,mmp2-clock.yaml b/Documentation/devicetree/bindings/clock/marvell,mmp2-clock.yaml
new file mode 100644
index 0000000000000..c5fc2ad0236dd
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/marvell,mmp2-clock.yaml
@@ -0,0 +1,62 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/marvell,mmp2-clock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Marvell MMP2 Clock Controller
+
+maintainers:
+  - Lubomir Rintel <lkundrak@v3.sk>
+
+description: |
+  The MMP2 clock subsystem generates and supplies clock to various
+  controllers within the MMP2 SoC.
+
+  Each clock is assigned an identifier and client nodes use this identifier
+  to specify the clock which they consume.
+
+  All these identifiers could be found in <dt-bindings/clock/marvell,mmp2.h>.
+
+properties:
+  compatible:
+    const: marvell,mmp2-clock # controller compatible with MMP2 SoC
+
+  reg:
+    items:
+      - description: MPMU register region
+      - description: APMU register region
+      - description: APBC register region
+
+  reg-names:
+    items:
+      - const: mpmu
+      - const: apmu
+      - const: apbc
+
+  '#clock-cells':
+    const: 1
+
+  '#reset-cells':
+    const: 1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - '#clock-cells'
+  - '#reset-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    clock-controller@d4050000 {
+      compatible = "marvell,mmp2-clock";
+      reg = <0xd4050000 0x1000>,
+            <0xd4282800 0x400>,
+            <0xd4015000 0x1000>;
+      reg-names = "mpmu", "apmu", "apbc";
+      #clock-cells = <1>;
+      #reset-cells = <1>;
+    };
diff --git a/Documentation/devicetree/bindings/clock/marvell,mmp2.txt b/Documentation/devicetree/bindings/clock/marvell,mmp2.txt
deleted file mode 100644
index 23b52dc02266a..0000000000000
--- a/Documentation/devicetree/bindings/clock/marvell,mmp2.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-* Marvell MMP2 Clock Controller
-
-The MMP2 clock subsystem generates and supplies clock to various
-controllers within the MMP2 SoC.
-
-Required Properties:
-
-- compatible: should be one of the following.
-  - "marvell,mmp2-clock" - controller compatible with MMP2 SoC.
-
-- reg: physical base address of the clock subsystem and length of memory mapped
-  region. There are 3 places in SOC has clock control logic:
-  "mpmu", "apmu", "apbc". So three reg spaces need to be defined.
-
-- #clock-cells: should be 1.
-- #reset-cells: should be 1.
-
-Each clock is assigned an identifier and client nodes use this identifier
-to specify the clock which they consume.
-
-All these identifiers could be found in <dt-bindings/clock/marvell,mmp2.h>.
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (2 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 03/17] dt-bindings: clock: Convert marvell,mmp2-clock to json-schema Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
  2020-04-06 19:30   ` Guenter Roeck
  2020-03-09 19:42 ` [PATCH v2 05/17] clk: mmp2: Stop pretending PLL outputs are constant Lubomir Rintel
                   ` (12 subsequent siblings)
  16 siblings, 2 replies; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

The clk-of-mmp2 driver pretends that the clock outputs from the PLLs are
constant, but in fact they are configurable.

Add logic for obtaining the actual clock rates on MMP2 as well as MMP3.
There is no documentation for either SoC, but the "systemsetting" drivers
from Marvell GPL code dump provide some clue as far as MPMU registers on
MMP2 [1] and MMP3 [2] go.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/char/mmp2_systemsetting.c
[2] https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/char/mmp3_systemsetting.c

A separate commit will adjust the clk-of-mmp2 driver.

Tested on a MMP3-based Dell Wyse 3020 as well as MMP2-based OLPC
XO-1.75 laptop.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/clk/mmp/Makefile  |   2 +-
 drivers/clk/mmp/clk-pll.c | 139 ++++++++++++++++++++++++++++++++++++++
 drivers/clk/mmp/clk.c     |  31 +++++++++
 drivers/clk/mmp/clk.h     |  24 +++++++
 4 files changed, 195 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/mmp/clk-pll.c

diff --git a/drivers/clk/mmp/Makefile b/drivers/clk/mmp/Makefile
index acc141adf087c..14dc8a8a9d087 100644
--- a/drivers/clk/mmp/Makefile
+++ b/drivers/clk/mmp/Makefile
@@ -8,7 +8,7 @@ obj-y += clk-apbc.o clk-apmu.o clk-frac.o clk-mix.o clk-gate.o clk.o
 obj-$(CONFIG_RESET_CONTROLLER) += reset.o
 
 obj-$(CONFIG_MACH_MMP_DT) += clk-of-pxa168.o clk-of-pxa910.o
-obj-$(CONFIG_COMMON_CLK_MMP2) += clk-of-mmp2.o
+obj-$(CONFIG_COMMON_CLK_MMP2) += clk-of-mmp2.o clk-pll.o
 
 obj-$(CONFIG_CPU_PXA168) += clk-pxa168.o
 obj-$(CONFIG_CPU_PXA910) += clk-pxa910.o
diff --git a/drivers/clk/mmp/clk-pll.c b/drivers/clk/mmp/clk-pll.c
new file mode 100644
index 0000000000000..7077be2938711
--- /dev/null
+++ b/drivers/clk/mmp/clk-pll.c
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * MMP PLL clock rate calculation
+ *
+ * Copyright (C) 2020 Lubomir Rintel <lkundrak@v3.sk>
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/slab.h>
+#include <linux/io.h>
+
+#include "clk.h"
+
+#define to_clk_mmp_pll(hw)	container_of(hw, struct mmp_clk_pll, hw)
+
+struct mmp_clk_pll {
+	struct clk_hw hw;
+	unsigned long default_rate;
+	void __iomem *enable_reg;
+	u32 enable;
+	void __iomem *reg;
+	u8 shift;
+
+	unsigned long input_rate;
+	void __iomem *postdiv_reg;
+	u8 postdiv_shift;
+};
+
+static int mmp_clk_pll_is_enabled(struct clk_hw *hw)
+{
+	struct mmp_clk_pll *pll = to_clk_mmp_pll(hw);
+	u32 val;
+
+	val = readl_relaxed(pll->enable_reg);
+	if ((val & pll->enable) == pll->enable)
+		return 1;
+
+	/* Some PLLs, if not software controlled, output default clock. */
+	if (pll->default_rate > 0)
+		return 1;
+
+	return 0;
+}
+
+static unsigned long mmp_clk_pll_recalc_rate(struct clk_hw *hw,
+					unsigned long parent_rate)
+{
+	struct mmp_clk_pll *pll = to_clk_mmp_pll(hw);
+	u32 fbdiv, refdiv, postdiv;
+	u64 rate;
+	u32 val;
+
+	val = readl_relaxed(pll->enable_reg);
+	if ((val & pll->enable) != pll->enable)
+		return pll->default_rate;
+
+	if (pll->reg) {
+		val = readl_relaxed(pll->reg);
+		fbdiv = (val >> pll->shift) & 0x1ff;
+		refdiv = (val >> (pll->shift + 9)) & 0x1f;
+	} else {
+		fbdiv = 2;
+		refdiv = 1;
+	}
+
+	if (pll->postdiv_reg) {
+		/* MMP3 clock rate calculation */
+		static const u8 postdivs[] = {2, 3, 4, 5, 6, 8, 10, 12, 16};
+
+		val = readl_relaxed(pll->postdiv_reg);
+		postdiv = (val >> pll->postdiv_shift) & 0x7;
+
+		rate = pll->input_rate;
+		rate *= 2 * fbdiv;
+		do_div(rate, refdiv);
+		do_div(rate, postdivs[postdiv]);
+	} else {
+		/* MMP2 clock rate calculation */
+		if (refdiv == 3) {
+			rate = 19200000;
+		} else if (refdiv == 4) {
+			rate = 26000000;
+		} else {
+			pr_err("bad refdiv: %d (0x%08x)\n", refdiv, val);
+			return 0;
+		}
+
+		rate *= fbdiv + 2;
+		do_div(rate, refdiv + 2);
+	}
+
+	return (unsigned long)rate;
+}
+
+static const struct clk_ops mmp_clk_pll_ops = {
+	.is_enabled = mmp_clk_pll_is_enabled,
+	.recalc_rate = mmp_clk_pll_recalc_rate,
+};
+
+struct clk *mmp_clk_register_pll(char *name,
+			unsigned long default_rate,
+			void __iomem *enable_reg, u32 enable,
+			void __iomem *reg, u8 shift,
+			unsigned long input_rate,
+			void __iomem *postdiv_reg, u8 postdiv_shift)
+{
+	struct mmp_clk_pll *pll;
+	struct clk *clk;
+	struct clk_init_data init;
+
+	pll = kzalloc(sizeof(*pll), GFP_KERNEL);
+	if (!pll)
+		return ERR_PTR(-ENOMEM);
+
+	init.name = name;
+	init.ops = &mmp_clk_pll_ops;
+	init.flags = 0;
+	init.parent_names = NULL;
+	init.num_parents = 0;
+
+	pll->default_rate = default_rate;
+	pll->enable_reg = enable_reg;
+	pll->enable = enable;
+	pll->reg = reg;
+	pll->shift = shift;
+
+	pll->input_rate = input_rate;
+	pll->postdiv_reg = postdiv_reg;
+	pll->postdiv_shift = postdiv_shift;
+
+	pll->hw.init = &init;
+
+	clk = clk_register(NULL, &pll->hw);
+
+	if (IS_ERR(clk))
+		kfree(pll);
+
+	return clk;
+}
diff --git a/drivers/clk/mmp/clk.c b/drivers/clk/mmp/clk.c
index ca7d37e2c7be6..317123641d1ed 100644
--- a/drivers/clk/mmp/clk.c
+++ b/drivers/clk/mmp/clk.c
@@ -176,6 +176,37 @@ void mmp_register_div_clks(struct mmp_clk_unit *unit,
 	}
 }
 
+void mmp_register_pll_clks(struct mmp_clk_unit *unit,
+			struct mmp_param_pll_clk *clks,
+			void __iomem *base, int size)
+{
+	struct clk *clk;
+	int i;
+
+	for (i = 0; i < size; i++) {
+		void __iomem *reg = NULL;
+
+		if (clks[i].offset)
+			reg = base + clks[i].offset;
+
+		clk = mmp_clk_register_pll(clks[i].name,
+					clks[i].default_rate,
+					base + clks[i].enable_offset,
+					clks[i].enable,
+					reg, clks[i].shift,
+					clks[i].input_rate,
+					base + clks[i].postdiv_offset,
+					clks[i].postdiv_shift);
+		if (IS_ERR(clk)) {
+			pr_err("%s: failed to register clock %s\n",
+			       __func__, clks[i].name);
+			continue;
+		}
+		if (clks[i].id)
+			unit->clk_table[clks[i].id] = clk;
+	}
+}
+
 void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id,
 			struct clk *clk)
 {
diff --git a/drivers/clk/mmp/clk.h b/drivers/clk/mmp/clk.h
index 37d1e1d7b664c..971b4d6d992fb 100644
--- a/drivers/clk/mmp/clk.h
+++ b/drivers/clk/mmp/clk.h
@@ -221,6 +221,30 @@ void mmp_register_div_clks(struct mmp_clk_unit *unit,
 			struct mmp_param_div_clk *clks,
 			void __iomem *base, int size);
 
+struct mmp_param_pll_clk {
+	unsigned int id;
+	char *name;
+	unsigned long default_rate;
+	unsigned long enable_offset;
+	u32 enable;
+	unsigned long offset;
+	u8 shift;
+	/* MMP3 specific: */
+	unsigned long input_rate;
+	unsigned long postdiv_offset;
+	unsigned long postdiv_shift;
+};
+void mmp_register_pll_clks(struct mmp_clk_unit *unit,
+			struct mmp_param_pll_clk *clks,
+			void __iomem *base, int size);
+
+extern struct clk *mmp_clk_register_pll(char *name,
+			unsigned long default_rate,
+			void __iomem *enable_reg, u32 enable,
+			void __iomem *reg, u8 shift,
+			unsigned long input_rate,
+			void __iomem *postdiv_reg, u8 postdiv_shift);
+
 #define DEFINE_MIX_REG_INFO(w_d, s_d, w_m, s_m, fc)	\
 {							\
 	.width_div = (w_d),				\
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 05/17] clk: mmp2: Stop pretending PLL outputs are constant
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (3 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 06/17] dt-bindings: clock: Add MMP3 compatible string Lubomir Rintel
                   ` (11 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

The hardcoded values for PLL1 and PLL2 are wrong. PLL1 is slightly
off -- it defaults to 797.33 MHz, not 800 MHz. PLL2 is disabled by default,
but also configurable.

Tested on a MMP2-based OLPC XO-1.75 laptop, with PLL1=797.33 and various
values of PLL2 set via set-pll2-520mhz, set-pll2-910mhz and
set-pll2-988mhz Open Firmware words.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/clk/mmp/clk-of-mmp2.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index ee086d9714160..251d8d0e78abb 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2012 Marvell
  * Chao Xie <xiechao.mail@gmail.com>
+ * Copyright (C) 2020 Lubomir Rintel <lkundrak@v3.sk>
  *
  * This file is licensed under the terms of the GNU General Public
  * License version 2. This program is licensed "as is" without any
@@ -55,7 +56,11 @@
 #define APMU_CCIC1	0xf4
 #define APMU_USBHSIC0	0xf8
 #define APMU_USBHSIC1	0xfc
+
+#define MPMU_FCCR	0x8
+#define MPMU_POSR	0x10
 #define MPMU_UART_PLL	0x14
+#define MPMU_PLL2_CR	0x34
 
 struct mmp2_clk_unit {
 	struct mmp_clk_unit unit;
@@ -67,11 +72,14 @@ struct mmp2_clk_unit {
 static struct mmp_param_fixed_rate_clk fixed_rate_clks[] = {
 	{MMP2_CLK_CLK32, "clk32", NULL, 0, 32768},
 	{MMP2_CLK_VCTCXO, "vctcxo", NULL, 0, 26000000},
-	{MMP2_CLK_PLL1, "pll1", NULL, 0, 800000000},
-	{MMP2_CLK_PLL2, "pll2", NULL, 0, 960000000},
 	{MMP2_CLK_USB_PLL, "usb_pll", NULL, 0, 480000000},
 };
 
+static struct mmp_param_pll_clk pll_clks[] = {
+	{MMP2_CLK_PLL1,   "pll1",   797330000, MPMU_FCCR,          0x4000, MPMU_POSR,     0},
+	{MMP2_CLK_PLL2,   "pll2",           0, MPMU_PLL2_CR,       0x0300, MPMU_PLL2_CR, 10},
+};
+
 static struct mmp_param_fixed_factor_clk fixed_factor_clks[] = {
 	{MMP2_CLK_PLL1_2, "pll1_2", "pll1", 1, 2, 0},
 	{MMP2_CLK_PLL1_4, "pll1_4", "pll1_2", 1, 2, 0},
@@ -113,6 +121,10 @@ static void mmp2_pll_init(struct mmp2_clk_unit *pxa_unit)
 	mmp_register_fixed_rate_clks(unit, fixed_rate_clks,
 					ARRAY_SIZE(fixed_rate_clks));
 
+	mmp_register_pll_clks(unit, pll_clks,
+				pxa_unit->mpmu_base,
+				ARRAY_SIZE(pll_clks));
+
 	mmp_register_fixed_factor_clks(unit, fixed_factor_clks,
 					ARRAY_SIZE(fixed_factor_clks));
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 06/17] dt-bindings: clock: Add MMP3 compatible string
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (4 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 05/17] clk: mmp2: Stop pretending PLL outputs are constant Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 07/17] clk: mmp2: Check for MMP3 Lubomir Rintel
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel,
	Rob Herring

This binding describes the PMUs that are found on MMP3 as well. Add the
compatible strings and adjust the description.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Reviewed-by: Rob Herring <robh@kernel.org>

---
Changes since v1:
- Collected Rob's Reviewed-by tag

 .../devicetree/bindings/clock/marvell,mmp2-clock.yaml  | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/marvell,mmp2-clock.yaml b/Documentation/devicetree/bindings/clock/marvell,mmp2-clock.yaml
index c5fc2ad0236dd..e2b6ac96bbcb0 100644
--- a/Documentation/devicetree/bindings/clock/marvell,mmp2-clock.yaml
+++ b/Documentation/devicetree/bindings/clock/marvell,mmp2-clock.yaml
@@ -4,14 +4,14 @@
 $id: http://devicetree.org/schemas/clock/marvell,mmp2-clock.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Marvell MMP2 Clock Controller
+title: Marvell MMP2 and MMP3 Clock Controller
 
 maintainers:
   - Lubomir Rintel <lkundrak@v3.sk>
 
 description: |
-  The MMP2 clock subsystem generates and supplies clock to various
-  controllers within the MMP2 SoC.
+  The clock subsystem on MMP2 or MMP3 generates and supplies clock to various
+  controllers within the SoC.
 
   Each clock is assigned an identifier and client nodes use this identifier
   to specify the clock which they consume.
@@ -20,7 +20,9 @@ description: |
 
 properties:
   compatible:
-    const: marvell,mmp2-clock # controller compatible with MMP2 SoC
+    enum:
+      - marvell,mmp2-clock # controller compatible with MMP2 SoC
+      - marvell,mmp3-clock # controller compatible with MMP3 SoC
 
   reg:
     items:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 07/17] clk: mmp2: Check for MMP3
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (5 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 06/17] dt-bindings: clock: Add MMP3 compatible string Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 08/17] dt-bindings: marvell,mmp2: Add clock ids for MMP3 PLLs Lubomir Rintel
                   ` (9 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

The MMP3's are similar enough to MMP2, but there are differencies, such
are more clocks available on the newer model. We want to tell which
platform are we on.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/clk/mmp/clk-of-mmp2.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 251d8d0e78abb..7594a8280b93a 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -62,8 +62,14 @@
 #define MPMU_UART_PLL	0x14
 #define MPMU_PLL2_CR	0x34
 
+enum mmp2_clk_model {
+	CLK_MODEL_MMP2,
+	CLK_MODEL_MMP3,
+};
+
 struct mmp2_clk_unit {
 	struct mmp_clk_unit unit;
+	enum mmp2_clk_model model;
 	void __iomem *mpmu_base;
 	void __iomem *apmu_base;
 	void __iomem *apbc_base;
@@ -326,6 +332,11 @@ static void __init mmp2_clk_init(struct device_node *np)
 	if (!pxa_unit)
 		return;
 
+	if (of_device_is_compatible(np, "marvell,mmp3-clock"))
+		pxa_unit->model = CLK_MODEL_MMP3;
+	else
+		pxa_unit->model = CLK_MODEL_MMP2;
+
 	pxa_unit->mpmu_base = of_iomap(np, 0);
 	if (!pxa_unit->mpmu_base) {
 		pr_err("failed to map mpmu registers\n");
@@ -365,3 +376,4 @@ static void __init mmp2_clk_init(struct device_node *np)
 }
 
 CLK_OF_DECLARE(mmp2_clk, "marvell,mmp2-clock", mmp2_clk_init);
+CLK_OF_DECLARE(mmp3_clk, "marvell,mmp3-clock", mmp2_clk_init);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 08/17] dt-bindings: marvell,mmp2: Add clock ids for MMP3 PLLs
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (6 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 07/17] clk: mmp2: Check for MMP3 Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 09/17] clk: mmp2: Add PLLs that are available on MMP3 Lubomir Rintel
                   ` (8 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel,
	Rob Herring

MMP3 variant provides some more clocks. Add respective IDs.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Acked-by: Rob Herring <robh@kernel.org>

---
Changes since v1:
- Collected Rob's ack

 include/dt-bindings/clock/marvell,mmp2.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/dt-bindings/clock/marvell,mmp2.h b/include/dt-bindings/clock/marvell,mmp2.h
index 4b1a7724f20d7..22006392b411b 100644
--- a/include/dt-bindings/clock/marvell,mmp2.h
+++ b/include/dt-bindings/clock/marvell,mmp2.h
@@ -26,6 +26,9 @@
 #define MMP2_CLK_VCTCXO_4		25
 #define MMP2_CLK_UART_PLL		26
 #define MMP2_CLK_USB_PLL		27
+#define MMP3_CLK_PLL1_P			28
+#define MMP3_CLK_PLL2_P			29
+#define MMP3_CLK_PLL3			30
 
 /* apb periphrals */
 #define MMP2_CLK_TWSI0			60
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 09/17] clk: mmp2: Add PLLs that are available on MMP3
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (7 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 08/17] dt-bindings: marvell,mmp2: Add clock ids for MMP3 PLLs Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:25   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 10/17] ARM: dts: mmp3: Use the MMP3 compatible string for /clocks Lubomir Rintel
                   ` (7 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

There are more PLLs on MMP3 and are configured slightly differently.
Tested on a MMP3-based Dell Wyse 3020 machine.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/clk/mmp/clk-of-mmp2.c | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 7594a8280b93a..310d77855f03f 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -57,10 +57,16 @@
 #define APMU_USBHSIC0	0xf8
 #define APMU_USBHSIC1	0xfc
 
-#define MPMU_FCCR	0x8
-#define MPMU_POSR	0x10
-#define MPMU_UART_PLL	0x14
-#define MPMU_PLL2_CR	0x34
+#define MPMU_FCCR		0x8
+#define MPMU_POSR		0x10
+#define MPMU_UART_PLL		0x14
+#define MPMU_PLL2_CR		0x34
+/* MMP3 specific below */
+#define MPMU_PLL3_CR		0x50
+#define MPMU_PLL3_CTRL1		0x58
+#define MPMU_PLL1_CTRL		0x5c
+#define MPMU_PLL_DIFF_CTRL	0x68
+#define MPMU_PLL2_CTRL1		0x414
 
 enum mmp2_clk_model {
 	CLK_MODEL_MMP2,
@@ -86,6 +92,14 @@ static struct mmp_param_pll_clk pll_clks[] = {
 	{MMP2_CLK_PLL2,   "pll2",           0, MPMU_PLL2_CR,       0x0300, MPMU_PLL2_CR, 10},
 };
 
+static struct mmp_param_pll_clk mmp3_pll_clks[] = {
+	{MMP2_CLK_PLL2,   "pll1",   797330000, MPMU_FCCR,          0x4000, MPMU_POSR,     0,      26000000, MPMU_PLL1_CTRL,      25},
+	{MMP2_CLK_PLL2,   "pll2",           0, MPMU_PLL2_CR,       0x0300, MPMU_PLL2_CR, 10,      26000000, MPMU_PLL2_CTRL1,     25},
+	{MMP3_CLK_PLL1_P, "pll1_p",         0, MPMU_PLL_DIFF_CTRL, 0x0010, 0,             0,     797330000, MPMU_PLL_DIFF_CTRL,   0},
+	{MMP3_CLK_PLL2_P, "pll2_p",         0, MPMU_PLL_DIFF_CTRL, 0x0100, MPMU_PLL2_CR, 10,      26000000, MPMU_PLL_DIFF_CTRL,   5},
+	{MMP3_CLK_PLL3,   "pll3",           0, MPMU_PLL3_CR,       0x0300, MPMU_PLL3_CR, 10,      26000000, MPMU_PLL3_CTRL1,     25},
+};
+
 static struct mmp_param_fixed_factor_clk fixed_factor_clks[] = {
 	{MMP2_CLK_PLL1_2, "pll1_2", "pll1", 1, 2, 0},
 	{MMP2_CLK_PLL1_4, "pll1_4", "pll1_2", 1, 2, 0},
@@ -127,9 +141,15 @@ static void mmp2_pll_init(struct mmp2_clk_unit *pxa_unit)
 	mmp_register_fixed_rate_clks(unit, fixed_rate_clks,
 					ARRAY_SIZE(fixed_rate_clks));
 
-	mmp_register_pll_clks(unit, pll_clks,
-				pxa_unit->mpmu_base,
-				ARRAY_SIZE(pll_clks));
+	if (pxa_unit->model == CLK_MODEL_MMP3) {
+		mmp_register_pll_clks(unit, mmp3_pll_clks,
+					pxa_unit->mpmu_base,
+					ARRAY_SIZE(mmp3_pll_clks));
+	} else {
+		mmp_register_pll_clks(unit, pll_clks,
+					pxa_unit->mpmu_base,
+					ARRAY_SIZE(pll_clks));
+	}
 
 	mmp_register_fixed_factor_clks(unit, fixed_factor_clks,
 					ARRAY_SIZE(fixed_factor_clks));
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 10/17] ARM: dts: mmp3: Use the MMP3 compatible string for /clocks
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (8 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 09/17] clk: mmp2: Add PLLs that are available on MMP3 Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:20   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 11/17] dt-bindings: marvell,mmp2: Add clock ids for the GPU clocks Lubomir Rintel
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Clocks are in fact slightly different on MMP3. In particular, PLL2 is
fixed to a different frequency, there's an extra PLL3, and the GPU
clocks are configured differently.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 arch/arm/boot/dts/mmp3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/mmp3.dtsi b/arch/arm/boot/dts/mmp3.dtsi
index 59a108e49b41e..3e28f0dc9df41 100644
--- a/arch/arm/boot/dts/mmp3.dtsi
+++ b/arch/arm/boot/dts/mmp3.dtsi
@@ -531,7 +531,7 @@ l2: l2-cache-controller@d0020000 {
 		};
 
 		soc_clocks: clocks@d4050000 {
-			compatible = "marvell,mmp2-clock";
+			compatible = "marvell,mmp3-clock";
 			reg = <0xd4050000 0x1000>,
 			      <0xd4282800 0x400>,
 			      <0xd4015000 0x1000>;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 11/17] dt-bindings: marvell,mmp2: Add clock ids for the GPU clocks
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (9 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 10/17] ARM: dts: mmp3: Use the MMP3 compatible string for /clocks Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:25   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 12/17] clk: mmp2: add " Lubomir Rintel
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

MMP2 has a single GC860 core while MMP3 has a GC2000 and a GC300.
On both platforms there's an AXI bus interface clock that's common for
all GPUs and each GPU core has a separate clock.

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

---
Changes since v1:
- Added this patch

 include/dt-bindings/clock/marvell,mmp2.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/dt-bindings/clock/marvell,mmp2.h b/include/dt-bindings/clock/marvell,mmp2.h
index 22006392b411b..dd5067bd92f22 100644
--- a/include/dt-bindings/clock/marvell,mmp2.h
+++ b/include/dt-bindings/clock/marvell,mmp2.h
@@ -77,6 +77,11 @@
 #define MMP2_CLK_DISP0_LCDC		120
 #define MMP2_CLK_USBHSIC0		121
 #define MMP2_CLK_USBHSIC1		122
+#define MMP2_CLK_GPU_BUS		123
+#define MMP3_CLK_GPU_BUS		MMP2_CLK_GPU_BUS
+#define MMP2_CLK_GPU_3D			124
+#define MMP3_CLK_GPU_3D			MMP2_CLK_GPU_3D
+#define MMP3_CLK_GPU_2D			125
 
 #define MMP2_NR_CLKS			200
 #endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 12/17] clk: mmp2: add the GPU clocks
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (10 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 11/17] dt-bindings: marvell,mmp2: Add clock ids for the GPU clocks Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:25   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 13/17] dt-bindings: marvell,mmp2: Add clock ids for the thermal sensors Lubomir Rintel
                   ` (4 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

MMP2 has a single GC860 core while MMP3 has a GC2000 and a GC300.
On both platforms there's an AXI bus interface clock that's common for
all GPUs and each GPU core has a separate clock.

Meaning of the relevant APMU_GPU bits were gotten from James Cameron's
message and [1], the OLPC OS kernel source [2] and Marvell's MMP3 tree.

[1] http://lists.laptop.org/pipermail/devel/2019-April/039053.html
[2] http://dev.laptop.org/git/olpc-kernel/commit/arch/arm/mach-mmp/mmp2.c?h=arm-3.0-wip&id=8ce9f6122

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

---
Changes since v1:
- Added this patch

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

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 310d77855f03f..208c67df482a9 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -56,6 +56,7 @@
 #define APMU_CCIC1	0xf4
 #define APMU_USBHSIC0	0xf8
 #define APMU_USBHSIC1	0xfc
+#define APMU_GPU	0xcc
 
 #define MPMU_FCCR		0x8
 #define MPMU_POSR		0x10
@@ -245,6 +246,14 @@ static DEFINE_SPINLOCK(ccic0_lock);
 static DEFINE_SPINLOCK(ccic1_lock);
 static const char * const ccic_parent_names[] = {"pll1_2", "pll1_16", "vctcxo"};
 
+static DEFINE_SPINLOCK(gpu_lock);
+static const char * const mmp2_gpu_gc_parent_names[] =  {"pll1_2", "pll1_3", "pll2_2", "pll2_3", "pll2", "usb_pll"};
+static u32 mmp2_gpu_gc_parent_table[] =          { 0x0000,   0x0040,   0x0080,   0x00c0,   0x1000, 0x1040   };
+static const char * const mmp2_gpu_bus_parent_names[] = {"pll1_4", "pll2",   "pll2_2", "usb_pll"};
+static u32 mmp2_gpu_bus_parent_table[] =         { 0x0000,   0x0020,   0x0030,   0x4020   };
+static const char * const mmp3_gpu_bus_parent_names[] = {"pll1_4", "pll1_6", "pll1_2", "pll2_2"};
+static const char * const mmp3_gpu_gc_parent_names[] =  {"pll1",   "pll2",   "pll1_p", "pll2_p"};
+
 static struct mmp_clk_mix_config ccic0_mix_config = {
 	.reg_info = DEFINE_MIX_REG_INFO(4, 17, 2, 6, 32),
 };
@@ -257,6 +266,15 @@ static struct mmp_param_mux_clk apmu_mux_clks[] = {
 	{MMP2_CLK_DISP1_MUX, "disp1_mux", disp_parent_names, ARRAY_SIZE(disp_parent_names), CLK_SET_RATE_PARENT, APMU_DISP1, 6, 2, 0, &disp1_lock},
 };
 
+static struct mmp_param_mux_clk mmp3_apmu_mux_clks[] = {
+	{0, "gpu_bus_mux", mmp3_gpu_bus_parent_names, ARRAY_SIZE(mmp3_gpu_bus_parent_names),
+									CLK_SET_RATE_PARENT, APMU_GPU, 4, 2, 0, &gpu_lock},
+	{0, "gpu_3d_mux", mmp3_gpu_gc_parent_names, ARRAY_SIZE(mmp3_gpu_gc_parent_names),
+									CLK_SET_RATE_PARENT, APMU_GPU, 6, 2, 0, &gpu_lock},
+	{0, "gpu_2d_mux", mmp3_gpu_gc_parent_names, ARRAY_SIZE(mmp3_gpu_gc_parent_names),
+									CLK_SET_RATE_PARENT, APMU_GPU, 12, 2, 0, &gpu_lock},
+};
+
 static struct mmp_param_div_clk apmu_div_clks[] = {
 	{0, "disp0_div", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 8, 4, 0, &disp0_lock},
 	{0, "disp0_sphy_div", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 15, 5, 0, &disp0_lock},
@@ -265,6 +283,11 @@ static struct mmp_param_div_clk apmu_div_clks[] = {
 	{0, "ccic1_sphy_div", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 10, 5, 0, &ccic1_lock},
 };
 
+static struct mmp_param_div_clk mmp3_apmu_div_clks[] = {
+	{0, "gpu_3d_div", "gpu_3d_mux", CLK_SET_RATE_PARENT, APMU_GPU, 24, 4, 0, &gpu_lock},
+	{0, "gpu_2d_div", "gpu_2d_mux", CLK_SET_RATE_PARENT, APMU_GPU, 28, 4, 0, &gpu_lock},
+};
+
 static struct mmp_param_gate_clk apmu_gate_clks[] = {
 	{MMP2_CLK_USB, "usb_clk", "usb_pll", 0, APMU_USB, 0x9, 0x9, 0x0, 0, &usb_lock},
 	{MMP2_CLK_USBHSIC0, "usbhsic0_clk", "usb_pll", 0, APMU_USBHSIC0, 0x1b, 0x1b, 0x0, 0, &usbhsic0_lock},
@@ -285,6 +308,16 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
 	{MMP2_CLK_CCIC1, "ccic1_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x1b, 0x1b, 0x0, 0, &ccic1_lock},
 	{MMP2_CLK_CCIC1_PHY, "ccic1_phy_clk", "ccic1_mix_clk", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x24, 0x24, 0x0, 0, &ccic1_lock},
 	{MMP2_CLK_CCIC1_SPHY, "ccic1_sphy_clk", "ccic1_sphy_div", CLK_SET_RATE_PARENT, APMU_CCIC1, 0x300, 0x300, 0x0, 0, &ccic1_lock},
+	{MMP2_CLK_GPU_BUS, "gpu_bus_clk", "gpu_bus_mux", CLK_SET_RATE_PARENT, APMU_GPU, 0xa, 0xa, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
+};
+
+static struct mmp_param_gate_clk mmp2_apmu_gate_clks[] = {
+	{MMP2_CLK_GPU_3D, "gpu_3d_clk", "gpu_3d_mux", CLK_SET_RATE_PARENT, APMU_GPU, 0x5, 0x5, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
+};
+
+static struct mmp_param_gate_clk mmp3_apmu_gate_clks[] = {
+	{MMP3_CLK_GPU_3D, "gpu_3d_clk", "gpu_3d_div", CLK_SET_RATE_PARENT, APMU_GPU, 0x5, 0x5, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
+	{MMP3_CLK_GPU_2D, "gpu_2d_clk", "gpu_2d_div", CLK_SET_RATE_PARENT, APMU_GPU, 0x1c0000, 0x1c0000, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
 };
 
 static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
@@ -320,6 +353,34 @@ static void mmp2_axi_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
 
 	mmp_register_gate_clks(unit, apmu_gate_clks, pxa_unit->apmu_base,
 				ARRAY_SIZE(apmu_gate_clks));
+
+	if (pxa_unit->model == CLK_MODEL_MMP3) {
+		mmp_register_mux_clks(unit, mmp3_apmu_mux_clks, pxa_unit->apmu_base,
+					ARRAY_SIZE(mmp3_apmu_mux_clks));
+
+		mmp_register_div_clks(unit, mmp3_apmu_div_clks, pxa_unit->apmu_base,
+					ARRAY_SIZE(mmp3_apmu_div_clks));
+
+		mmp_register_gate_clks(unit, mmp3_apmu_gate_clks, pxa_unit->apmu_base,
+					ARRAY_SIZE(mmp3_apmu_gate_clks));
+	} else {
+		clk_register_mux_table(NULL, "gpu_3d_mux", mmp2_gpu_gc_parent_names,
+					ARRAY_SIZE(mmp2_gpu_gc_parent_names),
+					CLK_SET_RATE_PARENT,
+					pxa_unit->apmu_base + APMU_GPU,
+					0, 0x10c0, 0,
+					mmp2_gpu_gc_parent_table, &gpu_lock);
+
+		clk_register_mux_table(NULL, "gpu_bus_mux", mmp2_gpu_bus_parent_names,
+					ARRAY_SIZE(mmp2_gpu_bus_parent_names),
+					CLK_SET_RATE_PARENT,
+					pxa_unit->apmu_base + APMU_GPU,
+					0, 0x4030, 0,
+					mmp2_gpu_bus_parent_table, &gpu_lock);
+
+		mmp_register_gate_clks(unit, mmp2_apmu_gate_clks, pxa_unit->apmu_base,
+					ARRAY_SIZE(mmp2_apmu_gate_clks));
+	}
 }
 
 static void mmp2_clk_reset_init(struct device_node *np,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 13/17] dt-bindings: marvell,mmp2: Add clock ids for the thermal sensors
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (11 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 12/17] clk: mmp2: add " Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:25   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 14/17] clk: mmp2: Add clocks " Lubomir Rintel
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

There seems to be a single thermal sensor block on MMP2 and a couple
more on MMP3. Add definitions for their respective clocks.

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

---
Changes since v1:
- Added this patch

 include/dt-bindings/clock/marvell,mmp2.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/dt-bindings/clock/marvell,mmp2.h b/include/dt-bindings/clock/marvell,mmp2.h
index dd5067bd92f22..2793fdf300066 100644
--- a/include/dt-bindings/clock/marvell,mmp2.h
+++ b/include/dt-bindings/clock/marvell,mmp2.h
@@ -53,6 +53,10 @@
 #define MMP2_CLK_SSP2			79
 #define MMP2_CLK_SSP3			80
 #define MMP2_CLK_TIMER			81
+#define MMP2_CLK_THERMAL0		82
+#define MMP3_CLK_THERMAL1		83
+#define MMP3_CLK_THERMAL2		84
+#define MMP3_CLK_THERMAL3		85
 
 /* axi periphrals */
 #define MMP2_CLK_SDH0			101
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 14/17] clk: mmp2: Add clocks for the thermal sensors
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (12 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 13/17] dt-bindings: marvell,mmp2: Add clock ids for the thermal sensors Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:25   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 15/17] dt-bindings: marvell,mmp2: Add clock id for the fifth SD HCI on MMP3 Lubomir Rintel
                   ` (2 subsequent siblings)
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

The register definitions gotten from OLPC Open Firmware.

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

---
Changes since v1:
- Added this patch

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

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 208c67df482a9..0057a53905d8b 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -54,6 +54,10 @@
 #define APMU_DISP1	0x110
 #define APMU_CCIC0	0x50
 #define APMU_CCIC1	0xf4
+#define APBC_THERMAL0	0x90
+#define APBC_THERMAL1	0x98
+#define APBC_THERMAL2	0x9c
+#define APBC_THERMAL3	0xa0
 #define APMU_USBHSIC0	0xf8
 #define APMU_USBHSIC1	0xfc
 #define APMU_GPU	0xcc
@@ -215,6 +219,13 @@ static struct mmp_param_gate_clk apbc_gate_clks[] = {
 	{MMP2_CLK_SSP2, "ssp2_clk", "ssp2_mux", CLK_SET_RATE_PARENT, APBC_SSP2, 0x7, 0x3, 0x0, 0, &ssp2_lock},
 	{MMP2_CLK_SSP3, "ssp3_clk", "ssp3_mux", CLK_SET_RATE_PARENT, APBC_SSP3, 0x7, 0x3, 0x0, 0, &ssp3_lock},
 	{MMP2_CLK_TIMER, "timer_clk", "timer_mux", CLK_SET_RATE_PARENT, APBC_TIMER, 0x7, 0x3, 0x0, 0, &timer_lock},
+	{MMP2_CLK_THERMAL0, "thermal0_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_THERMAL0, 0x7, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, &reset_lock},
+};
+
+static struct mmp_param_gate_clk mmp3_apbc_gate_clks[] = {
+	{MMP3_CLK_THERMAL1, "thermal1_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_THERMAL1, 0x7, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, &reset_lock},
+	{MMP3_CLK_THERMAL2, "thermal2_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_THERMAL2, 0x7, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, &reset_lock},
+	{MMP3_CLK_THERMAL3, "thermal3_clk", "vctcxo", CLK_SET_RATE_PARENT, APBC_THERMAL3, 0x7, 0x3, 0x0, MMP_CLK_GATE_NEED_DELAY, &reset_lock},
 };
 
 static void mmp2_apb_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
@@ -226,6 +237,11 @@ static void mmp2_apb_periph_clk_init(struct mmp2_clk_unit *pxa_unit)
 
 	mmp_register_gate_clks(unit, apbc_gate_clks, pxa_unit->apbc_base,
 				ARRAY_SIZE(apbc_gate_clks));
+
+	if (pxa_unit->model == CLK_MODEL_MMP3) {
+		mmp_register_gate_clks(unit, mmp3_apbc_gate_clks, pxa_unit->apbc_base,
+					ARRAY_SIZE(mmp3_apbc_gate_clks));
+	}
 }
 
 static DEFINE_SPINLOCK(sdh_lock);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 15/17] dt-bindings: marvell,mmp2: Add clock id for the fifth SD HCI on MMP3
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (13 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 14/17] clk: mmp2: Add clocks " Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:25   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 16/17] clk: mmp2: Add clock for " Lubomir Rintel
  2020-03-09 19:42 ` [PATCH v2 17/17] clk: mmp2: Fix bit masks for LCDC I/O and pixel clocks Lubomir Rintel
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

There's one extra SDHCI on MMP3, used by the internal SD card on OLPC
XO-4. Add a clock for it.

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

---
Changes since v1:
- Added this patch

 include/dt-bindings/clock/marvell,mmp2.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/dt-bindings/clock/marvell,mmp2.h b/include/dt-bindings/clock/marvell,mmp2.h
index 2793fdf300066..06bb7fe4c62f4 100644
--- a/include/dt-bindings/clock/marvell,mmp2.h
+++ b/include/dt-bindings/clock/marvell,mmp2.h
@@ -86,6 +86,7 @@
 #define MMP2_CLK_GPU_3D			124
 #define MMP3_CLK_GPU_3D			MMP2_CLK_GPU_3D
 #define MMP3_CLK_GPU_2D			125
+#define MMP3_CLK_SDH4			126
 
 #define MMP2_NR_CLKS			200
 #endif
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 16/17] clk: mmp2: Add clock for fifth SD HCI on MMP3
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (14 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 15/17] dt-bindings: marvell,mmp2: Add clock id for the fifth SD HCI on MMP3 Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:25   ` Stephen Boyd
  2020-03-09 19:42 ` [PATCH v2 17/17] clk: mmp2: Fix bit masks for LCDC I/O and pixel clocks Lubomir Rintel
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

There's one extra SDHCI on MMP3, used by the internal SD card on OLPC
XO-4. Add a clock for it.

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

---
Changes since v1:
- Added this patch

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

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 0057a53905d8b..8769860fab640 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -49,6 +49,7 @@
 #define APMU_SDH1	0x58
 #define APMU_SDH2	0xe8
 #define APMU_SDH3	0xec
+#define APMU_SDH4	0x15c
 #define APMU_USB	0x5c
 #define APMU_DISP0	0x4c
 #define APMU_DISP1	0x110
@@ -332,6 +333,7 @@ static struct mmp_param_gate_clk mmp2_apmu_gate_clks[] = {
 };
 
 static struct mmp_param_gate_clk mmp3_apmu_gate_clks[] = {
+	{MMP3_CLK_SDH4, "sdh4_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH4, 0x1b, 0x1b, 0x0, 0, &sdh_lock},
 	{MMP3_CLK_GPU_3D, "gpu_3d_clk", "gpu_3d_div", CLK_SET_RATE_PARENT, APMU_GPU, 0x5, 0x5, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
 	{MMP3_CLK_GPU_2D, "gpu_2d_clk", "gpu_2d_div", CLK_SET_RATE_PARENT, APMU_GPU, 0x1c0000, 0x1c0000, 0x0, MMP_CLK_GATE_NEED_DELAY, &gpu_lock},
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v2 17/17] clk: mmp2: Fix bit masks for LCDC I/O and pixel clocks
  2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
                   ` (15 preceding siblings ...)
  2020-03-09 19:42 ` [PATCH v2 16/17] clk: mmp2: Add clock for " Lubomir Rintel
@ 2020-03-09 19:42 ` Lubomir Rintel
  2020-03-21  1:25   ` Stephen Boyd
  16 siblings, 1 reply; 37+ messages in thread
From: Lubomir Rintel @ 2020-03-09 19:42 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

They were reversed because I read the datasheet upside down.
Actually there is no datasheet, but I ended up understanding the
comments in Open Firmware driver wrong.

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

---
Changes since v1:
- Added this patch

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

diff --git a/drivers/clk/mmp/clk-of-mmp2.c b/drivers/clk/mmp/clk-of-mmp2.c
index 8769860fab640..52dc8b43acd9a 100644
--- a/drivers/clk/mmp/clk-of-mmp2.c
+++ b/drivers/clk/mmp/clk-of-mmp2.c
@@ -314,8 +314,8 @@ static struct mmp_param_gate_clk apmu_gate_clks[] = {
 	{MMP2_CLK_SDH1, "sdh1_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH1, 0x1b, 0x1b, 0x0, 0, &sdh_lock},
 	{MMP2_CLK_SDH2, "sdh2_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH2, 0x1b, 0x1b, 0x0, 0, &sdh_lock},
 	{MMP2_CLK_SDH3, "sdh3_clk", "sdh_mix_clk", CLK_SET_RATE_PARENT, APMU_SDH3, 0x1b, 0x1b, 0x0, 0, &sdh_lock},
-	{MMP2_CLK_DISP0, "disp0_clk", "disp0_div", CLK_SET_RATE_PARENT, APMU_DISP0, 0x09, 0x09, 0x0, 0, &disp0_lock},
-	{MMP2_CLK_DISP0_LCDC, "disp0_lcdc_clk", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 0x12, 0x12, 0x0, 0, &disp0_lock},
+	{MMP2_CLK_DISP0, "disp0_clk", "disp0_div", CLK_SET_RATE_PARENT, APMU_DISP0, 0x12, 0x12, 0x0, 0, &disp0_lock},
+	{MMP2_CLK_DISP0_LCDC, "disp0_lcdc_clk", "disp0_mux", CLK_SET_RATE_PARENT, APMU_DISP0, 0x09, 0x09, 0x0, 0, &disp0_lock},
 	{MMP2_CLK_DISP0_SPHY, "disp0_sphy_clk", "disp0_sphy_div", CLK_SET_RATE_PARENT, APMU_DISP0, 0x1024, 0x1024, 0x0, 0, &disp0_lock},
 	{MMP2_CLK_DISP1, "disp1_clk", "disp1_div", CLK_SET_RATE_PARENT, APMU_DISP1, 0x09, 0x09, 0x0, 0, &disp1_lock},
 	{MMP2_CLK_CCIC_ARBITER, "ccic_arbiter", "vctcxo", CLK_SET_RATE_PARENT, APMU_CCIC0, 0x1800, 0x1800, 0x0, 0, &ccic0_lock},
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 10/17] ARM: dts: mmp3: Use the MMP3 compatible string for /clocks
  2020-03-09 19:42 ` [PATCH v2 10/17] ARM: dts: mmp3: Use the MMP3 compatible string for /clocks Lubomir Rintel
@ 2020-03-21  1:20   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:20 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:47)
> Clocks are in fact slightly different on MMP3. In particular, PLL2 is
> fixed to a different frequency, there's an extra PLL3, and the GPU
> clocks are configured differently.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---

This should go through arm-soc.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 01/17] clk: mmp2: Remove a unused prototype
  2020-03-09 19:42 ` [PATCH v2 01/17] clk: mmp2: Remove a unused prototype Lubomir Rintel
@ 2020-03-21  1:24   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:24 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:38)
> There is no mmp_clk_register_pll2() routine.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 02/17] clk: mmp2: Constify some strings
  2020-03-09 19:42 ` [PATCH v2 02/17] clk: mmp2: Constify some strings Lubomir Rintel
@ 2020-03-21  1:24   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:24 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:39)
> All the parent clock names for the muxes are constant. Add const.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 03/17] dt-bindings: clock: Convert marvell,mmp2-clock to json-schema
  2020-03-09 19:42 ` [PATCH v2 03/17] dt-bindings: clock: Convert marvell,mmp2-clock to json-schema Lubomir Rintel
@ 2020-03-21  1:24   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:24 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel,
	Rob Herring

Quoting Lubomir Rintel (2020-03-09 12:42:40)
> Convert the fixed-factor-clock binding to DT schema format using
> json-schema.
> 
> While at that, fix a couple of small errors: make the file base name
> match the compatible string, add an example and document the reg-names
> property.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> Reviewed-by: Rob Herring <robh@kernel.org>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources
  2020-03-09 19:42 ` [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources Lubomir Rintel
@ 2020-03-21  1:24   ` Stephen Boyd
  2020-04-06 19:30   ` Guenter Roeck
  1 sibling, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:24 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:41)
> The clk-of-mmp2 driver pretends that the clock outputs from the PLLs are
> constant, but in fact they are configurable.
> 
> Add logic for obtaining the actual clock rates on MMP2 as well as MMP3.
> There is no documentation for either SoC, but the "systemsetting" drivers
> from Marvell GPL code dump provide some clue as far as MPMU registers on
> MMP2 [1] and MMP3 [2] go.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/char/mmp2_systemsetting.c
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/char/mmp3_systemsetting.c
> 
> A separate commit will adjust the clk-of-mmp2 driver.
> 
> Tested on a MMP3-based Dell Wyse 3020 as well as MMP2-based OLPC
> XO-1.75 laptop.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 05/17] clk: mmp2: Stop pretending PLL outputs are constant
  2020-03-09 19:42 ` [PATCH v2 05/17] clk: mmp2: Stop pretending PLL outputs are constant Lubomir Rintel
@ 2020-03-21  1:24   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:24 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:42)
> The hardcoded values for PLL1 and PLL2 are wrong. PLL1 is slightly
> off -- it defaults to 797.33 MHz, not 800 MHz. PLL2 is disabled by default,
> but also configurable.
> 
> Tested on a MMP2-based OLPC XO-1.75 laptop, with PLL1=797.33 and various
> values of PLL2 set via set-pll2-520mhz, set-pll2-910mhz and
> set-pll2-988mhz Open Firmware words.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 06/17] dt-bindings: clock: Add MMP3 compatible string
  2020-03-09 19:42 ` [PATCH v2 06/17] dt-bindings: clock: Add MMP3 compatible string Lubomir Rintel
@ 2020-03-21  1:24   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:24 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel,
	Rob Herring

Quoting Lubomir Rintel (2020-03-09 12:42:43)
> This binding describes the PMUs that are found on MMP3 as well. Add the
> compatible strings and adjust the description.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> Reviewed-by: Rob Herring <robh@kernel.org>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 07/17] clk: mmp2: Check for MMP3
  2020-03-09 19:42 ` [PATCH v2 07/17] clk: mmp2: Check for MMP3 Lubomir Rintel
@ 2020-03-21  1:24   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:24 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:44)
> The MMP3's are similar enough to MMP2, but there are differencies, such
> are more clocks available on the newer model. We want to tell which
> platform are we on.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 08/17] dt-bindings: marvell,mmp2: Add clock ids for MMP3 PLLs
  2020-03-09 19:42 ` [PATCH v2 08/17] dt-bindings: marvell,mmp2: Add clock ids for MMP3 PLLs Lubomir Rintel
@ 2020-03-21  1:24   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:24 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel,
	Rob Herring

Quoting Lubomir Rintel (2020-03-09 12:42:45)
> MMP3 variant provides some more clocks. Add respective IDs.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> Acked-by: Rob Herring <robh@kernel.org>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 09/17] clk: mmp2: Add PLLs that are available on MMP3
  2020-03-09 19:42 ` [PATCH v2 09/17] clk: mmp2: Add PLLs that are available on MMP3 Lubomir Rintel
@ 2020-03-21  1:25   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:25 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:46)
> There are more PLLs on MMP3 and are configured slightly differently.
> Tested on a MMP3-based Dell Wyse 3020 machine.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 11/17] dt-bindings: marvell,mmp2: Add clock ids for the GPU clocks
  2020-03-09 19:42 ` [PATCH v2 11/17] dt-bindings: marvell,mmp2: Add clock ids for the GPU clocks Lubomir Rintel
@ 2020-03-21  1:25   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:25 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:48)
> MMP2 has a single GC860 core while MMP3 has a GC2000 and a GC300.
> On both platforms there's an AXI bus interface clock that's common for
> all GPUs and each GPU core has a separate clock.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 12/17] clk: mmp2: add the GPU clocks
  2020-03-09 19:42 ` [PATCH v2 12/17] clk: mmp2: add " Lubomir Rintel
@ 2020-03-21  1:25   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:25 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:49)
> MMP2 has a single GC860 core while MMP3 has a GC2000 and a GC300.
> On both platforms there's an AXI bus interface clock that's common for
> all GPUs and each GPU core has a separate clock.
> 
> Meaning of the relevant APMU_GPU bits were gotten from James Cameron's
> message and [1], the OLPC OS kernel source [2] and Marvell's MMP3 tree.
> 
> [1] http://lists.laptop.org/pipermail/devel/2019-April/039053.html
> [2] http://dev.laptop.org/git/olpc-kernel/commit/arch/arm/mach-mmp/mmp2.c?h=arm-3.0-wip&id=8ce9f6122
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 13/17] dt-bindings: marvell,mmp2: Add clock ids for the thermal sensors
  2020-03-09 19:42 ` [PATCH v2 13/17] dt-bindings: marvell,mmp2: Add clock ids for the thermal sensors Lubomir Rintel
@ 2020-03-21  1:25   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:25 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:50)
> There seems to be a single thermal sensor block on MMP2 and a couple
> more on MMP3. Add definitions for their respective clocks.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 14/17] clk: mmp2: Add clocks for the thermal sensors
  2020-03-09 19:42 ` [PATCH v2 14/17] clk: mmp2: Add clocks " Lubomir Rintel
@ 2020-03-21  1:25   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:25 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:51)
> The register definitions gotten from OLPC Open Firmware.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 15/17] dt-bindings: marvell,mmp2: Add clock id for the fifth SD HCI on MMP3
  2020-03-09 19:42 ` [PATCH v2 15/17] dt-bindings: marvell,mmp2: Add clock id for the fifth SD HCI on MMP3 Lubomir Rintel
@ 2020-03-21  1:25   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:25 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:52)
> There's one extra SDHCI on MMP3, used by the internal SD card on OLPC
> XO-4. Add a clock for it.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 16/17] clk: mmp2: Add clock for fifth SD HCI on MMP3
  2020-03-09 19:42 ` [PATCH v2 16/17] clk: mmp2: Add clock for " Lubomir Rintel
@ 2020-03-21  1:25   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:25 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:53)
> There's one extra SDHCI on MMP3, used by the internal SD card on OLPC
> XO-4. Add a clock for it.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 17/17] clk: mmp2: Fix bit masks for LCDC I/O and pixel clocks
  2020-03-09 19:42 ` [PATCH v2 17/17] clk: mmp2: Fix bit masks for LCDC I/O and pixel clocks Lubomir Rintel
@ 2020-03-21  1:25   ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-03-21  1:25 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel, Lubomir Rintel

Quoting Lubomir Rintel (2020-03-09 12:42:54)
> They were reversed because I read the datasheet upside down.
> Actually there is no datasheet, but I ended up understanding the
> comments in Open Firmware driver wrong.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> ---

Applied to clk-next

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources
  2020-03-09 19:42 ` [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources Lubomir Rintel
  2020-03-21  1:24   ` Stephen Boyd
@ 2020-04-06 19:30   ` Guenter Roeck
  2020-04-09  8:32     ` Stephen Boyd
  1 sibling, 1 reply; 37+ messages in thread
From: Guenter Roeck @ 2020-04-06 19:30 UTC (permalink / raw)
  To: Lubomir Rintel
  Cc: Stephen Boyd, Michael Turquette, Rob Herring, Mark Rutland,
	linux-clk, devicetree, linux-kernel, linux-arm-kernel

On Mon, Mar 09, 2020 at 08:42:41PM +0100, Lubomir Rintel wrote:
> The clk-of-mmp2 driver pretends that the clock outputs from the PLLs are
> constant, but in fact they are configurable.
> 
> Add logic for obtaining the actual clock rates on MMP2 as well as MMP3.
> There is no documentation for either SoC, but the "systemsetting" drivers
> from Marvell GPL code dump provide some clue as far as MPMU registers on
> MMP2 [1] and MMP3 [2] go.
> 
> [1] https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/char/mmp2_systemsetting.c
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/char/mmp3_systemsetting.c
> 
> A separate commit will adjust the clk-of-mmp2 driver.
> 
> Tested on a MMP3-based Dell Wyse 3020 as well as MMP2-based OLPC
> XO-1.75 laptop.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

This patch results in:

arm-linux-gnueabi-ld: drivers/clk/mmp/clk.o: in function `mmp_register_pll_clks':
drivers/clk/mmp/clk.c:192: undefined reference to `mmp_clk_register_pll'

when building arm:pxa910_defconfig.

Bisect log is attached.

Guenter

---
# bad: [a10c9c710f9ecea87b9f4bbb837467893b4bef01] Merge tag 'for-v5.7' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
# good: [4c205c84e249e0a91dcfabe461d77667ec9b2d05] Merge tag 'keys-fixes-20200329' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs
git bisect start 'a10c9c710f9e' '4c205c84e249'
# bad: [31c0aa87ec8a30b1e9e4cf862905a369560f7705] Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random
git bisect bad 31c0aa87ec8a30b1e9e4cf862905a369560f7705
# bad: [53a2cc5cc36fd97728e1b418dbfa8f70bf23391a] Merge branches 'clk-ti', 'clk-ingenic', 'clk-typo', 'clk-at91', 'clk-mmp2' and 'clk-arm-icst' into clk-next
git bisect bad 53a2cc5cc36fd97728e1b418dbfa8f70bf23391a
# good: [2d11e9a1fd2abe784b334442b36f7d83ff914287] Merge branches 'clk-phase-errors', 'clk-amlogic', 'clk-renesas' and 'clk-allwinner' into clk-next
git bisect good 2d11e9a1fd2abe784b334442b36f7d83ff914287
# bad: [de17be999cb07effacf6a1129602f63396f5af27] clk: mmp2: Fix bit masks for LCDC I/O and pixel clocks
git bisect bad de17be999cb07effacf6a1129602f63396f5af27
# bad: [4d6da655d1871fadcb2b5de086e5a35883e22c95] dt-bindings: marvell,mmp2: Add clock ids for MMP3 PLLs
git bisect bad 4d6da655d1871fadcb2b5de086e5a35883e22c95
# bad: [5d34d0b32d6c13947b0aa890fc4c68f203491169] clk: mmp2: Add support for PLL clock sources
git bisect bad 5d34d0b32d6c13947b0aa890fc4c68f203491169
# good: [cb8dbfe831758fb2ba52d8c30db5249e48f57b8b] clk: mmp2: Constify some strings
git bisect good cb8dbfe831758fb2ba52d8c30db5249e48f57b8b
# good: [7de0b8b8b0508af5fed2f2a07e3abb6acac0c466] dt-bindings: clock: Convert marvell,mmp2-clock to json-schema
git bisect good 7de0b8b8b0508af5fed2f2a07e3abb6acac0c466
# first bad commit: [5d34d0b32d6c13947b0aa890fc4c68f203491169] clk: mmp2: Add support for PLL clock sources

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources
  2020-04-06 19:30   ` Guenter Roeck
@ 2020-04-09  8:32     ` Stephen Boyd
  0 siblings, 0 replies; 37+ messages in thread
From: Stephen Boyd @ 2020-04-09  8:32 UTC (permalink / raw)
  To: Guenter Roeck, Lubomir Rintel
  Cc: Michael Turquette, Rob Herring, Mark Rutland, linux-clk,
	devicetree, linux-kernel, linux-arm-kernel

Quoting Guenter Roeck (2020-04-06 12:30:50)
> On Mon, Mar 09, 2020 at 08:42:41PM +0100, Lubomir Rintel wrote:
> > The clk-of-mmp2 driver pretends that the clock outputs from the PLLs are
> > constant, but in fact they are configurable.
> > 
> > Add logic for obtaining the actual clock rates on MMP2 as well as MMP3.
> > There is no documentation for either SoC, but the "systemsetting" drivers
> > from Marvell GPL code dump provide some clue as far as MPMU registers on
> > MMP2 [1] and MMP3 [2] go.
> > 
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/char/mmp2_systemsetting.c
> > [2] https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/char/mmp3_systemsetting.c
> > 
> > A separate commit will adjust the clk-of-mmp2 driver.
> > 
> > Tested on a MMP3-based Dell Wyse 3020 as well as MMP2-based OLPC
> > XO-1.75 laptop.
> > 
> > Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> This patch results in:
> 
> arm-linux-gnueabi-ld: drivers/clk/mmp/clk.o: in function `mmp_register_pll_clks':
> drivers/clk/mmp/clk.c:192: undefined reference to `mmp_clk_register_pll'
> 
> when building arm:pxa910_defconfig.
> 

Thanks. I see that Arnd has sent a fix for this.

https://lore.kernel.org/r/20200408160518.2798571-1-arnd@arndb.de

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2020-04-09  8:32 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 19:42 [PATCH v2 00/17] clk: mmp2: MMP2 CLK Update Lubomir Rintel
2020-03-09 19:42 ` [PATCH v2 01/17] clk: mmp2: Remove a unused prototype Lubomir Rintel
2020-03-21  1:24   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 02/17] clk: mmp2: Constify some strings Lubomir Rintel
2020-03-21  1:24   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 03/17] dt-bindings: clock: Convert marvell,mmp2-clock to json-schema Lubomir Rintel
2020-03-21  1:24   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 04/17] clk: mmp2: Add support for PLL clock sources Lubomir Rintel
2020-03-21  1:24   ` Stephen Boyd
2020-04-06 19:30   ` Guenter Roeck
2020-04-09  8:32     ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 05/17] clk: mmp2: Stop pretending PLL outputs are constant Lubomir Rintel
2020-03-21  1:24   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 06/17] dt-bindings: clock: Add MMP3 compatible string Lubomir Rintel
2020-03-21  1:24   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 07/17] clk: mmp2: Check for MMP3 Lubomir Rintel
2020-03-21  1:24   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 08/17] dt-bindings: marvell,mmp2: Add clock ids for MMP3 PLLs Lubomir Rintel
2020-03-21  1:24   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 09/17] clk: mmp2: Add PLLs that are available on MMP3 Lubomir Rintel
2020-03-21  1:25   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 10/17] ARM: dts: mmp3: Use the MMP3 compatible string for /clocks Lubomir Rintel
2020-03-21  1:20   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 11/17] dt-bindings: marvell,mmp2: Add clock ids for the GPU clocks Lubomir Rintel
2020-03-21  1:25   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 12/17] clk: mmp2: add " Lubomir Rintel
2020-03-21  1:25   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 13/17] dt-bindings: marvell,mmp2: Add clock ids for the thermal sensors Lubomir Rintel
2020-03-21  1:25   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 14/17] clk: mmp2: Add clocks " Lubomir Rintel
2020-03-21  1:25   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 15/17] dt-bindings: marvell,mmp2: Add clock id for the fifth SD HCI on MMP3 Lubomir Rintel
2020-03-21  1:25   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 16/17] clk: mmp2: Add clock for " Lubomir Rintel
2020-03-21  1:25   ` Stephen Boyd
2020-03-09 19:42 ` [PATCH v2 17/17] clk: mmp2: Fix bit masks for LCDC I/O and pixel clocks Lubomir Rintel
2020-03-21  1:25   ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).