Linux-Clk Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/2] dt-bindings: clock: Create YAML schema for ICST clocks
@ 2020-02-13 14:11 Linus Walleij
  2020-02-13 14:11 ` [PATCH 2/2] clk: versatile: Add device tree probing for IM-PD1 clocks Linus Walleij
  2020-02-13 20:39 ` [PATCH 1/2] dt-bindings: clock: Create YAML schema for ICST clocks Rob Herring
  0 siblings, 2 replies; 4+ messages in thread
From: Linus Walleij @ 2020-02-13 14:11 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, Linus Walleij, devicetree

The ICST clocks used in the ARM Integrator, Versatile and
RealView platforms are updated to use YAML schema, and two
new ICST clocks used by the Integrator IM-PD1 logical module
are added in the process.

Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 .../bindings/clock/arm,syscon-icst.yaml       | 102 ++++++++++++++++++
 .../bindings/clock/arm-integrator.txt         |  34 ------
 .../bindings/clock/arm-syscon-icst.txt        |  70 ------------
 3 files changed, 102 insertions(+), 104 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
 delete mode 100644 Documentation/devicetree/bindings/clock/arm-integrator.txt
 delete mode 100644 Documentation/devicetree/bindings/clock/arm-syscon-icst.txt

diff --git a/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml b/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
new file mode 100644
index 000000000000..06c4d84e8c3d
--- /dev/null
+++ b/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/arm,syscon-icst.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ARM System Conctroller ICST Clocks
+
+maintainers:
+  - Linus Walleij <linusw@kernel.org>
+
+description: The ICS525 and ICS307 oscillators are produced by Integrated
+  Devices Technology (IDT). ARM integrated these oscillators deeply into their
+  reference designs by adding special control registers that manage such
+  oscillators to their system controllers.
+
+  The various ARM system controllers contain logic to serialize and initialize
+  an ICST clock request after a write to the 32 bit register at an offset
+  into the system controller. Furthermore, to even be able to alter one of
+  these frequencies, the system controller must first be unlocked by
+  writing a special token to another offset in the system controller.
+
+  Some ARM hardware contain special versions of the serial interface that only
+  connects the low 8 bits of the VDW (missing one bit), hardwires RDW to
+  different values and sometimes also hardwire the output divider. They
+  therefore have special compatible strings as per this table (the OD value is
+  the value on the pins, not the resulting output divider).
+
+  In the core modules and logic tiles, the ICST is a configurable clock fed
+  from a 24 MHz clock on the motherboard (usually the main crystal) used for
+  generating e.g. video clocks. It is located on the core module and there is
+  only one of these. This clock node must be a subnode of the core module.
+
+  Hardware variant         RDW     OD          VDW
+
+  Integrator/AP            22      1           Bit 8 0, rest variable
+  integratorap-cm
+
+  Integrator/AP            46      3           Bit 8 0, rest variable
+  integratorap-sys
+
+  Integrator/AP            22 or   1           17 or (33 or 25 MHz)
+  integratorap-pci         14      1           14
+
+  Integrator/CP            22      variable    Bit 8 0, rest variable
+  integratorcp-cm-core
+
+  Integrator/CP            22      variable    Bit 8 0, rest variable
+  integratorcp-cm-mem
+
+  The ICST oscillator must be provided inside a system controller node.
+
+properties:
+  "#clock-cells":
+    const: 0
+
+  compatible:
+    enum:
+      - arm,syscon-icst525
+      - arm,syscon-icst307
+      - arm,syscon-icst525-integratorap-cm
+      - arm,syscon-icst525-integratorap-sys
+      - arm,syscon-icst525-integratorap-pci
+      - arm,syscon-icst525-integratorcp-cm-core
+      - arm,syscon-icst525-integratorcp-cm-mem
+      - arm,integrator-cm-auxosc
+      - arm,versatile-cm-auxosc
+      - arm,impd-vco1
+      - arm,impd-vco2
+
+  clocks:
+    description: Parent clock for the ICST VCO
+    maxItems: 1
+
+  clock-output-names:
+    maxItems: 1
+
+  lock-offset:
+    $ref: '/schemas/types.yaml#/definitions/uint32'
+    description: Offset to the unlocking register for the oscillator
+
+  vco-offset:
+    $ref: '/schemas/types.yaml#/definitions/uint32'
+    description: Offset to the VCO register for the oscillator
+
+required:
+  - "#clock-cells"
+  - compatible
+  - clocks
+
+examples:
+  - |
+    vco1: clock@00 {
+      compatible = "arm,impd1-vco1";
+      #clock-cells = <0>;
+      lock-offset = <0x08>;
+      vco-offset = <0x00>;
+      clocks = <&sysclk>;
+      clock-output-names = "IM-PD1-VCO1";
+    };
+
+...
diff --git a/Documentation/devicetree/bindings/clock/arm-integrator.txt b/Documentation/devicetree/bindings/clock/arm-integrator.txt
deleted file mode 100644
index 11f5f95f571b..000000000000
--- a/Documentation/devicetree/bindings/clock/arm-integrator.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-Clock bindings for ARM Integrator and Versatile Core Module clocks
-
-Auxiliary Oscillator Clock
-
-This is a configurable clock fed from a 24 MHz chrystal,
-used for generating e.g. video clocks. It is located on the
-core module and there is only one of these.
-
-This clock node *must* be a subnode of the core module, since
-it obtains the base address for it's address range from its
-parent node.
-
-
-Required properties:
-- compatible: must be "arm,integrator-cm-auxosc" or "arm,versatile-cm-auxosc"
-- #clock-cells: must be <0>
-
-Optional properties:
-- clocks: parent clock(s)
-
-Example:
-
-core-module@10000000 {
-	xtal24mhz: xtal24mhz@24M {
-		#clock-cells = <0>;
-		compatible = "fixed-clock";
-		clock-frequency = <24000000>;
-	};
-	auxosc: cm_aux_osc@25M {
-		#clock-cells = <0>;
-		compatible = "arm,integrator-cm-auxosc";
-		clocks = <&xtal24mhz>;
-	};
-};
diff --git a/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt b/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt
deleted file mode 100644
index 4cd81742038f..000000000000
--- a/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt
+++ /dev/null
@@ -1,70 +0,0 @@
-ARM System Controller ICST clocks
-
-The ICS525 and ICS307 oscillators are produced by Integrated Devices
-Technology (IDT). ARM integrated these oscillators deeply into their
-reference designs by adding special control registers that manage such
-oscillators to their system controllers.
-
-The various ARM system controllers contain logic to serialize and initialize
-an ICST clock request after a write to the 32 bit register at an offset
-into the system controller. Furthermore, to even be able to alter one of
-these frequencies, the system controller must first be unlocked by
-writing a special token to another offset in the system controller.
-
-Some ARM hardware contain special versions of the serial interface that only
-connects the low 8 bits of the VDW (missing one bit), hardwires RDW to
-different values and sometimes also hardwire the output divider. They
-therefore have special compatible strings as per this table (the OD value is
-the value on the pins, not the resulting output divider):
-
-Hardware variant:        RDW     OD          VDW
-
-Integrator/AP            22      1           Bit 8 0, rest variable
-integratorap-cm
-
-Integrator/AP            46      3           Bit 8 0, rest variable
-integratorap-sys
-
-Integrator/AP            22 or   1           17 or (33 or 25 MHz)
-integratorap-pci         14      1           14
-
-Integrator/CP            22      variable    Bit 8 0, rest variable
-integratorcp-cm-core
-
-Integrator/CP            22      variable    Bit 8 0, rest variable
-integratorcp-cm-mem
-
-The ICST oscillator must be provided inside a system controller node.
-
-Required properties:
-- compatible: must be one of
-  "arm,syscon-icst525"
-  "arm,syscon-icst307"
-  "arm,syscon-icst525-integratorap-cm"
-  "arm,syscon-icst525-integratorap-sys"
-  "arm,syscon-icst525-integratorap-pci"
-  "arm,syscon-icst525-integratorcp-cm-core"
-  "arm,syscon-icst525-integratorcp-cm-mem"
-- lock-offset: the offset address into the system controller where the
-  unlocking register is located
-- vco-offset: the offset address into the system controller where the
-  ICST control register is located (even 32 bit address)
-- #clock-cells: must be <0>
-- clocks: parent clock, since the ICST needs a parent clock to derive its
-  frequency from, this attribute is compulsory.
-
-Example:
-
-syscon: syscon@10000000 {
-	compatible = "syscon";
-	reg = <0x10000000 0x1000>;
-
-	oscclk0: osc0@c {
-		compatible = "arm,syscon-icst307";
-		#clock-cells = <0>;
-		lock-offset = <0x20>;
-		vco-offset = <0x0c>;
-		clocks = <&xtal24mhz>;
-	};
-	(...)
-};
-- 
2.23.0


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

* [PATCH 2/2] clk: versatile: Add device tree probing for IM-PD1 clocks
  2020-02-13 14:11 [PATCH 1/2] dt-bindings: clock: Create YAML schema for ICST clocks Linus Walleij
@ 2020-02-13 14:11 ` Linus Walleij
  2020-02-14  1:22   ` Stephen Boyd
  2020-02-13 20:39 ` [PATCH 1/2] dt-bindings: clock: Create YAML schema for ICST clocks Rob Herring
  1 sibling, 1 reply; 4+ messages in thread
From: Linus Walleij @ 2020-02-13 14:11 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, Linus Walleij

As we want to move these clocks over to probe from the device
tree we add a device tree probing path.

The old platform data path will be deleted once we have the
device tree overall code in place.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/clk/versatile/clk-impd1.c | 68 +++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/drivers/clk/versatile/clk-impd1.c b/drivers/clk/versatile/clk-impd1.c
index 1991f15a5db9..96b1018bcb7a 100644
--- a/drivers/clk/versatile/clk-impd1.c
+++ b/drivers/clk/versatile/clk-impd1.c
@@ -7,7 +7,9 @@
 #include <linux/clkdev.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/platform_device.h>
 #include <linux/platform_data/clk-integrator.h>
+#include <linux/module.h>
 
 #include "icst.h"
 #include "clk-icst.h"
@@ -175,3 +177,69 @@ void integrator_impd1_clk_exit(unsigned int id)
 	kfree(imc->pclkname);
 }
 EXPORT_SYMBOL_GPL(integrator_impd1_clk_exit);
+
+static void __init integrator_impd1_clk_spawn(struct device *dev,
+					      void __iomem *base,
+					      struct device_node *np)
+{
+	struct clk *clk = ERR_PTR(-EINVAL);
+	const char *clk_name = np->name;
+	const char *parent_name;
+	const struct clk_icst_desc *desc;
+
+	if (of_device_is_compatible(np, "arm,impd1-vco1")) {
+		dev_info(dev, "register VCO1\n");
+		desc = &impd1_icst1_desc;
+	} else if (of_device_is_compatible(np, "arm,impd1-vco2")) {
+		dev_info(dev, "register VCO2\n");
+		desc = &impd1_icst2_desc;
+	} else {
+		dev_err(dev, "not a clock node %s\n", np->name);
+		return;
+	}
+
+	of_property_read_string(np, "clock-output-names", &clk_name);
+
+	parent_name = of_clk_get_parent_name(np, 0);
+	clk = icst_clk_register(NULL, desc, clk_name, parent_name, base);
+	if (!IS_ERR(clk))
+		of_clk_add_provider(np, of_clk_src_simple_get, clk);
+}
+
+static int integrator_impd1_clk_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	struct device_node *child;
+	void __iomem *base;
+
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base)) {
+		dev_err(dev, "unable to remap syscon base\n");
+		return PTR_ERR(base);
+	}
+	dev_info(dev, "located syscon base\n");
+
+	for_each_available_child_of_node(np, child)
+		integrator_impd1_clk_spawn(dev, base, child);
+
+	return 0;
+}
+
+static const struct of_device_id impd1_syscon_match[] = {
+	{ .compatible = "arm,im-pd1-syscon", },
+	{}
+};
+
+static struct platform_driver impd1_clk_driver = {
+	.driver = {
+		.name = "impd1-clk",
+		.of_match_table = impd1_syscon_match,
+	},
+	.probe  = integrator_impd1_clk_probe,
+};
+builtin_platform_driver(impd1_clk_driver);
+
+MODULE_AUTHOR("Linus Walleij <linusw@kernel.org>");
+MODULE_DESCRIPTION("Arm IM-PD1 module clock driver");
+MODULE_LICENSE("GPL v2");
-- 
2.23.0


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

* Re: [PATCH 1/2] dt-bindings: clock: Create YAML schema for ICST clocks
  2020-02-13 14:11 [PATCH 1/2] dt-bindings: clock: Create YAML schema for ICST clocks Linus Walleij
  2020-02-13 14:11 ` [PATCH 2/2] clk: versatile: Add device tree probing for IM-PD1 clocks Linus Walleij
@ 2020-02-13 20:39 ` Rob Herring
  1 sibling, 0 replies; 4+ messages in thread
From: Rob Herring @ 2020-02-13 20:39 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Michael Turquette, Stephen Boyd, linux-clk, devicetree

On Thu, Feb 13, 2020 at 8:11 AM Linus Walleij <linus.walleij@linaro.org> wrote:
>
> The ICST clocks used in the ARM Integrator, Versatile and
> RealView platforms are updated to use YAML schema, and two
> new ICST clocks used by the Integrator IM-PD1 logical module
> are added in the process.
>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  .../bindings/clock/arm,syscon-icst.yaml       | 102 ++++++++++++++++++
>  .../bindings/clock/arm-integrator.txt         |  34 ------
>  .../bindings/clock/arm-syscon-icst.txt        |  70 ------------
>  3 files changed, 102 insertions(+), 104 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
>  delete mode 100644 Documentation/devicetree/bindings/clock/arm-integrator.txt
>  delete mode 100644 Documentation/devicetree/bindings/clock/arm-syscon-icst.txt
>
> diff --git a/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml b/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
> new file mode 100644
> index 000000000000..06c4d84e8c3d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
> @@ -0,0 +1,102 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/clock/arm,syscon-icst.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ARM System Conctroller ICST Clocks
> +
> +maintainers:
> +  - Linus Walleij <linusw@kernel.org>
> +
> +description: The ICS525 and ICS307 oscillators are produced by Integrated

Needs a literal block '|' to preserve formatting of your table below.

With that,

Reviewed-by: Rob Herring <robh@kernel.org>

> +  Devices Technology (IDT). ARM integrated these oscillators deeply into their
> +  reference designs by adding special control registers that manage such
> +  oscillators to their system controllers.
> +
> +  The various ARM system controllers contain logic to serialize and initialize
> +  an ICST clock request after a write to the 32 bit register at an offset
> +  into the system controller. Furthermore, to even be able to alter one of
> +  these frequencies, the system controller must first be unlocked by
> +  writing a special token to another offset in the system controller.
> +
> +  Some ARM hardware contain special versions of the serial interface that only
> +  connects the low 8 bits of the VDW (missing one bit), hardwires RDW to
> +  different values and sometimes also hardwire the output divider. They
> +  therefore have special compatible strings as per this table (the OD value is
> +  the value on the pins, not the resulting output divider).
> +
> +  In the core modules and logic tiles, the ICST is a configurable clock fed
> +  from a 24 MHz clock on the motherboard (usually the main crystal) used for
> +  generating e.g. video clocks. It is located on the core module and there is
> +  only one of these. This clock node must be a subnode of the core module.
> +
> +  Hardware variant         RDW     OD          VDW
> +
> +  Integrator/AP            22      1           Bit 8 0, rest variable
> +  integratorap-cm
> +
> +  Integrator/AP            46      3           Bit 8 0, rest variable
> +  integratorap-sys
> +
> +  Integrator/AP            22 or   1           17 or (33 or 25 MHz)
> +  integratorap-pci         14      1           14
> +
> +  Integrator/CP            22      variable    Bit 8 0, rest variable
> +  integratorcp-cm-core
> +
> +  Integrator/CP            22      variable    Bit 8 0, rest variable
> +  integratorcp-cm-mem
> +
> +  The ICST oscillator must be provided inside a system controller node.
> +
> +properties:
> +  "#clock-cells":
> +    const: 0
> +
> +  compatible:
> +    enum:
> +      - arm,syscon-icst525
> +      - arm,syscon-icst307
> +      - arm,syscon-icst525-integratorap-cm
> +      - arm,syscon-icst525-integratorap-sys
> +      - arm,syscon-icst525-integratorap-pci
> +      - arm,syscon-icst525-integratorcp-cm-core
> +      - arm,syscon-icst525-integratorcp-cm-mem
> +      - arm,integrator-cm-auxosc
> +      - arm,versatile-cm-auxosc
> +      - arm,impd-vco1
> +      - arm,impd-vco2
> +
> +  clocks:
> +    description: Parent clock for the ICST VCO
> +    maxItems: 1
> +
> +  clock-output-names:
> +    maxItems: 1
> +
> +  lock-offset:
> +    $ref: '/schemas/types.yaml#/definitions/uint32'
> +    description: Offset to the unlocking register for the oscillator
> +
> +  vco-offset:
> +    $ref: '/schemas/types.yaml#/definitions/uint32'
> +    description: Offset to the VCO register for the oscillator
> +
> +required:
> +  - "#clock-cells"
> +  - compatible
> +  - clocks
> +
> +examples:
> +  - |
> +    vco1: clock@00 {
> +      compatible = "arm,impd1-vco1";
> +      #clock-cells = <0>;
> +      lock-offset = <0x08>;
> +      vco-offset = <0x00>;
> +      clocks = <&sysclk>;
> +      clock-output-names = "IM-PD1-VCO1";
> +    };
> +
> +...
> diff --git a/Documentation/devicetree/bindings/clock/arm-integrator.txt b/Documentation/devicetree/bindings/clock/arm-integrator.txt
> deleted file mode 100644
> index 11f5f95f571b..000000000000
> --- a/Documentation/devicetree/bindings/clock/arm-integrator.txt
> +++ /dev/null
> @@ -1,34 +0,0 @@
> -Clock bindings for ARM Integrator and Versatile Core Module clocks
> -
> -Auxiliary Oscillator Clock
> -
> -This is a configurable clock fed from a 24 MHz chrystal,
> -used for generating e.g. video clocks. It is located on the
> -core module and there is only one of these.
> -
> -This clock node *must* be a subnode of the core module, since
> -it obtains the base address for it's address range from its
> -parent node.
> -
> -
> -Required properties:
> -- compatible: must be "arm,integrator-cm-auxosc" or "arm,versatile-cm-auxosc"
> -- #clock-cells: must be <0>
> -
> -Optional properties:
> -- clocks: parent clock(s)
> -
> -Example:
> -
> -core-module@10000000 {
> -       xtal24mhz: xtal24mhz@24M {
> -               #clock-cells = <0>;
> -               compatible = "fixed-clock";
> -               clock-frequency = <24000000>;
> -       };
> -       auxosc: cm_aux_osc@25M {
> -               #clock-cells = <0>;
> -               compatible = "arm,integrator-cm-auxosc";
> -               clocks = <&xtal24mhz>;
> -       };
> -};
> diff --git a/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt b/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt
> deleted file mode 100644
> index 4cd81742038f..000000000000
> --- a/Documentation/devicetree/bindings/clock/arm-syscon-icst.txt
> +++ /dev/null
> @@ -1,70 +0,0 @@
> -ARM System Controller ICST clocks
> -
> -The ICS525 and ICS307 oscillators are produced by Integrated Devices
> -Technology (IDT). ARM integrated these oscillators deeply into their
> -reference designs by adding special control registers that manage such
> -oscillators to their system controllers.
> -
> -The various ARM system controllers contain logic to serialize and initialize
> -an ICST clock request after a write to the 32 bit register at an offset
> -into the system controller. Furthermore, to even be able to alter one of
> -these frequencies, the system controller must first be unlocked by
> -writing a special token to another offset in the system controller.
> -
> -Some ARM hardware contain special versions of the serial interface that only
> -connects the low 8 bits of the VDW (missing one bit), hardwires RDW to
> -different values and sometimes also hardwire the output divider. They
> -therefore have special compatible strings as per this table (the OD value is
> -the value on the pins, not the resulting output divider):
> -
> -Hardware variant:        RDW     OD          VDW
> -
> -Integrator/AP            22      1           Bit 8 0, rest variable
> -integratorap-cm
> -
> -Integrator/AP            46      3           Bit 8 0, rest variable
> -integratorap-sys
> -
> -Integrator/AP            22 or   1           17 or (33 or 25 MHz)
> -integratorap-pci         14      1           14
> -
> -Integrator/CP            22      variable    Bit 8 0, rest variable
> -integratorcp-cm-core
> -
> -Integrator/CP            22      variable    Bit 8 0, rest variable
> -integratorcp-cm-mem
> -
> -The ICST oscillator must be provided inside a system controller node.
> -
> -Required properties:
> -- compatible: must be one of
> -  "arm,syscon-icst525"
> -  "arm,syscon-icst307"
> -  "arm,syscon-icst525-integratorap-cm"
> -  "arm,syscon-icst525-integratorap-sys"
> -  "arm,syscon-icst525-integratorap-pci"
> -  "arm,syscon-icst525-integratorcp-cm-core"
> -  "arm,syscon-icst525-integratorcp-cm-mem"
> -- lock-offset: the offset address into the system controller where the
> -  unlocking register is located
> -- vco-offset: the offset address into the system controller where the
> -  ICST control register is located (even 32 bit address)
> -- #clock-cells: must be <0>
> -- clocks: parent clock, since the ICST needs a parent clock to derive its
> -  frequency from, this attribute is compulsory.
> -
> -Example:
> -
> -syscon: syscon@10000000 {
> -       compatible = "syscon";
> -       reg = <0x10000000 0x1000>;
> -
> -       oscclk0: osc0@c {
> -               compatible = "arm,syscon-icst307";
> -               #clock-cells = <0>;
> -               lock-offset = <0x20>;
> -               vco-offset = <0x0c>;
> -               clocks = <&xtal24mhz>;
> -       };
> -       (...)
> -};
> --
> 2.23.0
>

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

* Re: [PATCH 2/2] clk: versatile: Add device tree probing for IM-PD1 clocks
  2020-02-13 14:11 ` [PATCH 2/2] clk: versatile: Add device tree probing for IM-PD1 clocks Linus Walleij
@ 2020-02-14  1:22   ` Stephen Boyd
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2020-02-14  1:22 UTC (permalink / raw)
  To: Linus Walleij, Michael Turquette, Stephen Boyd; +Cc: linux-clk, Linus Walleij

Quoting Linus Walleij (2020-02-13 06:11:19)
> diff --git a/drivers/clk/versatile/clk-impd1.c b/drivers/clk/versatile/clk-impd1.c
> index 1991f15a5db9..96b1018bcb7a 100644
> --- a/drivers/clk/versatile/clk-impd1.c
> +++ b/drivers/clk/versatile/clk-impd1.c
> @@ -175,3 +177,69 @@ void integrator_impd1_clk_exit(unsigned int id)
>         kfree(imc->pclkname);
>  }
>  EXPORT_SYMBOL_GPL(integrator_impd1_clk_exit);
> +
> +static void __init integrator_impd1_clk_spawn(struct device *dev,

Remove __init. Kinda surprised that compile didn't complain about that.

> +                                             void __iomem *base,
> +                                             struct device_node *np)
> +{
> +       struct clk *clk = ERR_PTR(-EINVAL);
> +       const char *clk_name = np->name;
> +       const char *parent_name;
> +       const struct clk_icst_desc *desc;
> +
> +       if (of_device_is_compatible(np, "arm,impd1-vco1")) {
> +               dev_info(dev, "register VCO1\n");
> +               desc = &impd1_icst1_desc;
> +       } else if (of_device_is_compatible(np, "arm,impd1-vco2")) {
> +               dev_info(dev, "register VCO2\n");

Do we need these dev_infos()?

> +               desc = &impd1_icst2_desc;
> +       } else {
> +               dev_err(dev, "not a clock node %s\n", np->name);
> +               return;
> +       }
> +
> +       of_property_read_string(np, "clock-output-names", &clk_name);

Can you use the new way of specifying parents so that this can be parsed
by the core framework?

> +
> +       parent_name = of_clk_get_parent_name(np, 0);
> +       clk = icst_clk_register(NULL, desc, clk_name, parent_name, base);
> +       if (!IS_ERR(clk))
> +               of_clk_add_provider(np, of_clk_src_simple_get, clk);

Can you add a hw provider? Maybe in a followup patch?

> +}
> +
> +static int integrator_impd1_clk_probe(struct platform_device *pdev)
> +{
> +       struct device *dev = &pdev->dev;
> +       struct device_node *np = dev->of_node;
> +       struct device_node *child;
> +       void __iomem *base;
> +
> +       base = devm_platform_ioremap_resource(pdev, 0);
> +       if (IS_ERR(base)) {
> +               dev_err(dev, "unable to remap syscon base\n");
> +               return PTR_ERR(base);
> +       }
> +       dev_info(dev, "located syscon base\n");

More debug?

> +
> +       for_each_available_child_of_node(np, child)
> +               integrator_impd1_clk_spawn(dev, base, child);
> +
> +       return 0;
> +}
> +
> +static const struct of_device_id impd1_syscon_match[] = {
> +       { .compatible = "arm,im-pd1-syscon", },
> +       {}
> +};
> +

Add a module device table?

> +static struct platform_driver impd1_clk_driver = {
> +       .driver = {
> +               .name = "impd1-clk",
> +               .of_match_table = impd1_syscon_match,
> +       },
> +       .probe  = integrator_impd1_clk_probe,
> +};
> +builtin_platform_driver(impd1_clk_driver);
> +

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-13 14:11 [PATCH 1/2] dt-bindings: clock: Create YAML schema for ICST clocks Linus Walleij
2020-02-13 14:11 ` [PATCH 2/2] clk: versatile: Add device tree probing for IM-PD1 clocks Linus Walleij
2020-02-14  1:22   ` Stephen Boyd
2020-02-13 20:39 ` [PATCH 1/2] dt-bindings: clock: Create YAML schema for ICST clocks Rob Herring

Linux-Clk Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-clk/0 linux-clk/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-clk linux-clk/ https://lore.kernel.org/linux-clk \
		linux-clk@vger.kernel.org
	public-inbox-index linux-clk

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-clk


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git