Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: qcom: cmnpll: Add IPQ5424 SoC support

The CMN PLL in IPQ5424 SoC supplies the fixed clock to NSS at 300 MHZ
and to PPE at 375 MHZ. Other output clocks from CMN PLL on this SoC,
and their rates are same as IPQ9574.

Acked-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Luo Jie <quic_luoj@quicinc.com>
Link: https://lore.kernel.org/r/20250610-qcom_ipq5424_cmnpll-v3-2-ceada8165645@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>

authored by

Luo Jie and committed by
Bjorn Andersson
a2afa4c3 c1e21ccf

+30 -5
+30 -5
drivers/clk/qcom/ipq-cmn-pll.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 3 + * Copyright (c) 2024-2025 Qualcomm Innovation Center, Inc. All rights reserved. 4 4 */ 5 5 6 6 /* ··· 15 15 * and one clock with 353 MHZ to PPE. The other fixed rate output clocks 16 16 * are supplied to GCC (24 MHZ as XO and 32 KHZ as sleep clock), and to PCS 17 17 * with 31.25 MHZ. 18 + * 19 + * On the IPQ5424 SoC, there is an output clock from CMN PLL to PPE at 375 MHZ, 20 + * and an output clock to NSS (network subsystem) at 300 MHZ. The other output 21 + * clocks from CMN PLL on IPQ5424 are the same as IPQ9574. 18 22 * 19 23 * +---------+ 20 24 * | GCC | ··· 50 46 #include <linux/regmap.h> 51 47 52 48 #include <dt-bindings/clock/qcom,ipq-cmn-pll.h> 49 + #include <dt-bindings/clock/qcom,ipq5424-cmn-pll.h> 53 50 54 51 #define CMN_PLL_REFCLK_SRC_SELECTION 0x28 55 52 #define CMN_PLL_REFCLK_SRC_DIV GENMASK(9, 8) ··· 120 115 CLK_PLL_OUTPUT(ETH1_50MHZ_CLK, "eth1-50mhz", 50000000UL), 121 116 CLK_PLL_OUTPUT(ETH2_50MHZ_CLK, "eth2-50mhz", 50000000UL), 122 117 CLK_PLL_OUTPUT(ETH_25MHZ_CLK, "eth-25mhz", 25000000UL), 118 + { /* Sentinel */ } 119 + }; 120 + 121 + static const struct cmn_pll_fixed_output_clk ipq5424_output_clks[] = { 122 + CLK_PLL_OUTPUT(IPQ5424_XO_24MHZ_CLK, "xo-24mhz", 24000000UL), 123 + CLK_PLL_OUTPUT(IPQ5424_SLEEP_32KHZ_CLK, "sleep-32khz", 32000UL), 124 + CLK_PLL_OUTPUT(IPQ5424_PCS_31P25MHZ_CLK, "pcs-31p25mhz", 31250000UL), 125 + CLK_PLL_OUTPUT(IPQ5424_NSS_300MHZ_CLK, "nss-300mhz", 300000000UL), 126 + CLK_PLL_OUTPUT(IPQ5424_PPE_375MHZ_CLK, "ppe-375mhz", 375000000UL), 127 + CLK_PLL_OUTPUT(IPQ5424_ETH0_50MHZ_CLK, "eth0-50mhz", 50000000UL), 128 + CLK_PLL_OUTPUT(IPQ5424_ETH1_50MHZ_CLK, "eth1-50mhz", 50000000UL), 129 + CLK_PLL_OUTPUT(IPQ5424_ETH2_50MHZ_CLK, "eth2-50mhz", 50000000UL), 130 + CLK_PLL_OUTPUT(IPQ5424_ETH_25MHZ_CLK, "eth-25mhz", 25000000UL), 131 + { /* Sentinel */ } 123 132 }; 124 133 125 134 /* ··· 316 297 317 298 static int ipq_cmn_pll_register_clks(struct platform_device *pdev) 318 299 { 319 - const struct cmn_pll_fixed_output_clk *fixed_clk; 300 + const struct cmn_pll_fixed_output_clk *p, *fixed_clk; 320 301 struct clk_hw_onecell_data *hw_data; 321 302 struct device *dev = &pdev->dev; 322 303 struct clk_hw *cmn_pll_hw; ··· 324 305 struct clk_hw *hw; 325 306 int ret, i; 326 307 327 - fixed_clk = ipq9574_output_clks; 328 - num_clks = ARRAY_SIZE(ipq9574_output_clks); 308 + fixed_clk = device_get_match_data(dev); 309 + if (!fixed_clk) 310 + return -EINVAL; 311 + 312 + num_clks = 0; 313 + for (p = fixed_clk; p->name; p++) 314 + num_clks++; 329 315 330 316 hw_data = devm_kzalloc(dev, struct_size(hw_data, hws, num_clks + 1), 331 317 GFP_KERNEL); ··· 439 415 }; 440 416 441 417 static const struct of_device_id ipq_cmn_pll_clk_ids[] = { 442 - { .compatible = "qcom,ipq9574-cmn-pll", }, 418 + { .compatible = "qcom,ipq9574-cmn-pll", .data = &ipq9574_output_clks }, 419 + { .compatible = "qcom,ipq5424-cmn-pll", .data = &ipq5424_output_clks }, 443 420 { } 444 421 }; 445 422 MODULE_DEVICE_TABLE(of, ipq_cmn_pll_clk_ids);