Skip to contentSkip to conversation

clk: qcom: Add spmi_pmic clock divider support

PATCH Superseded Tirupathi Reddy 2 participants 3 messages Sep 6, 2017 – Sep 18, 2017

Subsystems (4)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 clk: qcom: Add spmi_pmic clock divider support

Clkdiv module provides a clock output on the PMIC with CXO as the source. This clock can be routed through PMIC GPIOs. Add a device driver to configure this clkdiv module.

---
 .../bindings/clock/clk-spmi-pmic-div.txt           |  51 +++
 drivers/clk/qcom/Kconfig                           |   9 +
 drivers/clk/qcom/Makefile                          |   1 +
 drivers/clk/qcom/clk-spmi-pmic-div.c               | 342 +++++++++++++++++++++
 4 files changed, 403 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt
 create mode 100644 drivers/clk/qcom/clk-spmi-pmic-div.c
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +51 -0
new file mode 100644
index 0000000..8b84b32
@@ -0,0 +1,51 @@
+Qualcomm Technologies, Inc. SPMI PMIC clock divider (clkdiv)
+
+clkdiv configures the clock frequency of a set of outputs on the PMIC.
+These clocks are typically wired through alternate functions on
+gpio pins.
+
+=======================
+Properties
+=======================
+
+- compatible
+	Usage:      required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,spmi-clkdiv"
+		    "qcom,pm8998-clkdiv"
+
+- reg
+	Usage:      required
+	Value type: <prop-encoded-array>
+	Definition: Addresses and sizes for the memory of this CLKDIV
+		    peripheral.
+
+- clocks:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: reference to the xo clock.
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "xo".
+
+=======
+Example
+=======
+
+pm8998_clk_divs: qcom,clkdiv@5b00 {
+	compatible = "qcom,pm8998-clkdiv";
+	reg = <0x5b00>;
+	#clock-cells = <1>;
+	clocks = <&xo_board>;
+	clock-names = "xo";
+
+	assigned-clocks = <&pm8998_clk_divs 1>,
+			  <&pm8998_clk_divs 2>,
+			  <&pm8998_clk_divs 3>;
+	assigned-clock-rates = <9600000>,
+			       <9600000>,
+			       <9600000>;
+};
drivers/clk/qcom/Kconfig +9 -0
index 9f6c278..dd5b18e 100644
@@ -196,3 +196,12 @@ config MSM_MMCC_8996
 	  Support for the multimedia clock controller on msm8996 devices.
 	  Say Y if you want to support multimedia devices such as display,
 	  graphics, video encode/decode, camera, etc.
+
+config SPMI_PMIC_CLKDIV
+	tristate "spmi pmic clkdiv driver"
+	depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TEST
+	help
+	  This driver supports the clkdiv functionality on the Qualcomm
+	  Technologies, Inc. SPMI PMIC. It configures the frequency of
+	  clkdiv outputs on the PMIC. These clocks are typically wired
+	  through alternate functions on gpio pins.
drivers/clk/qcom/Makefile +1 -0
index 3f3aff2..4d4c62b 100644
@@ -33,3 +33,4 @@ obj-$(CONFIG_MSM_MMCC_8974) += mmcc-msm8974.o
 obj-$(CONFIG_MSM_MMCC_8996) += mmcc-msm8996.o
 obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o
 obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o
+obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
drivers/clk/qcom/clk-spmi-pmic-div.c new file +342 -0

342 lines not on this page · raw message

Signature · 1 line
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
maintainer
#1 lore raw
Quoted 25 lines · Tirupathi Reddy

Clkdiv module provides a clock output on the PMIC with CXO as the source. This clock can be routed through PMIC GPIOs. Add a device driver to configure this clkdiv module.

---
 .../bindings/clock/clk-spmi-pmic-div.txt           |  51 +++
 drivers/clk/qcom/Kconfig                           |   9 +
 drivers/clk/qcom/Makefile                          |   1 +
 drivers/clk/qcom/clk-spmi-pmic-div.c               | 342 +++++++++++++++++++++
 4 files changed, 403 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt
 create mode 100644 drivers/clk/qcom/clk-spmi-pmic-div.c
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +5 -0
new file mode 100644
index 0000000..8b84b32
@@ -0,0 +1,51 @@
+Qualcomm Technologies, Inc. SPMI PMIC clock divider (clkdiv)
+
+clkdiv configures the clock frequency of a set of outputs on the PMIC.
+These clocks are typically wired through alternate functions on
+gpio pins.

Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +10 -0
+
+=======================
+Properties
+=======================
+
+- compatible
+	Usage:      required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,spmi-clkdiv"

If this is not a fallback, drop it.

Quoted 7 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +7 -0
+		    "qcom,pm8998-clkdiv"
+
+- reg
+	Usage:      required
+	Value type: <prop-encoded-array>
+	Definition: Addresses and sizes for the memory of this CLKDIV
+		    peripheral.

Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt line 32

Quoted 10 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +10 -0
+
+- clocks:
+	Usage: required
+	Value type: <prop-encoded-array>
+	Definition: reference to the xo clock.
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "xo".

Missing #clock-cells

Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt line 38

Quoted 6 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +6 -0
+
+=======
+Example
+=======
+
+pm8998_clk_divs: qcom,clkdiv@5b00 {

clock@5b00

Quoted 13 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +13 -0
+	compatible = "qcom,pm8998-clkdiv";
+	reg = <0x5b00>;
+	#clock-cells = <1>;
+	clocks = <&xo_board>;
+	clock-names = "xo";
+
+	assigned-clocks = <&pm8998_clk_divs 1>,
+			  <&pm8998_clk_divs 2>,
+			  <&pm8998_clk_divs 3>;
+	assigned-clock-rates = <9600000>,
+			       <9600000>,
+			       <9600000>;
+};
#2 lore raw
Quoted 29 lines · Rob Herring
Quoted 28 lines · Tirupathi Reddy

Clkdiv module provides a clock output on the PMIC with CXO as the source. This clock can be routed through PMIC GPIOs. Add a device driver to configure this clkdiv module.

---
  .../bindings/clock/clk-spmi-pmic-div.txt           |  51 +++
  drivers/clk/qcom/Kconfig                           |   9 +
  drivers/clk/qcom/Makefile                          |   1 +
  drivers/clk/qcom/clk-spmi-pmic-div.c               | 342 +++++++++++++++++++++
  4 files changed, 403 insertions(+)

create mode 100644 Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt create mode 100644 drivers/clk/qcom/clk-spmi-pmic-div.c

Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +8 -0
new file mode 100644
index 0000000..8b84b32
@@ -0,0 +1,51 @@
+Qualcomm Technologies, Inc. SPMI PMIC clock divider (clkdiv)
+
+clkdiv configures the clock frequency of a set of outputs on the PMIC.
+These clocks are typically wired through alternate functions on
+gpio pins.
+
+=======================
+Properties
Quoted 8 lines

Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt line 15

Quoted 7 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +7 -0
+=======================
+
+- compatible
+	Usage:      required
+	Value type: <string>
+	Definition: must be one of:
+		    "qcom,spmi-clkdiv"

If this is not a fallback, drop it.

Here "qcom,spmi-clkdiv" is used as generic string for registering only one clk and the pmic specific strings are used for registering more than one clk following the given base address in "reg" property.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +10 -0
+		    "qcom,pm8998-clkdiv"
+
+- reg
+	Usage:      required
+	Value type: <prop-encoded-array>
+	Definition: Addresses and sizes for the memory of this CLKDIV
+		    peripheral.
+
+- clocks:
+	Usage: required
Quoted 8 lines

Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt line 32

Quoted 7 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +7 -0
+	Value type: <prop-encoded-array>
+	Definition: reference to the xo clock.
+
+- clock-names:
+	Usage: required
+	Value type: <stringlist>
+	Definition: must be "xo".

Missing #clock-cells

Added in next patch set.

Quoted 8 lines

Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt line 38

Quoted 7 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +6 -0
+
+=======
+Example
+=======
+
+pm8998_clk_divs: qcom,clkdiv@5b00 {

clock@5b00

Addressed in next patch.

Quoted 14 lines
Quoted 14 lines
Documentation/devicetree/bindings/clock/clk-spmi-pmic-div.txt new file +13 -0
+	compatible = "qcom,pm8998-clkdiv";
+	reg = <0x5b00>;
+	#clock-cells = <1>;
+	clocks = <&xo_board>;
+	clock-names = "xo";
+
+	assigned-clocks = <&pm8998_clk_divs 1>,
+			  <&pm8998_clk_divs 2>,
+			  <&pm8998_clk_divs 3>;
+	assigned-clock-rates = <9600000>,
+			       <9600000>,
+			       <9600000>;
+};