From patchwork Mon Jun 17 07:11:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacobe Zang X-Patchwork-Id: 13700262 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 10DD4C27C77 for ; Mon, 17 Jun 2024 07:12:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:References:In-Reply-To:Message-Id:Date:Subject:Cc: To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oZ0PjwTt+XVTAG30Lrlbaz2psNI9OBOx0/bFuNlSJpY=; b=bqpK8eR0iYnospshb+lWqe0lrh Qa2FdOYRDQ3C6thzMR6OJEXW8yvSCdE/IdMW6+C7Uijpe6M7tflfkTU/gNId6dN5f99JH3OJraz79 f1lsXjx1pKjR3MIII11ZYKIRH9NbKfKa0kKzVmOohM1zYs7YVhtR1sDbxlYj50XhP1XEwrwHt/lNW 7uJQzs6GZKwsB2r9aYl+402eOWGS/tK/IYJ3LIVd9XQ8mtTmTj+PAterfR+0TwTJstxqdObuOSphh mowghSDAxJK1UOAco/uFin97A7JI8NuMkiBxUMW2xP/nStZxHbf28Zd7crbifZgax1nDpk+/Ub49/ i5i391EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJ6X1-00000009YV2-1DBn; Mon, 17 Jun 2024 07:11:59 +0000 Received: from mail-tyzapc01on20701.outbound.protection.outlook.com ([2a01:111:f403:2011::701] helo=APC01-TYZ-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJ6Wn-00000009YN5-0mSL; Mon, 17 Jun 2024 07:11:47 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L2LIANA/mwHZP7Hdcz4imGlxPRZF8CW0grNC5BURdJcDF7JJ06dPHpNPkh6j9vEGHGG84wkXJNZDgWWy+w9pd/SsDKlsJ4Q8PcdToLBjzFYKVHmchC8yKed8WJNuqzSDZ71xCuhjek8GMLyUZm+xeX655EWRNpMjZNlWfgWNw4142Pm1AuftFwbUMtXteXM1kcZj4Twgm5Z2w7uDFuM04By3UqM8jFIi0hg60AvRHIwkDl+UpBoZNWnFS8F5gQKkcY8oVwbPdZlZ63TWTEyuuqNp0sQ6O7ppGZpYibQd4Dsv2iLLOT6XKxxrmbVJDZoubHXpMQsFutqhxNRBje0Wew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oZ0PjwTt+XVTAG30Lrlbaz2psNI9OBOx0/bFuNlSJpY=; b=krgpVyzvmP9T2dNUFr5X8OUC/B2aBV3kAwjO6C+2y8uTqSw6GBa1k5I7UCztd00P3g0yA1a627/GdF6hSyL7eHSuMWDDRMuoSSnFJmu+cW5FHlxo8rr04uaFNU5FdJcXHaa1Q2cXrciGbcQxZoEBVofKi56HSaewVD8+NRm+ua91Uo9Gv3BsGmYNv2CwL5gK85UHYtemg+U3AvqOH+9MmC98Hda5dDWB0uk0WZ9FbLYakoik59vHKAUf5TZy0PJIjo3OeejmD1kPzUk2BxR6884+fZblzHi6sbfwKDF7l2LWRrXXemv8BWT3gZsbEUYKli8pc5+cWFCEPpFk4Aho0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wesion.com; dmarc=pass action=none header.from=wesion.com; dkim=pass header.d=wesion.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wesion.com; Received: from TYZPR03MB7001.apcprd03.prod.outlook.com (2603:1096:400:26a::14) by SEYPR03MB7968.apcprd03.prod.outlook.com (2603:1096:101:168::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7677.30; Mon, 17 Jun 2024 07:11:26 +0000 Received: from TYZPR03MB7001.apcprd03.prod.outlook.com ([fe80::78dd:5e68:1a9c:36c0]) by TYZPR03MB7001.apcprd03.prod.outlook.com ([fe80::78dd:5e68:1a9c:36c0%6]) with mapi id 15.20.7677.029; Mon, 17 Jun 2024 07:11:25 +0000 From: Jacobe Zang To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, heiko@sntech.de Cc: nick@khadas.com, efectn@protonmail.com, jagan@edgeble.ai, dsimic@manjaro.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jacobe Zang Subject: [PATCH v2 1/5] arm64: dts: rockchip: Add USB-C to Khadas Edge 2 Date: Mon, 17 Jun 2024 15:11:08 +0800 Message-Id: <20240617071112.3133101-2-jacobe.zang@wesion.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240617071112.3133101-1-jacobe.zang@wesion.com> References: <20240617071112.3133101-1-jacobe.zang@wesion.com> X-ClientProxiedBy: SI2PR06CA0017.apcprd06.prod.outlook.com (2603:1096:4:186::15) To TYZPR03MB7001.apcprd03.prod.outlook.com (2603:1096:400:26a::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR03MB7001:EE_|SEYPR03MB7968:EE_ X-MS-Office365-Filtering-Correlation-Id: d09ba50a-1ef2-4fa4-c3c5-08dc8e9cb33f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230037|1800799021|52116011|376011|7416011|366013|38350700011; X-Microsoft-Antispam-Message-Info: 1IgbeqXKK6vgBqToJYCDV6zVQ1F2Q+DD59w2UvEv8DG57TP5chM1hEy2MnNmJ0eHRUdDYwxZHIfN3AtVFSPIpV4w8Sef8H7n9TJbh8eRMKNrjfTLqWiWON2XARlvpjKikDVhwJWp2kNn/YPTrUtnsIQLRBUBvcJCyJlBzZlpf4YTY6OAqQKKXXlrr254Qoe8VR0MtyOa+9hUXjtJg0vHoEA0EgzfFETTkbyv6MvkRolsoAUl7VM/jqGs+kH8G4VqH8o/j9r3k9TsapUqsCjAhHaPvl26z4ZayLOxMYsQCtTQKGVkF2r2tpAB9e4waDKqSkNSviqfQOaLJ+QThgUrGpVI5dX+af0iijIsFgd9KqvhTkVMhifpSbBDSnX+1usCDZ1yNPZj2AuUIZcT4q7voSIvWNpFAbMjaWtKPlNfVCGZChhBFuU/X6BX/tp7SVxK3HKjCaHjDHuT24oZ/CsQhbKKN7Qs7VcKhJW4dbqtHXKS+ssIZbVGeYN54rW8I97/NxlYLxtFhOVLwVSQTc9d1Ahv3gsw1CmlTPV5+5VgzGNJjHE/2B+G58O0atwn1/xQBaaD8tppLl7IWBuwf4K6DQIofdebY0lwGbODdRiBTRLR0cpDL9x704Dsvw0xh0tOJ6JXB9nc3YpMSWPTerOyn/16P4UPW9SJFFRkpx/6H/HwYSMjGtTHjJGfAQyGB70AB44srKQysJLZoXaodNjPe9qbwAMbwxOtzf9ke6Uk0RpWjke8GbMvmjy1jUdLLkCOcRxLqdt1Ui+31vGV6BpU2tCQpgKPa3YJvKz7B2gvabarnGGm/WTWn6TtDbX7JIuIoaqhNAWGMlsDtkBw4b2ZCVShP3K5X60YJBi3comDAIcHXoEbwJP9C6mKck27xURq/oZc7PTnTHh919lvlfkWsBv6Ns53MgjNNBgl1mfLt0TJRhUmxnMJ4M1atLmQeb5w4DgHzaLkFz+wtEiQmH/8l1pfUM5esU/qI4kvjFTTmYad7/VPAzRw+yWsu0kyCYWoz4ABDhQcR0SFx77PUuv5UURz7gQA4vlmL0d2TsjDfcF4rFh+nBJLeyGVfdsGoGsUm7++3lSG+SJByomTYfQBVRa855t40osjsAdbDqu0dy9Um9wfwzytto8Si30s1AXIqMUhNjEfy4im/PLNrRcIyZmsNPVfXh1rvw7Zt+mKxhuiapbQ3NtRbsXlp1WfDrFkNpLzr4BjcNPtsLKMi8n77yTf/oU8kvkXP4ksZkzbsHDZ5tPQJb9n2W73BuSP7H3U9G6Lm7UxzcIFj1sybyP/n/vyw6KIk7VNyGX0e1zeKPnEzX97aBkk8J3dMlTLmovMHJ02IU2lWCx+OAl2+CGIeYgYhRADOG9sub03wh5jVmI= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR03MB7001.apcprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230037)(1800799021)(52116011)(376011)(7416011)(366013)(38350700011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H/xH6VCPmSD0+1HbcOVU7FQA/3msL1Vr165boIJmU51XUB6zPnPSRQVURxauTeTx8mKFAz7GGVcoXRmh6f0ktLtJCrJjzyiwhh2s3B5EgsbJPdTDeDtqH6QEqwVu8F//Ax/kbRqY7U/7+muJZEdkG2L28B9yUeBbQzH0/rHEpJLwAu9y6/EvCiISbnwnNzHmr9+N0rD0Vy55hkE+AWPwpc7uQB4VOWWyEuCfxjk5tjM8ZwiNWO9vR0tHVyA422p11lWn01hoJf8OOkoeoDe3XhESOd8oDp1AFE7NdXPRUGJTs5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IsZjlbCvO5Nx1tFGHbR+SNibhpti7lxIrjJBT+JBw7JuAW4QhwRvf17pZyEoUWXQ0sHWsa8b9AYmr45PxKUE2VZ4+UFolcUrJNJy6H0yUSqxr1uUNdO6kJ3LEdlqwqHUNfIu6YVojtQM1D3SvbIp1uCTWTD7zktskrOHawKvTPE9vFQwCKg+XmCcQipBqduU/nVU466gXRYLX+ZKO26W6gnZWVj2ZGns4LgZpnVhFJUYDZJZram8XXdBrpmp/ekQsjlixA4kyQ== X-OriginatorOrg: wesion.com X-MS-Exchange-CrossTenant-Network-Message-Id: d09ba50a-1ef2-4fa4-c3c5-08dc8e9cb33f X-MS-Exchange-CrossTenant-AuthSource: TYZPR03MB7001.apcprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2024 07:11:25.4478 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 2dc3bd76-7ac2-4780-a5b7-6c6cc6b5af9b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: CyhubkYcd4JH5D2LzOFI2OoyNqFggKfscppoFO25l/S8k919Qd9hrZ9fF8gi3XHv5eFe2h/sjJgXSvrPwgkF/w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR03MB7968 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240617_001145_267192_44DF5094 X-CRM114-Status: GOOD ( 10.09 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Khadas Edge 2 has 2x Type-C port. One just supports PD and controlled by MCU. The other one supports PD, DP Alt mode and DRD. This commit adds support for DRD. Signed-off-by: Jacobe Zang --- .../dts/rockchip/rk3588s-khadas-edge2.dts | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts index dbddfc3bb4641..8c0bc675690dd 100644 --- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts +++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts @@ -6,6 +6,7 @@ #include #include #include +#include #include "rk3588s.dtsi" / { @@ -112,6 +113,18 @@ vcc5v0_sys: vcc5v0-sys-regulator { regulator-max-microvolt = <5000000>; }; + vbus5v0_typec: vbus5v0-typec-regulator { + compatible = "regulator-fixed"; + regulator-name = "vbus5v0_typec"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + enable-active-high; + gpio = <&gpio3 RK_PA4 GPIO_ACTIVE_HIGH>; + vin-supply = <&vcc5v0_sys>; + pinctrl-names = "default"; + pinctrl-0 = <&typec5v_pwren>; + }; + vcc_1v1_nldo_s3: vcc-1v1-nldo-s3-regulator { compatible = "regulator-fixed"; regulator-name = "vcc_1v1_nldo_s3"; @@ -224,6 +237,56 @@ regulator-state-mem { &i2c2 { status = "okay"; + usbc0: usb-typec@22 { + compatible = "fcs,fusb302"; + reg = <0x22>; + interrupt-parent = <&gpio1>; + interrupts = ; + pinctrl-names = "default"; + pinctrl-0 = <&usbc0_int>; + vbus-supply = <&vbus5v0_typec>; + status = "okay"; + + usb_con: connector { + compatible = "usb-c-connector"; + label = "USB-C"; + data-role = "dual"; + power-role = "dual"; + try-power-role = "source"; + op-sink-microwatt = <1000000>; + sink-pdos = ; + source-pdos = ; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + usbc0_orien_sw: endpoint { + remote-endpoint = <&usbdp_phy0_orientation_switch>; + }; + }; + + port@1 { + reg = <1>; + usbc0_role_sw: endpoint { + remote-endpoint = <&dwc3_0_role_switch>; + }; + }; + + port@2 { + reg = <2>; + dp_altmode_mux: endpoint { + remote-endpoint = <&usbdp_phy0_dp_altmode_mux>; + }; + }; + }; + }; + }; + hym8563: rtc@51 { compatible = "haoyu,hym8563"; reg = <0x51>; @@ -256,6 +319,16 @@ vcc5v0_host_en: vcc5v0-host-en { }; }; + usb-typec { + usbc0_int: usbc0-int { + rockchip,pins = <1 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>; + }; + + typec5v_pwren: typec5v-pwren { + rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; + }; + }; + ir-receiver { ir_receiver_pin: ir-receiver-pin { rockchip,pins = <1 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>; @@ -681,6 +754,14 @@ &uart9 { status = "okay"; }; +&u2phy0 { + status = "okay"; +}; + +&u2phy0_otg { + status = "okay"; +}; + &u2phy2 { status = "okay"; }; @@ -707,6 +788,43 @@ &usb_host0_ohci { status = "okay"; }; +&usbdp_phy0 { + orientation-switch; + mode-switch; + sbu1-dc-gpios = <&gpio4 RK_PA0 GPIO_ACTIVE_HIGH>; + sbu2-dc-gpios = <&gpio4 RK_PA1 GPIO_ACTIVE_HIGH>; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + + usbdp_phy0_orientation_switch: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_orien_sw>; + }; + + usbdp_phy0_dp_altmode_mux: endpoint@1 { + reg = <1>; + remote-endpoint = <&dp_altmode_mux>; + }; + }; +}; + +&usb_host0_xhci { + usb-role-switch; + status = "okay"; + + port { + #address-cells = <1>; + #size-cells = <0>; + dwc3_0_role_switch: endpoint@0 { + reg = <0>; + remote-endpoint = <&usbc0_role_sw>; + }; + }; +}; + &usb_host1_ehci { status = "okay"; };