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 D7C48ECAAD2 for ; Thu, 1 Sep 2022 05:06:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232674AbiIAFGp (ORCPT ); Thu, 1 Sep 2022 01:06:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231447AbiIAFGo (ORCPT ); Thu, 1 Sep 2022 01:06:44 -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 557DB112EC7 for ; Wed, 31 Aug 2022 22:06:43 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oTcPV-0000wM-D8; Thu, 01 Sep 2022 07:06:37 +0200 Message-ID: Date: Thu, 1 Sep 2022 07:06:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: imx8mp USB OTG/dual-role Content-Language: en-US To: Tim Harvey , Jun Li , Alexander Stein Cc: Marek Vasut , Felipe Balbi , Fabio Estevam , Jacky Bai , Marcel Ziswiler , Sascha Hauer , "linux-usb@vger.kernel.org" , Rikard Falkeborn , Philippe Schenker , dl-linux-imx , Pengutronix Kernel Team , Francesco Dolcini , Shawn Guo , Aisheng Dong , Linux ARM Mailing List , Lucas Stach References: From: Ahmad Fatoum In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-usb@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On 31.08.22 18:38, Tim Harvey wrote: > On Tue, Aug 30, 2022 at 8:11 PM Jun Li wrote: >> >> Hi, >> >>> -----Original Message----- >>> From: Jacky Bai >>> Sent: Wednesday, August 31, 2022 9:18 AM >>> To: tharvey@gateworks.com; linux-usb@vger.kernel.org; Linux ARM Mailing >>> List ; Jun Li >>> Cc: Alexander Stein ; Jun Li >>> ; Rikard Falkeborn ; Lucas >>> Stach ; Philippe Schenker >>> ; Felipe Balbi ; Fabio >>> Estevam ; Marcel Ziswiler ; >>> Shawn Guo ; Marek Vasut ; Francesco >>> Dolcini ; Aisheng Dong >>> ; Sascha Hauer ; >>> dl-linux-imx ; Pengutronix Kernel Team >>> >>> Subject: RE: imx8mp USB OTG/dual-role >>> >>> Jun, as we discussed before, any conclusion on how to handle the USB OTG >>> ID pin in RM? >> >> The NXP datasheet for iMX8MP already changed the ID pin name to be with _DNU >> suffix, RM may be updated in next version. >> If legacy ID is going to be used, any normal GPIO function can be selected >> for it, extcon is well supported in dwc3 controller driver. >> >> More comments for Tim, see below... >> >>> >>> >>> BR >>> Jacky Bai >>> >>>> Subject: imx8mp USB OTG/dual-role >>>> >>>> Greetings, >>>> >>>> I have an imx8mp board (imx8mp-venice-gw74xx) which has a DWC3 USB >>>> host controller using imx8mp PHY >>>> (drivers/phy/freescale/phy-fsl-imx8mq-usb.c fsl,imx8mp-usb-phy) and >>>> DWC3 host controller core (drivers/usb/dwc3/core.c snps,dwc3) with >>>> imx8mp glue (drivers/usb/dwc3/dwc3-imx8mp.c fsl,imx8mp-dwc3). >>>> >>>> One of the 2x USB 3.0 hosts is connected to a USB Type C connector >>>> using a >>>> TPS25821 USB power switch and config controller which handles the CC >>>> pins on and VBUS enable as well as drives the mux sel pin of a >>>> USB3 mux to route the USB SS pairs to the appropriate half of the Type >>>> C connector. This device has no I2C or other management bus - only >>>> VBUS, FAULT#, SINK#, and POL# outputs based on CC pins. >>>> >>>> I'm not clear how to describe this in the device-tree in order for it >>>> to function as a dual-role controller for host vs device mode. >>>> >>>> The TPS25821 has a FAULT# signal that routes to IMX8MP GPIO1_IO13 >>>> pinmuxed as MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC and a SINK# signal >>>> that routes to IMX8MP GPIO1_IO10 pinmuxed as >>>> MX8MP_IOMUXC_GPIO1_IO10__USB1_OTG_ID. Additionally the VBUS output of >>>> the TPS25821 also connected to the TypeC VBUS pin routes to the IMX8MP >>>> USB1_VBUS pin. >> >> So TPS25821 does not need a driver. >> >>>> >>>> I've noticed there are currently only 2 other IMX8MP boards in Linux >>>> mainline that specify dr_mode="otg"; the DH electronics i.MX8M Plus >>>> DHCOM SOM (imx8mp-dhcom-som.dtsi), and the Toradex i.MX8M Plus Verdin >>>> SOM (imx8mp-verdin.dtsi). I'm not clear how these are hooked up or if >>>> USB dual-role work on these currently. I did notice that >> >> NXP iMX8MP EVK has not enabled type-C port due to the SS orientation >> switch binding is still in discussion, but you don't need a SW control >> in your case so you are okay here. >> >>>> imx8mp-verdin.dtsi looks like it does not enable the phy or core via >>>> status prop and uses invalid 'over-current-active-low' and >>> 'disable-over-current' dt props. >>>> >>>> I am currently using the following with imx8mp-venice-gw74xx: >>>> >>>> /* USB1 - Type C front panel */ >>>> &usb3_phy0 { >>>> status = "okay"; >>>> }; >>>> >>>> /* USB1 dwc3 glue */ >>>> &usb3_0 { >>>> fsl,over-current-active-low; >>>> status = "okay"; >>>> }; >>>> >>>> /* USB1 dwc3 core */ >>>> &usb_dwc3_0 { >>>> pinctrl-names = "default"; >>>> pinctrl-0 = <&pinctrl_usb1>; >>>> dr_mode = "otg"; >>>> }; >>>> >>>> &iomuxc { >>>> pinctrl_usb1: usb1grp { >>>> fsl,pins = < >>>> >>>> MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC 0x140 >>>> >>>> MX8MP_IOMUXC_GPIO1_IO10__USB1_OTG_ID 0x140 >>>> >; >>>> }; >>>> }; >>>> >>>> And currently v6.0-rc2 enumerates the host controller even without a >>>> Type-C to host cable attached which tells me that OTG_ID isn't doing >>>> its job. I vaguely recall some confusing statements on the IMX >>>> community forum that these pins might not even be used on the IMX8MP. >>>> >>>> How should I be describing the device-tree for this scenario in order >>>> to get dual-role behavior? >> >> Could this dts work for you? >> >> /* Config the "ID" pin iomux to be GPIO */ >> >> pinctrl_usb1: usb1grp { >> fsl,pins = < >> MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC 0x140 >> MX8MP_IOMUXC_GPIO1_IO10__GPIO1_IO10 0x140 >> >; >> }; >> >> extcon_usb: extcon_iddig { >> compatible = "linux,extcon-usb-gpio"; >> id-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>; >> }; >> >> &usb_dwc3_0 { >> pinctrl-names = "default"; >> pinctrl-0 = <&pinctrl_usb1>; >> extcon = <&extcon_usb> >> dr_mode = "otg"; >> }; >> >> Li Jun > > Jun, > > Thank you, this does appear to work as intended as dual-role. I was > not aware of linux,extcon-usb-gpio. > > And thanks also Alexander, your usb-dual-role via connector method > works as well. > > Which method is preferred, using extcon or using usb-role-switch via a > connector as in Alexander's patch? The commit adding the usb-role-switch 4602f3bff266 ("usb: common: add USB GPIO based connection detection driver") mentions that "[d]ue to the requirement of usb-connector.txt binding, the old way using extcon to support USB Dual-Role switch is now deprecated when use Type-B connector." > > Additionally, where is it appropriate to put the pinctrl for the OC > and ID pins in the usb_dwc3_0 (dwc3 core) node, the usb3_0 (dwc3 glue) > node, or the usb3_phy0 (phy) node? > > Best Regards, > > Tim > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | 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 C7815ECAAD2 for ; Thu, 1 Sep 2022 05:07:56 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dzvoYsM5ktlRR3srKsppuZeYSIkYWcJqXXFhTmS76hA=; b=kR6CeMvWh+AY+k 85Egk4UjM+CIyRJJgKPsnBOqcOYnAtUSTO7ALfC0kWhOTn4axcLPiT67ZBOAG+O4X9+phesmL9Juw 4WMUQwWsUMGPXF6UrSg23jpSOPs+yvaEkLc8nCl9hqH2zHT8GxHP4DXl6aXAmwapnHYpLPubtznQb LafP+ImviXiwD0krv37stjxXnvx2yx6LxILWNUCwSTpdCDCVe1yeUO+SrpAKb4X1qninRq238dx0w XnKLTusxOreIhrKYZFhCpD0co8jwRaVwMiDQYrkMPIgWGSXym+0dgJe+o8scxZ1kTeczATAPdt1x+ BCiARE9NaeswA+OCo8Lg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTcPm-009iCW-Ew; Thu, 01 Sep 2022 05:06:54 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTcPj-009iBU-9w for linux-arm-kernel@lists.infradead.org; Thu, 01 Sep 2022 05:06:53 +0000 Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oTcPV-0000wM-D8; Thu, 01 Sep 2022 07:06:37 +0200 Message-ID: Date: Thu, 1 Sep 2022 07:06:33 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: imx8mp USB OTG/dual-role Content-Language: en-US To: Tim Harvey , Jun Li , Alexander Stein Cc: Marek Vasut , Felipe Balbi , Fabio Estevam , Jacky Bai , Marcel Ziswiler , Sascha Hauer , "linux-usb@vger.kernel.org" , Rikard Falkeborn , Philippe Schenker , dl-linux-imx , Pengutronix Kernel Team , Francesco Dolcini , Shawn Guo , Aisheng Dong , Linux ARM Mailing List , Lucas Stach References: From: Ahmad Fatoum In-Reply-To: X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@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-20220831_220651_539324_588A01D0 X-CRM114-Status: GOOD ( 31.90 ) 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 On 31.08.22 18:38, Tim Harvey wrote: > On Tue, Aug 30, 2022 at 8:11 PM Jun Li wrote: >> >> Hi, >> >>> -----Original Message----- >>> From: Jacky Bai >>> Sent: Wednesday, August 31, 2022 9:18 AM >>> To: tharvey@gateworks.com; linux-usb@vger.kernel.org; Linux ARM Mailing >>> List ; Jun Li >>> Cc: Alexander Stein ; Jun Li >>> ; Rikard Falkeborn ; Lucas >>> Stach ; Philippe Schenker >>> ; Felipe Balbi ; Fabio >>> Estevam ; Marcel Ziswiler ; >>> Shawn Guo ; Marek Vasut ; Francesco >>> Dolcini ; Aisheng Dong >>> ; Sascha Hauer ; >>> dl-linux-imx ; Pengutronix Kernel Team >>> >>> Subject: RE: imx8mp USB OTG/dual-role >>> >>> Jun, as we discussed before, any conclusion on how to handle the USB OTG >>> ID pin in RM? >> >> The NXP datasheet for iMX8MP already changed the ID pin name to be with _DNU >> suffix, RM may be updated in next version. >> If legacy ID is going to be used, any normal GPIO function can be selected >> for it, extcon is well supported in dwc3 controller driver. >> >> More comments for Tim, see below... >> >>> >>> >>> BR >>> Jacky Bai >>> >>>> Subject: imx8mp USB OTG/dual-role >>>> >>>> Greetings, >>>> >>>> I have an imx8mp board (imx8mp-venice-gw74xx) which has a DWC3 USB >>>> host controller using imx8mp PHY >>>> (drivers/phy/freescale/phy-fsl-imx8mq-usb.c fsl,imx8mp-usb-phy) and >>>> DWC3 host controller core (drivers/usb/dwc3/core.c snps,dwc3) with >>>> imx8mp glue (drivers/usb/dwc3/dwc3-imx8mp.c fsl,imx8mp-dwc3). >>>> >>>> One of the 2x USB 3.0 hosts is connected to a USB Type C connector >>>> using a >>>> TPS25821 USB power switch and config controller which handles the CC >>>> pins on and VBUS enable as well as drives the mux sel pin of a >>>> USB3 mux to route the USB SS pairs to the appropriate half of the Type >>>> C connector. This device has no I2C or other management bus - only >>>> VBUS, FAULT#, SINK#, and POL# outputs based on CC pins. >>>> >>>> I'm not clear how to describe this in the device-tree in order for it >>>> to function as a dual-role controller for host vs device mode. >>>> >>>> The TPS25821 has a FAULT# signal that routes to IMX8MP GPIO1_IO13 >>>> pinmuxed as MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC and a SINK# signal >>>> that routes to IMX8MP GPIO1_IO10 pinmuxed as >>>> MX8MP_IOMUXC_GPIO1_IO10__USB1_OTG_ID. Additionally the VBUS output of >>>> the TPS25821 also connected to the TypeC VBUS pin routes to the IMX8MP >>>> USB1_VBUS pin. >> >> So TPS25821 does not need a driver. >> >>>> >>>> I've noticed there are currently only 2 other IMX8MP boards in Linux >>>> mainline that specify dr_mode="otg"; the DH electronics i.MX8M Plus >>>> DHCOM SOM (imx8mp-dhcom-som.dtsi), and the Toradex i.MX8M Plus Verdin >>>> SOM (imx8mp-verdin.dtsi). I'm not clear how these are hooked up or if >>>> USB dual-role work on these currently. I did notice that >> >> NXP iMX8MP EVK has not enabled type-C port due to the SS orientation >> switch binding is still in discussion, but you don't need a SW control >> in your case so you are okay here. >> >>>> imx8mp-verdin.dtsi looks like it does not enable the phy or core via >>>> status prop and uses invalid 'over-current-active-low' and >>> 'disable-over-current' dt props. >>>> >>>> I am currently using the following with imx8mp-venice-gw74xx: >>>> >>>> /* USB1 - Type C front panel */ >>>> &usb3_phy0 { >>>> status = "okay"; >>>> }; >>>> >>>> /* USB1 dwc3 glue */ >>>> &usb3_0 { >>>> fsl,over-current-active-low; >>>> status = "okay"; >>>> }; >>>> >>>> /* USB1 dwc3 core */ >>>> &usb_dwc3_0 { >>>> pinctrl-names = "default"; >>>> pinctrl-0 = <&pinctrl_usb1>; >>>> dr_mode = "otg"; >>>> }; >>>> >>>> &iomuxc { >>>> pinctrl_usb1: usb1grp { >>>> fsl,pins = < >>>> >>>> MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC 0x140 >>>> >>>> MX8MP_IOMUXC_GPIO1_IO10__USB1_OTG_ID 0x140 >>>> >; >>>> }; >>>> }; >>>> >>>> And currently v6.0-rc2 enumerates the host controller even without a >>>> Type-C to host cable attached which tells me that OTG_ID isn't doing >>>> its job. I vaguely recall some confusing statements on the IMX >>>> community forum that these pins might not even be used on the IMX8MP. >>>> >>>> How should I be describing the device-tree for this scenario in order >>>> to get dual-role behavior? >> >> Could this dts work for you? >> >> /* Config the "ID" pin iomux to be GPIO */ >> >> pinctrl_usb1: usb1grp { >> fsl,pins = < >> MX8MP_IOMUXC_GPIO1_IO13__USB1_OTG_OC 0x140 >> MX8MP_IOMUXC_GPIO1_IO10__GPIO1_IO10 0x140 >> >; >> }; >> >> extcon_usb: extcon_iddig { >> compatible = "linux,extcon-usb-gpio"; >> id-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>; >> }; >> >> &usb_dwc3_0 { >> pinctrl-names = "default"; >> pinctrl-0 = <&pinctrl_usb1>; >> extcon = <&extcon_usb> >> dr_mode = "otg"; >> }; >> >> Li Jun > > Jun, > > Thank you, this does appear to work as intended as dual-role. I was > not aware of linux,extcon-usb-gpio. > > And thanks also Alexander, your usb-dual-role via connector method > works as well. > > Which method is preferred, using extcon or using usb-role-switch via a > connector as in Alexander's patch? The commit adding the usb-role-switch 4602f3bff266 ("usb: common: add USB GPIO based connection detection driver") mentions that "[d]ue to the requirement of usb-connector.txt binding, the old way using extcon to support USB Dual-Role switch is now deprecated when use Type-B connector." > > Additionally, where is it appropriate to put the pinctrl for the OC > and ID pins in the usb_dwc3_0 (dwc3 core) node, the usb3_0 (dwc3 glue) > node, or the usb3_phy0 (phy) node? > > Best Regards, > > Tim > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel