ufs: mediatek: Fix probe failure on MT8395 SoC
cover ufs: mediatek: Fix probe failure on MT8395 SoC
Hello,
This series fixes probe failure on MT8395 SoC caused by LSDBS field in the CAP register being set while the controller only support UFSHCI 2.1.
This is based on 6.11/scsi-fixes as it requires the LSDBS quirk from [1].
This was tested on a Radxa NIO 12L with [2] and appropriate dt changes.
[1]https://lore.kernel.org/linux-scsi/[email protected]/ [2]https://lore.kernel.org/all/[email protected]/
Mary Guillemard (1):
scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
drivers/ufs/host/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+)
base-commit: cbaac68987b8699397df29413b33bd51f5255255
Signature · 1 line
2.46.0
PATCH 1/1 scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
MT8183 supports UFSHCI 2.1 spec, but report a bogus value of 1 in the reserved part for the Legacy Single Doorbell Support (LSDBS) capability.
This set UFSHCD_QUIRK_BROKEN_LSDBS_CAP when MCQ support is explicitly disabled, allowing the device to be properly registered.
--- drivers/ufs/host/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ufs/host/ufs-mediatek.c +3 -0
@@ -1026,6 +1026,9 @@ static int ufs_mtk_init(struct ufs_hba *hba)if (host->caps &UFS_MTK_CAP_DISABLE_AH8 ) hba->caps |=UFSHCD_CAP_HIBERN8_WITH_CLK_GATING ; +if (host->caps &UFS_MTK_CAP_DISABLE_MCQ ) + hba->quirks |=UFSHCD_QUIRK_BROKEN_LSDBS_CAP ; +ufs_mtk_init_clocks (hba);/*
Signature · 1 line
2.46.0
Re: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
Quoted 3 lines · Mary Guillemard
MT8183 supports UFSHCI 2.1 spec, but report a bogus value of 1 in the reserved part for the Legacy Single Doorbell Support (LSDBS) capability.
Wow... I never thought that this quirk will be used outside of Qcom SoCs...
Quoted 13 lines
This set
UFSHCD_QUIRK_BROKEN_LSDBS_CAPwhen MCQ support is explicitly disabled, allowing the device to be properly registered.Signed-off-by Mary Guillemard <[email protected]>--- drivers/ufs/host/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+)drivers/ufs/host/ufs-mediatek.c +0
-0
drivers/ufs/host/ufs-mediatek.c static int ufs_mtk_init(struct ufs_hba *hba) · line 1029
Quoted 4 lines
drivers/ufs/host/ufs-mediatek.c +1
-0@@ -1026,6 +1026,9 @@ static int ufs_mtk_init(struct ufs_hba *hba)if (host->caps &UFS_MTK_CAP_DISABLE_AH8 ) hba->caps |=UFSHCD_CAP_HIBERN8_WITH_CLK_GATING ; +if (host->caps &UFS_MTK_CAP_DISABLE_MCQ )
How can this be the deciding factor? You said above that the issue is with MT8183 SoC. So why not just use the quirk only for that platform?
- Mani
Quoted 9 lines
drivers/ufs/host/ufs-mediatek.c +2
-0+ hba->quirks |=UFSHCD_QUIRK_BROKEN_LSDBS_CAP ; +ufs_mtk_init_clocks (hba);/* Signature · 1 line
2.46.0
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
Quoted 7 lines · Manivannan Sadhasivam
Quoted 3 lines · Mary Guillemard
MT8183 supports UFSHCI 2.1 spec, but report a bogus value of 1 in the reserved part for the Legacy Single Doorbell Support (LSDBS) capability.
Wow... I never thought that this quirk will be used outside of Qcom SoCs...
Yeah I found that by trial and error some weeks ago and noticed your serie while looking to upstream this change, quite funny to see other vendors having the same quirk here.
Quoted 16 lines
Quoted 16 lines
This set
UFSHCD_QUIRK_BROKEN_LSDBS_CAPwhen MCQ support is explicitly disabled, allowing the device to be properly registered.Signed-off-by Mary Guillemard <[email protected]>--- drivers/ufs/host/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+)drivers/ufs/host/ufs-mediatek.c +0
-0@@ -1026,6 +1026,9 @@ static int ufs_mtk_init(struct ufs_hba *hba)if (host->caps &UFS_MTK_CAP_DISABLE_AH8 ) hba->caps |=UFSHCD_CAP_HIBERN8_WITH_CLK_GATING ;
Quoted 7 lines
drivers/ufs/host/ufs-mediatek.c static int ufs_mtk_init(struct ufs_hba *hba) · line 1029
Quoted 1 line
drivers/ufs/host/ufs-mediatek.c +1
-0+if (host->caps &UFS_MTK_CAP_DISABLE_MCQ )How can this be the deciding factor? You said above that the issue is with MT8183 SoC. So why not just use the quirk only for that platform?
- Mani
So my current assumption is that it also affect other Mediatek SoCs that are also based on UFS 2.1 spec but I cannot check this.
Instead, we know that if MCQ isn't supported, we must fallback to LSDB as there is no other ways to drive the device.
UFS_MTK_CAP_DISABLE_MCQ (mediatek,ufs-disable-mcq) being unused upstream, I think that's an acceptable fix.
Another way to handle this would be to add a new dt property and add it to ufs_mtk_host_caps but I feel that my approach should be enough.
Quoted 4 lines
Quoted 4 lines
drivers/ufs/host/ufs-mediatek.c +2
-0+ hba->quirks |=UFSHCD_QUIRK_BROKEN_LSDBS_CAP ; +ufs_mtk_init_clocks (hba);
Quoted 8 lines
Quoted 5 lines
drivers/ufs/host/ufs-mediatek.c +0
-0/* Signature · 1 line
2.46.0Signature · 1 line
மணிவண்ணன் சதாசிவம்
- Mary
Peter Wang (王信友)
maintainerRe: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
Quoted 55 lines · Mary Guillemard
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 2 lines · Manivannan Sadhasivam
Quoted 1 line · Mary Guillemard
MT8183 supports UFSHCI 2.1 spec, but report a bogus value of 1 in
the
Quoted 1 line
Quoted 1 line
reserved part for the Legacy Single Doorbell Support (LSDBS)
capability.
Quoted 3 lines
Quoted 1 line
Wow... I never thought that this quirk will be used outside of Qcom
SoCs...
Quoted 1 line
Yeah I found that by trial and error some weeks ago and noticed your serie while looking to upstream this change, quite funny to see other vendors having the same quirk here.
Quoted 1 line
Quoted 1 line
This set
UFSHCD_QUIRK_BROKEN_LSDBS_CAPwhen MCQ support isexplicitly
Quoted 8 lines
Review
Quoted 8 lines
disabled, allowing the device to be properly registered.
Signed-off-by Mary Guillemard <[email protected]>--- drivers/ufs/host/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/ufs/host/ufs-mediatek.cQuoted 4 lines
drivers/ufs/host/ufs-mediatek.c static int ufs_mtk_init(struct ufs_hba
Quoted 4 lines
index
02c9064284e1..9a5919434c4e100644drivers/ufs/host/ufs-mediatek.c +0
-0@@ -1026,6 +1026,9 @@ static int ufs_mtk_init(struct ufs_hba*hba)
Quoted 6 lines
drivers/ufs/host/ufs-mediatek.c static int ufs_mtk_init(struct ufs_hba *hba) · line 1029
Quoted 4 lines
drivers/ufs/host/ufs-mediatek.c +1
-0if (host->caps &UFS_MTK_CAP_DISABLE_AH8 ) hba->caps |=UFSHCD_CAP_HIBERN8_WITH_CLK_GATING ; +if (host->caps &UFS_MTK_CAP_DISABLE_MCQ )How can this be the deciding factor? You said above that the issue
is with
Quoted 4 lines
MT8183 SoC. So why not just use the quirk only for that platform?
- Mani
So my current assumption is that it also affect other Mediatek SoCs that are also based on UFS 2.1 spec but I cannot check this.
Instead, we know that if MCQ isn't supported, we must fallback to LSDB
as there is no other ways to drive the device.
Quoted 8 lines
UFS_MTK_CAP_DISABLE_MCQ(mediatek,ufs-disable-mcq) being unused upstream,
I think that's an acceptable fix.Another way to handle this would be to add a new dt property and add it
toufs_mtk_host_capsbut I feel that my approach should be enough.
Hi Mary,
Yes, the MT8395 indeed requires the LSDBS flag,
but not every MediaTek legacy chip does.
So setting the LSDBS flag here is appropriate.
Thanks.
Peter
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
drivers/ufs/host/ufs-mediatek.c +2
-0+hba->quirks |=UFSHCD_QUIRK_BROKEN_LSDBS_CAP ; +ufs_mtk_init_clocks (hba);Quoted 8 lines
Quoted 5 lines
drivers/ufs/host/ufs-mediatek.c +0
-0/* Signature · 1 line
2.46.0Signature · 1 line
மணிவண்ணன் சதாசிவம்- Mary
Re: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
In reply to Mary GuillemardQuoted 37 lines · Mary Guillemard
Quoted 7 lines · Manivannan Sadhasivam
Quoted 3 lines · Mary Guillemard
MT8183 supports UFSHCI 2.1 spec, but report a bogus value of 1 in the reserved part for the Legacy Single Doorbell Support (LSDBS) capability.
Wow... I never thought that this quirk will be used outside of Qcom SoCs...
Yeah I found that by trial and error some weeks ago and noticed your serie while looking to upstream this change, quite funny to see other vendors having the same quirk here.
Quoted 16 lines
Quoted 16 lines
This set
UFSHCD_QUIRK_BROKEN_LSDBS_CAPwhen MCQ support is explicitly disabled, allowing the device to be properly registered.Signed-off-by Mary Guillemard <[email protected]>--- drivers/ufs/host/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+)drivers/ufs/host/ufs-mediatek.c +0
-0@@ -1026,6 +1026,9 @@ static int ufs_mtk_init(struct ufs_hba *hba)if (host->caps &UFS_MTK_CAP_DISABLE_AH8 ) hba->caps |=UFSHCD_CAP_HIBERN8_WITH_CLK_GATING ;Quoted 7 lines
drivers/ufs/host/ufs-mediatek.c static int ufs_mtk_init(struct ufs_hba *hba) · line 1029
Quoted 1 line
drivers/ufs/host/ufs-mediatek.c +1
-0+if (host->caps &UFS_MTK_CAP_DISABLE_MCQ )How can this be the deciding factor? You said above that the issue is with MT8183 SoC. So why not just use the quirk only for that platform?
- Mani
Quoted 9 lines
So my current assumption is that it also affect other Mediatek SoCs that are also based on UFS 2.1 spec but I cannot check this.
Instead, we know that if MCQ isn't supported, we must fallback to LSDB as there is no other ways to drive the device.
UFS_MTK_CAP_DISABLE_MCQ(mediatek,ufs-disable-mcq) being unused upstream, I think that's an acceptable fix.
If you use this quirk, then you need to use the corresponding DT property. But using the 'mediatek,ufs-disable-mcq' property for 2.1 controller doesn't make sense as MCQ is for controllers >= 4.0.
Quoted 3 lines
Another way to handle this would be to add a new dt property and add it to
ufs_mtk_host_capsbut I feel that my approach should be enough.
No need to add a DT property. Just use the SoC specific compatible as I did for SM8550 SoC.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
Quoted 22 lines · Manivannan Sadhasivam
Quoted 7 lines · Mary Guillemard
Quoted 5 lines · Manivannan Sadhasivam
drivers/ufs/host/ufs-mediatek.c static int ufs_mtk_init(struct ufs_hba *hba) · line 1029
Quoted 1 line · Mary Guillemard
drivers/ufs/host/ufs-mediatek.c +1
-0+if (host->caps &UFS_MTK_CAP_DISABLE_MCQ )How can this be the deciding factor? You said above that the issue is with MT8183 SoC. So why not just use the quirk only for that platform?
Quoted 9 lines
So my current assumption is that it also affect other Mediatek SoCs that are also based on UFS 2.1 spec but I cannot check this.
Instead, we know that if MCQ isn't supported, we must fallback to LSDB as there is no other ways to drive the device.
UFS_MTK_CAP_DISABLE_MCQ(mediatek,ufs-disable-mcq) being unused upstream, I think that's an acceptable fix.If you use this quirk, then you need to use the corresponding DT property. But using the 'mediatek,ufs-disable-mcq' property for 2.1 controller doesn't make sense as MCQ is for controllers >= 4.0.
Quoted 6 lines
Quoted 3 lines
Another way to handle this would be to add a new dt property and add it to
ufs_mtk_host_capsbut I feel that my approach should be enough.No need to add a DT property. Just use the SoC specific compatible as I did for SM8550 SoC.
Mary, do you plan to implement Manivannan's feedback?
Thanks,
Bart.
Re: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
Quoted 27 lines · Bart Van Assche
Quoted 26 lines · Manivannan Sadhasivam
Quoted 7 lines · Mary Guillemard
Quoted 5 lines · Manivannan Sadhasivam
drivers/ufs/host/ufs-mediatek.c static int ufs_mtk_init(struct ufs_hba *hba) · line 1029
Quoted 1 line · Mary Guillemard
drivers/ufs/host/ufs-mediatek.c +1
-0+if (host->caps &UFS_MTK_CAP_DISABLE_MCQ )How can this be the deciding factor? You said above that the issue is with MT8183 SoC. So why not just use the quirk only for that platform?
Quoted 9 lines
So my current assumption is that it also affect other Mediatek SoCs that are also based on UFS 2.1 spec but I cannot check this.
Instead, we know that if MCQ isn't supported, we must fallback to LSDB as there is no other ways to drive the device.
UFS_MTK_CAP_DISABLE_MCQ(mediatek,ufs-disable-mcq) being unused upstream, I think that's an acceptable fix.If you use this quirk, then you need to use the corresponding DT property. But using the 'mediatek,ufs-disable-mcq' property for 2.1 controller doesn't make sense as MCQ is for controllers >= 4.0.
Quoted 3 lines
Another way to handle this would be to add a new dt property and add it to
ufs_mtk_host_capsbut I feel that my approach should be enough.
Quoted 9 lines
Quoted 2 lines
No need to add a DT property. Just use the SoC specific compatible as I did for SM8550 SoC.
Mary, do you plan to implement Manivannan's feedback?
Thanks,
Bart.
Hello Bart,
I think that considering Peter's reply, explicitly checking for the MT8183 controller isn't required.
I also think it could be required for at least the MT8192 and MT8195 considering they are apparently also based on UFS 2.1 spec [1].
However, if you want me to add an explicit check, I will happily send a v2.
Thanks,
Mary.
Re: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
Quoted 38 lines · Mary Guillemard
Quoted 27 lines · Bart Van Assche
Quoted 26 lines · Manivannan Sadhasivam
Quoted 7 lines · Mary Guillemard
Quoted 5 lines · Manivannan Sadhasivam
drivers/ufs/host/ufs-mediatek.c static int ufs_mtk_init(struct ufs_hba *hba) · line 1029
Quoted 1 line · Mary Guillemard
drivers/ufs/host/ufs-mediatek.c +1
-0+if (host->caps &UFS_MTK_CAP_DISABLE_MCQ )How can this be the deciding factor? You said above that the issue is with MT8183 SoC. So why not just use the quirk only for that platform?
Quoted 9 lines
So my current assumption is that it also affect other Mediatek SoCs that are also based on UFS 2.1 spec but I cannot check this.
Instead, we know that if MCQ isn't supported, we must fallback to LSDB as there is no other ways to drive the device.
UFS_MTK_CAP_DISABLE_MCQ(mediatek,ufs-disable-mcq) being unused upstream, I think that's an acceptable fix.If you use this quirk, then you need to use the corresponding DT property. But using the 'mediatek,ufs-disable-mcq' property for 2.1 controller doesn't make sense as MCQ is for controllers >= 4.0.
Quoted 3 lines
Another way to handle this would be to add a new dt property and add it to
ufs_mtk_host_capsbut I feel that my approach should be enough.Quoted 9 lines
Quoted 2 lines
No need to add a DT property. Just use the SoC specific compatible as I did for SM8550 SoC.
Mary, do you plan to implement Manivannan's feedback?
Thanks,
Bart.
Quoted 8 lines
Hello Bart,
I think that considering Peter's reply, explicitly checking for the MT8183 controller isn't required.
I also think it could be required for at least the MT8192 and MT8195 considering they are apparently also based on UFS 2.1 spec [1].
How can you add a quirk that is specifically meant for 4.x controllers to 2.1 controllers? It doesn't make sense.
Also it is weird that the existing DT files doesn't have ufshc nodes for any SoCs, but the SoCs are supporting UFSHC.
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Re: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
In reply to Mary GuillemardQuoted 33 lines · Mary Guillemard
External email : Please do not click links or open attachments until you have verified the sender or the content.
MT8183 supports UFSHCI 2.1 spec, but report a bogus value of 1 in
the
reserved part for the Legacy Single Doorbell Support (LSDBS) capability.This set
UFSHCD_QUIRK_BROKEN_LSDBS_CAPwhen MCQ support is explicitly disabled, allowing the device to be properly registered.Signed-off-by Mary Guillemard <[email protected]>--- drivers/ufs/host/ufs-mediatek.c | 3 +++ 1 file changed, 3 insertions(+)drivers/ufs/host/ufs- renamed from drivers/ufs/host/ufs-mediatek.c +0
-0
mediatek.c
index02c9064284e1..9a5919434c4e100644drivers/ufs/host/ufs-mediatek.c +3
-0@@ -1026,6 +1026,9 @@ static int ufs_mtk_init(struct ufs_hba *hba)if (host->caps &UFS_MTK_CAP_DISABLE_AH8 ) hba->caps |=UFSHCD_CAP_HIBERN8_WITH_CLK_GATING ; +if (host->caps &UFS_MTK_CAP_DISABLE_MCQ ) + hba->quirks |=UFSHCD_QUIRK_BROKEN_LSDBS_CAP ; +ufs_mtk_init_clocks (hba);/* Signature · 1 line
2.46.0
Martin K. Petersen
AppliedRe: [PATCH 1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
In reply to Mary GuillemardQuoted 8 lines · Mary Guillemard
MT8183 supports UFSHCI 2.1 spec, but report a bogus value of 1 in the reserved part for the Legacy Single Doorbell Support (LSDBS) capability.
This set
UFSHCD_QUIRK_BROKEN_LSDBS_CAPwhen MCQ support is explicitly disabled, allowing the device to be properly registered.[...]
Applied to 6.11/scsi-fixes, thanks!
[1/1] scsi: ufs-mediatek: Add UFSHCD_QUIRK_BROKEN_LSDBS_CAP
https://git.kernel.org/mkp/scsi/c/0f9592ae26ff
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering