All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Al Cooper <alcooperx@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	"Alan Stern" <stern@rowland.harvard.edu>,
	bcm-kernel-feedback-list@broadcom.com,
	"Chunfeng Yun" <chunfeng.yun@mediatek.com>,
	devicetree@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	linux-usb@vger.kernel.org, "Mark Rutland" <mark.rutland@arm.com>,
	"Mathias Nyman" <mathias.nyman@intel.com>,
	"Rob Herring" <robh+dt@kernel.org>
Subject: Re: [PATCH v2 3/4] usb: ehci: Add new EHCI driver for Broadcom STB SoC's
Date: Sat, 28 Mar 2020 22:18:46 +0200	[thread overview]
Message-ID: <20200328201846.GF1922688@smile.fi.intel.com> (raw)
In-Reply-To: <20200327204711.10614-4-alcooperx@gmail.com>

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



  parent reply	other threads:[~2020-03-28 20:18 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 20:47 [PATCH v2 0/4] Add XHCI, EHCI and OHCI support for Broadcom STB SoS's Al Cooper
2020-03-27 20:47 ` [PATCH v2 1/4] dt-bindings: Add Broadcom STB USB support Al Cooper
2020-03-30 15:40   ` Rob Herring
2020-04-07 20:28     ` Florian Fainelli
2020-04-08 13:13       ` Alan Cooper
2020-04-08 17:24         ` Florian Fainelli
2020-03-27 20:47 ` [PATCH v2 2/4] usb: xhci: xhci-plat: Add support for Broadcom STB SoC's Al Cooper
2020-03-30  2:35   ` Chunfeng Yun
2020-04-06 15:28     ` Alan Cooper
2020-03-31  9:37   ` Mathias Nyman
2020-03-27 20:47 ` [PATCH v2 3/4] usb: ehci: Add new EHCI driver " Al Cooper
2020-03-28  0:38   ` Alan Stern
2020-03-28 20:18   ` Andy Shevchenko [this message]
2020-04-06 18:46     ` Alan Cooper
2020-03-27 20:47 ` [PATCH v2 4/4] usb: host: Add ability to build new Broadcom STB USB drivers Al Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200328201846.GF1922688@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=alcooperx@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=chunfeng.yun@mediatek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=j.neuschaefer@gmx.net \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathias.nyman@intel.com \
    --cc=robh+dt@kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.