From patchwork Fri Nov 6 16:58:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 11887431 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65B406A2 for ; Fri, 6 Nov 2020 16:58:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3D5F622203 for ; Fri, 6 Nov 2020 16:58:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=st.com header.i=@st.com header.b="j2QBrG1V" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727626AbgKFQ6l (ORCPT ); Fri, 6 Nov 2020 11:58:41 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:36752 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727498AbgKFQ6j (ORCPT ); Fri, 6 Nov 2020 11:58:39 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A6GwCkp010238; Fri, 6 Nov 2020 17:58:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=EtuYOrqCs0Fxb2hFUZ6Z3gtrK51CMI3ATE1ilZwoDvo=; b=j2QBrG1V7i2kBCF039Z8iWaiXy02wUAbisTh2iKRwpr4rkse3zZSQpMlyjW8oVjUKlHn qbIRzf81F249tk52YIhE13ZpVKTX/bluMlcXsp4041CwxiyJVP7Rd72cTu7Zuc6PPMki YLdeown922cGEy8i8uDMxomKUUIHQQNxPDLGFCnJGGrhQmDTWmaeSjYwxBkHYqE/2ywy nM2KhXIBcv4xSYp2IWTj5g1ni9u3cJgo2Mq40Nafo6SepCo50kCtwocCkwEUuW4S9QIh Xap67uGvSZySsLNbgyzWNTepr85J9Oo9yO6Jq7VFmgnrmknA5R9hR2bMMEhNnNo4LCWT BA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 34gywrfkuk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Nov 2020 17:58:12 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E202810002A; Fri, 6 Nov 2020 17:58:11 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id CC0D62C41F5; Fri, 6 Nov 2020 17:58:11 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG3NODE2.st.com (10.75.127.8) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 6 Nov 2020 17:58:11 +0100 From: Amelie Delaunay To: Rob Herring , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , Russell King , Heikki Krogerus , Badhri Jagan Sridharan , Jun Li CC: , , , , , Amelie Delaunay , Fabrice Gasnier Subject: [PATCH v5 1/5] dt-bindings: connector: add typec-power-opmode property to usb-connector Date: Fri, 6 Nov 2020 17:58:01 +0100 Message-ID: <20201106165805.31534-2-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106165805.31534-1-amelie.delaunay@st.com> References: <20201106165805.31534-1-amelie.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG4NODE2.st.com (10.75.127.11) To SFHDAG3NODE2.st.com (10.75.127.8) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-06_06:2020-11-05,2020-11-06 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Power operation mode may depends on hardware design, so, add the optional property typec-power-opmode for usb-c connector to select the power operation mode capability. Signed-off-by: Amelie Delaunay Reviewed-by: Rob Herring --- Hi Bahdri, Rob, I've added the exlusion with FRS property, but new FRS property name should be use here so, be careful. --- .../bindings/connector/usb-connector.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/connector/usb-connector.yaml b/Documentation/devicetree/bindings/connector/usb-connector.yaml index 62781518aefc..a84464b3e1f2 100644 --- a/Documentation/devicetree/bindings/connector/usb-connector.yaml +++ b/Documentation/devicetree/bindings/connector/usb-connector.yaml @@ -93,6 +93,24 @@ properties: - device - dual + typec-power-opmode: + description: Determines the power operation mode that the Type C connector + will support and will advertise through CC pins when it has no power + delivery support. + - "default" corresponds to default USB voltage and current defined by the + USB 2.0 and USB 3.2 specifications, 5V 500mA for USB 2.0 ports and + 5V 900mA or 1500mA for USB 3.2 ports in single-lane or dual-lane + operation respectively. + - "1.5A" and "3.0A", 5V 1.5A and 5V 3.0A respectively, as defined in USB + Type-C Cable and Connector specification, when Power Delivery is not + supported. + allOf: + - $ref: /schemas/types.yaml#definitions/string + enum: + - default + - 1.5A + - 3.0A + # The following are optional properties for "usb-c-connector" with power # delivery support. source-pdos: @@ -192,6 +210,12 @@ allOf: type: const: micro +anyOf: + - not: + required: + - typec-power-opmode + - new-source-frs-typec-current + additionalProperties: true examples: From patchwork Fri Nov 6 16:58:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 11887435 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7AB176A2 for ; Fri, 6 Nov 2020 16:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57B6422202 for ; Fri, 6 Nov 2020 16:59:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=st.com header.i=@st.com header.b="IPJQfx8c" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727692AbgKFQ66 (ORCPT ); Fri, 6 Nov 2020 11:58:58 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:12160 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727553AbgKFQ6k (ORCPT ); Fri, 6 Nov 2020 11:58:40 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A6GvLoU020517; Fri, 6 Nov 2020 17:58:13 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=96MEsqaMWgi0lyi9f+eOqpd+Ad1LE4of3rEqH5GnIhI=; b=IPJQfx8caMQ3FIy54rqMeJDoUqRLWWZpOj9ZyRRGhyeDRNpMHu8DvH3n6EXCjDf2cnKH +eUHgQlS5HUK5sHImAR+dQkU7A+gJb3/de3bZxTfdcFxa0E0p6rdnrQLvlyzAVx1wBOU 1O5n54PQJe+r/2ecWnA7ClXj40LSO/AaRXgFHdPLgkbJeOJb9mj6bDP+1ajL1RjI6vP1 1kawvD1Crki/Ub5TSaRoOIUvu+34YZFlFQjmhZ2kMMOaFojmxysJz8gGx5w+GKhqTYkN PJ4mO+vvGqXXzuJvnAEd2glg3FECzR6sCFC1VhULgPQxWxrKF9kNFja/EBH0Z29UV2xS Ew== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 34h0328gr7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Nov 2020 17:58:13 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 18D5910002A; Fri, 6 Nov 2020 17:58:13 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 082792C41F5; Fri, 6 Nov 2020 17:58:13 +0100 (CET) Received: from localhost (10.75.127.47) by SFHDAG3NODE2.st.com (10.75.127.8) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 6 Nov 2020 17:58:12 +0100 From: Amelie Delaunay To: Rob Herring , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , Russell King , Heikki Krogerus , Badhri Jagan Sridharan , Jun Li CC: , , , , , Amelie Delaunay , Fabrice Gasnier Subject: [PATCH v5 2/5] dt-bindings: usb: Add DT bindings for STUSB160x Type-C controller Date: Fri, 6 Nov 2020 17:58:02 +0100 Message-ID: <20201106165805.31534-3-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106165805.31534-1-amelie.delaunay@st.com> References: <20201106165805.31534-1-amelie.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG3NODE1.st.com (10.75.127.7) To SFHDAG3NODE2.st.com (10.75.127.8) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-06_06:2020-11-05,2020-11-06 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add binding documentation for the STMicroelectronics STUSB160x Type-C port controller. Signed-off-by: Amelie Delaunay Reviewed-by: Rob Herring --- .../devicetree/bindings/usb/st,stusb160x.yaml | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 Documentation/devicetree/bindings/usb/st,stusb160x.yaml diff --git a/Documentation/devicetree/bindings/usb/st,stusb160x.yaml b/Documentation/devicetree/bindings/usb/st,stusb160x.yaml new file mode 100644 index 000000000000..9a51efa9d101 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/st,stusb160x.yaml @@ -0,0 +1,87 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/usb/st,stusb160x.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: STMicroelectronics STUSB160x Type-C controller bindings + +maintainers: + - Amelie Delaunay + +properties: + compatible: + enum: + - st,stusb1600 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vdd-supply: + description: main power supply (4.1V-22V) + + vsys-supply: + description: low power supply (3.0V-5.5V) + + vconn-supply: + description: power supply (2.7V-5.5V) used to supply VConn on CC pin in + source or dual power role + + connector: + type: object + + allOf: + - $ref: ../connector/usb-connector.yaml + + properties: + compatible: + const: usb-c-connector + + power-role: true + + typec-power-opmode: true + + required: + - compatible + +required: + - compatible + - reg + - connector + +additionalProperties: false + +examples: + - | + #include + i2c4 { + #address-cells = <1>; + #size-cells = <0>; + + typec: stusb1600@28 { + compatible = "st,stusb1600"; + reg = <0x28>; + vdd-supply = <&vbus_drd>; + vsys-supply = <&vdd_usb>; + interrupts = <11 IRQ_TYPE_EDGE_FALLING>; + interrupt-parent = <&gpioi>; + + typec_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + power-role = "dual"; + data-role = "dual"; + typec-power-opmode = "default"; + + port { + typec_con_ep: endpoint { + remote-endpoint = <&usbotg_hs_ep>; + }; + }; + }; + }; + }; +... From patchwork Fri Nov 6 16:58:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 11887433 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98E926A2 for ; Fri, 6 Nov 2020 16:58:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 70DD122248 for ; Fri, 6 Nov 2020 16:58:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=st.com header.i=@st.com header.b="G+w1ZZpp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727591AbgKFQ6k (ORCPT ); Fri, 6 Nov 2020 11:58:40 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:12280 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727474AbgKFQ6j (ORCPT ); Fri, 6 Nov 2020 11:58:39 -0500 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A6GvLoW020517; Fri, 6 Nov 2020 17:58:14 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=XenMXX7jpB+ldiDL9YwCU3HGZQwucqgew9IYEnutEX4=; b=G+w1ZZppV+wz4iskZtLF22i51Wp0PIbDYORQukZd9mV22WrkWZZn7KRPHXpIcLlK+KHk BCu8Jqr8cYsB66F+yIQRRyA1Iw7O91K60L/Zvgz9LCNMdIWMqd1N73PaqPt5/hoGmQjT 9z2fSyg2n7ujlrhcd1yocy28WRgyhnafwtASxLQZhTeMwF1dOuOAx7BcgZpqfTMPhTyx Ug+LxZD7yAj3MEK0JcpumUdmP2pO7xLml98DJdgf1Ni3dnshsfYxUklwtiF0FeBmP2L2 tVgb+QJnAV4IsIwnV+CLf4TmYua+6384txXEHXlpx+cniBr5l753Zv61fmKyM9fPhlhB iQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 34h0328gra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Nov 2020 17:58:14 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 585DE10002A; Fri, 6 Nov 2020 17:58:14 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 490A52C41F5; Fri, 6 Nov 2020 17:58:14 +0100 (CET) Received: from localhost (10.75.127.46) by SFHDAG3NODE2.st.com (10.75.127.8) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 6 Nov 2020 17:58:13 +0100 From: Amelie Delaunay To: Rob Herring , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , Russell King , Heikki Krogerus , Badhri Jagan Sridharan , Jun Li CC: , , , , , Amelie Delaunay , Fabrice Gasnier Subject: [PATCH v5 3/5] usb: typec: stusb160x: fix power-opmode property with typec-power-opmode Date: Fri, 6 Nov 2020 17:58:03 +0100 Message-ID: <20201106165805.31534-4-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106165805.31534-1-amelie.delaunay@st.com> References: <20201106165805.31534-1-amelie.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG4NODE2.st.com (10.75.127.11) To SFHDAG3NODE2.st.com (10.75.127.8) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-06_06:2020-11-05,2020-11-06 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Device tree property is named typec-power-opmode, not power-opmode. Fixes: da0cb6310094 ("usb: typec: add support for STUSB160x Type-C controller family") Signed-off-by: Amelie Delaunay Reviewed-by: Heikki Krogerus --- drivers/usb/typec/stusb160x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/stusb160x.c b/drivers/usb/typec/stusb160x.c index 2a618f02f4f1..d21750bbbb44 100644 --- a/drivers/usb/typec/stusb160x.c +++ b/drivers/usb/typec/stusb160x.c @@ -562,7 +562,7 @@ static int stusb160x_get_fw_caps(struct stusb160x *chip, * Supported power operation mode can be configured through device tree * else it is read from chip registers in stusb160x_get_caps. */ - ret = fwnode_property_read_string(fwnode, "power-opmode", &cap_str); + ret = fwnode_property_read_string(fwnode, "typec-power-opmode", &cap_str); if (!ret) { ret = typec_find_pwr_opmode(cap_str); /* Power delivery not yet supported */ From patchwork Fri Nov 6 16:58:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 11887427 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9EED56A2 for ; Fri, 6 Nov 2020 16:58:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7B69422228 for ; Fri, 6 Nov 2020 16:58:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=st.com header.i=@st.com header.b="ke9YRRFb" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727645AbgKFQ6m (ORCPT ); Fri, 6 Nov 2020 11:58:42 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:36742 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726422AbgKFQ6j (ORCPT ); Fri, 6 Nov 2020 11:58:39 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A6GwDlN010267; Fri, 6 Nov 2020 17:58:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=85cMq4TggMZAbc4+sAshrMoA2Vrgqngl/HoJ/KGRsVs=; b=ke9YRRFb1FAEJLij14tlpLtL/itYRQcHLz4iiN2ltmkbbBKpmW4Ue/hBmSYjRVZQzV5j P6q8ez/skNlyRW+tbMG9p+Bi1UOzhLVNRHnBZGoE9A5oWVMHHuWr/o9Tbv2UpVXlQuuP BMK+Ch/T0TKqclqcigj9ElvnvJBQ5S5MzleezrBSYqJvYIaookdPwZxVCmFWH6R0tvM7 ae0qmYHQLmM/pMhPk9cgX4dgsc3iJCN+8tFvxHBi1tcSTnr2OCzqCfrq037+ZoEVEYZ7 E26sRsOf+yj7kZMI70Y9xpOKB0nKgtj0upsv/Q4ZRORxYHBJQ74OfNwdHiIQhxM40pjB BA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 34gywrfkv2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Nov 2020 17:58:16 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7476210002A; Fri, 6 Nov 2020 17:58:15 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 654352C41F5; Fri, 6 Nov 2020 17:58:15 +0100 (CET) Received: from localhost (10.75.127.45) by SFHDAG3NODE2.st.com (10.75.127.8) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 6 Nov 2020 17:58:14 +0100 From: Amelie Delaunay To: Rob Herring , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , Russell King , Heikki Krogerus , Badhri Jagan Sridharan , Jun Li CC: , , , , , Amelie Delaunay , Fabrice Gasnier Subject: [PATCH v5 4/5] ARM: dts: stm32: add STUSB1600 Type-C using I2C4 on stm32mp15xx-dkx Date: Fri, 6 Nov 2020 17:58:04 +0100 Message-ID: <20201106165805.31534-5-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106165805.31534-1-amelie.delaunay@st.com> References: <20201106165805.31534-1-amelie.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG3NODE2.st.com (10.75.127.8) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-06_06:2020-11-05,2020-11-06 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This patch adds support for STUSB1600 USB Type-C port controller, used on I2C4 on stm32mp15xx-dkx. The default configuration on this board, on Type-C connector, is: - Dual Power Role (DRP), so set power-role to "dual"; - Vbus limited to 500mA, so set typec-power-opmode to "default" (it means 500mA in USB 2.0). typec-power-opmode is used to reconfigure the STUSB1600 advertising of current capability when its NVM is not in line with the board layout. On stm32mp15xx-dkx, Vbus power source of STUSB1600 is 5V_VIN. So power operation mode depends on the power supply used. To avoid any power issues, it is better to limit Vbus to 500mA on this board. ALERT# is the interrupt pin of STUSB1600. It needs an external pull-up, and signal is active low. USB OTG controller ID and Vbus signals are not connected on stm32mp15xx-dkx boards, so disconnection are not detected. Without DWC2 usb-role-switch: - if you unplug the USB cable from the Type-C port, you have to manually disconnect the USB gadget: echo disconnect > /sys/devices/platform/soc/49000000.usb-otg/udc/49000000.usb-otg/soft_connect - Then you can plug the USB cable again in the Type-C port, and manually reconnect the USB gadget: echo connect > /sys/devices/platform/soc/49000000.usb-otg/udc/49000000.usb-otg/soft_connect With DWC2 usb-role-switch, USB gadget is dynamically disconnected or connected. Signed-off-by: Amelie Delaunay --- arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 7 ++++++ arch/arm/boot/dts/stm32mp15xx-dkx.dtsi | 30 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi index d84686e00370..d2e9e7ac3336 100644 --- a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +++ b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi @@ -1591,6 +1591,13 @@ }; }; + stusb1600_pins_a: stusb1600-0 { + pins { + pinmux = ; + bias-pull-up; + }; + }; + uart4_pins_a: uart4-0 { pins1 { pinmux = ; /* UART4_TX */ diff --git a/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi b/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi index 93398cfae97e..ff324b151609 100644 --- a/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi +++ b/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi @@ -238,6 +238,30 @@ /delete-property/dmas; /delete-property/dma-names; + stusb1600@28 { + compatible = "st,stusb1600"; + reg = <0x28>; + interrupts = <11 IRQ_TYPE_EDGE_FALLING>; + interrupt-parent = <&gpioi>; + pinctrl-names = "default"; + pinctrl-0 = <&stusb1600_pins_a>; + status = "okay"; + vdd-supply = <&vin>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + power-role = "dual"; + typec-power-opmode = "default"; + + port { + con_usbotg_hs_ep: endpoint { + remote-endpoint = <&usbotg_hs_ep>; + }; + }; + }; + }; + pmic: stpmic@33 { compatible = "st,stpmic1"; reg = <0x33>; @@ -648,6 +672,12 @@ phy-names = "usb2-phy"; usb-role-switch; status = "okay"; + + port { + usbotg_hs_ep: endpoint { + remote-endpoint = <&con_usbotg_hs_ep>; + }; + }; }; &usbphyc { From patchwork Fri Nov 6 16:58:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amelie Delaunay X-Patchwork-Id: 11887425 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 094B6921 for ; Fri, 6 Nov 2020 16:58:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D48C1217A0 for ; Fri, 6 Nov 2020 16:58:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=st.com header.i=@st.com header.b="tM/K12L4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727505AbgKFQ6h (ORCPT ); Fri, 6 Nov 2020 11:58:37 -0500 Received: from mx07-00178001.pphosted.com ([185.132.182.106]:50616 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726953AbgKFQ6g (ORCPT ); Fri, 6 Nov 2020 11:58:36 -0500 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0A6GwBWQ008264; Fri, 6 Nov 2020 17:58:17 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=5CCBWSPpY2LWeU+v1BMKbE0dfzDcb6O0clQonhwRrS0=; b=tM/K12L4+LE4GkKl6PBDhLmilx/H0ZuElKoV5K4Y8s6s2rgCNYQ9K5KqMnZPgeym9BDW 26fBuS/aceArntsxivV4PXhRgFrI9w/a6zsYI013x7rvG6ROnEFkT9y/WelCVW6RuGMp b02Vd+0GEFc7vzFc1cWIy2LcSfHN7hfFPybgO/RyFITHnhZih0I9ckhVQRzYgFIhLiSi 9GrhfqpbKZs2aNXu6L68lZ3lUBf7sZB5fb0+xmFonzB5K+dMk3+zbVEBdJSVzijQo+vc voQA5Qw9WTIXk9ymfWIq9eQ87moeaqQo2vrLLvPXhEHbGJKcmr26dwLgqnKTv2TuWjIo lA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 34h00ewjwu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Nov 2020 17:58:17 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9FF0910002A; Fri, 6 Nov 2020 17:58:16 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 8CE002C41E8; Fri, 6 Nov 2020 17:58:16 +0100 (CET) Received: from localhost (10.75.127.44) by SFHDAG3NODE2.st.com (10.75.127.8) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 6 Nov 2020 17:58:16 +0100 From: Amelie Delaunay To: Rob Herring , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , Russell King , Heikki Krogerus , Badhri Jagan Sridharan , Jun Li CC: , , , , , Amelie Delaunay , Fabrice Gasnier Subject: [PATCH v5 5/5] ARM: multi_v7_defconfig: enable STUSB160X Type-C port controller support Date: Fri, 6 Nov 2020 17:58:05 +0100 Message-ID: <20201106165805.31534-6-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106165805.31534-1-amelie.delaunay@st.com> References: <20201106165805.31534-1-amelie.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG3NODE3.st.com (10.75.127.9) To SFHDAG3NODE2.st.com (10.75.127.8) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-06_06:2020-11-05,2020-11-06 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Enable support for the STMicroelectronics STUSB160X USB Type-C port controller driver by turning on CONFIG_TYPEC and CONFIG_TYPEC_STUSB160X as modules. Signed-off-by: Amelie Delaunay --- arch/arm/configs/multi_v7_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index a611b0c1e540..47eed80268e2 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -829,6 +829,8 @@ CONFIG_USB_CONFIGFS_F_HID=y CONFIG_USB_CONFIGFS_F_UVC=y CONFIG_USB_CONFIGFS_F_PRINTER=y CONFIG_USB_ETH=m +CONFIG_TYPEC=m +CONFIG_TYPEC_STUSB160X=m CONFIG_MMC=y CONFIG_MMC_BLOCK_MINORS=16 CONFIG_MMC_ARMMMCI=y