From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BC73C433E2 for ; Thu, 10 Sep 2020 15:29:06 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22BFF206CA for ; Thu, 10 Sep 2020 15:29:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="WZyFI4ln" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22BFF206CA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=S8doO9IIJ5aNPiXYy8zt4wzSOObDfNyXTHFGI/21Z6g=; b=WZyFI4lnWc6U1x0vo4SQZS6Zt UU4MyAlnrNUlpes44sYffcJAKoRy8+1Ok1s8dpCkP+vxJbjqshUisycFg9hUR9xlNykVUKh9WFsmX DaREDKVGWurZL6YKlhzDa/qOwRh1KZ1Oo3wcTHlNAi3J/QW+5xR7kR74qsGwRE0WMGKdVI+axZYH7 CnXJ+MGKtNDjxZGZk/jBiKDAfgKcfKSDrj9cH2Xs+fYo875u3wjbSrrg4lNflm6luTkCbBnIWN52O SsysY7xCP8a855OrBo7xGvJqF0pxh36dLPxktIhRWfAhxmhN/53RH3qtrynWGzigqiZEyJA6bUpEA NqkfSYdeQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGOU6-0002lI-7x; Thu, 10 Sep 2020 15:27:38 +0000 Received: from netrider.rowland.org ([192.131.102.5]) by merlin.infradead.org with smtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGOU4-0002ka-FD for linux-arm-kernel@lists.infradead.org; Thu, 10 Sep 2020 15:27:37 +0000 Received: (qmail 851550 invoked by uid 1000); 10 Sep 2020 11:27:34 -0400 Date: Thu, 10 Sep 2020 11:27:34 -0400 From: Alan Stern To: Chris Packham Subject: Re: [PATCH] usb: host: ehci-platform: Add workaround for brcm,xgs-iproc-ehci Message-ID: <20200910152734.GB849569@rowland.harvard.edu> References: <20200910025154.20848-1-chris.packham@alliedtelesis.co.nz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200910025154.20848-1-chris.packham@alliedtelesis.co.nz> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_112736_579097_C86489F2 X-CRM114-Status: GOOD ( 27.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux@prisktech.co.nz, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 10, 2020 at 02:51:53PM +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. Reasonable. > 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-platform.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 { > > static const char hcd_name[] = "ehci-platform"; > > +#define bcm_iproc_insnreg01 hostpc > +#define BCM_USB_FIFO_THRESHOLD 0x00800040 Minor nit: Since hostpc is nominally an array, IMO it would be a little clearer to define bcm_iproc_insnreg01 as hostpc[0] and then do the ehci_writel to &ehci->regs->bcm_iproc_insnreg01. That makes it look more like an ordinary structure member. Also IMO, it's better to put the #define's before the structure definitions. > + > static int ehci_platform_reset(struct usb_hcd *hcd) > { > struct platform_device *pdev = to_platform_device(hcd->self.controller); > @@ -358,6 +361,9 @@ static int ehci_platform_probe(struct platform_device *dev) > > 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); In theory, this should go before the usb_add_hcd() call because afterward the controller is active. But you can't put it before ehci->regs has been assigned, which happens in ehci_setup(). Probably the best place is at the end of ehci_platform_reset(). Alan Stern > platform_set_drvdata(dev, hcd); > > if (priv->quirk_poll) > -- > 2.28.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel