Typically a command for the UFS host controller consists of a UTP Transfer Request List entry and a command table element. Thus, the host software needs to start by finding an empty slot inside the UTP Task Management Request List first.
Basic steps for setting up the Task Management Request:
- Find an empty command list slot by reading the
UFS_UTMRLDBR register.
- In case there are no empty slots, wait and try again.
- In case there is at least one empty slot, start setting up the UTP Task Management Request Descriptor:
- Write I: define whether or not an interrupt has to be generated.
- Initialize OCS with the value Fh.
- Allocate space inside the system memory for an UTP Command Descriptor.
- Repeat the above procedure for all task management commands that need to be set up.
- Check UTP Task Management Request List Run Stop
register (UFS_UTMRLRSR) and make sure it is read 1h before continuing.
- Set UTP Transfer Request Interrupt Aggregation
Control register (UFS_UTRIACR) enable bit to 1h to enable the
interrupt.
- Set the UFS_IE[9] UTMRCE bit to 1h to enable the
interrupt.
- Set UTP Task Management Request List Doorbell
register (UFS_UTMRLDBR) to ring the doorbell register to indicate to the UFS
host controller that one or more transfer requests are ready to be sent to
the attached device. The host software shall only write a 1h to the bit
position that corresponding to the new command. All other bit positions
within the UFS_UTMRLDBR register should be written with a 0h, which
indicates no change to their current values.
Now the UFS host controller will take over and process the command list without further software interaction.