From patchwork Mon Jun 30 11:00:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 32692 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 74810203F4 for ; Mon, 30 Jun 2014 11:00:50 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id dc16sf15502659qab.1 for ; Mon, 30 Jun 2014 04:00:50 -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=e95au4DygJsT4imx7CYsEbswfDQMt/lNqJroBiORgfo=; b=U6UwhnT2vc6j/+SiEPtn1oqWFP0LJROxnQM3u9qd08cL1pjErCuRjhCIClkWk0oJI7 /2+9wq+whGM14aRoDwUrSqFZ0xcOjTMIxVThPiDotsVGRn/rC16c5HFIqarJhv+hSMv4 W4ArYrtsRPpzXR9wGJCBwKrx5HtnhdYNohgWwl0gE9B+8Wa8wWVATEX9H3csCGIVMkm7 kabo2O4cq3jBfUHBa5rsMijMB1JvCeAfwqtX25h7gqpSYTkCJzxurfiZTuR+YGGZssCW 82kO0OlDBfqoInO6tv5AEzEMH6pDJK8F6UPiXR/gnh81ZwqrzWUMCdkHmJKyyNsD7qCt 18uw== X-Gm-Message-State: ALoCoQnzLj5mGJ6/AMTBg+Vs8+BZNrlLwow+Grmby1He873qXq9wsIhTdZ0PJ/Ebjc2yfxip1sGW X-Received: by 10.58.114.41 with SMTP id jd9mr7373098veb.9.1404126050315; Mon, 30 Jun 2014 04:00:50 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.247 with SMTP id l110ls1452827qgf.90.gmail; Mon, 30 Jun 2014 04:00:50 -0700 (PDT) X-Received: by 10.221.40.193 with SMTP id tr1mr2737826vcb.31.1404126050168; Mon, 30 Jun 2014 04:00:50 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id yh7si9851454vdb.69.2014.06.30.04.00.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 04:00:50 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jx11so7970322veb.34 for ; Mon, 30 Jun 2014 04:00:50 -0700 (PDT) X-Received: by 10.52.252.193 with SMTP id zu1mr31366938vdc.7.1404126050065; Mon, 30 Jun 2014 04:00:50 -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.221.37.5 with SMTP id tc5csp127013vcb; Mon, 30 Jun 2014 04:00:49 -0700 (PDT) X-Received: by 10.68.94.225 with SMTP id df1mr51033184pbb.86.1404126049299; Mon, 30 Jun 2014 04:00:49 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yp2si22745403pbb.134.2014.06.30.04.00.48; Mon, 30 Jun 2014 04:00:48 -0700 (PDT) Received-SPF: none (google.com: linux-omap-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 S1750969AbaF3LAr (ORCPT + 6 others); Mon, 30 Jun 2014 07:00:47 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:50813 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752155AbaF3LAr (ORCPT ); Mon, 30 Jun 2014 07:00:47 -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 s5UB0jwf021720; Mon, 30 Jun 2014 06:00:45 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5UB0jWi006787; Mon, 30 Jun 2014 06:00:45 -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; Mon, 30 Jun 2014 06:00:45 -0500 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s5UB0evd012393; Mon, 30 Jun 2014 06:00:43 -0500 From: Roger Quadros To: , , CC: , , , , Roger Quadros Subject: [PATCH 1/3] phy: omap-usb2: Manage PHY 3.3V supply regulator Date: Mon, 30 Jun 2014 14:00:36 +0300 Message-ID: <1404126038-19974-2-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1404126038-19974-1-git-send-email-rogerq@ti.com> References: <1404126038-19974-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@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.128.175 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: , On some SoCs e.g. J6 the 3.3V supply to the USB2 PHY can be powered down when the PHY is not in use. Add regulator management code to control this power line. Signed-off-by: Roger Quadros Reviewed-by: Felipe Balbi --- drivers/phy/phy-omap-usb2.c | 25 +++++++++++++++++++++++++ include/linux/phy/omap_usb.h | 1 + 2 files changed, 26 insertions(+) diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c index 7007c11..2afc79c 100644 --- a/drivers/phy/phy-omap-usb2.c +++ b/drivers/phy/phy-omap-usb2.c @@ -30,6 +30,7 @@ #include #include #include +#include #define USB2PHY_DISCON_BYP_LATCH (1 << 31) #define USB2PHY_ANA_CONFIG1 0x4c @@ -107,6 +108,14 @@ static int omap_usb_power_off(struct phy *x) omap_control_phy_power(phy->control_dev, 0); + if (phy->pwr) { + int ret; + + ret = regulator_disable(phy->pwr); + if (ret) + return ret; + } + return 0; } @@ -114,6 +123,14 @@ static int omap_usb_power_on(struct phy *x) { struct omap_usb *phy = phy_get_drvdata(x); + if (phy->pwr) { + int ret; + + ret = regulator_enable(phy->pwr); + if (ret) + return ret; + } + omap_control_phy_power(phy->control_dev, 1); return 0; @@ -253,6 +270,14 @@ static int omap_usb2_probe(struct platform_device *pdev) phy->control_dev = &control_pdev->dev; omap_control_phy_power(phy->control_dev, 0); + /* phy-supply */ + phy->pwr = devm_regulator_get_optional(phy->dev, "phy"); + if (IS_ERR(phy->pwr)) { + if (PTR_ERR(phy->pwr) == -EPROBE_DEFER) + return -EPROBE_DEFER; + phy->pwr = NULL; + } + otg->set_host = omap_usb_set_host; otg->set_peripheral = omap_usb_set_peripheral; if (phy_data->flags & OMAP_USB2_HAS_SET_VBUS) diff --git a/include/linux/phy/omap_usb.h b/include/linux/phy/omap_usb.h index dc2c541..e2c46df 100644 --- a/include/linux/phy/omap_usb.h +++ b/include/linux/phy/omap_usb.h @@ -40,6 +40,7 @@ struct omap_usb { struct clk *wkupclk; struct clk *optclk; u8 flags; + struct regulator *pwr; }; struct usb_phy_data {