Add GPU & Video Clock controller driver for SC7180
cover Add GPU & Video Clock controller driver for SC7180
[v1]
* Fabia PLLs could fail latching in the case where the PLL is not calibrated, so add support to calibrate in prepare clock ops.
* Add driver support for Graphics clock controller for SC7180 and also update device tree bindings for the various clocks supported in the clock controller.
* Add driver support for Video clock controller for SC7180 and also update device tree bindings for the various clocks supported in the clock controller.
This change depends on below GCC clock driver series
https://patchwork.kernel.org/project/linux-clk/list/?series=187089
Taniya Das (7):
clk: qcom: clk-alpha-pll: Add support for Fabia PLL calibration
dt-bindings: clock: Add YAML schemas for the QCOM GPUCC clock bindings
dt-bindings: clock: Introduce QCOM Graphics clock bindings
clk: qcom: Add graphics clock controller driver for SC7180
dt-bindings: clock: Add YAML schemas for the QCOM VIDEOCC clock
bindings
dt-bindings: clock: Introduce QCOM Video clock bindings
clk: qcom: Add video clock controller driver for SC7180
.../devicetree/bindings/clock/qcom,gpucc.txt | 24 -- .../devicetree/bindings/clock/qcom,gpucc.yaml | 70 ++++++ .../devicetree/bindings/clock/qcom,videocc.txt | 18 -- .../devicetree/bindings/clock/qcom,videocc.yaml | 62 +++++ drivers/clk/qcom/Kconfig | 16 ++ drivers/clk/qcom/Makefile | 2 + drivers/clk/qcom/clk-alpha-pll.c | 84 ++++++- drivers/clk/qcom/clk-alpha-pll.h | 4 + drivers/clk/qcom/gpucc-sc7180.c | 274 +++++++++++++++++++++ drivers/clk/qcom/videocc-sc7180.c | 263 ++++++++++++++++++++ include/dt-bindings/clock/qcom,gpucc-sc7180.h | 21 ++ include/dt-bindings/clock/qcom,videocc-sc7180.h | 23 ++ 12 files changed, 814 insertions(+), 47 deletions(-) delete mode 100644 Documentation/devicetree/bindings/clock/qcom,gpucc.txt create mode 100644 Documentation/devicetree/bindings/clock/qcom,gpucc.yaml delete mode 100644 Documentation/devicetree/bindings/clock/qcom,videocc.txt create mode 100644 Documentation/devicetree/bindings/clock/qcom,videocc.yaml create mode 100644 drivers/clk/qcom/gpucc-sc7180.c create mode 100644 drivers/clk/qcom/videocc-sc7180.c create mode 100644 include/dt-bindings/clock/qcom,gpucc-sc7180.h create mode 100644 include/dt-bindings/clock/qcom,videocc-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 1/7 clk: qcom: clk-alpha-pll: Add support for Fabia PLL calibration
In the cases where the PLL is not calibrated the PLL could fail to lock. Add support for prepare ops which would take care of the same.
Fabia PLL user/test control registers might required to be configured, so add support for configuring them.
--- drivers/clk/qcom/clk-alpha-pll.c | 84 +++++++++++++++++++++++++++++++++++++--- drivers/clk/qcom/clk-alpha-pll.h | 4 ++ 2 files changed, 83 insertions(+), 5 deletions(-)
drivers/clk/qcom/clk-alpha-pll.c +79 -5
@@ -1024,6 +1024,25 @@ void clk_fabia_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,regmap_write (regmap,PLL_CONFIG_CTL (pll), config->config_ctl_val); +if (config->config_ctl_hi_val) +regmap_write (regmap,PLL_CONFIG_CTL_U (pll), + config->config_ctl_hi_val); + +if (config->user_ctl_val) +regmap_write (regmap,PLL_USER_CTL (pll), config->user_ctl_val); + +if (config->user_ctl_hi_val) +regmap_write (regmap,PLL_USER_CTL_U (pll), + config->user_ctl_hi_val); + +if (config->test_ctl_val) +regmap_write (regmap,PLL_TEST_CTL (pll), + config->test_ctl_val); + +if (config->test_ctl_hi_val) +regmap_write (regmap,PLL_TEST_CTL_U (pll), + config->test_ctl_hi_val); +if (config->post_div_mask) { mask = config->post_div_mask; val = config->post_div_val;
@@ -1141,15 +1160,11 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long prate) {struct clk_alpha_pll *pll =to_clk_alpha_pll (hw); -u32 val, l, alpha_width =pll_alpha_width (pll); +u32 l, alpha_width =pll_alpha_width (pll);u64 a;unsigned long rrate;int ret =0 ; - ret =regmap_read (pll->clkr.regmap,PLL_MODE (pll), &val); -if (ret) -return ret; - rrate =alpha_pll_round_rate (rate, prate, &l, &a, alpha_width);/*
@@ -1167,7 +1182,66 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate,return __clk_alpha_pll_update_latch (pll); } +static int alpha_pll_fabia_prepare (struct clk_hw *hw) +{ +struct clk_alpha_pll *pll =to_clk_alpha_pll (hw); +const struct pll_vco *vco; +struct clk_hw *parent_hw; +unsigned long cal_freq, rrate; +u32 cal_l, regval, alpha_width =pll_alpha_width (pll); +u64 a; +int ret; + +/* Check if calibration needs to be done i.e. PLL is in reset */ + ret =regmap_read (pll->clkr.regmap,PLL_MODE (pll), ®val); +if (ret) +return ret; + +/* Return early if calibration is not needed. */ +if (regval &PLL_RESET_N ) +return 0 ; + + vco =alpha_pll_find_vco (pll,clk_hw_get_rate (hw)); +if (!vco) { +pr_err ("alpha pll: not in a valid vco range\n" ); +return -EINVAL ; + } + + cal_freq =DIV_ROUND_CLOSEST ((pll->vco_table[0 ].min_freq + + pll->vco_table[0 ].max_freq) *54 ,100 ); + + parent_hw =clk_hw_get_parent (hw); +if (!parent_hw) +return -EINVAL ; + + rrate =alpha_pll_round_rate (cal_freq,clk_hw_get_rate (parent_hw), + &cal_l, &a, alpha_width); +/* +* Due to a limited number of bits for fractional rate programming, the +* rounded up rate could be marginally higher than the requested rate. +*/ +if (rrate > (cal_freq +FABIA_PLL_RATE_MARGIN ) || rrate < cal_freq) { +pr_err ("Call set rate on the PLL with rounded rates!\n" ); +return -EINVAL ; + } + +/* Setup PLL for calibration frequency */ +regmap_write (pll->clkr.regmap,PLL_ALPHA_VAL (pll), cal_l); + +/* Bringup the pll at calibration frequency */ + ret =clk_alpha_pll_enable (hw); +if (ret) { +pr_err ("alpha pll calibration failed\n" ); +return ret; + } + +clk_alpha_pll_disable (hw); + +return 0 ; +} +const struct clk_ops clk_alpha_pll_fabia_ops = { + .prepare = alpha_pll_fabia_prepare, .enable = alpha_pll_fabia_enable, .disable = alpha_pll_fabia_disable, .is_enabled = clk_alpha_pll_is_enabled,
drivers/clk/qcom/clk-alpha-pll.h +4 -0
@@ -94,6 +94,10 @@ struct alpha_pll_config {u32 alpha_hi;u32 config_ctl_val;u32 config_ctl_hi_val; +u32 user_ctl_val; +u32 user_ctl_hi_val; +u32 test_ctl_val; +u32 test_ctl_hi_val;u32 main_output_mask;u32 aux_output_mask;u32 aux2_output_mask;
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH 2/7 dt-bindings: clock: Add YAML schemas for the QCOM GPUCC clock bindings
In reply to Taniya DasThe GPUCC clock provider have a bunch of generic properties that are needed in a device tree. Add a YAML schemas for those.
--- .../devicetree/bindings/clock/qcom,gpucc.txt | 24 -------- .../devicetree/bindings/clock/qcom,gpucc.yaml | 69 ++++++++++++++++++++++ 2 files changed, 69 insertions(+), 24 deletions(-) delete mode 100644 Documentation/devicetree/bindings/clock/qcom,gpucc.txt create mode 100644 Documentation/devicetree/bindings/clock/qcom,gpucc.yaml
Documentation/devicetree/bindings/clock/qcom,gpucc.txt deleted +0 -24
@@ -1,24 +0,0 @@ -Qualcomm Graphics Clock & Reset Controller Binding --------------------------------------------------- - -Required properties : -- compatible : shall contain "qcom,sdm845-gpucc" or "qcom,msm8998-gpucc" -- reg : shall contain base register location and length -- #clock-cells : from common clock binding, shall contain 1 -- #reset-cells : from common reset binding, shall contain 1 -- #power-domain-cells : from generic power domain binding, shall contain 1 -- clocks : shall contain the XO clock - shall contain the gpll0 out main clock (msm8998) -- clock-names : shall be "xo" - shall be "gpll0" (msm8998) - -Example: - gpucc: clock-controller@5090000 { - compatible = "qcom,sdm845-gpucc"; - reg = <0x5090000 0x9000>; - #clock-cells = <1>; - #reset-cells = <1>; - #power-domain-cells = <1>; - clocks = <&rpmhcc RPMH_CXO_CLK>; - clock-names = "xo"; - };
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml new file +69 -0
69 lines not on this page · raw message
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH 3/7 dt-bindings: clock: Introduce QCOM Graphics clock bindings
In reply to Taniya DasAdd device tree bindings for graphics clock controller for Qualcomm Technology Inc's SC7180 SoCs.
--- .../devicetree/bindings/clock/qcom,gpucc.yaml | 1 + include/dt-bindings/clock/qcom,gpucc-sc7180.h | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 include/dt-bindings/clock/qcom,gpucc-sc7180.h
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml +1 -0
@@ -18,6 +18,7 @@ properties: enum: - qcom,sdm845-gpucc - qcom,msm8998-gpucc + - qcom,sc7180-gpucc clocks: minItems: 1
include/dt-bindings/clock/qcom,gpucc-sc7180.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +*/ + +#ifndef _DT_BINDINGS_CLK_QCOM_GPU_CC_SC7180_H +#define _DT_BINDINGS_CLK_QCOM_GPU_CC_SC7180_H + +#define GPU_CC_PLL1 0 +#define GPU_CC_AHB_CLK 1 +#define GPU_CC_CRC_AHB_CLK 2 +#define GPU_CC_CX_GMU_CLK 3 +#define GPU_CC_CX_SNOC_DVM_CLK 4 +#define GPU_CC_CXO_AON_CLK 5 +#define GPU_CC_CXO_CLK 6 +#define GPU_CC_GMU_CLK_SRC 7 + +/* CAM_CC GDSCRs */ +#define CX_GDSC 0 + +#endif
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH 4/7 clk: qcom: Add graphics clock controller driver for SC7180
In reply to Taniya DasAdd support for the graphics clock controller found on SC7180 based devices. This would allow graphics drivers to probe and control their clocks.
--- drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/gpucc-sc7180.c | 274 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 283 insertions(+) create mode 100644 drivers/clk/qcom/gpucc-sc7180.c
drivers/clk/qcom/Kconfig +8 -0
@@ -236,6 +236,14 @@ config SC_GCC_7180 Say Y if you want to use peripheral devices such as UART, SPI, I2C, USB, UFS, SDCC, etc. +config SC_GPUCC_7180 + tristate "SC7180 Graphics Clock Controller" + select SC_GCC_7180 + help + Support for the graphics clock controller on SC7180 devices. + Say Y if you want to support graphics controller devices and + functionality such as 3D graphics. + config SDM_CAMCC_845 tristate "SDM845 Camera Clock Controller" select SDM_GCC_845
drivers/clk/qcom/Makefile +1 -0
@@ -44,6 +44,7 @@ obj-$(CONFIG_QCOM_CLK_SMD_RPM) += clk-smd-rpm.o obj-$(CONFIG_QCS_GCC_404) += gcc-qcs404.o obj-$(CONFIG_QCS_TURING_404) += turingcc-qcs404.o obj-$(CONFIG_SC_GCC_7180) += gcc-sc7180.o +obj-$(CONFIG_SC_GPUCC_7180) += gpucc-sc7180.o obj-$(CONFIG_SDM_CAMCC_845) += camcc-sdm845.o obj-$(CONFIG_SDM_DISPCC_845) += dispcc-sdm845.o obj-$(CONFIG_SDM_GCC_660) += gcc-sdm660.o
drivers/clk/qcom/gpucc-sc7180.c new file +274 -0
274 lines not on this page · raw message
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH 5/7 dt-bindings: clock: Add YAML schemas for the QCOM VIDEOCC clock bindings
In reply to Taniya DasThe VIDEOCC clock provider have a bunch of generic properties that are needed in a device tree. Add a YAML schemas for those.
--- .../devicetree/bindings/clock/qcom,videocc.txt | 18 ------- .../devicetree/bindings/clock/qcom,videocc.yaml | 61 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 18 deletions(-) delete mode 100644 Documentation/devicetree/bindings/clock/qcom,videocc.txt create mode 100644 Documentation/devicetree/bindings/clock/qcom,videocc.yaml
Documentation/devicetree/bindings/clock/qcom,videocc.txt deleted +0 -18
@@ -1,18 +0,0 @@ -Qualcomm Video Clock & Reset Controller Binding ------------------------------------------------ - -Required properties : -- compatible : shall contain "qcom,sdm845-videocc" -- reg : shall contain base register location and length -- #clock-cells : from common clock binding, shall contain 1. -- #power-domain-cells : from generic power domain binding, shall contain 1. -- #reset-cells : from common reset binding, shall contain 1. - -Example: - videocc: clock-controller@ab00000 { - compatible = "qcom,sdm845-videocc"; - reg = <0xab00000 0x10000>; - #clock-cells = <1>; - #power-domain-cells = <1>; - #reset-cells = <1>; - };
Documentation/devicetree/bindings/clock/qcom,videocc.yaml new file +61 -0
61 lines not on this page · raw message
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH 6/7 dt-bindings: clock: Introduce QCOM Video clock bindings
In reply to Taniya DasAdd device tree bindings for video clock controller for Qualcomm Technology Inc's SC7180 SoCs.
--- .../devicetree/bindings/clock/qcom,videocc.yaml | 1 + include/dt-bindings/clock/qcom,videocc-sc7180.h | 23 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 include/dt-bindings/clock/qcom,videocc-sc7180.h
Documentation/devicetree/bindings/clock/qcom,videocc.yaml +1 -0
@@ -17,6 +17,7 @@ properties: compatible: enum: - qcom,sdm845-videocc + - qcom,sc7180-videocc clocks: maxItems: 1
include/dt-bindings/clock/qcom,videocc-sc7180.h new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +*/ + +#ifndef _DT_BINDINGS_CLK_QCOM_VIDEO_CC_SC7180_H +#define _DT_BINDINGS_CLK_QCOM_VIDEO_CC_SC7180_H + +/* VIDEO_CC clocks */ +#define VIDEO_PLL0 0 +#define VIDEO_CC_VCODEC0_AXI_CLK 1 +#define VIDEO_CC_VCODEC0_CORE_CLK 2 +#define VIDEO_CC_VENUS_AHB_CLK 3 +#define VIDEO_CC_VENUS_CLK_SRC 4 +#define VIDEO_CC_VENUS_CTL_AXI_CLK 5 +#define VIDEO_CC_VENUS_CTL_CORE_CLK 6 +#define VIDEO_CC_XO_CLK 7 + +/* VIDEO_CC GDSCRs */ +#define VENUS_GDSC 0 +#define VCODEC0_GDSC 1 + +#endif
--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member of the Code Aurora Forum, hosted by the Linux Foundation.
PATCH 7/7 clk: qcom: Add video clock controller driver for SC7180
In reply to Taniya DasAdd support for the video clock controller found on SC7180 based devices. This would allow video drivers to probe and control their clocks.
--- drivers/clk/qcom/Kconfig | 8 ++ drivers/clk/qcom/Makefile | 1 + drivers/clk/qcom/videocc-sc7180.c | 263 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 272 insertions(+) create mode 100644 drivers/clk/qcom/videocc-sc7180.c
drivers/clk/qcom/Kconfig +8 -0
@@ -244,6 +244,14 @@ config SC_GPUCC_7180 Say Y if you want to support graphics controller devices and functionality such as 3D graphics. +config SC_VIDEOCC_7180 + tristate "SC7180 Video Clock Controller" + select SC_GCC_7180 + help + Support for the video clock controller on SC7180 devices. + Say Y if you want to support video devices and functionality such as + video encode and decode. + config SDM_CAMCC_845 tristate "SDM845 Camera Clock Controller" select SDM_GCC_845
drivers/clk/qcom/Makefile +1 -0
@@ -45,6 +45,7 @@ obj-$(CONFIG_QCS_GCC_404) += gcc-qcs404.o obj-$(CONFIG_QCS_TURING_404) += turingcc-qcs404.o obj-$(CONFIG_SC_GCC_7180) += gcc-sc7180.o obj-$(CONFIG_SC_GPUCC_7180) += gpucc-sc7180.o +obj-$(CONFIG_SC_VIDEOCC_7180) += videocc-sc7180.o obj-$(CONFIG_SDM_CAMCC_845) += camcc-sdm845.o obj-$(CONFIG_SDM_DISPCC_845) += dispcc-sdm845.o obj-$(CONFIG_SDM_GCC_660) += gcc-sdm660.o
drivers/clk/qcom/videocc-sc7180.c new file +263 -0
263 lines not on this page · raw message
--
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 v1 2/7] dt-bindings: clock: Add YAML schemas for the QCOM GPUCC clock bindings
In reply to Taniya DasQuoting Taniya Das (2019-10-31 05:21:08)
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml line 1
Quoted 7 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml new file +1
-0@@ -0,0 +1,69 @@ +# SPDX-License-Identifier: GPL-2.0-only
Can it be GPL2 or BSD? I think Rob is asking for that sort of license on these files.
Quoted 9 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml new file +9
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/clock/qcom,gpucc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Graphics Clock & Reset Controller Binding + +maintainers: + - Taniya Das <[email protected]>
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml line 20
Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml new file +10
-0+ +description: | + Qualcomm grpahics clock control module which supports the clocks, resets and + power domains. + +properties: + compatible: + enum: + - qcom,sdm845-gpucc + - qcom,msm8998-gpucc
Sort please.
Stephen Boyd
maintainerRe: [PATCH v1 4/7] clk: qcom: Add graphics clock controller driver for SC7180
In reply to Taniya DasQuoting Taniya Das (2019-10-31 05:21:10)
Quoted 7 lines
drivers/clk/qcom/gpucc-sc7180.c new file +1
-0@@ -0,0 +1,274 @@ +// SPDX-License-Identifier: GPL-2.0-only
drivers/clk/qcom/gpucc-sc7180.c line 11
Quoted 10 lines
drivers/clk/qcom/gpucc-sc7180.c new file +10
-0+/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +*/ + +#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h>
Are these of includes used?
Quoted 19 lines
drivers/clk/qcom/gpucc-sc7180.c new file +19
-0+#include <linux/regmap.h> + +#include <dt-bindings/clock/qcom,gpucc-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" + +#define CX_GMU_CBCR_SLEEP_MASK 0xF +#define CX_GMU_CBCR_SLEEP_SHIFT 4 +#define CX_GMU_CBCR_WAKE_MASK 0xF +#define CX_GMU_CBCR_WAKE_SHIFT 8 +#define CLK_DIS_WAIT_SHIFT 12 +#define CLK_DIS_WAIT_MASK (0xf << CLK_DIS_WAIT_SHIFT) + +enum {
drivers/clk/qcom/gpucc-sc7180.c line 40
Quoted 10 lines
drivers/clk/qcom/gpucc-sc7180.c new file +10
-0+P_BI_TCXO , +P_CORE_BI_PLL_TEST_SE , +P_GPLL0_OUT_MAIN , +P_GPLL0_OUT_MAIN_DIV , +P_GPU_CC_PLL1_OUT_EVEN , +P_GPU_CC_PLL1_OUT_MAIN , + P_GPU_CC_PLL1_OUT_ODD, +}; + +static struct pll_vco fabia_vco[] = {
const?
Quoted 4 lines
drivers/clk/qcom/gpucc-sc7180.c new file +4
-0+ { 249600000, 2000000000, 0 }, +}; + +static struct clk_alpha_pll gpu_cc_pll1 = {
drivers/clk/qcom/gpucc-sc7180.c line 54
Quoted 10 lines
drivers/clk/qcom/gpucc-sc7180.c new file +10
-0+ .offset = 0x100, + .vco_table = fabia_vco, + .num_vco = ARRAY_SIZE(fabia_vco), + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA], + .clkr = { + .hw.init = &(struct clk_init_data){ + .name = "gpu_cc_pll1", + .parent_data = &(const struct clk_parent_data){ + .fw_name = "bi_tcxo", + .name = "bi_tcxo",
Do we need both? This is new so it should just work with .fw_name right?
Quoted 13 lines
drivers/clk/qcom/gpucc-sc7180.c new file +13
-0+ }, + .num_parents = 1, + .ops = &clk_alpha_pll_fabia_ops, + }, + }, +}; + +static const struct parent_map gpu_cc_parent_map_0[] = { + {P_BI_TCXO ,0 }, + {P_GPU_CC_PLL1_OUT_MAIN ,3 }, + {P_GPLL0_OUT_MAIN ,5 }, + {P_GPLL0_OUT_MAIN_DIV ,6 }, + { P_CORE_BI_PLL_TEST_SE, 7 },
drivers/clk/qcom/gpucc-sc7180.c line 77
Quoted 10 lines
drivers/clk/qcom/gpucc-sc7180.c new file +10
-0+}; + +static const struct clk_parent_data gpu_cc_parent_data_0[] = { + { .fw_name ="bi_tcxo" , .name ="bi_tcxo" }, + { .hw = &gpu_cc_pll1.clkr.hw }, + { .fw_name ="gcc_gpu_gpll0_clk_src" , .name ="gcc_gpu_gpll0_clk_src" }, + { .fw_name ="gcc_gpu_gpll0_div_clk_src" , + .name ="gcc_gpu_gpll0_div_clk_src" }, + { .fw_name ="core_bi_pll_test_se" , .name ="core_bi_pll_test_se" }, +};
Same for these.
Quoted 6 lines
drivers/clk/qcom/gpucc-sc7180.c new file +6
-0+ +static const struct freq_tbl ftbl_gpu_cc_gmu_clk_src[] = { +F (19200000 ,P_BI_TCXO ,1 ,0 ,0 ), +F (200000000 ,P_GPLL0_OUT_MAIN_DIV ,1.5 ,0 ,0 ), + { } +};
[..]
Quoted 10 lines
drivers/clk/qcom/gpucc-sc7180.c new file +10
-0+ + +static int gpu_cc_sc7180_probe (struct platform_device *pdev) +{ +struct regmap *regmap; +struct alpha_pll_config gpu_cc_pll_config = {}; +unsigned int value, mask; + + regmap =qcom_cc_map (pdev, &gpu_cc_sc7180_desc); +if (IS_ERR (regmap))
drivers/clk/qcom/gpucc-sc7180.c line 233
Quoted 10 lines
drivers/clk/qcom/gpucc-sc7180.c new file +10
-0+return PTR_ERR (regmap); + +/* 360MHz Configuration */ + gpu_cc_pll_config.l =0x12 ; + gpu_cc_pll_config.alpha =0xC000 ; + gpu_cc_pll_config.config_ctl_val =0x20485699 ; + gpu_cc_pll_config.config_ctl_hi_val =0x00002067 ; + gpu_cc_pll_config.user_ctl_val =0x00000001 ; + gpu_cc_pll_config.user_ctl_hi_val =0x00004805 ; + gpu_cc_pll_config.test_ctl_hi_val =0x40000000 ;
Is there a reason this is built on the stack? Save space or something?
drivers/clk/qcom/gpucc-sc7180.c line 240
Quoted 7 lines
drivers/clk/qcom/gpucc-sc7180.c new file +7
-0+ +clk_fabia_pll_configure (&gpu_cc_pll1, regmap, &gpu_cc_pll_config); + +/* Recommended WAKEUP/SLEEP settings for the gpu_cc_cx_gmu_clk */ + mask =CX_GMU_CBCR_WAKE_MASK <<CX_GMU_CBCR_WAKE_SHIFT ; + mask |=CX_GMU_CBCR_SLEEP_MASK <<CX_GMU_CBCR_SLEEP_SHIFT ; + value =0xF <<CX_GMU_CBCR_WAKE_SHIFT |0xF <<CX_GMU_CBCR_SLEEP_SHIFT ;
mask and value can just be big constants? I'm not sure anyone cares to tweak this later, but I guess it's fine this way too.
drivers/clk/qcom/gpucc-sc7180.c line 243
Quoted 3 lines
drivers/clk/qcom/gpucc-sc7180.c new file +3
-0+regmap_update_bits (regmap,0x1098 , mask, value); + +/* gpu_cc_ahb_clk */
What are we doing to gpu_cc_ahb_clk??
Quoted 12 lines
drivers/clk/qcom/gpucc-sc7180.c new file +12
-0+regmap_update_bits (regmap,0x1078 ,0x1 ,0x1 ); + +/* Configure clk_dis_wait for gpu_cx_gdsc */ +regmap_update_bits (regmap,0x106c ,CLK_DIS_WAIT_MASK , +8 <<CLK_DIS_WAIT_SHIFT ); + +return qcom_cc_really_probe (pdev, &gpu_cc_sc7180_desc, regmap); +} + +static struct platform_driver gpu_cc_sc7180_driver = { + .probe = gpu_cc_sc7180_probe, + .driver = {
drivers/clk/qcom/gpucc-sc7180.c line 265
Quoted 10 lines
drivers/clk/qcom/gpucc-sc7180.c new file +10
-0+ .name = "sc7180-gpucc", + .of_match_table = gpu_cc_sc7180_match_table, + }, +}; + +static int __init gpu_cc_sc7180_init (void ) +{ +return platform_driver_register (&gpu_cc_sc7180_driver); +} +core_initcall (gpu_cc_sc7180_init);
Does it need to be core initcal? Maybe module_platform_driver() works just as well?
Quoted 9 lines
drivers/clk/qcom/gpucc-sc7180.c new file +9
-0+ +static void __exit gpu_cc_sc7180_exit(void) +{ +platform_driver_unregister (&gpu_cc_sc7180_driver); +} +module_exit (gpu_cc_sc7180_exit); + +MODULE_DESCRIPTION ("QTI GPU_CC SC7180 Driver" ); +MODULE_LICENSE ("GPL v2" );
Stephen Boyd
maintainerRe: [PATCH v1 1/7] clk: qcom: clk-alpha-pll: Add support for Fabia PLL calibration
In reply to Taniya DasQuoting Taniya Das (2019-10-31 05:21:07)
Quoted 11 lines
drivers/clk/qcom/clk-alpha-pll.c +1
-1@@ -1141,15 +1160,11 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long prate) {struct clk_alpha_pll *pll =to_clk_alpha_pll (hw); -u32 val, l, alpha_width =pll_alpha_width (pll); +u32 l, alpha_width =pll_alpha_width (pll);u64 a;
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1170
Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c +0
-4unsigned long rrate;int ret =0 ; - ret =regmap_read (pll->clkr.regmap,PLL_MODE (pll), &val); -if (ret) -return ret; - rrate =alpha_pll_round_rate (rate, prate, &l, &a, alpha_width);/*
How is this diff related? Looks like it should be split off into another patch to remove a useless register read.
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1186
Quoted 6 lines
drivers/clk/qcom/clk-alpha-pll.c +2
-0@@ -1167,7 +1182,66 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate,return __clk_alpha_pll_update_latch (pll); } +static int alpha_pll_fabia_prepare (struct clk_hw *hw) +{
Why are we doing this in prepare vs. doing it at PLL configuration time? Does it need to be recalibrated each time the PLL is enabled?
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1196
Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c +10
-0+struct clk_alpha_pll *pll =to_clk_alpha_pll (hw); +const struct pll_vco *vco; +struct clk_hw *parent_hw; +unsigned long cal_freq, rrate; +u32 cal_l, regval, alpha_width =pll_alpha_width (pll); +u64 a; +int ret; + +/* Check if calibration needs to be done i.e. PLL is in reset */ + ret =regmap_read (pll->clkr.regmap,PLL_MODE (pll), ®val);
Please use 'val' instead of 'regval' as regval almost never appears in this file already.
Quoted 5 lines
drivers/clk/qcom/clk-alpha-pll.c +5
-0+if (ret) +return ret; + +/* Return early if calibration is not needed. */ +if (regval &PLL_RESET_N )
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1211
Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c +10
-0+return 0 ; + + vco =alpha_pll_find_vco (pll,clk_hw_get_rate (hw)); +if (!vco) { +pr_err ("alpha pll: not in a valid vco range\n" ); +return -EINVAL ; + } + + cal_freq =DIV_ROUND_CLOSEST ((pll->vco_table[0 ].min_freq + + pll->vco_table[0 ].max_freq) *54 ,100 );
Do we need to cast the first argument to a u64 to avoid overflow?
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1224
Quoted 13 lines
drivers/clk/qcom/clk-alpha-pll.c +13
-0+ + parent_hw =clk_hw_get_parent (hw); +if (!parent_hw) +return -EINVAL ; + + rrate =alpha_pll_round_rate (cal_freq,clk_hw_get_rate (parent_hw), + &cal_l, &a, alpha_width); +/* +* Due to a limited number of bits for fractional rate programming, the +* rounded up rate could be marginally higher than the requested rate. +*/ +if (rrate > (cal_freq +FABIA_PLL_RATE_MARGIN ) || rrate < cal_freq) { +pr_err ("Call set rate on the PLL with rounded rates!\n" );
This message is weird. Drivers shouldn't need to call set rate with rounded rates. What is going on?
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1231
Quoted 7 lines
drivers/clk/qcom/clk-alpha-pll.c +7
-0+return -EINVAL ; + } + +/* Setup PLL for calibration frequency */ +regmap_write (pll->clkr.regmap,PLL_ALPHA_VAL (pll), cal_l); + +/* Bringup the pll at calibration frequency */
capitalize PLL.
Quoted 11 lines
drivers/clk/qcom/clk-alpha-pll.c +11
-0+ ret =clk_alpha_pll_enable (hw); +if (ret) { +pr_err ("alpha pll calibration failed\n" ); +return ret; + } + +clk_alpha_pll_disable (hw); + +return 0 ; +} +
Stephen Boyd
maintainerRe: [PATCH v1 6/7] dt-bindings: clock: Introduce QCOM Video clock bindings
In reply to Taniya DasQuoting Taniya Das (2019-10-31 05:21:12)
Documentation/devicetree/bindings/clock/qcom,videocc.yaml properties: · line 20
Quoted 9 lines
Documentation/devicetree/bindings/clock/qcom,videocc.yaml +1
-0@@ -17,6 +17,7 @@ properties: compatible: enum: - qcom,sdm845-videocc + - qcom,sc7180-videocc
Sort.
Quoted 3 lines
Documentation/devicetree/bindings/clock/qcom,videocc.yaml +0
-0clocks: maxItems: 1
Stephen Boyd
maintainerRe: [PATCH v1 7/7] clk: qcom: Add video clock controller driver for SC7180
In reply to Taniya DasQuoting Taniya Das (2019-10-31 05:21:13)
Quoted 7 lines
drivers/clk/qcom/videocc-sc7180.c new file +1
-0@@ -0,0 +1,263 @@ +// SPDX-License-Identifier: GPL-2.0-only
drivers/clk/qcom/videocc-sc7180.c line 11
Quoted 10 lines
drivers/clk/qcom/videocc-sc7180.c new file +10
-0+/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +*/ + +#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h>
Are these of includes used?
Quoted 11 lines
drivers/clk/qcom/videocc-sc7180.c new file +11
-0+#include <linux/regmap.h> + +#include <dt-bindings/clock/qcom,videocc-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" +
drivers/clk/qcom/videocc-sc7180.c line 32
Quoted 10 lines
drivers/clk/qcom/videocc-sc7180.c new file +10
-0+enum { +P_BI_TCXO , +P_CHIP_SLEEP_CLK , +P_CORE_BI_PLL_TEST_SE , +P_VIDEO_PLL0_OUT_EVEN , +P_VIDEO_PLL0_OUT_MAIN , +P_VIDEO_PLL0_OUT_ODD , +}; + +static struct pll_vco fabia_vco[] = {
const?
Quoted 3 lines
drivers/clk/qcom/videocc-sc7180.c new file +3
-0+ { 249600000, 2000000000, 0 }, +}; +
[...]
drivers/clk/qcom/videocc-sc7180.c line 229
Quoted 11 lines
drivers/clk/qcom/videocc-sc7180.c new file +11
-0+ +static int video_cc_sc7180_probe (struct platform_device *pdev) +{ +struct regmap *regmap; +struct alpha_pll_config video_pll0_config = {}; + + regmap =qcom_cc_map (pdev, &video_cc_sc7180_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + + video_pll0_config.l =0x1F ;
lowercase hex please.
drivers/clk/qcom/videocc-sc7180.c line 232
Quoted 3 lines
drivers/clk/qcom/videocc-sc7180.c new file +3
-0+ video_pll0_config.alpha =0x4000 ; + video_pll0_config.user_ctl_val =0x00000001 ; + video_pll0_config.user_ctl_hi_val =0x00004805 ;
Same question, why on stack?
drivers/clk/qcom/videocc-sc7180.c line 236
Quoted 4 lines
drivers/clk/qcom/videocc-sc7180.c new file +4
-0+ +clk_fabia_pll_configure (&video_pll0, regmap, &video_pll0_config); + +/* video_cc_xo_clk */
What are we doing? Enabling it?
Quoted 14 lines
drivers/clk/qcom/videocc-sc7180.c new file +14
-0+regmap_update_bits (regmap,0x984 ,0x1 ,0x1 ); + +return qcom_cc_really_probe (pdev, &video_cc_sc7180_desc, regmap); +} + +static struct platform_driver video_cc_sc7180_driver = { + .probe = video_cc_sc7180_probe, + .driver = { + .name ="sc7180-videocc" , + .of_match_table = video_cc_sc7180_match_table, + }, +}; + +static int __init video_cc_sc7180_init (void )
drivers/clk/qcom/videocc-sc7180.c line 260
Quoted 10 lines
drivers/clk/qcom/videocc-sc7180.c new file +10
-0+{ +return platform_driver_register (&video_cc_sc7180_driver); +} +core_initcall (video_cc_sc7180_init); + +static void __exit video_cc_sc7180_exit(void) +{ +platform_driver_unregister (&video_cc_sc7180_driver); +} +module_exit (video_cc_sc7180_exit);
Same question, module platform driver perhaps?
Rob Herring
maintainerRe: [PATCH v1 2/7] dt-bindings: clock: Add YAML schemas for the QCOM GPUCC clock bindings
In reply to Stephen BoydQuoted 12 lines · Stephen Boyd
Quoting Taniya Das (2019-10-31 05:21:08)
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml line 1
Quoted 7 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml new file +1
-0@@ -0,0 +1,69 @@ +# SPDX-License-Identifier: GPL-2.0-onlyCan it be GPL2 or BSD? I think Rob is asking for that sort of license on these files.
I do, but only on new bindings unless we determine relicensing is okay. Though here it doesn't look like much is copied over.
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml new file +13
-0+%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bindings/clock/qcom,gpucc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Graphics Clock & Reset Controller Binding + +maintainers: + - Taniya Das <[email protected]> + +description: | + Qualcomm grpahics clock control module which supports the clocks, resets and + power domains.
Quoted 8 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml line 20
Quoted 6 lines
Documentation/devicetree/bindings/clock/qcom,gpucc.yaml new file +6
-0+ +properties: + compatible: + enum: + - qcom,sdm845-gpucc + - qcom,msm8998-gpuccSort please.
When you get tired of telling people to do this we can make the tooling do it. :) Shouldn't be too hard. The majority of the work is probably fixing the existing cases that aren't sorted.
Rob
Re: [PATCH v1 3/7] dt-bindings: clock: Introduce QCOM Graphics clock bindings
In reply to Taniya DasQuoted 10 lines · Taniya Das
Add device tree bindings for graphics clock controller for Qualcomm Technology Inc's SC7180 SoCs.
Signed-off-by Taniya Das <[email protected]>--- .../devicetree/bindings/clock/qcom,gpucc.yaml | 1 + include/dt-bindings/clock/qcom,gpucc-sc7180.h | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 include/dt-bindings/clock/qcom,gpucc-sc7180.h
Re: [PATCH v1 5/7] dt-bindings: clock: Add YAML schemas for the QCOM VIDEOCC clock bindings
In reply to Taniya DasQuoted 11 lines · Taniya Das
The VIDEOCC clock provider have a bunch of generic properties that are needed in a device tree. Add a YAML schemas for those.
Signed-off-by Taniya Das <[email protected]>--- .../devicetree/bindings/clock/qcom,videocc.txt | 18 ------- .../devicetree/bindings/clock/qcom,videocc.yaml | 61 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 18 deletions(-) delete mode 100644 Documentation/devicetree/bindings/clock/qcom,videocc.txt create mode 100644 Documentation/devicetree/bindings/clock/qcom,videocc.yaml
Re: [PATCH v1 1/7] clk: qcom: clk-alpha-pll: Add support for Fabia PLL calibration
In reply to Taniya DasHi,
Quoted 4 lines · Taniya Das
drivers/clk/qcom/clk-alpha-pll.c +0
-0@@ -1141,15 +1160,11 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long prate) {
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1151
Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c +1
-4struct clk_alpha_pll *pll =to_clk_alpha_pll (hw); -u32 val, l, alpha_width =pll_alpha_width (pll); +u32 l, alpha_width =pll_alpha_width (pll);u64 a;unsigned long rrate;int ret =0 ; - ret =regmap_read (pll->clkr.regmap,PLL_MODE (pll), &val); -if (ret) -return ret;
My compiler happened to notice that with the change to this function:
drivers/clk/qcom/clk-alpha-pll.c:1166:6: error: unused variable 'ret' [-Werror,-Wunused-variable]
int ret = 0;
-Doug
Re: [PATCH v1 1/7] clk: qcom: clk-alpha-pll: Add support for Fabia PLL calibration
In reply to Stephen BoydHi Stephen,
Thanks for your review.
Quoted 21 lines · Stephen Boyd
Quoting Taniya Das (2019-10-31 05:21:07)
Quoted 20 lines
drivers/clk/qcom/clk-alpha-pll.c +1
-5@@ -1141,15 +1160,11 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long prate) {struct clk_alpha_pll *pll =to_clk_alpha_pll (hw); -u32 val, l, alpha_width =pll_alpha_width (pll); +u32 l, alpha_width =pll_alpha_width (pll);u64 a;unsigned long rrate;int ret =0 ; - ret =regmap_read (pll->clkr.regmap,PLL_MODE (pll), &val); -if (ret) -return ret; - rrate =alpha_pll_round_rate (rate, prate, &l, &a, alpha_width);
Quoted 5 lines
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1170
Quoted 1 line
drivers/clk/qcom/clk-alpha-pll.c +0
-0/* How is this diff related? Looks like it should be split off into another patch to remove a useless register read.
I will split this in different patch.
Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1186
Quoted 6 lines
drivers/clk/qcom/clk-alpha-pll.c +2
-0@@ -1167,7 +1182,66 @@ static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate,return __clk_alpha_pll_update_latch (pll); } +static int alpha_pll_fabia_prepare (struct clk_hw *hw) +{Why are we doing this in prepare vs. doing it at PLL configuration time? Does it need to be recalibrated each time the PLL is enabled?
In the case if PLL looses the configuration then we would encounter PLL locking issues. Thus want to go ahead with prepare. In the case it is calibrated it would return.
Quoted 11 lines
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1196
Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c +10
-0+struct clk_alpha_pll *pll =to_clk_alpha_pll (hw); +const struct pll_vco *vco; +struct clk_hw *parent_hw; +unsigned long cal_freq, rrate; +u32 cal_l, regval, alpha_width =pll_alpha_width (pll); +u64 a; +int ret; + +/* Check if calibration needs to be done i.e. PLL is in reset */ + ret =regmap_read (pll->clkr.regmap,PLL_MODE (pll), ®val);
Quoted 3 lines
Please use 'val' instead of 'regval' as regval almost never appears in this file already.
Sure, will use 'val'.
Quoted 9 lines
Quoted 9 lines
drivers/clk/qcom/clk-alpha-pll.c +9
-0+if (ret) +return ret; + +/* Return early if calibration is not needed. */ +if (regval &PLL_RESET_N ) +return 0 ; + + vco =alpha_pll_find_vco (pll,clk_hw_get_rate (hw)); +if (!vco) {
Quoted 9 lines
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1211
Quoted 6 lines
drivers/clk/qcom/clk-alpha-pll.c +6
-0+pr_err ("alpha pll: not in a valid vco range\n" ); +return -EINVAL ; + } + + cal_freq =DIV_ROUND_CLOSEST ((pll->vco_table[0 ].min_freq + + pll->vco_table[0 ].max_freq) *54 ,100 );Do we need to cast the first argument to a u64 to avoid overflow?
No we do not need.
Quoted 8 lines
Quoted 8 lines
drivers/clk/qcom/clk-alpha-pll.c +8
-0+ + parent_hw =clk_hw_get_parent (hw); +if (!parent_hw) +return -EINVAL ; + + rrate =alpha_pll_round_rate (cal_freq,clk_hw_get_rate (parent_hw), + &cal_l, &a, alpha_width); +/*
Quoted 9 lines
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1224
Quoted 5 lines
drivers/clk/qcom/clk-alpha-pll.c +5
-0+* Due to a limited number of bits for fractional rate programming, the +* rounded up rate could be marginally higher than the requested rate. +*/ +if (rrate > (cal_freq +FABIA_PLL_RATE_MARGIN ) || rrate < cal_freq) { +pr_err ("Call set rate on the PLL with rounded rates!\n" );This message is weird. Drivers shouldn't need to call set rate with rounded rates. What is going on?
:), my bad, copy paste from another function. I will remove this print.
Quoted 10 lines
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1231
Quoted 7 lines
drivers/clk/qcom/clk-alpha-pll.c +7
-0+return -EINVAL ; + } + +/* Setup PLL for calibration frequency */ +regmap_write (pll->clkr.regmap,PLL_ALPHA_VAL (pll), cal_l); + +/* Bringup the pll at calibration frequency */ capitalize PLL.
Will take care of it.
Quoted 11 lines
Quoted 11 lines
drivers/clk/qcom/clk-alpha-pll.c +11
-0+ ret =clk_alpha_pll_enable (hw); +if (ret) { +pr_err ("alpha pll calibration failed\n" ); +return ret; + } + +clk_alpha_pll_disable (hw); + +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. --
Re: [PATCH v1 1/7] clk: qcom: clk-alpha-pll: Add support for Fabia PLL calibration
In reply to Doug AndersonHi Doug,
Quoted 4 lines · Doug Anderson
drivers/clk/qcom/clk-alpha-pll.c static int alpha_pll_fabia_set_rate(struct clk_hw *hw, unsigned long rate, · line 1151
Quoted 3 lines
drivers/clk/qcom/clk-alpha-pll.c +0
-3- ret =regmap_read (pll->clkr.regmap,PLL_MODE (pll), &val); -if (ret) -return ret;
Quoted 8 lines
My compiler happened to notice that with the change to this function:
drivers/clk/qcom/clk-alpha-pll.c:1166:6: error: unused variable 'ret' [-Werror,-Wunused-variable]int ret = 0;-Doug
Thanks for the review, will remove the unused variable.
Signature · 4 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation. --
Re: [PATCH v1 4/7] clk: qcom: Add graphics clock controller driver for SC7180
In reply to Stephen BoydHi Stephen,
Thanks for the review.
Quoted 12 lines · Stephen Boyd
Quoting Taniya Das (2019-10-31 05:21:10)
Quoted 11 lines
drivers/clk/qcom/gpucc-sc7180.c new file +5
-0@@ -0,0 +1,274 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +*/ +
Quoted 9 lines
drivers/clk/qcom/gpucc-sc7180.c line 11
Quoted 6 lines
drivers/clk/qcom/gpucc-sc7180.c new file +6
-0+#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> Are these of includes used?
yes, would clean up these headers.
Quoted 23 lines
Quoted 23 lines
drivers/clk/qcom/gpucc-sc7180.c new file +23
-0+#include <linux/regmap.h> + +#include <dt-bindings/clock/qcom,gpucc-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" + +#define CX_GMU_CBCR_SLEEP_MASK 0xF +#define CX_GMU_CBCR_SLEEP_SHIFT 4 +#define CX_GMU_CBCR_WAKE_MASK 0xF +#define CX_GMU_CBCR_WAKE_SHIFT 8 +#define CLK_DIS_WAIT_SHIFT 12 +#define CLK_DIS_WAIT_MASK (0xf << CLK_DIS_WAIT_SHIFT) + +enum { +P_BI_TCXO , +P_CORE_BI_PLL_TEST_SE , +P_GPLL0_OUT_MAIN , +P_GPLL0_OUT_MAIN_DIV ,
Quoted 9 lines
drivers/clk/qcom/gpucc-sc7180.c line 40
Quoted 6 lines
drivers/clk/qcom/gpucc-sc7180.c new file +6
-0+P_GPU_CC_PLL1_OUT_EVEN , +P_GPU_CC_PLL1_OUT_MAIN , + P_GPU_CC_PLL1_OUT_ODD, +}; + +static struct pll_vco fabia_vco[] = {const?
Will take care.
Quoted 8 lines
Quoted 8 lines
drivers/clk/qcom/gpucc-sc7180.c new file +8
-0+ { 249600000, 2000000000, 0 }, +}; + +static struct clk_alpha_pll gpu_cc_pll1 = { + .offset =0x100 , + .vco_table = fabia_vco, + .num_vco =ARRAY_SIZE (fabia_vco), + .regs = clk_alpha_pll_regs[CLK_ALPHA_PLL_TYPE_FABIA],
Quoted 9 lines
drivers/clk/qcom/gpucc-sc7180.c line 54
Quoted 6 lines
drivers/clk/qcom/gpucc-sc7180.c new file +6
-0+ .clkr = { + .hw.init = &(struct clk_init_data){ + .name = "gpu_cc_pll1", + .parent_data = &(const struct clk_parent_data){ + .fw_name = "bi_tcxo", + .name = "bi_tcxo",Do we need both? This is new so it should just work with .fw_name right?
yes, will clean this up.
Quoted 47 lines
Quoted 13 lines
drivers/clk/qcom/gpucc-sc7180.c new file +13
-0+ }, + .num_parents = 1, + .ops = &clk_alpha_pll_fabia_ops, + }, + }, +}; + +static const struct parent_map gpu_cc_parent_map_0[] = { + {P_BI_TCXO ,0 }, + {P_GPU_CC_PLL1_OUT_MAIN ,3 }, + {P_GPLL0_OUT_MAIN ,5 }, + {P_GPLL0_OUT_MAIN_DIV ,6 }, + { P_CORE_BI_PLL_TEST_SE, 7 },drivers/clk/qcom/gpucc-sc7180.c line 77
Quoted 10 lines
drivers/clk/qcom/gpucc-sc7180.c new file +10
-0+}; + +static const struct clk_parent_data gpu_cc_parent_data_0[] = { + { .fw_name ="bi_tcxo" , .name ="bi_tcxo" }, + { .hw = &gpu_cc_pll1.clkr.hw }, + { .fw_name ="gcc_gpu_gpll0_clk_src" , .name ="gcc_gpu_gpll0_clk_src" }, + { .fw_name ="gcc_gpu_gpll0_div_clk_src" , + .name ="gcc_gpu_gpll0_div_clk_src" }, + { .fw_name ="core_bi_pll_test_se" , .name ="core_bi_pll_test_se" }, +};Same for these.
Quoted 6 lines
drivers/clk/qcom/gpucc-sc7180.c new file +6
-0+ +static const struct freq_tbl ftbl_gpu_cc_gmu_clk_src[] = { +F (19200000 ,P_BI_TCXO ,1 ,0 ,0 ), +F (200000000 ,P_GPLL0_OUT_MAIN_DIV ,1.5 ,0 ,0 ), + { } +};[..]
Quoted 14 lines
drivers/clk/qcom/gpucc-sc7180.c new file +14
-0+ + +static int gpu_cc_sc7180_probe (struct platform_device *pdev) +{ +struct regmap *regmap; +struct alpha_pll_config gpu_cc_pll_config = {}; +unsigned int value, mask; + + regmap =qcom_cc_map (pdev, &gpu_cc_sc7180_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +/* 360MHz Configuration */ + gpu_cc_pll_config.l =0x12 ;
Quoted 9 lines
drivers/clk/qcom/gpucc-sc7180.c line 233
Quoted 6 lines
drivers/clk/qcom/gpucc-sc7180.c new file +6
-0+ gpu_cc_pll_config.alpha =0xC000 ; + gpu_cc_pll_config.config_ctl_val =0x20485699 ; + gpu_cc_pll_config.config_ctl_hi_val =0x00002067 ; + gpu_cc_pll_config.user_ctl_val =0x00000001 ; + gpu_cc_pll_config.user_ctl_hi_val =0x00004805 ; + gpu_cc_pll_config.test_ctl_hi_val =0x40000000 ;Is there a reason this is built on the stack? Save space or something?
I have done as we had discussed during the dispcc review for SDM845
https://patchwork.kernel.org/patch/10446073/
Quoted 8 lines
drivers/clk/qcom/gpucc-sc7180.c
Quoted 5 lines
Quoted 1 line
drivers/clk/qcom/gpucc-sc7180.c new file +4
-0+static const struct alpha_pll_config disp_cc_pll0_config = { + .l =0x2c , + .alpha =0xcaaa , +};Any reason this can't be put on the stack in the probe function?
I would move it.
Quoted 1 line
Quoted 1 line
Quoted 1 line
In case you think I should move it outside I can do that too.
Quoted 11 lines
drivers/clk/qcom/gpucc-sc7180.c line 240
Quoted 7 lines
drivers/clk/qcom/gpucc-sc7180.c new file +7
-0+ +clk_fabia_pll_configure (&gpu_cc_pll1, regmap, &gpu_cc_pll_config); + +/* Recommended WAKEUP/SLEEP settings for the gpu_cc_cx_gmu_clk */ + mask =CX_GMU_CBCR_WAKE_MASK <<CX_GMU_CBCR_WAKE_SHIFT ; + mask |=CX_GMU_CBCR_SLEEP_MASK <<CX_GMU_CBCR_SLEEP_SHIFT ; + value =0xF <<CX_GMU_CBCR_WAKE_SHIFT |0xF <<CX_GMU_CBCR_SLEEP_SHIFT ;mask and value can just be big constants? I'm not sure anyone cares to tweak this later, but I guess it's fine this way too.
Quoted 6 lines
drivers/clk/qcom/gpucc-sc7180.c line 243
Quoted 3 lines
drivers/clk/qcom/gpucc-sc7180.c new file +3
-0+regmap_update_bits (regmap,0x1098 , mask, value); + +/* gpu_cc_ahb_clk */ What are we doing to
gpu_cc_ahb_clk??
I was marking this CRITICAL clock, but I checked the HW specs and it is always left ON from HW, so will remove it.
Quoted 17 lines
Quoted 17 lines
drivers/clk/qcom/gpucc-sc7180.c new file +17
-0+regmap_update_bits (regmap,0x1078 ,0x1 ,0x1 ); + +/* Configure clk_dis_wait for gpu_cx_gdsc */ +regmap_update_bits (regmap,0x106c ,CLK_DIS_WAIT_MASK , +8 <<CLK_DIS_WAIT_SHIFT ); + +return qcom_cc_really_probe (pdev, &gpu_cc_sc7180_desc, regmap); +} + +static struct platform_driver gpu_cc_sc7180_driver = { + .probe = gpu_cc_sc7180_probe, + .driver = { + .name ="sc7180-gpucc" , + .of_match_table = gpu_cc_sc7180_match_table, + }, +}; +
Quoted 9 lines
drivers/clk/qcom/gpucc-sc7180.c line 265
Quoted 5 lines
drivers/clk/qcom/gpucc-sc7180.c new file +5
-0+static int __init gpu_cc_sc7180_init (void ) +{ +return platform_driver_register (&gpu_cc_sc7180_driver); +} +core_initcall (gpu_cc_sc7180_init);Does it need to be core initcal? Maybe
module_platform_driver()works just as well?
I will leave it to subsys_initcall.
Quoted 9 lines
Quoted 9 lines
drivers/clk/qcom/gpucc-sc7180.c new file +9
-0+ +static void __exit gpu_cc_sc7180_exit(void) +{ +platform_driver_unregister (&gpu_cc_sc7180_driver); +} +module_exit (gpu_cc_sc7180_exit); + +MODULE_DESCRIPTION ("QTI GPU_CC SC7180 Driver" ); +MODULE_LICENSE ("GPL v2" );
Signature · 4 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation. --
Re: [PATCH v1 7/7] clk: qcom: Add video clock controller driver for SC7180
In reply to Stephen BoydHi Stephen,
Thanks for the review.
Quoted 12 lines · Stephen Boyd
Quoting Taniya Das (2019-10-31 05:21:13)
Quoted 11 lines
drivers/clk/qcom/videocc-sc7180.c new file +5
-0@@ -0,0 +1,263 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +*/ +
Quoted 9 lines
drivers/clk/qcom/videocc-sc7180.c line 11
Quoted 6 lines
drivers/clk/qcom/videocc-sc7180.c new file +6
-0+#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> Are these of includes used?
I will clean them up.
Quoted 15 lines
Quoted 15 lines
drivers/clk/qcom/videocc-sc7180.c new file +15
-0+#include <linux/regmap.h> + +#include <dt-bindings/clock/qcom,videocc-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_CHIP_SLEEP_CLK , +P_CORE_BI_PLL_TEST_SE ,
Quoted 9 lines
drivers/clk/qcom/videocc-sc7180.c line 32
Quoted 6 lines
drivers/clk/qcom/videocc-sc7180.c new file +6
-0+P_VIDEO_PLL0_OUT_EVEN , +P_VIDEO_PLL0_OUT_MAIN , + P_VIDEO_PLL0_OUT_ODD, +}; + +static struct pll_vco fabia_vco[] = {const?
yes, will add it.
Quoted 18 lines
Quoted 3 lines
drivers/clk/qcom/videocc-sc7180.c new file +3
-0+ { 249600000, 2000000000, 0 }, +}; +[...]
drivers/clk/qcom/videocc-sc7180.c line 229
Quoted 11 lines
drivers/clk/qcom/videocc-sc7180.c new file +11
-0+ +static int video_cc_sc7180_probe (struct platform_device *pdev) +{ +struct regmap *regmap; +struct alpha_pll_config video_pll0_config = {}; + + regmap =qcom_cc_map (pdev, &video_cc_sc7180_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + + video_pll0_config.l =0x1F ;lowercase hex please.
Quoted 6 lines
drivers/clk/qcom/videocc-sc7180.c line 232
Quoted 3 lines
drivers/clk/qcom/videocc-sc7180.c new file +3
-0+ video_pll0_config.alpha =0x4000 ; + video_pll0_config.user_ctl_val =0x00000001 ; + video_pll0_config.user_ctl_hi_val =0x00004805 ;Same question, why on stack?
Will update the same.
Quoted 7 lines
drivers/clk/qcom/videocc-sc7180.c line 236
Quoted 4 lines
drivers/clk/qcom/videocc-sc7180.c new file +4
-0+ +clk_fabia_pll_configure (&video_pll0, regmap, &video_pll0_config); + +/* video_cc_xo_clk */ What are we doing? Enabling it?
yes, enabling it. Did not model and mark it CRITICAL.
Quoted 18 lines
Quoted 18 lines
drivers/clk/qcom/videocc-sc7180.c new file +18
-0+regmap_update_bits (regmap,0x984 ,0x1 ,0x1 ); + +return qcom_cc_really_probe (pdev, &video_cc_sc7180_desc, regmap); +} + +static struct platform_driver video_cc_sc7180_driver = { + .probe = video_cc_sc7180_probe, + .driver = { + .name ="sc7180-videocc" , + .of_match_table = video_cc_sc7180_match_table, + }, +}; + +static int __init video_cc_sc7180_init (void ) +{ +return platform_driver_register (&video_cc_sc7180_driver); +} +core_initcall (video_cc_sc7180_init);
Quoted 9 lines
drivers/clk/qcom/videocc-sc7180.c line 260
Quoted 6 lines
drivers/clk/qcom/videocc-sc7180.c new file +6
-0+ +static void __exit video_cc_sc7180_exit(void) +{ +platform_driver_unregister (&video_cc_sc7180_driver); +} +module_exit (video_cc_sc7180_exit);Same question, module platform driver perhaps?
I will move it to subsys_initcall().
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 v1 4/7] clk: qcom: Add graphics clock controller driver for SC7180
In reply to Taniya DasQuoting Taniya Das (2019-11-15 00:11:28)
Quoted 27 lines
Hi Stephen,
Thanks for the review.
Quoted 12 lines · Stephen Boyd
Quoting Taniya Das (2019-10-31 05:21:10)
Quoted 11 lines
drivers/clk/qcom/gpucc-sc7180.c new file +5
-0@@ -0,0 +1,274 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (c) 2019, The Linux Foundation. All rights reserved. +*/ +Quoted 9 lines
drivers/clk/qcom/gpucc-sc7180.c line 11
Quoted 6 lines
drivers/clk/qcom/gpucc-sc7180.c new file +6
-0+#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_device.h> Are these of includes used?
Quoted 2 lines
yes, would clean up these headers.
Maybe they're used. I'm not sure.
Quoted 26 lines
Quoted 13 lines
drivers/clk/qcom/gpucc-sc7180.c line 233
Quoted 12 lines
drivers/clk/qcom/gpucc-sc7180.c new file +12
-0+ regmap =qcom_cc_map (pdev, &gpu_cc_sc7180_desc); +if (IS_ERR (regmap)) +return PTR_ERR (regmap); + +/* 360MHz Configuration */ + gpu_cc_pll_config.l =0x12 ; + gpu_cc_pll_config.alpha =0xC000 ; + gpu_cc_pll_config.config_ctl_val =0x20485699 ; + gpu_cc_pll_config.config_ctl_hi_val =0x00002067 ; + gpu_cc_pll_config.user_ctl_val =0x00000001 ; + gpu_cc_pll_config.user_ctl_hi_val =0x00004805 ; + gpu_cc_pll_config.test_ctl_hi_val =0x40000000 ;Quoted 2 lines
Is there a reason this is built on the stack? Save space or something?
I have done as we had discussed during the dispcc review for SDM845
https://patchwork.kernel.org/patch/10446073/Quoted 8 lines
drivers/clk/qcom/gpucc-sc7180.c
Quoted 5 lines
Quoted 1 line
drivers/clk/qcom/gpucc-sc7180.c new file +4
-0+static const struct alpha_pll_config disp_cc_pll0_config = { + .l =0x2c , + .alpha =0xcaaa , +};Any reason this can't be put on the stack in the probe function?
Quoted 4 lines
I would move it.
Quoted 1 line
Quoted 1 line
Quoted 1 line
In case you think I should move it outside I can do that too.
No I was just wondering what prompted it.
Stephen Boyd
maintainerRe: [PATCH v1 7/7] clk: qcom: Add video clock controller driver for SC7180
In reply to Taniya DasQuoting Taniya Das (2019-11-15 00:11:31)
Quoted 13 lines
Hi Stephen,
Thanks for the review.
Quoted 8 lines · Stephen Boyd
Quoting Taniya Das (2019-10-31 05:21:13)
Quoted 6 lines
drivers/clk/qcom/videocc-sc7180.c new file +0
-0@@ -0,0 +1,263 @@
Quoted 8 lines
Quoted 6 lines
drivers/clk/qcom/videocc-sc7180.c line 232
Quoted 3 lines
drivers/clk/qcom/videocc-sc7180.c new file +3
-0+ video_pll0_config.alpha =0x4000 ; + video_pll0_config.user_ctl_val =0x00000001 ; + video_pll0_config.user_ctl_hi_val =0x00004805 ;Same question, why on stack?
Will update the same.
Sounds like nothing to do.
Quoted 10 lines
Quoted 8 lines
drivers/clk/qcom/videocc-sc7180.c line 236
Quoted 5 lines
drivers/clk/qcom/videocc-sc7180.c new file +4
-0+ +clk_fabia_pll_configure (&video_pll0, regmap, &video_pll0_config); + +/* video_cc_xo_clk */ What are we doing? Enabling it?
yes, enabling it. Did not model and mark it CRITICAL.
Ok. Please describe that in the comment.
Quoted 8 lines
Quoted 5 lines
drivers/clk/qcom/videocc-sc7180.c line 9
Quoted 2 lines
drivers/clk/qcom/videocc-sc7180.c new file +2
-0+} +module_exit (video_cc_sc7180_exit);Same question, module platform driver perhaps?
I will move it to
subsys_initcall().
Hmm ok.