Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp288322pxk; Wed, 2 Sep 2020 00:59:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvhDCIJe2JEWHdgCJ5N6FtorH5H3OejrLzdlgugqmBHIdyGt7ThWfHkZkfhs3F6GLl6s9a X-Received: by 2002:a17:906:a0c5:: with SMTP id bh5mr4948164ejb.120.1599033577029; Wed, 02 Sep 2020 00:59:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599033577; cv=none; d=google.com; s=arc-20160816; b=QF7C7co93CaOWrr3juS5bfA6i3eYm5q+qN6ffQbS9LfS00kKw9w0HOOooZs2O0TXB5 v5uAPOIMo7H5aDrf/1CnBKd3tBdPIGFaQOno8L8sOaC0PTcYXDVFcOPZP1BJcok0wPYS bDhVWcF0Yfi5WzKkSWqUJKTShi1t5aGSAD4BzpFCs06D9YavtyrB9o8vyTJC41DLt5Hy 6oc8W3s/2ST97Fawc9o9f9zIXKE7FbrDxc5ulqLyDvsLuRm1ODo3v9hdeA0mVW5CWjs5 tj1401SsrlKL0IT3Ri5DRi2+n7YqlZLUHebvYkrvDfv1fKyoHXp+5jOPf69dq4r6T6dA EIOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=YojwehfIro8lj5y1pZczwwtLSghgdQ9RZAhgH6eo2q0=; b=whYtJmeW4ypkp4bX4sCjH+zCYBJHgMbReyMMHRfI2P6QpZbffKckaPm1cSB8zkxPrI q1WoF6gO66Uba4G/3brHfQl+e0ebjjplp7DPOFaE4yAGxwk52jgz4reJZQkWLNvXhUDZ su7YuJN8XuSkpLYFIGnLdbC1/pwL0Lib+5dx7PmtltL9upTFYqFtXel47pR9EO80TwWC y8wqGH3lUUM/Z/zYC+QKhqmkRRl1cRutf0kAsTn7+UFEQs3hfXEwaWO4QcdFSLgxcC4+ TxtfKhhrIsR3Wu94Ng4blutUxltVkw7mNHpEKVrHSWzAAlbCRdrXp86dnCXi3q8OIUoo gTQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=A3Hyr7jr; 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 t4si2075389ejt.506.2020.09.02.00.59.13; Wed, 02 Sep 2020 00:59:37 -0700 (PDT) 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=A3Hyr7jr; 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 S1726922AbgIBH55 (ORCPT + 99 others); Wed, 2 Sep 2020 03:57:57 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:45886 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726268AbgIBH5m (ORCPT ); Wed, 2 Sep 2020 03:57:42 -0400 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 0827m8Q8032288; Wed, 2 Sep 2020 09:57:22 +0200 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=YojwehfIro8lj5y1pZczwwtLSghgdQ9RZAhgH6eo2q0=; b=A3Hyr7jrIBqHyVoK/6pHoW915zKJr6aPWtNeeL6V+iBPdiEhjIIO7jw5bwh5mpniUXic UlOF61BjAV+9kNTvdMNjJr3rxZXbHO42GbZc1fzT6RRjMc2bnab8yK4FU0f9LEnhSodf Mg3wSW7NPwYXSb5ftwN/U0FLVvpnp9xHoR9Hy/XIRQ8A3w1NJYr01HoYD5jXILPqLjmP +jAlT2QwL+ZX2Tpm59xIPHFjYbxPwMNWw5r+We+hUZfFuIrqDDJBYpfWigCs00LRLbED 14UiZOLcphuH39AaId3ixai4stSD5ftSSjbEx6i6eP9fwNaCQLGN4NYMM1C0P6QOIDtJ wg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 337dwhc0fu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 02 Sep 2020 09:57:22 +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 24C0D10002A; Wed, 2 Sep 2020 09:57:22 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 13CF4212FBA; Wed, 2 Sep 2020 09:57:22 +0200 (CEST) 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; Wed, 2 Sep 2020 09:57:21 +0200 From: Amelie Delaunay To: Rob Herring , Greg Kroah-Hartman , Maxime Coquelin , Alexandre Torgue , Russell King , Heikki Krogerus CC: , , , , , Amelie Delaunay , Fabrice Gasnier Subject: [RESEND PATCH v2 5/6] ARM: dts: stm32: add STUSB1600 Type-C using I2C4 on stm32mp15xx-dkx Date: Wed, 2 Sep 2020 09:57:06 +0200 Message-ID: <20200902075707.9052-6-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200902075707.9052-1-amelie.delaunay@st.com> References: <20200902075707.9052-1-amelie.delaunay@st.com> MIME-Version: 1.0 Content-Type: text/plain 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.235,18.0.687 definitions=2020-09-02_03:2020-09-02,2020-09-02 signatures=0 Sender: linux-kernel-owner@vger.kernel.org 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 power-opmode to "default" (it means 500mA in USB 2.0). 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 add the vin fixed 5V regulator too). 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 --- No changes in v2. --- arch/arm/boot/dts/stm32mp15-pinctrl.dtsi | 7 +++++ arch/arm/boot/dts/stm32mp15xx-dkx.dtsi | 38 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi index b5a66429670c..fe782afaf010 100644 --- a/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi +++ b/arch/arm/boot/dts/stm32mp15-pinctrl.dtsi @@ -1573,6 +1573,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 a5307745719a..589065223bf0 100644 --- a/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi +++ b/arch/arm/boot/dts/stm32mp15xx-dkx.dtsi @@ -80,6 +80,14 @@ dais = <&sai2a_port &sai2b_port &i2s2_port>; status = "okay"; }; + + vin: vin { + compatible = "regulator-fixed"; + regulator-name = "vin"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + regulator-always-on; + }; }; &adc { @@ -230,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"; + power-opmode = "default"; + + port { + con_usbotg_hs_ep: endpoint { + remote-endpoint = <&usbotg_hs_ep>; + }; + }; + }; + }; + pmic: stpmic@33 { compatible = "st,stpmic1"; reg = <0x33>; @@ -631,6 +663,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