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

Configure Feed

Select the types of activity you want to include in your feed.

phy: cadence-torrent: extract calls to clk_get from cdns_torrent_clk

Extract calls to clk_get from cdns_torrent_clk into a separate function.
It needs to call cdns_torrent_clk at resume without looking up the clock.

Co-developed-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: https://lore.kernel.org/r/20240412-j7200-phy-s2r-v1-4-f15815833974@bootlin.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Thomas Richard and committed by
Vinod Koul
c2286092 b5539abd

+21 -16
+21 -16
drivers/phy/cadence/phy-cadence-torrent.c
··· 2699 2699 return 0; 2700 2700 } 2701 2701 2702 + static int cdns_torrent_of_get_clk(struct cdns_torrent_phy *cdns_phy) 2703 + { 2704 + /* refclk: Input reference clock for PLL0 */ 2705 + cdns_phy->clk = devm_clk_get(cdns_phy->dev, "refclk"); 2706 + if (IS_ERR(cdns_phy->clk)) 2707 + return dev_err_probe(cdns_phy->dev, PTR_ERR(cdns_phy->clk), 2708 + "phy ref clock not found\n"); 2709 + 2710 + /* refclk1: Input reference clock for PLL1 */ 2711 + cdns_phy->clk1 = devm_clk_get_optional(cdns_phy->dev, "pll1_refclk"); 2712 + if (IS_ERR(cdns_phy->clk1)) 2713 + return dev_err_probe(cdns_phy->dev, PTR_ERR(cdns_phy->clk1), 2714 + "phy PLL1 ref clock not found\n"); 2715 + 2716 + return 0; 2717 + } 2718 + 2702 2719 static int cdns_torrent_clk(struct cdns_torrent_phy *cdns_phy) 2703 2720 { 2704 - struct device *dev = cdns_phy->dev; 2705 2721 unsigned long ref_clk1_rate; 2706 2722 unsigned long ref_clk_rate; 2707 2723 int ret; 2708 - 2709 - /* refclk: Input reference clock for PLL0 */ 2710 - cdns_phy->clk = devm_clk_get(dev, "refclk"); 2711 - if (IS_ERR(cdns_phy->clk)) { 2712 - dev_err(dev, "phy ref clock not found\n"); 2713 - return PTR_ERR(cdns_phy->clk); 2714 - } 2715 2724 2716 2725 ret = clk_prepare_enable(cdns_phy->clk); 2717 2726 if (ret) { ··· 2751 2742 default: 2752 2743 dev_err(cdns_phy->dev, "Invalid ref clock rate\n"); 2753 2744 ret = -EINVAL; 2754 - goto disable_clk; 2755 - } 2756 - 2757 - /* refclk1: Input reference clock for PLL1 */ 2758 - cdns_phy->clk1 = devm_clk_get_optional(dev, "pll1_refclk"); 2759 - if (IS_ERR(cdns_phy->clk1)) { 2760 - dev_err(dev, "phy PLL1 ref clock not found\n"); 2761 - ret = PTR_ERR(cdns_phy->clk1); 2762 2745 goto disable_clk; 2763 2746 } 2764 2747 ··· 2846 2845 ret = cdns_torrent_clk_register(cdns_phy); 2847 2846 if (ret) 2848 2847 return ret; 2848 + 2849 + ret = cdns_torrent_of_get_clk(cdns_phy); 2850 + if (ret) 2851 + goto clk_cleanup; 2849 2852 2850 2853 regmap_field_read(cdns_phy->phy_pma_cmn_ctrl_1, &already_configured); 2851 2854