From patchwork Wed Sep 17 11:17:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 4923741 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 BAA4C9F3EC for ; Wed, 17 Sep 2014 11:17:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49D6520138 for ; Wed, 17 Sep 2014 11:18:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6BA2720166 for ; Wed, 17 Sep 2014 11:18:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755353AbaIQLR5 (ORCPT ); Wed, 17 Sep 2014 07:17:57 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:57342 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754639AbaIQLRz (ORCPT ); Wed, 17 Sep 2014 07:17:55 -0400 Received: by mail-pa0-f53.google.com with SMTP id rd3so1937118pab.26 for ; Wed, 17 Sep 2014 04:17:54 -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=Fpb9xBIqnx0Blv74We6HKKGmnSLW3HQVoThdWCEEeEw=; b=qPMndycwIMzBEB4JrHGCf5mVOmGqghUjoOkLy82q9LDgXylVZBLDsESvRPrCc/mgGw nRJsM7++E2BDmB78RGaCO7AFFwfqVJs5HnhyHyF5sPiyI9qFIEG3EhCtCElcRV57k7Z5 W9RjdQUdTocZx4HmgQKC1Fh4WYCpvfEatHHt6g+QKJRLoXwavHfLSmPl40lm8Dn6Rq/X zSRML1pJX6rE2Spz/WeeKE4fIjFflh37Xo3hBTYhsUhANF1jkdkWMH/0kGXurHwK359z JTj9BsAZ7uqkTp+CL9jA5ynpHacxlFnm3chCfimpq7FqVDhlul50YJHo/rlPBnqAm+kP vskg== X-Received: by 10.70.60.169 with SMTP id i9mr5212228pdr.166.1410952674385; Wed, 17 Sep 2014 04:17:54 -0700 (PDT) Received: from vivek-linuxpc.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id g13sm17152160pat.45.2014.09.17.04.17.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 17 Sep 2014 04:17:53 -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 v3 1/2] usb: host: ehci-exynos: Remove unnecessary usb-phy support Date: Wed, 17 Sep 2014 16:47:41 +0530 Message-Id: <1410952662-4297-2-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1410952662-4297-1-git-send-email-gautam.vivek@samsung.com> References: <1410952662-4297-1-git-send-email-gautam.vivek@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. Signed-off-by: Vivek Gautam Acked-by: Jingoo Han --- drivers/usb/host/ehci-exynos.c | 81 ++++++++++++---------------------------- 1 file changed, 23 insertions(+), 58 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 2eed9a4..99c5f5f 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -21,11 +21,8 @@ #include #include #include -#include -#include #include #include -#include #include "ehci.h" @@ -47,9 +44,7 @@ static struct hc_driver __read_mostly exynos_ehci_hc_driver; struct exynos_ehci_hcd { struct clk *clk; - struct usb_phy *phy; - struct usb_otg *otg; - struct phy *phy_g[PHY_NUMBER]; + struct phy *phy[PHY_NUMBER]; }; #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd *)(hcd_to_ehci(hcd)->priv) @@ -59,49 +54,39 @@ static int exynos_ehci_get_phy(struct device *dev, { struct device_node *child; struct phy *phy; - int phy_number; - int ret = 0; + int phy_num; + int ret; for_each_available_child_of_node(dev->of_node, child) { - ret = of_property_read_u32(child, "reg", &phy_number); + ret = of_property_read_u32(child, "reg", &phy_num); if (ret) { dev_err(dev, "Failed to parse device tree\n"); of_node_put(child); return ret; } - if (phy_number >= PHY_NUMBER) { + if (phy_num >= PHY_NUMBER) { dev_err(dev, "Invalid number of PHYs\n"); of_node_put(child); return -EINVAL; } - phy = devm_of_phy_get(dev, child, NULL); + exynos_ehci->phy[phy_num] = devm_of_phy_get(dev, child, NULL); + phy = exynos_ehci->phy[phy_num]; of_node_put(child); - if (IS_ERR(phy)) - /* Lets fallback to older USB-PHYs */ - goto usb_phy_old; - exynos_ehci->phy_g[phy_number] = phy; - /* Make the older PHYs unavailable */ - exynos_ehci->phy = ERR_PTR(-ENXIO); - } - - return 0; - -usb_phy_old: - exynos_ehci->phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2); - if (IS_ERR(exynos_ehci->phy)) { - ret = PTR_ERR(exynos_ehci->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_ehci->otg = exynos_ehci->phy->otg; } - return ret; + return 0; } static int exynos_ehci_phy_enable(struct device *dev) @@ -111,16 +96,13 @@ static int exynos_ehci_phy_enable(struct device *dev) int i; int ret = 0; - if (!IS_ERR(exynos_ehci->phy)) - return usb_phy_init(exynos_ehci->phy); - for (i = 0; ret == 0 && i < PHY_NUMBER; i++) - if (!IS_ERR(exynos_ehci->phy_g[i])) - ret = phy_power_on(exynos_ehci->phy_g[i]); + if (!IS_ERR(exynos_ehci->phy[i])) + ret = phy_power_on(exynos_ehci->phy[i]); if (ret) for (i--; i >= 0; i--) - if (!IS_ERR(exynos_ehci->phy_g[i])) - phy_power_off(exynos_ehci->phy_g[i]); + if (!IS_ERR(exynos_ehci->phy[i])) + phy_power_off(exynos_ehci->phy[i]); return ret; } @@ -131,14 +113,9 @@ static void exynos_ehci_phy_disable(struct device *dev) struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd); int i; - if (!IS_ERR(exynos_ehci->phy)) { - usb_phy_shutdown(exynos_ehci->phy); - return; - } - for (i = 0; i < PHY_NUMBER; i++) - if (!IS_ERR(exynos_ehci->phy_g[i])) - phy_power_off(exynos_ehci->phy_g[i]); + if (!IS_ERR(exynos_ehci->phy[i])) + phy_power_off(exynos_ehci->phy[i]); } static void exynos_setup_vbus_gpio(struct device *dev) @@ -231,9 +208,6 @@ skip_phy: goto fail_io; } - if (exynos_ehci->otg) - exynos_ehci->otg->set_host(exynos_ehci->otg, &hcd->self); - err = exynos_ehci_phy_enable(&pdev->dev); if (err) { dev_err(&pdev->dev, "Failed to enable USB phy\n"); @@ -273,9 +247,6 @@ static int exynos_ehci_remove(struct platform_device *pdev) usb_remove_hcd(hcd); - if (exynos_ehci->otg) - exynos_ehci->otg->set_host(exynos_ehci->otg, &hcd->self); - exynos_ehci_phy_disable(&pdev->dev); clk_disable_unprepare(exynos_ehci->clk); @@ -298,9 +269,6 @@ static int exynos_ehci_suspend(struct device *dev) if (rc) return rc; - if (exynos_ehci->otg) - exynos_ehci->otg->set_host(exynos_ehci->otg, &hcd->self); - exynos_ehci_phy_disable(dev); clk_disable_unprepare(exynos_ehci->clk); @@ -316,9 +284,6 @@ static int exynos_ehci_resume(struct device *dev) clk_prepare_enable(exynos_ehci->clk); - if (exynos_ehci->otg) - exynos_ehci->otg->set_host(exynos_ehci->otg, &hcd->self); - ret = exynos_ehci_phy_enable(dev); if (ret) { dev_err(dev, "Failed to enable USB phy\n");