From patchwork Thu Aug 1 14:05:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 2837058 Return-Path: X-Original-To: patchwork-linux-omap@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 2873F9F7D6 for ; Thu, 1 Aug 2013 14:08:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0EA6B2033F for ; Thu, 1 Aug 2013 14:08:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF6B120334 for ; Thu, 1 Aug 2013 14:08:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756407Ab3HAOHy (ORCPT ); Thu, 1 Aug 2013 10:07:54 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:57472 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756278Ab3HAOF0 (ORCPT ); Thu, 1 Aug 2013 10:05:26 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id r71E5Pia015305; Thu, 1 Aug 2013 09:05:25 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r71E5PK1018358; Thu, 1 Aug 2013 09:05:25 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.2.342.3; Thu, 1 Aug 2013 09:05:24 -0500 Received: from localhost.localdomain (h0-158.vpn.ti.com [172.24.0.158]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r71E5Hkj026031; Thu, 1 Aug 2013 09:05:23 -0500 From: Roger Quadros To: CC: , , , , , , , , Roger Quadros Subject: [PATCH 2/7] usb: phy: omap-usb2: Don't use omap_get_control_dev() Date: Thu, 1 Aug 2013 17:05:10 +0300 Message-ID: <1375365915-21380-3-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1375365915-21380-1-git-send-email-rogerq@ti.com> References: <1375365915-21380-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Tested-by: Kishon Vijay Abraham I --- drivers/usb/phy/phy-omap-usb2.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-omap-usb2.c b/drivers/usb/phy/phy-omap-usb2.c index 376b367..77e0cf4 100644 --- a/drivers/usb/phy/phy-omap-usb2.c +++ b/drivers/usb/phy/phy-omap-usb2.c @@ -28,6 +28,7 @@ #include #include #include +#include /** * omap_usb2_set_comparator - links the comparator present in the sytem with @@ -124,6 +125,8 @@ static int omap_usb2_probe(struct platform_device *pdev) struct omap_usb *phy; struct usb_otg *otg; struct device_node *node = pdev->dev.of_node; + struct device_node *control_node; + struct platform_device *control_pdev; if (!node) return -ENODEV; @@ -148,11 +151,18 @@ static int omap_usb2_probe(struct platform_device *pdev) phy->phy.otg = otg; phy->phy.type = USB_PHY_TYPE_USB2; - phy->control_dev = omap_get_control_dev(); - if (IS_ERR(phy->control_dev)) { - dev_dbg(&pdev->dev, "Failed to get control device\n"); + control_node = of_parse_phandle(node, "ctrl-module", 0); + if (!control_node) { + dev_err(&pdev->dev, "Failed to get control device phandle\n"); return -ENODEV; } + control_pdev = of_find_device_by_node(control_node); + if (!control_pdev) { + dev_err(&pdev->dev, "Failed to get control device\n"); + return -ENODEV; + } + + phy->control_dev = &control_pdev->dev; phy->is_suspended = 1; omap_control_usb_phy_power(phy->control_dev, 0);