clk: qcom: Support for Low Power Audio Clocks on SC7180
v2 cover clk: qcom: Support for Low Power Audio Clocks on SC7180
[v2]
* Update retention macro name.
* Update the register description in the documentation.
[v1]
* Add support for Retention of GDSCR.
* Add YAML schema for LPASS clocks and clock IDs for LPASS.
* Add clock driver for LPASS core clocks and GCC LPASS clock.
Taniya Das (4):
clk: qcom: gdsc: Add support to enable retention of GSDCR
dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7180
clk: qcom: gcc: Add support for GCC LPASS clock for SC7180
clk: qcom: lpass: Add support for LPASS clock controller for SC7180
.../bindings/clock/qcom,sc7180-lpasscorecc.yaml | 101 +++++ drivers/clk/qcom/Kconfig | 9 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/gcc-sc7180.c | 14 + drivers/clk/qcom/gdsc.c | 12 + drivers/clk/qcom/gdsc.h | 1 + drivers/clk/qcom/lpasscorecc-sc7180.c | 479 +++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-sc7180.h | 1 + .../dt-bindings/clock/qcom,lpasscorecc-sc7180.h | 29 ++ 9 files changed, 647 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml create mode 100644 drivers/clk/qcom/lpasscorecc-sc7180.c create mode 100644 include/dt-bindings/clock/qcom,lpasscorecc-sc7180.h
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH v2 1/4 clk: qcom: gdsc: Add support to enable retention of GSDCR
Add support for the RETAIN_FF_ENABLE feature which enables the usage of retention registers. These registers maintain their state after disabling and re-enabling a GDSC.
--- drivers/clk/qcom/gdsc.c | 12 ++++++++++++ drivers/clk/qcom/gdsc.h | 1 + 2 files changed, 13 insertions(+)
drivers/clk/qcom/gdsc.c +12 -0
@@ -28,6 +28,7 @@/* CFG_GDSCR */ #define GDSC_POWER_UP_COMPLETE BIT(16)#define GDSC_POWER_DOWN_COMPLETE BIT(15) +#define GDSC_RETAIN_FF_ENABLE BIT(11)#define CFG_GDSCR_OFFSET 0x4/* Wait 2^n CXO cycles between all states. Here, n=2 (4 cycles). */
@@ -202,6 +203,14 @@ static inline void gdsc_assert_reset_aon(struct gdsc *sc)regmap_update_bits (sc->regmap, sc->clamp_io_ctrl,GMEM_RESET_MASK ,0 ); } + +static void gdsc_retain_ff_on (struct gdsc *sc) +{ +u32 mask =GDSC_RETAIN_FF_ENABLE ; + +regmap_update_bits (sc->regmap, sc->gdscr, mask, mask); +} +static int gdsc_enable (struct generic_pm_domain *domain) {struct gdsc *sc =domain_to_gdsc (domain);
@@ -254,6 +263,9 @@ static int gdsc_enable(struct generic_pm_domain *domain)udelay (1 ); } +if (sc->flags &RETAIN_FF_ENABLE ) +gdsc_retain_ff_on (sc); +return 0 ; }
drivers/clk/qcom/gdsc.h +1 -0
@@ -49,6 +49,7 @@ struct gdsc {#define AON_RESET BIT(4)#define POLL_CFG_GDSCR BIT(5)#define ALWAYS_ON BIT(6) +#define RETAIN_FF_ENABLE BIT(7)struct reset_controller_dev *rcdev;unsigned int *resets;unsigned int reset_count;
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH v2 2/4 dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7180
In reply to Taniya DasThe LPASS(Low Power Audio Subsystem) clock provider have a bunch of generic properties that are needed in a device tree. Also add clock ids for GCC LPASS and LPASS Core clock IDs for LPASS client to request for the clocks.
--- .../bindings/clock/qcom,sc7180-lpasscorecc.yaml | 101 +++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-sc7180.h | 1 + .../dt-bindings/clock/qcom,lpasscorecc-sc7180.h | 29 ++++++ 3 files changed, 131 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml create mode 100644 include/dt-bindings/clock/qcom,lpasscorecc-sc7180.h
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +101 -0
@@ -0,0 +1,101 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/qcom,sc7180-lpasscorecc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm LPASS Core Clock Controller Binding for SC7180 + +maintainers: + - Taniya Das <[email protected]> + +description: | + Qualcomm LPASS core clock control module which supports the clocks and + power domains on SC7180. + + See also: + - dt-bindings/clock/qcom,lpasscorecc-sc7180.h + +properties: + compatible: + enum: + - qcom,sc7180-lpasshm + - qcom,sc7180-lpasscorecc + + clocks: + items: + - description: gcc_lpass_sway clock from GCC + + clock-names: + items: + - const: gcc_lpass_sway + + power-domains: + items: + - description: LPASS CORE HM GSDCR + + '#clock-cells': + const: 1 + + '#power-domain-cells': + const: 1 + + reg: + minItems: 1 + maxItems: 2 + items: + - description: lpass audio cc register + - description: lpass core cc register + + reg-names: + items: + - const: lpass_core_cc + - const: lpass_audio_cc + +if: + properties: + compatible: + contains: + const: qcom,sc7180-lpasshm +then: + properties: + reg: + items: + - description: lpass hm core register + +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + - '#power-domain-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/qcom,gcc-sc7180.h> + #include <dt-bindings/clock/qcom,lpasscorecc-sc7180.h> + clock-controller@63000000 { + compatible = "qcom,sc7180-lpasshm"; + reg = <0 0x63000000 0 0x28>; + clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>; + clock-names = "gcc_lpass_sway"; + #clock-cells = <1>; + #power-domain-cells = <1>; + }; + + - | + clock-controller@62d00000 { + compatible = "qcom,sc7180-lpasscorecc"; + reg = <0 0x62d00000 0 0x50000>, + <0 0x62780000 0 0x30000>; + reg-names = "lpass_core_cc", "lpass_audio_cc"; + clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>; + clock-names = "gcc_lpass_sway"; + power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>; + #clock-cells = <1>; + #power-domain-cells = <1>; + }; +...
include/dt-bindings/clock/qcom,gcc-sc7180.h +1 -0
@@ -137,6 +137,7 @@#define GCC_MSS_NAV_AXI_CLK 127#define GCC_MSS_Q6_MEMNOC_AXI_CLK 128#define GCC_MSS_SNOC_AXI_CLK 129 +#define GCC_LPASS_CFG_NOC_SWAY_CLK 130/* GCC resets */ #define GCC_QUSB2PHY_PRIM_BCR 0
include/dt-bindings/clock/qcom,lpasscorecc-sc7180.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) 2020, The Linux Foundation. All rights reserved. +*/ + +#ifndef _DT_BINDINGS_CLK_QCOM_LPASS_CORE_CC_SC7180_H +#define _DT_BINDINGS_CLK_QCOM_LPASS_CORE_CC_SC7180_H + +/* LPASS_CORE_CC clocks */ +#define LPASS_LPAAUDIO_DIG_PLL 0 +#define LPASS_LPAAUDIO_DIG_PLL_OUT_ODD 1 +#define CORE_CLK_SRC 2 +#define EXT_MCLK0_CLK_SRC 3 +#define LPAIF_PRI_CLK_SRC 4 +#define LPAIF_SEC_CLK_SRC 5 +#define LPASS_AUDIO_CORE_CORE_CLK 6 +#define LPASS_AUDIO_CORE_EXT_MCLK0_CLK 7 +#define LPASS_AUDIO_CORE_LPAIF_PRI_IBIT_CLK 8 +#define LPASS_AUDIO_CORE_LPAIF_SEC_IBIT_CLK 9 +#define LPASS_AUDIO_CORE_SYSNOC_MPORT_CORE_CLK 10 + +/* LPASS Core power domains */ +#define LPASS_CORE_HM_GDSCR 0 + +/* LPASS Audio power domains */ +#define LPASS_AUDIO_HM_GDSCR 0 +#define LPASS_PDC_HM_GDSCR 1 + +#endif
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
Stephen Boyd
maintainerRe: [PATCH v2 2/4] dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7180
Quoting Taniya Das (2020-05-17 02:22:22)
Quoted 27 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +21
-0@@ -0,0 +1,101 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/qcom,sc7180-lpasscorecc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm LPASS Core Clock Controller Binding for SC7180 + +maintainers: + - Taniya Das <[email protected]> + +description: | + Qualcomm LPASS core clock control module which supports the clocks and + power domains on SC7180. + + See also: + - dt-bindings/clock/qcom,lpasscorecc-sc7180.h + +properties: + compatible: + enum:
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 31
Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +10
-0+ - qcom,sc7180-lpasshm + - qcom,sc7180-lpasscorecc + + clocks: + items: + - description: gcc_lpass_sway clock from GCC + + clock-names: + items: + - const: gcc_lpass_sway
As said on patch #4, maybe "iface" instead?
Quoted 5 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +5
-0+ + power-domains: + items: + - description: LPASS CORE HM GSDCR +
Re: [PATCH v2 2/4] dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7180
Thanks for the review.
Quoted 10 lines · Stephen Boyd
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 31
Quoted 7 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +7
-0+ clocks: + items: + - description: gcc_lpass_sway clock from GCC + + clock-names: + items: + - const: gcc_lpass_swayAs said on patch #4, maybe "iface" instead?
Will take care in the next patch.
Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +5
-0+ + power-domains: + items: + - description: LPASS CORE HM GSDCR +
Signature · 4 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation. --
Rob Herring
maintainerRe: [PATCH v2 2/4] dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7180
In reply to Taniya DasQuoted 44 lines · Taniya Das
The LPASS(Low Power Audio Subsystem) clock provider have a bunch of generic properties that are needed in a device tree. Also add clock ids for GCC LPASS and LPASS Core clock IDs for LPASS client to request for the clocks.
Signed-off-by Taniya Das <[email protected]>--- .../bindings/clock/qcom,sc7180-lpasscorecc.yaml | 101 +++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-sc7180.h | 1 + .../dt-bindings/clock/qcom,lpasscorecc-sc7180.h | 29 ++++++ 3 files changed, 131 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml create mode 100644 include/dt-bindings/clock/qcom,lpasscorecc-sc7180.hDocumentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +25
-0@@ -0,0 +1,101 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/qcom,sc7180-lpasscorecc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm LPASS Core Clock Controller Binding for SC7180 + +maintainers: + - Taniya Das <[email protected]> + +description: | + Qualcomm LPASS core clock control module which supports the clocks and + power domains on SC7180. + + See also: + - dt-bindings/clock/qcom,lpasscorecc-sc7180.h + +properties: + compatible: + enum: + - qcom,sc7180-lpasshm + - qcom,sc7180-lpasscorecc + + clocks:
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 35
Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +10
-0+ items: + - description: gcc_lpass_sway clock from GCC + + clock-names: + items: + - const: gcc_lpass_sway + + power-domains: + items: + - description: LPASS CORE HM GSDCR
For single entry, 'maxItems: 1' is enough.
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 48
Quoted 13 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +13
-0+ + '#clock-cells': + const: 1 + + '#power-domain-cells': + const: 1 + + reg: + minItems: 1 + maxItems: 2 + items: + - description: lpass audio cc register + - description: lpass core cc register
audio then core
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 53
Quoted 5 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +5
-0+ + reg-names: + items: + - const: lpass_core_cc + - const: lpass_audio_cc
core then audio?
2 reg-names required, but 1 reg allowed?
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 64
Quoted 11 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +11
-0+ +if: + properties: + compatible: + contains: + const: qcom,sc7180-lpasshm +then: + properties: + reg: + items: + - description: lpass hm core register
reg-names allowed in this case?
Ideally, this would have just 'maxItems: 1' to just disallow the 2nd entry above.
Quoted 88 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +37
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + - '#power-domain-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/qcom,gcc-sc7180.h> + #include <dt-bindings/clock/qcom,lpasscorecc-sc7180.h> + clock-controller@63000000 { + compatible = "qcom,sc7180-lpasshm"; + reg = <0 0x63000000 0 0x28>; + clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>; + clock-names = "gcc_lpass_sway"; + #clock-cells = <1>; + #power-domain-cells = <1>; + }; + + - | + clock-controller@62d00000 { + compatible = "qcom,sc7180-lpasscorecc"; + reg = <0 0x62d00000 0 0x50000>, + <0 0x62780000 0 0x30000>; + reg-names = "lpass_core_cc", "lpass_audio_cc"; + clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>; + clock-names = "gcc_lpass_sway"; + power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>; + #clock-cells = <1>; + #power-domain-cells = <1>; + }; +...include/dt-bindings/clock/qcom,gcc-sc7180.h +1
-0@@ -137,6 +137,7 @@#define GCC_MSS_NAV_AXI_CLK 127#define GCC_MSS_Q6_MEMNOC_AXI_CLK 128#define GCC_MSS_SNOC_AXI_CLK 129 +#define GCC_LPASS_CFG_NOC_SWAY_CLK 130/* GCC resets */ #define GCC_QUSB2PHY_PRIM_BCR 0include/dt-bindings/clock/qcom,lpasscorecc-sc7180.h new file +29
-1@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) 2020, The Linux Foundation. All rights reserved. +*/ + +#ifndef _DT_BINDINGS_CLK_QCOM_LPASS_CORE_CC_SC7180_H +#define _DT_BINDINGS_CLK_QCOM_LPASS_CORE_CC_SC7180_H + +/* LPASS_CORE_CC clocks */ +#define LPASS_LPAAUDIO_DIG_PLL 0 +#define LPASS_LPAAUDIO_DIG_PLL_OUT_ODD 1 +#define CORE_CLK_SRC 2 +#define EXT_MCLK0_CLK_SRC 3 +#define LPAIF_PRI_CLK_SRC 4 +#define LPAIF_SEC_CLK_SRC 5 +#define LPASS_AUDIO_CORE_CORE_CLK 6 +#define LPASS_AUDIO_CORE_EXT_MCLK0_CLK 7 +#define LPASS_AUDIO_CORE_LPAIF_PRI_IBIT_CLK 8 +#define LPASS_AUDIO_CORE_LPAIF_SEC_IBIT_CLK 9 +#define LPASS_AUDIO_CORE_SYSNOC_MPORT_CORE_CLK 10 + +/* LPASS Core power domains */ +#define LPASS_CORE_HM_GDSCR 0 + +/* LPASS Audio power domains */ +#define LPASS_AUDIO_HM_GDSCR 0 +#define LPASS_PDC_HM_GDSCR 1 + +#endif --Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
Re: [PATCH v2 2/4] dt-bindings: clock: Add YAML schemas for LPASS clocks on SC7180
Thanks for your review.
Quoted 49 lines · Rob Herring
Quoted 48 lines · Taniya Das
The LPASS(Low Power Audio Subsystem) clock provider have a bunch of generic properties that are needed in a device tree. Also add clock ids for GCC LPASS and LPASS Core clock IDs for LPASS client to request for the clocks.
Signed-off-by Taniya Das <[email protected]>--- .../bindings/clock/qcom,sc7180-lpasscorecc.yaml | 101 +++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-sc7180.h | 1 + .../dt-bindings/clock/qcom,lpasscorecc-sc7180.h | 29 ++++++ 3 files changed, 131 insertions(+)create mode 100644
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yamlcreate mode 100644include/dt-bindings/clock/qcom,lpasscorecc-sc7180.hDocumentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +29
-0@@ -0,0 +1,101 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/qcom,sc7180-lpasscorecc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm LPASS Core Clock Controller Binding for SC7180 + +maintainers: + - Taniya Das <[email protected]> + +description: | + Qualcomm LPASS core clock control module which supports the clocks and + power domains on SC7180. + + See also: + - dt-bindings/clock/qcom,lpasscorecc-sc7180.h + +properties: + compatible: + enum: + - qcom,sc7180-lpasshm + - qcom,sc7180-lpasscorecc + + clocks: + items: + - description: gcc_lpass_sway clock from GCC + + clock-names:
Quoted 8 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 35
Quoted 6 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +6
-0+ items: + - const: gcc_lpass_sway + + power-domains: + items: + - description: LPASS CORE HM GSDCRFor single entry, 'maxItems: 1' is enough.
Will take of it in the next patch.
Quoted 16 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 48
Quoted 13 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +13
-0+ + '#clock-cells': + const: 1 + + '#power-domain-cells': + const: 1 + + reg: + minItems: 1 + maxItems: 2 + items: + - description: lpass audio cc register + - description: lpass core cc registeraudio then core
Quoted 8 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 53
Quoted 5 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +5
-0+ + reg-names: + items: + - const: lpass_core_cc + - const: lpass_audio_cccore then audio?
My bad, will take care of it.
Quoted 2 lines
2 reg-names required, but 1 reg allowed?
Update to use maxItems: 2 in the next patch.
Quoted 14 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml line 64
Quoted 11 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +11
-0+ +if: + properties: + compatible: + contains: + const: qcom,sc7180-lpasshm +then: + properties: + reg: + items: + - description: lpass hm core registerreg-names allowed in this case?
Quoted 3 lines
Ideally, this would have just 'maxItems: 1' to just disallow the 2nd entry above.
Yes, I would take care of this too.
Quoted 88 lines
Quoted 88 lines
Documentation/devicetree/bindings/clock/qcom,sc7180-lpasscorecc.yaml new file +37
-0+ +required: + - compatible + - reg + - clocks + - clock-names + - '#clock-cells' + - '#power-domain-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/qcom,gcc-sc7180.h> + #include <dt-bindings/clock/qcom,lpasscorecc-sc7180.h> + clock-controller@63000000 { + compatible = "qcom,sc7180-lpasshm"; + reg = <0 0x63000000 0 0x28>; + clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>; + clock-names = "gcc_lpass_sway"; + #clock-cells = <1>; + #power-domain-cells = <1>; + }; + + - | + clock-controller@62d00000 { + compatible = "qcom,sc7180-lpasscorecc"; + reg = <0 0x62d00000 0 0x50000>, + <0 0x62780000 0 0x30000>; + reg-names = "lpass_core_cc", "lpass_audio_cc"; + clocks = <&gcc GCC_LPASS_CFG_NOC_SWAY_CLK>; + clock-names = "gcc_lpass_sway"; + power-domains = <&lpass_hm LPASS_CORE_HM_GDSCR>; + #clock-cells = <1>; + #power-domain-cells = <1>; + }; +...include/dt-bindings/clock/qcom,gcc-sc7180.h +1
-0@@ -137,6 +137,7 @@#define GCC_MSS_NAV_AXI_CLK 127#define GCC_MSS_Q6_MEMNOC_AXI_CLK 128#define GCC_MSS_SNOC_AXI_CLK 129 +#define GCC_LPASS_CFG_NOC_SWAY_CLK 130/* GCC resets */ #define GCC_QUSB2PHY_PRIM_BCR 0include/dt-bindings/clock/qcom,lpasscorecc-sc7180.h new file +29
-1@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) 2020, The Linux Foundation. All rights reserved. +*/ + +#ifndef _DT_BINDINGS_CLK_QCOM_LPASS_CORE_CC_SC7180_H +#define _DT_BINDINGS_CLK_QCOM_LPASS_CORE_CC_SC7180_H + +/* LPASS_CORE_CC clocks */ +#define LPASS_LPAAUDIO_DIG_PLL 0 +#define LPASS_LPAAUDIO_DIG_PLL_OUT_ODD 1 +#define CORE_CLK_SRC 2 +#define EXT_MCLK0_CLK_SRC 3 +#define LPAIF_PRI_CLK_SRC 4 +#define LPAIF_SEC_CLK_SRC 5 +#define LPASS_AUDIO_CORE_CORE_CLK 6 +#define LPASS_AUDIO_CORE_EXT_MCLK0_CLK 7 +#define LPASS_AUDIO_CORE_LPAIF_PRI_IBIT_CLK 8 +#define LPASS_AUDIO_CORE_LPAIF_SEC_IBIT_CLK 9 +#define LPASS_AUDIO_CORE_SYSNOC_MPORT_CORE_CLK 10 + +/* LPASS Core power domains */ +#define LPASS_CORE_HM_GDSCR 0 + +/* LPASS Audio power domains */ +#define LPASS_AUDIO_HM_GDSCR 0 +#define LPASS_PDC_HM_GDSCR 1 + +#endif --Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
Signature · 4 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation. --
PATCH v2 3/4 clk: qcom: gcc: Add support for GCC LPASS clock for SC7180
In reply to Taniya DasAdd the GCC lpass clock which is required to access the LPASS core clocks.
--- drivers/clk/qcom/gcc-sc7180.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/clk/qcom/gcc-sc7180.c +14 -0
@@ -2230,6 +2230,19 @@ static struct clk_branch gcc_mss_q6_memnoc_axi_clk = { }, }; +static struct clk_branch gcc_lpass_cfg_noc_sway_clk = { + .halt_reg =0x47018 , + .halt_check =BRANCH_HALT_DELAY , + .clkr = { + .enable_reg =0x47018 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_lpass_cfg_noc_sway_clk" , + .ops = &clk_branch2_ops, + }, + }, +}; +static struct gdsc ufs_phy_gdsc = { .gdscr =0x77004 , .pd = {
@@ -2406,6 +2419,7 @@ static struct clk_regmap *gcc_sc7180_clocks[] = { [GCC_MSS_NAV_AXI_CLK] = &gcc_mss_nav_axi_clk.clkr, [GCC_MSS_Q6_MEMNOC_AXI_CLK] = &gcc_mss_q6_memnoc_axi_clk.clkr, [GCC_MSS_SNOC_AXI_CLK] = &gcc_mss_snoc_axi_clk.clkr, + [GCC_LPASS_CFG_NOC_SWAY_CLK] = &gcc_lpass_cfg_noc_sway_clk.clkr, };static const struct qcom_reset_map gcc_sc7180_resets[] = {
Signature · 2 lines
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH v2 4/4 clk: qcom: lpass: Add support for LPASS clock controller for SC7180
In reply to Taniya DasThe Low Power Audio subsystem clocks are required for Audio client to be able to request for the clocks and power domains.
--- drivers/clk/qcom/Kconfig | 9 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/lpasscorecc-sc7180.c | 479 ++++++++++++++++++++++++++++++++++ 3 files changed, 489 insertions(+) create mode 100644 drivers/clk/qcom/lpasscorecc-sc7180.c
drivers/clk/qcom/Kconfig +9 -0
@@ -272,6 +272,15 @@ config SC_GCC_7180 Say Y if you want to use peripheral devices such as UART, SPI, I2C, USB, UFS, SDCC, etc. +config SC_LPASS_CORECC_7180 + tristate "SC7180 LPASS Core Clock Controller" + select SC_GCC_7180 + help + Support for the LPASS(Low Power Audio Subsystem) core clock controller + on SC7180 devices. + Say Y if you want to use LPASS clocks and power domains of the LPASS + core clock controller. + config SC_GPUCC_7180 tristate "SC7180 Graphics Clock Controller" select SC_GCC_7180
drivers/clk/qcom/Makefile +1 -0
@@ -50,6 +50,7 @@ obj-$(CONFIG_QCS_TURING_404) += turingcc-qcs404.o obj-$(CONFIG_SC_DISPCC_7180) += dispcc-sc7180.o obj-$(CONFIG_SC_GCC_7180) += gcc-sc7180.o obj-$(CONFIG_SC_GPUCC_7180) += gpucc-sc7180.o +obj-$(CONFIG_SC_LPASS_CORECC_7180) += lpasscorecc-sc7180.o obj-$(CONFIG_SC_MSS_7180) += mss-sc7180.o obj-$(CONFIG_SC_VIDEOCC_7180) += videocc-sc7180.o obj-$(CONFIG_SDM_CAMCC_845) += camcc-sdm845.o
drivers/clk/qcom/lpasscorecc-sc7180.c new file +479 -0
479 lines not on this page · raw message
Signature · 2 lines
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
Stephen Boyd
maintainerRe: [PATCH v2 4/4] clk: qcom: lpass: Add support for LPASS clock controller for SC7180
Quoting Taniya Das (2020-05-17 02:22:24)
Quoted 41 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +35
-0@@ -0,0 +1,479 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2020, The Linux Foundation. All rights reserved. +*/ + +#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/pm_clock.h> +#include <linux/pm_runtime.h> +#include <linux/of.h> +#include <linux/regmap.h> + +#include <dt-bindings/clock/qcom,lpasscorecc-sc7180.h> + +#include "clk-alpha-pll.h" +#include "clk-branch.h" +#include "clk-rcg.h" +#include "clk-regmap.h" +#include "common.h" +#include "gdsc.h" + +enum { +P_BI_TCXO , +P_LPASS_LPAAUDIO_DIG_PLL_OUT_ODD , +P_SLEEP_CLK , +}; + +static struct pll_vco fabia_vco[] = { + {249600000 ,2000000000 ,0 }, +}; + +static const struct alpha_pll_config lpass_lpaaudio_dig_pll_config = { + .l =0x20 ,
[...]
Quoted 17 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +17
-0+ +static struct regmap_config lpass_core_cc_sc7180_regmap_config = { + .reg_bits =32 , + .reg_stride =4 , + .val_bits =32 , + .fast_io = true, +}; + +static const struct qcom_cc_desc lpass_core_hm_sc7180_desc = { + .config = &lpass_core_cc_sc7180_regmap_config, + .gdscs = lpass_core_hm_sc7180_gdscs, + .num_gdscs =ARRAY_SIZE (lpass_core_hm_sc7180_gdscs), +}; + +static const struct qcom_cc_desc lpass_core_cc_sc7180_desc = { + .config = &lpass_core_cc_sc7180_regmap_config, + .clks = lpass_core_cc_sc7180_clocks,
drivers/clk/qcom/lpasscorecc-sc7180.c line 360
Quoted 10 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +10
-0+ .num_clks = ARRAY_SIZE(lpass_core_cc_sc7180_clocks), +}; + +static const struct qcom_cc_desc lpass_audio_hm_sc7180_desc = { + .config = &lpass_core_cc_sc7180_regmap_config, + .gdscs = lpass_audio_hm_sc7180_gdscs, + .num_gdscs =ARRAY_SIZE (lpass_audio_hm_sc7180_gdscs), +}; + +
Drop double newline please.
Quoted 9 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +9
-0+static int lpass_core_cc_sc7180_probe (struct platform_device *pdev) +{ +const struct qcom_cc_desc *desc; +struct regmap *regmap; +int ret; + + lpass_core_cc_sc7180_regmap_config.name ="lpass_audio_cc" ; + desc = &lpass_audio_hm_sc7180_desc; + ret =qcom_cc_probe_by_index (pdev,1 , desc);
drivers/clk/qcom/lpasscorecc-sc7180.c line 379
Quoted 10 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +10
-0+if (ret) +return ret; + + lpass_core_cc_sc7180_regmap_config.name ="lpass_core_cc" ; + regmap =qcom_cc_map (pdev, &lpass_core_cc_sc7180_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +/* +* Keep the CLK always-ON
Why? Presumably to make sure we can access the lpass sysnoc path all the time?
Quoted 41 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +41
-0+* LPASS_AUDIO_CORE_SYSNOC_SWAY_CORE_CLK +*/ +regmap_update_bits (regmap,0x24000 ,BIT (0 ),BIT (0 )); + +/* PLL settings */ +regmap_write (regmap,0x1008 ,0x20 ); +regmap_update_bits (regmap,0x1014 ,BIT (0 ),BIT (0 )); + +clk_fabia_pll_configure (&lpass_lpaaudio_dig_pll, regmap, + &lpass_lpaaudio_dig_pll_config); + +return qcom_cc_really_probe (pdev, &lpass_core_cc_sc7180_desc, regmap); +} + +static int lpass_hm_core_probe (struct platform_device *pdev) +{ +const struct qcom_cc_desc *desc; +int ret; + + lpass_core_cc_sc7180_regmap_config.name ="lpass_hm_core" ; + desc = &lpass_core_hm_sc7180_desc; + +return qcom_cc_probe_by_index (pdev,0 , desc); +} + +static const struct of_device_id lpass_core_cc_sc7180_match_table[] = { + { + .compatible ="qcom,sc7180-lpasshm" , + .data = lpass_hm_core_probe, + }, + { + .compatible ="qcom,sc7180-lpasscorecc" , + .data = lpass_core_cc_sc7180_probe, + }, + { } +}; +MODULE_DEVICE_TABLE (of, lpass_core_cc_sc7180_match_table); + +static int lpass_core_sc7180_probe (struct platform_device *pdev) +{ +int (*clk_probe)(struct platform_device *p);
drivers/clk/qcom/lpasscorecc-sc7180.c line 430
Quoted 10 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +10
-0+int ret; + +pm_runtime_enable (&pdev->dev); + ret =pm_clk_create (&pdev->dev); +if (ret) +return ret; + + ret =pm_clk_add (&pdev->dev,"gcc_lpass_sway" ); +if (ret <0 ) { +dev_err (&pdev->dev,"failed to acquire iface clock\n" );
Can the clk name be 'iface' if it's actually the interface clk? "gcc_lpass_sway" looks to be the actual clk name which we shouldn't care about here. It should be whatever clk name we consider it to be, which would mean iface probably.
Quoted 12 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +12
-0+ goto disable_pm_runtime; + } + + clk_probe =of_device_get_match_data (&pdev->dev); +if (!clk_probe) +return -EINVAL ; + + ret =clk_probe (pdev); +if (ret) + goto destroy_pm_clk; + +return 0 ;
Re: [PATCH v2 4/4] clk: qcom: lpass: Add support for LPASS clock controller for SC7180
Thanks for your review.
Quoted 64 lines · Stephen Boyd
Quoting Taniya Das (2020-05-17 02:22:24)
Quoted 41 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +35
-0@@ -0,0 +1,479 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2020, The Linux Foundation. All rights reserved. +*/ + +#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/pm_clock.h> +#include <linux/pm_runtime.h> +#include <linux/of.h> +#include <linux/regmap.h> + +#include <dt-bindings/clock/qcom,lpasscorecc-sc7180.h> + +#include "clk-alpha-pll.h" +#include "clk-branch.h" +#include "clk-rcg.h" +#include "clk-regmap.h" +#include "common.h" +#include "gdsc.h" + +enum { +P_BI_TCXO , +P_LPASS_LPAAUDIO_DIG_PLL_OUT_ODD , +P_SLEEP_CLK , +}; + +static struct pll_vco fabia_vco[] = { + {249600000 ,2000000000 ,0 }, +}; + +static const struct alpha_pll_config lpass_lpaaudio_dig_pll_config = { + .l =0x20 ,[...]
Quoted 21 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +21
-0+ +static struct regmap_config lpass_core_cc_sc7180_regmap_config = { + .reg_bits =32 , + .reg_stride =4 , + .val_bits =32 , + .fast_io = true, +}; + +static const struct qcom_cc_desc lpass_core_hm_sc7180_desc = { + .config = &lpass_core_cc_sc7180_regmap_config, + .gdscs = lpass_core_hm_sc7180_gdscs, + .num_gdscs =ARRAY_SIZE (lpass_core_hm_sc7180_gdscs), +}; + +static const struct qcom_cc_desc lpass_core_cc_sc7180_desc = { + .config = &lpass_core_cc_sc7180_regmap_config, + .clks = lpass_core_cc_sc7180_clocks, + .num_clks =ARRAY_SIZE (lpass_core_cc_sc7180_clocks), +}; + +static const struct qcom_cc_desc lpass_audio_hm_sc7180_desc = {
Quoted 9 lines
drivers/clk/qcom/lpasscorecc-sc7180.c line 360
Quoted 6 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +6
-0+ .config = &lpass_core_cc_sc7180_regmap_config, + .gdscs = lpass_audio_hm_sc7180_gdscs, + .num_gdscs = ARRAY_SIZE(lpass_audio_hm_sc7180_gdscs), +}; + +Drop double newline please.
Done.
Quoted 14 lines
Quoted 14 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +14
-0+static int lpass_core_cc_sc7180_probe (struct platform_device *pdev) +{ +const struct qcom_cc_desc *desc; +struct regmap *regmap; +int ret; + + lpass_core_cc_sc7180_regmap_config.name ="lpass_audio_cc" ; + desc = &lpass_audio_hm_sc7180_desc; + ret =qcom_cc_probe_by_index (pdev,1 , desc); +if (ret) +return ret; + + lpass_core_cc_sc7180_regmap_config.name ="lpass_core_cc" ; + regmap =qcom_cc_map (pdev, &lpass_core_cc_sc7180_desc);
Quoted 9 lines
drivers/clk/qcom/lpasscorecc-sc7180.c line 379
Quoted 5 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +5
-0+if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +/* +* Keep the CLK always-ON Why? Presumably to make sure we can access the lpass sysnoc path all the time?
This is an always ON clock from HW, just making sure to keep it enabled.
Quoted 48 lines
Quoted 48 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +48
-0+* LPASS_AUDIO_CORE_SYSNOC_SWAY_CORE_CLK +*/ +regmap_update_bits (regmap,0x24000 ,BIT (0 ),BIT (0 )); + +/* PLL settings */ +regmap_write (regmap,0x1008 ,0x20 ); +regmap_update_bits (regmap,0x1014 ,BIT (0 ),BIT (0 )); + +clk_fabia_pll_configure (&lpass_lpaaudio_dig_pll, regmap, + &lpass_lpaaudio_dig_pll_config); + +return qcom_cc_really_probe (pdev, &lpass_core_cc_sc7180_desc, regmap); +} + +static int lpass_hm_core_probe (struct platform_device *pdev) +{ +const struct qcom_cc_desc *desc; +int ret; + + lpass_core_cc_sc7180_regmap_config.name ="lpass_hm_core" ; + desc = &lpass_core_hm_sc7180_desc; + +return qcom_cc_probe_by_index (pdev,0 , desc); +} + +static const struct of_device_id lpass_core_cc_sc7180_match_table[] = { + { + .compatible ="qcom,sc7180-lpasshm" , + .data = lpass_hm_core_probe, + }, + { + .compatible ="qcom,sc7180-lpasscorecc" , + .data = lpass_core_cc_sc7180_probe, + }, + { } +}; +MODULE_DEVICE_TABLE (of, lpass_core_cc_sc7180_match_table); + +static int lpass_core_sc7180_probe (struct platform_device *pdev) +{ +int (*clk_probe)(struct platform_device *p); +int ret; + +pm_runtime_enable (&pdev->dev); + ret =pm_clk_create (&pdev->dev); +if (ret) +return ret; +
Quoted 9 lines
drivers/clk/qcom/lpasscorecc-sc7180.c line 430
Quoted 3 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +3
-0+ ret =pm_clk_add (&pdev->dev,"gcc_lpass_sway" ); +if (ret <0 ) { +dev_err (&pdev->dev,"failed to acquire iface clock\n" );Can the clk name be 'iface' if it's actually the interface clk? "
gcc_lpass_sway" looks to be the actual clk name which we shouldn't care about here. It should be whatever clk name we consider it to be, which would mean iface probably.
Yes would use "iface".
Quoted 12 lines
Quoted 12 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +12
-0+ goto disable_pm_runtime; + } + + clk_probe =of_device_get_match_data (&pdev->dev); +if (!clk_probe) +return -EINVAL ; + + ret =clk_probe (pdev); +if (ret) + goto destroy_pm_clk; + +return 0 ;
Signature · 4 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation. --
Stephen Boyd
maintainerRe: [PATCH v2 4/4] clk: qcom: lpass: Add support for LPASS clock controller for SC7180
Quoting Taniya Das (2020-06-10 10:11:49)
Quoted 17 lines · Stephen Boyd
Quoted 15 lines
Quoting Taniya Das (2020-05-17 02:22:24)
drivers/clk/qcom/lpasscorecc-sc7180.c line 379
Quoted 10 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +10
-0+if (ret) +return ret; + + lpass_core_cc_sc7180_regmap_config.name ="lpass_core_cc" ; + regmap =qcom_cc_map (pdev, &lpass_core_cc_sc7180_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +/* +* Keep the CLK always-ON Why? Presumably to make sure we can access the lpass sysnoc path all the time?
Quoted 1 line
This is an always ON clock from HW, just making sure to keep it enabled.
I'm not following. Hardware says it must always be enabled? If it isn't enabled is it even possible to write this register?
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
drivers/clk/qcom/lpasscorecc-sc7180.c new file +4
-0+* LPASS_AUDIO_CORE_SYSNOC_SWAY_CORE_CLK +*/ +regmap_update_bits (regmap,0x24000 ,BIT (0 ),BIT (0 )); +