diff mbox

[v7,10/14] usb: phy-mxs: add controller id

Message ID 1387525930-27313-11-git-send-email-peter.chen@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Peter Chen Dec. 20, 2013, 7:52 a.m. UTC
It is used to access un-regulator registers according to
different controllers.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
 drivers/usb/phy/phy-mxs-usb.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Comments

Peter Chen Dec. 24, 2013, 1:34 a.m. UTC | #1
On Tue, Dec 24, 2013 at 10:08:28AM +0800, Shawn Guo wrote:
> On Fri, Dec 20, 2013 at 03:52:06PM +0800, Peter Chen wrote:
> > It is used to access un-regulator registers according to
> > different controllers.
> > 
> > Signed-off-by: Peter Chen <peter.chen@freescale.com>
> > ---
> >  drivers/usb/phy/phy-mxs-usb.c |    8 ++++++++
> >  1 files changed, 8 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> > index f28bdd8..09ece2b 100644
> > --- a/drivers/usb/phy/phy-mxs-usb.c
> > +++ b/drivers/usb/phy/phy-mxs-usb.c
> > @@ -111,6 +111,7 @@ struct mxs_phy {
> >  	struct clk *clk;
> >  	const struct mxs_phy_data *data;
> >  	struct regmap *regmap_anatop;
> > +	int port_id;
> >  };
> >  
> >  static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
> > @@ -237,6 +238,13 @@ static int mxs_phy_probe(struct platform_device *pdev)
> >  		return -ENOMEM;
> >  	}
> >  
> > +	ret = of_alias_get_id(np, "usbphy");
> > +	if (ret < 0) {
> > +		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
> > +		return ret;
> > +	}
> 
> It has the same compatibility issue with an old DTB.  In case the alias
> is not found, we should keep driver work in the existing way rather than
> failing out.
> 

Thanks, will change.

Do the two DTS patches are ok?
Shawn Guo Dec. 24, 2013, 2:08 a.m. UTC | #2
On Fri, Dec 20, 2013 at 03:52:06PM +0800, Peter Chen wrote:
> It is used to access un-regulator registers according to
> different controllers.
> 
> Signed-off-by: Peter Chen <peter.chen@freescale.com>
> ---
>  drivers/usb/phy/phy-mxs-usb.c |    8 ++++++++
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> index f28bdd8..09ece2b 100644
> --- a/drivers/usb/phy/phy-mxs-usb.c
> +++ b/drivers/usb/phy/phy-mxs-usb.c
> @@ -111,6 +111,7 @@ struct mxs_phy {
>  	struct clk *clk;
>  	const struct mxs_phy_data *data;
>  	struct regmap *regmap_anatop;
> +	int port_id;
>  };
>  
>  static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
> @@ -237,6 +238,13 @@ static int mxs_phy_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  	}
>  
> +	ret = of_alias_get_id(np, "usbphy");
> +	if (ret < 0) {
> +		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
> +		return ret;
> +	}

It has the same compatibility issue with an old DTB.  In case the alias
is not found, we should keep driver work in the existing way rather than
failing out.

Shawn

> +	mxs_phy->port_id = ret;
> +
>  	mxs_phy->phy.io_priv		= base;
>  	mxs_phy->phy.dev		= &pdev->dev;
>  	mxs_phy->phy.label		= DRIVER_NAME;
> -- 
> 1.7.8
> 
>
Peter Chen Dec. 24, 2013, 2:09 a.m. UTC | #3
On Tue, Dec 24, 2013 at 10:25:17AM +0800, Shawn Guo wrote:
> On Tue, Dec 24, 2013 at 09:34:47AM +0800, Peter Chen wrote:
> > On Tue, Dec 24, 2013 at 10:08:28AM +0800, Shawn Guo wrote:
> > > On Fri, Dec 20, 2013 at 03:52:06PM +0800, Peter Chen wrote:
> > > > It is used to access un-regulator registers according to
> > > > different controllers.
> > > > 
> > > > Signed-off-by: Peter Chen <peter.chen@freescale.com>
> > > > ---
> > > >  drivers/usb/phy/phy-mxs-usb.c |    8 ++++++++
> > > >  1 files changed, 8 insertions(+), 0 deletions(-)
> > > > 
> > > > diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> > > > index f28bdd8..09ece2b 100644
> > > > --- a/drivers/usb/phy/phy-mxs-usb.c
> > > > +++ b/drivers/usb/phy/phy-mxs-usb.c
> > > > @@ -111,6 +111,7 @@ struct mxs_phy {
> > > >  	struct clk *clk;
> > > >  	const struct mxs_phy_data *data;
> > > >  	struct regmap *regmap_anatop;
> > > > +	int port_id;
> > > >  };
> > > >  
> > > >  static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
> > > > @@ -237,6 +238,13 @@ static int mxs_phy_probe(struct platform_device *pdev)
> > > >  		return -ENOMEM;
> > > >  	}
> > > >  
> > > > +	ret = of_alias_get_id(np, "usbphy");
> > > > +	if (ret < 0) {
> > > > +		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
> > > > +		return ret;
> > > > +	}
> > > 
> > > It has the same compatibility issue with an old DTB.  In case the alias
> > > is not found, we should keep driver work in the existing way rather than
> > > failing out.
> > > 
> > 
> > Thanks, will change.
> > 
> > Do the two DTS patches are ok?
> 
> Yes.  And with the DTS change being optional to kernel driver, the DTS
> and driver changes can be merged independently through two trees.  So
> I just applied those two DTS patches.
> 

Including doc update or not?
Shawn Guo Dec. 24, 2013, 2:25 a.m. UTC | #4
On Tue, Dec 24, 2013 at 09:34:47AM +0800, Peter Chen wrote:
> On Tue, Dec 24, 2013 at 10:08:28AM +0800, Shawn Guo wrote:
> > On Fri, Dec 20, 2013 at 03:52:06PM +0800, Peter Chen wrote:
> > > It is used to access un-regulator registers according to
> > > different controllers.
> > > 
> > > Signed-off-by: Peter Chen <peter.chen@freescale.com>
> > > ---
> > >  drivers/usb/phy/phy-mxs-usb.c |    8 ++++++++
> > >  1 files changed, 8 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
> > > index f28bdd8..09ece2b 100644
> > > --- a/drivers/usb/phy/phy-mxs-usb.c
> > > +++ b/drivers/usb/phy/phy-mxs-usb.c
> > > @@ -111,6 +111,7 @@ struct mxs_phy {
> > >  	struct clk *clk;
> > >  	const struct mxs_phy_data *data;
> > >  	struct regmap *regmap_anatop;
> > > +	int port_id;
> > >  };
> > >  
> > >  static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
> > > @@ -237,6 +238,13 @@ static int mxs_phy_probe(struct platform_device *pdev)
> > >  		return -ENOMEM;
> > >  	}
> > >  
> > > +	ret = of_alias_get_id(np, "usbphy");
> > > +	if (ret < 0) {
> > > +		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
> > > +		return ret;
> > > +	}
> > 
> > It has the same compatibility issue with an old DTB.  In case the alias
> > is not found, we should keep driver work in the existing way rather than
> > failing out.
> > 
> 
> Thanks, will change.
> 
> Do the two DTS patches are ok?

Yes.  And with the DTS change being optional to kernel driver, the DTS
and driver changes can be merged independently through two trees.  So
I just applied those two DTS patches.

Shawn
Shawn Guo Dec. 24, 2013, 2:54 a.m. UTC | #5
On Tue, Dec 24, 2013 at 10:09:17AM +0800, Peter Chen wrote:
> > Yes.  And with the DTS change being optional to kernel driver, the DTS
> > and driver changes can be merged independently through two trees.  So
> > I just applied those two DTS patches.
> > 
> 
> Including doc update or not?

No.  The binding should go with driver changes.

Shawn
diff mbox

Patch

diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c
index f28bdd8..09ece2b 100644
--- a/drivers/usb/phy/phy-mxs-usb.c
+++ b/drivers/usb/phy/phy-mxs-usb.c
@@ -111,6 +111,7 @@  struct mxs_phy {
 	struct clk *clk;
 	const struct mxs_phy_data *data;
 	struct regmap *regmap_anatop;
+	int port_id;
 };
 
 static int mxs_phy_hw_init(struct mxs_phy *mxs_phy)
@@ -237,6 +238,13 @@  static int mxs_phy_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
+	ret = of_alias_get_id(np, "usbphy");
+	if (ret < 0) {
+		dev_err(&pdev->dev, "failed to get alias id, errno %d\n", ret);
+		return ret;
+	}
+	mxs_phy->port_id = ret;
+
 	mxs_phy->phy.io_priv		= base;
 	mxs_phy->phy.dev		= &pdev->dev;
 	mxs_phy->phy.label		= DRIVER_NAME;