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: add suspend and resume support

Add suspend and resume support.

The already_configured flag is cleared during the suspend stage to force
the PHY initialization during the resume stage.

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-8-f15815833974@bootlin.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Thomas Richard and committed by
Vinod Koul
0da27ed0 81472a55

+57
+57
drivers/phy/cadence/phy-cadence-torrent.c
··· 3095 3095 .num_regs = ARRAY_SIZE(sgmii_qsgmii_xcvr_diag_ln_regs), 3096 3096 }; 3097 3097 3098 + static int cdns_torrent_phy_suspend_noirq(struct device *dev) 3099 + { 3100 + struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(dev); 3101 + int i; 3102 + 3103 + reset_control_assert(cdns_phy->phy_rst); 3104 + reset_control_assert(cdns_phy->apb_rst); 3105 + for (i = 0; i < cdns_phy->nsubnodes; i++) 3106 + reset_control_assert(cdns_phy->phys[i].lnk_rst); 3107 + 3108 + if (cdns_phy->already_configured) 3109 + cdns_phy->already_configured = 0; 3110 + else { 3111 + clk_disable_unprepare(cdns_phy->clk1); 3112 + clk_disable_unprepare(cdns_phy->clk); 3113 + } 3114 + 3115 + return 0; 3116 + } 3117 + 3118 + static int cdns_torrent_phy_resume_noirq(struct device *dev) 3119 + { 3120 + struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(dev); 3121 + int node = cdns_phy->nsubnodes; 3122 + int ret, i; 3123 + 3124 + ret = cdns_torrent_clk(cdns_phy); 3125 + if (ret) 3126 + return ret; 3127 + 3128 + /* Enable APB */ 3129 + reset_control_deassert(cdns_phy->apb_rst); 3130 + 3131 + if (cdns_phy->nsubnodes > 1) { 3132 + ret = cdns_torrent_phy_configure_multilink(cdns_phy); 3133 + if (ret) 3134 + goto put_lnk_rst; 3135 + } 3136 + 3137 + return 0; 3138 + 3139 + put_lnk_rst: 3140 + for (i = 0; i < node; i++) 3141 + reset_control_assert(cdns_phy->phys[i].lnk_rst); 3142 + reset_control_assert(cdns_phy->apb_rst); 3143 + 3144 + clk_disable_unprepare(cdns_phy->clk1); 3145 + clk_disable_unprepare(cdns_phy->clk); 3146 + 3147 + return ret; 3148 + } 3149 + 3150 + static DEFINE_NOIRQ_DEV_PM_OPS(cdns_torrent_phy_pm_ops, 3151 + cdns_torrent_phy_suspend_noirq, 3152 + cdns_torrent_phy_resume_noirq); 3153 + 3098 3154 /* USB and DP link configuration */ 3099 3155 static struct cdns_reg_pairs usb_dp_link_cmn_regs[] = { 3100 3156 {0x0002, PHY_PLL_CFG}, ··· 5388 5332 .driver = { 5389 5333 .name = "cdns-torrent-phy", 5390 5334 .of_match_table = cdns_torrent_phy_of_match, 5335 + .pm = pm_sleep_ptr(&cdns_torrent_phy_pm_ops), 5391 5336 } 5392 5337 }; 5393 5338 module_platform_driver(cdns_torrent_phy_driver);