From patchwork Tue Oct 7 10:19:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 5044701 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 282B49F30B for ; Tue, 7 Oct 2014 10:20:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED1D9201B9 for ; Tue, 7 Oct 2014 10:20:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1555B2010C for ; Tue, 7 Oct 2014 10:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753522AbaJGKT7 (ORCPT ); Tue, 7 Oct 2014 06:19:59 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:51446 "EHLO mail-pa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753328AbaJGKTz (ORCPT ); Tue, 7 Oct 2014 06:19:55 -0400 Received: by mail-pa0-f51.google.com with SMTP id lj1so6995447pab.10 for ; Tue, 07 Oct 2014 03:19: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=bxaeu7bE/dFT5mz2zcMvBEWXkb30OtHWp/P2lvGP6wM=; b=kWPXvKxxcAOfkg/fNEPfUIdlURzOatwu9x9pcsj+4qGeR2wFxKsGiRQ5whKS1LOYNP iCcdN7IfiChmp6DknZV5E7NCcEQJ9oP8Xx/wjFh9jBkRXjHe+sGbh+rvBeNZdTrE/8PH 8NQdtLhtudBn01nRTTfg21j6iicXNrr4N8gEyI9htyzhJZiuxYQuPDijanbF8SEs1vgd fXrN6qnAJW5qdZTdXCzpZAHaWVjzpliT4a5F+ZQYs0CcqOPzyRUbgeSBBmZC3TnWmNni E+QfITb3Nvu7rWLth74cavI8iLCt2QYvKqTEKJLY5cH4oKomr7F4iTnNetMUdF2cuIzS MyMg== X-Received: by 10.70.131.199 with SMTP id oo7mr2989558pdb.95.1412677194330; Tue, 07 Oct 2014 03:19:54 -0700 (PDT) Received: from vivek-linuxpc.sisodomain.com ([14.140.216.146]) by mx.google.com with ESMTPSA id ca3sm15514850pbb.80.2014.10.07.03.19.50 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 07 Oct 2014 03:19:53 -0700 (PDT) From: Vivek Gautam To: linux-usb@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org, linux-omap@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org, balbi@ti.com, kgene.kim@samsung.com, mark.rutland@arm.com, pawel.moll@arm.com, robh+dt@kernel.org, kishon@ti.com, Vivek Gautam Subject: [PATCH v2 3/4] phy: exynos5-usbdrd: Add facility for VBUS-BOOST-5V supply Date: Tue, 7 Oct 2014 15:49:35 +0530 Message-Id: <1412677176-3850-4-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1412677176-3850-1-git-send-email-gautam.vivek@samsung.com> References: <1412677176-3850-1-git-send-email-gautam.vivek@samsung.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY, URIBL_RHS_DOB 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 Some Exynos SoCs have a separate regulator controlling a Boost 5V supply which goes as input for VBUS regulator. So adding a control for the same in driver, to enable vbus supply on the port. Signed-off-by: Vivek Gautam --- drivers/phy/phy-exynos5-usbdrd.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index 013ee84..57e8a0a 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c @@ -176,6 +176,7 @@ struct exynos5_usbdrd_phy { u32 extrefclk; struct clk *ref_clk; struct regulator *vbus; + struct regulator *vbus_boost; }; static inline @@ -455,11 +456,20 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) clk_prepare_enable(phy_drd->ref_clk); /* Enable VBUS supply */ + if (phy_drd->vbus_boost) { + ret = regulator_enable(phy_drd->vbus_boost); + if (ret) { + dev_err(phy_drd->dev, + "Failed to enable VBUS boost supply\n"); + goto fail_vbus; + } + } + if (phy_drd->vbus) { ret = regulator_enable(phy_drd->vbus); if (ret) { dev_err(phy_drd->dev, "Failed to enable VBUS supply\n"); - goto fail_vbus; + goto fail_vbus_boost; } } @@ -468,6 +478,10 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) return 0; +fail_vbus_boost: + if (phy_drd->vbus_boost) + regulator_disable(phy_drd->vbus_boost); + fail_vbus: clk_disable_unprepare(phy_drd->ref_clk); clk_disable_unprepare(phy_drd->pipeclk); @@ -489,6 +503,8 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy) /* Disable VBUS supply */ if (phy_drd->vbus) regulator_disable(phy_drd->vbus); + if (phy_drd->vbus_boost) + regulator_disable(phy_drd->vbus_boost); clk_disable_unprepare(phy_drd->ref_clk); clk_disable_unprepare(phy_drd->pipeclk); @@ -644,7 +660,7 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) break; } - /* Get Vbus regulator */ + /* Get Vbus regulators */ phy_drd->vbus = devm_regulator_get(dev, "vbus"); if (IS_ERR(phy_drd->vbus)) { ret = PTR_ERR(phy_drd->vbus); @@ -655,6 +671,16 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) phy_drd->vbus = NULL; } + phy_drd->vbus_boost = devm_regulator_get(dev, "vbus-boost"); + if (IS_ERR(phy_drd->vbus_boost)) { + ret = PTR_ERR(phy_drd->vbus_boost); + if (ret == -EPROBE_DEFER) + return ret; + + dev_warn(dev, "Failed to get VBUS boost supply regulator\n"); + phy_drd->vbus_boost = NULL; + } + dev_vdbg(dev, "Creating usbdrd_phy phy\n"); for (i = 0; i < EXYNOS5_DRDPHYS_NUM; i++) {