Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp916479ybb; Sat, 28 Mar 2020 13:19:52 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt3blTRUzZT71T1Ovl1E3686DhF7Jfl87Ir6pK0rj3Y0LsoMAAvW2YWpWKaxCxH7M96iPPt X-Received: by 2002:aca:5208:: with SMTP id g8mr3020750oib.169.1585426791932; Sat, 28 Mar 2020 13:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585426791; cv=none; d=google.com; s=arc-20160816; b=YPrqxFUexcMKasMiebPGIyycqoowoVQZFC4RhrozWfYoLTeX9JiGpMiCIl2P80JsS9 NQQzx1iNOYujymHtuzQDc10aQaeFlB5Yrq+eTPwHyFxGShVpZLPs+KR/ZLOOIm1QHpJ5 rUQoqdYBU5ijuzQpEcFMoqNRqbnXugSqncUCnjE4OSuDmPa3aTZ8dpom48V26TeiuKBP DTd/abgdQtQeFvdZ9iMl6QxYVM3c7MgOOi6WjgD3+zga+dbAhU8Ca4xNtKfRgAOg9yiE WLr1qAfDap+aOzaXvGDhoBezeqRyudQzU5ySNHXrkoJ+UWs10sPEYQr8u4GYswBMJUqe ps+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:ironport-sdr; bh=gJGPMmRfeFnpCFYN7Yfazn6XurIEYz8625me4Sv8rnc=; b=NL1o+WLI+xtxlBy84bgFy31zECEyS9Rx7d0vn3eKb1sLIU18/emEAuWQwhUgMb1TcH +UuryZehWSYmGK0rKa4dDyKLWKdKw7fnDHFdba9YRECOOscKJKEiv6H3e2T30ajoHpgv x7iCKuoWiR5zlJ4kSgrrjYIux0zAgeLMEsaTPkffq112DWLSM+UD8epsFaVsIu+TxY4g RhQJLMnvqfwVRG+7l14jBRQAiXs49Y4RmEbQKeGN/JfRBA6+p0VHWrHjSGakqtfUuMsN /GYZhiWSp1G/0egVI55wopHmzwoimZrhRRCdc2L66ASQhrdRhpwrVAnaiT4nZmlpm2K3 kLBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7si2283739otp.258.2020.03.28.13.19.37; Sat, 28 Mar 2020 13:19:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727199AbgC1USt (ORCPT + 99 others); Sat, 28 Mar 2020 16:18:49 -0400 Received: from mga18.intel.com ([134.134.136.126]:13886 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727009AbgC1USt (ORCPT ); Sat, 28 Mar 2020 16:18:49 -0400 IronPort-SDR: amEyykdrmcuGDzwxLI7SVxyFpb5FEmzZUf2j9Em/Rr2HisJSf1jimTlDcVK6D2gXmomoxJkzbS HTncgiKjmUVw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Mar 2020 13:18:48 -0700 IronPort-SDR: 8G6vRZkbxY7Lejf9g5PvRI2WmjBZDd83G0KoDb42WLdqIVZBhTz7RXzqZj1IUee8ghKyGOIFf0 APVn58glMouQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,317,1580803200"; d="scan'208";a="294222256" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by FMSMGA003.fm.intel.com with ESMTP; 28 Mar 2020 13:18:44 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jIHuo-00Dm35-DF; Sat, 28 Mar 2020 22:18:46 +0200 Date: Sat, 28 Mar 2020 22:18:46 +0200 From: Andy Shevchenko To: Al Cooper Cc: linux-kernel@vger.kernel.org, Alan Stern , bcm-kernel-feedback-list@broadcom.com, Chunfeng Yun , devicetree@vger.kernel.org, Greg Kroah-Hartman , Jonathan =?iso-8859-1?Q?Neusch=E4fer?= , Krzysztof Kozlowski , linux-usb@vger.kernel.org, Mark Rutland , Mathias Nyman , Rob Herring Subject: Re: [PATCH v2 3/4] usb: ehci: Add new EHCI driver for Broadcom STB SoC's Message-ID: <20200328201846.GF1922688@smile.fi.intel.com> References: <20200327204711.10614-1-alcooperx@gmail.com> <20200327204711.10614-4-alcooperx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200327204711.10614-4-alcooperx@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 27, 2020 at 04:47:10PM -0400, Al Cooper wrote: > Add a new EHCI driver for Broadcom STB SoC's. A new EHCI driver > was created instead of adding support to the existing ehci platform > driver because of the code required to workaround bugs in the EHCI > controller. I'm not sure this has been tested. See below. ... > +#include > +#include I didn;t find evidence these are needed. ... > + res = readl_relaxed_poll_timeout(&ehci->regs->frame_index, val, > + (val != frame_idx), 1, 130); Too many parentheses. > + if (res) > + dev_err(ehci_to_hcd(ehci)->self.controller, > + "Error waiting for SOF\n"); ... > +static int ehci_brcm_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct resource *res_mem; > + struct brcm_priv *priv; > + struct usb_hcd *hcd; > + int irq; > + int err; > + > + if (usb_disabled()) > + return -ENODEV; > + > + err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); > + if (err) > + return err; > + > + irq = platform_get_irq(pdev, 0); > + return irq; I'm not sure it was an intention to leave a lot of dead code below. > + /* Hook the hub control routine to work around a bug */ > + if (org_hub_control == NULL) if (!org_hub_control) ? > + org_hub_control = ehci_brcm_hc_driver.hub_control; > + ehci_brcm_hc_driver.hub_control = ehci_brcm_hub_control; > + device_wakeup_enable(hcd->self.controller); > + device_enable_async_suspend(hcd->self.controller); > + platform_set_drvdata(pdev, hcd); > + > + return err; return 0; ? > +err_clk: > + clk_disable_unprepare(priv->clk); > +err_hcd: > + usb_put_hcd(hcd); > + > + return err; > +} ... > +#ifdef CONFIG_PM_SLEEP You also can use __maybe_unused annotations. > +static int ehci_brcm_suspend(struct device *dev) > +{ > + int ret; > + struct usb_hcd *hcd = dev_get_drvdata(dev); > + struct brcm_priv *priv = hcd_to_ehci_priv(hcd); > + bool do_wakeup = device_may_wakeup(dev); > + > + ret = ehci_suspend(hcd, do_wakeup); > + clk_disable_unprepare(priv->clk); > + return ret; So, if you fail to suspend the device, clocks will become unusable, how to recover from such case? > +} > +#endif /* CONFIG_PM_SLEEP */ ... > +MODULE_DESCRIPTION(BRCM_DRIVER_DESC); Better to have it explicit. -- With Best Regards, Andy Shevchenko