Skip to contentSkip to conversation

dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings

PATCH Superseded Wen He 4 participants 10 messages Dec 5, 2019 – Dec 20, 2019

Subsystems (2)

v11 of 12 Superseded Latest is v12 →

lore
Share & tools
lore

Wen He

author
#0 lore raw

PATCH v11 1/2 dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings

LS1028A has a clock domain PXLCLK0 used for provide pixel clocks to Display output interface. Add a YAML schema for this.

---
change in v11:
- renamed 'vco-frequency' to 'fsl,vco-hz' to clearly feild definiation

 .../devicetree/bindings/clock/fsl,plldig.yaml | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/fsl,plldig.yaml
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +55 -0
new file mode 100644
index 000000000000..23cce65b3a93
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bindings/clock/fsl,plldig.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP QorIQ Layerscape LS1028A Display PIXEL Clock Binding
+
+maintainers:
+  - Wen He <[email protected]>
+
+description: |
+  NXP LS1028A has a clock domain PXLCLK0 used for the Display output
+  interface in the display core, as implemented in TSMC CLN28HPM PLL.
+  which generate and offers pixel clocks to Display.
+
+properties:
+  compatible:
+    const: fsl,ls1028a-plldig
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 0
+
+  fsl,vco-hz:
+     $ref: '/schemas/types.yaml#/definitions/uint32'
+     description: Optional for VCO frequency of the PLL in Hertz.
+        The VCO frequency of this PLL cannot be changed during runtime
+        only at startup. Therefore, the output frequencies are very
+        limited and might not even closely match the requested frequency.
+        To work around this restriction the user may specify its own
+        desired VCO frequency for the PLL.
+     minimum: 650000000
+     maximum: 1300000000
+     default: 1188000000
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - '#clock-cells'
+
+examples:
+  # Display PIXEL Clock node:
+  - |
+    dpclk: clock-display@f1f0000 {
+        compatible = "fsl,ls1028a-plldig";
+        reg = <0x0 0xf1f0000 0x0 0xffff>;
+        #clock-cells = <0>;
+        clocks = <&osc_27m>;
+    };
+
+...
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v11 2/2 clk: ls1028a: Add clock driver for Display output interface

Add clock driver for QorIQ LS1028A Display output interfaces(LCD, DPHY), as implemented in TSMC CLN28HPM PLL, this PLL supports the programmable integer division and range of the display output pixel clock's 27-594MHz.

---
 drivers/clk/Kconfig      |  10 ++
 drivers/clk/Makefile     |   1 +
 drivers/clk/clk-plldig.c | 297 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 308 insertions(+)
 create mode 100644 drivers/clk/clk-plldig.c
drivers/clk/Kconfig +10 -0
index 0530bebfc25a..9f6b0196c604 100644
@@ -218,6 +218,16 @@ config CLK_QORIQ
 	  This adds the clock driver support for Freescale QorIQ platforms
 	  using common clock framework.
 
+config CLK_LS1028A_PLLDIG
+        tristate "Clock driver for LS1028A Display output"
+        depends on ARCH_LAYERSCAPE || COMPILE_TEST
+        default ARCH_LAYERSCAPE
+        help
+          This driver support the Display output interfaces(LCD, DPHY) pixel clocks
+          of the QorIQ Layerscape LS1028A, as implemented TSMC CLN28HPM PLL. Not all
+          features of the PLL are currently supported by the driver. By default,
+          configured bypass mode with this PLL.
+
 config COMMON_CLK_XGENE
 	bool "Clock driver for APM XGene SoC"
 	default ARCH_XGENE
drivers/clk/Makefile +1 -0
index 0138fb14e6f8..97d1e5bc6de5 100644
@@ -43,6 +43,7 @@ obj-$(CONFIG_ARCH_NPCM7XX)	    	+= clk-npcm7xx.o
 obj-$(CONFIG_ARCH_NSPIRE)		+= clk-nspire.o
 obj-$(CONFIG_COMMON_CLK_OXNAS)		+= clk-oxnas.o
 obj-$(CONFIG_COMMON_CLK_PALMAS)		+= clk-palmas.o
+obj-$(CONFIG_CLK_LS1028A_PLLDIG)	+= clk-plldig.o
 obj-$(CONFIG_COMMON_CLK_PWM)		+= clk-pwm.o
 obj-$(CONFIG_CLK_QORIQ)			+= clk-qoriq.o
 obj-$(CONFIG_COMMON_CLK_RK808)		+= clk-rk808.o
drivers/clk/clk-plldig.c new file +297 -0

297 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#2 lore raw

RE: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

Quoted 13 lines

-----Original Message-----
From: Wen He <[email protected]>
Sent: 2019年12月5日 15:27
To: Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; Michael Walle <[email protected]>; Leo Li <[email protected]>; [email protected]; [email protected]; [email protected]
Cc: Wen He <[email protected]>
Subject: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

Hi Maintainer,

Do you have any comments for this patch?

Best Regards,
Wen

Quoted 349 lines

Add clock driver for QorIQ LS1028A Display output interfaces(LCD, DPHY), as implemented in TSMC CLN28HPM PLL, this PLL supports the programmable integer division and range of the display output pixel clock's 27-594MHz.

---
 drivers/clk/Kconfig      |  10 ++
 drivers/clk/Makefile     |   1 +
 drivers/clk/clk-plldig.c | 297
+++++++++++++++++++++++++++++++++++++++
 3 files changed, 308 insertions(+)
 create mode 100644 drivers/clk/clk-plldig.c
drivers/clk/Kconfig index renamed from drivers/clk/Kconfig +0 -0

0530bebfc25a..9f6b0196c604 100644

drivers/clk/Kconfig +6 -0
@@ -218,6 +218,16 @@ config CLK_QORIQ
 	  This adds the clock driver support for Freescale QorIQ platforms
 	  using common clock framework.
 
+config CLK_LS1028A_PLLDIG
+        tristate "Clock driver for LS1028A Display output"
+        depends on ARCH_LAYERSCAPE || COMPILE_TEST
+        default ARCH_LAYERSCAPE
+        help
+          This driver support the Display output interfaces(LCD, DPHY) pixel

clocks
+ of the QorIQ Layerscape LS1028A, as implemented TSMC
CLN28HPM PLL. Not all
+ features of the PLL are currently supported by the driver. By
default,

drivers/clk/Kconfig +2 -0
+          configured bypass mode with this PLL.
+
 config COMMON_CLK_XGENE
 	bool "Clock driver for APM XGene SoC"
 	default ARCH_XGENE
drivers/clk/Makefile index renamed from drivers/clk/Makefile +0 -0

0138fb14e6f8..97d1e5bc6de5 100644

drivers/clk/Makefile +0 -0
@@ -43,6 +43,7 @@ obj-$(CONFIG_ARCH_NPCM7XX)	    	+=

clk-npcm7xx.o
obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o
obj-$(CONFIG_COMMON_CLK_OXNAS) += clk-oxnas.o
obj-$(CONFIG_COMMON_CLK_PALMAS) += clk-palmas.o

drivers/clk/Makefile +1 -0
+obj-$(CONFIG_CLK_LS1028A_PLLDIG)	+= clk-plldig.o
 obj-$(CONFIG_COMMON_CLK_PWM)		+= clk-pwm.o
 obj-$(CONFIG_CLK_QORIQ)			+= clk-qoriq.o
 obj-$(CONFIG_COMMON_CLK_RK808)		+= clk-rk808.o
drivers/clk/clk-plldig.c new file mode renamed from drivers/clk/clk-plldig.c +0 -0

100644 index 000000000000..1942686f0254

drivers/clk/clk-plldig.c new file +289 -0
@@ -0,0 +1,297 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 NXP
+ *
+ * Clock driver for LS1028A Display output interfaces(LCD, DPHY).
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/bitfield.h>
+
+/* PLLDIG register offsets and bit masks */
+#define PLLDIG_REG_PLLSR            0x24
+#define PLLDIG_LOCK_MASK            BIT(2)
+#define PLLDIG_REG_PLLDV            0x28
+#define PLLDIG_MFD_MASK             GENMASK(7, 0)
+#define PLLDIG_RFDPHI1_MASK         GENMASK(30, 25)
+#define PLLDIG_REG_PLLFM            0x2c
+#define PLLDIG_SSCGBYP_ENABLE       BIT(30)
+#define PLLDIG_REG_PLLFD            0x30
+#define PLLDIG_FDEN                 BIT(30)
+#define PLLDIG_FRAC_MASK            GENMASK(15, 0)
+#define PLLDIG_REG_PLLCAL1          0x38
+#define PLLDIG_REG_PLLCAL2          0x3c
+
+/* Range of the VCO frequencies, in Hz */
+#define PLLDIG_MIN_VCO_FREQ         650000000
+#define PLLDIG_MAX_VCO_FREQ         1300000000
+
+/* Range of the output frequencies, in Hz */
+#define PHI1_MIN_FREQ               27000000
+#define PHI1_MAX_FREQ               600000000
+
+/* Maximum value of the reduced frequency divider */
+#define MAX_RFDPHI1          63UL
+
+/* Best value of multiplication factor divider */
+#define PLLDIG_DEFAULT_MFD   44
+
+/*
+ * Denominator part of the fractional part of the
+ * loop multiplication factor.
+ */
+#define MFDEN          20480
+
+static const struct clk_parent_data parent_data[] = {
+	{.index = 0},
+};
+
+struct clk_plldig {
+	struct clk_hw hw;
+	void __iomem *regs;
+	unsigned int vco_freq;
+};
+
+#define to_clk_plldig(_hw)	container_of(_hw, struct clk_plldig, hw)
+
+static int plldig_enable(struct clk_hw *hw) {
+	struct clk_plldig *data = to_clk_plldig(hw);
+	u32 val;
+
+	val = readl(data->regs + PLLDIG_REG_PLLFM);
+	/*
+	 * Use Bypass mode with PLL off by default, the frequency overshoot
+	 * detector output was disable. SSCG Bypass mode should be enable.
+	 */
+	val |= PLLDIG_SSCGBYP_ENABLE;
+	writel(val, data->regs + PLLDIG_REG_PLLFM);
+
+	return 0;
+}
+
+static void plldig_disable(struct clk_hw *hw) {
+	struct clk_plldig *data = to_clk_plldig(hw);
+	u32 val;
+
+	val = readl(data->regs + PLLDIG_REG_PLLFM);
+
+	val &= ~PLLDIG_SSCGBYP_ENABLE;
+	val |= FIELD_PREP(PLLDIG_SSCGBYP_ENABLE, 0x0);
+
+	writel(val, data->regs + PLLDIG_REG_PLLFM); }
+
+static int plldig_is_enabled(struct clk_hw *hw) {
+	struct clk_plldig *data = to_clk_plldig(hw);
+
+	return (readl(data->regs + PLLDIG_REG_PLLFM) &
+			      PLLDIG_SSCGBYP_ENABLE);
+}
+
+static unsigned long plldig_recalc_rate(struct clk_hw *hw,
+					unsigned long parent_rate)
+{
+	struct clk_plldig *data = to_clk_plldig(hw);
+	u32 val, rfdphi1;
+
+	val = readl(data->regs + PLLDIG_REG_PLLDV);
+
+	/* Check if PLL is bypassed */
+	if (val & PLLDIG_SSCGBYP_ENABLE)
+		return parent_rate;
+
+	rfdphi1 = FIELD_GET(PLLDIG_RFDPHI1_MASK, val);
+
+	/*
+	 * If RFDPHI1 has a value of 1 the VCO frequency is also divided by
+	 * one.
+	 */
+	if (!rfdphi1)
+		rfdphi1 = 1;
+
+	return DIV_ROUND_UP(data->vco_freq, rfdphi1); }
+
+static unsigned long plldig_calc_target_div(unsigned long vco_freq,
+					    unsigned long target_rate)
+{
+	unsigned long div;
+
+	div = DIV_ROUND_CLOSEST(vco_freq, target_rate);
+	div = max(1UL, div);
+	div = min(div, MAX_RFDPHI1);
+
+	return div;
+}
+
+static int plldig_determine_rate(struct clk_hw *hw,
+				 struct clk_rate_request *req)
+{
+	struct clk_plldig *data = to_clk_plldig(hw);
+	unsigned int div;
+
+	if (req->rate < PHI1_MIN_FREQ)
+		req->rate = PHI1_MIN_FREQ;
+	if (req->rate > PHI1_MAX_FREQ)
+		req->rate = PHI1_MAX_FREQ;
+
+	div = plldig_calc_target_div(data->vco_freq, req->rate);
+	req->rate = DIV_ROUND_UP(data->vco_freq, div);
+
+	return 0;
+}
+
+static int plldig_set_rate(struct clk_hw *hw, unsigned long rate,
+		unsigned long parent_rate)
+{
+	struct clk_plldig *data = to_clk_plldig(hw);
+	unsigned int val, cond;
+	unsigned int rfdphi1;
+
+	if (rate < PHI1_MIN_FREQ)
+		rate = PHI1_MIN_FREQ;
+	if (rate > PHI1_MAX_FREQ)
+		rate = PHI1_MAX_FREQ;
+
+	rfdphi1 = plldig_calc_target_div(data->vco_freq, rate);
+
+	/* update the divider value */
+	val = readl(data->regs + PLLDIG_REG_PLLDV);
+	val &= ~PLLDIG_RFDPHI1_MASK;
+	val |= FIELD_PREP(PLLDIG_RFDPHI1_MASK, rfdphi1);
+	writel(val, data->regs + PLLDIG_REG_PLLDV);
+
+	/* delay 200us make sure that old lock state is cleared */
+	udelay(200);
+
+	/* Wait until PLL is locked or timeout (maximum 1000 usecs) */
+	return readl_poll_timeout_atomic(data->regs + PLLDIG_REG_PLLSR, cond,
+					 cond & PLLDIG_LOCK_MASK, 0,
+					 USEC_PER_MSEC);
+}
+
+static const struct clk_ops plldig_clk_ops = {
+	.enable = plldig_enable,
+	.disable = plldig_disable,
+	.is_enabled = plldig_is_enabled,
+	.recalc_rate = plldig_recalc_rate,
+	.determine_rate = plldig_determine_rate,
+	.set_rate = plldig_set_rate,
+};
+
+static int plldig_init(struct clk_hw *hw) {
+	struct clk_plldig *data = to_clk_plldig(hw);
+	struct clk_hw *parent = clk_hw_get_parent(hw);
+	unsigned long parent_rate = clk_hw_get_rate(parent);
+	unsigned long val;
+	unsigned long long lltmp;
+	unsigned int mfd, fracdiv = 0;
+
+	if (!parent)
+		return -EINVAL;
+
+	if (data->vco_freq) {
+		mfd = data->vco_freq / parent_rate;
+		lltmp = data->vco_freq % parent_rate;
+		lltmp *= MFDEN;
+		do_div(lltmp, parent_rate);
+		fracdiv = lltmp;
+	} else {
+		mfd = PLLDIG_DEFAULT_MFD;
+		data->vco_freq = parent_rate * mfd;
+	}
+
+	val = FIELD_PREP(PLLDIG_MFD_MASK, mfd);
+	writel(val, data->regs + PLLDIG_REG_PLLDV);
+
+	if (fracdiv) {
+		val = FIELD_PREP(PLLDIG_FRAC_MASK, fracdiv);
+		/* Enable fractional divider */
+		val |= PLLDIG_FDEN;
+		writel(val, data->regs + PLLDIG_REG_PLLFD);
+	}
+
+	return 0;
+}
+
+static int plldig_clk_probe(struct platform_device *pdev) {
+	struct clk_plldig *data;
+	struct resource *mem;
+	struct device *dev = &pdev->dev;
+	int ret;
+
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	data->regs = devm_ioremap_resource(dev, mem);
+	if (IS_ERR(data->regs))
+		return PTR_ERR(data->regs);
+
+	data->hw.init = CLK_HW_INIT_PARENTS_DATA("dpclk",
+						 parent_data,
+						 &plldig_clk_ops,
+						 0);
+
+	ret = devm_clk_hw_register(dev, &data->hw);
+	if (ret) {
+		dev_err(dev, "failed to register %s clock\n",
+						dev->of_node->name);
+		return ret;
+	}
+
+	ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get,
+					  &data->hw);
+	if (ret) {
+		dev_err(dev, "unable to add clk provider\n");
+		return ret;
+	}
+
+	/*
+	 * The frequency of the VCO cannot be changed during runtime.
+	 * Therefore, let the user specify a desired frequency.
+	 */
+	if (!of_property_read_u32(dev->of_node, "fsl,vco-hz",
+				  &data->vco_freq)) {
+		if (data->vco_freq < PLLDIG_MIN_VCO_FREQ ||
+		    data->vco_freq > PLLDIG_MAX_VCO_FREQ)
+			return -EINVAL;
+	}
+
+	return plldig_init(&data->hw);
+}
+
+static const struct of_device_id plldig_clk_id[] = {
+	{ .compatible = "fsl,ls1028a-plldig"},
+	{ }
+};
+MODULE_DEVICE_TABLE(of, plldig_clk_id);
+
+static struct platform_driver plldig_clk_driver = {
+	.driver = {
+		.name = "plldig-clock",
+		.of_match_table = plldig_clk_id,
+	},
+	.probe = plldig_clk_probe,
+};
+module_platform_driver(plldig_clk_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_AUTHOR("Wen He <[email protected]>");

MODULE_DESCRIPTION("LS1028A
+Display output interface pixel clock driver");
--
2.17.1

maintainer
#3 lore raw

Re: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

In reply to Wen He

Quoting Wen He (2019-12-04 23:26:53)

Quoted 6 lines

Add clock driver for QorIQ LS1028A Display output interfaces(LCD, DPHY), as implemented in TSMC CLN28HPM PLL, this PLL supports the programmable integer division and range of the display output pixel clock's 27-594MHz.

Is Michael the author? SoB chain is backwards here.

Quoted 52 lines
drivers/clk/clk-plldig.c new file +46 -0
new file mode 100644
index 000000000000..1942686f0254
@@ -0,0 +1,297 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 NXP
+ *
+ * Clock driver for LS1028A Display output interfaces(LCD, DPHY).
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/bitfield.h>
+
+/* PLLDIG register offsets and bit masks */
+#define PLLDIG_REG_PLLSR            0x24
+#define PLLDIG_LOCK_MASK            BIT(2)
+#define PLLDIG_REG_PLLDV            0x28
+#define PLLDIG_MFD_MASK             GENMASK(7, 0)
+#define PLLDIG_RFDPHI1_MASK         GENMASK(30, 25)
+#define PLLDIG_REG_PLLFM            0x2c
+#define PLLDIG_SSCGBYP_ENABLE       BIT(30)
+#define PLLDIG_REG_PLLFD            0x30
+#define PLLDIG_FDEN                 BIT(30)
+#define PLLDIG_FRAC_MASK            GENMASK(15, 0)
+#define PLLDIG_REG_PLLCAL1          0x38
+#define PLLDIG_REG_PLLCAL2          0x3c
+
+/* Range of the VCO frequencies, in Hz */
+#define PLLDIG_MIN_VCO_FREQ         650000000
+#define PLLDIG_MAX_VCO_FREQ         1300000000
+
+/* Range of the output frequencies, in Hz */
+#define PHI1_MIN_FREQ               27000000
+#define PHI1_MAX_FREQ               600000000
+
+/* Maximum value of the reduced frequency divider */
+#define MAX_RFDPHI1          63UL
+
+/* Best value of multiplication factor divider */

drivers/clk/clk-plldig.c line 56

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+#define PLLDIG_DEFAULT_MFD   44
+
+/*
+ * Denominator part of the fractional part of the
+ * loop multiplication factor.
+ */
+#define MFDEN          20480
+
+static const struct clk_parent_data parent_data[] = {
+       {.index = 0},

Nitpick: Add spaces after { and before }

Quoted 34 lines
drivers/clk/clk-plldig.c new file +34 -0
+};
+
+struct clk_plldig {
+       struct clk_hw hw;
+       void __iomem *regs;
+       unsigned int vco_freq;
+};
+
+#define to_clk_plldig(_hw)     container_of(_hw, struct clk_plldig, hw)
+
+static int plldig_enable(struct clk_hw *hw)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       u32 val;
+
+       val = readl(data->regs + PLLDIG_REG_PLLFM);
+       /*
+        * Use Bypass mode with PLL off by default, the frequency overshoot
+        * detector output was disable. SSCG Bypass mode should be enable.
+        */
+       val |= PLLDIG_SSCGBYP_ENABLE;
+       writel(val, data->regs + PLLDIG_REG_PLLFM);
+
+       return 0;
+}
+
+static void plldig_disable(struct clk_hw *hw)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       u32 val;
+
+       val = readl(data->regs + PLLDIG_REG_PLLFM);
+
+       val &= ~PLLDIG_SSCGBYP_ENABLE;

drivers/clk/clk-plldig.c line 100

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+       val |= FIELD_PREP(PLLDIG_SSCGBYP_ENABLE, 0x0);
+
+       writel(val, data->regs + PLLDIG_REG_PLLFM);
+}
+
+static int plldig_is_enabled(struct clk_hw *hw)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+
+       return (readl(data->regs + PLLDIG_REG_PLLFM) &

Please drop useless parenthesis.

Quoted 25 lines
drivers/clk/clk-plldig.c new file +25 -0
+                             PLLDIG_SSCGBYP_ENABLE);
+}
+
+static unsigned long plldig_recalc_rate(struct clk_hw *hw,
+                                       unsigned long parent_rate)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       u32 val, rfdphi1;
+
+       val = readl(data->regs + PLLDIG_REG_PLLDV);
+
+       /* Check if PLL is bypassed */
+       if (val & PLLDIG_SSCGBYP_ENABLE)
+               return parent_rate;
+
+       rfdphi1 = FIELD_GET(PLLDIG_RFDPHI1_MASK, val);
+
+       /*
+        * If RFDPHI1 has a value of 1 the VCO frequency is also divided by
+        * one.
+        */
+       if (!rfdphi1)
+               rfdphi1 = 1;
+
+       return DIV_ROUND_UP(data->vco_freq, rfdphi1);

drivers/clk/clk-plldig.c line 135

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+}
+
+static unsigned long plldig_calc_target_div(unsigned long vco_freq,
+                                           unsigned long target_rate)
+{
+       unsigned long div;
+
+       div = DIV_ROUND_CLOSEST(vco_freq, target_rate);
+       div = max(1UL, div);
+       div = min(div, MAX_RFDPHI1);

Use clamp().

Quoted 4 lines
drivers/clk/clk-plldig.c new file +4 -0
+
+       return div;
+}
+

drivers/clk/clk-plldig.c line 149

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+static int plldig_determine_rate(struct clk_hw *hw,
+                                struct clk_rate_request *req)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       unsigned int div;
+
+       if (req->rate < PHI1_MIN_FREQ)
+               req->rate = PHI1_MIN_FREQ;
+       if (req->rate > PHI1_MAX_FREQ)
+               req->rate = PHI1_MAX_FREQ;

Use clamp()

Quoted 8 lines
drivers/clk/clk-plldig.c new file +8 -0
+
+       div = plldig_calc_target_div(data->vco_freq, req->rate);
+       req->rate = DIV_ROUND_UP(data->vco_freq, div);
+
+       return 0;
+}
+
+static int plldig_set_rate(struct clk_hw *hw, unsigned long rate,

drivers/clk/clk-plldig.c line 167

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+               unsigned long parent_rate)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       unsigned int val, cond;
+       unsigned int rfdphi1;
+
+       if (rate < PHI1_MIN_FREQ)
+               rate = PHI1_MIN_FREQ;
+       if (rate > PHI1_MAX_FREQ)
+               rate = PHI1_MAX_FREQ;

Use clamp()

drivers/clk/clk-plldig.c line 178

Quoted 11 lines
drivers/clk/clk-plldig.c new file +11 -0
+
+       rfdphi1 = plldig_calc_target_div(data->vco_freq, rate);
+
+       /* update the divider value */
+       val = readl(data->regs + PLLDIG_REG_PLLDV);
+       val &= ~PLLDIG_RFDPHI1_MASK;
+       val |= FIELD_PREP(PLLDIG_RFDPHI1_MASK, rfdphi1);
+       writel(val, data->regs + PLLDIG_REG_PLLDV);
+
+       /* delay 200us make sure that old lock state is cleared */
+       udelay(200);

Please remove 'delay 200us' from the comment. Just say that we're waiting for old lock state to clear. It's clear from the code how much time it is.

drivers/clk/clk-plldig.c line 180

Quoted 2 lines
drivers/clk/clk-plldig.c new file +2 -0
+
+       /* Wait until PLL is locked or timeout (maximum 1000 usecs) */

Drop the time. It's a millisecond.

Quoted 33 lines
drivers/clk/clk-plldig.c new file +33 -0
+       return readl_poll_timeout_atomic(data->regs + PLLDIG_REG_PLLSR, cond,
+                                        cond & PLLDIG_LOCK_MASK, 0,
+                                        USEC_PER_MSEC);
+}
+
+static const struct clk_ops plldig_clk_ops = {
+       .enable = plldig_enable,
+       .disable = plldig_disable,
+       .is_enabled = plldig_is_enabled,
+       .recalc_rate = plldig_recalc_rate,
+       .determine_rate = plldig_determine_rate,
+       .set_rate = plldig_set_rate,
+};
+
+static int plldig_init(struct clk_hw *hw)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       struct clk_hw *parent = clk_hw_get_parent(hw);
+       unsigned long parent_rate = clk_hw_get_rate(parent);
+       unsigned long val;
+       unsigned long long lltmp;
+       unsigned int mfd, fracdiv = 0;
+
+       if (!parent)
+               return -EINVAL;
+
+       if (data->vco_freq) {
+               mfd = data->vco_freq / parent_rate;
+               lltmp = data->vco_freq % parent_rate;
+               lltmp *= MFDEN;
+               do_div(lltmp, parent_rate);
+               fracdiv = lltmp;
+       } else {

drivers/clk/clk-plldig.c line 223

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+               mfd = PLLDIG_DEFAULT_MFD;
+               data->vco_freq = parent_rate * mfd;
+       }
+
+       val = FIELD_PREP(PLLDIG_MFD_MASK, mfd);
+       writel(val, data->regs + PLLDIG_REG_PLLDV);
+
+       if (fracdiv) {
+               val = FIELD_PREP(PLLDIG_FRAC_MASK, fracdiv);
+               /* Enable fractional divider */

Remove useless comment please. Or move above the if condition.

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+               val |= PLLDIG_FDEN;
+               writel(val, data->regs + PLLDIG_REG_PLLFD);
+       }
+
+       return 0;
+}
+
+static int plldig_clk_probe(struct platform_device *pdev)
+{
+       struct clk_plldig *data;

drivers/clk/clk-plldig.c line 243

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+       struct resource *mem;
+       struct device *dev = &pdev->dev;
+       int ret;
+
+       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       data->regs = devm_ioremap_resource(dev, mem);

We have devm_platform_ioremap_resource() for this now.

Quoted 28 lines
drivers/clk/clk-plldig.c new file +28 -0
+       if (IS_ERR(data->regs))
+               return PTR_ERR(data->regs);
+
+       data->hw.init = CLK_HW_INIT_PARENTS_DATA("dpclk",
+                                                parent_data,
+                                                &plldig_clk_ops,
+                                                0);
+
+       ret = devm_clk_hw_register(dev, &data->hw);
+       if (ret) {
+               dev_err(dev, "failed to register %s clock\n",
+                                               dev->of_node->name);
+               return ret;
+       }
+
+       ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get,
+                                         &data->hw);
+       if (ret) {
+               dev_err(dev, "unable to add clk provider\n");
+               return ret;
+       }
+
+       /*
+        * The frequency of the VCO cannot be changed during runtime.
+        * Therefore, let the user specify a desired frequency.
+        */
+       if (!of_property_read_u32(dev->of_node, "fsl,vco-hz",
+                                 &data->vco_freq)) {

drivers/clk/clk-plldig.c line 281

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+               if (data->vco_freq < PLLDIG_MIN_VCO_FREQ ||
+                   data->vco_freq > PLLDIG_MAX_VCO_FREQ)
+                       return -EINVAL;
+       }
+
+       return plldig_init(&data->hw);
+}
+
+static const struct of_device_id plldig_clk_id[] = {
+       { .compatible = "fsl,ls1028a-plldig"},

Nitpick: Add a space before }

Quoted 4 lines
drivers/clk/clk-plldig.c new file +4 -0
+       { }
+};
+MODULE_DEVICE_TABLE(of, plldig_clk_id);
+
#4 lore raw

Re: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

Am 12. Dezember 2019 23:18:16 MEZ schrieb Stephen Boyd <[email protected]>:

Quoted 4 lines

Quoting Wen He (2019-12-04 23:26:53)

Quoted 1 line

Add clock driver for QorIQ LS1028A Display output interfaces(LCD,

DPHY),

Quoted 1 line

as implemented in TSMC CLN28HPM PLL, this PLL supports the

Quoted 8 lines

programmable

Quoted 1 line

integer division and range of the display output pixel clock's

27-594MHz.

Quoted 3 lines

Is Michael the author? SoB chain is backwards here.

the original driver was from Wen. I've just supplied some code and the vco frequency stuff. so its basically a sob of us both.

-michael

Quoted 332 lines
Quoted 53 lines
drivers/clk/clk-plldig.c new file +46 -0
new file mode 100644
index 000000000000..1942686f0254
@@ -0,0 +1,297 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright 2019 NXP
+ *
+ * Clock driver for LS1028A Display output interfaces(LCD, DPHY).
+ */
+
+#include <linux/clk-provider.h>
+#include <linux/device.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/bitfield.h>
+
+/* PLLDIG register offsets and bit masks */
+#define PLLDIG_REG_PLLSR            0x24
+#define PLLDIG_LOCK_MASK            BIT(2)
+#define PLLDIG_REG_PLLDV            0x28
+#define PLLDIG_MFD_MASK             GENMASK(7, 0)
+#define PLLDIG_RFDPHI1_MASK         GENMASK(30, 25)
+#define PLLDIG_REG_PLLFM            0x2c
+#define PLLDIG_SSCGBYP_ENABLE       BIT(30)
+#define PLLDIG_REG_PLLFD            0x30
+#define PLLDIG_FDEN                 BIT(30)
+#define PLLDIG_FRAC_MASK            GENMASK(15, 0)
+#define PLLDIG_REG_PLLCAL1          0x38
+#define PLLDIG_REG_PLLCAL2          0x3c
+
+/* Range of the VCO frequencies, in Hz */
+#define PLLDIG_MIN_VCO_FREQ         650000000
+#define PLLDIG_MAX_VCO_FREQ         1300000000
+
+/* Range of the output frequencies, in Hz */
+#define PHI1_MIN_FREQ               27000000
+#define PHI1_MAX_FREQ               600000000
+
+/* Maximum value of the reduced frequency divider */
+#define MAX_RFDPHI1          63UL
+
+/* Best value of multiplication factor divider */

drivers/clk/clk-plldig.c line 56

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+#define PLLDIG_DEFAULT_MFD   44
+
+/*
+ * Denominator part of the fractional part of the
+ * loop multiplication factor.
+ */
+#define MFDEN          20480
+
+static const struct clk_parent_data parent_data[] = {
+       {.index = 0},

Nitpick: Add spaces after { and before }

drivers/clk/clk-plldig.c

Quoted 9 lines
drivers/clk/clk-plldig.c new file +9 -0
+};
+
+struct clk_plldig {
+       struct clk_hw hw;
+       void __iomem *regs;
+       unsigned int vco_freq;
+};
+
+#define to_clk_plldig(_hw)     container_of(_hw, struct clk_plldig,

hw)

drivers/clk/clk-plldig.c

Quoted 9 lines
drivers/clk/clk-plldig.c new file +9 -0
+
+static int plldig_enable(struct clk_hw *hw)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       u32 val;
+
+       val = readl(data->regs + PLLDIG_REG_PLLFM);
+       /*
+        * Use Bypass mode with PLL off by default, the frequency

overshoot

drivers/clk/clk-plldig.c line 75

Quoted 1 line
drivers/clk/clk-plldig.c new file +1 -0
+        * detector output was disable. SSCG Bypass mode should be

enable.

Quoted 15 lines
drivers/clk/clk-plldig.c new file +15 -0
+        */
+       val |= PLLDIG_SSCGBYP_ENABLE;
+       writel(val, data->regs + PLLDIG_REG_PLLFM);
+
+       return 0;
+}
+
+static void plldig_disable(struct clk_hw *hw)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       u32 val;
+
+       val = readl(data->regs + PLLDIG_REG_PLLFM);
+
+       val &= ~PLLDIG_SSCGBYP_ENABLE;

drivers/clk/clk-plldig.c line 100

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+       val |= FIELD_PREP(PLLDIG_SSCGBYP_ENABLE, 0x0);
+
+       writel(val, data->regs + PLLDIG_REG_PLLFM);
+}
+
+static int plldig_is_enabled(struct clk_hw *hw)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+
+       return (readl(data->regs + PLLDIG_REG_PLLFM) &

Please drop useless parenthesis.

Quoted 9 lines
drivers/clk/clk-plldig.c new file +9 -0
+                             PLLDIG_SSCGBYP_ENABLE);
+}
+
+static unsigned long plldig_recalc_rate(struct clk_hw *hw,
+                                       unsigned long parent_rate)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       u32 val, rfdphi1;
+

drivers/clk/clk-plldig.c

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+       val = readl(data->regs + PLLDIG_REG_PLLDV);
+
+       /* Check if PLL is bypassed */
+       if (val & PLLDIG_SSCGBYP_ENABLE)
+               return parent_rate;
+
+       rfdphi1 = FIELD_GET(PLLDIG_RFDPHI1_MASK, val);
+
+       /*
+        * If RFDPHI1 has a value of 1 the VCO frequency is also

divided by

drivers/clk/clk-plldig.c

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+        * one.
+        */
+       if (!rfdphi1)
+               rfdphi1 = 1;
+
+       return DIV_ROUND_UP(data->vco_freq, rfdphi1);
+}
+
+static unsigned long plldig_calc_target_div(unsigned long vco_freq,
+                                           unsigned long

target_rate)

drivers/clk/clk-plldig.c line 135

Quoted 6 lines
drivers/clk/clk-plldig.c new file +6 -0
+{
+       unsigned long div;
+
+       div = DIV_ROUND_CLOSEST(vco_freq, target_rate);
+       div = max(1UL, div);
+       div = min(div, MAX_RFDPHI1);

Use clamp().

Quoted 4 lines
drivers/clk/clk-plldig.c new file +4 -0
+
+       return div;
+}
+

drivers/clk/clk-plldig.c line 149

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+static int plldig_determine_rate(struct clk_hw *hw,
+                                struct clk_rate_request *req)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       unsigned int div;
+
+       if (req->rate < PHI1_MIN_FREQ)
+               req->rate = PHI1_MIN_FREQ;
+       if (req->rate > PHI1_MAX_FREQ)
+               req->rate = PHI1_MAX_FREQ;

Use clamp()

Quoted 8 lines
drivers/clk/clk-plldig.c new file +8 -0
+
+       div = plldig_calc_target_div(data->vco_freq, req->rate);
+       req->rate = DIV_ROUND_UP(data->vco_freq, div);
+
+       return 0;
+}
+
+static int plldig_set_rate(struct clk_hw *hw, unsigned long rate,

drivers/clk/clk-plldig.c line 167

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+               unsigned long parent_rate)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       unsigned int val, cond;
+       unsigned int rfdphi1;
+
+       if (rate < PHI1_MIN_FREQ)
+               rate = PHI1_MIN_FREQ;
+       if (rate > PHI1_MAX_FREQ)
+               rate = PHI1_MAX_FREQ;

Use clamp()

drivers/clk/clk-plldig.c line 178

Quoted 11 lines
drivers/clk/clk-plldig.c new file +11 -0
+
+       rfdphi1 = plldig_calc_target_div(data->vco_freq, rate);
+
+       /* update the divider value */
+       val = readl(data->regs + PLLDIG_REG_PLLDV);
+       val &= ~PLLDIG_RFDPHI1_MASK;
+       val |= FIELD_PREP(PLLDIG_RFDPHI1_MASK, rfdphi1);
+       writel(val, data->regs + PLLDIG_REG_PLLDV);
+
+       /* delay 200us make sure that old lock state is cleared */
+       udelay(200);

Please remove 'delay 200us' from the comment. Just say that we're waiting
for old lock state to clear. It's clear from the code how much time it is.

drivers/clk/clk-plldig.c line 180

Quoted 2 lines
drivers/clk/clk-plldig.c new file +2 -0
+
+       /* Wait until PLL is locked or timeout (maximum 1000 usecs)

*/

Drop the time. It's a millisecond.

drivers/clk/clk-plldig.c line 181

Quoted 1 line
drivers/clk/clk-plldig.c new file +1 -0
+       return readl_poll_timeout_atomic(data->regs +

PLLDIG_REG_PLLSR, cond,

Quoted 32 lines
drivers/clk/clk-plldig.c new file +32 -0
+                                        cond & PLLDIG_LOCK_MASK, 0,
+                                        USEC_PER_MSEC);
+}
+
+static const struct clk_ops plldig_clk_ops = {
+       .enable = plldig_enable,
+       .disable = plldig_disable,
+       .is_enabled = plldig_is_enabled,
+       .recalc_rate = plldig_recalc_rate,
+       .determine_rate = plldig_determine_rate,
+       .set_rate = plldig_set_rate,
+};
+
+static int plldig_init(struct clk_hw *hw)
+{
+       struct clk_plldig *data = to_clk_plldig(hw);
+       struct clk_hw *parent = clk_hw_get_parent(hw);
+       unsigned long parent_rate = clk_hw_get_rate(parent);
+       unsigned long val;
+       unsigned long long lltmp;
+       unsigned int mfd, fracdiv = 0;
+
+       if (!parent)
+               return -EINVAL;
+
+       if (data->vco_freq) {
+               mfd = data->vco_freq / parent_rate;
+               lltmp = data->vco_freq % parent_rate;
+               lltmp *= MFDEN;
+               do_div(lltmp, parent_rate);
+               fracdiv = lltmp;
+       } else {

drivers/clk/clk-plldig.c line 223

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+               mfd = PLLDIG_DEFAULT_MFD;
+               data->vco_freq = parent_rate * mfd;
+       }
+
+       val = FIELD_PREP(PLLDIG_MFD_MASK, mfd);
+       writel(val, data->regs + PLLDIG_REG_PLLDV);
+
+       if (fracdiv) {
+               val = FIELD_PREP(PLLDIG_FRAC_MASK, fracdiv);
+               /* Enable fractional divider */

Remove useless comment please. Or move above the if condition.

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+               val |= PLLDIG_FDEN;
+               writel(val, data->regs + PLLDIG_REG_PLLFD);
+       }
+
+       return 0;
+}
+
+static int plldig_clk_probe(struct platform_device *pdev)
+{
+       struct clk_plldig *data;

drivers/clk/clk-plldig.c line 243

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+       struct resource *mem;
+       struct device *dev = &pdev->dev;
+       int ret;
+
+       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       data->regs = devm_ioremap_resource(dev, mem);

We have devm_platform_ioremap_resource() for this now.

Quoted 28 lines
drivers/clk/clk-plldig.c new file +28 -0
+       if (IS_ERR(data->regs))
+               return PTR_ERR(data->regs);
+
+       data->hw.init = CLK_HW_INIT_PARENTS_DATA("dpclk",
+                                                parent_data,
+                                                &plldig_clk_ops,
+                                                0);
+
+       ret = devm_clk_hw_register(dev, &data->hw);
+       if (ret) {
+               dev_err(dev, "failed to register %s clock\n",
+                                               dev->of_node->name);
+               return ret;
+       }
+
+       ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get,
+                                         &data->hw);
+       if (ret) {
+               dev_err(dev, "unable to add clk provider\n");
+               return ret;
+       }
+
+       /*
+        * The frequency of the VCO cannot be changed during runtime.
+        * Therefore, let the user specify a desired frequency.
+        */
+       if (!of_property_read_u32(dev->of_node, "fsl,vco-hz",
+                                 &data->vco_freq)) {

drivers/clk/clk-plldig.c line 281

Quoted 10 lines
drivers/clk/clk-plldig.c new file +10 -0
+               if (data->vco_freq < PLLDIG_MIN_VCO_FREQ ||
+                   data->vco_freq > PLLDIG_MAX_VCO_FREQ)
+                       return -EINVAL;
+       }
+
+       return plldig_init(&data->hw);
+}
+
+static const struct of_device_id plldig_clk_id[] = {
+       { .compatible = "fsl,ls1028a-plldig"},

Nitpick: Add a space before }

Quoted 4 lines
drivers/clk/clk-plldig.c new file +4 -0
+       { }
+};
+MODULE_DEVICE_TABLE(of, plldig_clk_id);
+
maintainer
#5 lore raw

Re: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

Quoting Michael Walle (2019-12-12 16:06:16)

Quoted 12 lines

Am 12. Dezember 2019 23:18:16 MEZ schrieb Stephen Boyd <[email protected]>:

Quoted 11 lines

Quoting Wen He (2019-12-04 23:26:53)

Quoted 1 line

Add clock driver for QorIQ LS1028A Display output interfaces(LCD,

DPHY),

Quoted 1 line

as implemented in TSMC CLN28HPM PLL, this PLL supports the

programmable

Quoted 1 line

integer division and range of the display output pixel clock's

27-594MHz.

Quoted 3 lines
Quoted 6 lines
Quoted 1 line

Is Michael the author? SoB chain is backwards here.

the original driver was from Wen. I've just supplied some code and the vco frequency stuff. so its basically a sob of us both.

-michael

Ok. That's a Co-developed-by: tag then. Thanks for letting us know.

author
#6 lore raw

RE: [EXT] Re: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

Quoted 29 lines

-----Original Message-----
From: Stephen Boyd <[email protected]>
Sent: 2019年12月17日 1:56
To: Leo Li <[email protected]>; Mark Rutland <[email protected]>; Michael Turquette <[email protected]>; Michael Walle <[email protected]>; Rob Herring <[email protected]>; Wen He <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

Caution: EXT Email

Quoting Michael Walle (2019-12-12 16:06:16)

Quoted 1 line

Am 12. Dezember 2019 23:18:16 MEZ schrieb Stephen Boyd

<[email protected]>:

Quoted 11 lines
Quoted 11 lines

Quoting Wen He (2019-12-04 23:26:53)

Quoted 1 line

Add clock driver for QorIQ LS1028A Display output interfaces(LCD,

DPHY),

Quoted 1 line

as implemented in TSMC CLN28HPM PLL, this PLL supports the

programmable

Quoted 1 line

integer division and range of the display output pixel clock's

27-594MHz.

Quoted 3 lines
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Is Michael the author? SoB chain is backwards here.

the original driver was from Wen. I've just supplied some code and the vco frequency stuff. so its basically a sob of us both.

-michael

Ok. That's a Co-developed-by: tag then. Thanks for letting us know.

The v12 version patch was sent out.
Does need I change the author sign to below?

Best Regards,
Wen

#7 lore raw

Re: [EXT] Re: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

Am 2019-12-17 08:08, schrieb Wen He:

Quoted 32 lines
Quoted 32 lines

-----Original Message-----
From: Stephen Boyd <[email protected]>
Sent: 2019年12月17日 1:56
To: Leo Li <[email protected]>; Mark Rutland <[email protected]>; Michael Turquette <[email protected]>; Michael Walle <[email protected]>; Rob Herring <[email protected]>; Wen He <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [v11 2/2] clk: ls1028a: Add clock driver for Display output interface

Caution: EXT Email

Quoting Michael Walle (2019-12-12 16:06:16)

Quoted 1 line

Am 12. Dezember 2019 23:18:16 MEZ schrieb Stephen Boyd

<[email protected]>:

Quoted 16 lines
Quoted 4 lines

Quoting Wen He (2019-12-04 23:26:53)

Quoted 1 line

Add clock driver for QorIQ LS1028A Display output interfaces(LCD,

DPHY),

Quoted 1 line

as implemented in TSMC CLN28HPM PLL, this PLL supports the

Quoted 8 lines

programmable

Quoted 1 line

integer division and range of the display output pixel clock's

27-594MHz.

Quoted 3 lines

Is Michael the author? SoB chain is backwards here.

the original driver was from Wen. I've just supplied some code and the vco frequency stuff. so its basically a sob of us both.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

-michael

Ok. That's a Co-developed-by: tag then. Thanks for letting us know.

The v12 version patch was sent out.
Does need I change the author sign to below?

I guess you mean the MODULE_AUTHOR()? I don't care if you add me or not, so do as you like.

Quoted 5 lines

Judging by the other Co-developed-by: lines it should be

-michael

maintainer Reviewed-by on v11 1/2
#8 lore raw
In reply to Wen He
Quoted 37 lines · Wen He

LS1028A has a clock domain PXLCLK0 used for provide pixel clocks to Display output interface. Add a YAML schema for this.

---
change in v11:
- renamed 'vco-frequency' to 'fsl,vco-hz' to clearly feild definiation

 .../devicetree/bindings/clock/fsl,plldig.yaml | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/fsl,plldig.yaml
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +18 -0
new file mode 100644
index 000000000000..23cce65b3a93
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bindings/clock/fsl,plldig.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NXP QorIQ Layerscape LS1028A Display PIXEL Clock Binding
+
+maintainers:
+  - Wen He <[email protected]>
+
+description: |
+  NXP LS1028A has a clock domain PXLCLK0 used for the Display output
+  interface in the display core, as implemented in TSMC CLN28HPM PLL.
+  which generate and offers pixel clocks to Display.
+
+properties:
+  compatible:

Documentation/devicetree/bindings/clock/fsl,plldig.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +10 -0
+    const: fsl,ls1028a-plldig
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 0
+
+  fsl,vco-hz:
+     $ref: '/schemas/types.yaml#/definitions/uint32'

Drop this as '*-hz' already has a type.

With that,

Quoted 30 lines
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +27 -0
+     description: Optional for VCO frequency of the PLL in Hertz.
+        The VCO frequency of this PLL cannot be changed during runtime
+        only at startup. Therefore, the output frequencies are very
+        limited and might not even closely match the requested frequency.
+        To work around this restriction the user may specify its own
+        desired VCO frequency for the PLL.
+     minimum: 650000000
+     maximum: 1300000000
+     default: 1188000000
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - '#clock-cells'
+
+examples:
+  # Display PIXEL Clock node:
+  - |
+    dpclk: clock-display@f1f0000 {
+        compatible = "fsl,ls1028a-plldig";
+        reg = <0x0 0xf1f0000 0x0 0xffff>;
+        #clock-cells = <0>;
+        clocks = <&osc_27m>;
+    };
+
+...
Signature · 1 line
2.17.1
author
#9 lore raw
Quoted 96 lines

-----Original Message-----
From: Rob Herring <[email protected]>
Sent: 2019年12月5日 22:27
To: Wen He <[email protected]>
Cc: Michael Turquette <[email protected]>; Stephen Boyd <[email protected]>; Mark Rutland <[email protected]>; Michael Walle <[email protected]>; Leo Li <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: [EXT] Re: [v11 1/2] dt/bindings: clk: Add YAML schemas for LS1028A Display Clock bindings

Caution: EXT Email

Quoted 24 lines · Wen He

LS1028A has a clock domain PXLCLK0 used for provide pixel clocks to Display output interface. Add a YAML schema for this.

---
change in v11:
- renamed 'vco-frequency' to 'fsl,vco-hz' to clearly feild
definiation

 .../devicetree/bindings/clock/fsl,plldig.yaml | 55
+++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644

Documentation/devicetree/bindings/clock/fsl,plldig.yaml

Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +0 -0
new file mode 100644
index 000000000000..23cce65b3a93

Documentation/devicetree/bindings/clock/fsl,plldig.yaml line 5

Quoted 5 lines
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +5 -0
@@ -0,0 +1,55 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id:
+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi

+cetree.org%2Fschemas%2Fbindings%2Fclock%2Ffsl%2Cplldig.yaml%23&amp; da

Quoted 1 line

+ta=02%7C01%7Cwen.he_1%40nxp.com%7Cbc3e7eabcfef4f75316e08d7798f 2c2e%7C

Quoted 1 line

+686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63711152813315072 4&amp;sda

Quoted 1 line

+ta=vFRvWaWgdyIWqQAVE7NXnUKCnE%2BU38svA%2BjWqNc%2Fb8w%3D&a mp;reserved=

Quoted 4 lines

+0
+$schema:
+https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdevi

+cetree.org%2Fmeta-schemas%2Fcore.yaml%23&amp;data=02%7C01%7Cwen .he_1%

Quoted 1 line

+40nxp.com%7Cbc3e7eabcfef4f75316e08d7798f2c2e%7C686ea1d3bc2b4c6f a92cd9

Quoted 1 line

+9c5c301635%7C0%7C0%7C637111528133150724&amp;sdata=dqj%2FBK%2 F4%2BBmfk

Quoted 14 lines
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +14 -0
+HkGjeNZm3FZZlTYPJOzEKroyH0jKDA%3D&amp;reserved=0
+
+title: NXP QorIQ Layerscape LS1028A Display PIXEL Clock Binding
+
+maintainers:
+  - Wen He <[email protected]>
+
+description: |
+  NXP LS1028A has a clock domain PXLCLK0 used for the Display output
+  interface in the display core, as implemented in TSMC CLN28HPM PLL.
+  which generate and offers pixel clocks to Display.
+
+properties:
+  compatible:

Documentation/devicetree/bindings/clock/fsl,plldig.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +10 -0
+    const: fsl,ls1028a-plldig
+
+  reg:
+    maxItems: 1
+
+  '#clock-cells':
+    const: 0
+
+  fsl,vco-hz:
+     $ref: '/schemas/types.yaml#/definitions/uint32'

Drop this as '*-hz' already has a type.

Quoted 3 lines

With that,

Thanks a lot;

Best Regards,
Wen

Quoted 32 lines

Documentation/devicetree/bindings/clock/fsl,plldig.yaml

Quoted 5 lines
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +4 -0
+     description: Optional for VCO frequency of the PLL in Hertz.
+        The VCO frequency of this PLL cannot be changed during runtime
+        only at startup. Therefore, the output frequencies are very
+        limited and might not even closely match the requested

frequency.

Quoted 26 lines
Documentation/devicetree/bindings/clock/fsl,plldig.yaml new file +23 -1
+        To work around this restriction the user may specify its own
+        desired VCO frequency for the PLL.
+     minimum: 650000000
+     maximum: 1300000000
+     default: 1188000000
+
+required:
+  - compatible
+  - reg
+  - clocks
+  - '#clock-cells'
+
+examples:
+  # Display PIXEL Clock node:
+  - |
+    dpclk: clock-display@f1f0000 {
+        compatible = "fsl,ls1028a-plldig";
+        reg = <0x0 0xf1f0000 0x0 0xffff>;
+        #clock-cells = <0>;
+        clocks = <&osc_27m>;
+    };
+
+...
--

2.17.1