From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3323C77B7F for ; Wed, 3 May 2023 18:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JWTRPGMkRQdTFxsDr72zu0Rke0tLP+B2sE5aDsEzoZo=; b=pRH78fdIfimmMF qeouzGumqppQbM4JAKx8J8DH3WlJ+UQy01tUFqs12H+SyXaP40W0agwn8JsZgacFy4zk9NLOjkJF9 sVjoKWrl6AxnJXcOk2jCIA/6llRGyJPzkCTKLnA35hge/5Ljq0vsv+qcgyEYAs+wA14+44OAT7v0c 2hJFyErYZ3GU3hQBU+q/uAIY4t9/tvm+3tIb2KS4VufiaAPJXMlCqGiZDKAx+Z094/iiyHfMYxcMn OAtopoPCSUF6xb9xyDGVGsKS61L2NcHArvklKdn8+UG0rs3YycyvCjFbf72aTcRfXYKmB7hMNodE2 15lWKJweXUb0s6lrXXfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1puHX0-005Ty3-24; Wed, 03 May 2023 18:48:50 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1puHWx-005TwN-20 for linux-arm-kernel@lists.infradead.org; Wed, 03 May 2023 18:48:49 +0000 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-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-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230503_114847_834805_410A2526 X-CRM114-Status: GOOD ( 31.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6757C77B78 for ; Wed, 3 May 2023 18:49:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjECStP (ORCPT ); Wed, 3 May 2023 14:49:15 -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 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 >