[PATCH v4 2/2] ufs: qcom: add ufs host regulator support

Federico Amedeo Izzo federico at izzo.pro
Mon May 25 21:41:00 CEST 2026


Il 2026-05-25 14:12 Neha Malcom Francis ha scritto:

> On Sat, 23 May 2026 15:04:25 +0200, Federico Amedeo Izzo 
> <federico at izzo.pro> wrote:
> 
>> diff --git a/drivers/ufs/ufs-qcom.c b/drivers/ufs/ufs-qcom.c
>> index dc40ee62daf..0e2e45f1075 100644
>> --- a/drivers/ufs/ufs-qcom.c
>> +++ b/drivers/ufs/ufs-qcom.c
>> @@ -561,6 +562,19 @@ static int ufs_qcom_init(struct ufs_hba *hba)
>> 
>> priv->hba = hba;
>> 
>> +    /* enable regulators */
>> +    err = regulator_set_enable(priv->vcc, true);
>> +    if (err && err != -ENOSYS)
>> +        dev_warn(hba->dev, "failed to enable regulator 
>> vcc-supply:%d\n", err);
>> +
>> +    err = regulator_set_enable(priv->vccq, true);
>> +    if (err && err != -ENOSYS)
>> +        dev_warn(hba->dev, "failed to enable regulator 
>> vccq-supply:%d\n", err);
>> +
>> +    err = regulator_set_enable(priv->vccq2, true);
>> +    if (err && err != -ENOSYS)
>> +        dev_warn(hba->dev, "failed to enable regulator 
>> vccq2-supply:%d\n", err);
> 
> vccq2 is optional right? Is it verified that the optional code route 
> will never
> return ENOSYS and there is handling in regulator_set_enable for NULL 
> regulators?

Hi,
vccq2 is indeed optional, if it's not present, regulator_set_enable() 
will handle the NULL regulator and return -ENOSYS.
The warning is skipped for -ENOSYS as we don't want to print warnings 
for non existing regulators,

Below is a section of regulator_set_enable() from regulator_uclass.c

int regulator_set_enable(struct udevice *dev, bool enable)
{
         const struct dm_regulator_ops *ops = dev_get_driver_ops(dev);
         struct dm_regulator_uclass_plat *uc_pdata;
         int ret, old_enable = 0;

         if (!ops || !ops->set_enable)
                 return -ENOSYS;
[...]

Greetings,
Federico Amedeo Izzo


More information about the U-Boot mailing list