From patchwork Fri Aug 16 13:09:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 2845668 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C24339F271 for ; Fri, 16 Aug 2013 13:12:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0B1D20284 for ; Fri, 16 Aug 2013 13:12:37 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 58BAB201D5 for ; Fri, 16 Aug 2013 13:12:36 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VAJoV-0000rc-IQ; Fri, 16 Aug 2013 13:11:35 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VAJnz-0001dW-18; Fri, 16 Aug 2013 13:11:03 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VAJnG-0001Wx-70 for linux-arm-kernel@lists.infradead.org; Fri, 16 Aug 2013 13:10:20 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r7GD9lMG016565; Fri, 16 Aug 2013 08:09:47 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r7GD9lAn014994; Fri, 16 Aug 2013 08:09:47 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Fri, 16 Aug 2013 08:09:47 -0500 Received: from localhost.localdomain (h113-233.vpn.ti.com [172.24.113.233]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r7GD9WcY026886; Fri, 16 Aug 2013 08:09:45 -0500 From: Roger Quadros To: , Subject: [PATCH v3 4/8] usb: phy: omap-usb3: Don't use omap_get_control_dev() Date: Fri, 16 Aug 2013 16:09:27 +0300 Message-ID: <1376658571-20992-5-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1376658571-20992-1-git-send-email-rogerq@ti.com> References: <1376658571-20992-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130816_091018_506456_77ED7C4E X-CRM114-Status: GOOD ( 12.76 ) X-Spam-Score: -9.6 (---------) Cc: devicetree@vger.kernel.org, george.cherian@TI.COM, tony@atomide.com, bigeasy@linutronix.de, linux-usb@vger.kernel.org, kishon@TI.COM, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roger Quadros X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP omap_get_control_dev() is being deprecated as it doesn't support multiple instances. As control device is present only from OMAP4 onwards which supports DT only, we use phandles to get the reference to the control device. As we don't support non-DT boot, we just bail out on probe if device node is not present. Signed-off-by: Roger Quadros --- drivers/usb/phy/phy-omap-usb3.c | 22 ++++++++++++++++++---- 1 files changed, 18 insertions(+), 4 deletions(-) diff --git a/drivers/usb/phy/phy-omap-usb3.c b/drivers/usb/phy/phy-omap-usb3.c index 4a7f27c..981313e 100644 --- a/drivers/usb/phy/phy-omap-usb3.c +++ b/drivers/usb/phy/phy-omap-usb3.c @@ -26,6 +26,7 @@ #include #include #include +#include #define PLL_STATUS 0x00000004 #define PLL_GO 0x00000008 @@ -198,6 +199,12 @@ static int omap_usb3_probe(struct platform_device *pdev) { struct omap_usb *phy; struct resource *res; + struct device_node *node = pdev->dev.of_node; + struct device_node *control_node; + struct platform_device *control_pdev; + + if (!node) + return -EINVAL; phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); if (!phy) { @@ -239,11 +246,18 @@ static int omap_usb3_probe(struct platform_device *pdev) return -EINVAL; } - phy->control_dev = omap_get_control_dev(); - if (IS_ERR(phy->control_dev)) { - dev_dbg(&pdev->dev, "Failed to get control device\n"); - return -ENODEV; + control_node = of_parse_phandle(node, "ctrl-module", 0); + if (!control_node) { + dev_err(&pdev->dev, "Failed to get control device phandle\n"); + return -EINVAL; } + control_pdev = of_find_device_by_node(control_node); + if (!control_pdev) { + dev_err(&pdev->dev, "Failed to get control device\n"); + return -EINVAL; + } + + phy->control_dev = &control_pdev->dev; omap_control_usb_phy_power(phy->control_dev, 0); usb_add_phy_dev(&phy->phy);