dt-bindings: usb: mtk-xhci: add a new property for broken streams
Subsystems (5)
Chunfeng Yun
maintainerPATCH 1/3 dt-bindings: usb: mtk-xhci: add a new property for broken streams
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, so add a new property "mediatek,broken_streams_quirk" to fix it.
---
this patch depends on:
https://patchwork.kernel.org/project/linux-mediatek/list/?series=402773
[v4,09/11] dt-bindings: usb: convert mediatek, mtk-xhci.txt to YAML schema
--- Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +5 -0
@@ -120,6 +120,11 @@ properties: description: The mask to disable u3ports, bit0 for u3port0, bit1 for u3port1, ... etc + mediatek,broken_streams_quirk: + description: set if the controller doesn't support bulk stream but + HCCPARAMS says support. + type: boolean + "#address-cells": const: 1
Signature · 1 line
2.18.0
Chunfeng Yun
maintainerPATCH 2/3 usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use XHCI_BROKEN_STREAMS quirk to fix it.
--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-mtk.c +6 -1
@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */
@@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret; mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );/* optional property, ignore the error if it does not exist */ of_property_read_u32 (node,"mediatek,u3p-dis-msk" , &mtk->u3p_dis_msk);
@@ -546,7 +551,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)if (ret) goto put_usb3_hcd; -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (!mtk->broken_streams &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ; ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );
drivers/usb/host/xhci-mtk.h +1 -0
@@ -147,6 +147,7 @@ struct xhci_hcd_mtk {struct phy **phys;int num_phys;bool lpm_support; +bool broken_streams;/* usb remote wakeup */ bool uwk_en;struct regmap *uwk;
Signature · 1 line
2.18.0
Re: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
Quoted 28 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use
XHCI_BROKEN_STREAMSquirk to fix it.Fixes 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")Signed-off-by Chunfeng Yun <[email protected]>--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/usb/host/xhci-mtk.c +3
-0@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 5 lines
drivers/usb/host/xhci-mtk.c +2
-0@@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret; mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );
Would it be better to add a data field to struct of_device_id mtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?
(IMHO usb3-lpm-capable detection should also be done in the same way)
Thanks,
Quoted 25 lines
drivers/usb/host/xhci-mtk.c +1
-1/* optional property, ignore the error if it does not exist */ of_property_read_u32 (node,"mediatek,u3p-dis-msk" , &mtk->u3p_dis_msk);@@ -546,7 +551,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)if (ret) goto put_usb3_hcd; -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (!mtk->broken_streams &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ; ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );drivers/usb/host/xhci-mtk.h +1
-1@@ -147,6 +147,7 @@ struct xhci_hcd_mtk {struct phy **phys;int num_phys;bool lpm_support; +bool broken_streams;/* usb remote wakeup */ bool uwk_en;struct regmap *uwk; --
Quoted 1 line
2.18.0
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Chunfeng Yun
maintainerRe: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
Quoted 31 lines · Nicolas Boichat
Quoted 30 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use
XHCI_BROKEN_STREAMSquirk to fix it.Fixes 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")Signed-off-by Chunfeng Yun <[email protected]>--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/usb/host/xhci-mtk.c +3
-0@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */ @@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret;
Quoted 6 lines
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 3 lines
drivers/usb/host/xhci-mtk.c +2
-0mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );Would it be better to add a data field to struct
of_device_idmtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?
This is the common issue for all SoCs (before 2016.06) with 0.96 xHCI when the controller don't support bulk stream. If enable this quirk only for mt8173, then for other SoCs, the compatible need include "mediatek,mt8173-xhci" in dts, this may be not flexible for some cases, e.g. a new SoC has the broken stream as mt8173, but also has another different quirk, the way you suggested will not handle it. And I plan to remove "mediatek,mt8173-xhci" in mtk_xhci_of_match after converting the binding to YMAL.
Quoted 2 lines
(IMHO usb3-lpm-capable detection should also be done in the same way)
I prefer to provide a property for common issues, and use the way you suggested for the issue only happened at a specific SoC.
Thank you
Quoted 29 lines
Thanks,
Quoted 26 lines
drivers/usb/host/xhci-mtk.c +1
-1/* optional property, ignore the error if it does not exist */ of_property_read_u32 (node,"mediatek,u3p-dis-msk" , &mtk->u3p_dis_msk);@@ -546,7 +551,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)if (ret) goto put_usb3_hcd; -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (!mtk->broken_streams &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ; ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );drivers/usb/host/xhci-mtk.h +1
-1@@ -147,6 +147,7 @@ struct xhci_hcd_mtk {struct phy **phys;int num_phys;bool lpm_support; +bool broken_streams;/* usb remote wakeup */ bool uwk_en;struct regmap *uwk; --2.18.0
Re: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
Quoted 39 lines · Chunfeng Yun
Quoted 31 lines · Nicolas Boichat
Quoted 30 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use
XHCI_BROKEN_STREAMSquirk to fix it.Fixes 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")Signed-off-by Chunfeng Yun <[email protected]>--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/usb/host/xhci-mtk.c +3
-0@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */ @@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret;Quoted 6 lines
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 3 lines
drivers/usb/host/xhci-mtk.c +2
-0mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );Would it be better to add a data field to struct
of_device_idmtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?
Quoted 6 lines
This is the common issue for all SoCs (before 2016.06) with 0.96 xHCI when the controller don't support bulk stream. If enable this quirk only for mt8173, then for other SoCs, the compatible need include "mediatek,mt8173-xhci" in dts, this may be not flexible for some cases, e.g. a new SoC has the broken stream as mt8173, but also has another different quirk, the way you suggested will not handle it.
It can, we do this regularly for many other components. One example:
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/busses/i2c-mt65xx.c#L402
Quoted 7 lines
And I plan to remove "mediatek,mt8173-xhci" in
mtk_xhci_of_matchafter converting the binding to YMAL.Quoted 2 lines
(IMHO usb3-lpm-capable detection should also be done in the same way)
I prefer to provide a property for common issues, and use the way you suggested for the issue only happened at a specific SoC.
Understand, it's just different approaches, there seems to be precedent (at least in this driver/binding) for using properties, so I'll let the USB maintainers speak up ,-)
Quoted 17 lines
Thank you
Quoted 14 lines
Thanks,
Quoted 11 lines
drivers/usb/host/xhci-mtk.c +1
-1/* optional property, ignore the error if it does not exist */ of_property_read_u32 (node,"mediatek,u3p-dis-msk" , &mtk->u3p_dis_msk);@@ -546,7 +551,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)if (ret) goto put_usb3_hcd; -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (!mtk->broken_streams &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ;
Quoted 16 lines
Quoted 7 lines
Quoted 7 lines
drivers/usb/host/xhci-mtk.c +0
-0ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );drivers/usb/host/xhci-mtk.h +0
-0@@ -147,6 +147,7 @@ struct xhci_hcd_mtk {struct phy **phys;Quoted 8 lines
Quoted 8 lines
drivers/usb/host/xhci-mtk.h +1
-1int num_phys;bool lpm_support; +bool broken_streams;/* usb remote wakeup */ bool uwk_en;struct regmap *uwk; --2.18.0
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Chunfeng Yun
maintainerRe: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
Quoted 47 lines · Nicolas Boichat
Quoted 39 lines · Chunfeng Yun
Quoted 31 lines · Nicolas Boichat
Quoted 30 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use
XHCI_BROKEN_STREAMSquirk to fix it.Fixes 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")Signed-off-by Chunfeng Yun <[email protected]>--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/usb/host/xhci-mtk.c +3
-0@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */ @@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret;Quoted 6 lines
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 3 lines
drivers/usb/host/xhci-mtk.c +2
-0mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );Would it be better to add a data field to struct
of_device_idmtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?Quoted 6 lines
This is the common issue for all SoCs (before 2016.06) with 0.96 xHCI when the controller don't support bulk stream. If enable this quirk only for mt8173, then for other SoCs, the compatible need include "mediatek,mt8173-xhci" in dts, this may be not flexible for some cases, e.g. a new SoC has the broken stream as mt8173, but also has another different quirk, the way you suggested will not handle it.
Quoted 3 lines
It can, we do this regularly for many other components. One example:
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/busses/i2c-mt65xx.c#L402
Got it. Indeed works when add compatible private data.
Due to many SoCs supports USB and not upstream, I'd prefer to avoid adding new compatible in driver when support new SoCs, and leave the code as simple as possible.
Quoted 9 lines
Quoted 7 lines
And I plan to remove "mediatek,mt8173-xhci" in
mtk_xhci_of_matchafter converting the binding to YMAL.Quoted 2 lines
(IMHO usb3-lpm-capable detection should also be done in the same way)
I prefer to provide a property for common issues, and use the way you suggested for the issue only happened at a specific SoC.
Understand, it's just different approaches,
Yes
Quoted 37 lines
there seems to be
precedent (at least in this driver/binding) for using properties, so I'll let the USB maintainers speak up ,-)Quoted 33 lines
Thank you
Quoted 29 lines
Thanks,
Quoted 26 lines
drivers/usb/host/xhci-mtk.c +1
-1/* optional property, ignore the error if it does not exist */ of_property_read_u32 (node,"mediatek,u3p-dis-msk" , &mtk->u3p_dis_msk);@@ -546,7 +551,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)if (ret) goto put_usb3_hcd; -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (!mtk->broken_streams &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ; ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );drivers/usb/host/xhci-mtk.h +1
-1@@ -147,6 +147,7 @@ struct xhci_hcd_mtk {struct phy **phys;int num_phys;bool lpm_support; +bool broken_streams;/* usb remote wakeup */ bool uwk_en;struct regmap *uwk; --2.18.0
Rob Herring
maintainerRe: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
Quoted 48 lines · Chunfeng Yun
Quoted 47 lines · Nicolas Boichat
Quoted 45 lines · Chunfeng Yun
Quoted 31 lines · Nicolas Boichat
Quoted 30 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use
XHCI_BROKEN_STREAMSquirk to fix it.Fixes 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")Signed-off-by Chunfeng Yun <[email protected]>--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/usb/host/xhci-mtk.c +3
-0@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */ @@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret;Quoted 6 lines
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 3 lines
drivers/usb/host/xhci-mtk.c +2
-0mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );Would it be better to add a data field to struct
of_device_idmtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?This is the common issue for all SoCs (before 2016.06) with 0.96 xHCI when the controller don't support bulk stream. If enable this quirk only for mt8173, then for other SoCs, the compatible need include "mediatek,mt8173-xhci" in dts, this may be not flexible for some cases, e.g. a new SoC has the broken stream as mt8173, but also has another different quirk, the way you suggested will not handle it.
Quoted 8 lines
Quoted 3 lines
It can, we do this regularly for many other components. One example:
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/busses/i2c-mt65xx.c#L402Got it. Indeed works when add compatible private data.
Due to many SoCs supports USB and not upstream, I'd prefer to avoid adding new compatible in driver when support new SoCs, and leave the code as simple as possible.
No. The problem is adding new fixes requires updating the DT. That would be fine if you knew all possible issues and quirks up front. You may for some, but you won't catch them all.
Save DT properties for per board quirks/features, not per SoC ones.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
And I plan to remove "mediatek,mt8173-xhci" in
mtk_xhci_of_matchafter converting the binding to YMAL.Quoted 2 lines
(IMHO usb3-lpm-capable detection should also be done in the same way)
I tend to agree, but am more tolerable of standard USB features than specific IP block quirks.
Rob
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Chunfeng Yun
maintainerRe: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
Quoted 54 lines · Rob Herring
Quoted 53 lines · Chunfeng Yun
Quoted 47 lines · Nicolas Boichat
Quoted 39 lines · Chunfeng Yun
Quoted 31 lines · Nicolas Boichat
Quoted 30 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use
XHCI_BROKEN_STREAMSquirk to fix it.Fixes 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")Signed-off-by Chunfeng Yun <[email protected]>--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/usb/host/xhci-mtk.c +3
-0@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */ @@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret;Quoted 6 lines
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 3 lines
drivers/usb/host/xhci-mtk.c +2
-0mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );Would it be better to add a data field to struct
of_device_idmtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?Quoted 6 lines
This is the common issue for all SoCs (before 2016.06) with 0.96 xHCI when the controller don't support bulk stream. If enable this quirk only for mt8173, then for other SoCs, the compatible need include "mediatek,mt8173-xhci" in dts, this may be not flexible for some cases, e.g. a new SoC has the broken stream as mt8173, but also has another different quirk, the way you suggested will not handle it.
Quoted 3 lines
It can, we do this regularly for many other components. One example:
https://elixir.bootlin.com/linux/latest/source/drivers/i2c/busses/i2c-mt65xx.c#L402Got it. Indeed works when add compatible private data.
Quoted 7 lines
Quoted 3 lines
Due to many SoCs supports USB and not upstream, I'd prefer to avoid adding new compatible in driver when support new SoCs, and leave the code as simple as possible.
No. The problem is adding new fixes requires updating the DT. That would be fine if you knew all possible issues and quirks up front. You may for some, but you won't catch them all.
Yes.
But all SoCs use the generic compatible "mediatek,mtk-xhci" except mtk8173. as following:
compatible = "mediatek,mt<SoC>-xhci", "mediatek,mtk-xhci";
It may be a little messy when the driver fill many compatibles after supporting several tens or hundreds SoCs.
I'll think about it again.
Quoted 2 lines
Save DT properties for per board quirks/features, not per SoC ones.
This is for USB IP quirks/feature, not board or SoC
Thanks
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
And I plan to remove "mediatek,mt8173-xhci" in
mtk_xhci_of_matchafter converting the binding to YMAL.Quoted 1 line
Quoted 6 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
(IMHO usb3-lpm-capable detection should also be done in the same way)
I tend to agree, but am more tolerable of standard USB features than specific IP block quirks.
Rob
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
In reply to Chunfeng YunQuoted 39 lines · Chunfeng Yun
Quoted 31 lines · Nicolas Boichat
Quoted 30 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use
XHCI_BROKEN_STREAMSquirk to fix it.Fixes 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")Signed-off-by Chunfeng Yun <[email protected]>--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/usb/host/xhci-mtk.c +3
-0@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */ @@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret;Quoted 6 lines
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 3 lines
drivers/usb/host/xhci-mtk.c +2
-0mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );Would it be better to add a data field to struct
of_device_idmtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?
Quoted 8 lines
This is the common issue for all SoCs (before 2016.06) with 0.96 xHCI when the controller don't support bulk stream. If enable this quirk only for mt8173, then for other SoCs, the compatible need include "mediatek,mt8173-xhci" in dts, this may be not flexible for some cases, e.g. a new SoC has the broken stream as mt8173, but also has another different quirk, the way you suggested will not handle it. And I plan to remove "mediatek,mt8173-xhci" in
mtk_xhci_of_matchafter converting the binding to YMAL.
I'm guessing this also applies to mt7621?
Quoted 34 lines
Quoted 3 lines
(IMHO usb3-lpm-capable detection should also be done in the same way)
I prefer to provide a property for common issues, and use the way you suggested for the issue only happened at a specific SoC.
Thank you
Quoted 26 lines
Thanks,
Quoted 23 lines
drivers/usb/host/xhci-mtk.c +1
-1/* optional property, ignore the error if it does not exist */ of_property_read_u32 (node,"mediatek,u3p-dis-msk" , &mtk->u3p_dis_msk);@@ -546,7 +551,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)if (ret) goto put_usb3_hcd; -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (!mtk->broken_streams &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ; ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );drivers/usb/host/xhci-mtk.h +1
-0@@ -147,6 +147,7 @@ struct xhci_hcd_mtk {struct phy **phys;int num_phys;bool lpm_support; +bool broken_streams;/* usb remote wakeup */ bool uwk_en;
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
drivers/usb/host/xhci-mtk.h +0
-1struct regmap *uwk; --2.18.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Chunfeng Yun
maintainerRe: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
Quoted 48 lines · Rosen Penev
Quoted 39 lines · Chunfeng Yun
Quoted 31 lines · Nicolas Boichat
Quoted 30 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, here use
XHCI_BROKEN_STREAMSquirk to fix it.Fixes 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd")Signed-off-by Chunfeng Yun <[email protected]>--- drivers/usb/host/xhci-mtk.c | 7 ++++++- drivers/usb/host/xhci-mtk.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-)drivers/usb/host/xhci-mtk.c +3
-0@@ -395,6 +395,9 @@ static void xhci_mtk_quirks(struct device *dev, struct xhci_hcd *xhci) xhci->quirks |=XHCI_SPURIOUS_SUCCESS ;if (mtk->lpm_support) xhci->quirks |=XHCI_LPM_SUPPORT ; + +if (mtk->broken_streams) + xhci->quirks |=XHCI_BROKEN_STREAMS ; }/* called during probe() after chip reset completes */ @@ -460,6 +463,8 @@ static int xhci_mtk_probe(struct platform_device *pdev)return ret;Quoted 6 lines
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 3 lines
drivers/usb/host/xhci-mtk.c +2
-0mtk->lpm_support =of_property_read_bool (node,"usb3-lpm-capable" ); + mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );Would it be better to add a data field to struct
of_device_idmtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?Quoted 8 lines
This is the common issue for all SoCs (before 2016.06) with 0.96 xHCI when the controller don't support bulk stream. If enable this quirk only for mt8173, then for other SoCs, the compatible need include "mediatek,mt8173-xhci" in dts, this may be not flexible for some cases, e.g. a new SoC has the broken stream as mt8173, but also has another different quirk, the way you suggested will not handle it. And I plan to remove "mediatek,mt8173-xhci" in
mtk_xhci_of_matchafter converting the binding to YMAL.
Quoted 1 line
I'm guessing this also applies to mt7621?
Yes, mt7621 doesn't support bulk stream
Quoted 34 lines
Quoted 34 lines
Quoted 3 lines
(IMHO usb3-lpm-capable detection should also be done in the same way)
I prefer to provide a property for common issues, and use the way you suggested for the issue only happened at a specific SoC.
Thank you
Quoted 26 lines
Thanks,
Quoted 23 lines
drivers/usb/host/xhci-mtk.c +1
-1/* optional property, ignore the error if it does not exist */ of_property_read_u32 (node,"mediatek,u3p-dis-msk" , &mtk->u3p_dis_msk);@@ -546,7 +551,7 @@ static int xhci_mtk_probe(struct platform_device *pdev)if (ret) goto put_usb3_hcd; -if (HCC_MAX_PSA (xhci->hcc_params) >=4 ) +if (!mtk->broken_streams &&HCC_MAX_PSA (xhci->hcc_params) >=4 ) xhci->shared_hcd->can_do_streams =1 ; ret =usb_add_hcd (xhci->shared_hcd, irq,IRQF_SHARED );drivers/usb/host/xhci-mtk.h +1
-0@@ -147,6 +147,7 @@ struct xhci_hcd_mtk {struct phy **phys;int num_phys;bool lpm_support; +bool broken_streams;/* usb remote wakeup */ bool uwk_en;
Quoted 8 lines
Quoted 8 lines
Quoted 3 lines
Quoted 3 lines
drivers/usb/host/xhci-mtk.h +0
-1struct regmap *uwk; --2.18.0
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
A message that is not in the archive (sent off-list or not yet received): [email protected]
Chunfeng Yun
maintainerRe: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk
Quoted 22 lines · Matthias Brugger
Quoted 5 lines · Chunfeng Yun
Quoted 4 lines · Rosen Penev
Quoted 3 lines · Chunfeng Yun
Quoted 1 line · Nicolas Boichat
On Wed, Dec 16, 2020 at 7:53 PM Chunfeng Yun <[email protected]> wrote:
[...]
Quoted 14 lines
Quoted 14 lines
Quoted 14 lines
Quoted 6 lines
drivers/usb/host/xhci-mtk.c static int xhci_mtk_probe(struct platform_device *pdev) · line 467
Quoted 3 lines
mtk->lpm_support = of_property_read_bool(node, "usb3-lpm-capable");drivers/usb/host/xhci-mtk.c +2
-0+ mtk->broken_streams = +of_property_read_bool (node,"mediatek,broken_streams_quirk" );Would it be better to add a data field to struct
of_device_idmtk_xhci_of_match, and enable this quirk on mediatek,mt8173-xhci only?This is the common issue for all SoCs (before 2016.06) with 0.96 xHCI when the controller don't support bulk stream. If enable this quirk only for mt8173, then for other SoCs, the compatible need include "mediatek,mt8173-xhci" in dts, this may be not flexible for some cases, e.g. a new SoC has the broken stream as mt8173, but also has another different quirk, the way you suggested will not handle it. And I plan to remove "mediatek,mt8173-xhci" in
mtk_xhci_of_matchafter converting the binding to YMAL.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
I'm guessing this also applies to mt7621?
Yes, mt7621 doesn't support bulk stream
Then please provide patches to the DTSI for all SoCs that have this problem. Either as a follow-up or as part of this series, if you need to resubmit.
Ok, I'll send new version, and also try other way to fix it without add property in DTS, thanks
Quoted 3 lines
Regards,
Matthias
Chunfeng Yun
maintainerPATCH 3/3 arm64: dts: mt8173: add a broken streams quirk property for xHCI node
In reply to Chunfeng YunDue to 0.96 xHCI on mt8173 doesn't support bulk stream but MaxPSASize says supporting, add a new "mediatek,broken_streams_quirk" property to fix it.
--- arch/arm64/boot/dts/mediatek/mt8173.dtsi | 1 + 1 file changed, 1 insertion(+)
arch/arm64/boot/dts/mediatek/mt8173.dtsi +1 -0
@@ -886,6 +886,7 @@ power-domains = <&scpsys MT8173_POWER_DOMAIN_USB>; clocks = <&topckgen CLK_TOP_USB30_SEL>, <&clk26m>; clock-names = "sys_ck", "ref_ck"; + mediatek,broken_streams_quirk; status = "disabled"; }; };
Signature · 5 lines
2.18.0 _______________________________________________ Linux-mediatek mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-mediatek
Rob Herring
maintainerQuoted 19 lines · Chunfeng Yun
The 0.96 xHCI controller on some platforms does not support bulk stream even HCCPARAMS says supporting, due to MaxPSASize is set a non-zero default value by mistake, so add a new property "mediatek,broken_streams_quirk" to fix it.
Signed-off-by Chunfeng Yun <[email protected]>---
this patch depends on:
https://patchwork.kernel.org/project/linux-mediatek/list/?series=402773
[v4,09/11] dt-bindings: usb: convert mediatek, mtk-xhci.txt to YAML schema--- Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml | 5 +++++ 1 file changed, 5 insertions(+)Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +0
-0
Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml properties: · line 123
Quoted 4 lines
Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +1
-0@@ -120,6 +120,11 @@ properties: description: The mask to disable u3ports, bit0 for u3port0, bit1 for u3port1, ... etc + mediatek,broken_streams_quirk:
You should imply this from the compatible property.
(Also, don't use '_' in property names).
Quoted 9 lines
Documentation/devicetree/bindings/usb/mediatek,mtk-xhci.yaml +4
-0+ description: set if the controller doesn't support bulk stream but + HCCPARAMS says support. + type: boolean + "#address-cells": const: 1Signature · 1 line
2.18.0
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek