Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1124390pxb; Fri, 6 Nov 2020 01:22:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJy1zgm00PEhxt9daF2PDHdFSlnKXahBGs6367BfwO7IDcaTHmF6qLnUhgOH+F1xvTbtnw9b X-Received: by 2002:a17:906:824a:: with SMTP id f10mr1176510ejx.167.1604654533013; Fri, 06 Nov 2020 01:22:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604654533; cv=none; d=google.com; s=arc-20160816; b=l40HhhN3rTxH/IGl1pFJDdMtPtflOAixlCLO4gt4qMRFLj24dXnCSL+A5V9/Gj5aFa j796209RzS4TyEFRfvsuTNYtLoLNuyM9iBlCFn6VjIBmBs1kVI3teLeEdcZ/j0w3ABfq 4QfMHTzva+OBnDH5b+acPnqQ5aOAQLOW/IvoJfGcBHVaUHPbXqqCk26zcstctJqOtg3m DS9UH8lBK3GSYyMa6WfCxLm33CjiBx0cI8X++NXoL0IolIguvZOo1m9sChq68fvlkqXw bez9LLd789A/0l+5WaOOyIVBEuvf6j2Gyn/FN5W5HwVhafc43GoNtkgNFOPQCDJFue/W pezQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=85cMq4TggMZAbc4+sAshrMoA2Vrgqngl/HoJ/KGRsVs=; b=o1kWijlgytAK5OhoW9SYbSD/Dkr1VKpLGgf52vI+kmv5VBOkSPNaOYBGypNMl/oplr vm1ldvBwaanNrIatmyxFi+kWyPqJbCE7+M2rWJvH+DW7ES9aMxlazlrB4VCsZxlGx/9x qxcLVF9QL9rUY4vu4yrKJZ3UtDs5cyHIJbHDz/oNXy58EpSUnBjKo6JXGP/Unl6eY83f E4Gb+GLijgW0dXr05GwK0Xe9LpLreHOmGT7URXE7ofl+79qlS0aWsy4dOjNQuAZg2/r8 IA8Jv/d2d/nEcdN0xp8qDRYz4nCjfqQDZ3LF1A/0SIwYuFOaBwtJaLwYHYmYC2JhJhRx 5R1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=KVFfOrdL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j24si414165ejy.346.2020.11.06.01.21.50; Fri, 06 Nov 2020 01:22:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=KVFfOrdL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726646AbgKFJTo (ORCPT + 99 others); Fri, 6 Nov 2020 04:19:44 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:44608 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726190AbgKFJTc (ORCPT ); Fri, 6 Nov 2020 04:19:32 -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 0A698DJp027462; Fri, 6 Nov 2020 10:19: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=85cMq4TggMZAbc4+sAshrMoA2Vrgqngl/HoJ/KGRsVs=; b=KVFfOrdLB9MrFo4Fp2VflDBDKWZPRg4wbZvwgPpdyIor2rR5dfUWA9guSf+yHZ4aQaWu otPTV9Sh+eKv04Fkl3LsC7vNdPyvY8nDpew0fUwKmH32QyIwrf0LYQ/M1BU1Z/cO02j4 bBfKRI6S4qrWOD/ti+6ongQeJnXgjqSrOhls8vs+tGMdRXqavMUubNJdlw/JqyiOJjiz 9WKDNUh/3HiyHD6Nxc/0Mk3W0tIfG5VTt7/mqnFoUjtnznn5X1Yuzi9+0VQ4D/tnuOyc j1EZHTVki94g0xtDgA26beNtXEB75s8eZoMMPCTvX0UHuPDv3jEv5ZciwplMAfEZeNGi 9g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 34gywrd88u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 06 Nov 2020 10:19: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 3B165100034; Fri, 6 Nov 2020 10:19:12 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2BA7C233E9D; Fri, 6 Nov 2020 10:19:12 +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 10:19: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 v4 4/5] ARM: dts: stm32: add STUSB1600 Type-C using I2C4 on stm32mp15xx-dkx Date: Fri, 6 Nov 2020 10:18:53 +0100 Message-ID: <20201106091854.14958-5-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201106091854.14958-1-amelie.delaunay@st.com> References: <20201106091854.14958-1-amelie.delaunay@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.45] 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_03:2020-11-05,2020-11-06 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 { -- 2.17.1