From patchwork Wed Apr 9 11:54:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 3955011 Return-Path: X-Original-To: patchwork-linux-arm@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 B80149F371 for ; Wed, 9 Apr 2014 11:55:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6C7920555 for ; Wed, 9 Apr 2014 11:55:38 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0238D2054D for ; Wed, 9 Apr 2014 11:55:38 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXr6L-0005lP-Rr; Wed, 09 Apr 2014 11:55:33 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXr6J-0007tY-LR; Wed, 09 Apr 2014 11:55:31 +0000 Received: from mail-pa0-f50.google.com ([209.85.220.50]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WXr6D-0007sc-D9 for linux-arm-kernel@lists.infradead.org; Wed, 09 Apr 2014 11:55:27 +0000 Received: by mail-pa0-f50.google.com with SMTP id kq14so2405887pab.23 for ; Wed, 09 Apr 2014 04:54:59 -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; bh=PaYLs77PcEH3p4kaxLeB6dAQdP+U0nrpNnTSeZ9oRpQ=; b=RisH4m7ccq2RS2tb4EJe9Krp9wic1aipPLLWHJShVlKYySmj5VzghbDHJIt2VPUL/X qUl1JwtPNSf8dvsg5KGeOOgMGOqLQL8W8mrkW8OOVtkcQLqtONkS2A9bM7xLx9Ma6iJM yuTDNOtKWUZUVAlYCJ/gqHW72t7GAqP0MX4JUvNjy1WLQkeWkkJyjp2RGcQlRDeAP5jr cASbHv7O/lpZPzIZBbfPoYEgdaHwQx4ntkjhGz5FfEFFYcZqy3v3dtwTWkKKcIwjoVLG z2TcJnnKQJuRxM1mSaE+wJMZzmDMH0icJ8fC5NR/zAb/z2WrCMMcX6I7kUVYCavG0fDG SChQ== X-Received: by 10.68.202.194 with SMTP id kk2mr11574854pbc.156.1397044499654; Wed, 09 Apr 2014 04:54:59 -0700 (PDT) Received: from vivek-linuxpc.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id f3sm2063598pbg.60.2014.04.09.04.54.54 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 09 Apr 2014 04:54:59 -0700 (PDT) From: Vivek Gautam To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-doc@vger.kernel.org, kishon@ti.com Subject: [PATCH] phy: exynos5-usbdrd: Add facility to toggle vbus gpio on/off Date: Wed, 9 Apr 2014 17:24:45 +0530 Message-Id: <1397044485-26483-1-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140409_075526_127855_F042EA64 X-CRM114-Status: GOOD ( 11.10 ) X-Spam-Score: -2.4 (--) Cc: k.debski@samsung.com, kgene.kim@samsung.com, gregkh@linuxfoundation.org, t.figa@samsung.com, jg1.han@samsung.com, balbi@ti.com, gautam.vivek@samsung.com, sylvester.nawrocki@gmail.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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 Adding support to enable/disable VBUS hooked to a gpio to enable vbus supply on the port. Signed-off-by: Vivek Gautam --- Based on 'phy-exynos5-usbdrd' patches: [PATCH V4 0/5] Add Exynos5 USB 3.0 phy driver based on generic PHY framework http://www.spinics.net/lists/linux-usb/msg105507.html drivers/phy/phy-exynos5-usbdrd.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/phy/phy-exynos5-usbdrd.c b/drivers/phy/phy-exynos5-usbdrd.c index ff54a7c..5ca7485 100644 --- a/drivers/phy/phy-exynos5-usbdrd.c +++ b/drivers/phy/phy-exynos5-usbdrd.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -176,6 +177,7 @@ struct exynos5_usbdrd_phy { struct clk *ref_clk; unsigned long ref_rate; unsigned int refclk_reg; + int gpio; }; #define to_usbdrd_phy(inst) \ @@ -460,6 +462,9 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy) if (!IS_ERR(phy_drd->usb30_sclk)) clk_prepare_enable(phy_drd->usb30_sclk); + /* Toggle VBUS gpio - on */ + gpio_set_value(phy_drd->gpio, 1); + /* Power-on PHY*/ inst->phy_cfg->phy_isol(inst, 0); @@ -476,6 +481,9 @@ static int exynos5_usbdrd_phy_power_off(struct phy *phy) /* Power-off the PHY */ inst->phy_cfg->phy_isol(inst, 1); + /* Toggle VBUS gpio - off */ + gpio_set_value(phy_drd->gpio, 0); + if (!IS_ERR(phy_drd->usb30_sclk)) clk_disable_unprepare(phy_drd->usb30_sclk); @@ -585,6 +593,16 @@ static int exynos5_usbdrd_phy_probe(struct platform_device *pdev) phy_drd->drv_data = drv_data; + /* Get required GPIO for vbus */ + phy_drd->gpio = of_get_named_gpio(dev->of_node, + "samsung,vbus-gpio", 0); + if (!gpio_is_valid(phy_drd->gpio)) + dev_dbg(dev, "no usbdrd-phy vbus gpio defined\n"); + + if (devm_gpio_request(dev, phy_drd->gpio, "phydrd_vbus_gpio")) + dev_dbg(dev, "can't request usbdrd-phy vbus gpio %d\n", + phy_drd->gpio); + if (of_property_read_u32(node, "samsung,pmu-offset", &pmu_offset)) { dev_err(dev, "Missing pmu-offset for phy isolation\n"); return -EINVAL;