Re: [PATCH 11/14] phy: cadence-torrent: add suspend and resume support

From: Thomas Richard
Date: Mon Jan 22 2024 - 09:28:30 EST


Hello Philipp,

On 1/17/24 16:12, Philipp Zabel wrote:
> Hi Thomas,
>
> On Mo, 2024-01-15 at 17:14 +0100, Thomas Richard wrote:
>> Add suspend and resume support.
>> The alread_configured flag is cleared during suspend stage to force the
>> phy initialization during the resume stage.
>>
>> Based on the work of Théo Lebrun <theo.lebrun@xxxxxxxxxxx>
>>
>> Signed-off-by: Thomas Richard <thomas.richard@xxxxxxxxxxx>
>> ---
>> drivers/phy/cadence/phy-cadence-torrent.c | 57 +++++++++++++++++++++++++++++++
>> 1 file changed, 57 insertions(+)
>>
>> diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
>> index 70413fca5776..31b2594e5942 100644
>> --- a/drivers/phy/cadence/phy-cadence-torrent.c
>> +++ b/drivers/phy/cadence/phy-cadence-torrent.c
>> @@ -3006,6 +3006,62 @@ static void cdns_torrent_phy_remove(struct platform_device *pdev)
> [...]
>> +static int cdns_torrent_phy_resume_noirq(struct device *dev)
>> +{
>> + struct cdns_torrent_phy *cdns_phy = dev_get_drvdata(dev);
>> + int node = cdns_phy->nsubnodes;
>> + int ret, i;
>> +
>> + ret = cdns_torrent_clk(cdns_phy);
>> + if (ret)
>> + goto clk_cleanup;
>> +
>> + /* Enable APB */
>> + reset_control_deassert(cdns_phy->apb_rst);
>> +
>> + if (cdns_phy->nsubnodes > 1) {
>> + ret = cdns_torrent_phy_configure_multilink(cdns_phy);
>> + if (ret)
>> + goto put_lnk_rst;
>> + }
>> +
>> + return 0;
>> +
>> +put_lnk_rst:
>> + for (i = 0; i < node; i++)
>> + reset_control_put(cdns_phy->phys[i].lnk_rst);
>
> What is this intended to do? I expect this to explode in _remove, where
> the lnk_rst are put again. Should this be:
>
> reset_control_assert(cdns_phy->phys[i].lnk_rst);
>
> ?

Yes indeed, it's reset_control_assert instead of reset_control_put.

Thanks for the review.

Regards,

--
Thomas Richard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com