public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: Venu Byravarasu <vbyravarasu@nvidia.com>
Cc: stern@rowland.harvard.edu, gregkh@linuxfoundation.org,
	balbi@ti.com, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: tegra: Removing dependency on PHY instance number
Date: Fri, 21 Dec 2012 14:01:35 -0700	[thread overview]
Message-ID: <50D4CE2F.1090303@wwwdotorg.org> (raw)
In-Reply-To: <1356073105-13043-1-git-send-email-vbyravarasu@nvidia.com>

On 12/20/2012 11:58 PM, Venu Byravarasu wrote:
> Tegra2 has two varieties of USB PHYs:
> Instance 0 - legacy PHY interface and
> Instace 1 & 2 - non-legacy standard PHY interfaces.
> 
> PHY driver is using instance numbers to identify the
> interface type.
> 
> With this patch Modified PHY driver to make use of
> DT property for handling this.
> 
> ULPI PHY is used on USB PHY instance 1 & UTMI is
> used on other two instances. Hence modified PHY type
> detection also from instance number to the parameter
> passed from host driver.

Mostly seems fine to me; just a couple more things I noticed inline
below. For the record, I'd like to take this through the Tegra tree with
all the other Tegra-related USB patches in order to manage any
dependencies, with the USB maintainers' Acks. Thanks.

> diff --git a/drivers/usb/phy/tegra_usb_phy.c b/drivers/usb/phy/tegra_usb_phy.c

> +struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev,
> +	bool is_legacy_mode, void __iomem *regs, void *config,
> +	enum tegra_usb_phy_mode phy_mode)

> +	u8 index = is_legacy_mode ? 0 : 2;

I know this looks slightly icky, but I discussed earlier with Venu that
this will be replaced by reading all the parameters out of device tree,
as soon as this code becomes a true driver. I think the patch for that
is up next, or at most after a few more cleanup patches.

> +	phy->is_ulpi_phy = config ? true : false;
>  
>  	if (!phy->config) {
> -		if (phy_is_ulpi(phy)) {
> +		if (phy->is_ulpi_phy) {
>  			pr_err("%s: ulpi phy configuration missing", __func__);
>  			err = -EINVAL;
>  			goto err0;

That check will never fire now, since phy->is_ulpi_phy is calculated
based on whether phy->config is set. I think it's fine for now to rely
on the EHCI driver correctly passing config or NULL, and hence you could
simply delete some of this error-checking code. I imagine that when the
PHY driver is reworked to be an actual device rather than a utility
module, phy->is_ulpi_phy will be determined by the compatible value of
the PHY node in device tree.

  reply	other threads:[~2012-12-21 21:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-21  6:58 [PATCH] usb: tegra: Removing dependency on PHY instance number Venu Byravarasu
2012-12-21 21:01 ` Stephen Warren [this message]
2012-12-24  4:32   ` Venu Byravarasu

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=50D4CE2F.1090303@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=vbyravarasu@nvidia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox