From patchwork Fri Jun 28 21:37:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tuomas Tynkkynen X-Patchwork-Id: 255674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 6ADE52C00A1 for ; Sat, 29 Jun 2013 07:38:48 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752720Ab3F1Vie (ORCPT ); Fri, 28 Jun 2013 17:38:34 -0400 Received: from hqemgate03.nvidia.com ([216.228.121.140]:17568 "EHLO hqemgate03.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752728Ab3F1ViM (ORCPT ); Fri, 28 Jun 2013 17:38:12 -0400 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate03.nvidia.com id ; Fri, 28 Jun 2013 14:45:32 -0700 Received: from hqemhub01.nvidia.com ([172.20.12.94]) by hqnvupgp07.nvidia.com (PGP Universal service); Fri, 28 Jun 2013 14:36:05 -0700 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 28 Jun 2013 14:36:05 -0700 Received: from ttynkkynen-lnx.Nvidia.com (172.20.144.16) by hqemhub01.nvidia.com (172.20.150.30) with Microsoft SMTP Server (TLS) id 8.3.298.1; Fri, 28 Jun 2013 14:38:11 -0700 From: Tuomas Tynkkynen To: CC: , , , , , Tuomas Tynkkynen Subject: [PATCH 8/9] usb: phy: tegra: Use DT helpers for phy_type Date: Sat, 29 Jun 2013 00:37:06 +0300 Message-ID: <1372455427-20898-9-git-send-email-ttynkkynen@nvidia.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1372455427-20898-1-git-send-email-ttynkkynen@nvidia.com> References: <1372455427-20898-1-git-send-email-ttynkkynen@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Use the new of_usb_get_phy_mode helper function for parsing phy_type from the device tree. Signed-off-by: Tuomas Tynkkynen --- 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 2cba13e..13049ce 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -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");