From patchwork Thu May 4 13:46:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Felsch X-Patchwork-Id: 90091 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp338551vqo; Thu, 4 May 2023 07:01:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7MS+yUxvffDdhOcQoGUjr2kqypgSXrDEtgKNnZ7cxwariUv6uGYBI4pS22wduIFjKx6KAK X-Received: by 2002:a17:90b:4b46:b0:246:c097:6a17 with SMTP id mi6-20020a17090b4b4600b00246c0976a17mr2354379pjb.24.1683208871882; Thu, 04 May 2023 07:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683208871; cv=none; d=google.com; s=arc-20160816; b=cSF+vJfQPgnJS6q113mjA80xv28b7fcwF1dbuF65nqhnZeERWsMq+maiSsvE0vz/8N VzRqoLZOSJiGpmb8bHSlT5Hdx7NwEcPFZnTTU5EWs8Q6dEoWmKcQ06VjXLmv8VlWEKpr uOhXRQLwsTRtk+TAY8pBTscth4divy1ywM+UMV+F+cmtpqa+F8aX56s8CBwRtE+rRKJ0 8bek8P5SI0xUBuLwmt/+zo90Lq0guiLOI1F15CI/zM4duWixJzUri+hfbSMQurdxVp4c OsQD8Ky4o9WvvbZVDe1Vpdn2Ec9LBdOZA151BVm3sFnFQv/rkdJORBsN2mNDGRdvfGya cBbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=Bag8ohLN3lpu2m+vAdsIzso9ypYi61OFdJSKsSELxgU=; b=pyzn5/JiBukUR/5RHZmFGOBDBV4NvMx6pFatAn9TkhLg6ql9bCEJGHP/ReZ9kIReDC yjZz9DAaKdQ61S5C9dCdBh+8A/hNYLp+MVwVhb1/sBZHeC+r+lkF1goROJNqE5wMcGnf +OjWiOqhCX/DR0U4nG47TZX/d/3dB2/maOuPZJgXXPfCZsgO5Tpt2TFJdAv9IWLQlFvn jMGCEj9dH8Zhk1HfLZQGQS7tzDUg+J5UQ76vd+kpUumYWjOBjh1tVKBnjKThV9nbV1Mq F4hl+DW9BoRLcaHmu4zDVq8/ewkPjXA8TQ2YPV8SgsCIoaazMeILfjzbn9gsdRgKMoct fBqA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lk4-20020a17090b33c400b002475696c010si17304318pjb.129.2023.05.04.07.00.54; Thu, 04 May 2023 07:01:11 -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 S231261AbjEDNrz (ORCPT + 99 others); Thu, 4 May 2023 09:47:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbjEDNrl (ORCPT ); Thu, 4 May 2023 09:47:41 -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 AFBE57A99 for ; Thu, 4 May 2023 06:47:39 -0700 (PDT) Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1puZIW-0004SX-OF; Thu, 04 May 2023 15:47:04 +0200 From: Marco Felsch Date: Thu, 04 May 2023 15:46:53 +0200 Subject: [PATCH v2 4/4] arm64: dts: imx8mp-evk: add dual-role usb port1 support MIME-Version: 1.0 Message-Id: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-4-3889b1b2050c@pengutronix.de> References: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-0-3889b1b2050c@pengutronix.de> In-Reply-To: <20230504-b4-v6-3-topic-boards-imx8mp-evk-dual-role-usb-v2-0-3889b1b2050c@pengutronix.de> To: andreas@fatal.se, jun.li@nxp.com, Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Heikki Krogerus , Guenter Roeck , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marco Felsch X-Mailer: b4 0.12.1 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::28 X-SA-Exim-Mail-From: m.felsch@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=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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764972425968872260?= X-GMAIL-MSGID: =?utf-8?q?1764972425968872260?= 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. Below is the test results of a basic usbgadget-ethernet test using by iperf3. Accepted connection from 192.168.60.1, port 48172 [ 5] local 192.168.60.2 port 5201 connected to 192.168.60.1 port 48176 [ ID] Interval Transfer Bitrate [ 5] 0.00-1.00 sec 101 MBytes 850 Mbits/sec [ 5] 1.00-2.00 sec 105 MBytes 883 Mbits/sec [ 5] 2.00-3.00 sec 105 MBytes 885 Mbits/sec ... - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate [ 5] 0.00-100.04 sec 10.3 GBytes 882 Mbits/sec receiver Accepted connection from 192.168.60.1, port 42104 [ 5] local 192.168.60.2 port 5201 connected to 192.168.60.1 port 42110 [ ID] Interval Transfer Bitrate Retr Cwnd [ 5] 0.00-1.00 sec 110 MBytes 925 Mbits/sec 0 540 KBytes [ 5] 1.00-2.00 sec 112 MBytes 938 Mbits/sec 0 566 KBytes [ 5] 2.00-3.00 sec 115 MBytes 969 Mbits/sec 0 566 KBytes ... - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval Transfer Bitrate Retr [ 5] 0.00-37.00 sec 4.27 GBytes 990 Mbits/sec 0 sender Signed-off-by: Marco Felsch --- arch/arm64/boot/dts/freescale/imx8mp-evk.dts | 88 ++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts index 7816853162b3..20c3c41d6209 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp-evk.dts +++ b/arch/arm64/boot/dts/freescale/imx8mp-evk.dts @@ -5,7 +5,9 @@ /dts-v1/; +#include #include +#include #include "imx8mp.dtsi" / { @@ -83,6 +85,22 @@ reg_usdhc2_vmmc: regulator-usdhc2 { gpio = <&gpio2 19 GPIO_ACTIVE_HIGH>; enable-active-high; }; + + usb-ss-mux { + compatible = "gpio-ss-mux"; + enable-gpios = <&gpio2 20 GPIO_ACTIVE_LOW>; + select-gpios = <&gpio4 20 GPIO_ACTIVE_HIGH>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb_ss_mux>; + + orientation-switch; + + port { + usb_ss_mux: endpoint { + remote-endpoint = <&usb_con_ss_mux>; + }; + }; + }; }; &flexspi { @@ -336,6 +354,40 @@ &i2c2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2>; status = "okay"; + + tcpc@50 { + compatible = "nxp,ptn5110"; + reg = <0x50>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_tcpc>; + interrupt-parent = <&gpio4>; + interrupts = <19 IRQ_TYPE_LEVEL_LOW>; + + connector { + compatible = "usb-c-connector"; + label = "USB-C"; + power-role = "dual"; + data-role = "dual"; + try-power-role = "sink"; + source-pdos = ; + sink-pdos = ; + op-sink-microwatt = <15000000>; + self-powered; + + port { + usb_con_ss_mux: endpoint { + remote-endpoint = <&usb_ss_mux>; + }; + }; + }; + + port { + usb_con_ss: endpoint { + remote-endpoint = <&usb_dwc3_0_drd>; + }; + }; + }; }; &i2c3 { @@ -442,14 +494,37 @@ &uart2 { status = "okay"; }; +&usb3_phy0 { + status = "okay"; +}; + &usb3_phy1 { status = "okay"; }; +&usb3_0 { + status = "okay"; +}; + &usb3_1 { status = "okay"; }; +&usb_dwc3_0 { + dr_mode = "otg"; + hnp-disable; + srp-disable; + adp-disable; + usb-role-switch; + status = "okay"; + + port { + usb_dwc3_0_drd: endpoint { + remote-endpoint = <&usb_con_ss>; + }; + }; +}; + &usb_dwc3_1 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_usb1_vbus>; @@ -659,6 +734,12 @@ MX8MP_IOMUXC_SD2_RESET_B__GPIO2_IO19 0x40 >; }; + pinctrl_tcpc: tcpcgrp { + fsl,pins = < + MX8MP_IOMUXC_SAI1_TXD7__GPIO4_IO19 0x1e0 + >; + }; + pinctrl_uart1: uart1grp { fsl,pins = < MX8MP_IOMUXC_UART1_RXD__UART1_DCE_RX 0x140 @@ -690,6 +771,13 @@ MX8MP_IOMUXC_ECSPI1_MISO__UART3_DCE_CTS 0x140 >; }; + pinctrl_usb_ss_mux: usbssmuxgrp { + fsl,pins = < + MX8MP_IOMUXC_SD2_WP__GPIO2_IO20 0x104 + MX8MP_IOMUXC_SAI1_MCLK__GPIO4_IO20 0x144 + >; + }; + pinctrl_usdhc2: usdhc2grp { fsl,pins = < MX8MP_IOMUXC_SD2_CLK__USDHC2_CLK 0x190