Re: [PATCH v1 1/1] scsi: ufshcd: Properly set the device Icc Level

From: nguyenb
Date: Mon Sep 14 2020 - 12:36:21 EST


On 2020-09-10 03:02, Avri Altman wrote:

On 2020-08-31 18:19, Bao D. Nguyen wrote:
> UFS version 3.0 and later devices require Vcc and Vccq power supplies
> with Vccq2 being optional. While earlier UFS version 2.0 and 2.1
> devices, the Vcc and Vccq2 are required with Vccq being optional.
> Check the required power supplies used by the device
> and set the device's supported Icc level properly.
Practically you are correct - most flash vendors moved in UFS3.1 to
1.2 supply instead of 1.8.
However, the host should provide all 3 supplies to the device because -
a) A flash vendor might want to still use 1.8 in its UFS3.1 device, and
b) We should allow a degenerated configurations, e.g. 3.1 devices,
that are degenerated to 2.1 or 2.2
Thank you for your comment.
The host can provide all 3 power supplies. However, the change is to ensure
we do not exit early and fail to properly set the Icc level because the optional power
supply is not provided.

That said, I think we can entirely remove the check in the beginning
of the function,
But not because the spec allows it, but because each supply is
explicitly checked later on,
before reading its applicable max current entry in the power descriptor.
We need these checks to prevent NULL pointer access subsequently in this function.
Thanks,
Avri