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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

...


> +	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





[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux