Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp301980pxx; Thu, 29 Oct 2020 03:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1b5fAp2TLk68T9u4HQbTRSrRFs0+MottFG0DHGumjCkgdhegtmrU/WEgU9enb/xWRORP6 X-Received: by 2002:a17:906:8401:: with SMTP id n1mr3100951ejx.215.1603965832431; Thu, 29 Oct 2020 03:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603965832; cv=none; d=google.com; s=arc-20160816; b=Y+wl+bSsUrU7ofK0O1+67HUBYcaDn24IHwkfGOxyMb7pkZyQ3Qa3RIdnSl2svgPKM6 W9J43kJkxxyju7Gu76CJWzo4mM7BIezq5OoPE4cY+kguIiwZdrEIX3IF418ekztd4FI0 /eB3zdzFHPcVVbnyk1ZLR568ST4DBSu/ksXE7wRKwFDtmuG6H7Eo50DVl5szJijbU+ts t1a25e18MMRSWC4LjUjX0HC1keCFvww8yl4aMPAy/ZACZFYKEPlGfshRueN5zx58SPjh Q2XlUPeNgqo1gtIWqc0C+iz3Z68IoSCrLnz3eXOTqUxqrLN17HLBtbMAVg7Gj5JndilS 3NFQ== 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=ZM1QwAwOmgnMzCkIZ8lEStCgVIzwOuXqZVBLnUmf6Pg=; b=lFNGTdGW2mU4Nd16ZzUesWfHqs05NQOWra2KKQ1Keiepo2FtK6lzTEGqtP7TlWYJTf Wvma8vBUDR/aYi1m1gnXxdRY92Hl4c30O5w8NBWfy3sM0PqryrZwb9x323H6yx5elYHJ rCQHxZpWVMUUo5WkYXpKuc8zYEHXOhNXOWUmdEgx3N0YIdgUKISmeDM9DLA4sWluHhqi xljHmDMR14Hxez4gwg6XHeSOJG5Crg/VPXh6NENa6boacMixxPTOqp8jit6dEPn538yy SYj4lQeJkJ1insEqkSLCC5JurjTcP1JelQeLNo1IcrJ0XsjnfNOT86j6RqmCYUyL+Gg6 qucA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=Pqq8qixC; 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 p18si1496926ejm.186.2020.10.29.03.03.29; Thu, 29 Oct 2020 03:03:52 -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=Pqq8qixC; 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 S1727350AbgJ2J6r (ORCPT + 99 others); Thu, 29 Oct 2020 05:58:47 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:25174 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727254AbgJ2J6j (ORCPT ); Thu, 29 Oct 2020 05:58:39 -0400 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 09T9wIu3006762; Thu, 29 Oct 2020 10:58:21 +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=ZM1QwAwOmgnMzCkIZ8lEStCgVIzwOuXqZVBLnUmf6Pg=; b=Pqq8qixCHIVtfBS91Xt9tDYrQ700RjMW+5ujDdVogKeMgtu2TRjZ0Uh8GVhdMdjaOH2Z BmbPx7vbYIGsigRbBh+erst+tecLNprgdac+BeXP41id4OgcLOsBvLZ6tIUrxCuOJadG vg1ae73kcf56gTJXB7rcq9i7r/mEVO/MylhUP9WGgV/ATbIu2UQRKKgvoeYJC4m74+5g xV6FCZ3C/op/OJvA83Z8ydjDm/ayYASrlnHk0VnjdKUkPaj6uGZMGodrr+kWdKQpiBmW QtQj0R/v+i05EVVkr3g6khmEKSn2nMUWJEV2wc53mYYltdnwdfSjCtVLmJblyGXdK+ec hw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 34ccmr846r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Oct 2020 10:58:21 +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 A3E8710002A; Thu, 29 Oct 2020 10: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 91412221F97; Thu, 29 Oct 2020 10: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; Thu, 29 Oct 2020 10:58:14 +0100 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 v3 3/4] ARM: dts: stm32: add STUSB1600 Type-C using I2C4 on stm32mp15xx-dkx Date: Thu, 29 Oct 2020 10:58:05 +0100 Message-ID: <20201029095806.10648-4-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201029095806.10648-1-amelie.delaunay@st.com> References: <20201029095806.10648-1-amelie.delaunay@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.45] 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-10-29_03:2020-10-29,2020-10-29 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 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 --- 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..01fa571584a4 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"; + 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