Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2180910pxk; Mon, 14 Sep 2020 06:54:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAbd9x/bs0ZUxJJzlFxPWXeIrRtNI2G7J/dtz7DoW2lB5u3Mj/aWc7ZP4gEPEcb2U+p+xZ X-Received: by 2002:a17:906:194b:: with SMTP id b11mr14583415eje.159.1600091653142; Mon, 14 Sep 2020 06:54:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600091653; cv=none; d=google.com; s=arc-20160816; b=WzFQNAxkEcLteIMfroAbG5xHGmaEUedfPuKrElYKCVfRmW8sFIplwowE9YkFhLcdTP ZMaJ+gq8GgjbLBx/fGZccD77pZYPr09KUOUfYgOSU3HiUvjBhDDg4UIWvANafW2atGTO UCu0HfTa7DHKCK1qot6FCMx+wKGUQRU+7wR5AiSWFY5216Pk8c2BD5Z1BGELDpVwZI7N ZQmde2s3B2YLhUO8z3phmA9Ut3wozqWD3jfCZHfEL+7GEuGhxKwjTUvCwg38mTom9Uay ncjaPpaNB1KDsrJ/ERLYYA7vuvxtQTlFTTQXS6Gjq73Q2oW2NtdSkwipt3mr9yYOkUFx A9dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=4IrBEwETIbi0mlCU6F1FnosW+aIMHa0PTuiMVT8BX5M=; b=cuklkdqg21jp4yY2hdFZppFk0ktwR9FHnb+B7rS3Kd16uLTuhrszUy0mYAlcbKSVom qUpRknGx9XRdzaKR4tmVONgRcJYHGDdem5i6rs/OJ35f8oslf0bgXJjVr6bO4FEFjFWw Rw1sZ4c6ufMHRzJsJEHupzC+VwhUb8BjgGsWFLB9dh0YxwmtIora5qbwWlFxc0X3tN5P fRMvk6FKX+cyiTUJlYk6uVQwUtZ4QBW7ujDgF9B2QPthfGlVQSj+QiPPazPQRILlzMbL MAlQdE3ZrAY1QMmQyVey2OVzRN7ceVVddv3suf0yWpPgDPGUtQZH/aiNNd6o70yF2XTy q0dg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si7576981edp.477.2020.09.14.06.53.51; Mon, 14 Sep 2020 06:54:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbgINNwk (ORCPT + 99 others); Mon, 14 Sep 2020 09:52:40 -0400 Received: from netrider.rowland.org ([192.131.102.5]:37257 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1726721AbgINNsw (ORCPT ); Mon, 14 Sep 2020 09:48:52 -0400 Received: (qmail 963410 invoked by uid 1000); 14 Sep 2020 09:48:43 -0400 Date: Mon, 14 Sep 2020 09:48:43 -0400 From: Alan Stern To: Chris Packham Cc: linux@prisktech.co.nz, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] usb: host: ehci-platform: Add workaround for brcm,xgs-iproc-ehci Message-ID: <20200914134843.GA963127@rowland.harvard.edu> References: <20200913215926.29880-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200913215926.29880-1-chris.packham@alliedtelesis.co.nz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2020 at 09:59:26AM +1200, Chris Packham wrote: > 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 to > avoid a soft lockup when using a USB3 Flash drive formatted has ext4 (USB2 + > 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 affected > host controller. I settled on using of_device_is_compatible() as that seemed > the simplest thing to do. > > Changes in v2: > - move workaround to ehci_platform_reset > - cosmetic changes suggested by Alan > > drivers/usb/host/ehci-platform.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c > index 006c4f6188a5..9804ffa9e67f 100644 > --- a/drivers/usb/host/ehci-platform.c > +++ b/drivers/usb/host/ehci-platform.c > @@ -42,6 +42,9 @@ > #define EHCI_MAX_CLKS 4 > #define hcd_to_ehci_priv(h) ((struct ehci_platform_priv *)hcd_to_ehci(h)->priv) > > +#define BCM_USB_FIFO_THRESHOLD 0x00800040 > +#define bcm_iproc_insnreg01 hostpc[0] > + > struct ehci_platform_priv { > struct clk *clks[EHCI_MAX_CLKS]; > struct reset_control *rsts; > @@ -75,6 +78,11 @@ static int ehci_platform_reset(struct usb_hcd *hcd) > > if (pdata->no_io_watchdog) > ehci->need_io_watchdog = 0; > + > + if (of_device_is_compatible(pdev->dev.of_node, "brcm,xgs-iproc-ehci")) > + ehci_writel(ehci, BCM_USB_FIFO_THRESHOLD, > + &ehci->regs->bcm_iproc_insnreg01); > + > return 0; > } Acked-by: Alan Stern