mbox series

[v5,0/3] Add UFS RTC support

Message ID 20231212220825.85255-1-beanhuo@iokpp.de (mailing list archive)
Headers show
Series Add UFS RTC support | expand

Message

Bean Huo Dec. 12, 2023, 10:08 p.m. UTC
Adding RTC support for embedded storage device UFS in its driver, it is
important for a few key reasons:

1. Helps with Regular Maintenance:
The RTC provides a basic way to keep track of time, making it useful for
scheduling routine maintenance tasks in the storage device. This includes
things like making sure data is spread
evenly across the storage to extend its life.

2. Figuring Out How Old Data Is:
The RTC helps the device estimate how long ago certain parts of the storage
were last used. This is handy for deciding when to do maintenance tasks to
keep the storage working well over time.

3. Making Devices Last Longer:
By using the RTC for regular upkeep, we can make sure the storage device lasts
longer and stays reliable. This is especially important for devices that need
to work well for a long time.

4.Fitting In with Other Devices:
The inclusion of RTC support aligns with existing UFS specifications (starting
from UFS Spec 2.0) and is consistent with the prevalent industry practice. Many
UFS devices currently on the market utilize RTC for internal timekeeping. By
ensuring compatibility with this widely adopted standard, the embedded storage
device becomes seamlessly integrable with existing hardware and software
ecosystems, reducing the risk of compatibility issues.

In short, adding RTC support to embedded storage device UFS helps with regular
upkeep, extends the device's life, ensures compatibility, and keeps everything
running smoothly with the rest of the system.

Changelog:
	v4--v5:
		1. Fix coding type issues in patch 2/3
		2. Move ufs_rtc_update_work init to ufshcd_init()
		3. Move ufshcd_state != UFSHCD_STATE_OPERATIONAL checkup out of ufshcd_is_ufs_dev_busy()
		4. Remove inline keyword
	v3--v4:
		1. Incorporate a check for "Current time precedes previous setting" in ufshcd_update_rtc()
		2. Eliminate redundant return value code in ufshcd_update_rtc().
        v2--v3:
                1. Move ufshcd_is_ufs_dev_busy() to the source file ufshcd.c in patch 1/3.
                2. Format commit statement in patch 2/3.
        v1--v2:
                1. Add a new patch "scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()"
                2. RTC periodic update work is disabled by default
                3. Address several issues raised by Avri, Bart, and Thomas.

Bean Huo (3):
  scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()
  scsi: ufs: core: Add UFS RTC support
  scsi: ufs: core: Add sysfs node for UFS RTC update

 Documentation/ABI/testing/sysfs-driver-ufs |   7 ++
 drivers/ufs/core/ufs-sysfs.c               |  31 +++++++
 drivers/ufs/core/ufshcd.c                  | 101 +++++++++++++++++++--
 include/ufs/ufs.h                          |  14 +++
 include/ufs/ufshcd.h                       |   4 +
 5 files changed, 151 insertions(+), 6 deletions(-)

Comments

Martin K. Petersen Dec. 14, 2023, 4:17 a.m. UTC | #1
Bean,

> Adding RTC support for embedded storage device UFS in its driver, it
> is important for a few key reasons:

Applied to 6.8/scsi-staging, thanks!
Martin K. Petersen Dec. 19, 2023, 2:18 a.m. UTC | #2
On Tue, 12 Dec 2023 23:08:22 +0100, Bean Huo wrote:

> Adding RTC support for embedded storage device UFS in its driver, it is
> important for a few key reasons:
> 
> 1. Helps with Regular Maintenance:
> The RTC provides a basic way to keep track of time, making it useful for
> scheduling routine maintenance tasks in the storage device. This includes
> things like making sure data is spread
> evenly across the storage to extend its life.
> 
> [...]

Applied to 6.8/scsi-queue, thanks!

[1/3] scsi: ufs: core: Add ufshcd_is_ufs_dev_busy()
      https://git.kernel.org/mkp/scsi/c/9fa268875ca4
[2/3] scsi: ufs: core: Add UFS RTC support
      https://git.kernel.org/mkp/scsi/c/6bf999e0eb41
[3/3] scsi: ufs: core: Add sysfs node for UFS RTC update
      https://git.kernel.org/mkp/scsi/c/838f595a5672