Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/hardware/peripherals/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Peripherals
stepper.rst
smbus.rst
uart.rst
ufshc.rst
usbc_vbus.rst
tcpc.rst
tgpio.rst
Expand Down
61 changes: 61 additions & 0 deletions doc/hardware/peripherals/ufshc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
.. _ufs_api:

Universal Flash Storage (UFS)
#############################

The UFS Host Controller driver api offers a generic interface for interacting
with a UFS host controller device. It is used by the UFS subsystem, and is
not intended to be directly used by the application.

UFS Host Controller (UFSHC) Overview
************************************

The UFS host controller driver is based on SCSI Framework. UFSHC is a low
level device driver for UFS subsystem. The UFS subsystem acts as an interface
between SCSI and UFS Host controllers.

The current UFS subsystem implementation supports the following functionality:

UFS controller initialization
=============================

Prepares the UFS Host Controller to transfer commands/responses between UFSHC
and UFS device.

.. _ufs-init-api:

Transfer requests
=================

It handles SCSI commands from SCSI subsystem, form UPIUs and issues UPIUs to
the UFS Host controller.

.. _ufs-scsi-api:

Query Request
=============

It handles query requests which are used to modify and retrieve configuration
information of the device.

.. _ufs-query-api:

Configuration Options
*********************

Related configuration options:

* :kconfig:option:`CONFIG_UFSHC`
* :kconfig:option:`CONFIG_UFS_STACK`
* :kconfig:option:`CONFIG_SCSI`

API Reference
*************

UFS subsystem APIs are provided by ufs.h

.. doxygengroup:: ufs_interface

UFS Host Controller (UFSHC) APIs are provided by ufshc.h

.. doxygengroup:: ufshc_interface
1 change: 1 addition & 0 deletions drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ add_subdirectory_ifdef(CONFIG_STEPPER stepper)
add_subdirectory_ifdef(CONFIG_SYSCON syscon)
add_subdirectory_ifdef(CONFIG_SYS_CLOCK_EXISTS timer)
add_subdirectory_ifdef(CONFIG_TEE tee)
add_subdirectory_ifdef(CONFIG_UFSHC ufshc)
add_subdirectory_ifdef(CONFIG_VIDEO video)
add_subdirectory_ifdef(CONFIG_VIRTUALIZATION virtualization)
add_subdirectory_ifdef(CONFIG_W1 w1)
Expand Down
1 change: 1 addition & 0 deletions drivers/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ source "drivers/spi/Kconfig"
source "drivers/stepper/Kconfig"
source "drivers/syscon/Kconfig"
source "drivers/timer/Kconfig"
source "drivers/ufshc/Kconfig"
source "drivers/usb/Kconfig"
source "drivers/usb_c/Kconfig"
source "drivers/video/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions drivers/disk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ zephyr_library()
zephyr_library_sources_ifdef(CONFIG_DISK_DRIVER_FLASH flashdisk.c)
zephyr_library_sources_ifdef(CONFIG_DISK_DRIVER_RAM ramdisk.c)
zephyr_library_sources_ifdef(CONFIG_DISK_DRIVER_LOOPBACK loopback_disk.c)
zephyr_library_sources_ifdef(CONFIG_DISK_DRIVER_UFS ufsdisk.c)

zephyr_library_sources_ifdef(CONFIG_SDMMC_STM32 sdmmc_stm32.c)
zephyr_library_sources_ifdef(CONFIG_SDMMC_SUBSYS sdmmc_subsys.c)
Expand Down
1 change: 1 addition & 0 deletions drivers/disk/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ source "drivers/disk/Kconfig.flash"
source "drivers/disk/Kconfig.sdmmc"
source "drivers/disk/Kconfig.mmc"
source "drivers/disk/Kconfig.loopback"
source "drivers/disk/Kconfig.ufs"

rsource "nvme/Kconfig"

Expand Down
30 changes: 30 additions & 0 deletions drivers/disk/Kconfig.ufs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (c) 2025 Advanced Micro Devices, Inc.
# SPDX-License-Identifier: Apache-2.0

config DISK_DRIVER_UFS
bool "Disk operations on UFS card"
default y if DT_HAS_ZEPHYR_UFS_DISK_ENABLED
select SCSI
select UFS_STACK
help
UFS device as disk driver.

if DISK_DRIVER_UFS

config UFSDISK_INIT_PRIORITY
int "Init priority"
default 90
help
UFS disk device driver initialization priority

config UFS_BUFFER_SIZE
int
default 4096
help
Size in bytes of internal buffer UFS card uses for unaligned reads.

module = UFSDISK
module-str = ufsdisk
source "subsys/logging/Kconfig.template.log_config"

endif # DISK_DRIVER_UFS
Loading