From patchwork Thu Sep 18 04:25:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 4928931 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A57B7BEEA5 for ; Thu, 18 Sep 2014 04:25:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C3DB201E4 for ; Thu, 18 Sep 2014 04:25:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A50E20179 for ; Thu, 18 Sep 2014 04:25:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751585AbaIREZX (ORCPT ); Thu, 18 Sep 2014 00:25:23 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:46478 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbaIREZW (ORCPT ); Thu, 18 Sep 2014 00:25:22 -0400 Received: by mail-pd0-f181.google.com with SMTP id w10so553838pde.12 for ; Wed, 17 Sep 2014 21:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=19HJ6wUcF5lkrDYWR0ceMwu9bFtg3gcExFlR5I4Ssdw=; b=vTJ1EvUXSaK2BQrq/qTyxhJQMHtC7viskNeAOtpXdwv9aVrn+pFxW5d0wvaW5vsL7L PCRT6aHJeaz0x69F5/TEtxlKCtgB1y6+pRXIGTIyszKA2MkSTK5I39lS/KSH7COl5qpw lPn5tawgKnTJfk4oHeI5jMTOT+RdW7nzMA28KqfUo66XP7+BIjfrReqUu32F4jb2YB89 Y2GKwMs6LdF0uPiLLy3wu9yh4TOq/1liCMX/lcVYCbODyLGFJEM7Syxj8l8a+/CoF54S VzObPa+k3Nx35j27hHGnO9a/jeYmDv06otW6lFRtw+TwI7LaHVbYnV5vXrT06uJhZWCR XJPg== X-Received: by 10.68.173.101 with SMTP id bj5mr2327555pbc.15.1411014322253; Wed, 17 Sep 2014 21:25:22 -0700 (PDT) Received: from vivek-linuxpc.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id xq4sm18867024pac.21.2014.09.17.21.25.19 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 21:25:21 -0700 (PDT) From: Vivek Gautam To: linux-usb@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, stern@rowland.harvard.edu, kgene.kim@samsung.com, jg1.han@samsung.com, Vivek Gautam Subject: [PATCH v4 2/2] usb: host: ohci-exynos: Remove unnecessary usb-phy support Date: Thu, 18 Sep 2014 09:55:15 +0530 Message-Id: <1411014315-17914-1-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <001501cfd26f54983d0$%han@samsung.com> References: <001501cfd26f54983d0$%han@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 Now that we have completely moved from older USB-PHY drivers to newer GENERIC-PHY drivers for PHYs available with USB controllers on Exynos series of SoCs, we can remove the support for the same in our host drivers too. We also defer the probe for our host in case we end up getting EPROBE_DEFER error when getting PHYs. Signed-off-by: Vivek Gautam Acked-by: Jingoo Han Cc: Alan Stern --- Changes since v3: - Addressed review comments by Alan: -- Skipped renaming 'phy_number' variable, -- resorted to just adding minimal change required for phy assignment. -- updated patch description to mention EPROBE_DEFER support. drivers/usb/host/ohci-exynos.c | 81 ++++++++++------------------------------ 1 file changed, 20 insertions(+), 61 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 7c48e3f..e8bf4bb 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -19,11 +19,8 @@ #include #include #include -#include -#include #include #include -#include #include "ohci.h" @@ -38,9 +35,7 @@ static struct hc_driver __read_mostly exynos_ohci_hc_driver; struct exynos_ohci_hcd { struct clk *clk; - struct usb_phy *phy; - struct usb_otg *otg; - struct phy *phy_g[PHY_NUMBER]; + struct phy *phy[PHY_NUMBER]; }; static int exynos_ohci_get_phy(struct device *dev, @@ -49,15 +44,9 @@ static int exynos_ohci_get_phy(struct device *dev, struct device_node *child; struct phy *phy; int phy_number; - int ret = 0; + int ret; - /* - * Getting generic phy: - * We are keeping both types of phys as a part of transiting OHCI - * to generic phy framework, so as to maintain backward compatibilty - * with old DTB too. - * We fallback to older USB-PHYs when we fail to get generic PHYs. - */ + /* Get PHYs for the controller */ for_each_available_child_of_node(dev->of_node, child) { ret = of_property_read_u32(child, "reg", &phy_number); if (ret) { @@ -73,31 +62,21 @@ static int exynos_ohci_get_phy(struct device *dev, } phy = devm_of_phy_get(dev, child, NULL); + exynos_ohci->phy[phy_number] = phy; of_node_put(child); - if (IS_ERR(phy)) - /* Lets fallback to older USB-PHYs */ - goto usb_phy_old; - exynos_ohci->phy_g[phy_number] = phy; - /* Make the older PHYs unavailable */ - exynos_ohci->phy = ERR_PTR(-ENXIO); - } - - return 0; - -usb_phy_old: - exynos_ohci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(exynos_ohci->phy)) { - ret = PTR_ERR(exynos_ohci->phy); - if (ret != -ENXIO && ret != -ENODEV) { - dev_err(dev, "no usb2 phy configured\n"); - return ret; + if (IS_ERR(phy)) { + ret = PTR_ERR(phy); + if (ret == -EPROBE_DEFER) { + return ret; + } else if (ret != -ENOSYS && ret != -ENODEV) { + dev_err(dev, + "Error retrieving usb2 phy: %d\n", ret); + return PTR_ERR(phy); + } } - dev_dbg(dev, "Failed to get usb2 phy\n"); - } else { - exynos_ohci->otg = exynos_ohci->phy->otg; } - return ret; + return 0; } static int exynos_ohci_phy_enable(struct device *dev) @@ -107,16 +86,13 @@ static int exynos_ohci_phy_enable(struct device *dev) int i; int ret = 0; - if (!IS_ERR(exynos_ohci->phy)) - return usb_phy_init(exynos_ohci->phy); - for (i = 0; ret == 0 && i < PHY_NUMBER; i++) - if (!IS_ERR(exynos_ohci->phy_g[i])) - ret = phy_power_on(exynos_ohci->phy_g[i]); + if (!IS_ERR(exynos_ohci->phy[i])) + ret = phy_power_on(exynos_ohci->phy[i]); if (ret) for (i--; i >= 0; i--) - if (!IS_ERR(exynos_ohci->phy_g[i])) - phy_power_off(exynos_ohci->phy_g[i]); + if (!IS_ERR(exynos_ohci->phy[i])) + phy_power_off(exynos_ohci->phy[i]); return ret; } @@ -127,14 +103,9 @@ static void exynos_ohci_phy_disable(struct device *dev) struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); int i; - if (!IS_ERR(exynos_ohci->phy)) { - usb_phy_shutdown(exynos_ohci->phy); - return; - } - for (i = 0; i < PHY_NUMBER; i++) - if (!IS_ERR(exynos_ohci->phy_g[i])) - phy_power_off(exynos_ohci->phy_g[i]); + if (!IS_ERR(exynos_ohci->phy[i])) + phy_power_off(exynos_ohci->phy[i]); } static int exynos_ohci_probe(struct platform_device *pdev) @@ -206,9 +177,6 @@ skip_phy: goto fail_io; } - if (exynos_ohci->otg) - exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self); - platform_set_drvdata(pdev, hcd); err = exynos_ohci_phy_enable(&pdev->dev); @@ -241,9 +209,6 @@ static int exynos_ohci_remove(struct platform_device *pdev) usb_remove_hcd(hcd); - if (exynos_ohci->otg) - exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self); - exynos_ohci_phy_disable(&pdev->dev); clk_disable_unprepare(exynos_ohci->clk); @@ -272,9 +237,6 @@ static int exynos_ohci_suspend(struct device *dev) if (rc) return rc; - if (exynos_ohci->otg) - exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self); - exynos_ohci_phy_disable(dev); clk_disable_unprepare(exynos_ohci->clk); @@ -290,9 +252,6 @@ static int exynos_ohci_resume(struct device *dev) clk_prepare_enable(exynos_ohci->clk); - if (exynos_ohci->otg) - exynos_ohci->otg->set_host(exynos_ohci->otg, &hcd->self); - ret = exynos_ohci_phy_enable(dev); if (ret) { dev_err(dev, "Failed to enable USB phy\n");