Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions Documentation/devicetree/bindings/clock/qcom,clk-gp-mnd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/qcom,clk-gp-mnd.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Qualcomm Peripheral Web's PDM GP_MN Clock Divider

maintainers:
- Taniya Das <taniya.das@oss.qualcomm.com>

description: |
The Peripheral Web's PDM GP_MN clock divider receives an input clock
(TCXO4) with frequency Fin and generates an output clock with
frequency Fout = Fin * (M / N) and a duty cycle controlled by D
and routed over a gpio pin.

The divider is configured using three registers:

- GP_MN_CLK_MDIV: holds the M value.
- GP_MN_CLK_NDIV: holds the ones complement of (N - M).
- GP_MN_CLK_DUTY: holds the D value.

For every N input clock cycles the GP_MN produces M output clock
cycles. D is the number of native clock cycles in which the GP_MN
output is low, counted over 2^13 native clock cycles.

Hardware constraints:

M <= 511
N <= 8191
N > 2 * M
M < D < (N - M)
M and N must be coprime (no common divisor)

properties:
compatible:
const: qcom,clk-gp-mnd

reg:
maxItems: 1

clocks:
items:
- description: PDM XO4 source clock
- description: PDM AHB bus clock for register access

clock-names:
items:
- const: pdm_clk
- const: ahb_clk

'#clock-cells':
const: 0

clock-output-names:
maxItems: 1

pinctrl-0:
description: Pin configuration for the GP_MN output in the active state.

pinctrl-names:
items:
- const: active

assigned-clocks:
maxItems: 1
description: Parent clock phandle used to set the input frequency.

assigned-clock-rates:
maxItems: 1
description: |
Rate for the parent clock in Hz.
Supported rates: 19200000, 9600000, 6400000, 4800000.

required:
- compatible
- reg
- clocks
- clock-names
- '#clock-cells'
- clock-output-names
- pinctrl-0
- pinctrl-names
- assigned-clocks
- assigned-clock-rates

additionalProperties: false

examples:
- |
#include <dt-bindings/clock/qcom,gcc-sdm845.h>
gp_mn: clock-controller@88d3000 {
compatible = "qcom,clk-gp-mnd";
reg = <0x88d3000 0xc>;
clocks = <&gcc GCC_PDM_XO4_CLK>,
<&gcc GCC_PDM_AHB_CLK>;
clock-names = "pdm_clk", "ahb_clk";
clock-output-names = "gp_mn_clk";
pinctrl-0 = <&gp_mn_pin_active>;
pinctrl-names = "active";
assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
assigned-clock-rates = <4800000>;
#clock-cells = <0>;
};
21 changes: 21 additions & 0 deletions arch/arm64/boot/dts/qcom/lemans.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -4045,6 +4045,20 @@
};
};

gp_mn: clock-controller@88d3000 {
compatible = "qcom,clk-gp-mnd";
reg = <0x0 0x088d3000 0x0 0xc>;
clocks = <&gcc GCC_PDM_XO4_CLK>,
<&gcc GCC_PDM_AHB_CLK>;
clock-names = "pdm_clk", "ahb_clk";
clock-output-names = "gp_mn_clk";
#clock-cells = <0>;
pinctrl-names = "active";
pinctrl-0 = <&gp_mn_active>;
assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
assigned-clock-rates = <4800000>;
};

usb_0_hsphy: phy@88e4000 {
compatible = "qcom,sa8775p-usb-hs-phy",
"qcom,usb-snps-hs-5nm-phy";
Expand Down Expand Up @@ -5646,6 +5660,13 @@
bias-disable;
};

gp_mn_active: gp_mn_active-state {
pins = "gpio35";
function = "gp_mn";
drive-strength = <2>;
bias-disable;
};

hs0_mi2s_active: hs0-mi2s-active-state {
pins = "gpio114", "gpio115", "gpio116", "gpio117";
function = "hs0_mi2s";
Expand Down
21 changes: 21 additions & 0 deletions arch/arm64/boot/dts/qcom/monaco.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -4803,6 +4803,20 @@
};
};

gp_mn: clock-controller@88d3000 {
compatible = "qcom,clk-gp-mnd";
reg = <0x0 0x088d3000 0x0 0xc>;
clocks = <&gcc GCC_PDM_XO4_CLK>,
<&gcc GCC_PDM_AHB_CLK>;
clock-names = "pdm_clk", "ahb_clk";
clock-output-names = "gp_mn_clk";
#clock-cells = <0>;
pinctrl-names = "active";
pinctrl-0 = <&gp_mn_active>;
assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
assigned-clock-rates = <4800000>;
};

usb_1_hsphy: phy@8904000 {
compatible = "qcom,qcs8300-usb-hs-phy",
"qcom,usb-snps-hs-7nm-phy";
Expand Down Expand Up @@ -6269,6 +6283,13 @@
bias-disable;
};

gp_mn_active: gp_mn_active-state {
pins = "gpio32";
function = "gp_mn";
drive-strength = <2>;
bias-disable;
};

hs0_mi2s_active: hs0-mi2s-active-state {
pins = "gpio106", "gpio107", "gpio108", "gpio109";
function = "hs0_mi2s";
Expand Down
21 changes: 21 additions & 0 deletions arch/arm64/boot/dts/qcom/sc7280.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -4347,6 +4347,20 @@
usb-role-switch;
};

gp_mn: clock-controller@88d3000 {
compatible = "qcom,clk-gp-mnd";
reg = <0x0 0x088d3000 0x0 0xc>;
clocks = <&gcc GCC_PDM_XO4_CLK>,
<&gcc GCC_PDM_AHB_CLK>;
clock-names = "pdm_clk", "ahb_clk";
clock-output-names = "gp_mn_clk";
#clock-cells = <0>;
pinctrl-names = "active";
pinctrl-0 = <&gp_mn_active>;
assigned-clocks = <&gcc GCC_PDM_XO4_CLK>;
assigned-clock-rates = <4800000>;
};

qspi: spi@88dc000 {
compatible = "qcom,sc7280-qspi", "qcom,qspi-v1";
reg = <0 0x088dc000 0 0x1000>;
Expand Down Expand Up @@ -5852,6 +5866,13 @@
function = "edp_hot";
};

gp_mn_active: gp_mn_active-state {
pins = "gpio35";
function = "gp_mn";
drive-strength = <2>;
bias-disable;
};

mi2s0_data0: mi2s0-data0-state {
pins = "gpio98";
function = "mi2s0_data0";
Expand Down
15 changes: 15 additions & 0 deletions drivers/clk/qcom/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1635,4 +1635,19 @@ config SM_VIDEOCC_8450
SM8450 or SM8475 devices.
Say Y if you want to support video devices and functionality such as
video encode/decode.

config QCOM_CLK_GP_MND
tristate "Qualcomm PDM GP_MN clock divider"
depends on ARM64 || COMPILE_TEST
help
Support for the Qualcomm PDM GP_MN clock divider found in PDM
(Pulse Density Modulation) hardware blocks.
Given an input clock of frequency Fin (TCXO4), the output
frequency is Fout = Fin * (M / N). For every N input cycles
the divider produces M output cycles. D controls the duty
cycle: it is the number of native clock cycles in which the
GP_MN output is low, counted over 8192 native clock cycles.

Say Y or M if you want to support GP_MN-based frequency and
duty-cycle configuration on Qualcomm SoCs.
endif
1 change: 1 addition & 0 deletions drivers/clk/qcom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ obj-$(CONFIG_SM_VIDEOCC_8450) += videocc-sm8450.o
obj-$(CONFIG_SM_VIDEOCC_8550) += videocc-sm8550.o
obj-$(CONFIG_SM_VIDEOCC_MILOS) += videocc-milos.o
obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
obj-$(CONFIG_QCOM_CLK_GP_MND) += clk-gp-mnd.o
obj-$(CONFIG_KPSS_XCC) += kpss-xcc.o
obj-$(CONFIG_QCOM_HFPLL) += hfpll.o
obj-$(CONFIG_KRAITCC) += krait-cc.o
Loading