SDM670 Global Clocks
v2 cover SDM670 Global Clocks
Changes since v1:
- regenerate patches to fixed malformed patch
- fix schema so that the parent clocks are specified correctly
- remove core_bi_test_pll_se from new parent_data to match array sizes
- reference correct frequency table for gcc_sdm670_cpuss_rbcpr_clk_src
- set correct index for sdcc1_ice_core_clk_src
This patch series adds global clocks essential for features of the Qualcomm Snapdragon 670 (hopefully) cleanly into the SDM845 driver without doing runtime fixups like in Google's bonito kernel (see patch 3).
This series (mostly patch 2) affects kernels made for Snapdragon 845 and might need some further testing on SDM845 devices. I do not have a Snapdragon 845-based device so someone else will have to double check if it is necessary.
.../devicetree/bindings/clock/qcom,gcc-sdm845.yaml | 60 ++- drivers/clk/qcom/Kconfig | 4 +- drivers/clk/qcom/gcc-sdm845.c | 404 ++++++++++++++++++++- include/dt-bindings/clock/qcom,gcc-sdm845.h | 2 + 4 files changed, 453 insertions(+), 17 deletions(-)
PATCH v2 1/3 dt-bindings: clock: gcc-sdm845: add sdm670 global clocks
The Snapdragon 670 clocks will be added into the sdm845 gcc driver. Most of the new clocks, GDSCs, and resets already have reserved IDs but there are some resources that don't. Add the new clock and extra BCR from Snapdragon 670 and document the differences between the SoC parent clocks.
--- .../bindings/clock/qcom,gcc-sdm845.yaml | 60 +++++++++++++++---- include/dt-bindings/clock/qcom,gcc-sdm845.h | 2 + 2 files changed, 49 insertions(+), 13 deletions(-)
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml +47 -13
@@ -19,23 +19,17 @@ description: | properties: compatible: - const: qcom,gcc-sdm845 + enum: + - qcom,gcc-sdm670 + - qcom,gcc-sdm845 clocks: - items: - - description: Board XO source - - description: Board active XO source - - description: Sleep clock source - - description: PCIE 0 Pipe clock source - - description: PCIE 1 Pipe clock source + minItems: 3 + maxItems: 5 clock-names: - items: - - const: bi_tcxo - - const: bi_tcxo_ao - - const: sleep_clk - - const: pcie_0_pipe_clk - - const: pcie_1_pipe_clk + minItems: 3 + maxItems: 5 '#clock-cells': const: 1
@@ -63,6 +57,46 @@ required: - '#reset-cells' - '#power-domain-cells' +allOf: + - if: + properties: + compatible: + contains: + const: qcom,gcc-sdm845 + then: + properties: + clocks: + items: + - description: Board XO source + - description: Board active XO source + - description: Sleep clock source + - description: PCIE 0 Pipe clock source + - description: PCIE 1 Pipe clock source + clock-names: + items: + - const: bi_tcxo + - const: bi_tcxo_ao + - const: sleep_clk + - const: pcie_0_pipe_clk + - const: pcie_1_pipe_clk + - if: + properties: + compatible: + contains: + const: qcom,gcc-sdm670 + then: + properties: + clocks: + items: + - description: Board XO source + - description: Board active XO source + - description: Sleep clock source + clock-names: + items: + - const: bi_tcxo + - const: bi_tcxo_ao + - const: sleep_clk + additionalProperties: false examples:
include/dt-bindings/clock/qcom,gcc-sdm845.h +2 -0
@@ -199,6 +199,7 @@#define GCC_QSPI_CNOC_PERIPH_AHB_CLK 189#define GCC_LPASS_Q6_AXI_CLK 190#define GCC_LPASS_SWAY_CLK 191 +#define GPLL6 192/* GCC Resets */ #define GCC_MMSS_BCR 0
@@ -227,6 +228,7 @@#define GCC_USB_PHY_CFG_AHB2PHY_BCR 23#define GCC_PCIE_0_PHY_BCR 24#define GCC_PCIE_1_PHY_BCR 25 +#define GCC_SDCC1_BCR 26/* GCC GDSCRs */ #define PCIE_0_GDSC 0
Signature · 1 line
2.37.3
Re: [PATCH v2 1/3] dt-bindings: clock: gcc-sdm845: add sdm670 global clocks
Quoted 6 lines · Richard Acayan
The Snapdragon 670 clocks will be added into the sdm845 gcc driver. Most of the new clocks, GDSCs, and resets already have reserved IDs but there are some resources that don't. Add the new clock and extra BCR from Snapdragon 670 and document the differences between the SoC parent clocks.
Signed-off-by Richard Acayan <[email protected]>
Thank you for your patch. There is something to discuss/improve.
Quoted 18 lines
'#clock-cells': const: 1Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml +12
-0@@ -63,6 +57,46 @@ required: - '#reset-cells' - '#power-domain-cells' +allOf: + - if: + properties: + compatible: + contains: + const: qcom,gcc-sdm845 + then: + properties: + clocks: + items: + - description: Board XO source + - description: Board active XO source
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml required: · line 81
Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml +10
-0+ - description: Sleep clock source + - description: PCIE 0 Pipe clock source + - description: PCIE 1 Pipe clock source + clock-names: + items: + - const: bi_tcxo + - const: bi_tcxo_ao + - const: sleep_clk + - const: pcie_0_pipe_clk + - const: pcie_1_pipe_clk
Blank line here.
With this:
Best regards,
Krzysztof
Re: [PATCH v2 1/3] dt-bindings: clock: gcc-sdm845: add sdm670 global clocks
Quoted 8 lines
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml required: · line 81
Quoted 7 lines
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml +7
-0+ clock-names: + items: + - const: bi_tcxo + - const: bi_tcxo_ao + - const: sleep_clk + - const: pcie_0_pipe_clk + - const: pcie_1_pipe_clk
Quoted 5 lines
Blank line here.
With this:
Reviewed-by Krzysztof Kozlowski <[email protected]>
Thanks for reviewing. While I'm at it, I might as well swap sdm670 and sdm845 if statements so they're at least in the same order as in the enum (I don't know what order to put them in).
Re: [PATCH v2 1/3] dt-bindings: clock: gcc-sdm845: add sdm670 global clocks
Quoted 10 lines · Richard Acayan
Quoted 10 lines
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml required: · line 81
Quoted 7 lines
Documentation/devicetree/bindings/clock/qcom,gcc-sdm845.yaml +7
-0+ clock-names: + items: + - const: bi_tcxo + - const: bi_tcxo_ao + - const: sleep_clk + - const: pcie_0_pipe_clk + - const: pcie_1_pipe_clkBlank line here.
Quoted 7 lines
Quoted 3 lines
With this:
Reviewed-by Krzysztof Kozlowski <[email protected]>Thanks for reviewing. While I'm at it, I might as well swap sdm670 and sdm845 if statements so they're at least in the same order as in the enum (I don't know what order to put them in).
Put them in alphabetical order.
Best regards,
Krzysztof
PATCH v2 2/3 clk: qcom: gcc-sdm845: use device tree match data
In reply to Richard AcayanThis driver will support more than one SoC's set of clocks, and set of GDSCs. This behavior would be unclean with hard-coded static variables. Support it by grabbing clocks, GDSCs, and BCRs in the match data.
--- drivers/clk/qcom/gcc-sdm845.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/qcom/gcc-sdm845.c +4 -2
@@ -3574,7 +3574,7 @@ static const struct qcom_cc_desc gcc_sdm845_desc = { };static const struct of_device_id gcc_sdm845_match_table[] = { - { .compatible ="qcom,gcc-sdm845" }, + { .compatible ="qcom,gcc-sdm845" , .data = &gcc_sdm845_desc }, { } };MODULE_DEVICE_TABLE (of, gcc_sdm845_match_table);
@@ -3600,6 +3600,7 @@ static const struct clk_rcg_dfs_data gcc_dfs_clocks[] = {static int gcc_sdm845_probe (struct platform_device *pdev) { +const struct qcom_cc_desc *gcc_desc;struct regmap *regmap;int ret;
@@ -3616,7 +3617,8 @@ static int gcc_sdm845_probe(struct platform_device *pdev)if (ret)return ret; -return qcom_cc_really_probe (pdev, &gcc_sdm845_desc, regmap); + gcc_desc =of_device_get_match_data (&pdev->dev); +return qcom_cc_really_probe (pdev, gcc_desc, regmap); }static struct platform_driver gcc_sdm845_driver = {
Signature · 1 line
2.37.3
Re: [PATCH v2 2/3] clk: qcom: gcc-sdm845: use device tree match data
Quoted 5 lines · Richard Acayan
This driver will support more than one SoC's set of clocks, and set of GDSCs. This behavior would be unclean with hard-coded static variables. Support it by grabbing clocks, GDSCs, and BCRs in the match data.
Signed-off-by Richard Acayan <[email protected]>
Best regards,
Krzysztof
PATCH v2 3/3 clk: qcom: gcc-sdm845: add sdm670 global clock data
In reply to Richard AcayanThe Snapdragon 670 adds and removes some clocks, adds new frequencies, and adds a new GPLL (Global Phase-Locked Loop) in reference to SDM845, while also removing some GDSCs. Despite these differences, there are many similarities with SDM670. Add data for SDM670 in the driver for SDM845 to reuse the most of the clock data.
Advantages and disadvantages of this approach:
+ maintenance applies to both sdm670 and sdm845 by default
+ less duplicate code (clocks) means smaller distro/pre-built kernels with all drivers enabled
- clocks for both SoC's must be compiled if the user wants clocks for one specific SoC (both or none)
- additional testing needed for sdm845 devices
--- drivers/clk/qcom/Kconfig | 4 +- drivers/clk/qcom/gcc-sdm845.c | 398 ++++++++++++++++++++++++++++++++++ 2 files changed, 400 insertions(+), 2 deletions(-)
drivers/clk/qcom/Kconfig +2 -2
@@ -545,10 +545,10 @@ config QCS_Q6SSTOP_404 controller to reset the Q6SSTOP subsystem. config SDM_GCC_845 - tristate "SDM845 Global Clock Controller" + tristate "SDM845/SDM670 Global Clock Controller" select QCOM_GDSC help - Support for the global clock controller on SDM845 devices. + Support for the global clock controller on SDM845 and SDM670 devices. Say Y if you want to use peripheral devices such as UART, SPI, i2C, USB, UFS, SDDC, PCIe, etc.
drivers/clk/qcom/gcc-sdm845.c +398 -0
482 lines not on this page · raw message
Signature · 1 line
2.37.3
Re: [PATCH v2 3/3] clk: qcom: gcc-sdm845: add sdm670 global clock data
Quoted 14 lines · Richard Acayan
The Snapdragon 670 adds and removes some clocks, adds new frequencies, and adds a new GPLL (Global Phase-Locked Loop) in reference to SDM845, while also removing some GDSCs. Despite these differences, there are many similarities with SDM670. Add data for SDM670 in the driver for SDM845 to reuse the most of the clock data.
Advantages and disadvantages of this approach:
+ maintenance applies to both sdm670 and sdm845 by default
+ less duplicate code (clocks) means smaller distro/pre-built kernels with all drivers enabled
- clocks for both SoC's must be compiled if the user wants clocks for one specific SoC (both or none)
- additional testing needed for sdm845 devices
Quoted 7 lines
Signed-off-by Richard Acayan <[email protected]>--- drivers/clk/qcom/Kconfig | 4 +- drivers/clk/qcom/gcc-sdm845.c | 398 ++++++++++++++++++++++++++++++++++ 2 files changed, 400 insertions(+), 2 deletions(-)
Thank you for your patch. There is something to discuss/improve.
Quoted 53 lines
drivers/clk/qcom/gcc-sdm845.c +49
-0+ &gcc_tsif_inactivity_timers_clk.clkr, + [GCC_TSIF_REF_CLK] = &gcc_tsif_ref_clk.clkr, + [GCC_TSIF_REF_CLK_SRC] = &gcc_tsif_ref_clk_src.clkr, + [GCC_UFS_MEM_CLKREF_CLK] = &gcc_ufs_mem_clkref_clk.clkr, + [GCC_UFS_PHY_AHB_CLK] = &gcc_ufs_phy_ahb_clk.clkr, + [GCC_UFS_PHY_AXI_CLK] = &gcc_ufs_phy_axi_clk.clkr, + [GCC_UFS_PHY_AXI_CLK_SRC] = &gcc_ufs_phy_axi_clk_src.clkr, + [GCC_UFS_PHY_ICE_CORE_CLK] = &gcc_ufs_phy_ice_core_clk.clkr, + [GCC_UFS_PHY_ICE_CORE_CLK_SRC] = &gcc_ufs_phy_ice_core_clk_src.clkr, + [GCC_UFS_PHY_PHY_AUX_CLK] = &gcc_ufs_phy_phy_aux_clk.clkr, + [GCC_UFS_PHY_PHY_AUX_CLK_SRC] = &gcc_ufs_phy_phy_aux_clk_src.clkr, + [GCC_UFS_PHY_RX_SYMBOL_0_CLK] = &gcc_ufs_phy_rx_symbol_0_clk.clkr, + [GCC_UFS_PHY_TX_SYMBOL_0_CLK] = &gcc_ufs_phy_tx_symbol_0_clk.clkr, + [GCC_UFS_PHY_UNIPRO_CORE_CLK] = &gcc_ufs_phy_unipro_core_clk.clkr, + [GCC_UFS_PHY_UNIPRO_CORE_CLK_SRC ] = + &gcc_ufs_phy_unipro_core_clk_src.clkr, + [GCC_USB30_PRIM_MASTER_CLK] = &gcc_usb30_prim_master_clk.clkr, + [GCC_USB30_PRIM_MASTER_CLK_SRC] = &gcc_usb30_prim_master_clk_src.clkr, + [GCC_USB30_PRIM_MOCK_UTMI_CLK] = &gcc_usb30_prim_mock_utmi_clk.clkr, + [GCC_USB30_PRIM_MOCK_UTMI_CLK_SRC ] = + &gcc_usb30_prim_mock_utmi_clk_src.clkr, + [GCC_USB30_PRIM_SLEEP_CLK] = &gcc_usb30_prim_sleep_clk.clkr, + [GCC_USB3_PRIM_CLKREF_CLK] = &gcc_usb3_prim_clkref_clk.clkr, + [GCC_USB3_PRIM_PHY_AUX_CLK] = &gcc_usb3_prim_phy_aux_clk.clkr, + [GCC_USB3_PRIM_PHY_AUX_CLK_SRC] = &gcc_usb3_prim_phy_aux_clk_src.clkr, + [GCC_USB3_PRIM_PHY_COM_AUX_CLK] = &gcc_usb3_prim_phy_com_aux_clk.clkr, + [GCC_USB3_PRIM_PHY_PIPE_CLK] = &gcc_usb3_prim_phy_pipe_clk.clkr, + [GCC_USB_PHY_CFG_AHB2PHY_CLK] = &gcc_usb_phy_cfg_ahb2phy_clk.clkr, + [GCC_VDDA_VS_CLK] = &gcc_vdda_vs_clk.clkr, + [GCC_VDDCX_VS_CLK] = &gcc_vddcx_vs_clk.clkr, + [GCC_VDDMX_VS_CLK] = &gcc_vddmx_vs_clk.clkr, + [GCC_VIDEO_AHB_CLK] = &gcc_video_ahb_clk.clkr, + [GCC_VIDEO_AXI_CLK] = &gcc_video_axi_clk.clkr, + [GCC_VIDEO_XO_CLK] = &gcc_video_xo_clk.clkr, + [GCC_VS_CTRL_AHB_CLK] = &gcc_vs_ctrl_ahb_clk.clkr, + [GCC_VS_CTRL_CLK] = &gcc_vs_ctrl_clk.clkr, + [GCC_VS_CTRL_CLK_SRC] = &gcc_vs_ctrl_clk_src.clkr, + [GCC_VSENSOR_CLK_SRC] = &gcc_vsensor_clk_src.clkr, + [GPLL0] = &gpll0.clkr, + [GPLL0_OUT_EVEN] = &gpll0_out_even.clkr, + [GPLL4] = &gpll4.clkr, + [GPLL6] = &gpll6.clkr, + [GCC_CPUSS_DVM_BUS_CLK] = &gcc_cpuss_dvm_bus_clk.clkr, + [GCC_CPUSS_GNOC_CLK] = &gcc_cpuss_gnoc_clk.clkr, + [GCC_QSPI_CORE_CLK_SRC] = &gcc_qspi_core_clk_src.clkr, + [GCC_QSPI_CORE_CLK] = &gcc_qspi_core_clk.clkr, + [GCC_QSPI_CNOC_PERIPH_AHB_CLK] = &gcc_qspi_cnoc_periph_ahb_clk.clkr, +}; +static struct clk_regmap *gcc_sdm845_clocks[] = { [GCC_AGGRE_NOC_PCIE_TBU_CLK ] = &gcc_aggre_noc_pcie_tbu_clk.clkr, [GCC_AGGRE_UFS_CARD_AXI_CLK ] = &gcc_aggre_ufs_card_axi_clk.clkr,
drivers/clk/qcom/gcc-sdm845.c static const struct qcom_reset_map gcc_sdm845_resets[] = { · line 3884
Quoted 4 lines
drivers/clk/qcom/gcc-sdm845.c +1
-0@@ -3515,6 +3881,7 @@ static const struct qcom_reset_map gcc_sdm845_resets[] = { [GCC_QUPV3_WRAPPER_1_BCR] = { 0x18000 }, [GCC_QUSB2PHY_PRIM_BCR] = { 0x12000 }, [GCC_QUSB2PHY_SEC_BCR] = { 0x12004 }, + [GCC_SDCC1_BCR] = { 0x26000 },
You are changing existing SDM845, so this should be separate patch with its own explanation.
Best regards,
Krzysztof
Re: [PATCH v2 3/3] clk: qcom: gcc-sdm845: add sdm670 global clock data
Quoted 8 lines
drivers/clk/qcom/gcc-sdm845.c static const struct qcom_reset_map gcc_sdm845_resets[] = { · line 3884
Quoted 5 lines
drivers/clk/qcom/gcc-sdm845.c +1
-0@@ -3515,6 +3881,7 @@ static const struct qcom_reset_map gcc_sdm845_resets[] = { [GCC_QUPV3_WRAPPER_1_BCR] = { 0x18000 }, [GCC_QUSB2PHY_PRIM_BCR] = { 0x12000 }, [GCC_QUSB2PHY_SEC_BCR] = { 0x12004 }, + [GCC_SDCC1_BCR] = { 0x26000 },You are changing existing SDM845, so this should be separate patch with its own explanation.
I only added this reset for the sake of completeness. It is not used in my initial dtsi so I will drop it from this series. It can be added later if it is needed for a specific device.