Talk about UFS initialization and startup

This section talks about UFS initialization.

Initialization and startup includes three stages: partial initialization, loading startup code (optional), and initialization completion.

Partial initialization phase

This stage starts at power-up or device restart, and it involves the initialization of the entire UFS stack.

After this initialization phase is completed, the entire physical layer (M-PHY) and data link layer (UniPro) should be initialized, the transport layer can interact with the host Read command and "TEST UNIT READY" command (the host sends this command to the device Check if the device is ready), the host can also access the device descriptor (Device Descriptor) through the device manager to obtain device configuration information.

Load startup code

If the startup code is not stored on the UFS device, there is no such stage. How does the host know if the startup code is stored on the UFS device?

After the initialization in the previous stage, the host can access the device descriptor to obtain the "bBootLunEn" attribute, and read this attribute to know whether the startup code is on the UFS device and which Boot LU it is on.

If bBootLunEn = 01h or 02h, the boot code is stored on the UFS device. Since Boot LU is mapped to ordinary LU, to read the boot code, you also need to know the mapping between Boot LU and the stored boot code LU. The host can know by reading the unit descriptor (Unit Descriptor), such as:

After finding the specific storage code LU, the host can read the LU to obtain the startup code.

loading finished

When the host completes the first two stages, the host will set fDeviceInit = 1 for the device through the device manager. This is a flag to initialize. After the host sets the flag, it will always query the value of the flag there.

At the same time, the firmware of the UFS device continues to complete its initialization. When the device completes initialization and thinks that it can respond to any command or request from the host, it clears fDeviceInit, that is, fDeviceInit = 0.

When the host queries fDeviceInit = 0, it can send any command or request in any UFS protocol to the UFS device.

At this point, the entire UFS initialization and startup is complete.

The following figure specifically shows the UFS initialization and startup process (optional, Opt):

Explain this startup process again:

The host powers on the device or restarts the device. Then the physical layer and data link layer of the host and the device are initialized. After that, the host pings the device (via NOP OUT UPIU) to confirm that the two sides of the device are properly connected. The device receives NOP OUT UPIU and should return NOP IN UPIU, indicating that there is no problem with the connection between the two parties.

Loading the startup code is optional (steps in the blue box above). The host reads the UFS device descriptor. If bDescrAccessEn = 0, the device descriptor is not accessible. Then, even if the startup code is stored on the UFS device, we cannot load the startup code at this stage because information such as bBootEnable and bBootLunEn cannot Obtained, the host cannot know on which LU the storage code is stored. Therefore, if bDescrAccessEn = 0, the loading startup code stage should not be placed here, but after the device is completely initialized.

In the stage of loading the startup code, the host obtains the LU on which the startup code is by reading the device descriptor, and then sends a tentative command "TEST UNIT READY" to the LU to see if the LU is ready. If the Boot LU is ready, the host sends the READ command to the device to load the startup code.

Then, the host sets fDeviceInit = 1, and then polls the flag all the time. Once fDeviceInit becomes 0, the flag UFS device initialization is complete.

Finally, the content of the interaction between the two parties during the device initialization process is summarized:

Laptop Holder Apple

Apple Laptop Holder For Desk,Apple Laptop Holder,Apple Laptop Holder Dock,Apple Pencil Holder Laptop,etc.

Shenzhen Chengrong Technology Co.ltd is a high-quality enterprise specializing in metal stamping and CNC production for 12 years. The company mainly aims at the R&D, production and sales of Notebook Laptop Stands and Mobile Phone Stands. From the mold design and processing to machining and product surface oxidation, spraying treatment etc ,integration can fully meet the various processing needs of customers. Have a complete and scientific quality management system, strength and product quality are recognized and trusted by the industry, to meet changing economic and social needs .

Laptop Stands And Risers

Apple Laptop Holder For Desk,Apple Laptop Holder,Apple Laptop Holder Dock,Apple Pencil Holder Laptop

Shenzhen ChengRong Technology Co.,Ltd. , https://www.laptopstandsuppliers.com