Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp771157pxk; Wed, 9 Sep 2020 19:55:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzfIfct8A178LZ2ewtR+x9dm9K/wBdiH0lsWvXtyndF3Z+nK/nX0GxOUepera3UB2lJvJHl X-Received: by 2002:a17:906:d9da:: with SMTP id qk26mr6573624ejb.435.1599706557502; Wed, 09 Sep 2020 19:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599706557; cv=none; d=google.com; s=arc-20160816; b=jqS8o7vH1haaJ25OmaQqumpnOk/j9Gb9EUnH3gFJcMgGaR0pzUf3nPxVnuMITzKiry wRMUtVnObOMZtBhquDbgPHRLlU3SeBE7RewLd/1ou1M8nVwjcdnO3+1O4DROAjE7SHg7 yIJQ8LYLBZxL6zlssvfQfNuO8uvMD/DK3w5uITPM5TzPUOVu2Dc+uY+Cz7ExDs8s2+mY SXwXPi46yPW8ECwy42emkYw/O8GqXrSfpbPrtq1Rm2plgRxpdEfb4/FrLzoYHxM/wz6N 6moVT1Nynf8FGTq5K+BjWcUQyHYIZmLqJ7acALzn5/jT/uBMBHI2UPj5c0MspWZxb1pD 37kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lQhwDjP6TNS2Ik4pBM/Zgt2mpKx73CO14Av4nyUHdV0=; b=d/OYPxybZqEKbc5yg+a/k+vxqspXegwtrxbgmxgQh7fXk2yscCP93t6iesECNGUFDM 0iw9285cmyzwpgnRYCJPTReXXjFFYEvVtAOfrSngv2eOvfa6AAVrpp7272OAK8RxP4ul /OTjfi0fp6SwW/nTbffVJbLn2I0QPs2mGXjkRuzNxuzmwkNs6IIYbjw2rXzzJzblMoxn a9vQGSZ5U7RqbQVfQwEDv+sKdvLCjY02SPYy/cHKXyNUM7tbc0xIQ5j2qvdDdWANjNBg eq6Z4spJyN3ARqBG0+/uwRkOT7VCcBAT8ecVqdG8zG8QYThetJii2b5YXcjfRigcEPK9 zh1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alliedtelesis.co.nz header.s=mail181024 header.b="Dl/XEoko"; 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=NONE dis=NONE) header.from=alliedtelesis.co.nz Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b19si2806378ejk.429.2020.09.09.19.55.34; Wed, 09 Sep 2020 19:55:57 -0700 (PDT) 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=@alliedtelesis.co.nz header.s=mail181024 header.b="Dl/XEoko"; 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=NONE dis=NONE) header.from=alliedtelesis.co.nz Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbgIJCwo (ORCPT + 99 others); Wed, 9 Sep 2020 22:52:44 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:48742 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729135AbgIJCwF (ORCPT ); Wed, 9 Sep 2020 22:52:05 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 1A5A4806B5; Thu, 10 Sep 2020 14:51:57 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail181024; t=1599706317; bh=lQhwDjP6TNS2Ik4pBM/Zgt2mpKx73CO14Av4nyUHdV0=; h=From:To:Cc:Subject:Date; b=Dl/XEokogax91p9/0956kDDlgva9mRwc6HTUWXhpsAx/lat3/xlutBsKDpTbVFWC+ hEqYYP8vF8ISmzC94Pm95DB9GaK6kbZPV7bmxh3VPQ8bJ9G4MZPsQAYj2q/YP3Fvvy 5rhUcg450FlhWEg2KjGFKj2+UqY8YVrXWFHPlOwW7bOnTguhu/UZ38UI9mbNUfxCGm SQWEz2GE+v8eUwQ9RtC0Q3qPlsJbPPdnp1OHNglBnUDvFHltRAqhmMRtgbmKJegVJE JY+wniQ5CRYWMsjy6Nlo6VrwPzrNKYIftExZxiGh5lX128w3ORRTtkVVeYwmi17N42 t1rHCz85oJdJA== Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7,5,8,10121) id ; Thu, 10 Sep 2020 14:51:56 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.20]) by smtp (Postfix) with ESMTP id DC6C913EEBA; Thu, 10 Sep 2020 14:51:55 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id C3FE5280076; Thu, 10 Sep 2020 14:51:56 +1200 (NZST) From: Chris Packham To: stern@rowland.harvard.edu, linux@prisktech.co.nz, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Chris Packham Subject: [PATCH] usb: host: ehci-platform: Add workaround for brcm,xgs-iproc-ehci Date: Thu, 10 Sep 2020 14:51:53 +1200 Message-Id: <20200910025154.20848-1-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable x-atlnz-ls: pat Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The ehci controller found in some Broadcom switches with integrated SoCs has an issue which causes a soft lockup with large transfers like you see when running ext4 on USB3 flash drive. Port the fix from the Broadcom XLDK to increase the OUT_THRESHOLD to avoid the problem. Signed-off-by: Chris Packham --- I don't have much data on what this change does. I can say it is needed t= o avoid a soft lockup when using a USB3 Flash drive formatted has ext4 (USB= 2 + ext4 is OK, USB3 + fat is OK). I presume the affected combination ends up= using larger transfers triggering the problem. The equivalent change in the Broadcom XLDK is if (IS_ENABLED(CONFIG_USB_EHCI_XGS_IPROC)) ehci_writel(ehci, BCM_USB_FIFO_THRESHOLD, &ehci->regs->reserved4[6]); This is problematic because it would unconditionally apply to all ehci controllers whenever CONFIG_USB_EHCI_XGS_IPROC is enabled (also reserved4= only goes to 6 so technically it's indexing off the end of the array). I wasn't sure if I should add a new property or somehow detect the affect= ed host controller. I settled on using of_device_is_compatible() as that see= med the simplest thing to do. drivers/usb/host/ehci-platform.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-pla= tform.c index 006c4f6188a5..0d2de8faa3c1 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -53,6 +53,9 @@ struct ehci_platform_priv { =20 static const char hcd_name[] =3D "ehci-platform"; =20 +#define bcm_iproc_insnreg01 hostpc +#define BCM_USB_FIFO_THRESHOLD 0x00800040 + static int ehci_platform_reset(struct usb_hcd *hcd) { struct platform_device *pdev =3D to_platform_device(hcd->self.controlle= r); @@ -358,6 +361,9 @@ static int ehci_platform_probe(struct platform_device= *dev) =20 device_wakeup_enable(hcd->self.controller); device_enable_async_suspend(hcd->self.controller); + if (of_device_is_compatible(dev->dev.of_node, "brcm,xgs-iproc-ehci")) + ehci_writel(ehci, BCM_USB_FIFO_THRESHOLD, + ehci->regs->bcm_iproc_insnreg01); platform_set_drvdata(dev, hcd); =20 if (priv->quirk_poll) --=20 2.28.0