Skip to content

Add support for UFS driver #93528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

neeliajay
Copy link

This pull request re-opens the PR: #87201

  • UFS (Universal Flash Storage) support to Zephyr
  • support for SCSI, UFS subsystems
  • AMD Versal Gen 2 UFSHC (UFS Host Controller) driver
  • UFS disk driver
  • SCSI, UFS testing
  • doc for UFSHC (UFS Host Controller) peripheral

Ajay Neeli added 2 commits May 5, 2025 17:39
Introduce core components of the SCSI subsystem, including support for
device initialization, command dispatching, and basic I/O operations.

Provide foundation for future integration with UFS and other SCSI-based
devices.

Signed-off-by: Ajay Neeli <[email protected]>
Introduce initial support for the UFS subsystem in Zephyr, providing
core infrastructure to enable UFS device functionality.

This lays the foundation for further enhancements to the UFS
subsystem in Zephyr.

Key features introduced in this patch:
 - UFS controller initialization support.
 - Handling of SCSI command transfer requests.
 - UFS device configuration support.
 - Interrupt-driven UFS operations.

Limitations:
 - Does not support task management functionality.
 - Does not include RPMB (Replay Protected Memory Block) support.
 - Asynchronous transfers are not supported.

Signed-off-by: Ajay Neeli <[email protected]>
@neeliajay
Copy link
Author

#87201 - Reopening the closed PR

@danieldegrasse
Copy link
Contributor

Generally we prefer to continue work on the original PR rather than reopening one. Are you able to reopen #87201? I am not able to, that may be because the "Allow edits by maintainers" box isn't checked on that PR but I'm unable to see that from my side. Example of the box I'm referring to:

image

@neeliajay
Copy link
Author

No.. i cannot open: #87201

@rruuaanng
Copy link
Contributor

@danieldegrasse @neeliajay
Look this :). It seems to refer to the current.
image

Ajay Neeli added 2 commits August 6, 2025 16:18
Add amd,versal2-ufs.yaml for AMD Versal Gen 2 UFS Host Controller.
Add ufs-common.yaml for common properties of UFS Host Controllers.

Signed-off-by: Ajay Neeli <[email protected]>
Add support for the UFS Host Controller (UFSHC) driver on the AMD Versal
Gen 2 platform.

The implementation includes necessary configurations for M-PHY, RMMI,
and Unipro, as well as programming of vendor-specific registers during
controller initialization.

Signed-off-by: Ajay Neeli <[email protected]>
@neeliajay neeliajay force-pushed the feature/ufs-support branch from 565ef0b to ddc6f20 Compare August 6, 2025 10:53
@neeliajay neeliajay requested a review from rruuaanng August 6, 2025 12:28
# SPDX-License-Identifier: Apache-2.0

description: |
This Zephyr UFS disk node binding indicates that a UFS disk device is attached
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to rephrase the description and remove node binding, as its purpose is already clearly indicated in the dts/bindings directory, making it redundant.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, rephrased it by referencing the binding descriptions from sd and mmc-disk

Ajay Neeli added 6 commits August 7, 2025 10:32
Add device tree binding for UFS disks in Zephyr, enabling interaction
with UFS storage via the Zephyr disk subsystem.

This binding ensures correct handling of UFS devices, including support
for multiple LUNs, enabling filesystem operations in Zephyr.

Key properties:
 - lun: Defines the Logical Unit Number (LUN) for the UFS disk,
   defaulting to 0. This is essential for systems with multiple LUNs.
 - disk-name: A required string specifying the UFS disk's name for
   proper registration in the disk subsystem.

Signed-off-by: Ajay Neeli <[email protected]>
Add UFS disk driver, enabling interaction with UFS storage devices
via the filesystem interface.

It recognizes Logical Unit Numbers (LUNs) as separate disks and presents
UFS devices as block devices for standard filesystem operations.

This driver ensures UFS devices are recognized and usable within
Zephyr’s filesystem.

Key features:
 - Initialization: Initializes the UFS disk using LUN and disk-name
   properties from the device tree.
 - Disk Operations: Registers essential operations, including  read,
   write, and ioctl.

Signed-off-by: Ajay Neeli <[email protected]>
Add a test for the UFS subsystem to verify the functionality of UFS
stack implementation.

The test performs basic read operations on a UFS card after
initialization.

Test components:
 - Init: Verifies the UFS host controller can detect card presence and
   initialize the UFS subsystem.
 - Configuration: Ensures that the UFS stack reports a valid
   configuration for the UFS card after initialization.

Signed-off-by: Ajay Neeli <[email protected]>
Add a test to verify the SCSI subsystem's functionality with UFS
devices.

Test Components:
 - Init Test: Verifies SCSI device initialization via the UFS host
   controller.
 - IOCTL Test: Checks SCSI IOCTL operations using SG_IO.
 - R/W Test: Confirms data can be written to and read from the UFS
   device without errors.

Requirements:
 - UFS device must be connected.
 - Write operations are disabled by default (can be enabled via
   configuration).

Signed-off-by: Ajay Neeli <[email protected]>
Extend disk_access test suite to support UFS disk driver.

Signed-off-by: Ajay Neeli <[email protected]>
Add documentation for the UFS Host Controller (UFSHC) driver, which
provides a generic interface for interacting with UFS host controller
devices. It is used by the UFS subsystem to manage UFS-based storage
devices.

The documentation covers key aspects of the UFSHC, including
initialization, transfer request handling, query requests, and
configuration options, helping developers understand how to integrate
and work with the UFS subsystem effectively.

Signed-off-by: Ajay Neeli <[email protected]>
@neeliajay neeliajay force-pushed the feature/ufs-support branch from ddc6f20 to 702bad4 Compare August 7, 2025 05:03
Copy link

sonarqubecloud bot commented Aug 7, 2025

@neeliajay neeliajay requested a review from rruuaanng August 7, 2025 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants