Thread (14 messages) 14 messages, 5 authors, 2020-05-11

Re: [PATCH v8 4/5] usb: ehci: Add new EHCI driver for Broadcom STB SoC's

From: Alan Stern <stern@rowland.harvard.edu>
Date: 2020-05-09 00:47:54
Also in: linux-usb, lkml

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 <alcooperx@gmail.com>
Reviewed-by: Andy Shevchenko <redacted>
---
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

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help