On Sat, Mar 28, 2020 at 4:18 PM Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> wrote: > > 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 <linux/acpi.h> > > +#include <linux/of.h> > > I didn;t find evidence these are needed. I removed them. > > ... > > > > + res = readl_relaxed_poll_timeout(&ehci->regs->frame_index, val, > > + (val != frame_idx), 1, 130); > > Too many parentheses. > Fixed > > + 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. > Fixed. > > + /* Hook the hub control routine to work around a bug */ > > > + if (org_hub_control == NULL) > > if (!org_hub_control) ? > Changed. > > + 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; ? > Changed. > > +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. > Changed. > > +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? > Changed to handle the failure. > > +} > > > +#endif /* CONFIG_PM_SLEEP */ > > ... > > > +MODULE_DESCRIPTION(BRCM_DRIVER_DESC); > > Better to have it explicit. > Changed. > -- > With Best Regards, > Andy Shevchenko > > v3 coming. Thanks again for the review Al