Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2237010rwl; Thu, 30 Mar 2023 07:47:01 -0700 (PDT) X-Google-Smtp-Source: AKy350aR+cjfiE8reJdAGJfXOD70bdA724WQ7sM5drHnNNkq1+s8OkcZ18Rs/EtkSwYBVgY0Yea0 X-Received: by 2002:a05:6a00:194e:b0:62a:5ae:3012 with SMTP id s14-20020a056a00194e00b0062a05ae3012mr2896746pfk.1.1680187621281; Thu, 30 Mar 2023 07:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680187621; cv=none; d=google.com; s=arc-20160816; b=Yip4vxH9hqXfR5HoLss0PJpuYLUycPnW7xkr4ts2jRnBNWJEk1wy6H/+zjkOQAvRy7 Hh6hLAkhrHpQzxYkcs9yk1/b2rA5WbjsdG2dvq5gnUrMMwz0oNZO7GG+R30Jda74aJGN xTj9OoXM9fK8QRVXzLSGuFME2cBHbZTv1jKlR76snbuo+IlRjuCjqCucA+X/TXLe5qHr sjcB/Nj0aLF82yQPAXZ4qnS3XYow0XtOlvR5b72X38VlsslY0TLJp5jLli77OIVkWgUm RW4A+7qeApXqta8tegvPYrqz35nJUnaTgr7Orgzmmo2JjP8AqYwNxK/36csDq4qUn5Yr mFgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=nSR4Y25BjBZKEaJW7Afy19doH1/s9g14RfLRHHeQ3bI=; b=n3Zi44FQmivCVk94rnXK71xYShj9DNVonoIdtaSTWQGsr+uCK4BsvhBtfyaH2lL0mW aKsr7mn/DNMeqDd6cAXvmVweUzuSFufAzTSj7LOqq3jFwnk1eQdP/8WT0ACHeIz4bv1x 6CeInfbIenfBVu2NOj2dz9mcT7yFD3AE7x/7DXtLZAHOQycapOd53odVDHtoC9+B+7I2 T8JhUin53zxdGFrCkG5FZS0Vco069mLzJ4TLGN/5UjVAac1gQ7EMA5q1igtquuzmtJp3 XEo3FUU1CnE16H85sowBFLnizS7C1VseJrwgNQPcybRJDhtVlGa5PNkk795Lse+s2JUK NQVw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k20-20020a056a00135400b006255ffe925fsi25213531pfu.162.2023.03.30.07.46.48; Thu, 30 Mar 2023 07:47:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231886AbjC3Oi1 (ORCPT + 99 others); Thu, 30 Mar 2023 10:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbjC3Oi0 (ORCPT ); Thu, 30 Mar 2023 10:38:26 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C83F6DE for ; Thu, 30 Mar 2023 07:38:24 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1phtPr-0002m4-U6; Thu, 30 Mar 2023 16:38:15 +0200 Received: from mfe by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1phtPp-0001ax-BT; Thu, 30 Mar 2023 16:38:13 +0200 Date: Thu, 30 Mar 2023 16:38:13 +0200 From: Marco Felsch To: Andreas Henriksson Cc: Jun Li , "robh+dt@kernel.org" , "krzysztof.kozlowski+dt@linaro.org" , "shawnguo@kernel.org" , dl-linux-imx , "festevam@gmail.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "kernel@pengutronix.de" , Xu Yang Subject: Re: [PATCH] arm64: dts: imx8mp-evk: add dual-role usb port1 support Message-ID: <20230330143813.teid36w24a4esjsx@pengutronix.de> References: <20230323105826.2058003-1-m.felsch@pengutronix.de> <20230327084947.dcguxgyo2lfen2ms@fatal.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230327084947.dcguxgyo2lfen2ms@fatal.se> User-Agent: NeoMutt/20180716 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 23-03-27, Andreas Henriksson wrote: > On Fri, Mar 24, 2023 at 10:18:17AM +0000, Jun Li wrote: > > > > > > > -----Original Message----- > > > From: Marco Felsch > > > Sent: Thursday, March 23, 2023 6:58 PM > > > To: robh+dt@kernel.org; krzysztof.kozlowski+dt@linaro.org; > > > shawnguo@kernel.org; dl-linux-imx ; festevam@gmail.com > > > Cc: linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > > > kernel@pengutronix.de > > > Subject: [PATCH] arm64: dts: imx8mp-evk: add dual-role usb port1 support > > > > > > The i.MX8MP-EVK has a dual-role usb-type-c port marked as PORT1. By this > > > commit the dual-role support is added which allows the user-space to assign > > > usb-gadget functions to it via the configFS. > > > > So just ignore the orientation switch will make this port cannot work > > at super speed, this is actually why this port is not enabled at upstream. > > I see the orientation switch via GPIO for SBU is already merged: > > drivers/usb/typec/mux/gpio-sbu-mux.c > > Do you have interest to expand this driver to support super speed > > switch for this case? > [...] > > FWIW This is what I ended up with (after backporting the gpio-sbu-mux patches) > a little while ago trying to get the usb-c ports going on imx8mp-evk. I've not > yet had the time to fully test this (only done host/device, not tested: SS, > orientation, etc), so beware that it might be completely wrong. > > #include "dt-bindings/usb/pd.h" > > &usb3_phy0 { > vbus-power-supply = <&ptn5110>; > status = "okay"; > }; > > &usb3_0 { > status = "okay"; > }; > > &usb_dwc3_0 { > dr_mode = "otg"; > hnp-disable; > srp-disable; > adp-disable; > usb-role-switch; > role-switch-default-mode = "peripheral"; > snps,dis-u1-entry-quirk; > snps,dis-u2-entry-quirk; > status = "okay"; > > port { > usb3_drd_sw: endpoint { > remote-endpoint = <&typec_dr_sw>; > }; > }; > }; > > &i2c2 { > clock-frequency = <100000>; > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_i2c2>; > status = "okay"; > > ptn5110: tcpc@50 { > compatible = "nxp,ptn5110"; > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_typec>; > reg = <0x50>; > > interrupt-parent = <&gpio4>; > interrupts = <19 IRQ_TYPE_LEVEL_LOW>; > status = "okay"; > > port { > typec_dr_sw: endpoint { > remote-endpoint = <&usb3_drd_sw>; > }; > }; > > usb_con: connector { > compatible = "usb-c-connector"; > label = "USB-C"; > power-role = "dual"; > data-role = "dual"; > try-power-role = "sink"; > source-pdos = ; > sink-pdos = PDO_VAR(5000, 20000, 3000)>; > op-sink-microwatt = <15000000>; > self-powered; > > ports { > #address-cells = <1>; > #size-cells = <0>; > > port@1 { > reg = <1>; > typec_con_ss: endpoint { > remote-endpoint = <&usb3_data_ss>; > }; > }; > }; > }; > }; > > }; > > &iomuxc { > pinctrl_typec: typec1grp { > fsl,pins = < > MX8MP_IOMUXC_SAI1_TXD7__GPIO4_IO19 0x1c4 > >; > }; > > pinctrl_typec_mux: typec1muxgrp { > fsl,pins = < > MX8MP_IOMUXC_SAI1_MCLK__GPIO4_IO20 0x16 > MX8MP_IOMUXC_SD2_WP__GPIO2_IO20 0x16 > >; > }; > > > pinctrl_i2c2: i2c2grp { > fsl,pins = < > MX8MP_IOMUXC_I2C2_SCL__I2C2_SCL 0x400001c2 > MX8MP_IOMUXC_I2C2_SDA__I2C2_SDA 0x400001c2 > >; > }; > }; > > / { > gpio-sbu-mux { > compatible = "gpio-sbu-mux"; > > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_typec_mux>; > select-gpios = <&gpio4 20 GPIO_ACTIVE_LOW>; // (PAD_)SAI1_MCLK -> USB1_SS_SEL > enable-gpios = <&gpio2 20 GPIO_ACTIVE_LOW>; // (PAD_)SD2_WP -> USB1_TYPEC_EN_B -> TYPEC_EN_B > > //mode-switch; > orientation-switch; > > port { > usb3_data_ss: endpoint { > remote-endpoint = <&typec_con_ss>; > }; > }; > }; > }; > > Hope it might help. I didn't tested it but at the moment I don't see the problem with my patch. Sure the ID pin is not connected but if I understood it correctly (please correct me) the tcpc will handle the orientation. I can set the mode to device from user-space which worked. I didn't verified the SuperSpeed mode nor the host mode since I don't have a USB-C flash drive. Without the patch the port is just unused albeit the port is really useful for bootloaders like barebox to provide a usbgadget/fastboot device to flash the system. Regards, Marco