Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp928023pxu; Wed, 16 Dec 2020 19:46:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+o32NRHk2a7UuWUH/WJKL8IwQEU89dW5OoXoYLf37a9GCIDm4qfqJinwj9+gGDufu/1/J X-Received: by 2002:aa7:d750:: with SMTP id a16mr37075597eds.252.1608176780498; Wed, 16 Dec 2020 19:46:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608176780; cv=none; d=google.com; s=arc-20160816; b=tvJmWbK4xFCWAQBLjgqTWx6GltaLWZ03AA97zoX6g4uUywpckNqVFltBH+Twrb1xSY gQDtE2ncAnbBRgpXtn6cdaJiLX4IJK8CUKc3qL6TH1sJZxCD7X78egnezfdKQdt4n9kG 8/LOZfGszOLtrpzJsEh4Qaj8JY9tu4v8KCh43t3JOHRoC4eeUfQyUDJdp7dfYqOkKePj 5Wv2GHyF/i4VSIcwO3yNm9NsCpDmMKY74duw/oI+uSI8jHDVUWvZ92DLPN/lJ68tMWk1 QTzfCAUNeLGtjFZJ/JW+5IsHyVUXJTTuvDM5ewb0ZoGYoHarLf826cugF4JxZJM/wW86 vZ4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=tkZdULlUHpCTLPPLnvYRioU35Xl4oRXIiOGWSipJOsk=; b=H3VywoZ0rBfII8g+WpN79VAOLZf/W09GCTY3RnyAOuVnpfZVEL0dKJfVBXQvvJBZwO svnJOOQktyvWd4fIrF0WzF7oDaHyMEjCSHUqkUsuPi7L5VFxdmi95JohXxAdanqTmweA KSQZ1Q6QdmzazfY5vwivOwJrTb3qzLsmtxtg8VgFvHkUdHuB2i/KLCJKrplJ5jTv91Qy PLWjCoa9AIGtlfkYaBklBls/uYzxHQeqVxW6L6rIh+cNNLCFrNwgafLDCaRBZkdxpCyj GZ1nsmqhvOT2U6tGsTezP1yAo7qnbeN1se8rzgDAEJHBPvxbm3zr8p0VmKITRFEFy/WB B3PA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=naJK+sF6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zp23si2092613ejb.261.2020.12.16.19.45.58; Wed, 16 Dec 2020 19:46:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=naJK+sF6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727964AbgLQDoC (ORCPT + 99 others); Wed, 16 Dec 2020 22:44:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727323AbgLQDoC (ORCPT ); Wed, 16 Dec 2020 22:44:02 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B174C061794; Wed, 16 Dec 2020 19:43:22 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id v2so645674pfm.9; Wed, 16 Dec 2020 19:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tkZdULlUHpCTLPPLnvYRioU35Xl4oRXIiOGWSipJOsk=; b=naJK+sF6BTWwx2gI+Fp66YCAll/8W/IjZ7maOeoXiGnYRhT7yJu0VFGdnprp0DZ06H mM+yGyD9z0lVF9t1mR7k0WZOaCfeWcDuh2cc9UYyAZoeYI/oPIPVXpwjusP63QyVyRSn xjuPwyi7OZxJ4Lq20qCAh+8RBOPcmYnJanST8fZneUCjiaZEPKRdfg2Nkzi4CKmN4mFQ AlamZkC9vNZRlUGMpkhtSenWeJFzVGv9b6GtffaguFjJrOqHW80bBPoue2jOCnkmd1b4 9fkc6FycbqaoZLI28ocEaXAon5yvjDusDP+pSMWpGCLzcrP/pZpGnyKALPEyHSsyhnrt EpvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tkZdULlUHpCTLPPLnvYRioU35Xl4oRXIiOGWSipJOsk=; b=Ejfxsv2syMKaLBrTsGPkcFGB0lZnI77qLSpwXDrZ7TUvo7MpvY/79qO3nYRqAHOrsE iQoTwDz3gt715UnWHFAzb52MRW6Ysc8IEdp2U0EKo2GJJNU1VjW5hc+3fxIMrju/bGlY ezXLUk4OeaPQ29hUuVXmNEyV31rawFTJ0WC8kfgnW7vqLNcMm45vHnn3BbRuEe6NE+Gz 5Z60Gv1lm0LD6iG2DoEzLLFFGKBiUMOxje8OifSYVn4g05ZKH05O6NIRcI/jAXks57ZG naY54wuOlMITcBquVzQvUAj/TCuhQCrPnYm1lsn3Mvy53LQwm+ZRQo7zwKZxtJoFCPzK TC6g== X-Gm-Message-State: AOAM530Y0MCpvVCmkCy+XrWa+HArNk9SLQSnD4d5RYEgaz1gzlsomwpU GmIIoBztHuxTuLrhOj6VaZ9EPEbz5Zef4VQQ1vQ= X-Received: by 2002:a05:6a00:2384:b029:19a:eed3:7f42 with SMTP id f4-20020a056a002384b029019aeed37f42mr35475427pfc.4.1608176601666; Wed, 16 Dec 2020 19:43:21 -0800 (PST) MIME-Version: 1.0 References: <20201216115125.5886-1-chunfeng.yun@mediatek.com> <20201216115125.5886-2-chunfeng.yun@mediatek.com> <1608171557.23328.53.camel@mhfsdcap03> In-Reply-To: <1608171557.23328.53.camel@mhfsdcap03> From: Rosen Penev Date: Wed, 16 Dec 2020 19:43:10 -0800 Message-ID: Subject: Re: [PATCH 2/3] usb: xhci-mtk: fix UAS issue by XHCI_BROKEN_STREAMS quirk To: Chunfeng Yun Cc: Nicolas Boichat , Devicetree List , Mathias Nyman , Greg Kroah-Hartman , linux-usb@vger.kernel.org, lkml , Rob Herring , "moderated list:ARM/Mediatek SoC support" , Hsin-Yi Wang , Matthias Brugger , Ikjoon Jang , linux-arm Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 16, 2020 at 6:29 PM Chunfeng Yun wrote: > > On Wed, 2020-12-16 at 20:28 +0800, Nicolas Boichat wrote: > > On Wed, Dec 16, 2020 at 7:53 PM Chunfeng Yun wrote: > > > > > > 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. > > > > > > Fixes: 94a631d91ad3 ("usb: xhci-mtk: check hcc_params after adding primary hcd") > > > Signed-off-by: Chunfeng Yun > > > --- > > > drivers/usb/host/xhci-mtk.c | 7 ++++++- > > > drivers/usb/host/xhci-mtk.h | 1 + > > > 2 files changed, 7 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/usb/host/xhci-mtk.c b/drivers/usb/host/xhci-mtk.c > > > index 8f321f39ab96..08dab974d847 100644 > > > --- a/drivers/usb/host/xhci-mtk.c > > > +++ b/drivers/usb/host/xhci-mtk.c > > > @@ -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"); > > > > 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? > 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. I'm guessing this also applies to mt7621? > > > > > (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 > > > > > Thanks, > > > > > /* 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); > > > diff --git a/drivers/usb/host/xhci-mtk.h b/drivers/usb/host/xhci-mtk.h > > > index a93cfe817904..86aa4978915e 100644 > > > --- a/drivers/usb/host/xhci-mtk.h > > > +++ b/drivers/usb/host/xhci-mtk.h > > > @@ -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 > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel