From patchwork Fri Oct 17 17:16:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 38929 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 917BB202DB for ; Fri, 17 Oct 2014 17:18:01 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id d1sf800379wiv.6 for ; Fri, 17 Oct 2014 10:18:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=G3JwSNhceZKLK6g1vhjIa05nUKw6KSdcXK+0rIoN7r8=; b=GARdqDod4ZTOipEuRsRGOdJUWiQpv58XZbjWFZuVf43C4j3yXIw95pSobRQEFldGAB OUVkxaeGVTGv2HWH67+Yg8yf8HIhSK8Q5et2MFfTkyUP6YRhtHggkPp2x8IDg+Dcckv/ qIMHa76OPtLfEMp8XTrBMbPzZdIie0nhuhE23URSniARIeh19pQLi8WY7NxeAiH8fvov 0xx7QsqF+r7QHdhu6OM0NHiBM/tbnrhKD7unOJGdmUc1weI+iXEYmUoQfdozqG1yp7gt xrqoe+IVPcq0jLQqku/ZP0XIJtP0JqOLFhsy5cvi8REEzJgEYW7jMml6v6f21eMmkYGf 1Thg== X-Gm-Message-State: ALoCoQnjJrEPid30xXF5sIUwfZRCDfuBCF/KnmzAFVG6TVNQ0ObP4ttMszjjywC61mwy3FJ4Z8EN X-Received: by 10.152.25.202 with SMTP id e10mr1601292lag.2.1413566280733; Fri, 17 Oct 2014 10:18:00 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.66 with SMTP id h2ls230581laa.58.gmail; Fri, 17 Oct 2014 10:18:00 -0700 (PDT) X-Received: by 10.152.19.9 with SMTP id a9mr10237573lae.41.1413566280571; Fri, 17 Oct 2014 10:18:00 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id kv1si3007009lac.53.2014.10.17.10.18.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 17 Oct 2014 10:18:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ge10so1059420lab.24 for ; Fri, 17 Oct 2014 10:18:00 -0700 (PDT) X-Received: by 10.152.202.135 with SMTP id ki7mr10325824lac.40.1413566280294; Fri, 17 Oct 2014 10:18:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp268034lbz; Fri, 17 Oct 2014 10:17:59 -0700 (PDT) X-Received: by 10.68.57.166 with SMTP id j6mr5193550pbq.145.1413566278643; Fri, 17 Oct 2014 10:17:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si1686618pdm.75.2014.10.17.10.17.58 for ; Fri, 17 Oct 2014 10:17:58 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753485AbaJQRRz (ORCPT + 3 others); Fri, 17 Oct 2014 13:17:55 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:36337 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753356AbaJQRRs (ORCPT ); Fri, 17 Oct 2014 13:17:48 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s9HHHb5t028715; Fri, 17 Oct 2014 12:17:37 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHHbFN029265; Fri, 17 Oct 2014 12:17:37 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Fri, 17 Oct 2014 12:17:37 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s9HHHaMa029985; Fri, 17 Oct 2014 12:17:37 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Greg KH , , Paul Zimmerman , , , , , , , Yoshihiro Shimoda , Felipe Balbi Subject: [PATCH 12/67] usb: renesas_usbhs: add support for generic PHY Date: Fri, 17 Oct 2014 12:16:19 -0500 Message-ID: <1413566234-13537-13-git-send-email-balbi@ti.com> X-Mailer: git-send-email 2.1.0.GIT In-Reply-To: <1413566234-13537-1-git-send-email-balbi@ti.com> References: <1413566234-13537-1-git-send-email-balbi@ti.com> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Yoshihiro Shimoda This patch adds support for the generic PHY. The generic PHY will be used in multiplatform environment. Acked-by: Kishon Vijay Abraham I Signed-off-by: Yoshihiro Shimoda Signed-off-by: Felipe Balbi --- drivers/usb/renesas_usbhs/common.h | 1 + drivers/usb/renesas_usbhs/rcar2.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index e0d53c5..c45667f 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h @@ -270,6 +270,7 @@ struct usbhs_priv { struct usbhs_fifo_info fifo_info; struct usb_phy *usb_phy; + struct phy *phy; }; /* diff --git a/drivers/usb/renesas_usbhs/rcar2.c b/drivers/usb/renesas_usbhs/rcar2.c index 485b889..8fc15c0 100644 --- a/drivers/usb/renesas_usbhs/rcar2.c +++ b/drivers/usb/renesas_usbhs/rcar2.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include "common.h" @@ -21,6 +22,16 @@ static int usbhs_rcar2_hardware_init(struct platform_device *pdev) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); + if (IS_ENABLED(CONFIG_GENERIC_PHY)) { + struct phy *phy = phy_get(&pdev->dev, "usb"); + + if (IS_ERR(phy)) + return PTR_ERR(phy); + + priv->phy = phy; + return 0; + } + if (IS_ENABLED(CONFIG_USB_PHY)) { struct usb_phy *usb_phy = usb_get_phy_dev(&pdev->dev, 0); @@ -38,6 +49,11 @@ static int usbhs_rcar2_hardware_exit(struct platform_device *pdev) { struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); + if (priv->phy) { + phy_put(priv->phy); + priv->phy = NULL; + } + if (priv->usb_phy) { usb_put_phy(priv->usb_phy); priv->usb_phy = NULL; @@ -52,6 +68,19 @@ static int usbhs_rcar2_power_ctrl(struct platform_device *pdev, struct usbhs_priv *priv = usbhs_pdev_to_priv(pdev); int retval = -ENODEV; + if (priv->phy) { + if (enable) { + retval = phy_init(priv->phy); + + if (!retval) + retval = phy_power_on(priv->phy); + } else { + phy_power_off(priv->phy); + phy_exit(priv->phy); + retval = 0; + } + } + if (priv->usb_phy) { if (enable) { retval = usb_phy_init(priv->usb_phy);