From patchwork Thu Apr 4 16:41:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 10885945 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DD65917EE for ; Thu, 4 Apr 2019 16:42:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C21D928AB0 for ; Thu, 4 Apr 2019 16:42:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B349128ABF; Thu, 4 Apr 2019 16:42:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 623D228AB0 for ; Thu, 4 Apr 2019 16:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wN2rN+B1ueQyQahWfrtzDZsUMjqkbZGc2V7WE2Jo9Ro=; b=R8+q19JwRCyrpM +G/ylEwf9jt1ykg4DoWv8pL3eTprYM/MBqkiLMy8VoX9WUNgvrBCi+ubsIhCitRklRpZvjNavsIAo bkANQfgCFFj8nAYT2Phl42I8yiP7QTJKVcDNr2L/L4LRRNW1oVkZ9MJA3oebhXtYBrLCclBgJIAiP 6Jws4e2pRs4ita1vl5NKobdkG3cmHg+ncOh6PzrA50vTngNqdaeyvOOrRsr9MVyTkrji609lBTDtK /kmvN0wgPEq1/u34dmCXMz52iDpAfPMTnpv0qBgF4a4Xf4gzWdda+0w+wKpNI18pRhx2Qv8RPMO5a lktqzzoVg8cT1rb4cccg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hC5RF-0006R0-95; Thu, 04 Apr 2019 16:42:05 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hC5R5-0006HO-4F for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2019 16:41:56 +0000 Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28] helo=dude02.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.89) (envelope-from ) id 1hC5Qz-0008Lb-8f; Thu, 04 Apr 2019 18:41:49 +0200 From: Lucas Stach To: Kishon Vijay Abraham I , Rob Herring Subject: [PATCH 2/2] phy: fsl-imx8mq-usb: add support for VBUS power control Date: Thu, 4 Apr 2019 18:41:48 +0200 Message-Id: <20190404164148.11140-2-l.stach@pengutronix.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190404164148.11140-1-l.stach@pengutronix.de> References: <20190404164148.11140-1-l.stach@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190404_094155_377265_8FE59136 X-CRM114-Status: GOOD ( 11.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, patchwork-lst@pengutronix.de, NXP Linux Team , kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, Li Jun Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This adds support to the PHY driver to power up/down the VBUS voltage rail at the appropriate times. Signed-off-by: Lucas Stach --- drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c index d6ea5ce8afa5..0a3e88e37ab5 100644 --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c @@ -6,6 +6,7 @@ #include #include #include +#include #define PHY_CTRL0 0x0 #define PHY_CTRL0_REF_SSP_EN BIT(2) @@ -24,6 +25,7 @@ struct imx8mq_usb_phy { struct phy *phy; struct clk *clk; void __iomem *base; + struct regulator *vbus; }; static int imx8mq_usb_phy_init(struct phy *phy) @@ -55,6 +57,11 @@ static int imx8mq_usb_phy_init(struct phy *phy) static int imx8mq_phy_power_on(struct phy *phy) { struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy); + int ret; + + ret = regulator_enable(imx_phy->vbus); + if (ret) + return ret; return clk_prepare_enable(imx_phy->clk); } @@ -64,6 +71,7 @@ static int imx8mq_phy_power_off(struct phy *phy) struct imx8mq_usb_phy *imx_phy = phy_get_drvdata(phy); clk_disable_unprepare(imx_phy->clk); + regulator_disable(imx_phy->vbus); return 0; } @@ -101,6 +109,11 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) if (IS_ERR(imx_phy->phy)) return PTR_ERR(imx_phy->phy); + imx_phy->vbus = devm_regulator_get(dev, "vbus"); + if (IS_ERR(imx_phy->vbus)) + return PTR_ERR(imx_phy->vbus); + + phy_set_drvdata(imx_phy->phy, imx_phy); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);