From patchwork Mon May 17 12:08:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 12261745 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CAA6C433B4 for ; Mon, 17 May 2021 12:10:01 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C684461241 for ; Mon, 17 May 2021 12:10:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C684461241 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=foss.st.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4iBhsmqtWNRq3ZCDwLrTZD/hwn09ufc4oggz4LouLN4=; b=My+oSLMPIcSviY2nIzMdojAXP GghiWKC6NjKHSipQlYBab8P1aq8SmsxBZxr6cGnELb+2ziwzCtn0twWPwznwaPTIfeLkSqOqcC+I1 dFaFPLiQxTI27zWR0YF7Ho39X2DXzeBn2SVg5IoovJltskBFz0XeQ7hj7cHL2AIPjSJP413KxYqkm vL/Xhbyb9y4agh5gwOYH01811qv9Ea3WhomG/2uteYcV4Go7HGRAct1vtizhFWhlIfkZN0U2O79E3 mdQDtlLKmpCWWAyhGAttBDzQ3qz7Pj9uT1BJ/Zc9+zvqnqUJMGLsfprCwExkYs/1QGwlvIuQHuDMO jPP2GHWGw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lic4I-00EqGC-Ro; Mon, 17 May 2021 12:09:55 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lic33-00Eq8q-K7; Mon, 17 May 2021 12:09:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=/iRm6XLUsizToc00x1Pm9rvjqNdz5eb8TrDBu4Oy548=; b=odwYxhZyj7Lx1pCc4t7VRLzQc8 72XMT8Dyv0nfXc9dDuNhPfOBSzP6ik4NhClCQkoCKhJ6hNRihm5sdvJ6Cun2cp3uVqV2NTMNwDz0T HaiWoBBRnJH8NXHUDQ304YXbeq+WQavkBhhmVvM6t8InCwZoeq/3QsBZsvi7tk+Xsbl+5keUJ+n0u ezXNgbBmCj/628ZY/yrJNcNsKGXgU3aFhUPob+coXl+iCm8+xc7OIYy/f+j6V+ZktAAnZtQV/mfUj EqBAnMq5bQSZ+w4VxZdCUAuHndSQpfjNoSAWE5bGLbIzwZhWGPE9EBkJxPLq6jHg7dlMvJUJTRlLM VV+Pfe2g==; Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lic30-00Dk6f-4O; Mon, 17 May 2021 12:08:36 +0000 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14HC6pOf010306; Mon, 17 May 2021 14:08:26 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=selector1; bh=/iRm6XLUsizToc00x1Pm9rvjqNdz5eb8TrDBu4Oy548=; b=qzemeJDN3FnIi9Oz7UgrruiF7qH/WHunE8nnKSmkPGUBeWwJvF+XrZGJTj3GL3pC7mvy bLOBv45IhPVCjeQ5PomhOfcxLRVARsEqZbp/KnZGo2Lk0l1EnVjDedJTorOfcPxwzkDz R/ifSfY+6zs3Ln/IRU142Mx9r3Cupwmf2peYf0lsApo0YznMNS+FU3EP8028l7yGnSv1 FWbPNjJLV4+cniN03SSwyzXDgVmdUKOGiDq3bf12aXmnN9dEz0j5HuLVTcPc0x7Xx+2o /85sfKQNO4dfHxRofK0szzkE57NOEdT5fWT23YYoOeACmaeeaHC/fYnGxMHVFp8ZOCkm Vw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 38kmb2sf3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 May 2021 14:08:26 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 551C5100034; Mon, 17 May 2021 14:08:26 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 42B6622D636; Mon, 17 May 2021 14:08:26 +0200 (CEST) Received: from localhost (10.75.127.49) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 17 May 2021 14:08:25 +0200 From: Amelie Delaunay To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Alexandre Torgue , Maxime Coquelin CC: , , , , , Amelie Delaunay Subject: [RESEND PATCH v2 1/2] dt-bindings: phy: add vbus-supply optional property to phy-stm32-usbphyc Date: Mon, 17 May 2021 14:08:20 +0200 Message-ID: <20210517120821.26466-2-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210517120821.26466-1-amelie.delaunay@foss.st.com> References: <20210517120821.26466-1-amelie.delaunay@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-17_04:2021-05-17, 2021-05-17 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_050834_487697_37B15CCB X-CRM114-Status: GOOD ( 13.30 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This patch adds vbus-supply optional property to phy sub-nodes using connector node. A regulator for USB VBUS may be needed for host mode. Reviewed-by: Rob Herring Signed-off-by: Amelie Delaunay --- Changes in v2: - add connector vbus-supply property as suggested by Rob --- .../devicetree/bindings/phy/phy-stm32-usbphyc.yaml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.yaml b/Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.yaml index 018cc1246ee1..3329f1d33a4f 100644 --- a/Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.yaml +++ b/Documentation/devicetree/bindings/phy/phy-stm32-usbphyc.yaml @@ -74,6 +74,13 @@ patternProperties: "#phy-cells": enum: [ 0x0, 0x1 ] + connector: + type: object + allOf: + - $ref: ../connector/usb-connector.yaml + properties: + vbus-supply: true + allOf: - if: properties: @@ -130,6 +137,10 @@ examples: reg = <0>; phy-supply = <&vdd_usb>; #phy-cells = <0>; + connector { + compatible = "usb-a-connector"; + vbus-supply = <&vbus_sw>; + }; }; usbphyc_port1: usb-phy@1 { From patchwork Mon May 17 12:08:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 12261743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08D33C43460 for ; Mon, 17 May 2021 12:09:56 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 805CF6135F for ; Mon, 17 May 2021 12:09:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 805CF6135F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=foss.st.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=BIGTLditrrM2SrnbF6SDlU0FoQ5ZS/Rp+jnYLdhzmRw=; b=ergsYOVraSsznA40hPWIryhfh etWV++e0o1P2/IFTfn6d+PVE750WT5+dQDYItCUrGa/AhJzCxusExqmqqKXu9T7hayx6ColHpUeqJ hwlJHfrrRUASNIdOXvj1gJRzdJkFElpybjTVopxF5v7cq9LhAnsbX1duxheVaANqKnjmDPGJ7ipnK 4lRKDikUI+3Txx+ddocGTicRRHvFDOk8/YUFIpWCxeQ+GT2OV3FsQFyLHBaQ8GwkaIn9o15ybMN6l 4De48jUdSoTdxzUpXMNQD7isAtAMG+tq8m2VHKb0YYcMTYZtvGoY5R2Ty+Au1/tqD5EgEwXv63UTP tRPkV1vJg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lic4H-00EqFd-3m; Mon, 17 May 2021 12:09:53 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lic36-00Eq8s-Lt; Mon, 17 May 2021 12:09:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=pjdn0iPLZsVnMrs5LhG4TkO0pVvE9Vj+yQMAhrHcFD4=; b=1y8aDhCB2/AEIXbBC17krJRJGi bGr1wmHzThbGx30JM+l9RGcBLwNYTxiNW+CFOBryzLuoPJCGrPuriIHKaMZYi/jjQcPDlNbyiSNYU NytDJ6eh5pH5jAatOMlTKyXwPHuI3tWA9RZkO/qsNrS/DW/pyZiN4ua02j9a4TA2tmKb/SpJkQJxS /RJYumYB7Wz4/gNf8GP/ashUaCxPvnl0+QU1huQby8sqFl9g8XBHn/mXtpO57uUJOsejJPYM7xo+z RFy7PseTrSK/4vjjGyBPsm2cZBpmAKuOBuf4Gw14wKflkkpFhH5odImDB7G/DUyou1MPmGJT5MLJD cR9u1HUQ==; Received: from mx07-00178001.pphosted.com ([185.132.182.106]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lic32-00Dk6g-Bh; Mon, 17 May 2021 12:08:39 +0000 Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14HC5Z7f008635; Mon, 17 May 2021 14:08:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=selector1; bh=pjdn0iPLZsVnMrs5LhG4TkO0pVvE9Vj+yQMAhrHcFD4=; b=385JZpGwsRXOH0R+XqYOdRc0bj1NCZlTWKhWt55LKQXMHPfEAvt8xwUJjPznPKpw1DCo OQYaTXOTbEsudLNusDajGSk9RLmtd5hn2s4IiYqlE0FOR99KWxl9baQS1WrgfC/OP/h5 US/pPr/olOAJ4966qbG2ug/glogb0CD0CkzKKx19nyuTnvz57zCpLENjD3JA6JZCPMwd jnEqMgv8Jz7g0cJaRje1OMRyjuTH78g4LtKQAabj8OROB36O239AGujrIBIPEAC7uDuy zUq1HdIMtVQNM01SIvIHA5qfMsCZBnwiHKSu0euputTpf8ENMUPqalNT0x5QVWzxHBbz Lg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 38k5dq4p4x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 17 May 2021 14:08:28 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9708710002A; Mon, 17 May 2021 14:08:27 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag2node3.st.com [10.75.127.6]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7C4C922D636; Mon, 17 May 2021 14:08:27 +0200 (CEST) Received: from localhost (10.75.127.50) by SFHDAG2NODE3.st.com (10.75.127.6) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 17 May 2021 14:08:27 +0200 From: Amelie Delaunay To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Alexandre Torgue , Maxime Coquelin CC: , , , , , Amelie Delaunay Subject: [RESEND PATCH v2 2/2] phy: stm32: manage optional vbus regulator on phy_power_on/off Date: Mon, 17 May 2021 14:08:21 +0200 Message-ID: <20210517120821.26466-3-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210517120821.26466-1-amelie.delaunay@foss.st.com> References: <20210517120821.26466-1-amelie.delaunay@foss.st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG3NODE2.st.com (10.75.127.8) To SFHDAG2NODE3.st.com (10.75.127.6) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.761 definitions=2021-05-17_04:2021-05-17, 2021-05-17 signatures=0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_050836_719047_A4CB8857 X-CRM114-Status: GOOD ( 17.85 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org This patch adds support for optional vbus regulator. It is managed on phy_power_on/off calls and may be needed for host mode. Signed-off-by: Amelie Delaunay --- No changes in v2. --- drivers/phy/st/phy-stm32-usbphyc.c | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c index c184f4e34584..3e491dfb2525 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -57,6 +57,7 @@ struct pll_params { struct stm32_usbphyc_phy { struct phy *phy; struct stm32_usbphyc *usbphyc; + struct regulator *vbus; u32 index; bool active; }; @@ -291,9 +292,31 @@ static int stm32_usbphyc_phy_exit(struct phy *phy) return stm32_usbphyc_pll_disable(usbphyc); } +static int stm32_usbphyc_phy_power_on(struct phy *phy) +{ + struct stm32_usbphyc_phy *usbphyc_phy = phy_get_drvdata(phy); + + if (usbphyc_phy->vbus) + return regulator_enable(usbphyc_phy->vbus); + + return 0; +} + +static int stm32_usbphyc_phy_power_off(struct phy *phy) +{ + struct stm32_usbphyc_phy *usbphyc_phy = phy_get_drvdata(phy); + + if (usbphyc_phy->vbus) + return regulator_disable(usbphyc_phy->vbus); + + return 0; +} + static const struct phy_ops stm32_usbphyc_phy_ops = { .init = stm32_usbphyc_phy_init, .exit = stm32_usbphyc_phy_exit, + .power_on = stm32_usbphyc_phy_power_on, + .power_off = stm32_usbphyc_phy_power_off, .owner = THIS_MODULE, }; @@ -519,6 +542,14 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) usbphyc->phys[port]->index = index; usbphyc->phys[port]->active = false; + usbphyc->phys[port]->vbus = devm_regulator_get_optional(&phy->dev, "vbus"); + if (IS_ERR(usbphyc->phys[port]->vbus)) { + ret = PTR_ERR(usbphyc->phys[port]->vbus); + if (ret == -EPROBE_DEFER) + goto put_child; + usbphyc->phys[port]->vbus = NULL; + } + port++; }