Merge branches 'clk-nvidia', 'clk-imx', 'clk-samsung' and 'clk-qcom' into clk-next

* clk-nvidia:
  clk: tegra: Support runtime PM and power domain
  clk: tegra: Make vde a child of pll_p on tegra114

* clk-imx:
  clk: imx8mp: Fix the parent clk of the audio_root_clk
  clk: imx8mp: Remove IPG_AUDIO_ROOT from imx8mp-clock.h
  clk: imx8mn: Fix imx8mn_clko1_sels
  clk: imx: Use div64_ul instead of do_div
  clk: imx: imx8ulp: set suppress_bind_attrs to true

* clk-samsung:
  clk: samsung: Add initial Exynos7885 clock driver
  clk: samsung: clk-pll: Add support for pll1417x
  clk: samsung: Make exynos850_register_cmu shared
  dt-bindings: clock: Document Exynos7885 CMU bindings
  dt-bindings: clock: Add bindings definitions for Exynos7885 CMU
  clk: samsung: exynos850: Add missing sysreg clocks
  dt-bindings: clock: Add bindings for Exynos850 sysreg clocks
  clk: samsung: exynos850: Register clocks early
  clk: samsung: exynos850: Keep some crucial clocks running
  clk: samsung: exynos850: Implement CMU_CMGP domain
  dt-bindings: clock: Add bindings for Exynos850 CMU_CMGP
  clk: samsung: exynos850: Implement CMU_APM domain
  dt-bindings: clock: Add bindings for Exynos850 CMU_APM
  clk: samsung: Update CPU clk registration
  clk: samsung: Remove meaningless __init and extern from header files
  clk: samsung: remove __clk_lookup() usage
  dt-bindings: clock: samsung: add IDs for some core clocks

* clk-qcom: (25 commits)
  clk: qcom: gcc-sc7280: Mark gcc_cfg_noc_lpass_clk always enabled
  clk: qcom: clk-alpha-pll: Increase PLL lock detect poll time
  clk: qcom: turingcc-qcs404: explicitly include clk-provider.h
  clk: qcom: q6sstop-qcs404: explicitly include clk-provider.h
  clk: qcom: mmcc-apq8084: explicitly include clk-provider.h
  clk: qcom: lpasscc-sdm845: explicitly include clk-provider.h
  clk: qcom: lpasscc-sc7280: explicitly include clk-provider.h
  clk: qcom: gcc-sm6350: explicitly include clk-provider.h
  clk: qcom: gcc-msm8994: explicitly include clk-provider.h
  clk: qcom: gcc-sm8350: explicitly include clk-provider.h
  clk: qcom: Add MSM8976/56 Global Clock Controller (GCC) driver
  dt-bindings: clk: qcom: Document MSM8976 Global Clock Controller
  clk: qcom: Add clock driver for SM8450
  clk: qcom: Add SDX65 GCC support
  clk: qcom: Add LUCID_EVO PLL type for SDX65
  dt-bindings: clock: Add SM8450 GCC clock bindings
  dt-bindings: clock: Add SDX65 GCC clock bindings
  clk: qcom: rpmh: add support for SM8450 rpmh clocks
  dt-bindings: clock: Add RPMHCC bindings for SM8450
  clk: qcom: smd-rpm: Drop binary value handling for buffered clock
  ...
This commit is contained in:
Stephen Boyd 2022-01-11 18:30:43 -08:00
64 changed files with 12137 additions and 283 deletions

View File

@ -0,0 +1,97 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/qcom,gcc-msm8976.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm Global Clock & Reset Controller Binding for MSM8976
maintainers:
- Stephen Boyd <sboyd@kernel.org>
- Taniya Das <tdas@codeaurora.org>
description: |
Qualcomm global clock control module which supports the clocks, resets and
power domains on MSM8976.
See also:
- dt-bindings/clock/qcom,gcc-msm8976.h
properties:
compatible:
enum:
- qcom,gcc-msm8976
- qcom,gcc-msm8976-v1.1
clocks:
items:
- description: XO source
- description: Always-on XO source
- description: Pixel clock from DSI PHY0
- description: Byte clock from DSI PHY0
- description: Pixel clock from DSI PHY1
- description: Byte clock from DSI PHY1
clock-names:
items:
- const: xo
- const: xo_a
- const: dsi0pll
- const: dsi0pllbyte
- const: dsi1pll
- const: dsi1pllbyte
vdd_gfx-supply:
description:
Phandle to voltage regulator providing power to the GX domain.
'#clock-cells':
const: 1
'#reset-cells':
const: 1
'#power-domain-cells':
const: 1
reg:
maxItems: 1
required:
- compatible
- reg
- clocks
- clock-names
- vdd_gfx-supply
- '#clock-cells'
- '#reset-cells'
- '#power-domain-cells'
additionalProperties: false
examples:
- |
clock-controller@1800000 {
compatible = "qcom,gcc-msm8976";
#clock-cells = <1>;
#reset-cells = <1>;
#power-domain-cells = <1>;
reg = <0x1800000 0x80000>;
clocks = <&xo_board>,
<&xo_board>,
<&dsi0_phy 1>,
<&dsi0_phy 0>,
<&dsi1_phy 1>,
<&dsi1_phy 0>;
clock-names = "xo",
"xo_a",
"dsi0pll",
"dsi0pllbyte",
"dsi1pll",
"dsi1pllbyte";
vdd_gfx-supply = <&pm8004_s5>;
};
...

View File

@ -0,0 +1,80 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/qcom,gcc-sdx65.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm Global Clock & Reset Controller Binding for SDX65
maintainers:
- Vamsi krishna Lanka <quic_vamslank@quicinc.com>
description: |
Qualcomm global clock control module which supports the clocks, resets and
power domains on SDX65
See also:
- dt-bindings/clock/qcom,gcc-sdx65.h
properties:
compatible:
const: qcom,gcc-sdx65
reg:
maxItems: 1
clocks:
items:
- description: Board XO source
- description: Board active XO source
- description: Sleep clock source
- description: PCIE Pipe clock source
- description: USB3 phy wrapper pipe clock source
- description: PLL test clock source (Optional clock)
minItems: 5
clock-names:
items:
- const: bi_tcxo
- const: bi_tcxo_ao
- const: sleep_clk
- const: pcie_pipe_clk
- const: usb3_phy_wrapper_gcc_usb30_pipe_clk
- const: core_bi_pll_test_se # Optional clock
minItems: 5
'#clock-cells':
const: 1
'#reset-cells':
const: 1
'#power-domain-cells':
const: 1
required:
- compatible
- reg
- clocks
- clock-names
- '#clock-cells'
- '#reset-cells'
- '#power-domain-cells'
additionalProperties: false
examples:
- |
#include <dt-bindings/clock/qcom,rpmh.h>
clock-controller@100000 {
compatible = "qcom,gcc-sdx65";
reg = <0x100000 0x1f7400>;
clocks = <&rpmhcc RPMH_CXO_CLK>, <&rpmhcc RPMH_CXO_CLK_A>, <&sleep_clk>,
<&pcie_pipe_clk>, <&usb3_phy_wrapper_gcc_usb30_pipe_clk>, <&pll_test_clk>;
clock-names = "bi_tcxo", "bi_tcxo_ao", "sleep_clk",
"pcie_pipe_clk", "usb3_phy_wrapper_gcc_usb30_pipe_clk", "core_bi_pll_test_se";
#clock-cells = <1>;
#reset-cells = <1>;
#power-domain-cells = <1>;
};
...

View File

@ -0,0 +1,85 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/qcom,gcc-sm8450.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm Global Clock & Reset Controller Binding for SM8450
maintainers:
- Vinod Koul <vkoul@kernel.org>
description: |
Qualcomm global clock control module which supports the clocks, resets and
power domains on SM8450
See also:
- dt-bindings/clock/qcom,gcc-sm8450.h
properties:
compatible:
const: qcom,gcc-sm8450
clocks:
items:
- description: Board XO source
- description: Sleep clock source
- description: PCIE 0 Pipe clock source (Optional clock)
- description: PCIE 1 Pipe clock source (Optional clock)
- description: PCIE 1 Phy Auxillary clock source (Optional clock)
- description: UFS Phy Rx symbol 0 clock source (Optional clock)
- description: UFS Phy Rx symbol 1 clock source (Optional clock)
- description: UFS Phy Tx symbol 0 clock source (Optional clock)
- description: USB3 Phy wrapper pipe clock source (Optional clock)
minItems: 2
clock-names:
items:
- const: bi_tcxo
- const: sleep_clk
- const: pcie_0_pipe_clk # Optional clock
- const: pcie_1_pipe_clk # Optional clock
- const: pcie_1_phy_aux_clk # Optional clock
- const: ufs_phy_rx_symbol_0_clk # Optional clock
- const: ufs_phy_rx_symbol_1_clk # Optional clock
- const: ufs_phy_tx_symbol_0_clk # Optional clock
- const: usb3_phy_wrapper_gcc_usb30_pipe_clk # Optional clock
minItems: 2
'#clock-cells':
const: 1
'#reset-cells':
const: 1
'#power-domain-cells':
const: 1
reg:
maxItems: 1
required:
- compatible
- reg
- clocks
- clock-names
- '#clock-cells'
- '#reset-cells'
- '#power-domain-cells'
additionalProperties: false
examples:
- |
#include <dt-bindings/clock/qcom,rpmh.h>
clock-controller@100000 {
compatible = "qcom,gcc-sm8450";
reg = <0x00100000 0x001f4200>;
clocks = <&rpmhcc RPMH_CXO_CLK>, <&sleep_clk>;
clock-names = "bi_tcxo", "sleep_clk";
#clock-cells = <1>;
#reset-cells = <1>;
#power-domain-cells = <1>;
};
...

View File

@ -22,10 +22,12 @@ properties:
- qcom,sc8180x-rpmh-clk - qcom,sc8180x-rpmh-clk
- qcom,sdm845-rpmh-clk - qcom,sdm845-rpmh-clk
- qcom,sdx55-rpmh-clk - qcom,sdx55-rpmh-clk
- qcom,sdx65-rpmh-clk
- qcom,sm6350-rpmh-clk - qcom,sm6350-rpmh-clk
- qcom,sm8150-rpmh-clk - qcom,sm8150-rpmh-clk
- qcom,sm8250-rpmh-clk - qcom,sm8250-rpmh-clk
- qcom,sm8350-rpmh-clk - qcom,sm8350-rpmh-clk
- qcom,sm8450-rpmh-clk
clocks: clocks:
maxItems: 1 maxItems: 1

View File

@ -0,0 +1,166 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/samsung,exynos7885-clock.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung Exynos7885 SoC clock controller
maintainers:
- Dávid Virág <virag.david003@gmail.com>
- Chanwoo Choi <cw00.choi@samsung.com>
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
- Sylwester Nawrocki <s.nawrocki@samsung.com>
- Tomasz Figa <tomasz.figa@gmail.com>
description: |
Exynos7885 clock controller is comprised of several CMU units, generating
clocks for different domains. Those CMU units are modeled as separate device
tree nodes, and might depend on each other. The root clock in that root tree
is an external clock: OSCCLK (26 MHz). This external clock must be defined
as a fixed-rate clock in dts.
CMU_TOP is a top-level CMU, where all base clocks are prepared using PLLs and
dividers; all other leaf clocks (other CMUs) are usually derived from CMU_TOP.
Each clock is assigned an identifier and client nodes can use this identifier
to specify the clock which they consume. All clocks available for usage
in clock consumer nodes are defined as preprocessor macros in
'dt-bindings/clock/exynos7885.h' header.
properties:
compatible:
enum:
- samsung,exynos7885-cmu-top
- samsung,exynos7885-cmu-core
- samsung,exynos7885-cmu-peri
clocks:
minItems: 1
maxItems: 10
clock-names:
minItems: 1
maxItems: 10
"#clock-cells":
const: 1
reg:
maxItems: 1
allOf:
- if:
properties:
compatible:
contains:
const: samsung,exynos7885-cmu-top
then:
properties:
clocks:
items:
- description: External reference clock (26 MHz)
clock-names:
items:
- const: oscclk
- if:
properties:
compatible:
contains:
const: samsung,exynos7885-cmu-core
then:
properties:
clocks:
items:
- description: External reference clock (26 MHz)
- description: CMU_CORE bus clock (from CMU_TOP)
- description: CCI clock (from CMU_TOP)
- description: G3D clock (from CMU_TOP)
clock-names:
items:
- const: oscclk
- const: dout_core_bus
- const: dout_core_cci
- const: dout_core_g3d
- if:
properties:
compatible:
contains:
const: samsung,exynos7885-cmu-peri
then:
properties:
clocks:
items:
- description: External reference clock (26 MHz)
- description: CMU_PERI bus clock (from CMU_TOP)
- description: SPI0 clock (from CMU_TOP)
- description: SPI1 clock (from CMU_TOP)
- description: UART0 clock (from CMU_TOP)
- description: UART1 clock (from CMU_TOP)
- description: UART2 clock (from CMU_TOP)
- description: USI0 clock (from CMU_TOP)
- description: USI1 clock (from CMU_TOP)
- description: USI2 clock (from CMU_TOP)
clock-names:
items:
- const: oscclk
- const: dout_peri_bus
- const: dout_peri_spi0
- const: dout_peri_spi1
- const: dout_peri_uart0
- const: dout_peri_uart1
- const: dout_peri_uart2
- const: dout_peri_usi0
- const: dout_peri_usi1
- const: dout_peri_usi2
required:
- compatible
- "#clock-cells"
- clocks
- clock-names
- reg
additionalProperties: false
examples:
# Clock controller node for CMU_PERI
- |
#include <dt-bindings/clock/exynos7885.h>
cmu_peri: clock-controller@10010000 {
compatible = "samsung,exynos7885-cmu-peri";
reg = <0x10010000 0x8000>;
#clock-cells = <1>;
clocks = <&oscclk>,
<&cmu_top CLK_DOUT_PERI_BUS>,
<&cmu_top CLK_DOUT_PERI_SPI0>,
<&cmu_top CLK_DOUT_PERI_SPI1>,
<&cmu_top CLK_DOUT_PERI_UART0>,
<&cmu_top CLK_DOUT_PERI_UART1>,
<&cmu_top CLK_DOUT_PERI_UART2>,
<&cmu_top CLK_DOUT_PERI_USI0>,
<&cmu_top CLK_DOUT_PERI_USI1>,
<&cmu_top CLK_DOUT_PERI_USI2>;
clock-names = "oscclk",
"dout_peri_bus",
"dout_peri_spi0",
"dout_peri_spi1",
"dout_peri_uart0",
"dout_peri_uart1",
"dout_peri_uart2",
"dout_peri_usi0",
"dout_peri_usi1",
"dout_peri_usi2";
};
...

View File

@ -32,6 +32,8 @@ properties:
compatible: compatible:
enum: enum:
- samsung,exynos850-cmu-top - samsung,exynos850-cmu-top
- samsung,exynos850-cmu-apm
- samsung,exynos850-cmu-cmgp
- samsung,exynos850-cmu-core - samsung,exynos850-cmu-core
- samsung,exynos850-cmu-dpu - samsung,exynos850-cmu-dpu
- samsung,exynos850-cmu-hsi - samsung,exynos850-cmu-hsi
@ -68,6 +70,42 @@ allOf:
items: items:
- const: oscclk - const: oscclk
- if:
properties:
compatible:
contains:
const: samsung,exynos850-cmu-apm
then:
properties:
clocks:
items:
- description: External reference clock (26 MHz)
- description: CMU_APM bus clock (from CMU_TOP)
clock-names:
items:
- const: oscclk
- const: dout_clkcmu_apm_bus
- if:
properties:
compatible:
contains:
const: samsung,exynos850-cmu-cmgp
then:
properties:
clocks:
items:
- description: External reference clock (26 MHz)
- description: CMU_CMGP bus clock (from CMU_APM)
clock-names:
items:
- const: oscclk
- const: gout_clkcmu_cmgp_bus
- if: - if:
properties: properties:
compatible: compatible:

View File

@ -15725,6 +15725,15 @@ F: Documentation/admin-guide/media/qcom_camss.rst
F: Documentation/devicetree/bindings/media/*camss* F: Documentation/devicetree/bindings/media/*camss*
F: drivers/media/platform/qcom/camss/ F: drivers/media/platform/qcom/camss/
QUALCOMM CLOCK DRIVERS
M: Bjorn Andersson <bjorn.andersson@linaro.org>
L: linux-arm-msm@vger.kernel.org
S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git
F: Documentation/devicetree/bindings/clock/qcom,*
F: drivers/clk/qcom/
F: include/dt-bindings/clock/qcom,*
QUALCOMM CORE POWER REDUCTION (CPR) AVS DRIVER QUALCOMM CORE POWER REDUCTION (CPR) AVS DRIVER
M: Niklas Cassel <nks@flawful.org> M: Niklas Cassel <nks@flawful.org>
L: linux-pm@vger.kernel.org L: linux-pm@vger.kernel.org

View File

@ -277,9 +277,9 @@ static const char * const imx8mn_pdm_sels[] = {"osc_24m", "sys_pll2_100m", "audi
static const char * const imx8mn_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", }; static const char * const imx8mn_dram_core_sels[] = {"dram_pll_out", "dram_alt_root", };
static const char * const imx8mn_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "osc_27m", static const char * const imx8mn_clko1_sels[] = {"osc_24m", "sys_pll1_800m", "dummy",
"sys_pll1_200m", "audio_pll2_out", "vpu_pll", "sys_pll1_200m", "audio_pll2_out", "sys_pll2_500m",
"sys_pll1_80m", }; "dummy", "sys_pll1_80m", };
static const char * const imx8mn_clko2_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_400m", static const char * const imx8mn_clko2_sels[] = {"osc_24m", "sys_pll2_200m", "sys_pll1_400m",
"sys_pll2_166m", "sys_pll3_out", "audio_pll1_out", "sys_pll2_166m", "sys_pll3_out", "audio_pll1_out",
"video_pll1_out", "osc_32k", }; "video_pll1_out", "osc_32k", };

View File

@ -700,7 +700,7 @@ static int imx8mp_clocks_probe(struct platform_device *pdev)
hws[IMX8MP_CLK_HDMI_ROOT] = imx_clk_hw_gate4("hdmi_root_clk", "hdmi_axi", ccm_base + 0x45f0, 0); hws[IMX8MP_CLK_HDMI_ROOT] = imx_clk_hw_gate4("hdmi_root_clk", "hdmi_axi", ccm_base + 0x45f0, 0);
hws[IMX8MP_CLK_TSENSOR_ROOT] = imx_clk_hw_gate4("tsensor_root_clk", "ipg_root", ccm_base + 0x4620, 0); hws[IMX8MP_CLK_TSENSOR_ROOT] = imx_clk_hw_gate4("tsensor_root_clk", "ipg_root", ccm_base + 0x4620, 0);
hws[IMX8MP_CLK_VPU_ROOT] = imx_clk_hw_gate4("vpu_root_clk", "vpu_bus", ccm_base + 0x4630, 0); hws[IMX8MP_CLK_VPU_ROOT] = imx_clk_hw_gate4("vpu_root_clk", "vpu_bus", ccm_base + 0x4630, 0);
hws[IMX8MP_CLK_AUDIO_ROOT] = imx_clk_hw_gate4("audio_root_clk", "ipg_root", ccm_base + 0x4650, 0); hws[IMX8MP_CLK_AUDIO_ROOT] = imx_clk_hw_gate4("audio_root_clk", "audio_ahb", ccm_base + 0x4650, 0);
hws[IMX8MP_CLK_ARM] = imx_clk_hw_cpu("arm", "arm_a53_core", hws[IMX8MP_CLK_ARM] = imx_clk_hw_cpu("arm", "arm_a53_core",
hws[IMX8MP_CLK_A53_CORE]->clk, hws[IMX8MP_CLK_A53_CORE]->clk,

View File

@ -559,6 +559,7 @@ static struct platform_driver imx8ulp_clk_driver = {
.probe = imx8ulp_clk_probe, .probe = imx8ulp_clk_probe,
.driver = { .driver = {
.name = KBUILD_MODNAME, .name = KBUILD_MODNAME,
.suppress_bind_attrs = true,
.of_match_table = imx8ulp_clk_dt_ids, .of_match_table = imx8ulp_clk_dt_ids,
}, },
}; };

View File

@ -247,7 +247,7 @@ static long clk_pllv3_av_round_rate(struct clk_hw *hw, unsigned long rate,
div = rate / parent_rate; div = rate / parent_rate;
temp64 = (u64) (rate - div * parent_rate); temp64 = (u64) (rate - div * parent_rate);
temp64 *= mfd; temp64 *= mfd;
do_div(temp64, parent_rate); temp64 = div64_ul(temp64, parent_rate);
mfn = temp64; mfn = temp64;
temp64 = (u64)parent_rate; temp64 = (u64)parent_rate;
@ -277,7 +277,7 @@ static int clk_pllv3_av_set_rate(struct clk_hw *hw, unsigned long rate,
div = rate / parent_rate; div = rate / parent_rate;
temp64 = (u64) (rate - div * parent_rate); temp64 = (u64) (rate - div * parent_rate);
temp64 *= mfd; temp64 *= mfd;
do_div(temp64, parent_rate); temp64 = div64_ul(temp64, parent_rate);
mfn = temp64; mfn = temp64;
val = readl_relaxed(pll->base); val = readl_relaxed(pll->base);
@ -334,7 +334,7 @@ static struct clk_pllv3_vf610_mf clk_pllv3_vf610_rate_to_mf(
/* rate = parent_rate * (mfi + mfn/mfd) */ /* rate = parent_rate * (mfi + mfn/mfd) */
temp64 = rate - parent_rate * mf.mfi; temp64 = rate - parent_rate * mf.mfi;
temp64 *= mf.mfd; temp64 *= mf.mfd;
do_div(temp64, parent_rate); temp64 = div64_ul(temp64, parent_rate);
mf.mfn = temp64; mf.mfn = temp64;
} }

View File

@ -265,6 +265,14 @@ config MSM_MMCC_8974
Say Y if you want to support multimedia devices such as display, Say Y if you want to support multimedia devices such as display,
graphics, video encode/decode, camera, etc. graphics, video encode/decode, camera, etc.
config MSM_GCC_8976
tristate "MSM8956/76 Global Clock Controller"
select QCOM_GDSC
help
Support for the global clock controller on msm8956/76 devices.
Say Y if you want to use peripheral devices such as UART, SPI,
i2c, USB, SD/eMMC, SATA, PCIe, etc.
config MSM_MMCC_8994 config MSM_MMCC_8994
tristate "MSM8994 Multimedia Clock Controller" tristate "MSM8994 Multimedia Clock Controller"
select MSM_GCC_8994 select MSM_GCC_8994
@ -564,6 +572,14 @@ config SM_CAMCC_8250
Support for the camera clock controller on SM8250 devices. Support for the camera clock controller on SM8250 devices.
Say Y if you want to support camera devices and camera functionality. Say Y if you want to support camera devices and camera functionality.
config SDX_GCC_65
tristate "SDX65 Global Clock Controller"
select QCOM_GDSC
help
Support for the global clock controller on SDX65 devices.
Say Y if you want to use peripheral devices such as UART,
SPI, I2C, USB, SD/UFS, PCIe etc.
config SM_DISPCC_8250 config SM_DISPCC_8250
tristate "SM8150 and SM8250 Display Clock Controller" tristate "SM8150 and SM8250 Display Clock Controller"
depends on SM_GCC_8150 || SM_GCC_8250 depends on SM_GCC_8150 || SM_GCC_8250
@ -618,6 +634,14 @@ config SM_GCC_8350
Say Y if you want to use peripheral devices such as UART, Say Y if you want to use peripheral devices such as UART,
SPI, I2C, USB, SD/UFS, PCIe etc. SPI, I2C, USB, SD/UFS, PCIe etc.
config SM_GCC_8450
tristate "SM8450 Global Clock Controller"
select QCOM_GDSC
help
Support for the global clock controller on SM8450 devices.
Say Y if you want to use peripheral devices such as UART,
SPI, I2C, USB, SD/UFS, PCIe etc.
config SM_GPUCC_8150 config SM_GPUCC_8150
tristate "SM8150 Graphics Clock Controller" tristate "SM8150 Graphics Clock Controller"
select SM_GCC_8150 select SM_GCC_8150

View File

@ -36,6 +36,7 @@ obj-$(CONFIG_MSM_GCC_8939) += gcc-msm8939.o
obj-$(CONFIG_MSM_GCC_8953) += gcc-msm8953.o obj-$(CONFIG_MSM_GCC_8953) += gcc-msm8953.o
obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o obj-$(CONFIG_MSM_GCC_8960) += gcc-msm8960.o
obj-$(CONFIG_MSM_GCC_8974) += gcc-msm8974.o obj-$(CONFIG_MSM_GCC_8974) += gcc-msm8974.o
obj-$(CONFIG_MSM_GCC_8976) += gcc-msm8976.o
obj-$(CONFIG_MSM_GCC_8994) += gcc-msm8994.o obj-$(CONFIG_MSM_GCC_8994) += gcc-msm8994.o
obj-$(CONFIG_MSM_GCC_8996) += gcc-msm8996.o obj-$(CONFIG_MSM_GCC_8996) += gcc-msm8996.o
obj-$(CONFIG_MSM_LCC_8960) += lcc-msm8960.o obj-$(CONFIG_MSM_LCC_8960) += lcc-msm8960.o
@ -83,6 +84,7 @@ obj-$(CONFIG_SDM_LPASSCC_845) += lpasscc-sdm845.o
obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o obj-$(CONFIG_SDM_VIDEOCC_845) += videocc-sdm845.o
obj-$(CONFIG_SDX_GCC_55) += gcc-sdx55.o obj-$(CONFIG_SDX_GCC_55) += gcc-sdx55.o
obj-$(CONFIG_SM_CAMCC_8250) += camcc-sm8250.o obj-$(CONFIG_SM_CAMCC_8250) += camcc-sm8250.o
obj-$(CONFIG_SDX_GCC_65) += gcc-sdx65.o
obj-$(CONFIG_SM_DISPCC_8250) += dispcc-sm8250.o obj-$(CONFIG_SM_DISPCC_8250) += dispcc-sm8250.o
obj-$(CONFIG_SM_GCC_6115) += gcc-sm6115.o obj-$(CONFIG_SM_GCC_6115) += gcc-sm6115.o
obj-$(CONFIG_SM_GCC_6125) += gcc-sm6125.o obj-$(CONFIG_SM_GCC_6125) += gcc-sm6125.o
@ -90,6 +92,7 @@ obj-$(CONFIG_SM_GCC_6350) += gcc-sm6350.o
obj-$(CONFIG_SM_GCC_8150) += gcc-sm8150.o obj-$(CONFIG_SM_GCC_8150) += gcc-sm8150.o
obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o obj-$(CONFIG_SM_GCC_8250) += gcc-sm8250.o
obj-$(CONFIG_SM_GCC_8350) += gcc-sm8350.o obj-$(CONFIG_SM_GCC_8350) += gcc-sm8350.o
obj-$(CONFIG_SM_GCC_8450) += gcc-sm8450.o
obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o obj-$(CONFIG_SM_GPUCC_8150) += gpucc-sm8150.o
obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o obj-$(CONFIG_SM_GPUCC_8250) += gpucc-sm8250.o
obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o obj-$(CONFIG_SM_VIDEOCC_8150) += videocc-sm8150.o

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
/* /*
* Copyright (c) 2015, 2018, The Linux Foundation. All rights reserved. * Copyright (c) 2015, 2018, The Linux Foundation. All rights reserved.
* Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved.
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
@ -139,6 +140,20 @@ const u8 clk_alpha_pll_regs[][PLL_OFF_MAX_REGS] = {
[PLL_OFF_OPMODE] = 0x28, [PLL_OFF_OPMODE] = 0x28,
[PLL_OFF_STATUS] = 0x38, [PLL_OFF_STATUS] = 0x38,
}, },
[CLK_ALPHA_PLL_TYPE_LUCID_EVO] = {
[PLL_OFF_OPMODE] = 0x04,
[PLL_OFF_STATUS] = 0x0c,
[PLL_OFF_L_VAL] = 0x10,
[PLL_OFF_ALPHA_VAL] = 0x14,
[PLL_OFF_USER_CTL] = 0x18,
[PLL_OFF_USER_CTL_U] = 0x1c,
[PLL_OFF_CONFIG_CTL] = 0x20,
[PLL_OFF_CONFIG_CTL_U] = 0x24,
[PLL_OFF_CONFIG_CTL_U1] = 0x28,
[PLL_OFF_TEST_CTL] = 0x2c,
[PLL_OFF_TEST_CTL_U] = 0x30,
[PLL_OFF_TEST_CTL_U1] = 0x34,
},
}; };
EXPORT_SYMBOL_GPL(clk_alpha_pll_regs); EXPORT_SYMBOL_GPL(clk_alpha_pll_regs);
@ -175,6 +190,10 @@ EXPORT_SYMBOL_GPL(clk_alpha_pll_regs);
#define LUCID_5LPE_PLL_LATCH_INPUT BIT(14) #define LUCID_5LPE_PLL_LATCH_INPUT BIT(14)
#define LUCID_5LPE_ENABLE_VOTE_RUN BIT(21) #define LUCID_5LPE_ENABLE_VOTE_RUN BIT(21)
/* LUCID EVO PLL specific settings and offsets */
#define LUCID_EVO_ENABLE_VOTE_RUN BIT(25)
#define LUCID_EVO_PLL_L_VAL_MASK GENMASK(15, 0)
/* ZONDA PLL specific */ /* ZONDA PLL specific */
#define ZONDA_PLL_OUT_MASK 0xf #define ZONDA_PLL_OUT_MASK 0xf
#define ZONDA_STAY_IN_CFA BIT(16) #define ZONDA_STAY_IN_CFA BIT(16)
@ -204,7 +223,7 @@ static int wait_for_pll(struct clk_alpha_pll *pll, u32 mask, bool inverse,
if (ret) if (ret)
return ret; return ret;
for (count = 100; count > 0; count--) { for (count = 200; count > 0; count--) {
ret = regmap_read(pll->clkr.regmap, PLL_MODE(pll), &val); ret = regmap_read(pll->clkr.regmap, PLL_MODE(pll), &val);
if (ret) if (ret)
return ret; return ret;
@ -1741,24 +1760,32 @@ static int alpha_pll_lucid_5lpe_set_rate(struct clk_hw *hw, unsigned long rate,
LUCID_5LPE_ALPHA_PLL_ACK_LATCH); LUCID_5LPE_ALPHA_PLL_ACK_LATCH);
} }
static int clk_lucid_5lpe_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate, static int __clk_lucid_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate) unsigned long parent_rate,
unsigned long enable_vote_run)
{ {
struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw); struct clk_alpha_pll_postdiv *pll = to_clk_alpha_pll_postdiv(hw);
int i, val = 0, div, ret; struct regmap *regmap = pll->clkr.regmap;
int i, val, div, ret;
u32 mask; u32 mask;
/* /*
* If the PLL is in FSM mode, then treat set_rate callback as a * If the PLL is in FSM mode, then treat set_rate callback as a
* no-operation. * no-operation.
*/ */
ret = regmap_read(pll->clkr.regmap, PLL_USER_CTL(pll), &val); ret = regmap_read(regmap, PLL_USER_CTL(pll), &val);
if (ret) if (ret)
return ret; return ret;
if (val & LUCID_5LPE_ENABLE_VOTE_RUN) if (val & enable_vote_run)
return 0; return 0;
if (!pll->post_div_table) {
pr_err("Missing the post_div_table for the %s PLL\n",
clk_hw_get_name(&pll->clkr.hw));
return -EINVAL;
}
div = DIV_ROUND_UP_ULL((u64)parent_rate, rate); div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
for (i = 0; i < pll->num_post_div; i++) { for (i = 0; i < pll->num_post_div; i++) {
if (pll->post_div_table[i].div == div) { if (pll->post_div_table[i].div == div) {
@ -1772,6 +1799,12 @@ static int clk_lucid_5lpe_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long
mask, val << pll->post_div_shift); mask, val << pll->post_div_shift);
} }
static int clk_lucid_5lpe_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
return __clk_lucid_pll_postdiv_set_rate(hw, rate, parent_rate, LUCID_5LPE_ENABLE_VOTE_RUN);
}
const struct clk_ops clk_alpha_pll_lucid_5lpe_ops = { const struct clk_ops clk_alpha_pll_lucid_5lpe_ops = {
.prepare = alpha_pll_lucid_5lpe_prepare, .prepare = alpha_pll_lucid_5lpe_prepare,
.enable = alpha_pll_lucid_5lpe_enable, .enable = alpha_pll_lucid_5lpe_enable,
@ -1951,3 +1984,124 @@ const struct clk_ops clk_alpha_pll_zonda_ops = {
.set_rate = clk_zonda_pll_set_rate, .set_rate = clk_zonda_pll_set_rate,
}; };
EXPORT_SYMBOL(clk_alpha_pll_zonda_ops); EXPORT_SYMBOL(clk_alpha_pll_zonda_ops);
static int alpha_pll_lucid_evo_enable(struct clk_hw *hw)
{
struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
struct regmap *regmap = pll->clkr.regmap;
u32 val;
int ret;
ret = regmap_read(regmap, PLL_USER_CTL(pll), &val);
if (ret)
return ret;
/* If in FSM mode, just vote for it */
if (val & LUCID_EVO_ENABLE_VOTE_RUN) {
ret = clk_enable_regmap(hw);
if (ret)
return ret;
return wait_for_pll_enable_lock(pll);
}
/* Check if PLL is already enabled */
ret = trion_pll_is_enabled(pll, regmap);
if (ret < 0) {
return ret;
} else if (ret) {
pr_warn("%s PLL is already enabled\n", clk_hw_get_name(&pll->clkr.hw));
return 0;
}
ret = regmap_update_bits(regmap, PLL_MODE(pll), PLL_RESET_N, PLL_RESET_N);
if (ret)
return ret;
/* Set operation mode to RUN */
regmap_write(regmap, PLL_OPMODE(pll), PLL_RUN);
ret = wait_for_pll_enable_lock(pll);
if (ret)
return ret;
/* Enable the PLL outputs */
ret = regmap_update_bits(regmap, PLL_USER_CTL(pll), PLL_OUT_MASK, PLL_OUT_MASK);
if (ret)
return ret;
/* Enable the global PLL outputs */
ret = regmap_update_bits(regmap, PLL_MODE(pll), PLL_OUTCTRL, PLL_OUTCTRL);
if (ret)
return ret;
/* Ensure that the write above goes through before returning. */
mb();
return ret;
}
static void alpha_pll_lucid_evo_disable(struct clk_hw *hw)
{
struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
struct regmap *regmap = pll->clkr.regmap;
u32 val;
int ret;
ret = regmap_read(regmap, PLL_USER_CTL(pll), &val);
if (ret)
return;
/* If in FSM mode, just unvote it */
if (val & LUCID_EVO_ENABLE_VOTE_RUN) {
clk_disable_regmap(hw);
return;
}
/* Disable the global PLL output */
ret = regmap_update_bits(regmap, PLL_MODE(pll), PLL_OUTCTRL, 0);
if (ret)
return;
/* Disable the PLL outputs */
ret = regmap_update_bits(regmap, PLL_USER_CTL(pll), PLL_OUT_MASK, 0);
if (ret)
return;
/* Place the PLL mode in STANDBY */
regmap_write(regmap, PLL_OPMODE(pll), PLL_STANDBY);
}
static unsigned long alpha_pll_lucid_evo_recalc_rate(struct clk_hw *hw,
unsigned long parent_rate)
{
struct clk_alpha_pll *pll = to_clk_alpha_pll(hw);
struct regmap *regmap = pll->clkr.regmap;
u32 l, frac;
regmap_read(regmap, PLL_L_VAL(pll), &l);
l &= LUCID_EVO_PLL_L_VAL_MASK;
regmap_read(regmap, PLL_ALPHA_VAL(pll), &frac);
return alpha_pll_calc_rate(parent_rate, l, frac, pll_alpha_width(pll));
}
static int clk_lucid_evo_pll_postdiv_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
return __clk_lucid_pll_postdiv_set_rate(hw, rate, parent_rate, LUCID_EVO_ENABLE_VOTE_RUN);
}
const struct clk_ops clk_alpha_pll_fixed_lucid_evo_ops = {
.enable = alpha_pll_lucid_evo_enable,
.disable = alpha_pll_lucid_evo_disable,
.is_enabled = clk_trion_pll_is_enabled,
.recalc_rate = alpha_pll_lucid_evo_recalc_rate,
.round_rate = clk_alpha_pll_round_rate,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_fixed_lucid_evo_ops);
const struct clk_ops clk_alpha_pll_postdiv_lucid_evo_ops = {
.recalc_rate = clk_alpha_pll_postdiv_fabia_recalc_rate,
.round_rate = clk_alpha_pll_postdiv_fabia_round_rate,
.set_rate = clk_lucid_evo_pll_postdiv_set_rate,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_lucid_evo_ops);

View File

@ -17,6 +17,7 @@ enum {
CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION, CLK_ALPHA_PLL_TYPE_LUCID = CLK_ALPHA_PLL_TYPE_TRION,
CLK_ALPHA_PLL_TYPE_AGERA, CLK_ALPHA_PLL_TYPE_AGERA,
CLK_ALPHA_PLL_TYPE_ZONDA, CLK_ALPHA_PLL_TYPE_ZONDA,
CLK_ALPHA_PLL_TYPE_LUCID_EVO,
CLK_ALPHA_PLL_TYPE_MAX, CLK_ALPHA_PLL_TYPE_MAX,
}; };
@ -151,6 +152,8 @@ extern const struct clk_ops clk_alpha_pll_postdiv_lucid_5lpe_ops;
extern const struct clk_ops clk_alpha_pll_zonda_ops; extern const struct clk_ops clk_alpha_pll_zonda_ops;
#define clk_alpha_pll_postdiv_zonda_ops clk_alpha_pll_postdiv_fabia_ops #define clk_alpha_pll_postdiv_zonda_ops clk_alpha_pll_postdiv_fabia_ops
extern const struct clk_ops clk_alpha_pll_fixed_lucid_evo_ops;
extern const struct clk_ops clk_alpha_pll_postdiv_lucid_evo_ops;
void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap, void clk_alpha_pll_configure(struct clk_alpha_pll *pll, struct regmap *regmap,
const struct alpha_pll_config *config); const struct alpha_pll_config *config);

View File

@ -515,6 +515,32 @@ static const struct clk_rpmh_desc clk_rpmh_sm8350 = {
/* Resource name must match resource id present in cmd-db */ /* Resource name must match resource id present in cmd-db */
DEFINE_CLK_RPMH_ARC(sc7280, bi_tcxo, bi_tcxo_ao, "xo.lvl", 0x3, 4); DEFINE_CLK_RPMH_ARC(sc7280, bi_tcxo, bi_tcxo_ao, "xo.lvl", 0x3, 4);
DEFINE_CLK_RPMH_VRM(sm8450, ln_bb_clk1, ln_bb_clk1_ao, "lnbclka1", 4);
DEFINE_CLK_RPMH_VRM(sm8450, ln_bb_clk2, ln_bb_clk2_ao, "lnbclka2", 4);
static struct clk_hw *sm8450_rpmh_clocks[] = {
[RPMH_CXO_CLK] = &sc7280_bi_tcxo.hw,
[RPMH_CXO_CLK_A] = &sc7280_bi_tcxo_ao.hw,
[RPMH_LN_BB_CLK1] = &sm8450_ln_bb_clk1.hw,
[RPMH_LN_BB_CLK1_A] = &sm8450_ln_bb_clk1_ao.hw,
[RPMH_LN_BB_CLK2] = &sm8450_ln_bb_clk2.hw,
[RPMH_LN_BB_CLK2_A] = &sm8450_ln_bb_clk2_ao.hw,
[RPMH_RF_CLK1] = &sdm845_rf_clk1.hw,
[RPMH_RF_CLK1_A] = &sdm845_rf_clk1_ao.hw,
[RPMH_RF_CLK2] = &sdm845_rf_clk2.hw,
[RPMH_RF_CLK2_A] = &sdm845_rf_clk2_ao.hw,
[RPMH_RF_CLK3] = &sdm845_rf_clk3.hw,
[RPMH_RF_CLK3_A] = &sdm845_rf_clk3_ao.hw,
[RPMH_RF_CLK4] = &sm8350_rf_clk4.hw,
[RPMH_RF_CLK4_A] = &sm8350_rf_clk4_ao.hw,
[RPMH_IPA_CLK] = &sdm845_ipa.hw,
};
static const struct clk_rpmh_desc clk_rpmh_sm8450 = {
.clks = sm8450_rpmh_clocks,
.num_clks = ARRAY_SIZE(sm8450_rpmh_clocks),
};
static struct clk_hw *sc7280_rpmh_clocks[] = { static struct clk_hw *sc7280_rpmh_clocks[] = {
[RPMH_CXO_CLK] = &sc7280_bi_tcxo.hw, [RPMH_CXO_CLK] = &sc7280_bi_tcxo.hw,
[RPMH_CXO_CLK_A] = &sc7280_bi_tcxo_ao.hw, [RPMH_CXO_CLK_A] = &sc7280_bi_tcxo_ao.hw,
@ -556,6 +582,30 @@ static const struct clk_rpmh_desc clk_rpmh_sm6350 = {
.num_clks = ARRAY_SIZE(sm6350_rpmh_clocks), .num_clks = ARRAY_SIZE(sm6350_rpmh_clocks),
}; };
DEFINE_CLK_RPMH_VRM(sdx65, ln_bb_clk1, ln_bb_clk1_ao, "lnbclka1", 4);
static struct clk_hw *sdx65_rpmh_clocks[] = {
[RPMH_CXO_CLK] = &sc7280_bi_tcxo.hw,
[RPMH_CXO_CLK_A] = &sc7280_bi_tcxo_ao.hw,
[RPMH_LN_BB_CLK1] = &sdx65_ln_bb_clk1.hw,
[RPMH_LN_BB_CLK1_A] = &sdx65_ln_bb_clk1_ao.hw,
[RPMH_RF_CLK1] = &sdm845_rf_clk1.hw,
[RPMH_RF_CLK1_A] = &sdm845_rf_clk1_ao.hw,
[RPMH_RF_CLK2] = &sdm845_rf_clk2.hw,
[RPMH_RF_CLK2_A] = &sdm845_rf_clk2_ao.hw,
[RPMH_RF_CLK3] = &sdm845_rf_clk3.hw,
[RPMH_RF_CLK3_A] = &sdm845_rf_clk3_ao.hw,
[RPMH_RF_CLK4] = &sm8350_rf_clk4.hw,
[RPMH_RF_CLK4_A] = &sm8350_rf_clk4_ao.hw,
[RPMH_IPA_CLK] = &sdm845_ipa.hw,
[RPMH_QPIC_CLK] = &sdx55_qpic_clk.hw,
};
static const struct clk_rpmh_desc clk_rpmh_sdx65 = {
.clks = sdx65_rpmh_clocks,
.num_clks = ARRAY_SIZE(sdx65_rpmh_clocks),
};
static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec, static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec,
void *data) void *data)
{ {
@ -643,10 +693,12 @@ static const struct of_device_id clk_rpmh_match_table[] = {
{ .compatible = "qcom,sc8180x-rpmh-clk", .data = &clk_rpmh_sc8180x}, { .compatible = "qcom,sc8180x-rpmh-clk", .data = &clk_rpmh_sc8180x},
{ .compatible = "qcom,sdm845-rpmh-clk", .data = &clk_rpmh_sdm845}, { .compatible = "qcom,sdm845-rpmh-clk", .data = &clk_rpmh_sdm845},
{ .compatible = "qcom,sdx55-rpmh-clk", .data = &clk_rpmh_sdx55}, { .compatible = "qcom,sdx55-rpmh-clk", .data = &clk_rpmh_sdx55},
{ .compatible = "qcom,sdx65-rpmh-clk", .data = &clk_rpmh_sdx65},
{ .compatible = "qcom,sm6350-rpmh-clk", .data = &clk_rpmh_sm6350}, { .compatible = "qcom,sm6350-rpmh-clk", .data = &clk_rpmh_sm6350},
{ .compatible = "qcom,sm8150-rpmh-clk", .data = &clk_rpmh_sm8150}, { .compatible = "qcom,sm8150-rpmh-clk", .data = &clk_rpmh_sm8150},
{ .compatible = "qcom,sm8250-rpmh-clk", .data = &clk_rpmh_sm8250}, { .compatible = "qcom,sm8250-rpmh-clk", .data = &clk_rpmh_sm8250},
{ .compatible = "qcom,sm8350-rpmh-clk", .data = &clk_rpmh_sm8350}, { .compatible = "qcom,sm8350-rpmh-clk", .data = &clk_rpmh_sm8350},
{ .compatible = "qcom,sm8450-rpmh-clk", .data = &clk_rpmh_sm8450},
{ .compatible = "qcom,sc7280-rpmh-clk", .data = &clk_rpmh_sc7280}, { .compatible = "qcom,sc7280-rpmh-clk", .data = &clk_rpmh_sc7280},
{ } { }
}; };

View File

@ -17,7 +17,6 @@
#include <linux/soc/qcom/smd-rpm.h> #include <linux/soc/qcom/smd-rpm.h>
#include <dt-bindings/clock/qcom,rpmcc.h> #include <dt-bindings/clock/qcom,rpmcc.h>
#include <dt-bindings/mfd/qcom-rpm.h>
#define QCOM_RPM_KEY_SOFTWARE_ENABLE 0x6e657773 #define QCOM_RPM_KEY_SOFTWARE_ENABLE 0x6e657773
#define QCOM_RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY 0x62636370 #define QCOM_RPM_KEY_PIN_CTRL_CLK_BUFFER_ENABLE_KEY 0x62636370
@ -151,12 +150,6 @@ struct clk_smd_rpm_req {
__le32 value; __le32 value;
}; };
struct rpm_cc {
struct qcom_rpm *rpm;
struct clk_smd_rpm **clks;
size_t num_clks;
};
struct rpm_smd_clk_desc { struct rpm_smd_clk_desc {
struct clk_smd_rpm **clks; struct clk_smd_rpm **clks;
size_t num_clks; size_t num_clks;
@ -196,10 +189,6 @@ static int clk_smd_rpm_set_rate_active(struct clk_smd_rpm *r,
.value = cpu_to_le32(DIV_ROUND_UP(rate, 1000)), /* to kHz */ .value = cpu_to_le32(DIV_ROUND_UP(rate, 1000)), /* to kHz */
}; };
/* Buffered clock needs a binary value */
if (r->rpm_res_type == QCOM_SMD_RPM_CLK_BUF_A)
req.value = cpu_to_le32(!!req.value);
return qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_ACTIVE_STATE, return qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_ACTIVE_STATE,
r->rpm_res_type, r->rpm_clk_id, &req, r->rpm_res_type, r->rpm_clk_id, &req,
sizeof(req)); sizeof(req));
@ -214,10 +203,6 @@ static int clk_smd_rpm_set_rate_sleep(struct clk_smd_rpm *r,
.value = cpu_to_le32(DIV_ROUND_UP(rate, 1000)), /* to kHz */ .value = cpu_to_le32(DIV_ROUND_UP(rate, 1000)), /* to kHz */
}; };
/* Buffered clock needs a binary value */
if (r->rpm_res_type == QCOM_SMD_RPM_CLK_BUF_A)
req.value = cpu_to_le32(!!req.value);
return qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_SLEEP_STATE, return qcom_rpm_smd_write(r->rpm, QCOM_SMD_RPM_SLEEP_STATE,
r->rpm_res_type, r->rpm_clk_id, &req, r->rpm_res_type, r->rpm_clk_id, &req,
sizeof(req)); sizeof(req));
@ -1159,20 +1144,19 @@ MODULE_DEVICE_TABLE(of, rpm_smd_clk_match_table);
static struct clk_hw *qcom_smdrpm_clk_hw_get(struct of_phandle_args *clkspec, static struct clk_hw *qcom_smdrpm_clk_hw_get(struct of_phandle_args *clkspec,
void *data) void *data)
{ {
struct rpm_cc *rcc = data; const struct rpm_smd_clk_desc *desc = data;
unsigned int idx = clkspec->args[0]; unsigned int idx = clkspec->args[0];
if (idx >= rcc->num_clks) { if (idx >= desc->num_clks) {
pr_err("%s: invalid index %u\n", __func__, idx); pr_err("%s: invalid index %u\n", __func__, idx);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
return rcc->clks[idx] ? &rcc->clks[idx]->hw : ERR_PTR(-ENOENT); return desc->clks[idx] ? &desc->clks[idx]->hw : ERR_PTR(-ENOENT);
} }
static int rpm_smd_clk_probe(struct platform_device *pdev) static int rpm_smd_clk_probe(struct platform_device *pdev)
{ {
struct rpm_cc *rcc;
int ret; int ret;
size_t num_clks, i; size_t num_clks, i;
struct qcom_smd_rpm *rpm; struct qcom_smd_rpm *rpm;
@ -1192,13 +1176,6 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
rpm_smd_clks = desc->clks; rpm_smd_clks = desc->clks;
num_clks = desc->num_clks; num_clks = desc->num_clks;
rcc = devm_kzalloc(&pdev->dev, sizeof(*rcc), GFP_KERNEL);
if (!rcc)
return -ENOMEM;
rcc->clks = rpm_smd_clks;
rcc->num_clks = num_clks;
for (i = 0; i < num_clks; i++) { for (i = 0; i < num_clks; i++) {
if (!rpm_smd_clks[i]) if (!rpm_smd_clks[i])
continue; continue;
@ -1224,7 +1201,7 @@ static int rpm_smd_clk_probe(struct platform_device *pdev)
} }
ret = devm_of_clk_add_hw_provider(&pdev->dev, qcom_smdrpm_clk_hw_get, ret = devm_of_clk_add_hw_provider(&pdev->dev, qcom_smdrpm_clk_hw_get,
rcc); (void *)desc);
if (ret) if (ret)
goto err; goto err;

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,7 @@
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. /* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
*/ */
#include <linux/clk-provider.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/err.h> #include <linux/err.h>

View File

@ -2917,7 +2917,7 @@ static struct clk_branch gcc_cfg_noc_lpass_clk = {
.enable_mask = BIT(0), .enable_mask = BIT(0),
.hw.init = &(struct clk_init_data){ .hw.init = &(struct clk_init_data){
.name = "gcc_cfg_noc_lpass_clk", .name = "gcc_cfg_noc_lpass_clk",
.ops = &clk_branch2_ops, .ops = &clk_branch2_aon_ops,
}, },
}, },
}; };

1611
drivers/clk/qcom/gcc-sdx65.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,7 @@
* Copyright (c) 2021, Konrad Dybcio <konrad.dybcio@somainline.org> * Copyright (c) 2021, Konrad Dybcio <konrad.dybcio@somainline.org>
*/ */
#include <linux/clk-provider.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h> #include <linux/regmap.h>

View File

@ -4,6 +4,7 @@
* Copyright (c) 2020-2021, Linaro Limited * Copyright (c) 2020-2021, Linaro Limited
*/ */
#include <linux/clk-provider.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regmap.h> #include <linux/regmap.h>

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@
* Copyright (c) 2021, The Linux Foundation. All rights reserved. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
*/ */
#include <linux/clk-provider.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/pm_clock.h> #include <linux/pm_clock.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>

View File

@ -3,6 +3,7 @@
* Copyright (c) 2018, The Linux Foundation. All rights reserved. * Copyright (c) 2018, The Linux Foundation. All rights reserved.
*/ */
#include <linux/clk-provider.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of_address.h> #include <linux/of_address.h>

View File

@ -3,6 +3,7 @@
* Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*/ */
#include <linux/clk-provider.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/module.h> #include <linux/module.h>

View File

@ -4,6 +4,7 @@
*/ */
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/clk-provider.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>

View File

@ -4,6 +4,7 @@
*/ */
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/clk-provider.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/module.h> #include <linux/module.h>

View File

@ -16,7 +16,9 @@ obj-$(CONFIG_EXYNOS_5420_COMMON_CLK) += clk-exynos5-subcmu.o
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos5433.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos5433.o
obj-$(CONFIG_EXYNOS_AUDSS_CLK_CON) += clk-exynos-audss.o obj-$(CONFIG_EXYNOS_AUDSS_CLK_CON) += clk-exynos-audss.o
obj-$(CONFIG_EXYNOS_CLKOUT) += clk-exynos-clkout.o obj-$(CONFIG_EXYNOS_CLKOUT) += clk-exynos-clkout.o
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos-arm64.o
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos7.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos7.o
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos7885.o
obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos850.o obj-$(CONFIG_EXYNOS_ARM64_COMMON_CLK) += clk-exynos850.o
obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o obj-$(CONFIG_S3C2410_COMMON_CLK)+= clk-s3c2410.o
obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o obj-$(CONFIG_S3C2410_COMMON_DCLK)+= clk-s3c2410-dclk.o

View File

@ -400,7 +400,7 @@ static int exynos5433_cpuclk_notifier_cb(struct notifier_block *nb,
} }
/* helper function to register a CPU clock */ /* helper function to register a CPU clock */
int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx, static int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,
unsigned int lookup_id, const char *name, unsigned int lookup_id, const char *name,
const struct clk_hw *parent, const struct clk_hw *alt_parent, const struct clk_hw *parent, const struct clk_hw *alt_parent,
unsigned long offset, const struct exynos_cpuclk_cfg_data *cfg, unsigned long offset, const struct exynos_cpuclk_cfg_data *cfg,

View File

@ -62,11 +62,4 @@ struct exynos_cpuclk {
#define CLK_CPU_HAS_E5433_REGS_LAYOUT (1 << 2) #define CLK_CPU_HAS_E5433_REGS_LAYOUT (1 << 2)
}; };
int __init exynos_register_cpu_clock(struct samsung_clk_provider *ctx,
unsigned int lookup_id, const char *name,
const struct clk_hw *parent, const struct clk_hw *alt_parent,
unsigned long offset,
const struct exynos_cpuclk_cfg_data *cfg,
unsigned long num_cfgs, unsigned long flags);
#endif /* __SAMSUNG_CLK_CPU_H */ #endif /* __SAMSUNG_CLK_CPU_H */

View File

@ -0,0 +1,94 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2021 Linaro Ltd.
* Copyright (C) 2021 Dávid Virág <virag.david003@gmail.com>
* Author: Sam Protsenko <semen.protsenko@linaro.org>
* Author: Dávid Virág <virag.david003@gmail.com>
*
* This file contains shared functions used by some arm64 Exynos SoCs,
* such as Exynos7885 or Exynos850 to register and init CMUs.
*/
#include <linux/clk.h>
#include <linux/of_address.h>
#include "clk-exynos-arm64.h"
/* Gate register bits */
#define GATE_MANUAL BIT(20)
#define GATE_ENABLE_HWACG BIT(28)
/* Gate register offsets range */
#define GATE_OFF_START 0x2000
#define GATE_OFF_END 0x2fff
/**
* exynos_arm64_init_clocks - Set clocks initial configuration
* @np: CMU device tree node with "reg" property (CMU addr)
* @reg_offs: Register offsets array for clocks to init
* @reg_offs_len: Number of register offsets in reg_offs array
*
* Set manual control mode for all gate clocks.
*/
static void __init exynos_arm64_init_clocks(struct device_node *np,
const unsigned long *reg_offs, size_t reg_offs_len)
{
void __iomem *reg_base;
size_t i;
reg_base = of_iomap(np, 0);
if (!reg_base)
panic("%s: failed to map registers\n", __func__);
for (i = 0; i < reg_offs_len; ++i) {
void __iomem *reg = reg_base + reg_offs[i];
u32 val;
/* Modify only gate clock registers */
if (reg_offs[i] < GATE_OFF_START || reg_offs[i] > GATE_OFF_END)
continue;
val = readl(reg);
val |= GATE_MANUAL;
val &= ~GATE_ENABLE_HWACG;
writel(val, reg);
}
iounmap(reg_base);
}
/**
* exynos_arm64_register_cmu - Register specified Exynos CMU domain
* @dev: Device object; may be NULL if this function is not being
* called from platform driver probe function
* @np: CMU device tree node
* @cmu: CMU data
*
* Register specified CMU domain, which includes next steps:
*
* 1. Enable parent clock of @cmu CMU
* 2. Set initial registers configuration for @cmu CMU clocks
* 3. Register @cmu CMU clocks using Samsung clock framework API
*/
void __init exynos_arm64_register_cmu(struct device *dev,
struct device_node *np, const struct samsung_cmu_info *cmu)
{
/* Keep CMU parent clock running (needed for CMU registers access) */
if (cmu->clk_name) {
struct clk *parent_clk;
if (dev)
parent_clk = clk_get(dev, cmu->clk_name);
else
parent_clk = of_clk_get_by_name(np, cmu->clk_name);
if (IS_ERR(parent_clk)) {
pr_err("%s: could not find bus clock %s; err = %ld\n",
__func__, cmu->clk_name, PTR_ERR(parent_clk));
} else {
clk_prepare_enable(parent_clk);
}
}
exynos_arm64_init_clocks(np, cmu->clk_regs, cmu->nr_clk_regs);
samsung_cmu_register_one(np, cmu);
}

View File

@ -0,0 +1,20 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (C) 2021 Linaro Ltd.
* Copyright (C) 2021 Dávid Virág <virag.david003@gmail.com>
* Author: Sam Protsenko <semen.protsenko@linaro.org>
* Author: Dávid Virág <virag.david003@gmail.com>
*
* This file contains shared functions used by some arm64 Exynos SoCs,
* such as Exynos7885 or Exynos850 to register and init CMUs.
*/
#ifndef __CLK_EXYNOS_ARM64_H
#define __CLK_EXYNOS_ARM64_H
#include "clk.h"
void exynos_arm64_register_cmu(struct device *dev,
struct device_node *np, const struct samsung_cmu_info *cmu);
#endif /* __CLK_EXYNOS_ARM64_H */

View File

@ -748,6 +748,31 @@ static const struct samsung_pll_clock exynos3250_plls[] __initconst = {
UPLL_LOCK, UPLL_CON0, exynos3250_pll_rates), UPLL_LOCK, UPLL_CON0, exynos3250_pll_rates),
}; };
#define E3250_CPU_DIV0(apll, pclk_dbg, atb, corem) \
(((apll) << 24) | ((pclk_dbg) << 20) | ((atb) << 16) | \
((corem) << 4))
#define E3250_CPU_DIV1(hpm, copy) \
(((hpm) << 4) | ((copy) << 0))
static const struct exynos_cpuclk_cfg_data e3250_armclk_d[] __initconst = {
{ 1000000, E3250_CPU_DIV0(1, 7, 4, 1), E3250_CPU_DIV1(7, 7), },
{ 900000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 800000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 700000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 600000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 500000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 400000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 300000, E3250_CPU_DIV0(1, 5, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 200000, E3250_CPU_DIV0(1, 3, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 100000, E3250_CPU_DIV0(1, 1, 1, 1), E3250_CPU_DIV1(7, 7), },
{ 0 },
};
static const struct samsung_cpu_clock exynos3250_cpu_clks[] __initconst = {
CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C,
CLK_CPU_HAS_DIV1, 0x14200, e3250_armclk_d),
};
static void __init exynos3_core_down_clock(void __iomem *reg_base) static void __init exynos3_core_down_clock(void __iomem *reg_base)
{ {
unsigned int tmp; unsigned int tmp;
@ -780,46 +805,21 @@ static const struct samsung_cmu_info cmu_info __initconst = {
.nr_gate_clks = ARRAY_SIZE(gate_clks), .nr_gate_clks = ARRAY_SIZE(gate_clks),
.fixed_factor_clks = fixed_factor_clks, .fixed_factor_clks = fixed_factor_clks,
.nr_fixed_factor_clks = ARRAY_SIZE(fixed_factor_clks), .nr_fixed_factor_clks = ARRAY_SIZE(fixed_factor_clks),
.cpu_clks = exynos3250_cpu_clks,
.nr_cpu_clks = ARRAY_SIZE(exynos3250_cpu_clks),
.nr_clk_ids = CLK_NR_CLKS, .nr_clk_ids = CLK_NR_CLKS,
.clk_regs = exynos3250_cmu_clk_regs, .clk_regs = exynos3250_cmu_clk_regs,
.nr_clk_regs = ARRAY_SIZE(exynos3250_cmu_clk_regs), .nr_clk_regs = ARRAY_SIZE(exynos3250_cmu_clk_regs),
}; };
#define E3250_CPU_DIV0(apll, pclk_dbg, atb, corem) \
(((apll) << 24) | ((pclk_dbg) << 20) | ((atb) << 16) | \
((corem) << 4))
#define E3250_CPU_DIV1(hpm, copy) \
(((hpm) << 4) | ((copy) << 0))
static const struct exynos_cpuclk_cfg_data e3250_armclk_d[] __initconst = {
{ 1000000, E3250_CPU_DIV0(1, 7, 4, 1), E3250_CPU_DIV1(7, 7), },
{ 900000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 800000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 700000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 600000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 500000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 400000, E3250_CPU_DIV0(1, 7, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 300000, E3250_CPU_DIV0(1, 5, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 200000, E3250_CPU_DIV0(1, 3, 3, 1), E3250_CPU_DIV1(7, 7), },
{ 100000, E3250_CPU_DIV0(1, 1, 1, 1), E3250_CPU_DIV1(7, 7), },
{ 0 },
};
static void __init exynos3250_cmu_init(struct device_node *np) static void __init exynos3250_cmu_init(struct device_node *np)
{ {
struct samsung_clk_provider *ctx; struct samsung_clk_provider *ctx;
struct clk_hw **hws;
ctx = samsung_cmu_register_one(np, &cmu_info); ctx = samsung_cmu_register_one(np, &cmu_info);
if (!ctx) if (!ctx)
return; return;
hws = ctx->clk_data.hws;
exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk",
hws[CLK_MOUT_APLL], hws[CLK_MOUT_MPLL_USER_C],
0x14200, e3250_armclk_d, ARRAY_SIZE(e3250_armclk_d),
CLK_CPU_HAS_DIV1);
exynos3_core_down_clock(ctx->reg_base); exynos3_core_down_clock(ctx->reg_base);
} }
CLK_OF_DECLARE(exynos3250_cmu, "samsung,exynos3250-cmu", exynos3250_cmu_init); CLK_OF_DECLARE(exynos3250_cmu, "samsung,exynos3250-cmu", exynos3250_cmu_init);

View File

@ -437,7 +437,7 @@ static const struct samsung_mux_clock exynos4_mux_clks[] __initconst = {
/* list of mux clocks supported in exynos4210 soc */ /* list of mux clocks supported in exynos4210 soc */
static const struct samsung_mux_clock exynos4210_mux_early[] __initconst = { static const struct samsung_mux_clock exynos4210_mux_early[] __initconst = {
MUX(0, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP1, 0, 1), MUX(CLK_MOUT_VPLLSRC, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP1, 0, 1),
}; };
static const struct samsung_mux_clock exynos4210_mux_clks[] __initconst = { static const struct samsung_mux_clock exynos4210_mux_clks[] __initconst = {
@ -603,7 +603,7 @@ static const struct samsung_div_clock exynos4_div_clks[] __initconst = {
DIV(0, "div_periph", "div_core2", DIV_CPU0, 12, 3), DIV(0, "div_periph", "div_core2", DIV_CPU0, 12, 3),
DIV(0, "div_atb", "mout_core", DIV_CPU0, 16, 3), DIV(0, "div_atb", "mout_core", DIV_CPU0, 16, 3),
DIV(0, "div_pclk_dbg", "div_atb", DIV_CPU0, 20, 3), DIV(0, "div_pclk_dbg", "div_atb", DIV_CPU0, 20, 3),
DIV(0, "div_core2", "div_core", DIV_CPU0, 28, 3), DIV(CLK_DIV_CORE2, "div_core2", "div_core", DIV_CPU0, 28, 3),
DIV(0, "div_copy", "mout_hpm", DIV_CPU1, 0, 3), DIV(0, "div_copy", "mout_hpm", DIV_CPU1, 0, 3),
DIV(0, "div_hpm", "div_copy", DIV_CPU1, 4, 3), DIV(0, "div_hpm", "div_copy", DIV_CPU1, 4, 3),
DIV(0, "div_clkout_cpu", "mout_clkout_cpu", CLKOUT_CMU_CPU, 8, 6), DIV(0, "div_clkout_cpu", "mout_clkout_cpu", CLKOUT_CMU_CPU, 8, 6),
@ -1228,6 +1228,16 @@ static const struct exynos_cpuclk_cfg_data e4412_armclk_d[] __initconst = {
{ 0 }, { 0 },
}; };
static const struct samsung_cpu_clock exynos4210_cpu_clks[] __initconst = {
CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_SCLK_MPLL,
CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14200, e4210_armclk_d),
};
static const struct samsung_cpu_clock exynos4412_cpu_clks[] __initconst = {
CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL_USER_C,
CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1, 0x14200, e4412_armclk_d),
};
/* register exynos4 clocks */ /* register exynos4 clocks */
static void __init exynos4_clk_init(struct device_node *np, static void __init exynos4_clk_init(struct device_node *np,
enum exynos4_soc soc) enum exynos4_soc soc)
@ -1254,21 +1264,21 @@ static void __init exynos4_clk_init(struct device_node *np,
samsung_clk_register_mux(ctx, exynos4210_mux_early, samsung_clk_register_mux(ctx, exynos4210_mux_early,
ARRAY_SIZE(exynos4210_mux_early)); ARRAY_SIZE(exynos4210_mux_early));
if (_get_rate("fin_pll") == 24000000) { if (clk_hw_get_rate(hws[CLK_FIN_PLL]) == 24000000) {
exynos4210_plls[apll].rate_table = exynos4210_plls[apll].rate_table =
exynos4210_apll_rates; exynos4210_apll_rates;
exynos4210_plls[epll].rate_table = exynos4210_plls[epll].rate_table =
exynos4210_epll_rates; exynos4210_epll_rates;
} }
if (_get_rate("mout_vpllsrc") == 24000000) if (clk_hw_get_rate(hws[CLK_MOUT_VPLLSRC]) == 24000000)
exynos4210_plls[vpll].rate_table = exynos4210_plls[vpll].rate_table =
exynos4210_vpll_rates; exynos4210_vpll_rates;
samsung_clk_register_pll(ctx, exynos4210_plls, samsung_clk_register_pll(ctx, exynos4210_plls,
ARRAY_SIZE(exynos4210_plls), reg_base); ARRAY_SIZE(exynos4210_plls), reg_base);
} else { } else {
if (_get_rate("fin_pll") == 24000000) { if (clk_hw_get_rate(hws[CLK_FIN_PLL]) == 24000000) {
exynos4x12_plls[apll].rate_table = exynos4x12_plls[apll].rate_table =
exynos4x12_apll_rates; exynos4x12_apll_rates;
exynos4x12_plls[epll].rate_table = exynos4x12_plls[epll].rate_table =
@ -1304,10 +1314,8 @@ static void __init exynos4_clk_init(struct device_node *np,
samsung_clk_register_fixed_factor(ctx, samsung_clk_register_fixed_factor(ctx,
exynos4210_fixed_factor_clks, exynos4210_fixed_factor_clks,
ARRAY_SIZE(exynos4210_fixed_factor_clks)); ARRAY_SIZE(exynos4210_fixed_factor_clks));
exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", samsung_clk_register_cpu(ctx, exynos4210_cpu_clks,
hws[CLK_MOUT_APLL], hws[CLK_SCLK_MPLL], 0x14200, ARRAY_SIZE(exynos4210_cpu_clks));
e4210_armclk_d, ARRAY_SIZE(e4210_armclk_d),
CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1);
} else { } else {
samsung_clk_register_mux(ctx, exynos4x12_mux_clks, samsung_clk_register_mux(ctx, exynos4x12_mux_clks,
ARRAY_SIZE(exynos4x12_mux_clks)); ARRAY_SIZE(exynos4x12_mux_clks));
@ -1318,11 +1326,8 @@ static void __init exynos4_clk_init(struct device_node *np,
samsung_clk_register_fixed_factor(ctx, samsung_clk_register_fixed_factor(ctx,
exynos4x12_fixed_factor_clks, exynos4x12_fixed_factor_clks,
ARRAY_SIZE(exynos4x12_fixed_factor_clks)); ARRAY_SIZE(exynos4x12_fixed_factor_clks));
samsung_clk_register_cpu(ctx, exynos4412_cpu_clks,
exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", ARRAY_SIZE(exynos4412_cpu_clks));
hws[CLK_MOUT_APLL], hws[CLK_MOUT_MPLL_USER_C], 0x14200,
e4412_armclk_d, ARRAY_SIZE(e4412_armclk_d),
CLK_CPU_NEEDS_DEBUG_ALT_DIV | CLK_CPU_HAS_DIV1);
} }
if (soc == EXYNOS4X12) if (soc == EXYNOS4X12)
@ -1344,9 +1349,11 @@ static void __init exynos4_clk_init(struct device_node *np,
pr_info("%s clocks: sclk_apll = %ld, sclk_mpll = %ld\n" pr_info("%s clocks: sclk_apll = %ld, sclk_mpll = %ld\n"
"\tsclk_epll = %ld, sclk_vpll = %ld, arm_clk = %ld\n", "\tsclk_epll = %ld, sclk_vpll = %ld, arm_clk = %ld\n",
exynos4_soc == EXYNOS4210 ? "Exynos4210" : "Exynos4x12", exynos4_soc == EXYNOS4210 ? "Exynos4210" : "Exynos4x12",
_get_rate("sclk_apll"), _get_rate("sclk_mpll"), clk_hw_get_rate(hws[CLK_SCLK_APLL]),
_get_rate("sclk_epll"), _get_rate("sclk_vpll"), clk_hw_get_rate(hws[CLK_SCLK_MPLL]),
_get_rate("div_core2")); clk_hw_get_rate(hws[CLK_SCLK_EPLL]),
clk_hw_get_rate(hws[CLK_SCLK_VPLL]),
clk_hw_get_rate(hws[CLK_DIV_CORE2]));
} }

View File

@ -239,7 +239,7 @@ static const struct samsung_fixed_factor_clock exynos5250_fixed_factor_clks[] __
}; };
static const struct samsung_mux_clock exynos5250_pll_pmux_clks[] __initconst = { static const struct samsung_mux_clock exynos5250_pll_pmux_clks[] __initconst = {
MUX(0, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1), MUX(CLK_MOUT_VPLLSRC, "mout_vpllsrc", mout_vpllsrc_p, SRC_TOP2, 0, 1),
}; };
static const struct samsung_mux_clock exynos5250_mux_clks[] __initconst = { static const struct samsung_mux_clock exynos5250_mux_clks[] __initconst = {
@ -351,7 +351,7 @@ static const struct samsung_div_clock exynos5250_div_clks[] __initconst = {
*/ */
DIV(0, "div_arm", "mout_cpu", DIV_CPU0, 0, 3), DIV(0, "div_arm", "mout_cpu", DIV_CPU0, 0, 3),
DIV(0, "div_apll", "mout_apll", DIV_CPU0, 24, 3), DIV(0, "div_apll", "mout_apll", DIV_CPU0, 24, 3),
DIV(0, "div_arm2", "div_arm", DIV_CPU0, 28, 3), DIV(CLK_DIV_ARM2, "div_arm2", "div_arm", DIV_CPU0, 28, 3),
/* /*
* CMU_TOP * CMU_TOP
@ -772,6 +772,11 @@ static const struct exynos_cpuclk_cfg_data exynos5250_armclk_d[] __initconst = {
{ 0 }, { 0 },
}; };
static const struct samsung_cpu_clock exynos5250_cpu_clks[] __initconst = {
CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MPLL, CLK_CPU_HAS_DIV1, 0x200,
exynos5250_armclk_d),
};
static const struct of_device_id ext_clk_match[] __initconst = { static const struct of_device_id ext_clk_match[] __initconst = {
{ .compatible = "samsung,clock-xxti", .data = (void *)0, }, { .compatible = "samsung,clock-xxti", .data = (void *)0, },
{ }, { },
@ -801,12 +806,12 @@ static void __init exynos5250_clk_init(struct device_node *np)
samsung_clk_register_mux(ctx, exynos5250_pll_pmux_clks, samsung_clk_register_mux(ctx, exynos5250_pll_pmux_clks,
ARRAY_SIZE(exynos5250_pll_pmux_clks)); ARRAY_SIZE(exynos5250_pll_pmux_clks));
if (_get_rate("fin_pll") == 24 * MHZ) { if (clk_hw_get_rate(hws[CLK_FIN_PLL]) == 24 * MHZ) {
exynos5250_plls[epll].rate_table = epll_24mhz_tbl; exynos5250_plls[epll].rate_table = epll_24mhz_tbl;
exynos5250_plls[apll].rate_table = apll_24mhz_tbl; exynos5250_plls[apll].rate_table = apll_24mhz_tbl;
} }
if (_get_rate("mout_vpllsrc") == 24 * MHZ) if (clk_hw_get_rate(hws[CLK_MOUT_VPLLSRC]) == 24 * MHZ)
exynos5250_plls[vpll].rate_table = vpll_24mhz_tbl; exynos5250_plls[vpll].rate_table = vpll_24mhz_tbl;
samsung_clk_register_pll(ctx, exynos5250_plls, samsung_clk_register_pll(ctx, exynos5250_plls,
@ -822,10 +827,8 @@ static void __init exynos5250_clk_init(struct device_node *np)
ARRAY_SIZE(exynos5250_div_clks)); ARRAY_SIZE(exynos5250_div_clks));
samsung_clk_register_gate(ctx, exynos5250_gate_clks, samsung_clk_register_gate(ctx, exynos5250_gate_clks,
ARRAY_SIZE(exynos5250_gate_clks)); ARRAY_SIZE(exynos5250_gate_clks));
exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", samsung_clk_register_cpu(ctx, exynos5250_cpu_clks,
hws[CLK_MOUT_APLL], hws[CLK_MOUT_MPLL], 0x200, ARRAY_SIZE(exynos5250_cpu_clks));
exynos5250_armclk_d, ARRAY_SIZE(exynos5250_armclk_d),
CLK_CPU_HAS_DIV1);
/* /*
* Enable arm clock down (in idle) and set arm divider * Enable arm clock down (in idle) and set arm divider
@ -855,6 +858,6 @@ static void __init exynos5250_clk_init(struct device_node *np)
samsung_clk_of_add_provider(np, ctx); samsung_clk_of_add_provider(np, ctx);
pr_info("Exynos5250: clock setup completed, armclk=%ld\n", pr_info("Exynos5250: clock setup completed, armclk=%ld\n",
_get_rate("div_arm2")); clk_hw_get_rate(hws[CLK_DIV_ARM2]));
} }
CLK_OF_DECLARE_DRIVER(exynos5250_clk, "samsung,exynos5250-clock", exynos5250_clk_init); CLK_OF_DECLARE_DRIVER(exynos5250_clk, "samsung,exynos5250-clock", exynos5250_clk_init);

View File

@ -1551,6 +1551,20 @@ static const struct exynos_cpuclk_cfg_data exynos5420_kfcclk_d[] __initconst = {
{ 0 }, { 0 },
}; };
static const struct samsung_cpu_clock exynos5420_cpu_clks[] __initconst = {
CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MSPLL_CPU, 0, 0x200,
exynos5420_eglclk_d),
CPU_CLK(CLK_KFC_CLK, "kfcclk", CLK_MOUT_KPLL, CLK_MOUT_MSPLL_KFC, 0, 0x28200,
exynos5420_kfcclk_d),
};
static const struct samsung_cpu_clock exynos5800_cpu_clks[] __initconst = {
CPU_CLK(CLK_ARM_CLK, "armclk", CLK_MOUT_APLL, CLK_MOUT_MSPLL_CPU, 0, 0x200,
exynos5800_eglclk_d),
CPU_CLK(CLK_KFC_CLK, "kfcclk", CLK_MOUT_KPLL, CLK_MOUT_MSPLL_KFC, 0, 0x28200,
exynos5420_kfcclk_d),
};
static const struct of_device_id ext_clk_match[] __initconst = { static const struct of_device_id ext_clk_match[] __initconst = {
{ .compatible = "samsung,exynos5420-oscclk", .data = (void *)0, }, { .compatible = "samsung,exynos5420-oscclk", .data = (void *)0, },
{ }, { },
@ -1580,7 +1594,7 @@ static void __init exynos5x_clk_init(struct device_node *np,
ARRAY_SIZE(exynos5x_fixed_rate_ext_clks), ARRAY_SIZE(exynos5x_fixed_rate_ext_clks),
ext_clk_match); ext_clk_match);
if (_get_rate("fin_pll") == 24 * MHZ) { if (clk_hw_get_rate(hws[CLK_FIN_PLL]) == 24 * MHZ) {
exynos5x_plls[apll].rate_table = exynos5420_pll2550x_24mhz_tbl; exynos5x_plls[apll].rate_table = exynos5420_pll2550x_24mhz_tbl;
exynos5x_plls[epll].rate_table = exynos5420_epll_24mhz_tbl; exynos5x_plls[epll].rate_table = exynos5420_epll_24mhz_tbl;
exynos5x_plls[kpll].rate_table = exynos5420_pll2550x_24mhz_tbl; exynos5x_plls[kpll].rate_table = exynos5420_pll2550x_24mhz_tbl;
@ -1625,17 +1639,12 @@ static void __init exynos5x_clk_init(struct device_node *np,
} }
if (soc == EXYNOS5420) { if (soc == EXYNOS5420) {
exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", samsung_clk_register_cpu(ctx, exynos5420_cpu_clks,
hws[CLK_MOUT_APLL], hws[CLK_MOUT_MSPLL_CPU], 0x200, ARRAY_SIZE(exynos5420_cpu_clks));
exynos5420_eglclk_d, ARRAY_SIZE(exynos5420_eglclk_d), 0);
} else { } else {
exynos_register_cpu_clock(ctx, CLK_ARM_CLK, "armclk", samsung_clk_register_cpu(ctx, exynos5800_cpu_clks,
hws[CLK_MOUT_APLL], hws[CLK_MOUT_MSPLL_CPU], 0x200, ARRAY_SIZE(exynos5800_cpu_clks));
exynos5800_eglclk_d, ARRAY_SIZE(exynos5800_eglclk_d), 0);
} }
exynos_register_cpu_clock(ctx, CLK_KFC_CLK, "kfcclk",
hws[CLK_MOUT_KPLL], hws[CLK_MOUT_MSPLL_KFC], 0x28200,
exynos5420_kfcclk_d, ARRAY_SIZE(exynos5420_kfcclk_d), 0);
samsung_clk_extended_sleep_init(reg_base, samsung_clk_extended_sleep_init(reg_base,
exynos5x_clk_regs, ARRAY_SIZE(exynos5x_clk_regs), exynos5x_clk_regs, ARRAY_SIZE(exynos5x_clk_regs),

View File

@ -0,0 +1,597 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2021 Dávid Virág <virag.david003@gmail.com>
* Author: Dávid Virág <virag.david003@gmail.com>
*
* Common Clock Framework support for Exynos7885 SoC.
*/
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <dt-bindings/clock/exynos7885.h>
#include "clk.h"
#include "clk-exynos-arm64.h"
/* ---- CMU_TOP ------------------------------------------------------------- */
/* Register Offset definitions for CMU_TOP (0x12060000) */
#define PLL_LOCKTIME_PLL_SHARED0 0x0000
#define PLL_LOCKTIME_PLL_SHARED1 0x0004
#define PLL_CON0_PLL_SHARED0 0x0100
#define PLL_CON0_PLL_SHARED1 0x0120
#define CLK_CON_MUX_MUX_CLKCMU_CORE_BUS 0x1014
#define CLK_CON_MUX_MUX_CLKCMU_CORE_CCI 0x1018
#define CLK_CON_MUX_MUX_CLKCMU_CORE_G3D 0x101c
#define CLK_CON_MUX_MUX_CLKCMU_PERI_BUS 0x1058
#define CLK_CON_MUX_MUX_CLKCMU_PERI_SPI0 0x105c
#define CLK_CON_MUX_MUX_CLKCMU_PERI_SPI1 0x1060
#define CLK_CON_MUX_MUX_CLKCMU_PERI_UART0 0x1064
#define CLK_CON_MUX_MUX_CLKCMU_PERI_UART1 0x1068
#define CLK_CON_MUX_MUX_CLKCMU_PERI_UART2 0x106c
#define CLK_CON_MUX_MUX_CLKCMU_PERI_USI0 0x1070
#define CLK_CON_MUX_MUX_CLKCMU_PERI_USI1 0x1074
#define CLK_CON_MUX_MUX_CLKCMU_PERI_USI2 0x1078
#define CLK_CON_DIV_CLKCMU_CORE_BUS 0x181c
#define CLK_CON_DIV_CLKCMU_CORE_CCI 0x1820
#define CLK_CON_DIV_CLKCMU_CORE_G3D 0x1824
#define CLK_CON_DIV_CLKCMU_PERI_BUS 0x1874
#define CLK_CON_DIV_CLKCMU_PERI_SPI0 0x1878
#define CLK_CON_DIV_CLKCMU_PERI_SPI1 0x187c
#define CLK_CON_DIV_CLKCMU_PERI_UART0 0x1880
#define CLK_CON_DIV_CLKCMU_PERI_UART1 0x1884
#define CLK_CON_DIV_CLKCMU_PERI_UART2 0x1888
#define CLK_CON_DIV_CLKCMU_PERI_USI0 0x188c
#define CLK_CON_DIV_CLKCMU_PERI_USI1 0x1890
#define CLK_CON_DIV_CLKCMU_PERI_USI2 0x1894
#define CLK_CON_DIV_PLL_SHARED0_DIV2 0x189c
#define CLK_CON_DIV_PLL_SHARED0_DIV3 0x18a0
#define CLK_CON_DIV_PLL_SHARED0_DIV4 0x18a4
#define CLK_CON_DIV_PLL_SHARED0_DIV5 0x18a8
#define CLK_CON_DIV_PLL_SHARED1_DIV2 0x18ac
#define CLK_CON_DIV_PLL_SHARED1_DIV3 0x18b0
#define CLK_CON_DIV_PLL_SHARED1_DIV4 0x18b4
#define CLK_CON_GAT_GATE_CLKCMUC_PERI_UART1 0x2004
#define CLK_CON_GAT_GATE_CLKCMU_CORE_BUS 0x201c
#define CLK_CON_GAT_GATE_CLKCMU_CORE_CCI 0x2020
#define CLK_CON_GAT_GATE_CLKCMU_CORE_G3D 0x2024
#define CLK_CON_GAT_GATE_CLKCMU_PERI_BUS 0x207c
#define CLK_CON_GAT_GATE_CLKCMU_PERI_SPI0 0x2080
#define CLK_CON_GAT_GATE_CLKCMU_PERI_SPI1 0x2084
#define CLK_CON_GAT_GATE_CLKCMU_PERI_UART0 0x2088
#define CLK_CON_GAT_GATE_CLKCMU_PERI_UART2 0x208c
#define CLK_CON_GAT_GATE_CLKCMU_PERI_USI0 0x2090
#define CLK_CON_GAT_GATE_CLKCMU_PERI_USI1 0x2094
#define CLK_CON_GAT_GATE_CLKCMU_PERI_USI2 0x2098
static const unsigned long top_clk_regs[] __initconst = {
PLL_LOCKTIME_PLL_SHARED0,
PLL_LOCKTIME_PLL_SHARED1,
PLL_CON0_PLL_SHARED0,
PLL_CON0_PLL_SHARED1,
CLK_CON_MUX_MUX_CLKCMU_CORE_BUS,
CLK_CON_MUX_MUX_CLKCMU_CORE_CCI,
CLK_CON_MUX_MUX_CLKCMU_CORE_G3D,
CLK_CON_MUX_MUX_CLKCMU_PERI_BUS,
CLK_CON_MUX_MUX_CLKCMU_PERI_SPI0,
CLK_CON_MUX_MUX_CLKCMU_PERI_SPI1,
CLK_CON_MUX_MUX_CLKCMU_PERI_UART0,
CLK_CON_MUX_MUX_CLKCMU_PERI_UART1,
CLK_CON_MUX_MUX_CLKCMU_PERI_UART2,
CLK_CON_MUX_MUX_CLKCMU_PERI_USI0,
CLK_CON_MUX_MUX_CLKCMU_PERI_USI1,
CLK_CON_MUX_MUX_CLKCMU_PERI_USI2,
CLK_CON_DIV_CLKCMU_CORE_BUS,
CLK_CON_DIV_CLKCMU_CORE_CCI,
CLK_CON_DIV_CLKCMU_CORE_G3D,
CLK_CON_DIV_CLKCMU_PERI_BUS,
CLK_CON_DIV_CLKCMU_PERI_SPI0,
CLK_CON_DIV_CLKCMU_PERI_SPI1,
CLK_CON_DIV_CLKCMU_PERI_UART0,
CLK_CON_DIV_CLKCMU_PERI_UART1,
CLK_CON_DIV_CLKCMU_PERI_UART2,
CLK_CON_DIV_CLKCMU_PERI_USI0,
CLK_CON_DIV_CLKCMU_PERI_USI1,
CLK_CON_DIV_CLKCMU_PERI_USI2,
CLK_CON_DIV_PLL_SHARED0_DIV2,
CLK_CON_DIV_PLL_SHARED0_DIV3,
CLK_CON_DIV_PLL_SHARED0_DIV4,
CLK_CON_DIV_PLL_SHARED0_DIV5,
CLK_CON_DIV_PLL_SHARED1_DIV2,
CLK_CON_DIV_PLL_SHARED1_DIV3,
CLK_CON_DIV_PLL_SHARED1_DIV4,
CLK_CON_GAT_GATE_CLKCMUC_PERI_UART1,
CLK_CON_GAT_GATE_CLKCMU_CORE_BUS,
CLK_CON_GAT_GATE_CLKCMU_CORE_CCI,
CLK_CON_GAT_GATE_CLKCMU_CORE_G3D,
CLK_CON_GAT_GATE_CLKCMU_PERI_BUS,
CLK_CON_GAT_GATE_CLKCMU_PERI_SPI0,
CLK_CON_GAT_GATE_CLKCMU_PERI_SPI1,
CLK_CON_GAT_GATE_CLKCMU_PERI_UART0,
CLK_CON_GAT_GATE_CLKCMU_PERI_UART2,
CLK_CON_GAT_GATE_CLKCMU_PERI_USI0,
CLK_CON_GAT_GATE_CLKCMU_PERI_USI1,
CLK_CON_GAT_GATE_CLKCMU_PERI_USI2,
};
static const struct samsung_pll_clock top_pll_clks[] __initconst = {
PLL(pll_1417x, CLK_FOUT_SHARED0_PLL, "fout_shared0_pll", "oscclk",
PLL_LOCKTIME_PLL_SHARED0, PLL_CON0_PLL_SHARED0,
NULL),
PLL(pll_1417x, CLK_FOUT_SHARED1_PLL, "fout_shared1_pll", "oscclk",
PLL_LOCKTIME_PLL_SHARED1, PLL_CON0_PLL_SHARED1,
NULL),
};
/* List of parent clocks for Muxes in CMU_TOP: for CMU_CORE */
PNAME(mout_core_bus_p) = { "dout_shared0_div2", "dout_shared1_div2",
"dout_shared0_div3", "dout_shared0_div3" };
PNAME(mout_core_cci_p) = { "dout_shared0_div2", "dout_shared1_div2",
"dout_shared0_div3", "dout_shared0_div3" };
PNAME(mout_core_g3d_p) = { "dout_shared0_div2", "dout_shared1_div2",
"dout_shared0_div3", "dout_shared0_div3" };
/* List of parent clocks for Muxes in CMU_TOP: for CMU_PERI */
PNAME(mout_peri_bus_p) = { "dout_shared0_div4", "dout_shared1_div4" };
PNAME(mout_peri_spi0_p) = { "oscclk", "dout_shared0_div4" };
PNAME(mout_peri_spi1_p) = { "oscclk", "dout_shared0_div4" };
PNAME(mout_peri_uart0_p) = { "oscclk", "dout_shared0_div4" };
PNAME(mout_peri_uart1_p) = { "oscclk", "dout_shared0_div4" };
PNAME(mout_peri_uart2_p) = { "oscclk", "dout_shared0_div4" };
PNAME(mout_peri_usi0_p) = { "oscclk", "dout_shared0_div4" };
PNAME(mout_peri_usi1_p) = { "oscclk", "dout_shared0_div4" };
PNAME(mout_peri_usi2_p) = { "oscclk", "dout_shared0_div4" };
static const struct samsung_mux_clock top_mux_clks[] __initconst = {
/* CORE */
MUX(CLK_MOUT_CORE_BUS, "mout_core_bus", mout_core_bus_p,
CLK_CON_MUX_MUX_CLKCMU_CORE_BUS, 0, 2),
MUX(CLK_MOUT_CORE_CCI, "mout_core_cci", mout_core_cci_p,
CLK_CON_MUX_MUX_CLKCMU_CORE_CCI, 0, 2),
MUX(CLK_MOUT_CORE_G3D, "mout_core_g3d", mout_core_g3d_p,
CLK_CON_MUX_MUX_CLKCMU_CORE_G3D, 0, 2),
/* PERI */
MUX(CLK_MOUT_PERI_BUS, "mout_peri_bus", mout_peri_bus_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_BUS, 0, 1),
MUX(CLK_MOUT_PERI_SPI0, "mout_peri_spi0", mout_peri_spi0_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_SPI0, 0, 1),
MUX(CLK_MOUT_PERI_SPI1, "mout_peri_spi1", mout_peri_spi1_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_SPI1, 0, 1),
MUX(CLK_MOUT_PERI_UART0, "mout_peri_uart0", mout_peri_uart0_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_UART0, 0, 1),
MUX(CLK_MOUT_PERI_UART1, "mout_peri_uart1", mout_peri_uart1_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_UART1, 0, 1),
MUX(CLK_MOUT_PERI_UART2, "mout_peri_uart2", mout_peri_uart2_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_UART2, 0, 1),
MUX(CLK_MOUT_PERI_USI0, "mout_peri_usi0", mout_peri_usi0_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_USI0, 0, 1),
MUX(CLK_MOUT_PERI_USI1, "mout_peri_usi1", mout_peri_usi1_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_USI1, 0, 1),
MUX(CLK_MOUT_PERI_USI2, "mout_peri_usi2", mout_peri_usi2_p,
CLK_CON_MUX_MUX_CLKCMU_PERI_USI2, 0, 1),
};
static const struct samsung_div_clock top_div_clks[] __initconst = {
/* TOP */
DIV(CLK_DOUT_SHARED0_DIV2, "dout_shared0_div2", "fout_shared0_pll",
CLK_CON_DIV_PLL_SHARED0_DIV2, 0, 1),
DIV(CLK_DOUT_SHARED0_DIV3, "dout_shared0_div3", "fout_shared0_pll",
CLK_CON_DIV_PLL_SHARED0_DIV3, 0, 2),
DIV(CLK_DOUT_SHARED0_DIV4, "dout_shared0_div4", "fout_shared0_pll",
CLK_CON_DIV_PLL_SHARED0_DIV4, 0, 1),
DIV(CLK_DOUT_SHARED0_DIV5, "dout_shared0_div5", "fout_shared0_pll",
CLK_CON_DIV_PLL_SHARED0_DIV5, 0, 3),
DIV(CLK_DOUT_SHARED1_DIV2, "dout_shared1_div2", "fout_shared1_pll",
CLK_CON_DIV_PLL_SHARED1_DIV2, 0, 1),
DIV(CLK_DOUT_SHARED1_DIV3, "dout_shared1_div3", "fout_shared1_pll",
CLK_CON_DIV_PLL_SHARED1_DIV3, 0, 2),
DIV(CLK_DOUT_SHARED1_DIV4, "dout_shared1_div4", "fout_shared1_pll",
CLK_CON_DIV_PLL_SHARED1_DIV4, 0, 1),
/* CORE */
DIV(CLK_DOUT_CORE_BUS, "dout_core_bus", "gout_core_bus",
CLK_CON_DIV_CLKCMU_CORE_BUS, 0, 3),
DIV(CLK_DOUT_CORE_CCI, "dout_core_cci", "gout_core_cci",
CLK_CON_DIV_CLKCMU_CORE_CCI, 0, 3),
DIV(CLK_DOUT_CORE_G3D, "dout_core_g3d", "gout_core_g3d",
CLK_CON_DIV_CLKCMU_CORE_G3D, 0, 3),
/* PERI */
DIV(CLK_DOUT_PERI_BUS, "dout_peri_bus", "gout_peri_bus",
CLK_CON_DIV_CLKCMU_PERI_BUS, 0, 4),
DIV(CLK_DOUT_PERI_SPI0, "dout_peri_spi0", "gout_peri_spi0",
CLK_CON_DIV_CLKCMU_PERI_SPI0, 0, 6),
DIV(CLK_DOUT_PERI_SPI1, "dout_peri_spi1", "gout_peri_spi1",
CLK_CON_DIV_CLKCMU_PERI_SPI1, 0, 6),
DIV(CLK_DOUT_PERI_UART0, "dout_peri_uart0", "gout_peri_uart0",
CLK_CON_DIV_CLKCMU_PERI_UART0, 0, 4),
DIV(CLK_DOUT_PERI_UART1, "dout_peri_uart1", "gout_peri_uart1",
CLK_CON_DIV_CLKCMU_PERI_UART1, 0, 4),
DIV(CLK_DOUT_PERI_UART2, "dout_peri_uart2", "gout_peri_uart2",
CLK_CON_DIV_CLKCMU_PERI_UART2, 0, 4),
DIV(CLK_DOUT_PERI_USI0, "dout_peri_usi0", "gout_peri_usi0",
CLK_CON_DIV_CLKCMU_PERI_USI0, 0, 4),
DIV(CLK_DOUT_PERI_USI1, "dout_peri_usi1", "gout_peri_usi1",
CLK_CON_DIV_CLKCMU_PERI_USI1, 0, 4),
DIV(CLK_DOUT_PERI_USI2, "dout_peri_usi2", "gout_peri_usi2",
CLK_CON_DIV_CLKCMU_PERI_USI2, 0, 4),
};
static const struct samsung_gate_clock top_gate_clks[] __initconst = {
/* CORE */
GATE(CLK_GOUT_CORE_BUS, "gout_core_bus", "mout_core_bus",
CLK_CON_GAT_GATE_CLKCMU_CORE_BUS, 21, 0, 0),
GATE(CLK_GOUT_CORE_CCI, "gout_core_cci", "mout_core_cci",
CLK_CON_GAT_GATE_CLKCMU_CORE_CCI, 21, 0, 0),
GATE(CLK_GOUT_CORE_G3D, "gout_core_g3d", "mout_core_g3d",
CLK_CON_GAT_GATE_CLKCMU_CORE_G3D, 21, 0, 0),
/* PERI */
GATE(CLK_GOUT_PERI_BUS, "gout_peri_bus", "mout_peri_bus",
CLK_CON_GAT_GATE_CLKCMU_PERI_BUS, 21, 0, 0),
GATE(CLK_GOUT_PERI_SPI0, "gout_peri_spi0", "mout_peri_spi0",
CLK_CON_GAT_GATE_CLKCMU_PERI_SPI0, 21, 0, 0),
GATE(CLK_GOUT_PERI_SPI1, "gout_peri_spi1", "mout_peri_spi1",
CLK_CON_GAT_GATE_CLKCMU_PERI_SPI1, 21, 0, 0),
GATE(CLK_GOUT_PERI_UART0, "gout_peri_uart0", "mout_peri_uart0",
CLK_CON_GAT_GATE_CLKCMU_PERI_UART0, 21, 0, 0),
GATE(CLK_GOUT_PERI_UART1, "gout_peri_uart1", "mout_peri_uart1",
CLK_CON_GAT_GATE_CLKCMUC_PERI_UART1, 21, 0, 0),
GATE(CLK_GOUT_PERI_UART2, "gout_peri_uart2", "mout_peri_uart2",
CLK_CON_GAT_GATE_CLKCMU_PERI_UART2, 21, 0, 0),
GATE(CLK_GOUT_PERI_USI0, "gout_peri_usi0", "mout_peri_usi0",
CLK_CON_GAT_GATE_CLKCMU_PERI_USI0, 21, 0, 0),
GATE(CLK_GOUT_PERI_USI1, "gout_peri_usi1", "mout_peri_usi1",
CLK_CON_GAT_GATE_CLKCMU_PERI_USI1, 21, 0, 0),
GATE(CLK_GOUT_PERI_USI2, "gout_peri_usi2", "mout_peri_usi2",
CLK_CON_GAT_GATE_CLKCMU_PERI_USI2, 21, 0, 0),
};
static const struct samsung_cmu_info top_cmu_info __initconst = {
.pll_clks = top_pll_clks,
.nr_pll_clks = ARRAY_SIZE(top_pll_clks),
.mux_clks = top_mux_clks,
.nr_mux_clks = ARRAY_SIZE(top_mux_clks),
.div_clks = top_div_clks,
.nr_div_clks = ARRAY_SIZE(top_div_clks),
.gate_clks = top_gate_clks,
.nr_gate_clks = ARRAY_SIZE(top_gate_clks),
.nr_clk_ids = TOP_NR_CLK,
.clk_regs = top_clk_regs,
.nr_clk_regs = ARRAY_SIZE(top_clk_regs),
};
static void __init exynos7885_cmu_top_init(struct device_node *np)
{
exynos_arm64_register_cmu(NULL, np, &top_cmu_info);
}
/* Register CMU_TOP early, as it's a dependency for other early domains */
CLK_OF_DECLARE(exynos7885_cmu_top, "samsung,exynos7885-cmu-top",
exynos7885_cmu_top_init);
/* ---- CMU_PERI ------------------------------------------------------------ */
/* Register Offset definitions for CMU_PERI (0x10010000) */
#define PLL_CON0_MUX_CLKCMU_PERI_BUS_USER 0x0100
#define PLL_CON0_MUX_CLKCMU_PERI_SPI0_USER 0x0120
#define PLL_CON0_MUX_CLKCMU_PERI_SPI1_USER 0x0140
#define PLL_CON0_MUX_CLKCMU_PERI_UART0_USER 0x0160
#define PLL_CON0_MUX_CLKCMU_PERI_UART1_USER 0x0180
#define PLL_CON0_MUX_CLKCMU_PERI_UART2_USER 0x01a0
#define PLL_CON0_MUX_CLKCMU_PERI_USI0_USER 0x01c0
#define PLL_CON0_MUX_CLKCMU_PERI_USI1_USER 0x01e0
#define PLL_CON0_MUX_CLKCMU_PERI_USI2_USER 0x0200
#define CLK_CON_GAT_GOUT_PERI_GPIO_TOP_PCLK 0x2024
#define CLK_CON_GAT_GOUT_PERI_HSI2C_0_PCLK 0x2028
#define CLK_CON_GAT_GOUT_PERI_HSI2C_1_PCLK 0x202c
#define CLK_CON_GAT_GOUT_PERI_HSI2C_2_PCLK 0x2030
#define CLK_CON_GAT_GOUT_PERI_HSI2C_3_PCLK 0x2034
#define CLK_CON_GAT_GOUT_PERI_I2C_0_PCLK 0x2038
#define CLK_CON_GAT_GOUT_PERI_I2C_1_PCLK 0x203c
#define CLK_CON_GAT_GOUT_PERI_I2C_2_PCLK 0x2040
#define CLK_CON_GAT_GOUT_PERI_I2C_3_PCLK 0x2044
#define CLK_CON_GAT_GOUT_PERI_I2C_4_PCLK 0x2048
#define CLK_CON_GAT_GOUT_PERI_I2C_5_PCLK 0x204c
#define CLK_CON_GAT_GOUT_PERI_I2C_6_PCLK 0x2050
#define CLK_CON_GAT_GOUT_PERI_I2C_7_PCLK 0x2054
#define CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK 0x2058
#define CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK 0x205c
#define CLK_CON_GAT_GOUT_PERI_SPI_0_EXT_CLK 0x2060
#define CLK_CON_GAT_GOUT_PERI_SPI_1_PCLK 0x2064
#define CLK_CON_GAT_GOUT_PERI_SPI_1_EXT_CLK 0x2068
#define CLK_CON_GAT_GOUT_PERI_UART_0_EXT_UCLK 0x206c
#define CLK_CON_GAT_GOUT_PERI_UART_0_PCLK 0x2070
#define CLK_CON_GAT_GOUT_PERI_UART_1_EXT_UCLK 0x2074
#define CLK_CON_GAT_GOUT_PERI_UART_1_PCLK 0x2078
#define CLK_CON_GAT_GOUT_PERI_UART_2_EXT_UCLK 0x207c
#define CLK_CON_GAT_GOUT_PERI_UART_2_PCLK 0x2080
#define CLK_CON_GAT_GOUT_PERI_USI0_PCLK 0x2084
#define CLK_CON_GAT_GOUT_PERI_USI0_SCLK 0x2088
#define CLK_CON_GAT_GOUT_PERI_USI1_PCLK 0x208c
#define CLK_CON_GAT_GOUT_PERI_USI1_SCLK 0x2090
#define CLK_CON_GAT_GOUT_PERI_USI2_PCLK 0x2094
#define CLK_CON_GAT_GOUT_PERI_USI2_SCLK 0x2098
#define CLK_CON_GAT_GOUT_PERI_MCT_PCLK 0x20a0
#define CLK_CON_GAT_GOUT_PERI_SYSREG_PERI_PCLK 0x20b0
#define CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER0_PCLK 0x20b4
#define CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER1_PCLK 0x20b8
static const unsigned long peri_clk_regs[] __initconst = {
PLL_CON0_MUX_CLKCMU_PERI_BUS_USER,
PLL_CON0_MUX_CLKCMU_PERI_SPI0_USER,
PLL_CON0_MUX_CLKCMU_PERI_SPI1_USER,
PLL_CON0_MUX_CLKCMU_PERI_UART0_USER,
PLL_CON0_MUX_CLKCMU_PERI_UART1_USER,
PLL_CON0_MUX_CLKCMU_PERI_UART2_USER,
PLL_CON0_MUX_CLKCMU_PERI_USI0_USER,
PLL_CON0_MUX_CLKCMU_PERI_USI1_USER,
PLL_CON0_MUX_CLKCMU_PERI_USI2_USER,
CLK_CON_GAT_GOUT_PERI_GPIO_TOP_PCLK,
CLK_CON_GAT_GOUT_PERI_HSI2C_0_PCLK,
CLK_CON_GAT_GOUT_PERI_HSI2C_1_PCLK,
CLK_CON_GAT_GOUT_PERI_HSI2C_2_PCLK,
CLK_CON_GAT_GOUT_PERI_HSI2C_3_PCLK,
CLK_CON_GAT_GOUT_PERI_I2C_0_PCLK,
CLK_CON_GAT_GOUT_PERI_I2C_1_PCLK,
CLK_CON_GAT_GOUT_PERI_I2C_2_PCLK,
CLK_CON_GAT_GOUT_PERI_I2C_3_PCLK,
CLK_CON_GAT_GOUT_PERI_I2C_4_PCLK,
CLK_CON_GAT_GOUT_PERI_I2C_5_PCLK,
CLK_CON_GAT_GOUT_PERI_I2C_6_PCLK,
CLK_CON_GAT_GOUT_PERI_I2C_7_PCLK,
CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK,
CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK,
CLK_CON_GAT_GOUT_PERI_SPI_0_EXT_CLK,
CLK_CON_GAT_GOUT_PERI_SPI_1_PCLK,
CLK_CON_GAT_GOUT_PERI_SPI_1_EXT_CLK,
CLK_CON_GAT_GOUT_PERI_UART_0_EXT_UCLK,
CLK_CON_GAT_GOUT_PERI_UART_0_PCLK,
CLK_CON_GAT_GOUT_PERI_UART_1_EXT_UCLK,
CLK_CON_GAT_GOUT_PERI_UART_1_PCLK,
CLK_CON_GAT_GOUT_PERI_UART_2_EXT_UCLK,
CLK_CON_GAT_GOUT_PERI_UART_2_PCLK,
CLK_CON_GAT_GOUT_PERI_USI0_PCLK,
CLK_CON_GAT_GOUT_PERI_USI0_SCLK,
CLK_CON_GAT_GOUT_PERI_USI1_PCLK,
CLK_CON_GAT_GOUT_PERI_USI1_SCLK,
CLK_CON_GAT_GOUT_PERI_USI2_PCLK,
CLK_CON_GAT_GOUT_PERI_USI2_SCLK,
CLK_CON_GAT_GOUT_PERI_MCT_PCLK,
CLK_CON_GAT_GOUT_PERI_SYSREG_PERI_PCLK,
CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER0_PCLK,
CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER1_PCLK,
};
/* List of parent clocks for Muxes in CMU_PERI */
PNAME(mout_peri_bus_user_p) = { "oscclk", "dout_peri_bus" };
PNAME(mout_peri_spi0_user_p) = { "oscclk", "dout_peri_spi0" };
PNAME(mout_peri_spi1_user_p) = { "oscclk", "dout_peri_spi1" };
PNAME(mout_peri_uart0_user_p) = { "oscclk", "dout_peri_uart0" };
PNAME(mout_peri_uart1_user_p) = { "oscclk", "dout_peri_uart1" };
PNAME(mout_peri_uart2_user_p) = { "oscclk", "dout_peri_uart2" };
PNAME(mout_peri_usi0_user_p) = { "oscclk", "dout_peri_usi0" };
PNAME(mout_peri_usi1_user_p) = { "oscclk", "dout_peri_usi1" };
PNAME(mout_peri_usi2_user_p) = { "oscclk", "dout_peri_usi2" };
static const struct samsung_mux_clock peri_mux_clks[] __initconst = {
MUX(CLK_MOUT_PERI_BUS_USER, "mout_peri_bus_user", mout_peri_bus_user_p,
PLL_CON0_MUX_CLKCMU_PERI_BUS_USER, 4, 1),
MUX(CLK_MOUT_PERI_SPI0_USER, "mout_peri_spi0_user", mout_peri_spi0_user_p,
PLL_CON0_MUX_CLKCMU_PERI_SPI0_USER, 4, 1),
MUX(CLK_MOUT_PERI_SPI1_USER, "mout_peri_spi1_user", mout_peri_spi1_user_p,
PLL_CON0_MUX_CLKCMU_PERI_SPI1_USER, 4, 1),
MUX(CLK_MOUT_PERI_UART0_USER, "mout_peri_uart0_user",
mout_peri_uart0_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART0_USER, 4, 1),
MUX(CLK_MOUT_PERI_UART1_USER, "mout_peri_uart1_user",
mout_peri_uart1_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART1_USER, 4, 1),
MUX(CLK_MOUT_PERI_UART2_USER, "mout_peri_uart2_user",
mout_peri_uart2_user_p, PLL_CON0_MUX_CLKCMU_PERI_UART2_USER, 4, 1),
MUX(CLK_MOUT_PERI_USI0_USER, "mout_peri_usi0_user",
mout_peri_usi0_user_p, PLL_CON0_MUX_CLKCMU_PERI_USI0_USER, 4, 1),
MUX(CLK_MOUT_PERI_USI1_USER, "mout_peri_usi1_user",
mout_peri_usi1_user_p, PLL_CON0_MUX_CLKCMU_PERI_USI1_USER, 4, 1),
MUX(CLK_MOUT_PERI_USI2_USER, "mout_peri_usi2_user",
mout_peri_usi2_user_p, PLL_CON0_MUX_CLKCMU_PERI_USI2_USER, 4, 1),
};
static const struct samsung_gate_clock peri_gate_clks[] __initconst = {
/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
GATE(CLK_GOUT_GPIO_TOP_PCLK, "gout_gpio_top_pclk",
"mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_GPIO_TOP_PCLK, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_HSI2C0_PCLK, "gout_hsi2c0_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_HSI2C_0_PCLK, 21, 0, 0),
GATE(CLK_GOUT_HSI2C1_PCLK, "gout_hsi2c1_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_HSI2C_1_PCLK, 21, 0, 0),
GATE(CLK_GOUT_HSI2C2_PCLK, "gout_hsi2c2_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_HSI2C_2_PCLK, 21, 0, 0),
GATE(CLK_GOUT_HSI2C3_PCLK, "gout_hsi2c3_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_HSI2C_3_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I2C0_PCLK, "gout_i2c0_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_I2C_0_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I2C1_PCLK, "gout_i2c1_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_I2C_1_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I2C2_PCLK, "gout_i2c2_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_I2C_2_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I2C3_PCLK, "gout_i2c3_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_I2C_3_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I2C4_PCLK, "gout_i2c4_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_I2C_4_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I2C5_PCLK, "gout_i2c5_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_I2C_5_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I2C6_PCLK, "gout_i2c6_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_I2C_6_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I2C7_PCLK, "gout_i2c7_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_I2C_7_PCLK, 21, 0, 0),
GATE(CLK_GOUT_PWM_MOTOR_PCLK, "gout_pwm_motor_pclk",
"mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_PWM_MOTOR_PCLK, 21, 0, 0),
GATE(CLK_GOUT_SPI0_PCLK, "gout_spi0_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_SPI_0_PCLK, 21, 0, 0),
GATE(CLK_GOUT_SPI0_EXT_CLK, "gout_spi0_ipclk", "mout_peri_spi0_user",
CLK_CON_GAT_GOUT_PERI_SPI_0_EXT_CLK, 21, 0, 0),
GATE(CLK_GOUT_SPI1_PCLK, "gout_spi1_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_SPI_1_PCLK, 21, 0, 0),
GATE(CLK_GOUT_SPI1_EXT_CLK, "gout_spi1_ipclk", "mout_peri_spi1_user",
CLK_CON_GAT_GOUT_PERI_SPI_1_EXT_CLK, 21, 0, 0),
GATE(CLK_GOUT_UART0_EXT_UCLK, "gout_uart0_ext_uclk", "mout_peri_uart0_user",
CLK_CON_GAT_GOUT_PERI_UART_0_EXT_UCLK, 21, 0, 0),
GATE(CLK_GOUT_UART0_PCLK, "gout_uart0_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_UART_0_PCLK, 21, 0, 0),
GATE(CLK_GOUT_UART1_EXT_UCLK, "gout_uart1_ext_uclk", "mout_peri_uart1_user",
CLK_CON_GAT_GOUT_PERI_UART_1_EXT_UCLK, 21, 0, 0),
GATE(CLK_GOUT_UART1_PCLK, "gout_uart1_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_UART_1_PCLK, 21, 0, 0),
GATE(CLK_GOUT_UART2_EXT_UCLK, "gout_uart2_ext_uclk", "mout_peri_uart2_user",
CLK_CON_GAT_GOUT_PERI_UART_2_EXT_UCLK, 21, 0, 0),
GATE(CLK_GOUT_UART2_PCLK, "gout_uart2_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_UART_2_PCLK, 21, 0, 0),
GATE(CLK_GOUT_USI0_PCLK, "gout_usi0_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_USI0_PCLK, 21, 0, 0),
GATE(CLK_GOUT_USI0_SCLK, "gout_usi0_sclk", "mout_peri_usi0_user",
CLK_CON_GAT_GOUT_PERI_USI0_SCLK, 21, 0, 0),
GATE(CLK_GOUT_USI1_PCLK, "gout_usi1_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_USI1_PCLK, 21, 0, 0),
GATE(CLK_GOUT_USI1_SCLK, "gout_usi1_sclk", "mout_peri_usi1_user",
CLK_CON_GAT_GOUT_PERI_USI1_SCLK, 21, 0, 0),
GATE(CLK_GOUT_USI2_PCLK, "gout_usi2_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_USI2_PCLK, 21, 0, 0),
GATE(CLK_GOUT_USI2_SCLK, "gout_usi2_sclk", "mout_peri_usi2_user",
CLK_CON_GAT_GOUT_PERI_USI2_SCLK, 21, 0, 0),
GATE(CLK_GOUT_MCT_PCLK, "gout_mct_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_MCT_PCLK, 21, 0, 0),
GATE(CLK_GOUT_SYSREG_PERI_PCLK, "gout_sysreg_peri_pclk",
"mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_SYSREG_PERI_PCLK, 21, 0, 0),
GATE(CLK_GOUT_WDT0_PCLK, "gout_wdt0_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER0_PCLK, 21, 0, 0),
GATE(CLK_GOUT_WDT1_PCLK, "gout_wdt1_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_WDT_CLUSTER1_PCLK, 21, 0, 0),
};
static const struct samsung_cmu_info peri_cmu_info __initconst = {
.mux_clks = peri_mux_clks,
.nr_mux_clks = ARRAY_SIZE(peri_mux_clks),
.gate_clks = peri_gate_clks,
.nr_gate_clks = ARRAY_SIZE(peri_gate_clks),
.nr_clk_ids = PERI_NR_CLK,
.clk_regs = peri_clk_regs,
.nr_clk_regs = ARRAY_SIZE(peri_clk_regs),
.clk_name = "dout_peri_bus",
};
static void __init exynos7885_cmu_peri_init(struct device_node *np)
{
exynos_arm64_register_cmu(NULL, np, &peri_cmu_info);
}
/* Register CMU_PERI early, as it's needed for MCT timer */
CLK_OF_DECLARE(exynos7885_cmu_peri, "samsung,exynos7885-cmu-peri",
exynos7885_cmu_peri_init);
/* ---- CMU_CORE ------------------------------------------------------------ */
/* Register Offset definitions for CMU_CORE (0x12000000) */
#define PLL_CON0_MUX_CLKCMU_CORE_BUS_USER 0x0100
#define PLL_CON0_MUX_CLKCMU_CORE_CCI_USER 0x0120
#define PLL_CON0_MUX_CLKCMU_CORE_G3D_USER 0x0140
#define CLK_CON_MUX_MUX_CLK_CORE_GIC 0x1000
#define CLK_CON_DIV_DIV_CLK_CORE_BUSP 0x1800
#define CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK 0x2054
#define CLK_CON_GAT_GOUT_CORE_GIC400_CLK 0x2058
static const unsigned long core_clk_regs[] __initconst = {
PLL_CON0_MUX_CLKCMU_CORE_BUS_USER,
PLL_CON0_MUX_CLKCMU_CORE_CCI_USER,
PLL_CON0_MUX_CLKCMU_CORE_G3D_USER,
CLK_CON_MUX_MUX_CLK_CORE_GIC,
CLK_CON_DIV_DIV_CLK_CORE_BUSP,
CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK,
CLK_CON_GAT_GOUT_CORE_GIC400_CLK,
};
/* List of parent clocks for Muxes in CMU_CORE */
PNAME(mout_core_bus_user_p) = { "oscclk", "dout_core_bus" };
PNAME(mout_core_cci_user_p) = { "oscclk", "dout_core_cci" };
PNAME(mout_core_g3d_user_p) = { "oscclk", "dout_core_g3d" };
PNAME(mout_core_gic_p) = { "dout_core_busp", "oscclk" };
static const struct samsung_mux_clock core_mux_clks[] __initconst = {
MUX(CLK_MOUT_CORE_BUS_USER, "mout_core_bus_user", mout_core_bus_user_p,
PLL_CON0_MUX_CLKCMU_CORE_BUS_USER, 4, 1),
MUX(CLK_MOUT_CORE_CCI_USER, "mout_core_cci_user", mout_core_cci_user_p,
PLL_CON0_MUX_CLKCMU_CORE_CCI_USER, 4, 1),
MUX(CLK_MOUT_CORE_G3D_USER, "mout_core_g3d_user", mout_core_g3d_user_p,
PLL_CON0_MUX_CLKCMU_CORE_G3D_USER, 4, 1),
MUX(CLK_MOUT_CORE_GIC, "mout_core_gic", mout_core_gic_p,
CLK_CON_MUX_MUX_CLK_CORE_GIC, 0, 1),
};
static const struct samsung_div_clock core_div_clks[] __initconst = {
DIV(CLK_DOUT_CORE_BUSP, "dout_core_busp", "mout_core_bus_user",
CLK_CON_DIV_DIV_CLK_CORE_BUSP, 0, 2),
};
static const struct samsung_gate_clock core_gate_clks[] __initconst = {
/* CCI (interconnect) clock must be always running */
GATE(CLK_GOUT_CCI_ACLK, "gout_cci_aclk", "mout_core_cci_user",
CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK, 21, CLK_IS_CRITICAL, 0),
/* GIC (interrupt controller) clock must be always running */
GATE(CLK_GOUT_GIC400_CLK, "gout_gic400_clk", "mout_core_gic",
CLK_CON_GAT_GOUT_CORE_GIC400_CLK, 21, CLK_IS_CRITICAL, 0),
};
static const struct samsung_cmu_info core_cmu_info __initconst = {
.mux_clks = core_mux_clks,
.nr_mux_clks = ARRAY_SIZE(core_mux_clks),
.div_clks = core_div_clks,
.nr_div_clks = ARRAY_SIZE(core_div_clks),
.gate_clks = core_gate_clks,
.nr_gate_clks = ARRAY_SIZE(core_gate_clks),
.nr_clk_ids = CORE_NR_CLK,
.clk_regs = core_clk_regs,
.nr_clk_regs = ARRAY_SIZE(core_clk_regs),
.clk_name = "dout_core_bus",
};
/* ---- platform_driver ----------------------------------------------------- */
static int __init exynos7885_cmu_probe(struct platform_device *pdev)
{
const struct samsung_cmu_info *info;
struct device *dev = &pdev->dev;
info = of_device_get_match_data(dev);
exynos_arm64_register_cmu(dev, dev->of_node, info);
return 0;
}
static const struct of_device_id exynos7885_cmu_of_match[] = {
{
.compatible = "samsung,exynos7885-cmu-core",
.data = &core_cmu_info,
}, {
},
};
static struct platform_driver exynos7885_cmu_driver __refdata = {
.driver = {
.name = "exynos7885-cmu",
.of_match_table = exynos7885_cmu_of_match,
.suppress_bind_attrs = true,
},
.probe = exynos7885_cmu_probe,
};
static int __init exynos7885_cmu_init(void)
{
return platform_driver_register(&exynos7885_cmu_driver);
}
core_initcall(exynos7885_cmu_init);

View File

@ -9,56 +9,13 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <dt-bindings/clock/exynos850.h> #include <dt-bindings/clock/exynos850.h>
#include "clk.h" #include "clk.h"
#include "clk-exynos-arm64.h"
/* Gate register bits */
#define GATE_MANUAL BIT(20)
#define GATE_ENABLE_HWACG BIT(28)
/* Gate register offsets range */
#define GATE_OFF_START 0x2000
#define GATE_OFF_END 0x2fff
/**
* exynos850_init_clocks - Set clocks initial configuration
* @np: CMU device tree node with "reg" property (CMU addr)
* @reg_offs: Register offsets array for clocks to init
* @reg_offs_len: Number of register offsets in reg_offs array
*
* Set manual control mode for all gate clocks.
*/
static void __init exynos850_init_clocks(struct device_node *np,
const unsigned long *reg_offs, size_t reg_offs_len)
{
void __iomem *reg_base;
size_t i;
reg_base = of_iomap(np, 0);
if (!reg_base)
panic("%s: failed to map registers\n", __func__);
for (i = 0; i < reg_offs_len; ++i) {
void __iomem *reg = reg_base + reg_offs[i];
u32 val;
/* Modify only gate clock registers */
if (reg_offs[i] < GATE_OFF_START || reg_offs[i] > GATE_OFF_END)
continue;
val = readl(reg);
val |= GATE_MANUAL;
val &= ~GATE_ENABLE_HWACG;
writel(val, reg);
}
iounmap(reg_base);
}
/* ---- CMU_TOP ------------------------------------------------------------- */ /* ---- CMU_TOP ------------------------------------------------------------- */
@ -72,6 +29,7 @@ static void __init exynos850_init_clocks(struct device_node *np,
#define PLL_CON3_PLL_SHARED0 0x014c #define PLL_CON3_PLL_SHARED0 0x014c
#define PLL_CON0_PLL_SHARED1 0x0180 #define PLL_CON0_PLL_SHARED1 0x0180
#define PLL_CON3_PLL_SHARED1 0x018c #define PLL_CON3_PLL_SHARED1 0x018c
#define CLK_CON_MUX_MUX_CLKCMU_APM_BUS 0x1000
#define CLK_CON_MUX_MUX_CLKCMU_CORE_BUS 0x1014 #define CLK_CON_MUX_MUX_CLKCMU_CORE_BUS 0x1014
#define CLK_CON_MUX_MUX_CLKCMU_CORE_CCI 0x1018 #define CLK_CON_MUX_MUX_CLKCMU_CORE_CCI 0x1018
#define CLK_CON_MUX_MUX_CLKCMU_CORE_MMC_EMBD 0x101c #define CLK_CON_MUX_MUX_CLKCMU_CORE_MMC_EMBD 0x101c
@ -83,6 +41,7 @@ static void __init exynos850_init_clocks(struct device_node *np,
#define CLK_CON_MUX_MUX_CLKCMU_PERI_BUS 0x1070 #define CLK_CON_MUX_MUX_CLKCMU_PERI_BUS 0x1070
#define CLK_CON_MUX_MUX_CLKCMU_PERI_IP 0x1074 #define CLK_CON_MUX_MUX_CLKCMU_PERI_IP 0x1074
#define CLK_CON_MUX_MUX_CLKCMU_PERI_UART 0x1078 #define CLK_CON_MUX_MUX_CLKCMU_PERI_UART 0x1078
#define CLK_CON_DIV_CLKCMU_APM_BUS 0x180c
#define CLK_CON_DIV_CLKCMU_CORE_BUS 0x1820 #define CLK_CON_DIV_CLKCMU_CORE_BUS 0x1820
#define CLK_CON_DIV_CLKCMU_CORE_CCI 0x1824 #define CLK_CON_DIV_CLKCMU_CORE_CCI 0x1824
#define CLK_CON_DIV_CLKCMU_CORE_MMC_EMBD 0x1828 #define CLK_CON_DIV_CLKCMU_CORE_MMC_EMBD 0x1828
@ -100,6 +59,7 @@ static void __init exynos850_init_clocks(struct device_node *np,
#define CLK_CON_DIV_PLL_SHARED1_DIV2 0x1898 #define CLK_CON_DIV_PLL_SHARED1_DIV2 0x1898
#define CLK_CON_DIV_PLL_SHARED1_DIV3 0x189c #define CLK_CON_DIV_PLL_SHARED1_DIV3 0x189c
#define CLK_CON_DIV_PLL_SHARED1_DIV4 0x18a0 #define CLK_CON_DIV_PLL_SHARED1_DIV4 0x18a0
#define CLK_CON_GAT_GATE_CLKCMU_APM_BUS 0x2008
#define CLK_CON_GAT_GATE_CLKCMU_CORE_BUS 0x201c #define CLK_CON_GAT_GATE_CLKCMU_CORE_BUS 0x201c
#define CLK_CON_GAT_GATE_CLKCMU_CORE_CCI 0x2020 #define CLK_CON_GAT_GATE_CLKCMU_CORE_CCI 0x2020
#define CLK_CON_GAT_GATE_CLKCMU_CORE_MMC_EMBD 0x2024 #define CLK_CON_GAT_GATE_CLKCMU_CORE_MMC_EMBD 0x2024
@ -122,6 +82,7 @@ static const unsigned long top_clk_regs[] __initconst = {
PLL_CON3_PLL_SHARED0, PLL_CON3_PLL_SHARED0,
PLL_CON0_PLL_SHARED1, PLL_CON0_PLL_SHARED1,
PLL_CON3_PLL_SHARED1, PLL_CON3_PLL_SHARED1,
CLK_CON_MUX_MUX_CLKCMU_APM_BUS,
CLK_CON_MUX_MUX_CLKCMU_CORE_BUS, CLK_CON_MUX_MUX_CLKCMU_CORE_BUS,
CLK_CON_MUX_MUX_CLKCMU_CORE_CCI, CLK_CON_MUX_MUX_CLKCMU_CORE_CCI,
CLK_CON_MUX_MUX_CLKCMU_CORE_MMC_EMBD, CLK_CON_MUX_MUX_CLKCMU_CORE_MMC_EMBD,
@ -133,6 +94,7 @@ static const unsigned long top_clk_regs[] __initconst = {
CLK_CON_MUX_MUX_CLKCMU_PERI_BUS, CLK_CON_MUX_MUX_CLKCMU_PERI_BUS,
CLK_CON_MUX_MUX_CLKCMU_PERI_IP, CLK_CON_MUX_MUX_CLKCMU_PERI_IP,
CLK_CON_MUX_MUX_CLKCMU_PERI_UART, CLK_CON_MUX_MUX_CLKCMU_PERI_UART,
CLK_CON_DIV_CLKCMU_APM_BUS,
CLK_CON_DIV_CLKCMU_CORE_BUS, CLK_CON_DIV_CLKCMU_CORE_BUS,
CLK_CON_DIV_CLKCMU_CORE_CCI, CLK_CON_DIV_CLKCMU_CORE_CCI,
CLK_CON_DIV_CLKCMU_CORE_MMC_EMBD, CLK_CON_DIV_CLKCMU_CORE_MMC_EMBD,
@ -150,6 +112,7 @@ static const unsigned long top_clk_regs[] __initconst = {
CLK_CON_DIV_PLL_SHARED1_DIV2, CLK_CON_DIV_PLL_SHARED1_DIV2,
CLK_CON_DIV_PLL_SHARED1_DIV3, CLK_CON_DIV_PLL_SHARED1_DIV3,
CLK_CON_DIV_PLL_SHARED1_DIV4, CLK_CON_DIV_PLL_SHARED1_DIV4,
CLK_CON_GAT_GATE_CLKCMU_APM_BUS,
CLK_CON_GAT_GATE_CLKCMU_CORE_BUS, CLK_CON_GAT_GATE_CLKCMU_CORE_BUS,
CLK_CON_GAT_GATE_CLKCMU_CORE_CCI, CLK_CON_GAT_GATE_CLKCMU_CORE_CCI,
CLK_CON_GAT_GATE_CLKCMU_CORE_MMC_EMBD, CLK_CON_GAT_GATE_CLKCMU_CORE_MMC_EMBD,
@ -183,6 +146,8 @@ static const struct samsung_pll_clock top_pll_clks[] __initconst = {
PNAME(mout_shared0_pll_p) = { "oscclk", "fout_shared0_pll" }; PNAME(mout_shared0_pll_p) = { "oscclk", "fout_shared0_pll" };
PNAME(mout_shared1_pll_p) = { "oscclk", "fout_shared1_pll" }; PNAME(mout_shared1_pll_p) = { "oscclk", "fout_shared1_pll" };
PNAME(mout_mmc_pll_p) = { "oscclk", "fout_mmc_pll" }; PNAME(mout_mmc_pll_p) = { "oscclk", "fout_mmc_pll" };
/* List of parent clocks for Muxes in CMU_TOP: for CMU_APM */
PNAME(mout_clkcmu_apm_bus_p) = { "dout_shared0_div4", "pll_shared1_div4" };
/* List of parent clocks for Muxes in CMU_TOP: for CMU_CORE */ /* List of parent clocks for Muxes in CMU_TOP: for CMU_CORE */
PNAME(mout_core_bus_p) = { "dout_shared1_div2", "dout_shared0_div3", PNAME(mout_core_bus_p) = { "dout_shared1_div2", "dout_shared0_div3",
"dout_shared1_div3", "dout_shared0_div4" }; "dout_shared1_div3", "dout_shared0_div4" };
@ -222,6 +187,10 @@ static const struct samsung_mux_clock top_mux_clks[] __initconst = {
MUX(CLK_MOUT_MMC_PLL, "mout_mmc_pll", mout_mmc_pll_p, MUX(CLK_MOUT_MMC_PLL, "mout_mmc_pll", mout_mmc_pll_p,
PLL_CON0_PLL_MMC, 4, 1), PLL_CON0_PLL_MMC, 4, 1),
/* APM */
MUX(CLK_MOUT_CLKCMU_APM_BUS, "mout_clkcmu_apm_bus",
mout_clkcmu_apm_bus_p, CLK_CON_MUX_MUX_CLKCMU_APM_BUS, 0, 1),
/* CORE */ /* CORE */
MUX(CLK_MOUT_CORE_BUS, "mout_core_bus", mout_core_bus_p, MUX(CLK_MOUT_CORE_BUS, "mout_core_bus", mout_core_bus_p,
CLK_CON_MUX_MUX_CLKCMU_CORE_BUS, 0, 2), CLK_CON_MUX_MUX_CLKCMU_CORE_BUS, 0, 2),
@ -268,6 +237,10 @@ static const struct samsung_div_clock top_div_clks[] __initconst = {
DIV(CLK_DOUT_SHARED1_DIV4, "dout_shared1_div4", "dout_shared1_div2", DIV(CLK_DOUT_SHARED1_DIV4, "dout_shared1_div4", "dout_shared1_div2",
CLK_CON_DIV_PLL_SHARED1_DIV4, 0, 1), CLK_CON_DIV_PLL_SHARED1_DIV4, 0, 1),
/* APM */
DIV(CLK_DOUT_CLKCMU_APM_BUS, "dout_clkcmu_apm_bus",
"gout_clkcmu_apm_bus", CLK_CON_DIV_CLKCMU_APM_BUS, 0, 3),
/* CORE */ /* CORE */
DIV(CLK_DOUT_CORE_BUS, "dout_core_bus", "gout_core_bus", DIV(CLK_DOUT_CORE_BUS, "dout_core_bus", "gout_core_bus",
CLK_CON_DIV_CLKCMU_CORE_BUS, 0, 4), CLK_CON_DIV_CLKCMU_CORE_BUS, 0, 4),
@ -310,6 +283,10 @@ static const struct samsung_gate_clock top_gate_clks[] __initconst = {
GATE(CLK_GOUT_CORE_SSS, "gout_core_sss", "mout_core_sss", GATE(CLK_GOUT_CORE_SSS, "gout_core_sss", "mout_core_sss",
CLK_CON_GAT_GATE_CLKCMU_CORE_SSS, 21, 0, 0), CLK_CON_GAT_GATE_CLKCMU_CORE_SSS, 21, 0, 0),
/* APM */
GATE(CLK_GOUT_CLKCMU_APM_BUS, "gout_clkcmu_apm_bus",
"mout_clkcmu_apm_bus", CLK_CON_GAT_GATE_CLKCMU_APM_BUS, 21, 0, 0),
/* DPU */ /* DPU */
GATE(CLK_GOUT_DPU, "gout_dpu", "mout_dpu", GATE(CLK_GOUT_DPU, "gout_dpu", "mout_dpu",
CLK_CON_GAT_GATE_CLKCMU_DPU, 21, 0, 0), CLK_CON_GAT_GATE_CLKCMU_DPU, 21, 0, 0),
@ -347,13 +324,248 @@ static const struct samsung_cmu_info top_cmu_info __initconst = {
static void __init exynos850_cmu_top_init(struct device_node *np) static void __init exynos850_cmu_top_init(struct device_node *np)
{ {
exynos850_init_clocks(np, top_clk_regs, ARRAY_SIZE(top_clk_regs)); exynos_arm64_register_cmu(NULL, np, &top_cmu_info);
samsung_cmu_register_one(np, &top_cmu_info);
} }
/* Register CMU_TOP early, as it's a dependency for other early domains */
CLK_OF_DECLARE(exynos850_cmu_top, "samsung,exynos850-cmu-top", CLK_OF_DECLARE(exynos850_cmu_top, "samsung,exynos850-cmu-top",
exynos850_cmu_top_init); exynos850_cmu_top_init);
/* ---- CMU_APM ------------------------------------------------------------- */
/* Register Offset definitions for CMU_APM (0x11800000) */
#define PLL_CON0_MUX_CLKCMU_APM_BUS_USER 0x0600
#define PLL_CON0_MUX_CLK_RCO_APM_I3C_USER 0x0610
#define PLL_CON0_MUX_CLK_RCO_APM_USER 0x0620
#define PLL_CON0_MUX_DLL_USER 0x0630
#define CLK_CON_MUX_MUX_CLKCMU_CHUB_BUS 0x1000
#define CLK_CON_MUX_MUX_CLK_APM_BUS 0x1004
#define CLK_CON_MUX_MUX_CLK_APM_I3C 0x1008
#define CLK_CON_DIV_CLKCMU_CHUB_BUS 0x1800
#define CLK_CON_DIV_DIV_CLK_APM_BUS 0x1804
#define CLK_CON_DIV_DIV_CLK_APM_I3C 0x1808
#define CLK_CON_GAT_CLKCMU_CMGP_BUS 0x2000
#define CLK_CON_GAT_GATE_CLKCMU_CHUB_BUS 0x2014
#define CLK_CON_GAT_GOUT_APM_APBIF_GPIO_ALIVE_PCLK 0x2018
#define CLK_CON_GAT_GOUT_APM_APBIF_PMU_ALIVE_PCLK 0x2020
#define CLK_CON_GAT_GOUT_APM_APBIF_RTC_PCLK 0x2024
#define CLK_CON_GAT_GOUT_APM_APBIF_TOP_RTC_PCLK 0x2028
#define CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_PCLK 0x2034
#define CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_SCLK 0x2038
#define CLK_CON_GAT_GOUT_APM_SPEEDY_APM_PCLK 0x20bc
#define CLK_CON_GAT_GOUT_APM_SYSREG_APM_PCLK 0x20c0
static const unsigned long apm_clk_regs[] __initconst = {
PLL_CON0_MUX_CLKCMU_APM_BUS_USER,
PLL_CON0_MUX_CLK_RCO_APM_I3C_USER,
PLL_CON0_MUX_CLK_RCO_APM_USER,
PLL_CON0_MUX_DLL_USER,
CLK_CON_MUX_MUX_CLKCMU_CHUB_BUS,
CLK_CON_MUX_MUX_CLK_APM_BUS,
CLK_CON_MUX_MUX_CLK_APM_I3C,
CLK_CON_DIV_CLKCMU_CHUB_BUS,
CLK_CON_DIV_DIV_CLK_APM_BUS,
CLK_CON_DIV_DIV_CLK_APM_I3C,
CLK_CON_GAT_CLKCMU_CMGP_BUS,
CLK_CON_GAT_GATE_CLKCMU_CHUB_BUS,
CLK_CON_GAT_GOUT_APM_APBIF_GPIO_ALIVE_PCLK,
CLK_CON_GAT_GOUT_APM_APBIF_PMU_ALIVE_PCLK,
CLK_CON_GAT_GOUT_APM_APBIF_RTC_PCLK,
CLK_CON_GAT_GOUT_APM_APBIF_TOP_RTC_PCLK,
CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_PCLK,
CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_SCLK,
CLK_CON_GAT_GOUT_APM_SPEEDY_APM_PCLK,
CLK_CON_GAT_GOUT_APM_SYSREG_APM_PCLK,
};
/* List of parent clocks for Muxes in CMU_APM */
PNAME(mout_apm_bus_user_p) = { "oscclk_rco_apm", "dout_clkcmu_apm_bus" };
PNAME(mout_rco_apm_i3c_user_p) = { "oscclk_rco_apm", "clk_rco_i3c_pmic" };
PNAME(mout_rco_apm_user_p) = { "oscclk_rco_apm", "clk_rco_apm__alv" };
PNAME(mout_dll_user_p) = { "oscclk_rco_apm", "clk_dll_dco" };
PNAME(mout_clkcmu_chub_bus_p) = { "mout_apm_bus_user", "mout_dll_user" };
PNAME(mout_apm_bus_p) = { "mout_rco_apm_user", "mout_apm_bus_user",
"mout_dll_user", "oscclk_rco_apm" };
PNAME(mout_apm_i3c_p) = { "dout_apm_i3c", "mout_rco_apm_i3c_user" };
static const struct samsung_fixed_rate_clock apm_fixed_clks[] __initconst = {
FRATE(CLK_RCO_I3C_PMIC, "clk_rco_i3c_pmic", NULL, 0, 491520000),
FRATE(OSCCLK_RCO_APM, "oscclk_rco_apm", NULL, 0, 24576000),
FRATE(CLK_RCO_APM__ALV, "clk_rco_apm__alv", NULL, 0, 49152000),
FRATE(CLK_DLL_DCO, "clk_dll_dco", NULL, 0, 360000000),
};
static const struct samsung_mux_clock apm_mux_clks[] __initconst = {
MUX(CLK_MOUT_APM_BUS_USER, "mout_apm_bus_user", mout_apm_bus_user_p,
PLL_CON0_MUX_CLKCMU_APM_BUS_USER, 4, 1),
MUX(CLK_MOUT_RCO_APM_I3C_USER, "mout_rco_apm_i3c_user",
mout_rco_apm_i3c_user_p, PLL_CON0_MUX_CLK_RCO_APM_I3C_USER, 4, 1),
MUX(CLK_MOUT_RCO_APM_USER, "mout_rco_apm_user", mout_rco_apm_user_p,
PLL_CON0_MUX_CLK_RCO_APM_USER, 4, 1),
MUX(CLK_MOUT_DLL_USER, "mout_dll_user", mout_dll_user_p,
PLL_CON0_MUX_DLL_USER, 4, 1),
MUX(CLK_MOUT_CLKCMU_CHUB_BUS, "mout_clkcmu_chub_bus",
mout_clkcmu_chub_bus_p, CLK_CON_MUX_MUX_CLKCMU_CHUB_BUS, 0, 1),
MUX(CLK_MOUT_APM_BUS, "mout_apm_bus", mout_apm_bus_p,
CLK_CON_MUX_MUX_CLK_APM_BUS, 0, 2),
MUX(CLK_MOUT_APM_I3C, "mout_apm_i3c", mout_apm_i3c_p,
CLK_CON_MUX_MUX_CLK_APM_I3C, 0, 1),
};
static const struct samsung_div_clock apm_div_clks[] __initconst = {
DIV(CLK_DOUT_CLKCMU_CHUB_BUS, "dout_clkcmu_chub_bus",
"gout_clkcmu_chub_bus",
CLK_CON_DIV_CLKCMU_CHUB_BUS, 0, 3),
DIV(CLK_DOUT_APM_BUS, "dout_apm_bus", "mout_apm_bus",
CLK_CON_DIV_DIV_CLK_APM_BUS, 0, 3),
DIV(CLK_DOUT_APM_I3C, "dout_apm_i3c", "mout_apm_bus",
CLK_CON_DIV_DIV_CLK_APM_I3C, 0, 3),
};
static const struct samsung_gate_clock apm_gate_clks[] __initconst = {
GATE(CLK_GOUT_CLKCMU_CMGP_BUS, "gout_clkcmu_cmgp_bus", "dout_apm_bus",
CLK_CON_GAT_CLKCMU_CMGP_BUS, 21, 0, 0),
GATE(CLK_GOUT_CLKCMU_CHUB_BUS, "gout_clkcmu_chub_bus",
"mout_clkcmu_chub_bus",
CLK_CON_GAT_GATE_CLKCMU_CHUB_BUS, 21, 0, 0),
GATE(CLK_GOUT_RTC_PCLK, "gout_rtc_pclk", "dout_apm_bus",
CLK_CON_GAT_GOUT_APM_APBIF_RTC_PCLK, 21, 0, 0),
GATE(CLK_GOUT_TOP_RTC_PCLK, "gout_top_rtc_pclk", "dout_apm_bus",
CLK_CON_GAT_GOUT_APM_APBIF_TOP_RTC_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I3C_PCLK, "gout_i3c_pclk", "dout_apm_bus",
CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_PCLK, 21, 0, 0),
GATE(CLK_GOUT_I3C_SCLK, "gout_i3c_sclk", "mout_apm_i3c",
CLK_CON_GAT_GOUT_APM_I3C_APM_PMIC_I_SCLK, 21, 0, 0),
GATE(CLK_GOUT_SPEEDY_PCLK, "gout_speedy_pclk", "dout_apm_bus",
CLK_CON_GAT_GOUT_APM_SPEEDY_APM_PCLK, 21, 0, 0),
/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
GATE(CLK_GOUT_GPIO_ALIVE_PCLK, "gout_gpio_alive_pclk", "dout_apm_bus",
CLK_CON_GAT_GOUT_APM_APBIF_GPIO_ALIVE_PCLK, 21, CLK_IGNORE_UNUSED,
0),
GATE(CLK_GOUT_PMU_ALIVE_PCLK, "gout_pmu_alive_pclk", "dout_apm_bus",
CLK_CON_GAT_GOUT_APM_APBIF_PMU_ALIVE_PCLK, 21, 0, 0),
GATE(CLK_GOUT_SYSREG_APM_PCLK, "gout_sysreg_apm_pclk", "dout_apm_bus",
CLK_CON_GAT_GOUT_APM_SYSREG_APM_PCLK, 21, 0, 0),
};
static const struct samsung_cmu_info apm_cmu_info __initconst = {
.mux_clks = apm_mux_clks,
.nr_mux_clks = ARRAY_SIZE(apm_mux_clks),
.div_clks = apm_div_clks,
.nr_div_clks = ARRAY_SIZE(apm_div_clks),
.gate_clks = apm_gate_clks,
.nr_gate_clks = ARRAY_SIZE(apm_gate_clks),
.fixed_clks = apm_fixed_clks,
.nr_fixed_clks = ARRAY_SIZE(apm_fixed_clks),
.nr_clk_ids = APM_NR_CLK,
.clk_regs = apm_clk_regs,
.nr_clk_regs = ARRAY_SIZE(apm_clk_regs),
.clk_name = "dout_clkcmu_apm_bus",
};
/* ---- CMU_CMGP ------------------------------------------------------------ */
/* Register Offset definitions for CMU_CMGP (0x11c00000) */
#define CLK_CON_MUX_CLK_CMGP_ADC 0x1000
#define CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0 0x1004
#define CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1 0x1008
#define CLK_CON_DIV_DIV_CLK_CMGP_ADC 0x1800
#define CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0 0x1804
#define CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1 0x1808
#define CLK_CON_GAT_GOUT_CMGP_ADC_PCLK_S0 0x200c
#define CLK_CON_GAT_GOUT_CMGP_ADC_PCLK_S1 0x2010
#define CLK_CON_GAT_GOUT_CMGP_GPIO_PCLK 0x2018
#define CLK_CON_GAT_GOUT_CMGP_SYSREG_CMGP_PCLK 0x2040
#define CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK 0x2044
#define CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_PCLK 0x2048
#define CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK 0x204c
#define CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_PCLK 0x2050
static const unsigned long cmgp_clk_regs[] __initconst = {
CLK_CON_MUX_CLK_CMGP_ADC,
CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0,
CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1,
CLK_CON_DIV_DIV_CLK_CMGP_ADC,
CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0,
CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1,
CLK_CON_GAT_GOUT_CMGP_ADC_PCLK_S0,
CLK_CON_GAT_GOUT_CMGP_ADC_PCLK_S1,
CLK_CON_GAT_GOUT_CMGP_GPIO_PCLK,
CLK_CON_GAT_GOUT_CMGP_SYSREG_CMGP_PCLK,
CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK,
CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_PCLK,
CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK,
CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_PCLK,
};
/* List of parent clocks for Muxes in CMU_CMGP */
PNAME(mout_cmgp_usi0_p) = { "clk_rco_cmgp", "gout_clkcmu_cmgp_bus" };
PNAME(mout_cmgp_usi1_p) = { "clk_rco_cmgp", "gout_clkcmu_cmgp_bus" };
PNAME(mout_cmgp_adc_p) = { "oscclk", "dout_cmgp_adc" };
static const struct samsung_fixed_rate_clock cmgp_fixed_clks[] __initconst = {
FRATE(CLK_RCO_CMGP, "clk_rco_cmgp", NULL, 0, 49152000),
};
static const struct samsung_mux_clock cmgp_mux_clks[] __initconst = {
MUX(CLK_MOUT_CMGP_ADC, "mout_cmgp_adc", mout_cmgp_adc_p,
CLK_CON_MUX_CLK_CMGP_ADC, 0, 1),
MUX(CLK_MOUT_CMGP_USI0, "mout_cmgp_usi0", mout_cmgp_usi0_p,
CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP0, 0, 1),
MUX(CLK_MOUT_CMGP_USI1, "mout_cmgp_usi1", mout_cmgp_usi1_p,
CLK_CON_MUX_MUX_CLK_CMGP_USI_CMGP1, 0, 1),
};
static const struct samsung_div_clock cmgp_div_clks[] __initconst = {
DIV(CLK_DOUT_CMGP_ADC, "dout_cmgp_adc", "gout_clkcmu_cmgp_bus",
CLK_CON_DIV_DIV_CLK_CMGP_ADC, 0, 4),
DIV(CLK_DOUT_CMGP_USI0, "dout_cmgp_usi0", "mout_cmgp_usi0",
CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP0, 0, 5),
DIV(CLK_DOUT_CMGP_USI1, "dout_cmgp_usi1", "mout_cmgp_usi1",
CLK_CON_DIV_DIV_CLK_CMGP_USI_CMGP1, 0, 5),
};
static const struct samsung_gate_clock cmgp_gate_clks[] __initconst = {
GATE(CLK_GOUT_CMGP_ADC_S0_PCLK, "gout_adc_s0_pclk",
"gout_clkcmu_cmgp_bus",
CLK_CON_GAT_GOUT_CMGP_ADC_PCLK_S0, 21, 0, 0),
GATE(CLK_GOUT_CMGP_ADC_S1_PCLK, "gout_adc_s1_pclk",
"gout_clkcmu_cmgp_bus",
CLK_CON_GAT_GOUT_CMGP_ADC_PCLK_S1, 21, 0, 0),
/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
GATE(CLK_GOUT_CMGP_GPIO_PCLK, "gout_gpio_cmgp_pclk",
"gout_clkcmu_cmgp_bus",
CLK_CON_GAT_GOUT_CMGP_GPIO_PCLK, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_CMGP_USI0_IPCLK, "gout_cmgp_usi0_ipclk", "dout_cmgp_usi0",
CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_IPCLK, 21, 0, 0),
GATE(CLK_GOUT_CMGP_USI0_PCLK, "gout_cmgp_usi0_pclk",
"gout_clkcmu_cmgp_bus",
CLK_CON_GAT_GOUT_CMGP_USI_CMGP0_PCLK, 21, 0, 0),
GATE(CLK_GOUT_CMGP_USI1_IPCLK, "gout_cmgp_usi1_ipclk", "dout_cmgp_usi1",
CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_IPCLK, 21, 0, 0),
GATE(CLK_GOUT_CMGP_USI1_PCLK, "gout_cmgp_usi1_pclk",
"gout_clkcmu_cmgp_bus",
CLK_CON_GAT_GOUT_CMGP_USI_CMGP1_PCLK, 21, 0, 0),
GATE(CLK_GOUT_SYSREG_CMGP_PCLK, "gout_sysreg_cmgp_pclk",
"gout_clkcmu_cmgp_bus",
CLK_CON_GAT_GOUT_CMGP_SYSREG_CMGP_PCLK, 21, 0, 0),
};
static const struct samsung_cmu_info cmgp_cmu_info __initconst = {
.mux_clks = cmgp_mux_clks,
.nr_mux_clks = ARRAY_SIZE(cmgp_mux_clks),
.div_clks = cmgp_div_clks,
.nr_div_clks = ARRAY_SIZE(cmgp_div_clks),
.gate_clks = cmgp_gate_clks,
.nr_gate_clks = ARRAY_SIZE(cmgp_gate_clks),
.fixed_clks = cmgp_fixed_clks,
.nr_fixed_clks = ARRAY_SIZE(cmgp_fixed_clks),
.nr_clk_ids = CMGP_NR_CLK,
.clk_regs = cmgp_clk_regs,
.nr_clk_regs = ARRAY_SIZE(cmgp_clk_regs),
.clk_name = "gout_clkcmu_cmgp_bus",
};
/* ---- CMU_HSI ------------------------------------------------------------- */ /* ---- CMU_HSI ------------------------------------------------------------- */
/* Register Offset definitions for CMU_HSI (0x13400000) */ /* Register Offset definitions for CMU_HSI (0x13400000) */
@ -413,8 +625,9 @@ static const struct samsung_gate_clock hsi_gate_clks[] __initconst = {
CLK_CON_GAT_HSI_USB20DRD_TOP_I_REF_CLK_50, 21, 0, 0), CLK_CON_GAT_HSI_USB20DRD_TOP_I_REF_CLK_50, 21, 0, 0),
GATE(CLK_GOUT_USB_PHY_REF_CLK, "gout_usb_phy_ref", "oscclk", GATE(CLK_GOUT_USB_PHY_REF_CLK, "gout_usb_phy_ref", "oscclk",
CLK_CON_GAT_HSI_USB20DRD_TOP_I_PHY_REFCLK_26, 21, 0, 0), CLK_CON_GAT_HSI_USB20DRD_TOP_I_PHY_REFCLK_26, 21, 0, 0),
/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
GATE(CLK_GOUT_GPIO_HSI_PCLK, "gout_gpio_hsi_pclk", "mout_hsi_bus_user", GATE(CLK_GOUT_GPIO_HSI_PCLK, "gout_gpio_hsi_pclk", "mout_hsi_bus_user",
CLK_CON_GAT_GOUT_HSI_GPIO_HSI_PCLK, 21, 0, 0), CLK_CON_GAT_GOUT_HSI_GPIO_HSI_PCLK, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_MMC_CARD_ACLK, "gout_mmc_card_aclk", "mout_hsi_bus_user", GATE(CLK_GOUT_MMC_CARD_ACLK, "gout_mmc_card_aclk", "mout_hsi_bus_user",
CLK_CON_GAT_GOUT_HSI_MMC_CARD_I_ACLK, 21, 0, 0), CLK_CON_GAT_GOUT_HSI_MMC_CARD_I_ACLK, 21, 0, 0),
GATE(CLK_GOUT_MMC_CARD_SDCLKIN, "gout_mmc_card_sdclkin", GATE(CLK_GOUT_MMC_CARD_SDCLKIN, "gout_mmc_card_sdclkin",
@ -597,9 +810,10 @@ static const struct samsung_gate_clock peri_gate_clks[] __initconst = {
CLK_CON_GAT_GOUT_PERI_WDT_0_PCLK, 21, 0, 0), CLK_CON_GAT_GOUT_PERI_WDT_0_PCLK, 21, 0, 0),
GATE(CLK_GOUT_WDT1_PCLK, "gout_wdt1_pclk", "mout_peri_bus_user", GATE(CLK_GOUT_WDT1_PCLK, "gout_wdt1_pclk", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_WDT_1_PCLK, 21, 0, 0), CLK_CON_GAT_GOUT_PERI_WDT_1_PCLK, 21, 0, 0),
/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
GATE(CLK_GOUT_GPIO_PERI_PCLK, "gout_gpio_peri_pclk", GATE(CLK_GOUT_GPIO_PERI_PCLK, "gout_gpio_peri_pclk",
"mout_peri_bus_user", "mout_peri_bus_user",
CLK_CON_GAT_GOUT_PERI_GPIO_PERI_PCLK, 21, 0, 0), CLK_CON_GAT_GOUT_PERI_GPIO_PERI_PCLK, 21, CLK_IGNORE_UNUSED, 0),
}; };
static const struct samsung_cmu_info peri_cmu_info __initconst = { static const struct samsung_cmu_info peri_cmu_info __initconst = {
@ -615,6 +829,15 @@ static const struct samsung_cmu_info peri_cmu_info __initconst = {
.clk_name = "dout_peri_bus", .clk_name = "dout_peri_bus",
}; };
static void __init exynos850_cmu_peri_init(struct device_node *np)
{
exynos_arm64_register_cmu(NULL, np, &peri_cmu_info);
}
/* Register CMU_PERI early, as it's needed for MCT timer */
CLK_OF_DECLARE(exynos850_cmu_peri, "samsung,exynos850-cmu-peri",
exynos850_cmu_peri_init);
/* ---- CMU_CORE ------------------------------------------------------------ */ /* ---- CMU_CORE ------------------------------------------------------------ */
/* Register Offset definitions for CMU_CORE (0x12000000) */ /* Register Offset definitions for CMU_CORE (0x12000000) */
@ -626,10 +849,12 @@ static const struct samsung_cmu_info peri_cmu_info __initconst = {
#define CLK_CON_DIV_DIV_CLK_CORE_BUSP 0x1800 #define CLK_CON_DIV_DIV_CLK_CORE_BUSP 0x1800
#define CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK 0x2038 #define CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK 0x2038
#define CLK_CON_GAT_GOUT_CORE_GIC_CLK 0x2040 #define CLK_CON_GAT_GOUT_CORE_GIC_CLK 0x2040
#define CLK_CON_GAT_GOUT_CORE_GPIO_CORE_PCLK 0x2044
#define CLK_CON_GAT_GOUT_CORE_MMC_EMBD_I_ACLK 0x20e8 #define CLK_CON_GAT_GOUT_CORE_MMC_EMBD_I_ACLK 0x20e8
#define CLK_CON_GAT_GOUT_CORE_MMC_EMBD_SDCLKIN 0x20ec #define CLK_CON_GAT_GOUT_CORE_MMC_EMBD_SDCLKIN 0x20ec
#define CLK_CON_GAT_GOUT_CORE_SSS_I_ACLK 0x2128 #define CLK_CON_GAT_GOUT_CORE_SSS_I_ACLK 0x2128
#define CLK_CON_GAT_GOUT_CORE_SSS_I_PCLK 0x212c #define CLK_CON_GAT_GOUT_CORE_SSS_I_PCLK 0x212c
#define CLK_CON_GAT_GOUT_CORE_SYSREG_CORE_PCLK 0x2130
static const unsigned long core_clk_regs[] __initconst = { static const unsigned long core_clk_regs[] __initconst = {
PLL_CON0_MUX_CLKCMU_CORE_BUS_USER, PLL_CON0_MUX_CLKCMU_CORE_BUS_USER,
@ -640,10 +865,12 @@ static const unsigned long core_clk_regs[] __initconst = {
CLK_CON_DIV_DIV_CLK_CORE_BUSP, CLK_CON_DIV_DIV_CLK_CORE_BUSP,
CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK, CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK,
CLK_CON_GAT_GOUT_CORE_GIC_CLK, CLK_CON_GAT_GOUT_CORE_GIC_CLK,
CLK_CON_GAT_GOUT_CORE_GPIO_CORE_PCLK,
CLK_CON_GAT_GOUT_CORE_MMC_EMBD_I_ACLK, CLK_CON_GAT_GOUT_CORE_MMC_EMBD_I_ACLK,
CLK_CON_GAT_GOUT_CORE_MMC_EMBD_SDCLKIN, CLK_CON_GAT_GOUT_CORE_MMC_EMBD_SDCLKIN,
CLK_CON_GAT_GOUT_CORE_SSS_I_ACLK, CLK_CON_GAT_GOUT_CORE_SSS_I_ACLK,
CLK_CON_GAT_GOUT_CORE_SSS_I_PCLK, CLK_CON_GAT_GOUT_CORE_SSS_I_PCLK,
CLK_CON_GAT_GOUT_CORE_SYSREG_CORE_PCLK,
}; };
/* List of parent clocks for Muxes in CMU_CORE */ /* List of parent clocks for Muxes in CMU_CORE */
@ -673,10 +900,12 @@ static const struct samsung_div_clock core_div_clks[] __initconst = {
}; };
static const struct samsung_gate_clock core_gate_clks[] __initconst = { static const struct samsung_gate_clock core_gate_clks[] __initconst = {
/* CCI (interconnect) clock must be always running */
GATE(CLK_GOUT_CCI_ACLK, "gout_cci_aclk", "mout_core_cci_user", GATE(CLK_GOUT_CCI_ACLK, "gout_cci_aclk", "mout_core_cci_user",
CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK, 21, 0, 0), CLK_CON_GAT_GOUT_CORE_CCI_550_ACLK, 21, CLK_IS_CRITICAL, 0),
/* GIC (interrupt controller) clock must be always running */
GATE(CLK_GOUT_GIC_CLK, "gout_gic_clk", "mout_core_gic", GATE(CLK_GOUT_GIC_CLK, "gout_gic_clk", "mout_core_gic",
CLK_CON_GAT_GOUT_CORE_GIC_CLK, 21, 0, 0), CLK_CON_GAT_GOUT_CORE_GIC_CLK, 21, CLK_IS_CRITICAL, 0),
GATE(CLK_GOUT_MMC_EMBD_ACLK, "gout_mmc_embd_aclk", "dout_core_busp", GATE(CLK_GOUT_MMC_EMBD_ACLK, "gout_mmc_embd_aclk", "dout_core_busp",
CLK_CON_GAT_GOUT_CORE_MMC_EMBD_I_ACLK, 21, 0, 0), CLK_CON_GAT_GOUT_CORE_MMC_EMBD_I_ACLK, 21, 0, 0),
GATE(CLK_GOUT_MMC_EMBD_SDCLKIN, "gout_mmc_embd_sdclkin", GATE(CLK_GOUT_MMC_EMBD_SDCLKIN, "gout_mmc_embd_sdclkin",
@ -686,6 +915,12 @@ static const struct samsung_gate_clock core_gate_clks[] __initconst = {
CLK_CON_GAT_GOUT_CORE_SSS_I_ACLK, 21, 0, 0), CLK_CON_GAT_GOUT_CORE_SSS_I_ACLK, 21, 0, 0),
GATE(CLK_GOUT_SSS_PCLK, "gout_sss_pclk", "dout_core_busp", GATE(CLK_GOUT_SSS_PCLK, "gout_sss_pclk", "dout_core_busp",
CLK_CON_GAT_GOUT_CORE_SSS_I_PCLK, 21, 0, 0), CLK_CON_GAT_GOUT_CORE_SSS_I_PCLK, 21, 0, 0),
/* TODO: Should be enabled in GPIO driver (or made CLK_IS_CRITICAL) */
GATE(CLK_GOUT_GPIO_CORE_PCLK, "gout_gpio_core_pclk", "dout_core_busp",
CLK_CON_GAT_GOUT_CORE_GPIO_CORE_PCLK, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_SYSREG_CORE_PCLK, "gout_sysreg_core_pclk",
"dout_core_busp",
CLK_CON_GAT_GOUT_CORE_SYSREG_CORE_PCLK, 21, 0, 0),
}; };
static const struct samsung_cmu_info core_cmu_info __initconst = { static const struct samsung_cmu_info core_cmu_info __initconst = {
@ -742,8 +977,10 @@ static const struct samsung_div_clock dpu_div_clks[] __initconst = {
}; };
static const struct samsung_gate_clock dpu_gate_clks[] __initconst = { static const struct samsung_gate_clock dpu_gate_clks[] __initconst = {
/* TODO: Should be enabled in DSIM driver */
GATE(CLK_GOUT_DPU_CMU_DPU_PCLK, "gout_dpu_cmu_dpu_pclk", GATE(CLK_GOUT_DPU_CMU_DPU_PCLK, "gout_dpu_cmu_dpu_pclk",
"dout_dpu_busp", CLK_CON_GAT_CLK_DPU_CMU_DPU_PCLK, 21, 0, 0), "dout_dpu_busp",
CLK_CON_GAT_CLK_DPU_CMU_DPU_PCLK, 21, CLK_IGNORE_UNUSED, 0),
GATE(CLK_GOUT_DPU_DECON0_ACLK, "gout_dpu_decon0_aclk", "mout_dpu_user", GATE(CLK_GOUT_DPU_DECON0_ACLK, "gout_dpu_decon0_aclk", "mout_dpu_user",
CLK_CON_GAT_GOUT_DPU_ACLK_DECON0, 21, 0, 0), CLK_CON_GAT_GOUT_DPU_ACLK_DECON0, 21, 0, 0),
GATE(CLK_GOUT_DPU_DMA_ACLK, "gout_dpu_dma_aclk", "mout_dpu_user", GATE(CLK_GOUT_DPU_DMA_ACLK, "gout_dpu_dma_aclk", "mout_dpu_user",
@ -779,36 +1016,23 @@ static int __init exynos850_cmu_probe(struct platform_device *pdev)
{ {
const struct samsung_cmu_info *info; const struct samsung_cmu_info *info;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node;
info = of_device_get_match_data(dev); info = of_device_get_match_data(dev);
exynos850_init_clocks(np, info->clk_regs, info->nr_clk_regs); exynos_arm64_register_cmu(dev, dev->of_node, info);
samsung_cmu_register_one(np, info);
/* Keep bus clock running, so it's possible to access CMU registers */
if (info->clk_name) {
struct clk *bus_clk;
bus_clk = clk_get(dev, info->clk_name);
if (IS_ERR(bus_clk)) {
pr_err("%s: could not find bus clock %s; err = %ld\n",
__func__, info->clk_name, PTR_ERR(bus_clk));
} else {
clk_prepare_enable(bus_clk);
}
}
return 0; return 0;
} }
/* CMUs which belong to Power Domains and need runtime PM to be implemented */
static const struct of_device_id exynos850_cmu_of_match[] = { static const struct of_device_id exynos850_cmu_of_match[] = {
{ {
.compatible = "samsung,exynos850-cmu-apm",
.data = &apm_cmu_info,
}, {
.compatible = "samsung,exynos850-cmu-cmgp",
.data = &cmgp_cmu_info,
}, {
.compatible = "samsung,exynos850-cmu-hsi", .compatible = "samsung,exynos850-cmu-hsi",
.data = &hsi_cmu_info, .data = &hsi_cmu_info,
}, {
.compatible = "samsung,exynos850-cmu-peri",
.data = &peri_cmu_info,
}, { }, {
.compatible = "samsung,exynos850-cmu-core", .compatible = "samsung,exynos850-cmu-core",
.data = &core_cmu_info, .data = &core_cmu_info,

View File

@ -1476,6 +1476,7 @@ static void __init _samsung_clk_register_pll(struct samsung_clk_provider *ctx,
else else
init.ops = &samsung_pll35xx_clk_ops; init.ops = &samsung_pll35xx_clk_ops;
break; break;
case pll_1417x:
case pll_0822x: case pll_0822x:
pll->enable_offs = PLL0822X_ENABLE_SHIFT; pll->enable_offs = PLL0822X_ENABLE_SHIFT;
pll->lock_offs = PLL0822X_LOCK_STAT_SHIFT; pll->lock_offs = PLL0822X_LOCK_STAT_SHIFT;

View File

@ -32,6 +32,7 @@ enum samsung_pll_type {
pll_2550xx, pll_2550xx,
pll_2650x, pll_2650x,
pll_2650xx, pll_2650xx,
pll_1417x,
pll_1450x, pll_1450x,
pll_1451x, pll_1451x,
pll_1452x, pll_1452x,

View File

@ -323,6 +323,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
void __iomem *base) void __iomem *base)
{ {
struct samsung_clk_provider *ctx; struct samsung_clk_provider *ctx;
struct clk_hw **hws;
reg_base = base; reg_base = base;
if (np) { if (np) {
@ -332,13 +333,14 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
} }
ctx = samsung_clk_init(np, reg_base, NR_CLKS); ctx = samsung_clk_init(np, reg_base, NR_CLKS);
hws = ctx->clk_data.hws;
/* Register external clocks only in non-dt cases */ /* Register external clocks only in non-dt cases */
if (!np) if (!np)
s3c2410_common_clk_register_fixed_ext(ctx, xti_f); s3c2410_common_clk_register_fixed_ext(ctx, xti_f);
if (current_soc == S3C2410) { if (current_soc == S3C2410) {
if (_get_rate("xti") == 12 * MHZ) { if (clk_hw_get_rate(hws[XTI]) == 12 * MHZ) {
s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl; s3c2410_plls[mpll].rate_table = pll_s3c2410_12mhz_tbl;
s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl; s3c2410_plls[upll].rate_table = pll_s3c2410_12mhz_tbl;
} }
@ -348,7 +350,7 @@ void __init s3c2410_common_clk_init(struct device_node *np, unsigned long xti_f,
ARRAY_SIZE(s3c2410_plls), reg_base); ARRAY_SIZE(s3c2410_plls), reg_base);
} else { /* S3C2440, S3C2442 */ } else { /* S3C2440, S3C2442 */
if (_get_rate("xti") == 12 * MHZ) { if (clk_hw_get_rate(hws[XTI]) == 12 * MHZ) {
/* /*
* plls follow different calculation schemes, with the * plls follow different calculation schemes, with the
* upll following the same scheme as the s3c2410 plls * upll following the same scheme as the s3c2410 plls

View File

@ -394,6 +394,7 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
void __iomem *base) void __iomem *base)
{ {
struct samsung_clk_provider *ctx; struct samsung_clk_provider *ctx;
struct clk_hw **hws;
reg_base = base; reg_base = base;
is_s3c6400 = s3c6400; is_s3c6400 = s3c6400;
@ -405,6 +406,7 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
} }
ctx = samsung_clk_init(np, reg_base, NR_CLKS); ctx = samsung_clk_init(np, reg_base, NR_CLKS);
hws = ctx->clk_data.hws;
/* Register external clocks. */ /* Register external clocks. */
if (!np) if (!np)
@ -459,8 +461,10 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f,
pr_info("%s clocks: apll = %lu, mpll = %lu\n" pr_info("%s clocks: apll = %lu, mpll = %lu\n"
"\tepll = %lu, arm_clk = %lu\n", "\tepll = %lu, arm_clk = %lu\n",
is_s3c6400 ? "S3C6400" : "S3C6410", is_s3c6400 ? "S3C6400" : "S3C6410",
_get_rate("fout_apll"), _get_rate("fout_mpll"), clk_hw_get_rate(hws[MOUT_APLL]),
_get_rate("fout_epll"), _get_rate("armclk")); clk_hw_get_rate(hws[MOUT_MPLL]),
clk_hw_get_rate(hws[MOUT_EPLL]),
clk_hw_get_rate(hws[ARMCLK]));
} }
static void __init s3c6400_clk_init(struct device_node *np) static void __init s3c6400_clk_init(struct device_node *np)

View File

@ -741,8 +741,10 @@ static void __init __s5pv210_clk_init(struct device_node *np,
bool is_s5p6442) bool is_s5p6442)
{ {
struct samsung_clk_provider *ctx; struct samsung_clk_provider *ctx;
struct clk_hw **hws;
ctx = samsung_clk_init(np, reg_base, NR_CLKS); ctx = samsung_clk_init(np, reg_base, NR_CLKS);
hws = ctx->clk_data.hws;
samsung_clk_register_mux(ctx, early_mux_clks, samsung_clk_register_mux(ctx, early_mux_clks,
ARRAY_SIZE(early_mux_clks)); ARRAY_SIZE(early_mux_clks));
@ -789,8 +791,10 @@ static void __init __s5pv210_clk_init(struct device_node *np,
pr_info("%s clocks: mout_apll = %ld, mout_mpll = %ld\n" pr_info("%s clocks: mout_apll = %ld, mout_mpll = %ld\n"
"\tmout_epll = %ld, mout_vpll = %ld\n", "\tmout_epll = %ld, mout_vpll = %ld\n",
is_s5p6442 ? "S5P6442" : "S5PV210", is_s5p6442 ? "S5P6442" : "S5PV210",
_get_rate("mout_apll"), _get_rate("mout_mpll"), clk_hw_get_rate(hws[MOUT_APLL]),
_get_rate("mout_epll"), _get_rate("mout_vpll")); clk_hw_get_rate(hws[MOUT_MPLL]),
clk_hw_get_rate(hws[MOUT_EPLL]),
clk_hw_get_rate(hws[MOUT_VPLL]));
} }
static void __init s5pv210_clk_dt_init(struct device_node *np) static void __init s5pv210_clk_dt_init(struct device_node *np)

View File

@ -268,20 +268,6 @@ void __init samsung_clk_of_register_fixed_ext(struct samsung_clk_provider *ctx,
samsung_clk_register_fixed_rate(ctx, fixed_rate_clk, nr_fixed_rate_clk); samsung_clk_register_fixed_rate(ctx, fixed_rate_clk, nr_fixed_rate_clk);
} }
/* utility function to get the rate of a specified clock */
unsigned long _get_rate(const char *clk_name)
{
struct clk *clk;
clk = __clk_lookup(clk_name);
if (!clk) {
pr_err("%s: could not find clock %s\n", __func__, clk_name);
return 0;
}
return clk_get_rate(clk);
}
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int samsung_clk_suspend(void) static int samsung_clk_suspend(void)
{ {

View File

@ -337,54 +337,52 @@ struct samsung_cmu_info {
const char *clk_name; const char *clk_name;
}; };
extern struct samsung_clk_provider *__init samsung_clk_init( struct samsung_clk_provider * samsung_clk_init(
struct device_node *np, void __iomem *base, struct device_node *np, void __iomem *base,
unsigned long nr_clks); unsigned long nr_clks);
extern void __init samsung_clk_of_add_provider(struct device_node *np, void samsung_clk_of_add_provider(struct device_node *np,
struct samsung_clk_provider *ctx); struct samsung_clk_provider *ctx);
extern void __init samsung_clk_of_register_fixed_ext( void samsung_clk_of_register_fixed_ext(
struct samsung_clk_provider *ctx, struct samsung_clk_provider *ctx,
struct samsung_fixed_rate_clock *fixed_rate_clk, struct samsung_fixed_rate_clock *fixed_rate_clk,
unsigned int nr_fixed_rate_clk, unsigned int nr_fixed_rate_clk,
const struct of_device_id *clk_matches); const struct of_device_id *clk_matches);
extern void samsung_clk_add_lookup(struct samsung_clk_provider *ctx, void samsung_clk_add_lookup(struct samsung_clk_provider *ctx,
struct clk_hw *clk_hw, unsigned int id); struct clk_hw *clk_hw, unsigned int id);
extern void __init samsung_clk_register_alias(struct samsung_clk_provider *ctx, void samsung_clk_register_alias(struct samsung_clk_provider *ctx,
const struct samsung_clock_alias *list, const struct samsung_clock_alias *list,
unsigned int nr_clk); unsigned int nr_clk);
extern void __init samsung_clk_register_fixed_rate( void samsung_clk_register_fixed_rate(
struct samsung_clk_provider *ctx, struct samsung_clk_provider *ctx,
const struct samsung_fixed_rate_clock *clk_list, const struct samsung_fixed_rate_clock *clk_list,
unsigned int nr_clk); unsigned int nr_clk);
extern void __init samsung_clk_register_fixed_factor( void samsung_clk_register_fixed_factor(
struct samsung_clk_provider *ctx, struct samsung_clk_provider *ctx,
const struct samsung_fixed_factor_clock *list, const struct samsung_fixed_factor_clock *list,
unsigned int nr_clk); unsigned int nr_clk);
extern void __init samsung_clk_register_mux(struct samsung_clk_provider *ctx, void samsung_clk_register_mux(struct samsung_clk_provider *ctx,
const struct samsung_mux_clock *clk_list, const struct samsung_mux_clock *clk_list,
unsigned int nr_clk); unsigned int nr_clk);
extern void __init samsung_clk_register_div(struct samsung_clk_provider *ctx, void samsung_clk_register_div(struct samsung_clk_provider *ctx,
const struct samsung_div_clock *clk_list, const struct samsung_div_clock *clk_list,
unsigned int nr_clk); unsigned int nr_clk);
extern void __init samsung_clk_register_gate(struct samsung_clk_provider *ctx, void samsung_clk_register_gate(struct samsung_clk_provider *ctx,
const struct samsung_gate_clock *clk_list, const struct samsung_gate_clock *clk_list,
unsigned int nr_clk); unsigned int nr_clk);
extern void __init samsung_clk_register_pll(struct samsung_clk_provider *ctx, void samsung_clk_register_pll(struct samsung_clk_provider *ctx,
const struct samsung_pll_clock *pll_list, const struct samsung_pll_clock *pll_list,
unsigned int nr_clk, void __iomem *base); unsigned int nr_clk, void __iomem *base);
extern void samsung_clk_register_cpu(struct samsung_clk_provider *ctx, void samsung_clk_register_cpu(struct samsung_clk_provider *ctx,
const struct samsung_cpu_clock *list, unsigned int nr_clk); const struct samsung_cpu_clock *list, unsigned int nr_clk);
extern struct samsung_clk_provider __init *samsung_cmu_register_one( struct samsung_clk_provider *samsung_cmu_register_one(
struct device_node *, struct device_node *,
const struct samsung_cmu_info *); const struct samsung_cmu_info *);
extern unsigned long _get_rate(const char *clk_name);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
extern void samsung_clk_extended_sleep_init(void __iomem *reg_base, void samsung_clk_extended_sleep_init(void __iomem *reg_base,
const unsigned long *rdump, const unsigned long *rdump,
unsigned long nr_rdump, unsigned long nr_rdump,
const struct samsung_clk_reg_dump *rsuspend, const struct samsung_clk_reg_dump *rsuspend,
@ -399,13 +397,13 @@ static inline void samsung_clk_extended_sleep_init(void __iomem *reg_base,
#define samsung_clk_sleep_init(reg_base, rdump, nr_rdump) \ #define samsung_clk_sleep_init(reg_base, rdump, nr_rdump) \
samsung_clk_extended_sleep_init(reg_base, rdump, nr_rdump, NULL, 0) samsung_clk_extended_sleep_init(reg_base, rdump, nr_rdump, NULL, 0)
extern void samsung_clk_save(void __iomem *base, void samsung_clk_save(void __iomem *base,
struct samsung_clk_reg_dump *rd, struct samsung_clk_reg_dump *rd,
unsigned int num_regs); unsigned int num_regs);
extern void samsung_clk_restore(void __iomem *base, void samsung_clk_restore(void __iomem *base,
const struct samsung_clk_reg_dump *rd, const struct samsung_clk_reg_dump *rd,
unsigned int num_regs); unsigned int num_regs);
extern struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump( struct samsung_clk_reg_dump *samsung_clk_alloc_reg_dump(
const unsigned long *rdump, const unsigned long *rdump,
unsigned long nr_rdump); unsigned long nr_rdump);

View File

@ -1,6 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
obj-y += clk.o obj-y += clk.o
obj-y += clk-audio-sync.o obj-y += clk-audio-sync.o
obj-y += clk-device.o
obj-y += clk-dfll.o obj-y += clk-dfll.o
obj-y += clk-divider.o obj-y += clk-divider.o
obj-y += clk-periph.o obj-y += clk-periph.o

View File

@ -0,0 +1,199 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/clk.h>
#include <linux/clk-provider.h>
#include <linux/mutex.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm_domain.h>
#include <linux/pm_opp.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <soc/tegra/common.h>
#include "clk.h"
/*
* This driver manages performance state of the core power domain for the
* independent PLLs and system clocks. We created a virtual clock device
* for such clocks, see tegra_clk_dev_register().
*/
struct tegra_clk_device {
struct notifier_block clk_nb;
struct device *dev;
struct clk_hw *hw;
struct mutex lock;
};
static int tegra_clock_set_pd_state(struct tegra_clk_device *clk_dev,
unsigned long rate)
{
struct device *dev = clk_dev->dev;
struct dev_pm_opp *opp;
unsigned int pstate;
opp = dev_pm_opp_find_freq_ceil(dev, &rate);
if (opp == ERR_PTR(-ERANGE)) {
/*
* Some clocks may be unused by a particular board and they
* may have uninitiated clock rate that is overly high. In
* this case clock is expected to be disabled, but still we
* need to set up performance state of the power domain and
* not error out clk initialization. A typical example is
* a PCIe clock on Android tablets.
*/
dev_dbg(dev, "failed to find ceil OPP for %luHz\n", rate);
opp = dev_pm_opp_find_freq_floor(dev, &rate);
}
if (IS_ERR(opp)) {
dev_err(dev, "failed to find OPP for %luHz: %pe\n", rate, opp);
return PTR_ERR(opp);
}
pstate = dev_pm_opp_get_required_pstate(opp, 0);
dev_pm_opp_put(opp);
return dev_pm_genpd_set_performance_state(dev, pstate);
}
static int tegra_clock_change_notify(struct notifier_block *nb,
unsigned long msg, void *data)
{
struct clk_notifier_data *cnd = data;
struct tegra_clk_device *clk_dev;
int err = 0;
clk_dev = container_of(nb, struct tegra_clk_device, clk_nb);
mutex_lock(&clk_dev->lock);
switch (msg) {
case PRE_RATE_CHANGE:
if (cnd->new_rate > cnd->old_rate)
err = tegra_clock_set_pd_state(clk_dev, cnd->new_rate);
break;
case ABORT_RATE_CHANGE:
err = tegra_clock_set_pd_state(clk_dev, cnd->old_rate);
break;
case POST_RATE_CHANGE:
if (cnd->new_rate < cnd->old_rate)
err = tegra_clock_set_pd_state(clk_dev, cnd->new_rate);
break;
default:
break;
}
mutex_unlock(&clk_dev->lock);
return notifier_from_errno(err);
}
static int tegra_clock_sync_pd_state(struct tegra_clk_device *clk_dev)
{
unsigned long rate;
int ret;
mutex_lock(&clk_dev->lock);
rate = clk_hw_get_rate(clk_dev->hw);
ret = tegra_clock_set_pd_state(clk_dev, rate);
mutex_unlock(&clk_dev->lock);
return ret;
}
static int tegra_clock_probe(struct platform_device *pdev)
{
struct tegra_core_opp_params opp_params = {};
struct tegra_clk_device *clk_dev;
struct device *dev = &pdev->dev;
struct clk *clk;
int err;
if (!dev->pm_domain)
return -EINVAL;
clk_dev = devm_kzalloc(dev, sizeof(*clk_dev), GFP_KERNEL);
if (!clk_dev)
return -ENOMEM;
clk = devm_clk_get(dev, NULL);
if (IS_ERR(clk))
return PTR_ERR(clk);
clk_dev->dev = dev;
clk_dev->hw = __clk_get_hw(clk);
clk_dev->clk_nb.notifier_call = tegra_clock_change_notify;
mutex_init(&clk_dev->lock);
platform_set_drvdata(pdev, clk_dev);
/*
* Runtime PM was already enabled for this device by the parent clk
* driver and power domain state should be synced under clk_dev lock,
* hence we don't use the common OPP helper that initializes OPP
* state. For some clocks common OPP helper may fail to find ceil
* rate, it's handled by this driver.
*/
err = devm_tegra_core_dev_init_opp_table(dev, &opp_params);
if (err)
return err;
err = clk_notifier_register(clk, &clk_dev->clk_nb);
if (err) {
dev_err(dev, "failed to register clk notifier: %d\n", err);
return err;
}
/*
* The driver is attaching to a potentially active/resumed clock, hence
* we need to sync the power domain performance state in a accordance to
* the clock rate if clock is resumed.
*/
err = tegra_clock_sync_pd_state(clk_dev);
if (err)
goto unreg_clk;
return 0;
unreg_clk:
clk_notifier_unregister(clk, &clk_dev->clk_nb);
return err;
}
/*
* Tegra GENPD driver enables clocks during NOIRQ phase. It can't be done
* for clocks served by this driver because runtime PM is unavailable in
* NOIRQ phase. We will keep clocks resumed during suspend to mitigate this
* problem. In practice this makes no difference from a power management
* perspective since voltage is kept at a nominal level during suspend anyways.
*/
static const struct dev_pm_ops tegra_clock_pm = {
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_resume_and_get, pm_runtime_put)
};
static const struct of_device_id tegra_clock_match[] = {
{ .compatible = "nvidia,tegra20-sclk" },
{ .compatible = "nvidia,tegra30-sclk" },
{ .compatible = "nvidia,tegra30-pllc" },
{ .compatible = "nvidia,tegra30-plle" },
{ .compatible = "nvidia,tegra30-pllm" },
{ }
};
static struct platform_driver tegra_clock_driver = {
.driver = {
.name = "tegra-clock",
.of_match_table = tegra_clock_match,
.pm = &tegra_clock_pm,
.suppress_bind_attrs = true,
},
.probe = tegra_clock_probe,
};
builtin_platform_driver(tegra_clock_driver);

View File

@ -1914,7 +1914,7 @@ static struct clk *_tegra_clk_register_pll(struct tegra_clk_pll *pll,
/* Data in .init is copied by clk_register(), so stack variable OK */ /* Data in .init is copied by clk_register(), so stack variable OK */
pll->hw.init = &init; pll->hw.init = &init;
return clk_register(NULL, &pll->hw); return tegra_clk_dev_register(&pll->hw);
} }
struct clk *tegra_clk_register_pll(const char *name, const char *parent_name, struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,

View File

@ -226,7 +226,7 @@ struct clk *tegra_clk_register_super_mux(const char *name,
/* Data in .init is copied by clk_register(), so stack variable OK */ /* Data in .init is copied by clk_register(), so stack variable OK */
super->hw.init = &init; super->hw.init = &init;
clk = clk_register(NULL, &super->hw); clk = tegra_clk_dev_register(&super->hw);
if (IS_ERR(clk)) if (IS_ERR(clk))
kfree(super); kfree(super);

View File

@ -1158,7 +1158,7 @@ static struct tegra_clk_init_table init_table[] __initdata = {
{ TEGRA114_CLK_XUSB_HS_SRC, TEGRA114_CLK_XUSB_SS_DIV2, 61200000, 0 }, { TEGRA114_CLK_XUSB_HS_SRC, TEGRA114_CLK_XUSB_SS_DIV2, 61200000, 0 },
{ TEGRA114_CLK_XUSB_FALCON_SRC, TEGRA114_CLK_PLL_P, 204000000, 0 }, { TEGRA114_CLK_XUSB_FALCON_SRC, TEGRA114_CLK_PLL_P, 204000000, 0 },
{ TEGRA114_CLK_XUSB_HOST_SRC, TEGRA114_CLK_PLL_P, 102000000, 0 }, { TEGRA114_CLK_XUSB_HOST_SRC, TEGRA114_CLK_PLL_P, 102000000, 0 },
{ TEGRA114_CLK_VDE, TEGRA114_CLK_CLK_MAX, 600000000, 0 }, { TEGRA114_CLK_VDE, TEGRA114_CLK_PLL_P, 408000000, 0 },
{ TEGRA114_CLK_SPDIF_IN_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, { TEGRA114_CLK_SPDIF_IN_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 },
{ TEGRA114_CLK_I2S0_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, { TEGRA114_CLK_I2S0_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 },
{ TEGRA114_CLK_I2S1_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 }, { TEGRA114_CLK_I2S1_SYNC, TEGRA114_CLK_CLK_MAX, 24000000, 0 },

View File

@ -6,8 +6,11 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/clkdev.h> #include <linux/clkdev.h>
#include <linux/init.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/clk/tegra.h> #include <linux/clk/tegra.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <dt-bindings/clock/tegra20-car.h> #include <dt-bindings/clock/tegra20-car.h>
@ -414,7 +417,7 @@ static struct tegra_clk_pll_params pll_e_params = {
.fixed_rate = 100000000, .fixed_rate = 100000000,
}; };
static struct tegra_devclk devclks[] __initdata = { static struct tegra_devclk devclks[] = {
{ .con_id = "pll_c", .dt_id = TEGRA20_CLK_PLL_C }, { .con_id = "pll_c", .dt_id = TEGRA20_CLK_PLL_C },
{ .con_id = "pll_c_out1", .dt_id = TEGRA20_CLK_PLL_C_OUT1 }, { .con_id = "pll_c_out1", .dt_id = TEGRA20_CLK_PLL_C_OUT1 },
{ .con_id = "pll_p", .dt_id = TEGRA20_CLK_PLL_P }, { .con_id = "pll_p", .dt_id = TEGRA20_CLK_PLL_P },
@ -710,13 +713,6 @@ static void tegra20_super_clk_init(void)
NULL); NULL);
clks[TEGRA20_CLK_CCLK] = clk; clks[TEGRA20_CLK_CCLK] = clk;
/* SCLK */
clk = tegra_clk_register_super_mux("sclk", sclk_parents,
ARRAY_SIZE(sclk_parents),
CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
clk_base + SCLK_BURST_POLICY, 0, 4, 0, 0, NULL);
clks[TEGRA20_CLK_SCLK] = clk;
/* twd */ /* twd */
clk = clk_register_fixed_factor(NULL, "twd", "cclk", 0, 1, 4); clk = clk_register_fixed_factor(NULL, "twd", "cclk", 0, 1, 4);
clks[TEGRA20_CLK_TWD] = clk; clks[TEGRA20_CLK_TWD] = clk;
@ -1014,7 +1010,7 @@ static struct tegra_cpu_car_ops tegra20_cpu_car_ops = {
#endif #endif
}; };
static struct tegra_clk_init_table init_table[] __initdata = { static struct tegra_clk_init_table init_table[] = {
{ TEGRA20_CLK_PLL_P, TEGRA20_CLK_CLK_MAX, 216000000, 1 }, { TEGRA20_CLK_PLL_P, TEGRA20_CLK_CLK_MAX, 216000000, 1 },
{ TEGRA20_CLK_PLL_P_OUT1, TEGRA20_CLK_CLK_MAX, 28800000, 1 }, { TEGRA20_CLK_PLL_P_OUT1, TEGRA20_CLK_CLK_MAX, 28800000, 1 },
{ TEGRA20_CLK_PLL_P_OUT2, TEGRA20_CLK_CLK_MAX, 48000000, 1 }, { TEGRA20_CLK_PLL_P_OUT2, TEGRA20_CLK_CLK_MAX, 48000000, 1 },
@ -1052,11 +1048,6 @@ static struct tegra_clk_init_table init_table[] __initdata = {
{ TEGRA20_CLK_CLK_MAX, TEGRA20_CLK_CLK_MAX, 0, 0 }, { TEGRA20_CLK_CLK_MAX, TEGRA20_CLK_CLK_MAX, 0, 0 },
}; };
static void __init tegra20_clock_apply_init_table(void)
{
tegra_init_from_table(init_table, clks, TEGRA20_CLK_CLK_MAX);
}
/* /*
* Some clocks may be used by different drivers depending on the board * Some clocks may be used by different drivers depending on the board
* configuration. List those here to register them twice in the clock lookup * configuration. List those here to register them twice in the clock lookup
@ -1076,6 +1067,8 @@ static const struct of_device_id pmc_match[] __initconst = {
{ }, { },
}; };
static bool tegra20_car_initialized;
static struct clk *tegra20_clk_src_onecell_get(struct of_phandle_args *clkspec, static struct clk *tegra20_clk_src_onecell_get(struct of_phandle_args *clkspec,
void *data) void *data)
{ {
@ -1083,6 +1076,16 @@ static struct clk *tegra20_clk_src_onecell_get(struct of_phandle_args *clkspec,
struct clk_hw *hw; struct clk_hw *hw;
struct clk *clk; struct clk *clk;
/*
* Timer clocks are needed early, the rest of the clocks shouldn't be
* available to device drivers until clock tree is fully initialized.
*/
if (clkspec->args[0] != TEGRA20_CLK_RTC &&
clkspec->args[0] != TEGRA20_CLK_TWD &&
clkspec->args[0] != TEGRA20_CLK_TIMER &&
!tegra20_car_initialized)
return ERR_PTR(-EPROBE_DEFER);
clk = of_clk_src_onecell_get(clkspec, data); clk = of_clk_src_onecell_get(clkspec, data);
if (IS_ERR(clk)) if (IS_ERR(clk))
return clk; return clk;
@ -1149,10 +1152,48 @@ static void __init tegra20_clock_init(struct device_node *np)
tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA20_CLK_CLK_MAX); tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA20_CLK_CLK_MAX);
tegra_add_of_provider(np, tegra20_clk_src_onecell_get); tegra_add_of_provider(np, tegra20_clk_src_onecell_get);
tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
tegra_clk_apply_init_table = tegra20_clock_apply_init_table;
tegra_cpu_car_ops = &tegra20_cpu_car_ops; tegra_cpu_car_ops = &tegra20_cpu_car_ops;
} }
CLK_OF_DECLARE(tegra20, "nvidia,tegra20-car", tegra20_clock_init); CLK_OF_DECLARE_DRIVER(tegra20, "nvidia,tegra20-car", tegra20_clock_init);
/*
* Clocks that use runtime PM can't be created at the tegra20_clock_init
* time because drivers' base isn't initialized yet, and thus platform
* devices can't be created for the clocks. Hence we need to split the
* registration of the clocks into two phases. The first phase registers
* essential clocks which don't require RPM and are actually used during
* early boot. The second phase registers clocks which use RPM and this
* is done when device drivers' core API is ready.
*/
static int tegra20_car_probe(struct platform_device *pdev)
{
struct clk *clk;
clk = tegra_clk_register_super_mux("sclk", sclk_parents,
ARRAY_SIZE(sclk_parents),
CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
clk_base + SCLK_BURST_POLICY, 0, 4, 0, 0, NULL);
clks[TEGRA20_CLK_SCLK] = clk;
tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
tegra_init_from_table(init_table, clks, TEGRA20_CLK_CLK_MAX);
tegra20_car_initialized = true;
return 0;
}
static const struct of_device_id tegra20_car_match[] = {
{ .compatible = "nvidia,tegra20-car" },
{ }
};
static struct platform_driver tegra20_car_driver = {
.driver = {
.name = "tegra20-car",
.of_match_table = tegra20_car_match,
.suppress_bind_attrs = true,
},
.probe = tegra20_car_probe,
};
builtin_platform_driver(tegra20_car_driver);

View File

@ -7,8 +7,11 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/clkdev.h> #include <linux/clkdev.h>
#include <linux/init.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/clk/tegra.h> #include <linux/clk/tegra.h>
#include <soc/tegra/pmc.h> #include <soc/tegra/pmc.h>
@ -532,7 +535,7 @@ static unsigned long tegra30_input_freq[] = {
[12] = 26000000, [12] = 26000000,
}; };
static struct tegra_devclk devclks[] __initdata = { static struct tegra_devclk devclks[] = {
{ .con_id = "pll_c", .dt_id = TEGRA30_CLK_PLL_C }, { .con_id = "pll_c", .dt_id = TEGRA30_CLK_PLL_C },
{ .con_id = "pll_c_out1", .dt_id = TEGRA30_CLK_PLL_C_OUT1 }, { .con_id = "pll_c_out1", .dt_id = TEGRA30_CLK_PLL_C_OUT1 },
{ .con_id = "pll_p", .dt_id = TEGRA30_CLK_PLL_P }, { .con_id = "pll_p", .dt_id = TEGRA30_CLK_PLL_P },
@ -812,11 +815,6 @@ static void __init tegra30_pll_init(void)
{ {
struct clk *clk; struct clk *clk;
/* PLLC */
clk = tegra_clk_register_pll("pll_c", "pll_ref", clk_base, pmc_base, 0,
&pll_c_params, NULL);
clks[TEGRA30_CLK_PLL_C] = clk;
/* PLLC_OUT1 */ /* PLLC_OUT1 */
clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c", clk = tegra_clk_register_divider("pll_c_out1_div", "pll_c",
clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP, clk_base + PLLC_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
@ -826,11 +824,6 @@ static void __init tegra30_pll_init(void)
0, NULL); 0, NULL);
clks[TEGRA30_CLK_PLL_C_OUT1] = clk; clks[TEGRA30_CLK_PLL_C_OUT1] = clk;
/* PLLM */
clk = tegra_clk_register_pll("pll_m", "pll_ref", clk_base, pmc_base,
CLK_SET_RATE_GATE, &pll_m_params, NULL);
clks[TEGRA30_CLK_PLL_M] = clk;
/* PLLM_OUT1 */ /* PLLM_OUT1 */
clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m", clk = tegra_clk_register_divider("pll_m_out1_div", "pll_m",
clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP, clk_base + PLLM_OUT, 0, TEGRA_DIVIDER_ROUND_UP,
@ -880,9 +873,6 @@ static void __init tegra30_pll_init(void)
ARRAY_SIZE(pll_e_parents), ARRAY_SIZE(pll_e_parents),
CLK_SET_RATE_NO_REPARENT, CLK_SET_RATE_NO_REPARENT,
clk_base + PLLE_AUX, 2, 1, 0, NULL); clk_base + PLLE_AUX, 2, 1, 0, NULL);
clk = tegra_clk_register_plle("pll_e", "pll_e_mux", clk_base, pmc_base,
CLK_GET_RATE_NOCACHE, &pll_e_params, NULL);
clks[TEGRA30_CLK_PLL_E] = clk;
} }
static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m", static const char *cclk_g_parents[] = { "clk_m", "pll_c", "clk_32k", "pll_m",
@ -971,14 +961,6 @@ static void __init tegra30_super_clk_init(void)
NULL); NULL);
clks[TEGRA30_CLK_CCLK_LP] = clk; clks[TEGRA30_CLK_CCLK_LP] = clk;
/* SCLK */
clk = tegra_clk_register_super_mux("sclk", sclk_parents,
ARRAY_SIZE(sclk_parents),
CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
clk_base + SCLK_BURST_POLICY,
0, 4, 0, 0, NULL);
clks[TEGRA30_CLK_SCLK] = clk;
/* twd */ /* twd */
clk = clk_register_fixed_factor(NULL, "twd", "cclk_g", clk = clk_register_fixed_factor(NULL, "twd", "cclk_g",
CLK_SET_RATE_PARENT, 1, 2); CLK_SET_RATE_PARENT, 1, 2);
@ -1214,7 +1196,7 @@ static struct tegra_cpu_car_ops tegra30_cpu_car_ops = {
#endif #endif
}; };
static struct tegra_clk_init_table init_table[] __initdata = { static struct tegra_clk_init_table init_table[] = {
{ TEGRA30_CLK_UARTA, TEGRA30_CLK_PLL_P, 408000000, 0 }, { TEGRA30_CLK_UARTA, TEGRA30_CLK_PLL_P, 408000000, 0 },
{ TEGRA30_CLK_UARTB, TEGRA30_CLK_PLL_P, 408000000, 0 }, { TEGRA30_CLK_UARTB, TEGRA30_CLK_PLL_P, 408000000, 0 },
{ TEGRA30_CLK_UARTC, TEGRA30_CLK_PLL_P, 408000000, 0 }, { TEGRA30_CLK_UARTC, TEGRA30_CLK_PLL_P, 408000000, 0 },
@ -1259,11 +1241,6 @@ static struct tegra_clk_init_table init_table[] __initdata = {
{ TEGRA30_CLK_CLK_MAX, TEGRA30_CLK_CLK_MAX, 0, 0 }, { TEGRA30_CLK_CLK_MAX, TEGRA30_CLK_CLK_MAX, 0, 0 },
}; };
static void __init tegra30_clock_apply_init_table(void)
{
tegra_init_from_table(init_table, clks, TEGRA30_CLK_CLK_MAX);
}
/* /*
* Some clocks may be used by different drivers depending on the board * Some clocks may be used by different drivers depending on the board
* configuration. List those here to register them twice in the clock lookup * configuration. List those here to register them twice in the clock lookup
@ -1294,12 +1271,24 @@ static struct tegra_audio_clk_info tegra30_audio_plls[] = {
{ "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" }, { "pll_a", &pll_a_params, tegra_clk_pll_a, "pll_p_out1" },
}; };
static bool tegra30_car_initialized;
static struct clk *tegra30_clk_src_onecell_get(struct of_phandle_args *clkspec, static struct clk *tegra30_clk_src_onecell_get(struct of_phandle_args *clkspec,
void *data) void *data)
{ {
struct clk_hw *hw; struct clk_hw *hw;
struct clk *clk; struct clk *clk;
/*
* Timer clocks are needed early, the rest of the clocks shouldn't be
* available to device drivers until clock tree is fully initialized.
*/
if (clkspec->args[0] != TEGRA30_CLK_RTC &&
clkspec->args[0] != TEGRA30_CLK_TWD &&
clkspec->args[0] != TEGRA30_CLK_TIMER &&
!tegra30_car_initialized)
return ERR_PTR(-EPROBE_DEFER);
clk = of_clk_src_onecell_get(clkspec, data); clk = of_clk_src_onecell_get(clkspec, data);
if (IS_ERR(clk)) if (IS_ERR(clk))
return clk; return clk;
@ -1357,10 +1346,75 @@ static void __init tegra30_clock_init(struct device_node *np)
tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA30_CLK_CLK_MAX); tegra_init_dup_clks(tegra_clk_duplicates, clks, TEGRA30_CLK_CLK_MAX);
tegra_add_of_provider(np, tegra30_clk_src_onecell_get); tegra_add_of_provider(np, tegra30_clk_src_onecell_get);
tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
tegra_clk_apply_init_table = tegra30_clock_apply_init_table;
tegra_cpu_car_ops = &tegra30_cpu_car_ops; tegra_cpu_car_ops = &tegra30_cpu_car_ops;
} }
CLK_OF_DECLARE(tegra30, "nvidia,tegra30-car", tegra30_clock_init); CLK_OF_DECLARE_DRIVER(tegra30, "nvidia,tegra30-car", tegra30_clock_init);
/*
* Clocks that use runtime PM can't be created at the tegra30_clock_init
* time because drivers' base isn't initialized yet, and thus platform
* devices can't be created for the clocks. Hence we need to split the
* registration of the clocks into two phases. The first phase registers
* essential clocks which don't require RPM and are actually used during
* early boot. The second phase registers clocks which use RPM and this
* is done when device drivers' core API is ready.
*/
static int tegra30_car_probe(struct platform_device *pdev)
{
struct clk *clk;
/* PLLC */
clk = tegra_clk_register_pll("pll_c", "pll_ref", clk_base, pmc_base, 0,
&pll_c_params, NULL);
clks[TEGRA30_CLK_PLL_C] = clk;
/* PLLE */
clk = tegra_clk_register_plle("pll_e", "pll_e_mux", clk_base, pmc_base,
CLK_GET_RATE_NOCACHE, &pll_e_params, NULL);
clks[TEGRA30_CLK_PLL_E] = clk;
/* PLLM */
clk = tegra_clk_register_pll("pll_m", "pll_ref", clk_base, pmc_base,
CLK_SET_RATE_GATE, &pll_m_params, NULL);
clks[TEGRA30_CLK_PLL_M] = clk;
/* SCLK */
clk = tegra_clk_register_super_mux("sclk", sclk_parents,
ARRAY_SIZE(sclk_parents),
CLK_SET_RATE_PARENT | CLK_IS_CRITICAL,
clk_base + SCLK_BURST_POLICY,
0, 4, 0, 0, NULL);
clks[TEGRA30_CLK_SCLK] = clk;
tegra_register_devclks(devclks, ARRAY_SIZE(devclks));
tegra_init_from_table(init_table, clks, TEGRA30_CLK_CLK_MAX);
tegra30_car_initialized = true;
return 0;
}
static const struct of_device_id tegra30_car_match[] = {
{ .compatible = "nvidia,tegra30-car" },
{ }
};
static struct platform_driver tegra30_car_driver = {
.driver = {
.name = "tegra30-car",
.of_match_table = tegra30_car_match,
.suppress_bind_attrs = true,
},
.probe = tegra30_car_probe,
};
/*
* Clock driver must be registered before memory controller driver,
* which doesn't support deferred probing for today and is registered
* from arch init-level.
*/
static int tegra30_car_init(void)
{
return platform_driver_register(&tegra30_car_driver);
}
postcore_initcall(tegra30_car_init);

View File

@ -9,14 +9,19 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_device.h>
#include <linux/clk/tegra.h> #include <linux/clk/tegra.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/reset-controller.h> #include <linux/reset-controller.h>
#include <linux/string.h>
#include <soc/tegra/fuse.h> #include <soc/tegra/fuse.h>
#include "clk.h" #include "clk.h"
/* Global data of Tegra CPU CAR ops */ /* Global data of Tegra CPU CAR ops */
static struct device_node *tegra_car_np;
static struct tegra_cpu_car_ops dummy_car_ops; static struct tegra_cpu_car_ops dummy_car_ops;
struct tegra_cpu_car_ops *tegra_cpu_car_ops = &dummy_car_ops; struct tegra_cpu_car_ops *tegra_cpu_car_ops = &dummy_car_ops;
@ -261,7 +266,7 @@ void __init tegra_init_dup_clks(struct tegra_clk_duplicate *dup_list,
} }
} }
void __init tegra_init_from_table(struct tegra_clk_init_table *tbl, void tegra_init_from_table(struct tegra_clk_init_table *tbl,
struct clk *clks[], int clk_max) struct clk *clks[], int clk_max)
{ {
struct clk *clk; struct clk *clk;
@ -320,6 +325,8 @@ void __init tegra_add_of_provider(struct device_node *np,
{ {
int i; int i;
tegra_car_np = np;
for (i = 0; i < clk_num; i++) { for (i = 0; i < clk_num; i++) {
if (IS_ERR(clks[i])) { if (IS_ERR(clks[i])) {
pr_err pr_err
@ -348,7 +355,7 @@ void __init tegra_init_special_resets(unsigned int num,
special_reset_deassert = deassert; special_reset_deassert = deassert;
} }
void __init tegra_register_devclks(struct tegra_devclk *dev_clks, int num) void tegra_register_devclks(struct tegra_devclk *dev_clks, int num)
{ {
int i; int i;
@ -372,6 +379,68 @@ struct clk ** __init tegra_lookup_dt_id(int clk_id,
return NULL; return NULL;
} }
static struct device_node *tegra_clk_get_of_node(struct clk_hw *hw)
{
struct device_node *np;
char *node_name;
node_name = kstrdup(hw->init->name, GFP_KERNEL);
if (!node_name)
return NULL;
strreplace(node_name, '_', '-');
for_each_child_of_node(tegra_car_np, np) {
if (!strcmp(np->name, node_name))
break;
}
kfree(node_name);
return np;
}
struct clk *tegra_clk_dev_register(struct clk_hw *hw)
{
struct platform_device *pdev, *parent;
const char *dev_name = NULL;
struct device *dev = NULL;
struct device_node *np;
np = tegra_clk_get_of_node(hw);
if (!of_device_is_available(np))
goto put_node;
dev_name = kasprintf(GFP_KERNEL, "tegra_clk_%s", hw->init->name);
if (!dev_name)
goto put_node;
parent = of_find_device_by_node(tegra_car_np);
if (parent) {
pdev = of_platform_device_create(np, dev_name, &parent->dev);
put_device(&parent->dev);
if (!pdev) {
pr_err("%s: failed to create device for %pOF\n",
__func__, np);
goto free_name;
}
dev = &pdev->dev;
pm_runtime_enable(dev);
} else {
WARN(1, "failed to find device for %pOF\n", tegra_car_np);
}
free_name:
kfree(dev_name);
put_node:
of_node_put(np);
return clk_register(dev, hw);
}
tegra_clk_apply_init_table_func tegra_clk_apply_init_table; tegra_clk_apply_init_table_func tegra_clk_apply_init_table;
static int __init tegra_clocks_apply_init_table(void) static int __init tegra_clocks_apply_init_table(void)

View File

@ -927,4 +927,6 @@ struct clk *tegra20_clk_register_emc(void __iomem *ioaddr, bool low_jitter);
struct clk *tegra210_clk_register_emc(struct device_node *np, struct clk *tegra210_clk_register_emc(struct device_node *np,
void __iomem *regs); void __iomem *regs);
struct clk *tegra_clk_dev_register(struct clk_hw *hw);
#endif /* TEGRA_CLK_H */ #endif /* TEGRA_CLK_H */

View File

@ -209,6 +209,7 @@
#define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */ #define CLK_ACLK400_MCUISP 395 /* Exynos4x12 only */
#define CLK_MOUT_HDMI 396 #define CLK_MOUT_HDMI 396
#define CLK_MOUT_MIXER 397 #define CLK_MOUT_MIXER 397
#define CLK_MOUT_VPLLSRC 398
/* gate clocks - ppmu */ /* gate clocks - ppmu */
#define CLK_PPMULEFT 400 #define CLK_PPMULEFT 400
@ -236,9 +237,10 @@
#define CLK_DIV_C2C 458 /* Exynos4x12 only */ #define CLK_DIV_C2C 458 /* Exynos4x12 only */
#define CLK_DIV_GDL 459 #define CLK_DIV_GDL 459
#define CLK_DIV_GDR 460 #define CLK_DIV_GDR 460
#define CLK_DIV_CORE2 461
/* must be greater than maximal clock id */ /* must be greater than maximal clock id */
#define CLK_NR_CLKS 461 #define CLK_NR_CLKS 462
/* Exynos4x12 ISP clocks */ /* Exynos4x12 ISP clocks */
#define CLK_ISP_FIMC_ISP 1 #define CLK_ISP_FIMC_ISP 1

View File

@ -19,6 +19,7 @@
#define CLK_FOUT_EPLL 7 #define CLK_FOUT_EPLL 7
#define CLK_FOUT_VPLL 8 #define CLK_FOUT_VPLL 8
#define CLK_ARM_CLK 9 #define CLK_ARM_CLK 9
#define CLK_DIV_ARM2 10
/* gate for special clocks (sclk) */ /* gate for special clocks (sclk) */
#define CLK_SCLK_CAM_BAYER 128 #define CLK_SCLK_CAM_BAYER 128
@ -174,8 +175,9 @@
#define CLK_MOUT_ACLK300_DISP1_SUB 1027 #define CLK_MOUT_ACLK300_DISP1_SUB 1027
#define CLK_MOUT_APLL 1028 #define CLK_MOUT_APLL 1028
#define CLK_MOUT_MPLL 1029 #define CLK_MOUT_MPLL 1029
#define CLK_MOUT_VPLLSRC 1030
/* must be greater than maximal clock id */ /* must be greater than maximal clock id */
#define CLK_NR_CLKS 1030 #define CLK_NR_CLKS 1031
#endif /* _DT_BINDINGS_CLOCK_EXYNOS_5250_H */ #endif /* _DT_BINDINGS_CLOCK_EXYNOS_5250_H */

View File

@ -0,0 +1,115 @@
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/*
* Copyright (c) 2021 Dávid Virág
*
* Device Tree binding constants for Exynos7885 clock controller.
*/
#ifndef _DT_BINDINGS_CLOCK_EXYNOS_7885_H
#define _DT_BINDINGS_CLOCK_EXYNOS_7885_H
/* CMU_TOP */
#define CLK_FOUT_SHARED0_PLL 1
#define CLK_FOUT_SHARED1_PLL 2
#define CLK_DOUT_SHARED0_DIV2 3
#define CLK_DOUT_SHARED0_DIV3 4
#define CLK_DOUT_SHARED0_DIV4 5
#define CLK_DOUT_SHARED0_DIV5 6
#define CLK_DOUT_SHARED1_DIV2 7
#define CLK_DOUT_SHARED1_DIV3 8
#define CLK_DOUT_SHARED1_DIV4 9
#define CLK_MOUT_CORE_BUS 10
#define CLK_MOUT_CORE_CCI 11
#define CLK_MOUT_CORE_G3D 12
#define CLK_DOUT_CORE_BUS 13
#define CLK_DOUT_CORE_CCI 14
#define CLK_DOUT_CORE_G3D 15
#define CLK_GOUT_CORE_BUS 16
#define CLK_GOUT_CORE_CCI 17
#define CLK_GOUT_CORE_G3D 18
#define CLK_MOUT_PERI_BUS 19
#define CLK_MOUT_PERI_SPI0 20
#define CLK_MOUT_PERI_SPI1 21
#define CLK_MOUT_PERI_UART0 22
#define CLK_MOUT_PERI_UART1 23
#define CLK_MOUT_PERI_UART2 24
#define CLK_MOUT_PERI_USI0 25
#define CLK_MOUT_PERI_USI1 26
#define CLK_MOUT_PERI_USI2 27
#define CLK_DOUT_PERI_BUS 28
#define CLK_DOUT_PERI_SPI0 29
#define CLK_DOUT_PERI_SPI1 30
#define CLK_DOUT_PERI_UART0 31
#define CLK_DOUT_PERI_UART1 32
#define CLK_DOUT_PERI_UART2 33
#define CLK_DOUT_PERI_USI0 34
#define CLK_DOUT_PERI_USI1 35
#define CLK_DOUT_PERI_USI2 36
#define CLK_GOUT_PERI_BUS 37
#define CLK_GOUT_PERI_SPI0 38
#define CLK_GOUT_PERI_SPI1 39
#define CLK_GOUT_PERI_UART0 40
#define CLK_GOUT_PERI_UART1 41
#define CLK_GOUT_PERI_UART2 42
#define CLK_GOUT_PERI_USI0 43
#define CLK_GOUT_PERI_USI1 44
#define CLK_GOUT_PERI_USI2 45
#define TOP_NR_CLK 46
/* CMU_CORE */
#define CLK_MOUT_CORE_BUS_USER 1
#define CLK_MOUT_CORE_CCI_USER 2
#define CLK_MOUT_CORE_G3D_USER 3
#define CLK_MOUT_CORE_GIC 4
#define CLK_DOUT_CORE_BUSP 5
#define CLK_GOUT_CCI_ACLK 6
#define CLK_GOUT_GIC400_CLK 7
#define CORE_NR_CLK 8
/* CMU_PERI */
#define CLK_MOUT_PERI_BUS_USER 1
#define CLK_MOUT_PERI_SPI0_USER 2
#define CLK_MOUT_PERI_SPI1_USER 3
#define CLK_MOUT_PERI_UART0_USER 4
#define CLK_MOUT_PERI_UART1_USER 5
#define CLK_MOUT_PERI_UART2_USER 6
#define CLK_MOUT_PERI_USI0_USER 7
#define CLK_MOUT_PERI_USI1_USER 8
#define CLK_MOUT_PERI_USI2_USER 9
#define CLK_GOUT_GPIO_TOP_PCLK 10
#define CLK_GOUT_HSI2C0_PCLK 11
#define CLK_GOUT_HSI2C1_PCLK 12
#define CLK_GOUT_HSI2C2_PCLK 13
#define CLK_GOUT_HSI2C3_PCLK 14
#define CLK_GOUT_I2C0_PCLK 15
#define CLK_GOUT_I2C1_PCLK 16
#define CLK_GOUT_I2C2_PCLK 17
#define CLK_GOUT_I2C3_PCLK 18
#define CLK_GOUT_I2C4_PCLK 19
#define CLK_GOUT_I2C5_PCLK 20
#define CLK_GOUT_I2C6_PCLK 21
#define CLK_GOUT_I2C7_PCLK 22
#define CLK_GOUT_PWM_MOTOR_PCLK 23
#define CLK_GOUT_SPI0_PCLK 24
#define CLK_GOUT_SPI0_EXT_CLK 25
#define CLK_GOUT_SPI1_PCLK 26
#define CLK_GOUT_SPI1_EXT_CLK 27
#define CLK_GOUT_UART0_EXT_UCLK 28
#define CLK_GOUT_UART0_PCLK 29
#define CLK_GOUT_UART1_EXT_UCLK 30
#define CLK_GOUT_UART1_PCLK 31
#define CLK_GOUT_UART2_EXT_UCLK 32
#define CLK_GOUT_UART2_PCLK 33
#define CLK_GOUT_USI0_PCLK 34
#define CLK_GOUT_USI0_SCLK 35
#define CLK_GOUT_USI1_PCLK 36
#define CLK_GOUT_USI1_SCLK 37
#define CLK_GOUT_USI2_PCLK 38
#define CLK_GOUT_USI2_SCLK 39
#define CLK_GOUT_MCT_PCLK 40
#define CLK_GOUT_SYSREG_PERI_PCLK 41
#define CLK_GOUT_WDT0_PCLK 42
#define CLK_GOUT_WDT1_PCLK 43
#define PERI_NR_CLK 44
#endif /* _DT_BINDINGS_CLOCK_EXYNOS_7885_H */

View File

@ -55,7 +55,55 @@
#define CLK_GOUT_PERI_BUS 43 #define CLK_GOUT_PERI_BUS 43
#define CLK_GOUT_PERI_UART 44 #define CLK_GOUT_PERI_UART 44
#define CLK_GOUT_PERI_IP 45 #define CLK_GOUT_PERI_IP 45
#define TOP_NR_CLK 46 #define CLK_MOUT_CLKCMU_APM_BUS 46
#define CLK_DOUT_CLKCMU_APM_BUS 47
#define CLK_GOUT_CLKCMU_APM_BUS 48
#define TOP_NR_CLK 49
/* CMU_APM */
#define CLK_RCO_I3C_PMIC 1
#define OSCCLK_RCO_APM 2
#define CLK_RCO_APM__ALV 3
#define CLK_DLL_DCO 4
#define CLK_MOUT_APM_BUS_USER 5
#define CLK_MOUT_RCO_APM_I3C_USER 6
#define CLK_MOUT_RCO_APM_USER 7
#define CLK_MOUT_DLL_USER 8
#define CLK_MOUT_CLKCMU_CHUB_BUS 9
#define CLK_MOUT_APM_BUS 10
#define CLK_MOUT_APM_I3C 11
#define CLK_DOUT_CLKCMU_CHUB_BUS 12
#define CLK_DOUT_APM_BUS 13
#define CLK_DOUT_APM_I3C 14
#define CLK_GOUT_CLKCMU_CMGP_BUS 15
#define CLK_GOUT_CLKCMU_CHUB_BUS 16
#define CLK_GOUT_RTC_PCLK 17
#define CLK_GOUT_TOP_RTC_PCLK 18
#define CLK_GOUT_I3C_PCLK 19
#define CLK_GOUT_I3C_SCLK 20
#define CLK_GOUT_SPEEDY_PCLK 21
#define CLK_GOUT_GPIO_ALIVE_PCLK 22
#define CLK_GOUT_PMU_ALIVE_PCLK 23
#define CLK_GOUT_SYSREG_APM_PCLK 24
#define APM_NR_CLK 25
/* CMU_CMGP */
#define CLK_RCO_CMGP 1
#define CLK_MOUT_CMGP_ADC 2
#define CLK_MOUT_CMGP_USI0 3
#define CLK_MOUT_CMGP_USI1 4
#define CLK_DOUT_CMGP_ADC 5
#define CLK_DOUT_CMGP_USI0 6
#define CLK_DOUT_CMGP_USI1 7
#define CLK_GOUT_CMGP_ADC_S0_PCLK 8
#define CLK_GOUT_CMGP_ADC_S1_PCLK 9
#define CLK_GOUT_CMGP_GPIO_PCLK 10
#define CLK_GOUT_CMGP_USI0_IPCLK 11
#define CLK_GOUT_CMGP_USI0_PCLK 12
#define CLK_GOUT_CMGP_USI1_IPCLK 13
#define CLK_GOUT_CMGP_USI1_PCLK 14
#define CLK_GOUT_SYSREG_CMGP_PCLK 15
#define CMGP_NR_CLK 16
/* CMU_HSI */ /* CMU_HSI */
#define CLK_MOUT_HSI_BUS_USER 1 #define CLK_MOUT_HSI_BUS_USER 1
@ -123,7 +171,9 @@
#define CLK_GOUT_MMC_EMBD_SDCLKIN 10 #define CLK_GOUT_MMC_EMBD_SDCLKIN 10
#define CLK_GOUT_SSS_ACLK 11 #define CLK_GOUT_SSS_ACLK 11
#define CLK_GOUT_SSS_PCLK 12 #define CLK_GOUT_SSS_PCLK 12
#define CORE_NR_CLK 13 #define CLK_GOUT_GPIO_CORE_PCLK 13
#define CLK_GOUT_SYSREG_CORE_PCLK 14
#define CORE_NR_CLK 15
/* CMU_DPU */ /* CMU_DPU */
#define CLK_MOUT_DPU_USER 1 #define CLK_MOUT_DPU_USER 1

View File

@ -117,7 +117,6 @@
#define IMX8MP_CLK_AUDIO_AHB 108 #define IMX8MP_CLK_AUDIO_AHB 108
#define IMX8MP_CLK_MIPI_DSI_ESC_RX 109 #define IMX8MP_CLK_MIPI_DSI_ESC_RX 109
#define IMX8MP_CLK_IPG_ROOT 110 #define IMX8MP_CLK_IPG_ROOT 110
#define IMX8MP_CLK_IPG_AUDIO_ROOT 111
#define IMX8MP_CLK_DRAM_ALT 112 #define IMX8MP_CLK_DRAM_ALT 112
#define IMX8MP_CLK_DRAM_APB 113 #define IMX8MP_CLK_DRAM_APB 113
#define IMX8MP_CLK_VPU_G1 114 #define IMX8MP_CLK_VPU_G1 114

View File

@ -0,0 +1,240 @@
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/*
* Copyright (C) 2016, The Linux Foundation. All rights reserved.
* Copyright (C) 2016-2021, AngeloGioacchino Del Regno
* <angelogioacchino.delregno@somainline.org>
*/
#ifndef _DT_BINDINGS_CLK_MSM_GCC_8976_H
#define _DT_BINDINGS_CLK_MSM_GCC_8976_H
#define GPLL0 0
#define GPLL2 1
#define GPLL3 2
#define GPLL4 3
#define GPLL6 4
#define GPLL0_CLK_SRC 5
#define GPLL2_CLK_SRC 6
#define GPLL3_CLK_SRC 7
#define GPLL4_CLK_SRC 8
#define GPLL6_CLK_SRC 9
#define GCC_BLSP1_QUP1_SPI_APPS_CLK 10
#define GCC_BLSP1_QUP1_I2C_APPS_CLK 11
#define GCC_BLSP1_QUP2_I2C_APPS_CLK 12
#define GCC_BLSP1_QUP2_SPI_APPS_CLK 13
#define GCC_BLSP1_QUP3_I2C_APPS_CLK 14
#define GCC_BLSP1_QUP3_SPI_APPS_CLK 15
#define GCC_BLSP1_QUP4_I2C_APPS_CLK 16
#define GCC_BLSP1_QUP4_SPI_APPS_CLK 17
#define GCC_BLSP1_UART1_APPS_CLK 18
#define GCC_BLSP1_UART2_APPS_CLK 19
#define GCC_BLSP2_QUP1_I2C_APPS_CLK 20
#define GCC_BLSP2_QUP1_SPI_APPS_CLK 21
#define GCC_BLSP2_QUP2_I2C_APPS_CLK 22
#define GCC_BLSP2_QUP2_SPI_APPS_CLK 23
#define GCC_BLSP2_QUP3_I2C_APPS_CLK 24
#define GCC_BLSP2_QUP3_SPI_APPS_CLK 25
#define GCC_BLSP2_QUP4_I2C_APPS_CLK 26
#define GCC_BLSP2_QUP4_SPI_APPS_CLK 27
#define GCC_BLSP2_UART1_APPS_CLK 28
#define GCC_BLSP2_UART2_APPS_CLK 29
#define GCC_CAMSS_CCI_AHB_CLK 30
#define GCC_CAMSS_CCI_CLK 31
#define GCC_CAMSS_CPP_AHB_CLK 32
#define GCC_CAMSS_CPP_AXI_CLK 33
#define GCC_CAMSS_CPP_CLK 34
#define GCC_CAMSS_CSI0_AHB_CLK 35
#define GCC_CAMSS_CSI0_CLK 36
#define GCC_CAMSS_CSI0PHY_CLK 37
#define GCC_CAMSS_CSI0PIX_CLK 38
#define GCC_CAMSS_CSI0RDI_CLK 39
#define GCC_CAMSS_CSI1_AHB_CLK 40
#define GCC_CAMSS_CSI1_CLK 41
#define GCC_CAMSS_CSI1PHY_CLK 42
#define GCC_CAMSS_CSI1PIX_CLK 43
#define GCC_CAMSS_CSI1RDI_CLK 44
#define GCC_CAMSS_CSI2_AHB_CLK 45
#define GCC_CAMSS_CSI2_CLK 46
#define GCC_CAMSS_CSI2PHY_CLK 47
#define GCC_CAMSS_CSI2PIX_CLK 48
#define GCC_CAMSS_CSI2RDI_CLK 49
#define GCC_CAMSS_CSI_VFE0_CLK 50
#define GCC_CAMSS_CSI_VFE1_CLK 51
#define GCC_CAMSS_GP0_CLK 52
#define GCC_CAMSS_GP1_CLK 53
#define GCC_CAMSS_ISPIF_AHB_CLK 54
#define GCC_CAMSS_JPEG0_CLK 55
#define GCC_CAMSS_JPEG_AHB_CLK 56
#define GCC_CAMSS_JPEG_AXI_CLK 57
#define GCC_CAMSS_MCLK0_CLK 58
#define GCC_CAMSS_MCLK1_CLK 59
#define GCC_CAMSS_MCLK2_CLK 60
#define GCC_CAMSS_MICRO_AHB_CLK 61
#define GCC_CAMSS_CSI0PHYTIMER_CLK 62
#define GCC_CAMSS_CSI1PHYTIMER_CLK 63
#define GCC_CAMSS_AHB_CLK 64
#define GCC_CAMSS_TOP_AHB_CLK 65
#define GCC_CAMSS_VFE0_CLK 66
#define GCC_CAMSS_VFE_AHB_CLK 67
#define GCC_CAMSS_VFE_AXI_CLK 68
#define GCC_CAMSS_VFE1_AHB_CLK 69
#define GCC_CAMSS_VFE1_AXI_CLK 70
#define GCC_CAMSS_VFE1_CLK 71
#define GCC_DCC_CLK 72
#define GCC_GP1_CLK 73
#define GCC_GP2_CLK 74
#define GCC_GP3_CLK 75
#define GCC_MDSS_AHB_CLK 76
#define GCC_MDSS_AXI_CLK 77
#define GCC_MDSS_ESC0_CLK 78
#define GCC_MDSS_ESC1_CLK 79
#define GCC_MDSS_MDP_CLK 80
#define GCC_MDSS_VSYNC_CLK 81
#define GCC_MSS_CFG_AHB_CLK 82
#define GCC_MSS_Q6_BIMC_AXI_CLK 83
#define GCC_PDM2_CLK 84
#define GCC_PRNG_AHB_CLK 85
#define GCC_PDM_AHB_CLK 86
#define GCC_RBCPR_GFX_AHB_CLK 87
#define GCC_RBCPR_GFX_CLK 88
#define GCC_SDCC1_AHB_CLK 89
#define GCC_SDCC1_APPS_CLK 90
#define GCC_SDCC1_ICE_CORE_CLK 91
#define GCC_SDCC2_AHB_CLK 92
#define GCC_SDCC2_APPS_CLK 93
#define GCC_SDCC3_AHB_CLK 94
#define GCC_SDCC3_APPS_CLK 95
#define GCC_USB2A_PHY_SLEEP_CLK 96
#define GCC_USB_HS_PHY_CFG_AHB_CLK 97
#define GCC_USB_FS_AHB_CLK 98
#define GCC_USB_FS_IC_CLK 99
#define GCC_USB_FS_SYSTEM_CLK 100
#define GCC_USB_HS_AHB_CLK 101
#define GCC_USB_HS_SYSTEM_CLK 102
#define GCC_VENUS0_AHB_CLK 103
#define GCC_VENUS0_AXI_CLK 104
#define GCC_VENUS0_CORE0_VCODEC0_CLK 105
#define GCC_VENUS0_CORE1_VCODEC0_CLK 106
#define GCC_VENUS0_VCODEC0_CLK 107
#define GCC_APSS_AHB_CLK 108
#define GCC_APSS_AXI_CLK 109
#define GCC_BLSP1_AHB_CLK 110
#define GCC_BLSP2_AHB_CLK 111
#define GCC_BOOT_ROM_AHB_CLK 112
#define GCC_CRYPTO_AHB_CLK 113
#define GCC_CRYPTO_AXI_CLK 114
#define GCC_CRYPTO_CLK 115
#define GCC_CPP_TBU_CLK 116
#define GCC_APSS_TCU_CLK 117
#define GCC_JPEG_TBU_CLK 118
#define GCC_MDP_RT_TBU_CLK 119
#define GCC_MDP_TBU_CLK 120
#define GCC_SMMU_CFG_CLK 121
#define GCC_VENUS_1_TBU_CLK 122
#define GCC_VENUS_TBU_CLK 123
#define GCC_VFE1_TBU_CLK 124
#define GCC_VFE_TBU_CLK 125
#define GCC_APS_0_CLK 126
#define GCC_APS_1_CLK 127
#define APS_0_CLK_SRC 128
#define APS_1_CLK_SRC 129
#define APSS_AHB_CLK_SRC 130
#define BLSP1_QUP1_I2C_APPS_CLK_SRC 131
#define BLSP1_QUP1_SPI_APPS_CLK_SRC 132
#define BLSP1_QUP2_I2C_APPS_CLK_SRC 133
#define BLSP1_QUP2_SPI_APPS_CLK_SRC 134
#define BLSP1_QUP3_I2C_APPS_CLK_SRC 135
#define BLSP1_QUP3_SPI_APPS_CLK_SRC 136
#define BLSP1_QUP4_I2C_APPS_CLK_SRC 137
#define BLSP1_QUP4_SPI_APPS_CLK_SRC 138
#define BLSP1_UART1_APPS_CLK_SRC 139
#define BLSP1_UART2_APPS_CLK_SRC 140
#define BLSP2_QUP1_I2C_APPS_CLK_SRC 141
#define BLSP2_QUP1_SPI_APPS_CLK_SRC 142
#define BLSP2_QUP2_I2C_APPS_CLK_SRC 143
#define BLSP2_QUP2_SPI_APPS_CLK_SRC 144
#define BLSP2_QUP3_I2C_APPS_CLK_SRC 145
#define BLSP2_QUP3_SPI_APPS_CLK_SRC 146
#define BLSP2_QUP4_I2C_APPS_CLK_SRC 147
#define BLSP2_QUP4_SPI_APPS_CLK_SRC 148
#define BLSP2_UART1_APPS_CLK_SRC 149
#define BLSP2_UART2_APPS_CLK_SRC 150
#define CCI_CLK_SRC 151
#define CPP_CLK_SRC 152
#define CSI0_CLK_SRC 153
#define CSI1_CLK_SRC 154
#define CSI2_CLK_SRC 155
#define CAMSS_GP0_CLK_SRC 156
#define CAMSS_GP1_CLK_SRC 157
#define JPEG0_CLK_SRC 158
#define MCLK0_CLK_SRC 159
#define MCLK1_CLK_SRC 160
#define MCLK2_CLK_SRC 161
#define CSI0PHYTIMER_CLK_SRC 162
#define CSI1PHYTIMER_CLK_SRC 163
#define CAMSS_TOP_AHB_CLK_SRC 164
#define VFE0_CLK_SRC 165
#define VFE1_CLK_SRC 166
#define CRYPTO_CLK_SRC 167
#define GP1_CLK_SRC 168
#define GP2_CLK_SRC 169
#define GP3_CLK_SRC 170
#define ESC0_CLK_SRC 171
#define ESC1_CLK_SRC 172
#define MDP_CLK_SRC 173
#define VSYNC_CLK_SRC 174
#define PDM2_CLK_SRC 175
#define RBCPR_GFX_CLK_SRC 176
#define SDCC1_APPS_CLK_SRC 177
#define SDCC1_ICE_CORE_CLK_SRC 178
#define SDCC2_APPS_CLK_SRC 179
#define SDCC3_APPS_CLK_SRC 180
#define USB_FS_IC_CLK_SRC 181
#define USB_FS_SYSTEM_CLK_SRC 182
#define USB_HS_SYSTEM_CLK_SRC 183
#define VCODEC0_CLK_SRC 184
#define GCC_MDSS_BYTE0_CLK_SRC 185
#define GCC_MDSS_BYTE1_CLK_SRC 186
#define GCC_MDSS_BYTE0_CLK 187
#define GCC_MDSS_BYTE1_CLK 188
#define GCC_MDSS_PCLK0_CLK_SRC 189
#define GCC_MDSS_PCLK1_CLK_SRC 190
#define GCC_MDSS_PCLK0_CLK 191
#define GCC_MDSS_PCLK1_CLK 192
#define GCC_GFX3D_CLK_SRC 193
#define GCC_GFX3D_OXILI_CLK 194
#define GCC_GFX3D_BIMC_CLK 195
#define GCC_GFX3D_OXILI_AHB_CLK 196
#define GCC_GFX3D_OXILI_AON_CLK 197
#define GCC_GFX3D_OXILI_GMEM_CLK 198
#define GCC_GFX3D_OXILI_TIMER_CLK 199
#define GCC_GFX3D_TBU0_CLK 200
#define GCC_GFX3D_TBU1_CLK 201
#define GCC_GFX3D_TCU_CLK 202
#define GCC_GFX3D_GTCU_AHB_CLK 203
/* GCC block resets */
#define RST_CAMSS_MICRO_BCR 0
#define RST_USB_HS_BCR 1
#define RST_QUSB2_PHY_BCR 2
#define RST_USB2_HS_PHY_ONLY_BCR 3
#define RST_USB_HS_PHY_CFG_AHB_BCR 4
#define RST_USB_FS_BCR 5
#define RST_CAMSS_CSI1PIX_BCR 6
#define RST_CAMSS_CSI_VFE1_BCR 7
#define RST_CAMSS_VFE1_BCR 8
#define RST_CAMSS_CPP_BCR 9
/* GDSCs */
#define VENUS_GDSC 0
#define VENUS_CORE0_GDSC 1
#define VENUS_CORE1_GDSC 2
#define MDSS_GDSC 3
#define JPEG_GDSC 4
#define VFE0_GDSC 5
#define VFE1_GDSC 6
#define CPP_GDSC 7
#define OXILI_GX_GDSC 8
#define OXILI_CX_GDSC 9
#endif /* _DT_BINDINGS_CLK_MSM_GCC_8976_H */

View File

@ -0,0 +1,122 @@
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/*
* Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#ifndef _DT_BINDINGS_CLK_QCOM_GCC_SDX65_H
#define _DT_BINDINGS_CLK_QCOM_GCC_SDX65_H
/* GCC clocks */
#define GPLL0 0
#define GPLL0_OUT_EVEN 1
#define GCC_AHB_PCIE_LINK_CLK 2
#define GCC_BLSP1_AHB_CLK 3
#define GCC_BLSP1_QUP1_I2C_APPS_CLK 4
#define GCC_BLSP1_QUP1_I2C_APPS_CLK_SRC 5
#define GCC_BLSP1_QUP1_SPI_APPS_CLK 6
#define GCC_BLSP1_QUP1_SPI_APPS_CLK_SRC 7
#define GCC_BLSP1_QUP2_I2C_APPS_CLK 8
#define GCC_BLSP1_QUP2_I2C_APPS_CLK_SRC 9
#define GCC_BLSP1_QUP2_SPI_APPS_CLK 10
#define GCC_BLSP1_QUP2_SPI_APPS_CLK_SRC 11
#define GCC_BLSP1_QUP3_I2C_APPS_CLK 12
#define GCC_BLSP1_QUP3_I2C_APPS_CLK_SRC 13
#define GCC_BLSP1_QUP3_SPI_APPS_CLK 14
#define GCC_BLSP1_QUP3_SPI_APPS_CLK_SRC 15
#define GCC_BLSP1_QUP4_I2C_APPS_CLK 16
#define GCC_BLSP1_QUP4_I2C_APPS_CLK_SRC 17
#define GCC_BLSP1_QUP4_SPI_APPS_CLK 18
#define GCC_BLSP1_QUP4_SPI_APPS_CLK_SRC 19
#define GCC_BLSP1_SLEEP_CLK 20
#define GCC_BLSP1_UART1_APPS_CLK 21
#define GCC_BLSP1_UART1_APPS_CLK_SRC 22
#define GCC_BLSP1_UART2_APPS_CLK 23
#define GCC_BLSP1_UART2_APPS_CLK_SRC 24
#define GCC_BLSP1_UART3_APPS_CLK 25
#define GCC_BLSP1_UART3_APPS_CLK_SRC 26
#define GCC_BLSP1_UART4_APPS_CLK 27
#define GCC_BLSP1_UART4_APPS_CLK_SRC 28
#define GCC_BOOT_ROM_AHB_CLK 29
#define GCC_CPUSS_AHB_CLK 30
#define GCC_CPUSS_AHB_CLK_SRC 31
#define GCC_CPUSS_AHB_POSTDIV_CLK_SRC 32
#define GCC_CPUSS_GNOC_CLK 33
#define GCC_GP1_CLK 34
#define GCC_GP1_CLK_SRC 35
#define GCC_GP2_CLK 36
#define GCC_GP2_CLK_SRC 37
#define GCC_GP3_CLK 38
#define GCC_GP3_CLK_SRC 39
#define GCC_PCIE_0_CLKREF_EN 40
#define GCC_PCIE_AUX_CLK 41
#define GCC_PCIE_AUX_CLK_SRC 42
#define GCC_PCIE_AUX_PHY_CLK_SRC 43
#define GCC_PCIE_CFG_AHB_CLK 44
#define GCC_PCIE_MSTR_AXI_CLK 45
#define GCC_PCIE_PIPE_CLK 46
#define GCC_PCIE_PIPE_CLK_SRC 47
#define GCC_PCIE_RCHNG_PHY_CLK 48
#define GCC_PCIE_RCHNG_PHY_CLK_SRC 49
#define GCC_PCIE_SLEEP_CLK 50
#define GCC_PCIE_SLV_AXI_CLK 51
#define GCC_PCIE_SLV_Q2A_AXI_CLK 52
#define GCC_PDM2_CLK 53
#define GCC_PDM2_CLK_SRC 54
#define GCC_PDM_AHB_CLK 55
#define GCC_PDM_XO4_CLK 56
#define GCC_RX1_USB2_CLKREF_EN 57
#define GCC_SDCC1_AHB_CLK 58
#define GCC_SDCC1_APPS_CLK 59
#define GCC_SDCC1_APPS_CLK_SRC 60
#define GCC_SPMI_FETCHER_AHB_CLK 61
#define GCC_SPMI_FETCHER_CLK 62
#define GCC_SPMI_FETCHER_CLK_SRC 63
#define GCC_SYS_NOC_CPUSS_AHB_CLK 64
#define GCC_USB30_MASTER_CLK 65
#define GCC_USB30_MASTER_CLK_SRC 66
#define GCC_USB30_MOCK_UTMI_CLK 67
#define GCC_USB30_MOCK_UTMI_CLK_SRC 68
#define GCC_USB30_MOCK_UTMI_POSTDIV_CLK_SRC 69
#define GCC_USB30_MSTR_AXI_CLK 70
#define GCC_USB30_SLEEP_CLK 71
#define GCC_USB30_SLV_AHB_CLK 72
#define GCC_USB3_PHY_AUX_CLK 73
#define GCC_USB3_PHY_AUX_CLK_SRC 74
#define GCC_USB3_PHY_PIPE_CLK 75
#define GCC_USB3_PHY_PIPE_CLK_SRC 76
#define GCC_USB3_PRIM_CLKREF_EN 77
#define GCC_USB_PHY_CFG_AHB2PHY_CLK 78
#define GCC_XO_DIV4_CLK 79
#define GCC_XO_PCIE_LINK_CLK 80
/* GCC resets */
#define GCC_BLSP1_QUP1_BCR 0
#define GCC_BLSP1_QUP2_BCR 1
#define GCC_BLSP1_QUP3_BCR 2
#define GCC_BLSP1_QUP4_BCR 3
#define GCC_BLSP1_UART1_BCR 4
#define GCC_BLSP1_UART2_BCR 5
#define GCC_BLSP1_UART3_BCR 6
#define GCC_BLSP1_UART4_BCR 7
#define GCC_PCIE_BCR 8
#define GCC_PCIE_LINK_DOWN_BCR 9
#define GCC_PCIE_NOCSR_COM_PHY_BCR 10
#define GCC_PCIE_PHY_BCR 11
#define GCC_PCIE_PHY_CFG_AHB_BCR 12
#define GCC_PCIE_PHY_COM_BCR 13
#define GCC_PCIE_PHY_NOCSR_COM_PHY_BCR 14
#define GCC_PDM_BCR 15
#define GCC_QUSB2PHY_BCR 16
#define GCC_SDCC1_BCR 17
#define GCC_SPMI_FETCHER_BCR 18
#define GCC_TCSR_PCIE_BCR 19
#define GCC_USB30_BCR 20
#define GCC_USB3_PHY_BCR 21
#define GCC_USB3PHY_PHY_BCR 22
#define GCC_USB_PHY_CFG_AHB2PHY_BCR 23
/* GCC power domains */
#define USB30_GDSC 0
#define PCIE_GDSC 1
#endif

View File

@ -0,0 +1,244 @@
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2021, Linaro Limited
*/
#ifndef _DT_BINDINGS_CLK_QCOM_GCC_SM8450_H
#define _DT_BINDINGS_CLK_QCOM_GCC_SM8450_H
/* GCC HW clocks */
#define CORE_BI_PLL_TEST_SE 0
#define PCIE_0_PIPE_CLK 1
#define PCIE_1_PHY_AUX_CLK 2
#define PCIE_1_PIPE_CLK 3
#define UFS_PHY_RX_SYMBOL_0_CLK 4
#define UFS_PHY_RX_SYMBOL_1_CLK 5
#define UFS_PHY_TX_SYMBOL_0_CLK 6
#define USB3_PHY_WRAPPER_GCC_USB30_PIPE_CLK 7
/* GCC clocks */
#define GCC_AGGRE_NOC_PCIE_0_AXI_CLK 8
#define GCC_AGGRE_NOC_PCIE_1_AXI_CLK 9
#define GCC_AGGRE_UFS_PHY_AXI_CLK 10
#define GCC_AGGRE_UFS_PHY_AXI_HW_CTL_CLK 11
#define GCC_AGGRE_USB3_PRIM_AXI_CLK 12
#define GCC_ANOC_PCIE_PWRCTL_CLK 13
#define GCC_BOOT_ROM_AHB_CLK 14
#define GCC_CAMERA_AHB_CLK 15
#define GCC_CAMERA_HF_AXI_CLK 16
#define GCC_CAMERA_SF_AXI_CLK 17
#define GCC_CAMERA_XO_CLK 18
#define GCC_CFG_NOC_PCIE_ANOC_AHB_CLK 19
#define GCC_CFG_NOC_USB3_PRIM_AXI_CLK 20
#define GCC_CPUSS_AHB_CLK 21
#define GCC_CPUSS_AHB_CLK_SRC 22
#define GCC_CPUSS_AHB_POSTDIV_CLK_SRC 23
#define GCC_CPUSS_CONFIG_NOC_SF_CLK 24
#define GCC_DDRSS_GPU_AXI_CLK 25
#define GCC_DDRSS_PCIE_SF_TBU_CLK 26
#define GCC_DISP_AHB_CLK 27
#define GCC_DISP_HF_AXI_CLK 28
#define GCC_DISP_SF_AXI_CLK 29
#define GCC_DISP_XO_CLK 30
#define GCC_EUSB3_0_CLKREF_EN 31
#define GCC_GP1_CLK 32
#define GCC_GP1_CLK_SRC 33
#define GCC_GP2_CLK 34
#define GCC_GP2_CLK_SRC 35
#define GCC_GP3_CLK 36
#define GCC_GP3_CLK_SRC 37
#define GCC_GPLL0 38
#define GCC_GPLL0_OUT_EVEN 39
#define GCC_GPLL4 40
#define GCC_GPLL9 41
#define GCC_GPU_CFG_AHB_CLK 42
#define GCC_GPU_GPLL0_CLK_SRC 43
#define GCC_GPU_GPLL0_DIV_CLK_SRC 44
#define GCC_GPU_MEMNOC_GFX_CLK 45
#define GCC_GPU_SNOC_DVM_GFX_CLK 46
#define GCC_PCIE_0_AUX_CLK 47
#define GCC_PCIE_0_AUX_CLK_SRC 48
#define GCC_PCIE_0_CFG_AHB_CLK 49
#define GCC_PCIE_0_CLKREF_EN 50
#define GCC_PCIE_0_MSTR_AXI_CLK 51
#define GCC_PCIE_0_PHY_RCHNG_CLK 52
#define GCC_PCIE_0_PHY_RCHNG_CLK_SRC 53
#define GCC_PCIE_0_PIPE_CLK 54
#define GCC_PCIE_0_PIPE_CLK_SRC 55
#define GCC_PCIE_0_SLV_AXI_CLK 56
#define GCC_PCIE_0_SLV_Q2A_AXI_CLK 57
#define GCC_PCIE_1_AUX_CLK 58
#define GCC_PCIE_1_AUX_CLK_SRC 59
#define GCC_PCIE_1_CFG_AHB_CLK 60
#define GCC_PCIE_1_CLKREF_EN 61
#define GCC_PCIE_1_MSTR_AXI_CLK 62
#define GCC_PCIE_1_PHY_AUX_CLK 63
#define GCC_PCIE_1_PHY_AUX_CLK_SRC 64
#define GCC_PCIE_1_PHY_RCHNG_CLK 65
#define GCC_PCIE_1_PHY_RCHNG_CLK_SRC 66
#define GCC_PCIE_1_PIPE_CLK 67
#define GCC_PCIE_1_PIPE_CLK_SRC 68
#define GCC_PCIE_1_SLV_AXI_CLK 69
#define GCC_PCIE_1_SLV_Q2A_AXI_CLK 70
#define GCC_PDM2_CLK 71
#define GCC_PDM2_CLK_SRC 72
#define GCC_PDM_AHB_CLK 73
#define GCC_PDM_XO4_CLK 74
#define GCC_QMIP_CAMERA_NRT_AHB_CLK 75
#define GCC_QMIP_CAMERA_RT_AHB_CLK 76
#define GCC_QMIP_DISP_AHB_CLK 77
#define GCC_QMIP_GPU_AHB_CLK 78
#define GCC_QMIP_PCIE_AHB_CLK 79
#define GCC_QMIP_VIDEO_CV_CPU_AHB_CLK 80
#define GCC_QMIP_VIDEO_CVP_AHB_CLK 81
#define GCC_QMIP_VIDEO_V_CPU_AHB_CLK 82
#define GCC_QMIP_VIDEO_VCODEC_AHB_CLK 83
#define GCC_QUPV3_WRAP0_CORE_2X_CLK 84
#define GCC_QUPV3_WRAP0_CORE_CLK 85
#define GCC_QUPV3_WRAP0_S0_CLK 86
#define GCC_QUPV3_WRAP0_S0_CLK_SRC 87
#define GCC_QUPV3_WRAP0_S1_CLK 88
#define GCC_QUPV3_WRAP0_S1_CLK_SRC 89
#define GCC_QUPV3_WRAP0_S2_CLK 90
#define GCC_QUPV3_WRAP0_S2_CLK_SRC 91
#define GCC_QUPV3_WRAP0_S3_CLK 92
#define GCC_QUPV3_WRAP0_S3_CLK_SRC 93
#define GCC_QUPV3_WRAP0_S4_CLK 94
#define GCC_QUPV3_WRAP0_S4_CLK_SRC 95
#define GCC_QUPV3_WRAP0_S5_CLK 96
#define GCC_QUPV3_WRAP0_S5_CLK_SRC 97
#define GCC_QUPV3_WRAP0_S6_CLK 98
#define GCC_QUPV3_WRAP0_S6_CLK_SRC 99
#define GCC_QUPV3_WRAP0_S7_CLK 100
#define GCC_QUPV3_WRAP0_S7_CLK_SRC 101
#define GCC_QUPV3_WRAP1_CORE_2X_CLK 102
#define GCC_QUPV3_WRAP1_CORE_CLK 103
#define GCC_QUPV3_WRAP1_S0_CLK 104
#define GCC_QUPV3_WRAP1_S0_CLK_SRC 105
#define GCC_QUPV3_WRAP1_S1_CLK 106
#define GCC_QUPV3_WRAP1_S1_CLK_SRC 107
#define GCC_QUPV3_WRAP1_S2_CLK 108
#define GCC_QUPV3_WRAP1_S2_CLK_SRC 109
#define GCC_QUPV3_WRAP1_S3_CLK 110
#define GCC_QUPV3_WRAP1_S3_CLK_SRC 111
#define GCC_QUPV3_WRAP1_S4_CLK 112
#define GCC_QUPV3_WRAP1_S4_CLK_SRC 113
#define GCC_QUPV3_WRAP1_S5_CLK 114
#define GCC_QUPV3_WRAP1_S5_CLK_SRC 115
#define GCC_QUPV3_WRAP1_S6_CLK 116
#define GCC_QUPV3_WRAP1_S6_CLK_SRC 117
#define GCC_QUPV3_WRAP2_CORE_2X_CLK 118
#define GCC_QUPV3_WRAP2_CORE_CLK 119
#define GCC_QUPV3_WRAP2_S0_CLK 120
#define GCC_QUPV3_WRAP2_S0_CLK_SRC 121
#define GCC_QUPV3_WRAP2_S1_CLK 122
#define GCC_QUPV3_WRAP2_S1_CLK_SRC 123
#define GCC_QUPV3_WRAP2_S2_CLK 124
#define GCC_QUPV3_WRAP2_S2_CLK_SRC 125
#define GCC_QUPV3_WRAP2_S3_CLK 126
#define GCC_QUPV3_WRAP2_S3_CLK_SRC 127
#define GCC_QUPV3_WRAP2_S4_CLK 128
#define GCC_QUPV3_WRAP2_S4_CLK_SRC 129
#define GCC_QUPV3_WRAP2_S5_CLK 130
#define GCC_QUPV3_WRAP2_S5_CLK_SRC 131
#define GCC_QUPV3_WRAP2_S6_CLK 132
#define GCC_QUPV3_WRAP2_S6_CLK_SRC 133
#define GCC_QUPV3_WRAP_0_M_AHB_CLK 134
#define GCC_QUPV3_WRAP_0_S_AHB_CLK 135
#define GCC_QUPV3_WRAP_1_M_AHB_CLK 136
#define GCC_QUPV3_WRAP_1_S_AHB_CLK 137
#define GCC_QUPV3_WRAP_2_M_AHB_CLK 138
#define GCC_QUPV3_WRAP_2_S_AHB_CLK 139
#define GCC_SDCC2_AHB_CLK 140
#define GCC_SDCC2_APPS_CLK 141
#define GCC_SDCC2_APPS_CLK_SRC 142
#define GCC_SDCC2_AT_CLK 143
#define GCC_SDCC4_AHB_CLK 144
#define GCC_SDCC4_APPS_CLK 145
#define GCC_SDCC4_APPS_CLK_SRC 146
#define GCC_SDCC4_AT_CLK 147
#define GCC_SYS_NOC_CPUSS_AHB_CLK 148
#define GCC_UFS_0_CLKREF_EN 149
#define GCC_UFS_PHY_AHB_CLK 150
#define GCC_UFS_PHY_AXI_CLK 151
#define GCC_UFS_PHY_AXI_CLK_SRC 152
#define GCC_UFS_PHY_AXI_HW_CTL_CLK 153
#define GCC_UFS_PHY_ICE_CORE_CLK 154
#define GCC_UFS_PHY_ICE_CORE_CLK_SRC 155
#define GCC_UFS_PHY_ICE_CORE_HW_CTL_CLK 156
#define GCC_UFS_PHY_PHY_AUX_CLK 157
#define GCC_UFS_PHY_PHY_AUX_CLK_SRC 158
#define GCC_UFS_PHY_PHY_AUX_HW_CTL_CLK 159
#define GCC_UFS_PHY_RX_SYMBOL_0_CLK 160
#define GCC_UFS_PHY_RX_SYMBOL_0_CLK_SRC 161
#define GCC_UFS_PHY_RX_SYMBOL_1_CLK 162
#define GCC_UFS_PHY_RX_SYMBOL_1_CLK_SRC 163
#define GCC_UFS_PHY_TX_SYMBOL_0_CLK 164
#define GCC_UFS_PHY_TX_SYMBOL_0_CLK_SRC 165
#define GCC_UFS_PHY_UNIPRO_CORE_CLK 166
#define GCC_UFS_PHY_UNIPRO_CORE_CLK_SRC 167
#define GCC_UFS_PHY_UNIPRO_CORE_HW_CTL_CLK 168
#define GCC_USB30_PRIM_MASTER_CLK 169
#define GCC_USB30_PRIM_MASTER_CLK_SRC 170
#define GCC_USB30_PRIM_MOCK_UTMI_CLK 171
#define GCC_USB30_PRIM_MOCK_UTMI_CLK_SRC 172
#define GCC_USB30_PRIM_MOCK_UTMI_POSTDIV_CLK_SRC 173
#define GCC_USB30_PRIM_SLEEP_CLK 174
#define GCC_USB3_0_CLKREF_EN 175
#define GCC_USB3_PRIM_PHY_AUX_CLK 176
#define GCC_USB3_PRIM_PHY_AUX_CLK_SRC 177
#define GCC_USB3_PRIM_PHY_COM_AUX_CLK 178
#define GCC_USB3_PRIM_PHY_PIPE_CLK 179
#define GCC_USB3_PRIM_PHY_PIPE_CLK_SRC 180
#define GCC_VIDEO_AHB_CLK 181
#define GCC_VIDEO_AXI0_CLK 182
#define GCC_VIDEO_AXI1_CLK 183
#define GCC_VIDEO_XO_CLK 184
/* GCC resets */
#define GCC_CAMERA_BCR 0
#define GCC_DISPLAY_BCR 1
#define GCC_GPU_BCR 2
#define GCC_MMSS_BCR 3
#define GCC_PCIE_0_BCR 4
#define GCC_PCIE_0_LINK_DOWN_BCR 5
#define GCC_PCIE_0_NOCSR_COM_PHY_BCR 6
#define GCC_PCIE_0_PHY_BCR 7
#define GCC_PCIE_0_PHY_NOCSR_COM_PHY_BCR 8
#define GCC_PCIE_1_BCR 9
#define GCC_PCIE_1_LINK_DOWN_BCR 10
#define GCC_PCIE_1_NOCSR_COM_PHY_BCR 11
#define GCC_PCIE_1_PHY_BCR 12
#define GCC_PCIE_1_PHY_NOCSR_COM_PHY_BCR 13
#define GCC_PCIE_PHY_BCR 14
#define GCC_PCIE_PHY_CFG_AHB_BCR 15
#define GCC_PCIE_PHY_COM_BCR 16
#define GCC_PDM_BCR 17
#define GCC_QUPV3_WRAPPER_0_BCR 18
#define GCC_QUPV3_WRAPPER_1_BCR 19
#define GCC_QUPV3_WRAPPER_2_BCR 20
#define GCC_QUSB2PHY_PRIM_BCR 21
#define GCC_QUSB2PHY_SEC_BCR 22
#define GCC_SDCC2_BCR 23
#define GCC_SDCC4_BCR 24
#define GCC_UFS_PHY_BCR 25
#define GCC_USB30_PRIM_BCR 26
#define GCC_USB3_DP_PHY_PRIM_BCR 27
#define GCC_USB3_DP_PHY_SEC_BCR 28
#define GCC_USB3_PHY_PRIM_BCR 29
#define GCC_USB3_PHY_SEC_BCR 30
#define GCC_USB3PHY_PHY_PRIM_BCR 31
#define GCC_USB3PHY_PHY_SEC_BCR 32
#define GCC_USB_PHY_CFG_AHB2PHY_BCR 33
#define GCC_VIDEO_AXI0_CLK_ARES 34
#define GCC_VIDEO_AXI1_CLK_ARES 35
#define GCC_VIDEO_BCR 36
/* GCC power domains */
#define PCIE_0_GDSC 0
#define PCIE_1_GDSC 1
#define UFS_PHY_GDSC 2
#define USB30_PRIM_GDSC 3
#endif