Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp38412ybk; Fri, 8 May 2020 17:51:45 -0700 (PDT) X-Google-Smtp-Source: APiQypLb8yUZKwFd2EHPEklQQNxqzsxRegcCK6KA/PYD6XlRVRtJ/rmQIPTBsSodTgl6iwXkKMpg X-Received: by 2002:a05:6402:1543:: with SMTP id p3mr4650316edx.333.1588985505825; Fri, 08 May 2020 17:51:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588985505; cv=none; d=google.com; s=arc-20160816; b=nLUd5+MD3Pb0z8bzW9/pc+Q0FV4DUD+52ufwGsWAQ1PTjoDOhmEonf1+kC+bNDZnQp NPZChhMUp2/u3zJHy8fEvZmGYek5pO23P3PoCpfAmkeVIe9kxTCd+L561MVqFxB9FMKD J9S338siSKyxMrR+e8wzBMnSWPQ4Bisl+WSZJyrilHoJUvAvvMJ1s0Zn88YBWNbgP62X OHxf3cWxw82H+E/gR2jkdlw/rTgj56PNzFHRcYaB9rWmibmutN9wRJyGRqDUXjOzdfuE 9tRGoz9rCp1WlvibkHJzakQqQnqc821PiSQEXC6rrmaYTPfTf6s+J1CbNDtNpPsC0E+e NkWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date; bh=SAePoaliTNe8v+Pe4DvnF5rpXFMDvflF6+mkUj0KsXs=; b=Udw8hMXAo5xigfUNgOBIhEVLzSk0qS2146oegSvCUIHFjLThT9zak5JbrGT/PLQ5ko msSrNZ5kJxECX3Bowa/X0UJ5W8EVNQPaYPgMXX/7DuRUg24gUDA0SD/drL4skxaT+je4 K7FHK1b5mPhinQbrJBdj7GBa3DuH5Njw3WYiGCU2/pPkxI5ZBAaSN3wUSHRXWfhDHVXs GZNQOWC/gTmZq9cgOu0aHq6qFWeaxGHo6BnQmjwisqfIMbInK5v20Cnpbrd4Y/NZmRDk Fgu1/Cfoo3ZIE0c71r3+dTS29LdroJTP68fvee1x/q6JS0K3cE77gsPvcn1GBXmAYav0 Weiw== 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 w19si2054932edr.52.2020.05.08.17.51.22; Fri, 08 May 2020 17:51:45 -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 S1728475AbgEIArx (ORCPT + 99 others); Fri, 8 May 2020 20:47:53 -0400 Received: from netrider.rowland.org ([192.131.102.5]:38497 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1728426AbgEIArx (ORCPT ); Fri, 8 May 2020 20:47:53 -0400 Received: (qmail 3733 invoked by uid 500); 8 May 2020 20:47:52 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 8 May 2020 20:47:52 -0400 Date: Fri, 8 May 2020 20:47:52 -0400 (EDT) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Al Cooper cc: linux-kernel@vger.kernel.org, Andy Shevchenko , , , Greg Kroah-Hartman , Krzysztof Kozlowski , , Mathias Nyman , Rob Herring , Yoshihiro Shimoda , Andy Shevchenko Subject: Re: [PATCH v8 4/5] usb: ehci: Add new EHCI driver for Broadcom STB SoC's In-Reply-To: <20200508211929.39020-5-alcooperx@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 8 May 2020, Al Cooper wrote: A few minor typos in the patch description: > 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 -----------------------------------------^ "workaround" is a noun; the verb form is "work around". > controller. The primary workround is for a bug where the Core -----------------------------^ Missing "a". > violates the SOF interval between the first two SOFs transmitted after > resume. This only happens if the resume occurs near the end of a > microframe. The fix is to intercept the echi-hcd request to complete -------------------------------------------^ ehci, not echi. > RESUME and align it to the start of the next microframe. > > Signed-off-by: Al Cooper > Reviewed-by: Andy Shevchenko > --- Basically this new driver is fine. However... > +static inline void ehci_brcm_wait_for_sof(struct ehci_hcd *ehci, u32 delay) > +{ > + u32 frame_idx = ehci_readl(ehci, &ehci->regs->frame_index); > + u32 val; > + int res; > + > + /* Wait for next microframe (every 125 usecs) */ > + res = readl_relaxed_poll_timeout(&ehci->regs->frame_index, val, > + val != frame_idx, 1, 130); > + if (res) > + dev_err(ehci_to_hcd(ehci)->self.controller, > + "Error waiting for SOF\n"); If this patch is going to be redone anyway, you might as well change dev_err() to ehci_err() -- that's what it's for. I should have noticed this earlier, sorry. > +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; > + > + err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)); > + if (err) > + return err; > + > + irq = platform_get_irq(pdev, 0); > + if (irq <= 0) > + return irq; I don't want to get involved in the question of whether or not 0 is a valid IRQ number. The consensus has gone back and forth over the years, and it just doesn't seem important. However, as Sergei points out, if 0 is going to be regarded as an invalid value then we shouldn't return 0 from the probe function here. I'll leave the decision on how to handle this matter up to Greg. :-) Alan Stern