RE: [PATCH] usb: tegra: Removing dependency on PHY instance number

From: Venu Byravarasu
Date: Sun Dec 23 2012 - 23:32:02 EST


> -----Original Message-----
> From: Stephen Warren [mailto:swarren@xxxxxxxxxxxxx]
> Sent: Saturday, December 22, 2012 2:32 AM
> To: Venu Byravarasu
> Cc: stern@xxxxxxxxxxxxxxxxxxx; gregkh@xxxxxxxxxxxxxxxxxxx;
> balbi@xxxxxx; linux-usb@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] usb: tegra: Removing dependency on PHY instance
> number
>
> 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.

Thanks Stephen.
As we discussed already, I'll use DT params in upcoming 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.

Correct, Stephen.
Will use DT param for determining the PHY type.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/