mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
To: <balbi@ti.com>
Cc: <linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-usb@vger.kernel.org>, <swarren@wwwdotorg.org>,
	<gregkh@linuxfoundation.org>,
	Tuomas Tynkkynen <ttynkkynen@nvidia.com>
Subject: [PATCH v2 8/9] usb: phy: tegra: Use DT helpers for phy_type
Date: Mon, 15 Jul 2013 22:53:48 +0300	[thread overview]
Message-ID: <1373918029-28977-9-git-send-email-ttynkkynen@nvidia.com> (raw)
In-Reply-To: <1373918029-28977-1-git-send-email-ttynkkynen@nvidia.com>

Use the new of_usb_get_phy_mode helper function for parsing phy_type
from the device tree.

Signed-off-by: Tuomas Tynkkynen <ttynkkynen@nvidia.com>
---
 drivers/usb/phy/phy-tegra-usb.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index 0d48f4e..3ded872 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -31,6 +31,7 @@
 #include <linux/of_gpio.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
+#include <linux/usb/of.h>
 #include <asm/mach-types.h>
 #include <linux/usb/ehci_def.h>
 #include <linux/usb/tegra_usb_phy.h>
@@ -859,6 +860,7 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
 	struct resource *res;
 	struct tegra_usb_phy *tegra_phy = NULL;
 	struct device_node *np = pdev->dev.of_node;
+	enum usb_phy_interface phy_type;
 	int err;
 
 	tegra_phy = devm_kzalloc(&pdev->dev, sizeof(*tegra_phy), GFP_KERNEL);
@@ -883,12 +885,12 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
 	tegra_phy->is_legacy_phy =
 		of_property_read_bool(np, "nvidia,has-legacy-mode");
 
-	err = of_property_match_string(np, "phy_type", "ulpi");
-	if (err < 0) {
+	phy_type = of_usb_get_phy_mode(np);
+	if (phy_type == USBPHY_INTERFACE_MODE_UTMI) {
 		err = utmi_phy_probe(tegra_phy, pdev);
 		if (err < 0)
 			return err;
-	} else {
+	} else if (phy_type == USBPHY_INTERFACE_MODE_ULPI) {
 		tegra_phy->is_ulpi_phy = true;
 
 		tegra_phy->reset_gpio =
@@ -898,8 +900,10 @@ static int tegra_usb_phy_probe(struct platform_device *pdev)
 				tegra_phy->reset_gpio);
 			return tegra_phy->reset_gpio;
 		}
-
 		tegra_phy->config = NULL;
+	} else {
+		dev_err(&pdev->dev, "phy_type is invalid or unsupported\n");
+		return -EINVAL;
 	}
 
 	err = of_property_match_string(np, "dr_mode", "otg");
-- 
1.8.1.5


  parent reply	other threads:[~2013-07-15 19:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 19:53 [PATCH v2 0/9] Tegra USB cleanup series Tuomas Tynkkynen
2013-07-15 19:53 ` [PATCH v2 1/9] usb: phy: tegra: Remove unnecessary 'dev' field Tuomas Tynkkynen
2013-07-15 19:53 ` [PATCH v2 2/9] usb: host: tegra: Remove leftover code Tuomas Tynkkynen
2013-07-15 19:53 ` [PATCH v2 3/9] usb: tegra: host: Remove references to plat data Tuomas Tynkkynen
2013-07-15 19:53 ` [PATCH v2 4/9] ARM: tegra: Remove USB platform data Tuomas Tynkkynen
2013-07-15 23:22   ` Stephen Warren
2013-07-15 19:53 ` [PATCH v2 5/9] usb: phy: tegra: Register as an USB PHY Tuomas Tynkkynen
2013-07-15 19:53 ` [PATCH v2 6/9] usb: host: tegra: Locate a PHY via standard API Tuomas Tynkkynen
2013-07-15 19:53 ` [PATCH v2 7/9] usb: phy: tegra: Remove custom PHY locating APIs Tuomas Tynkkynen
2013-07-15 19:53 ` Tuomas Tynkkynen [this message]
2013-07-15 19:53 ` [PATCH v2 9/9] usb: phy: tegra: Use DT helpers for dr_mode Tuomas Tynkkynen
2013-07-15 23:28 ` [PATCH v2 0/9] Tegra USB cleanup series Stephen Warren
2013-07-25 17:51   ` Felipe Balbi
2013-07-25 18:22     ` Tuomas Tynkkynen

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=1373918029-28977-9-git-send-email-ttynkkynen@nvidia.com \
    --to=ttynkkynen@nvidia.com \
    --cc=balbi@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=swarren@wwwdotorg.org \
    /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

Powered by JetHome