Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1227148rwr; Wed, 3 May 2023 11:54:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4L1m70ayOpyd8u55Dwke3aHO9+VMNoeHEV7gqDeRb8rfOxRnNxWQkIElvi75dxkPGrU0AC X-Received: by 2002:a17:902:8206:b0:1aa:ffa9:9260 with SMTP id x6-20020a170902820600b001aaffa99260mr901591pln.7.1683140090636; Wed, 03 May 2023 11:54:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683140090; cv=none; d=google.com; s=arc-20160816; b=HtkpLRfrpewwA6hNPavqEPQJT0I1nb6a8KHw16d+X/7JkvPH0Ib3HPQhlkoKiECt4L J7PD+1chIFmOyK2Rp4uW041XfPEZ3RMLXK76V7vRdoPxTcLQuiwCwg9XQzm3I8+HNu1s 79aktFnSy8ppLbfB8JmkFcGHCz2lsOuF1vuQLK5HOqFXFnTtG6985pxoqCXZ5kZmitdl D96YCc7IwQDeLPsfhiuLmIrLDb+r7TKAmbWFHWajU4zpZ8Sa0YbD+5CDBYIPlqxEhD1S T7QIud7oW4VvrOs2KaCbee4RBd6TMJBME0fRdNEecZvMtNxkyR1tklXDj8jW81r5n6np YcGw== 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=+Pcm6ywBS3mdg8bGK82Teqy/5gGfBK/qLNoOXZ8rdlQ=; b=oiBCGBgdDl0EU+gJp7b0rQMTme9GEVrCICcMuCO/ETqJsGxodp/zcM//q0lNnmbwe8 MSn8PyjEr/Tgi3Qwh/mWawjC33ULGad0S5EiHzh84up/xTfgBRdT44mCjB+Xz39cTXnp LUcJZeimyNzIBwwAisbwYVB/dmXIz/HJGvz3NxBEZftHNW+i1fDtvU+GthtumBNcHRBb g13LYw7l9/j43MdCiR6XKTmZ7X6Yu0dEUX3hEvzcIa5wG9a64ZykLCDn4erSedbvmpeE HOSt+/ZDOxDoaTCV+IK4m+nu4CtLE8AhG5zhCZW2KgObj/dvo5PADTjwWaMmEHNEOxYM s3yA== 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 c5-20020a170902848500b001aadb1147e4si10516612plo.456.2023.05.03.11.54.39; Wed, 03 May 2023 11:54:50 -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 S229684AbjECStM (ORCPT + 99 others); Wed, 3 May 2023 14:49:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229559AbjECStA (ORCPT ); Wed, 3 May 2023 14:49:00 -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 A2F2D7D98 for ; Wed, 3 May 2023 11:48:44 -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 1puHWl-0003Vt-SJ; Wed, 03 May 2023 20:48:35 +0200 Received: from mfe by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1puHWk-0003xc-5a; Wed, 03 May 2023 20:48:34 +0200 Date: Wed, 3 May 2023 20:48:34 +0200 From: Marco Felsch To: Jun Li Cc: Andreas Henriksson , "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: <20230503184834.qln2wwvf3pgitkmp@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: 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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Li, Andreas, On 23-03-27, Jun Li wrote: > > > -----Original Message----- > > From: Andreas Henriksson > > Sent: Monday, March 27, 2023 4:50 PM > > To: Jun Li ; Marco Felsch > > Cc: 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 > > > > 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. > > Thanks for the advice. > > *reuse* compatible = "gpio-sbu-mux"; can make the basic *function* work, > but that's not the right direction, SBU has its own signal in typec connector, > here what we need is the Super Speed signal switch, you can see iMX8MP EVK > use 2 GPIOs control the SS for 3 states(normal orientation, reserve orientation, > places all channels in high impedance state), but SBU will disable both channels > at TYPEC_STATE_USB, this is not correct for USB data, so logically we cannot > reuse SBU either. But I think this gpio-sbu-mux.c driver can be extended to > add support super speed signal orientation. Thanks for the useful input :) I was dug into the usb-c hole and now I'm back. The "gpio-sbu-mux" should fit perfectly for our use-case, we only have to tell the driver to act as 'orientation-switch' only. All pieces are in place so just dts work to do. I will test my new patch and send a new version which should support super-speed to (fingers crossed). Regards, Marco > > Li Jun > > > > > #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. > > > > Regards, > > Andreas Henriksson >