Patchwork [3/4] USB: PHY: Tegra: Get rid of instance number to differentiate PHY type

login
register
mail settings
Submitter Venu Byravarasu
Date Jan. 16, 2013, 1:30 p.m.
Message ID <1358343022-28919-4-git-send-email-vbyravarasu@nvidia.com>
Download mbox | patch
Permalink /patch/212512/
State Accepted, archived
Headers show

Comments

Venu Byravarasu - Jan. 16, 2013, 1:30 p.m.
Tegra20 USB has 3 PHY instances:
Instance 1 and 3 are UTMI. Instance 2 is ULPI.

As instance number was used to differentiate ULPI from UTMI,
used DT param to get this info and processed accordingly.

Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>
---
 drivers/usb/phy/tegra_usb_phy.c   |   23 +++++++++--------------
 include/linux/usb/tegra_usb_phy.h |    1 +
 2 files changed, 10 insertions(+), 14 deletions(-)
Stephen Warren - Jan. 18, 2013, 5:04 p.m.
On 01/16/2013 06:30 AM, Venu Byravarasu wrote:
> Tegra20 USB has 3 PHY instances:
> Instance 1 and 3 are UTMI. Instance 2 is ULPI.
> 
> As instance number was used to differentiate ULPI from UTMI,
> used DT param to get this info and processed accordingly.

> diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
> index f03e157..a6a89d4 100644
> --- a/include/linux/usb/tegra_usb_phy.h
> +++ b/include/linux/usb/tegra_usb_phy.h
> @@ -60,6 +60,7 @@ struct tegra_usb_phy {
>  	struct usb_phy u_phy;
>  	struct device *dev;
>  	bool is_legacy_phy;
> +	bool is_ulpi_phy;
>  };

I see the code that uses this new field, but it doesn't appear to be set
anywhere...
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Stephen Warren - Jan. 18, 2013, 5:07 p.m.
On 01/18/2013 10:04 AM, Stephen Warren wrote:
> On 01/16/2013 06:30 AM, Venu Byravarasu wrote:
>> Tegra20 USB has 3 PHY instances:
>> Instance 1 and 3 are UTMI. Instance 2 is ULPI.
>>
>> As instance number was used to differentiate ULPI from UTMI,
>> used DT param to get this info and processed accordingly.
> 
>> diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
>> index f03e157..a6a89d4 100644
>> --- a/include/linux/usb/tegra_usb_phy.h
>> +++ b/include/linux/usb/tegra_usb_phy.h
>> @@ -60,6 +60,7 @@ struct tegra_usb_phy {
>>  	struct usb_phy u_phy;
>>  	struct device *dev;
>>  	bool is_legacy_phy;
>> +	bool is_ulpi_phy;
>>  };
> 
> I see the code that uses this new field, but it doesn't appear to be set
> anywhere...

Oh, I see that code ended up being part of patch 4. Can you please
repost the series with that chunk moved into patch 3 where it belongs?
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi - Jan. 18, 2013, 6:34 p.m.
On Wed, Jan 16, 2013 at 07:00:21PM +0530, Venu Byravarasu wrote:
> Tegra20 USB has 3 PHY instances:
> Instance 1 and 3 are UTMI. Instance 2 is ULPI.
> 
> As instance number was used to differentiate ULPI from UTMI,
> used DT param to get this info and processed accordingly.
> 
> Signed-off-by: Venu Byravarasu <vbyravarasu@nvidia.com>

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/usb/phy/tegra_usb_phy.c   |   23 +++++++++--------------
>  include/linux/usb/tegra_usb_phy.h |    1 +
>  2 files changed, 10 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/usb/phy/tegra_usb_phy.c b/drivers/usb/phy/tegra_usb_phy.c
> index 79280fe..ce1ff2a 100644
> --- a/drivers/usb/phy/tegra_usb_phy.c
> +++ b/drivers/usb/phy/tegra_usb_phy.c
> @@ -209,11 +209,6 @@ static struct tegra_utmip_config utmip_default[] = {
>  	},
>  };
>  
> -static inline bool phy_is_ulpi(struct tegra_usb_phy *phy)
> -{
> -	return (phy->instance == 1);
> -}
> -
>  static int utmip_pad_open(struct tegra_usb_phy *phy)
>  {
>  	phy->pad_clk = clk_get_sys("utmip-pad", NULL);
> @@ -655,7 +650,7 @@ static int	tegra_phy_init(struct usb_phy *x)
>  	struct tegra_ulpi_config *ulpi_config;
>  	int err;
>  
> -	if (phy_is_ulpi(phy)) {
> +	if (phy->is_ulpi_phy) {
>  		ulpi_config = phy->config;
>  		phy->clk = clk_get_sys(NULL, ulpi_config->clk);
>  		if (IS_ERR(phy->clk)) {
> @@ -693,7 +688,7 @@ static void tegra_usb_phy_close(struct usb_phy *x)
>  {
>  	struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy);
>  
> -	if (phy_is_ulpi(phy))
> +	if (phy->is_ulpi_phy)
>  		clk_put(phy->clk);
>  	else
>  		utmip_pad_close(phy);
> @@ -704,7 +699,7 @@ static void tegra_usb_phy_close(struct usb_phy *x)
>  
>  static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
>  {
> -	if (phy_is_ulpi(phy))
> +	if (phy->is_ulpi_phy)
>  		return ulpi_phy_power_on(phy);
>  	else
>  		return utmi_phy_power_on(phy);
> @@ -712,7 +707,7 @@ static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
>  
>  static int tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
>  {
> -	if (phy_is_ulpi(phy))
> +	if (phy->is_ulpi_phy)
>  		return ulpi_phy_power_off(phy);
>  	else
>  		return utmi_phy_power_off(phy);
> @@ -749,7 +744,7 @@ struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
>  		of_property_read_bool(np, "nvidia,has-legacy-mode");
>  
>  	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;
> @@ -796,14 +791,14 @@ EXPORT_SYMBOL_GPL(tegra_usb_phy_open);
>  
>  void tegra_usb_phy_preresume(struct tegra_usb_phy *phy)
>  {
> -	if (!phy_is_ulpi(phy))
> +	if (!phy->is_ulpi_phy)
>  		utmi_phy_preresume(phy);
>  }
>  EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume);
>  
>  void tegra_usb_phy_postresume(struct tegra_usb_phy *phy)
>  {
> -	if (!phy_is_ulpi(phy))
> +	if (!phy->is_ulpi_phy)
>  		utmi_phy_postresume(phy);
>  }
>  EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume);
> @@ -811,14 +806,14 @@ EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume);
>  void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
>  				 enum tegra_usb_phy_port_speed port_speed)
>  {
> -	if (!phy_is_ulpi(phy))
> +	if (!phy->is_ulpi_phy)
>  		utmi_phy_restore_start(phy, port_speed);
>  }
>  EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start);
>  
>  void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy)
>  {
> -	if (!phy_is_ulpi(phy))
> +	if (!phy->is_ulpi_phy)
>  		utmi_phy_restore_end(phy);
>  }
>  EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end);
> diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
> index f03e157..a6a89d4 100644
> --- a/include/linux/usb/tegra_usb_phy.h
> +++ b/include/linux/usb/tegra_usb_phy.h
> @@ -60,6 +60,7 @@ struct tegra_usb_phy {
>  	struct usb_phy u_phy;
>  	struct device *dev;
>  	bool is_legacy_phy;
> +	bool is_ulpi_phy;
>  };
>  
>  struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
> -- 
> 1.7.0.4
>

Patch

diff --git a/drivers/usb/phy/tegra_usb_phy.c b/drivers/usb/phy/tegra_usb_phy.c
index 79280fe..ce1ff2a 100644
--- a/drivers/usb/phy/tegra_usb_phy.c
+++ b/drivers/usb/phy/tegra_usb_phy.c
@@ -209,11 +209,6 @@  static struct tegra_utmip_config utmip_default[] = {
 	},
 };
 
-static inline bool phy_is_ulpi(struct tegra_usb_phy *phy)
-{
-	return (phy->instance == 1);
-}
-
 static int utmip_pad_open(struct tegra_usb_phy *phy)
 {
 	phy->pad_clk = clk_get_sys("utmip-pad", NULL);
@@ -655,7 +650,7 @@  static int	tegra_phy_init(struct usb_phy *x)
 	struct tegra_ulpi_config *ulpi_config;
 	int err;
 
-	if (phy_is_ulpi(phy)) {
+	if (phy->is_ulpi_phy) {
 		ulpi_config = phy->config;
 		phy->clk = clk_get_sys(NULL, ulpi_config->clk);
 		if (IS_ERR(phy->clk)) {
@@ -693,7 +688,7 @@  static void tegra_usb_phy_close(struct usb_phy *x)
 {
 	struct tegra_usb_phy *phy = container_of(x, struct tegra_usb_phy, u_phy);
 
-	if (phy_is_ulpi(phy))
+	if (phy->is_ulpi_phy)
 		clk_put(phy->clk);
 	else
 		utmip_pad_close(phy);
@@ -704,7 +699,7 @@  static void tegra_usb_phy_close(struct usb_phy *x)
 
 static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
 {
-	if (phy_is_ulpi(phy))
+	if (phy->is_ulpi_phy)
 		return ulpi_phy_power_on(phy);
 	else
 		return utmi_phy_power_on(phy);
@@ -712,7 +707,7 @@  static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy)
 
 static int tegra_usb_phy_power_off(struct tegra_usb_phy *phy)
 {
-	if (phy_is_ulpi(phy))
+	if (phy->is_ulpi_phy)
 		return ulpi_phy_power_off(phy);
 	else
 		return utmi_phy_power_off(phy);
@@ -749,7 +744,7 @@  struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,
 		of_property_read_bool(np, "nvidia,has-legacy-mode");
 
 	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;
@@ -796,14 +791,14 @@  EXPORT_SYMBOL_GPL(tegra_usb_phy_open);
 
 void tegra_usb_phy_preresume(struct tegra_usb_phy *phy)
 {
-	if (!phy_is_ulpi(phy))
+	if (!phy->is_ulpi_phy)
 		utmi_phy_preresume(phy);
 }
 EXPORT_SYMBOL_GPL(tegra_usb_phy_preresume);
 
 void tegra_usb_phy_postresume(struct tegra_usb_phy *phy)
 {
-	if (!phy_is_ulpi(phy))
+	if (!phy->is_ulpi_phy)
 		utmi_phy_postresume(phy);
 }
 EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume);
@@ -811,14 +806,14 @@  EXPORT_SYMBOL_GPL(tegra_usb_phy_postresume);
 void tegra_ehci_phy_restore_start(struct tegra_usb_phy *phy,
 				 enum tegra_usb_phy_port_speed port_speed)
 {
-	if (!phy_is_ulpi(phy))
+	if (!phy->is_ulpi_phy)
 		utmi_phy_restore_start(phy, port_speed);
 }
 EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_start);
 
 void tegra_ehci_phy_restore_end(struct tegra_usb_phy *phy)
 {
-	if (!phy_is_ulpi(phy))
+	if (!phy->is_ulpi_phy)
 		utmi_phy_restore_end(phy);
 }
 EXPORT_SYMBOL_GPL(tegra_ehci_phy_restore_end);
diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_usb_phy.h
index f03e157..a6a89d4 100644
--- a/include/linux/usb/tegra_usb_phy.h
+++ b/include/linux/usb/tegra_usb_phy.h
@@ -60,6 +60,7 @@  struct tegra_usb_phy {
 	struct usb_phy u_phy;
 	struct device *dev;
 	bool is_legacy_phy;
+	bool is_ulpi_phy;
 };
 
 struct tegra_usb_phy *tegra_usb_phy_open(struct device *dev, int instance,