On 2022-06-16 13:37, Stanley Chu wrote: > Support multiple VCC source in MediaTek UFS platforms. > > Two options are provided and distinguished by specific > device tree attributes as below examples, > > [Option 1: By numbering] > mediatek,ufs-vcc-by-num; > vcc-opt1-supply = <&mt6373_vbuck4_ufs>; > vcc-opt2-supply = <&mt6363_vemc>; > > [Option 2: By UFS version] > mediatek,ufs-vcc-by-ver; > vcc-ufs3-supply = <&mt6373_vbuck4_ufs>; > > Signed-off-by: Alice Chao <alice.chao@xxxxxxxxxxxx> > Signed-off-by: Peter Wang <peter.wang@xxxxxxxxxxxx> > Signed-off-by: Stanley Chu <stanley.chu@xxxxxxxxxxxx> > --- > drivers/ufs/host/ufs-mediatek.c | 46 ++++++++++++++++++++++++++++++++- > drivers/ufs/host/ufs-mediatek.h | 14 ++++++++++ > 2 files changed, 59 insertions(+), 1 deletion(-) > > diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c > index e756aba45acd..34e51c094366 100755 > --- a/drivers/ufs/host/ufs-mediatek.c > +++ b/drivers/ufs/host/ufs-mediatek.c > @@ -669,6 +669,49 @@ static u32 ufs_mtk_get_ufs_hci_version(struct ufs_hba *hba) > return hba->ufs_version; > } > > +#define MAX_VCC_NAME 30 > +static int ufs_mtk_vreg_fix_vcc(struct ufs_hba *hba) > +{ > + struct ufs_vreg_info *info = &hba->vreg_info; > + struct device_node *np = hba->dev->of_node; > + struct device *dev = hba->dev; > + char vcc_name[MAX_VCC_NAME]; > + struct arm_smccc_res res; > + int err, ver; > + > + if (hba->vreg_info.vcc) > + return 0; > + > + if (of_property_read_bool(np, "mediatek,ufs-vcc-by-num")) { > + ufs_mtk_get_vcc_num(res); > + if (res.a1 > UFS_VCC_NONE && res.a1 < UFS_VCC_MAX) > + snprintf(vcc_name, MAX_VCC_NAME, "vcc-opt%u", res.a1); Building this showes the following build warning/error drivers/ufs/host/ufs-mediatek.c: In function 'ufs_mtk_vreg_fix_vcc': drivers/ufs/host/ufs-mediatek.c:688:67: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Werror=format=] 688 | snprintf(vcc_name, MAX_VCC_NAME, "vcc-opt%u", res.a1); | ~^ ~~~~~~ | | | | | long unsigned int | unsigned int | %lu cc1: all warnings being treated as errors Cheers, Anders