Message ID | 20221102155226.51587-1-dev@pschenker.ch |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ee07:0:0:0:0:0 with SMTP id y7csp18044wrn; Wed, 2 Nov 2022 08:53:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Ya7J76RlzYVce0iceRqceFE7TYr8dBSKZueHGeDF/dD8ICZp/DMTmBEsZgj9mRdlNWz4O X-Received: by 2002:a05:6a00:13aa:b0:56b:c782:107f with SMTP id t42-20020a056a0013aa00b0056bc782107fmr25459619pfg.43.1667404418960; Wed, 02 Nov 2022 08:53:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667404418; cv=none; d=google.com; s=arc-20160816; b=WHYZ2cE2WbyhzX+RHZoYugh/0D+mbcM+rrz4UvYwu1DGSJ5/mr5x+Cs/S3iLq7T25a /XR6QSxGpmL2ure/Gd/VV2PxTMDq2s6CxSLBwYESU05dVMp9wPg0HAYl5it+Jo1Mo2Gc FUG4Ot0CgJH3eNJfANu8y70pNCdti5p473d/dGsiNwed42rg6pw5BI0wtDk7Qmdnn5GJ zmRyozto7eFZStSf1NP9KaZfs8mrtb6+3NTQSpIXSSsXkrYaFfMP92avLRSEqcffeZpH uilHcWXhnqao/WvwZgJtoqcW/+ByEb6UhFgyaFHl/hDt17fYswozUhY7L7uXksfy1Ojb rDag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7RAJSVbnPaockqds5kr1cdmh1ys2f76FTq9CJvS8rHg=; b=FdsSbK4s+YwnUL13qIfUwNEUEF/YYaKGqHSfvSN0kiPQLvO40JyaaFBOFnkv7n+w3N WnPWJae/CeFo7/nOtXwzoCpdTTSxEfGLc1If1ehQdFh9lNp+nrQngrYfbsSMbxVYOHIM wfKII7XrmqipVn47J8moNUQvwl14T/AO6WkZvF+TT3OFaxj8SUv1KXyJh95o9adcYPAh bV9t6bI699iP7VJtzk15eC2fQ396KNuUExXF3PgursJ5CdPmGFzHN+B0K7v9q3LRXFga Bmyo0TWC5VN/ZAMUr6m3NDHqxlU2solnEBFfG0Rdk8Ae5VkN/MX4SXt4uS6PQ9wcyipN e7UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pschenker.ch header.s=20220412 header.b=TQm8+MuV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pschenker.ch Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y192-20020a638ac9000000b00453d2790c49si16819130pgd.11.2022.11.02.08.53.25; Wed, 02 Nov 2022 08:53:38 -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; dkim=pass header.i=@pschenker.ch header.s=20220412 header.b=TQm8+MuV; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=pschenker.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230451AbiKBPwj (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Wed, 2 Nov 2022 11:52:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbiKBPwi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Nov 2022 11:52:38 -0400 Received: from smtp-bc09.mail.infomaniak.ch (smtp-bc09.mail.infomaniak.ch [IPv6:2001:1600:3:17::bc09]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A2C2AE35 for <linux-kernel@vger.kernel.org>; Wed, 2 Nov 2022 08:52:35 -0700 (PDT) Received: from smtp-3-0001.mail.infomaniak.ch (unknown [10.4.36.108]) by smtp-2-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4N2WcK0L8xzMqNZt; Wed, 2 Nov 2022 16:52:33 +0100 (CET) Received: from philippe-pc.toradex.int (unknown [31.10.206.125]) by smtp-3-0001.mail.infomaniak.ch (Postfix) with ESMTPA id 4N2WcJ40DVzMpqBV; Wed, 2 Nov 2022 16:52:32 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=pschenker.ch; s=20220412; t=1667404352; bh=hsmqP6LW9Hc8mmhziJ3amvKnlktfxLKv2Sastr0h7Mc=; h=From:To:Cc:Subject:Date:From; b=TQm8+MuVUwOG0FZujEOnW7Guwm64m8a1xGcEzqlHvLxisaRwxJuzqvTua50ZFeZ+X WaTLDPNoYxMGvittPp5RHg9Qxp6YowAa+4AbXgQ0O7bT+VF+dU5UR0okp58kB1PKra k1IgbmLnWIgyikD4GOCunTDajWVD1JyWv9QxjEUk= From: Philippe Schenker <dev@pschenker.ch> To: Shawn Guo <shawnguo@kernel.org>, devicetree@vger.kernel.org Cc: Philippe Schenker <philippe.schenker@toradex.com>, Fabio Estevam <festevam@gmail.com>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, NXP Linux Team <linux-imx@nxp.com>, Pengutronix Kernel Team <kernel@pengutronix.de>, Rob Herring <robh+dt@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: dts: colibri-imx6ull: Enable dual-role switching Date: Wed, 2 Nov 2022 16:52:26 +0100 Message-Id: <20221102155226.51587-1-dev@pschenker.ch> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748400256113741904?= X-GMAIL-MSGID: =?utf-8?q?1748400256113741904?= |
Series |
ARM: dts: colibri-imx6ull: Enable dual-role switching
|
|
Commit Message
Philippe Schenker
Nov. 2, 2022, 3:52 p.m. UTC
From: Philippe Schenker <philippe.schenker@toradex.com> The Colibri standard provides a GPIO called USBC_DET to switch from USB Host to USB Device and back. The Colibri iMX6ULL does have the SoC ball USB_OTG1_VBUS connected in series with a capacitor to ground. This means that we need to provide to the extcon framework VBUS and ID events using the single GPIO we have. The Extcon USB GPIO driver does use id-gpio also for VBUS event, as in our case where vbus-gpio is absent. Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com> --- arch/arm/boot/dts/imx6ull-colibri.dtsi | 8 ++++++++ 1 file changed, 8 insertions(+)
Comments
Hi Philippe, Am Mittwoch, 2. November 2022, 16:52:26 CET schrieb Philippe Schenker: > From: Philippe Schenker <philippe.schenker@toradex.com> > > The Colibri standard provides a GPIO called USBC_DET to switch from > USB Host to USB Device and back. The Colibri iMX6ULL does have the SoC > ball USB_OTG1_VBUS connected in series with a capacitor to ground. > > This means that we need to provide to the extcon framework VBUS and ID > events using the single GPIO we have. The Extcon USB GPIO driver does > use id-gpio also for VBUS event, as in our case where vbus-gpio is > absent. > > Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com> > > --- > > arch/arm/boot/dts/imx6ull-colibri.dtsi | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi > b/arch/arm/boot/dts/imx6ull-colibri.dtsi index 577a424b0e1d..feb1fcd9a684 > 100644 > --- a/arch/arm/boot/dts/imx6ull-colibri.dtsi > +++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi > @@ -24,6 +24,13 @@ backlight: backlight { > status = "okay"; > }; > > + extcon_usbc_det: usbc-det { > + compatible = "linux,extcon-usb-gpio"; > + id-gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>; /* SODIMM 137 / USBC_DET */ > + pinctrl-names = "default"; > + pinctrl-0 = <&pinctrl_snvs_usbc_det>; > + }; > + > gpio-keys { > compatible = "gpio-keys"; > pinctrl-names = "default"; > @@ -275,6 +282,7 @@ &uart5 { > /* Colibri USBC */ > &usbotg1 { > dr_mode = "otg"; > + extcon = <&extcon_usbc_det>, <&extcon_usbc_det>; How came you up with this double entries? Is there some documentation you need two phandles? I have a problem on imx8mm (same USB host controller) where on USB device mode no device is attached on host side. I fixed it by using usb-role-switch instead [1]. But it also works on imx8mm using extcon with two phandles instead of just one. Regards, Alexander [1] https://patchwork.kernel.org/project/linux-arm-kernel/patch/ 20221101093031.278241-1-alexander.stein@ew.tq-group.com/ > srp-disable; > hnp-disable; > adp-disable;
On Thu, Nov 03, 2022 at 08:46:58AM +0100, Alexander Stein wrote: > Hi Philippe, > > Am Mittwoch, 2. November 2022, 16:52:26 CET schrieb Philippe Schenker: > > From: Philippe Schenker <philippe.schenker@toradex.com> > > > > The Colibri standard provides a GPIO called USBC_DET to switch from > > USB Host to USB Device and back. The Colibri iMX6ULL does have the SoC > > ball USB_OTG1_VBUS connected in series with a capacitor to ground. > > > > This means that we need to provide to the extcon framework VBUS and ID > > events using the single GPIO we have. The Extcon USB GPIO driver does > > use id-gpio also for VBUS event, as in our case where vbus-gpio is > > absent. > > > > Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com> > > > > --- > > > > arch/arm/boot/dts/imx6ull-colibri.dtsi | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi > > b/arch/arm/boot/dts/imx6ull-colibri.dtsi index 577a424b0e1d..feb1fcd9a684 > > 100644 > > --- a/arch/arm/boot/dts/imx6ull-colibri.dtsi > > +++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi > > @@ -24,6 +24,13 @@ backlight: backlight { > > status = "okay"; > > }; > > > > + extcon_usbc_det: usbc-det { > > + compatible = "linux,extcon-usb-gpio"; > > + id-gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>; /* SODIMM 137 / > USBC_DET */ > > + pinctrl-names = "default"; > > + pinctrl-0 = <&pinctrl_snvs_usbc_det>; > > + }; > > + > > gpio-keys { > > compatible = "gpio-keys"; > > pinctrl-names = "default"; > > @@ -275,6 +282,7 @@ &uart5 { > > /* Colibri USBC */ > > &usbotg1 { > > dr_mode = "otg"; > > + extcon = <&extcon_usbc_det>, <&extcon_usbc_det>; > > How came you up with this double entries? Is there some documentation you need > two phandles? extcon-usb-gpio provides both vbus/otg_id with a single handle, however the integration in chipidea is somehow weird, the first entry is supposed to be used to read the vbus, the second one to read the otg_id. So if you need to read both you really need to have the handle twice ... Francesco
On Thu, Nov 03, 2022 at 09:04:53AM +0100, Francesco Dolcini wrote: > On Thu, Nov 03, 2022 at 08:46:58AM +0100, Alexander Stein wrote: > > Hi Philippe, > > > > Am Mittwoch, 2. November 2022, 16:52:26 CET schrieb Philippe Schenker: > > > From: Philippe Schenker <philippe.schenker@toradex.com> > > > > > > The Colibri standard provides a GPIO called USBC_DET to switch from > > > USB Host to USB Device and back. The Colibri iMX6ULL does have the SoC > > > ball USB_OTG1_VBUS connected in series with a capacitor to ground. > > > > > > This means that we need to provide to the extcon framework VBUS and ID > > > events using the single GPIO we have. The Extcon USB GPIO driver does > > > use id-gpio also for VBUS event, as in our case where vbus-gpio is > > > absent. > > > > > > Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com> > > > > > > --- > > > > > > arch/arm/boot/dts/imx6ull-colibri.dtsi | 8 ++++++++ > > > 1 file changed, 8 insertions(+) > > > > > > diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi > > > b/arch/arm/boot/dts/imx6ull-colibri.dtsi index 577a424b0e1d..feb1fcd9a684 > > > 100644 > > > --- a/arch/arm/boot/dts/imx6ull-colibri.dtsi > > > +++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi > > > @@ -24,6 +24,13 @@ backlight: backlight { > > > status = "okay"; > > > }; > > > > > > + extcon_usbc_det: usbc-det { > > > + compatible = "linux,extcon-usb-gpio"; > > > + id-gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>; /* SODIMM 137 / > > USBC_DET */ > > > + pinctrl-names = "default"; > > > + pinctrl-0 = <&pinctrl_snvs_usbc_det>; > > > + }; > > > + > > > gpio-keys { > > > compatible = "gpio-keys"; > > > pinctrl-names = "default"; > > > @@ -275,6 +282,7 @@ &uart5 { > > > /* Colibri USBC */ > > > &usbotg1 { > > > dr_mode = "otg"; > > > + extcon = <&extcon_usbc_det>, <&extcon_usbc_det>; > > > > How came you up with this double entries? Is there some documentation you need > > two phandles? > > extcon-usb-gpio provides both vbus/otg_id with a single handle, however > the integration in chipidea is somehow weird, the first entry is supposed to be > used to read the vbus, the second one to read the otg_id. > > So if you need to read both you really need to have the handle twice ... Thanks for the input, Francesco! Philippe, Do you consider to use usb-role-switch as suggested by Alexander, considering the weirdness of how chipidea driver supports extcon-usb-gpio? Shawn
diff --git a/arch/arm/boot/dts/imx6ull-colibri.dtsi b/arch/arm/boot/dts/imx6ull-colibri.dtsi index 577a424b0e1d..feb1fcd9a684 100644 --- a/arch/arm/boot/dts/imx6ull-colibri.dtsi +++ b/arch/arm/boot/dts/imx6ull-colibri.dtsi @@ -24,6 +24,13 @@ backlight: backlight { status = "okay"; }; + extcon_usbc_det: usbc-det { + compatible = "linux,extcon-usb-gpio"; + id-gpio = <&gpio5 2 GPIO_ACTIVE_HIGH>; /* SODIMM 137 / USBC_DET */ + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_snvs_usbc_det>; + }; + gpio-keys { compatible = "gpio-keys"; pinctrl-names = "default"; @@ -275,6 +282,7 @@ &uart5 { /* Colibri USBC */ &usbotg1 { dr_mode = "otg"; + extcon = <&extcon_usbc_det>, <&extcon_usbc_det>; srp-disable; hnp-disable; adp-disable;