On Sun, Dec 10, 2023 at 08:15:15PM +0100, Bean Huo wrote: > On Fri, 2023-12-08 at 23:01 +0530, Manivannan Sadhasivam wrote: > > > > > > > > Thank you for your reviews. I will incorporate the suggested > > > > changes > > > > into the patch, addressing all comments except for the RTC mode > > > > switch. > > > > The proposal is to perform the RTC mode switch during UFS > > > > provisioning, > > > > not at runtime in the UFS online phase. This approach ensures > > > > that the > > > > UFS configuration is populated based on the RTC configuration > > > > established during provisioning. It is advisable not to change > > > > the RTC > > > > mode after provisioning is complete. Additionally, the usage of > > > > tv_sec, > > > > which returns time elapsed since boot, suggests that there is no > > > > issue > > > > with utilizing the RTC in this context. > > > > > > Except that the warning will be issued to users after each 10s for > > > 40 years. > > > Atleast get rid of that. > > > > > > > I tried this series on Qcom RB5 board and found the issue due to the > > usage of > > UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH flag. When this flag is > > set, > > ufshcd_device_init() will be called twice due to reinit of the > > controller and > > PHY. > > > > Since RTC work is initialized and scheduled from > > ufshcd_device_init(), panic > > happens during second time. Is it possible to move RTC init outside > > of > > ufshcd_device_init(). Maybe you can parse RTC params in > > ufshcd_device_init() > > and initialize the work elsewhere. Or you can cancel the work before > > calling > > ufshcd_device_init() second time. > > > > - Mani > > > Thank you for your review. I have moved the INIT_DELAYED_WORK(&hba- > >ufs_rtc_update_work, ufshcd_rtc_work) to ufshcd_init() from > ufs_init_rtc(). This modification has been tested on the Qcom platform. This works, thanks! - Mani > Regarding the warning, instead of removing it entirely, I have switched > it to dev_dbg. This adjustment is made with the consideration that some > form of customer notification is still necessary. > > changes as below: > > > diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c > index 953d50cc4256..cb6b0c286367 100644 > --- a/drivers/ufs/core/ufshcd.c > +++ b/drivers/ufs/core/ufshcd.c > @@ -8205,7 +8205,7 @@ static void ufshcd_update_rtc(struct ufs_hba > *hba) > ktime_get_real_ts64(&ts64); > > if (ts64.tv_sec < hba->dev_info.rtc_time_baseline) { > - dev_warn(hba->dev, "%s: Current time precedes previous > setting!\n", __func__); > + dev_dbg(hba->dev, "%s: Current time precedes previous > setting!\n", __func__); > return; > } > /* > @@ -8270,8 +8270,6 @@ static void ufs_init_rtc(struct ufs_hba *hba, u8 > *desc_buf) > * update work, and let user configure by sysfs node according > to specific circumstance. > */ > hba->dev_info.rtc_update_period = 0; > - > - INIT_DELAYED_WORK(&hba->ufs_rtc_update_work, ufshcd_rtc_work); > } > > static int ufs_get_device_desc(struct ufs_hba *hba) > @@ -10634,8 +10632,8 @@ int ufshcd_init(struct ufs_hba *hba, void > __iomem *mmio_base, unsigned int irq) > UFS_SLEEP_PWR_MODE, > > UIC_LINK_HIBERN8_STATE); > > - INIT_DELAYED_WORK(&hba->rpm_dev_flush_recheck_work, > - ufshcd_rpm_dev_flush_recheck_work); > + INIT_DELAYED_WORK(&hba->rpm_dev_flush_recheck_work, > ufshcd_rpm_dev_flush_recheck_work); > + INIT_DELAYED_WORK(&hba->ufs_rtc_update_work, ufshcd_rtc_work); > > /* Set the default auto-hiberate idle timer value to 150 ms */ > if (ufshcd_is_auto_hibern8_supported(hba) && !hba->ahit) { > > Kind regards, > Bean -- மணிவண்ணன் சதாசிவம்