From: Shawn Lin <shawn.lin@rock-chips.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: shawn.lin@rock-chips.com, Rob Herring <robh+dt@kernel.org>,
"James E . J . Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
Avri Altman <avri.altman@wdc.com>,
Bart Van Assche <bvanassche@acm.org>,
YiFeng Zhao <zyf@rock-chips.com>, Liang Chen <cl@rock-chips.com>,
linux-scsi@vger.kernel.org, linux-rockchip@lists.infradead.org,
devicetree@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v4 7/7] scsi: ufs: rockchip: initial support for UFS
Date: Tue, 5 Nov 2024 09:54:16 +0800 [thread overview]
Message-ID: <7dc6d164-ced4-4c9b-888f-7345e8e52298@rock-chips.com> (raw)
In-Reply-To: <CAPDyKFrig236e5xTSeOHfNR5Z3840o6u_h7LnoAG2P8Ck348WQ@mail.gmail.com>
在 2024/11/4 18:57, Ulf Hansson 写道:
> On Mon, 4 Nov 2024 at 08:34, Shawn Lin <shawn.lin@rock-chips.com> wrote:
>>
>> RK3576 SoC contains a UFS controller, add initial support for it.
>> The features are:
>> (1) support UFS 2.0 features
>> (2) High speed up to HS-G3
>> (3) 2RX-2TX lanes
>> (4) auto H8 entry and exit
>>
>> Software limitation:
>> (1) HCE procedure: enable controller->enable intr->dme_reset->dme_enable
>> (2) disable unipro timeout values before power mode change
>>
>> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>> ---
>>
>> Changes in v4:
>> - deal with power domain of rpm and spm suggested by Ulf
>> - Fix typo and disable clks in ufs_rockchip_remove
>> - remove clk_disable_unprepare(host->ref_out_clk) from
>> ufs_rockchip_remove
>>
>
> [...]
>
>> +#ifdef CONFIG_PM
>> +static int ufs_rockchip_runtime_suspend(struct device *dev)
>> +{
>> + struct ufs_hba *hba = dev_get_drvdata(dev);
>> + struct ufs_rockchip_host *host = ufshcd_get_variant(hba);
>> +
>> + clk_disable_unprepare(host->ref_out_clk);
>> +
>> + /* Shouldn't power down if rpm_lvl is less than level 5. */
>> + dev_pm_genpd_rpm_always_on(dev, hba->rpm_lvl < UFS_PM_LVL_5 ? true : false);
>> +
>> + return ufshcd_runtime_suspend(dev);
>> +}
>> +
>> +static int ufs_rockchip_runtime_resume(struct device *dev)
>> +{
>> + struct ufs_hba *hba = dev_get_drvdata(dev);
>> + struct ufs_rockchip_host *host = ufshcd_get_variant(hba);
>> + int err;
>> +
>> + err = clk_prepare_enable(host->ref_out_clk);
>> + if (err) {
>> + dev_err(hba->dev, "failed to enable ref out clock %d\n", err);
>> + return err;
>> + }
>> +
>> + reset_control_assert(host->rst);
>> + usleep_range(1, 2);
>> + reset_control_deassert(host->rst);
>> +
>> + return ufshcd_runtime_resume(dev);
>> +}
>> +#endif
>> +
>> +#ifdef CONFIG_PM_SLEEP
>> +static int ufs_rockchip_system_suspend(struct device *dev)
>> +{
>> + struct ufs_hba *hba = dev_get_drvdata(dev);
>> +
>> + if (hba->spm_lvl < 5)
>> + device_set_wakeup_path(dev);
>
> Please use device_set_awake_path() instead.
>
> Ideally all users of device_set_wakeup_path() should convert into
> device_set_awake_path(), it's just that we haven't been able to
> complete the conversion yet.
Will use device_set_awake_path().
>
>> + else
>> + device_clr_wakeup_path(dev);
>
> This isn't needed. The flag is getting cleared in device_prepare().
>
>> +
>> + return ufshcd_system_suspend(dev);
>
> Don't you want to disable the clock during system suspend too? If the
> device is runtime resumed at this point, the clock will be left
> enabled, no?
Good point. Will fix it.
>
>> +}
>> +#endif
>> +
>> +static const struct dev_pm_ops ufs_rockchip_pm_ops = {
>> + SET_SYSTEM_SLEEP_PM_OPS(ufs_rockchip_system_suspend, ufshcd_system_resume)
>> + SET_RUNTIME_PM_OPS(ufs_rockchip_runtime_suspend, ufs_rockchip_runtime_resume, NULL)
>> + .prepare = ufshcd_suspend_prepare,
>> + .complete = ufshcd_resume_complete,
>> +};
>> +
>
> [...]
>
> Kind regards
> Uffe
>
next prev parent reply other threads:[~2024-11-05 6:30 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-04 7:31 [PATCH v4 0/7] Initial support for RK3576 UFS controller Shawn Lin
2024-11-04 7:31 ` [PATCH v4 1/7] scsi: ufs: core: Add UFSHCI_QUIRK_DME_RESET_ENABLE_AFTER_HCE Shawn Lin
2024-11-07 15:51 ` Manivannan Sadhasivam
2024-11-08 1:04 ` Shawn Lin
2024-11-04 7:31 ` [PATCH v4 2/7] dt-bindings: ufs: Document Rockchip UFS host controller Shawn Lin
2024-11-07 15:42 ` Manivannan Sadhasivam
2024-11-04 7:31 ` [PATCH v4 3/7] soc: rockchip: add header for suspend mode SIP interface Shawn Lin
2024-11-04 7:31 ` [PATCH v4 4/7] pmdomain: core: Introduce dev_pm_genpd_rpm_always_on() Shawn Lin
2024-11-04 19:04 ` kernel test robot
2024-11-04 20:17 ` kernel test robot
2024-11-08 14:19 ` Dan Carpenter
2024-11-04 7:31 ` [PATCH v4 5/7] pmdomain: rockchip: Add smc call to inform firmware Shawn Lin
2024-11-04 7:32 ` [PATCH v4 6/7] PM: wakeup: Add device_clr_wakeup_path() Shawn Lin
2024-11-04 7:32 ` [PATCH v4 7/7] scsi: ufs: rockchip: initial support for UFS Shawn Lin
2024-11-04 10:57 ` Ulf Hansson
2024-11-05 1:54 ` Shawn Lin [this message]
2024-11-09 12:12 ` Manivannan Sadhasivam
2024-11-11 1:10 ` Shawn Lin
2024-11-12 6:43 ` Manivannan Sadhasivam
2024-11-12 6:51 ` Shawn Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7dc6d164-ced4-4c9b-888f-7345e8e52298@rock-chips.com \
--to=shawn.lin@rock-chips.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=bvanassche@acm.org \
--cc=cl@rock-chips.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=krzk+dt@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=martin.petersen@oracle.com \
--cc=rafael@kernel.org \
--cc=robh+dt@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=zyf@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox