Misc patches to support clocks for SDM845
v3 cover Misc patches to support clocks for SDM845
Changes in v3:
1. Adressed review comments given for v2 series.
2. The GCC clock driver(patch 3) depends upon the below patches related to GDSC operation and are under review.
https://lkml.org/lkml/2018/4/2/142
Changes in v2:
Fixup for recalc_rate ops for clk_rcg2_shared_ops:
There could be few scenarios where shared clocks are configured at rate other than CXO by boot. In those cases there would be a mismatch between the rate calculated by the recalc shared ops and the actual HW register configuration. Fix the same by adding an additional check to read current src from CFG register and make a decision based on that.
Changes in v1:
https://lkml.org/lkml/2018/1/31/209
This patch series does the miscellaneous changes to support clock nodes for SDM845. Below are the major changes for which the existing code does not have support.
1. Clear hardware clock control bit of RCGs where HW clock control bit is set by default so that software can control those root clocks.
2. Introduces clk_rcg2_shared_ops to support clock controller drivers for SDM845. With new shared ops, RCGs with shared branches will be configured to a safe source in disable path and actual RCG update configuration will be done in enable path instead of doing config update in set_rate. In set_rate(), just cache the rate instead of doing actual configuration update. Also each RCG in clock controller driver will have their own safe configuration frequency table to switch to safe frequency.
3. Add support for controlling Fabia PLL for which the support is not available in existing alpha PLL code.
4. Add Global Clock controller (GCC) driver for SDM845. This should allow most non-multimedia device drivers to probe and control their clocks.
[v1] : https://lkml.org/lkml/2018/1/31/209
[v2] : https://lkml.org/lkml/2018/3/8/495
Amit Nischal (2):
clk: qcom: Clear hardware clock control bit of RCG
clk: qcom: Configure the RCGs to a safe source as needed
Taniya Das (1):
clk: qcom: Add Global Clock controller (GCC) driver for SDM845
.../devicetree/bindings/clock/qcom,gcc.txt | 1 + drivers/clk/qcom/Kconfig | 9 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/clk-rcg.h | 7 +- drivers/clk/qcom/clk-rcg2.c | 176 +- drivers/clk/qcom/gcc-sdm845.c | 3546 ++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-sdm845.h | 242 ++ 7 files changed, 3979 insertions(+), 3 deletions(-) create mode 100644 drivers/clk/qcom/gcc-sdm845.c create mode 100644 include/dt-bindings/clock/qcom,gcc-sdm845.h
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 1/3 clk: qcom: Clear hardware clock control bit of RCG
For upcoming targets like sdm845, POR value of the hardware clock control bit is set for most of root clocks which needs to be cleared for software to be able to control. For older targets like MSM8996, this bit is reserved bit and having POR value as 0 so this patch will work for the older targets too. So update the configuration mask to take care of the same to clear hardware clock control bit.
--- drivers/clk/qcom/clk-rcg2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/qcom/clk-rcg2.c +2 -1
@@ -42,6 +42,7 @@#define CFG_MODE_SHIFT 12#define CFG_MODE_MASK (0x3 << CFG_MODE_SHIFT)#define CFG_MODE_DUAL_EDGE (0x2 << CFG_MODE_SHIFT) +#define CFG_HW_CLK_CTRL_MASK BIT(20)#define M_REG 0x8#define N_REG 0xc
@@ -276,7 +277,7 @@ static int clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f) } mask =BIT (rcg->hid_width) -1 ; - mask |=CFG_SRC_SEL_MASK |CFG_MODE_MASK ; + mask |=CFG_SRC_SEL_MASK |CFG_MODE_MASK |CFG_HW_CLK_CTRL_MASK ; cfg = f->pre_div <<CFG_SRC_DIV_SHIFT ; cfg |= rcg->parent_map[index].cfg <<CFG_SRC_SEL_SHIFT ;if (rcg->mnd_width && f->n && (f->m != f->n))
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 2/3 clk: qcom: Configure the RCGs to a safe source as needed
In reply to Amit NischalFor some root clock generators, there could be child branches which are controlled by an entity other than application processor subsystem. For such RCGs, as per application processor subsystem clock driver, all of its downstream clocks are disabled and RCG is in disabled state but in reality downstream clocks can be left enabled before.
So in this scenario, when RCG is disabled as per clock driver's point of view and when rate scaling request comes before downstream clock enable request, then RCG fails to update its configuration because in reality RCG is on and it expects its new source to alredy be in enable state but in reality new source is off. In order to avoid having the RCG to go into an invalid state, add support to cache the rate of RCG during set_rate(), defer actual RCG configuration update to be done during clk_enable() as at this point of time, both its new parent and safe source will be already enabled and RCG can safely switch to new parent.
During clk_disable() request, configure it to safe source as both its parents, safe source and current parent will be enabled and RCG can safely execute a switch. Also add support to have safe configuration frequency table structure for each shared RCG.
--- drivers/clk/qcom/clk-rcg.h | 7 +- drivers/clk/qcom/clk-rcg2.c | 173 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 178 insertions(+), 2 deletions(-)
drivers/clk/qcom/clk-rcg.h +6 -1
@@ -1,5 +1,5 @@/* -* Copyright (c) 2013, The Linux Foundation. All rights reserved. +* Copyright (c) 2013, 2018, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and
@@ -144,8 +144,10 @@ struct clk_dyn_rcg {* @cmd_rcgr: corresponds to *_CMD_RCGR * @mnd_width: number of bits in m/n/d values * @hid_width: number of bits in half integer divider +* @safe_src_index: safe src index value * @parent_map: map from software's parent index to hardware's src_sel field * @freq_tbl: frequency table +* @current_freq: last cached frequency when using branches with shared RCGs * @clkr: regmap clock handle * */
@@ -153,8 +155,10 @@ struct clk_rcg2 {u32 cmd_rcgr;u8 mnd_width;u8 hid_width; +const u8 safe_src_index;const struct parent_map *parent_map;const struct freq_tbl *freq_tbl; +unsigned long current_freq;struct clk_regmap clkr; };
@@ -167,5 +171,6 @@ struct clk_rcg2 {extern const struct clk_ops clk_byte2_ops;extern const struct clk_ops clk_pixel_ops;extern const struct clk_ops clk_gfx3d_ops; +extern const struct clk_ops clk_rcg2_shared_ops;#endif
drivers/clk/qcom/clk-rcg2.c +172 -1
180 lines not on this page · raw message
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v3 3/3 clk: qcom: Add Global Clock controller (GCC) driver for SDM845
In reply to Amit NischalFrom: Taniya Das <[email protected]>
Add support for the global clock controller found on SDM845 based devices. This should allow most non-multimedia device drivers to probe and control their clocks.
---
The patch is dependent upon the below patches related to GDSC operation and are under review.
https://lkml.org/lkml/2018/4/2/142
.../devicetree/bindings/clock/qcom,gcc.txt | 1 + drivers/clk/qcom/Kconfig | 9 + drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/gcc-sdm845.c | 3546 ++++++++++++++++++++ include/dt-bindings/clock/qcom,gcc-sdm845.h | 242 ++ 5 files changed, 3799 insertions(+) create mode 100644 drivers/clk/qcom/gcc-sdm845.c create mode 100644 include/dt-bindings/clock/qcom,gcc-sdm845.h
Documentation/devicetree/bindings/clock/qcom,gcc.txt +1 -0
@@ -18,6 +18,7 @@ Required properties : "qcom,gcc-msm8994" "qcom,gcc-msm8996" "qcom,gcc-mdm9615" + "qcom,gcc-sdm845" - reg : shall contain base register location and length - #clock-cells : shall contain 1
drivers/clk/qcom/Kconfig +9 -0
@@ -218,6 +218,15 @@ config MSM_MMCC_8996 Say Y if you want to support multimedia devices such as display, graphics, video encode/decode, camera, etc. +config SDM_GCC_845 + tristate "SDM845 Global Clock Controller" + depends on COMMON_CLK_QCOM + help + Support for the global clock controller on Qualcomm Technologies, Inc + sdm845 devices. + Say Y if you want to use peripheral devices such as UART, SPI, + i2c, USB, UFS, SD/eMMC, PCIe, etc. + config SPMI_PMIC_CLKDIV tristate "SPMI PMIC clkdiv Support" depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TEST
drivers/clk/qcom/Makefile +1 -0
@@ -37,4 +37,5 @@ obj-$(CONFIG_QCOM_A53PLL) += a53-pll.o obj-$(CONFIG_QCOM_CLK_APCS_MSM8916) += apcs-msm8916.o obj-$(CONFIG_QCOM_CLK_RPM) += clk-rpm.o obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o +obj-$(CONFIG_SDM_GCC_845) += gcc-sdm845.o obj-$(CONFIG_SPMI_PMIC_CLKDIV) += clk-spmi-pmic-div.o
drivers/clk/qcom/gcc-sdm845.c new file +3546 -0
2,973 lines not on this page · raw message
include/dt-bindings/clock/qcom,gcc-sdm845.h new file +242 -0
242 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Part of the diff is not shown here. View the raw message.
Stephen Boyd
maintainerRe: [PATCH v3 3/3] clk: qcom: Add Global Clock controller (GCC) driver for SDM845
Quoting Amit Nischal (2018-04-03 06:22:41)
Quoted 6 lines
drivers/clk/qcom/Kconfig +0
-0@@ -218,6 +218,15 @@ config MSM_MMCC_8996 Say Y if you want to support multimedia devices such as display,
drivers/clk/qcom/Kconfig config MSM_MMCC_8996 · line 228
Quoted 10 lines
drivers/clk/qcom/Kconfig +8
-0graphics, video encode/decode, camera, etc. +config SDM_GCC_845 + tristate "SDM845 Global Clock Controller" + depends on COMMON_CLK_QCOM + help + Support for the global clock controller on Qualcomm Technologies, Inc + sdm845 devices. + Say Y if you want to use peripheral devices such as UART, SPI, + i2c, USB, UFS, SD/eMMC, PCIe, etc.
Is there eMMC?
Quoted 13 lines
drivers/clk/qcom/Kconfig +1
-0+ config SPMI_PMIC_CLKDIV tristate "SPMI PMIC clkdiv Support" depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TESTdrivers/clk/qcom/gcc-sdm845.c new file +3
-0@@ -0,0 +1,3546 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2018, The Linux Foundation. All rights reserved.
drivers/clk/qcom/gcc-sdm845.c line 13
Quoted 10 lines
drivers/clk/qcom/gcc-sdm845.c new file +10
-0+*/ + +#include <linux/kernel.h> +#include <linux/bitops.h> +#include <linux/err.h> +#include <linux/platform_device.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/clk.h>
Is this include used?
Quoted 4 lines
drivers/clk/qcom/gcc-sdm845.c new file +4
-0+#include <linux/clk-provider.h> +#include <linux/regmap.h> +#include <linux/reset-controller.h> +
[...]
drivers/clk/qcom/gcc-sdm845.c line 891
Quoted 12 lines
drivers/clk/qcom/gcc-sdm845.c new file +12
-0+ +static struct clk_rcg2 gcc_usb30_prim_mock_utmi_clk_src = { + .cmd_rcgr =0xf030 , + .mnd_width =0 , + .hid_width =5 , + .parent_map = gcc_parent_map_0, + .freq_tbl = ftbl_gcc_usb30_prim_mock_utmi_clk_src, + .clkr.hw.init = &(struct clk_init_data ){ + .name ="gcc_usb30_prim_mock_utmi_clk_src" , + .parent_names = gcc_parent_names_0, + .num_parents =4 , + .ops = &clk_rcg2_shared_ops,
Still shared? Why?
Quoted 8 lines
drivers/clk/qcom/gcc-sdm845.c new file +8
-0+ +static struct clk_branch gcc_video_ahb_clk = { + .halt_reg =0xb004 , + .halt_check =BRANCH_HALT , + .hwcg_reg =0xb004 , + .hwcg_bit =1 , + .clkr = { + .enable_reg =0xb004 ,
drivers/clk/qcom/gcc-sdm845.c line 3068
Quoted 10 lines
drivers/clk/qcom/gcc-sdm845.c new file +10
-0+ .enable_mask = BIT(0), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_video_ahb_clk" , + .flags =CLK_IS_CRITICAL , + .ops = &clk_branch2_ops, + }, + }, +}; + +
Weird double space here.
drivers/clk/qcom/gcc-sdm845.c line 3077
Quoted 9 lines
drivers/clk/qcom/gcc-sdm845.c new file +9
-0+static struct clk_branch gcc_video_xo_clk = { + .halt_reg =0xb028 , + .halt_check =BRANCH_HALT , + .clkr = { + .enable_reg =0xb028 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_video_xo_clk" , + .flags =CLK_IS_CRITICAL ,
For these "critical" clks that don't have parents can you just throw the enable part in the gcc driver probe and remove these clks from being exposed? They don't seem to provide any value to expose them as clks when they don't hook into the final clk tree.
Quoted 48 lines
drivers/clk/qcom/gcc-sdm845.c new file +48
-0+ .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch gcc_vs_ctrl_ahb_clk = { + .halt_reg =0x7a014 , + .halt_check =BRANCH_HALT , + .hwcg_reg =0x7a014 , + .hwcg_bit =1 , + .clkr = { + .enable_reg =0x7a014 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_vs_ctrl_ahb_clk" , + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch gcc_vs_ctrl_clk = { + .halt_reg =0x7a010 , + .halt_check =BRANCH_HALT , + .clkr = { + .enable_reg =0x7a010 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_vs_ctrl_clk" , + .parent_names = (const char *[]){ +"gcc_vs_ctrl_clk_src" , + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + .ops = &clk_branch2_ops, + }, + }, +}; + + +static int gcc_sdm845_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct regmap *regmap; +int i, ret; + + regmap =qcom_cc_map (pdev, &gcc_sdm845_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap);
drivers/clk/qcom/gcc-sdm845.c
Quoted 10 lines
drivers/clk/qcom/gcc-sdm845.c new file +10
-0+ +for (i =0 ; i <ARRAY_SIZE (gcc_sdm845_hws); i++) { + ret =devm_clk_hw_register (dev, gcc_sdm845_hws[i]); +if (ret) +return ret; + } + +/* Disable the GPLL0 active input to MMSS and GPU via MISC registers */ +regmap_update_bits (regmap,0x09ffc ,0x3 ,0x3 ); +regmap_update_bits (regmap,0x71028 ,0x3 ,0x3 );
I think we'll have to throw in the pipe clk branch stuff in here too? And then drop the pipe clks from the driver?
Quoted 10 lines
drivers/clk/qcom/gcc-sdm845.c new file +4
-0+ +return qcom_cc_really_probe (pdev, &gcc_sdm845_desc, regmap); +} +include/dt-bindings/clock/qcom,gcc-sdm845.h new file +0
-0@@ -0,0 +1,242 @@
[...]
include/dt-bindings/clock/qcom,gcc-sdm845.h line 197
Quoted 8 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h new file +8
-0+#define GCC_VDDA_VS_CLK 180 +#define GCC_VDDCX_VS_CLK 181 +#define GCC_VDDMX_VS_CLK 182 +#define GCC_VS_CTRL_AHB_CLK 183 +#define GCC_VS_CTRL_CLK 184 +#define GCC_VS_CTRL_CLK_SRC 185 +#define GCC_VSENSOR_CLK_SRC 186 +#define GPLL4 187
Do you have the define for the quad spi clks? And the implementation for it?
include/dt-bindings/clock/qcom,gcc-sdm845.h line 199
Quoted 2 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h new file +2
-0+ +/* GCC reset clocks */
They're just resets, not reset clks.
Quoted 8 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h new file +8
-0+#define GCC_MMSS_BCR 0 +#define GCC_PCIE_0_BCR 1 +#define GCC_PCIE_1_BCR 2 +#define GCC_PCIE_PHY_BCR 3 +#define GCC_PDM_BCR 4 +#define GCC_PRNG_BCR 5 +#define GCC_QUPV3_WRAPPER_0_BCR 6 +#define GCC_QUPV3_WRAPPER_1_BCR 7
Re: [PATCH v3 3/3] clk: qcom: Add Global Clock controller (GCC) driver for SDM845
Quoted 10 lines · Stephen Boyd
Quoting Amit Nischal (2018-04-03 06:22:41)
Quoted 9 lines
drivers/clk/qcom/Kconfig +0
-0@@ -218,6 +218,15 @@ config MSM_MMCC_8996 Say Y if you want to support multimedia devices such as display, graphics, video encode/decode, camera, etc.
Quoted 12 lines
Quoted 10 lines
drivers/clk/qcom/Kconfig +5
-0+config SDM_GCC_845 + tristate "SDM845 Global Clock Controller" + depends on COMMON_CLK_QCOM + help + Support for the global clock controller on QualcommTechnologies, Inc
drivers/clk/qcom/Kconfig +2
-0+ sdm845 devices. + Say Y if you want to use peripheral devices such as UART,SPI,
+ i2c, USB, UFS, SD/eMMC, PCIe, etc.Is there eMMC?
Thanks for the review comments. There is no eMMC for SDM845. I will fix the above in next patch series.
Quoted 18 lines
Quoted 18 lines
drivers/clk/qcom/Kconfig +1
-0+ config SPMI_PMIC_CLKDIV tristate "SPMI PMIC clkdiv Support" depends on (COMMON_CLK_QCOM && SPMI) || COMPILE_TESTdrivers/clk/qcom/gcc-sdm845.c new file +7
-0@@ -0,0 +1,3546 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Copyright (c) 2018, The Linux Foundation. All rights reserved. +*/ + +#include <linux/kernel.h> +#include <linux/bitops.h>
Quoted 8 lines
drivers/clk/qcom/gcc-sdm845.c line 13
Quoted 6 lines
drivers/clk/qcom/gcc-sdm845.c new file +6
-0+#include <linux/err.h> +#include <linux/platform_device.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> +#include <linux/clk.h> Is this include used?
No, it is not getting used. We will remove this in next patch series.
Quoted 6 lines
Quoted 5 lines
drivers/clk/qcom/gcc-sdm845.c new file +4
-0+#include <linux/clk-provider.h> +#include <linux/regmap.h> +#include <linux/reset-controller.h> +[...]
Quoted 14 lines
drivers/clk/qcom/gcc-sdm845.c line 891
Quoted 12 lines
drivers/clk/qcom/gcc-sdm845.c new file +12
-0+ +static struct clk_rcg2 gcc_usb30_prim_mock_utmi_clk_src = { + .cmd_rcgr =0xf030 , + .mnd_width =0 , + .hid_width =5 , + .parent_map = gcc_parent_map_0, + .freq_tbl = ftbl_gcc_usb30_prim_mock_utmi_clk_src, + .clkr.hw.init = &(struct clk_init_data ){ + .name ="gcc_usb30_prim_mock_utmi_clk_src" , + .parent_names = gcc_parent_names_0, + .num_parents =4 , + .ops = &clk_rcg2_shared_ops,Still shared? Why?
We would require the shared_ops for clocks which are configured by bootloader.
Quoted 13 lines
Quoted 13 lines
drivers/clk/qcom/gcc-sdm845.c new file +12
-0+ +static struct clk_branch gcc_video_ahb_clk = { + .halt_reg =0xb004 , + .halt_check =BRANCH_HALT , + .hwcg_reg =0xb004 , + .hwcg_bit =1 , + .clkr = { + .enable_reg =0xb004 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_video_ahb_clk" , + .flags =CLK_IS_CRITICAL ,
Quoted 8 lines
drivers/clk/qcom/gcc-sdm845.c line 1018
Quoted 6 lines
drivers/clk/qcom/gcc-sdm845.c new file +6
-0+ .ops = &clk_branch2_ops, + }, + }, +}; + +Weird double space here.
We will fix this in next patch series.
Quoted 11 lines
drivers/clk/qcom/gcc-sdm845.c line 3077
Quoted 10 lines
drivers/clk/qcom/gcc-sdm845.c new file +9
-0+static struct clk_branch gcc_video_xo_clk = { + .halt_reg =0xb028 , + .halt_check =BRANCH_HALT , + .clkr = { + .enable_reg =0xb028 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_video_xo_clk" , + .flags =CLK_IS_CRITICAL ,
Quoted 5 lines
For these "critical" clks that don't have parents can you just throw the enable part in the gcc driver probe and remove these clks from being exposed? They don't seem to provide any value to expose them as clks when they don't hook into the final clk tree.
For all of the "critical" clocks which don't have parents, we have removed the CRITICAL flag and mandate the clients to put their vote to enable/disable them. Other than this, some of the "critical" clock instances we have completely removed and enabled them in the probe. This will be fixed in the next patch series.
Quoted 54 lines
Quoted 54 lines
drivers/clk/qcom/gcc-sdm845.c new file +54
-0+ .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch gcc_vs_ctrl_ahb_clk = { + .halt_reg =0x7a014 , + .halt_check =BRANCH_HALT , + .hwcg_reg =0x7a014 , + .hwcg_bit =1 , + .clkr = { + .enable_reg =0x7a014 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_vs_ctrl_ahb_clk" , + .ops = &clk_branch2_ops, + }, + }, +}; + +static struct clk_branch gcc_vs_ctrl_clk = { + .halt_reg =0x7a010 , + .halt_check =BRANCH_HALT , + .clkr = { + .enable_reg =0x7a010 , + .enable_mask =BIT (0 ), + .hw.init = &(struct clk_init_data ){ + .name ="gcc_vs_ctrl_clk" , + .parent_names = (const char *[]){ +"gcc_vs_ctrl_clk_src" , + }, + .num_parents =1 , + .flags =CLK_SET_RATE_PARENT , + .ops = &clk_branch2_ops, + }, + }, +}; + + +static int gcc_sdm845_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct regmap *regmap; +int i, ret; + + regmap =qcom_cc_map (pdev, &gcc_sdm845_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +for (i =0 ; i <ARRAY_SIZE (gcc_sdm845_hws); i++) { + ret =devm_clk_hw_register (dev, gcc_sdm845_hws[i]); +if (ret) +return ret; + }
Quoted 8 lines
drivers/clk/qcom/gcc-sdm845.c line 3519
Quoted 5 lines
drivers/clk/qcom/gcc-sdm845.c new file +2
-0+ +/* Disable the GPLL0 active input to MMSS and GPU via MISC registers */
drivers/clk/qcom/gcc-sdm845.c new file +2
-0+regmap_update_bits (regmap,0x09ffc ,0x3 ,0x3 ); +regmap_update_bits (regmap,0x71028 ,0x3 ,0x3 );I think we'll have to throw in the pipe clk branch stuff in here too? And then drop the pipe clks from the driver?
All the USB pipe clocks would be taken care. The PCIE pipe branch clocks would have to be explicitly disabled so as to retain the memory logic. Otherwise, it would lead to memory corruption in case the external source is directly disabled without disabling the branch clock.
Quoted 12 lines
Quoted 11 lines
drivers/clk/qcom/gcc-sdm845.c new file +4
-0+ +return qcom_cc_really_probe (pdev, &gcc_sdm845_desc, regmap); +} +include/dt-bindings/clock/qcom,gcc-sdm845.h new file +0
-0@@ -0,0 +1,242 @@[...]
Quoted 14 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h line 197
Quoted 10 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h new file +8
-0+#define GCC_VDDA_VS_CLK 180 +#define GCC_VDDCX_VS_CLK 181 +#define GCC_VDDMX_VS_CLK 182 +#define GCC_VS_CTRL_AHB_CLK 183 +#define GCC_VS_CTRL_CLK 184 +#define GCC_VS_CTRL_CLK_SRC 185 +#define GCC_VSENSOR_CLK_SRC 186 +#define GPLL4 187Do you have the define for the quad spi clks? And the implementation for it?
In SDM845, Quad SPI clocks are part of gcc_qupv*_wrap*_s* clock group.
Quoted 4 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h line 199
Quoted 2 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h new file +2
-0+ +/* GCC reset clocks */ They're just resets, not reset clks.
Will fix this in next patch series.
Quoted 11 lines
Quoted 11 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h new file +8
-0+#define GCC_MMSS_BCR 0 +#define GCC_PCIE_0_BCR 1 +#define GCC_PCIE_1_BCR 2 +#define GCC_PCIE_PHY_BCR 3 +#define GCC_PDM_BCR 4 +#define GCC_PRNG_BCR 5 +#define GCC_QUPV3_WRAPPER_0_BCR 6 +#define GCC_QUPV3_WRAPPER_1_BCR 7
Re: [PATCH v3 3/3] clk: qcom: Add Global Clock controller (GCC) driver for SDM845
Hi Amit,
Quoted 11 lines · Amit Nischal
Quoted 6 lines
Quoted 3 lines
+ /* Disable the GPLL0 active input to MMSS and GPU via MISC registers */ + regmap_update_bits(regmap, 0x09ffc, 0x3, 0x3);
+ regmap_update_bits(regmap, 0x71028, 0x3, 0x3);I think we'll have to throw in the pipe clk branch stuff in here too? And then drop the pipe clks from the driver?
All the USB pipe clocks would be taken care. The PCIE pipe branch clocks would have to be explicitly disabled so as to retain the memory logic. Otherwise, it would lead to memory corruption in case the external source is directly disabled without disabling the branch clock.
PHY driver is same for both USB and PCIE and both PHYs use pipe_clk. If there is indeed some limitation and pipe_clk cant be left enabled always then I will suggest to not change pipe_clk handling for USB as well.
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Stephen Boyd
maintainerRe: [PATCH v3 3/3] clk: qcom: Add Global Clock controller (GCC) driver for SDM845
Quoting Manu Gautam (2018-04-18 09:38:41)
Quoted 11 lines
Hi Amit,
Quoted 7 lines · Amit Nischal
Quoted 6 lines
Quoted 3 lines
+ /* Disable the GPLL0 active input to MMSS and GPU via MISC registers */ + regmap_update_bits(regmap, 0x09ffc, 0x3, 0x3);
+ regmap_update_bits(regmap, 0x71028, 0x3, 0x3);I think we'll have to throw in the pipe clk branch stuff in here too? And then drop the pipe clks from the driver?
Quoted 9 lines
Quoted 4 lines
All the USB pipe clocks would be taken care. The PCIE pipe branch clocks would have to be explicitly disabled so as to retain the memory logic. Otherwise, it would lead to memory corruption in case the external source is directly disabled without disabling the branch clock.
PHY driver is same for both USB and PCIE and both PHYs use
pipe_clk. If there is indeed some limitation andpipe_clkcant be left enabled always then I will suggest to not changepipe_clkhandling for USB as well.
Right. This is concerning if we have a half way solution.
Just to clarify my understanding, are you saying that the pcie pipe clks are also tied to the memory logic and so toggling them on/off is used to reset the memories inside the phy? Or the memories inside the controller? What is the pipe clk clocking in these cases?
Stephen Boyd
maintainerRe: [PATCH v3 3/3] clk: qcom: Add Global Clock controller (GCC) driver for SDM845
In reply to Amit NischalQuoting Amit Nischal (2018-04-18 06:03:49)
Quoted 17 lines · Stephen Boyd
Quoted 15 lines
Quoting Amit Nischal (2018-04-03 06:22:41)
drivers/clk/qcom/gcc-sdm845.c line 891
Quoted 12 lines
drivers/clk/qcom/gcc-sdm845.c new file +12
-0+ +static struct clk_rcg2 gcc_usb30_prim_mock_utmi_clk_src = { + .cmd_rcgr =0xf030 , + .mnd_width =0 , + .hid_width =5 , + .parent_map = gcc_parent_map_0, + .freq_tbl = ftbl_gcc_usb30_prim_mock_utmi_clk_src, + .clkr.hw.init = &(struct clk_init_data ){ + .name ="gcc_usb30_prim_mock_utmi_clk_src" , + .parent_names = gcc_parent_names_0, + .num_parents =4 , + .ops = &clk_rcg2_shared_ops,Still shared? Why?
Quoted 2 lines
We would require the
shared_opsfor clocks which are configured by bootloader.
Why? The bootloader is not active anymore.
Quoted 29 lines
Quoted 13 lines
Quoted 12 lines
drivers/clk/qcom/gcc-sdm845.c new file +4
-0+ +return qcom_cc_really_probe (pdev, &gcc_sdm845_desc, regmap); +} +include/dt-bindings/clock/qcom,gcc-sdm845.h new file +0
-0@@ -0,0 +1,242 @@[...]
Quoted 15 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h line 197
Quoted 10 lines
include/dt-bindings/clock/qcom,gcc-sdm845.h new file +8
-0+#define GCC_VDDA_VS_CLK 180 +#define GCC_VDDCX_VS_CLK 181 +#define GCC_VDDMX_VS_CLK 182 +#define GCC_VS_CTRL_AHB_CLK 183 +#define GCC_VS_CTRL_CLK 184 +#define GCC_VS_CTRL_CLK_SRC 185 +#define GCC_VSENSOR_CLK_SRC 186 +#define GPLL4 187Do you have the define for the quad spi clks? And the implementation for
it?
Quoted 1 line
In SDM845, Quad SPI clocks are part of gcc_qupv*_wrap*_s* clock group.
Ok thanks. I must have messed up my math before because it didn't match what bootloader was doing last time I checked.