From patchwork Thu Feb 8 15:39:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Farouk Bouabid X-Patchwork-Id: 13549970 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 60DC0C48260 for ; Thu, 8 Feb 2024 15:41:36 +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:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=m3tqpKjUmz/3ecFr7De6lDiQg+Yqml8vF8nVIvvjjeE=; b=kjjIlmQ8BlBCa4DOQNywO2GW2b A3JplJ6m6Uvy0soHcIPKX6qNV9bKeQY0c3jLR+xAaPmwD+5/JbNTbqAsqVXrAlQ3psZnEt1oIVa6a 6uilqLzuwRHjEVm7v1/QUtqqxSLSl8+VKaupeUI+ytG6aSh0q0grH6qseuOzPTLgAROKMW0Z6LeUd HdfDbkmTeoZpzJL4Eh4pHzZ9OhWqm4VIr6x8LmDW83OzhPtL4GX3MnO+MRTT2ujRoDxefRz44lu6p P9v14O0JHRtJpg/2b+sLvPGib7w3S6ZQYLWa7IhYLgbMxo1wP7QhWsC4rfNRi5QyfOE/lgtHIH7Pe /gJWMgaQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rY6Wj-0000000EBox-2Irr; Thu, 08 Feb 2024 15:41:25 +0000 Received: from mail-he1eur04on20700.outbound.protection.outlook.com ([2a01:111:f403:260f::700] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rY6Wg-0000000EBl5-3790; Thu, 08 Feb 2024 15:41:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BSMvHQCIXTFGDIYe6InldKYaKmb9fkTFXefA0UdBnI17DREi1Iw3HAvNpfsLqV5HGmOuQgtCnAX7OnFZ5V9W/7LwmUAjxeiWqzmBqrICy2tTMqUaZVjyd8TLtBUzqdq4WHPSR9QU5aofCnE5RXFeaz6iTeLURHE2H/+BaFHFV/3NDdc/cNdM23sesk+FDRF1LExgXVD+oEEruj4UREJEdZP0C6KpEKvp1zJ7YTA0DuH4ARQXgvzoUplVd/grmdU1xVdIa6v5ahmm30GxOOCYqdS6ZxunaMjB9IoIgk+xUfHtop9IemLhXg6xiZp9jDFtbGZfJPUGOX/VGtH9ge9qSw== 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=OzXnL9EaqOhySjspSDKiz3Z7Qph5Q6lMd4LriNQ2V4M=; b=eB94oncInzXhzpqEavnv4B6Py8VqPUbIMezJNwh0OclcIsOpSuMkuxd8TLA3/rU+7T5MIEWebfWO/kyFCheN3cGeJOfrAwX35DHdEmwkeG0O6r3qhImfXvIT50T5pBxJttschvywA/aRju5NmdzaDnxwVKUXWpyFT6/v8HdmNBn2PLNRqgpMdzMu/da3wgA26OcHwVfHBLrpbJTUQlAemCPLMSY7riH73Q91Kluq14RIL04d8XVD0walzGyaZZ9sCeGbpVBDGkQX/dULMY8tT7tepbtpVX1TySqrfn1CMEJe1hIk0g2Isv10smjFb41s86PcvzRVE+w1iN5sn3do2A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=theobroma-systems.com; dmarc=pass action=none header.from=theobroma-systems.com; dkim=pass header.d=theobroma-systems.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=theobroma-systems.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OzXnL9EaqOhySjspSDKiz3Z7Qph5Q6lMd4LriNQ2V4M=; b=jLErUgXVmAsZJWzgI5D/RuafZX0iKrtHe5Ob66ifWCEbKqyV+lD8F+tTi7N4yEVwg1kLdJNbrFqGlTpsDIaZXDdDpNDbQiCWLd0K/F21kiQG9Hobl5oBlNSoIoFvEFZT0sFIIopXw3IPuf+bvf61+34H5Z4C4h8CCOpMvmW0tXaQI0hq/zL0yG13UR9K28uSd7sFa/yIW5ZESKAtVXROjU4rJW8evfsIf+Ihj07b/5Fehj/YfGdGqVJcCpTq02f6CJew9JgDa42nq7SbWMmy77cUUKjCe0LZCpvGJfQWVkRntrd2CWtZcxMIqYE1u2GzZkwfjaob0HvYu4oRZhFuTg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=theobroma-systems.com; Received: from VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) by AS8PR04MB7621.eurprd04.prod.outlook.com (2603:10a6:20b:299::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.39; Thu, 8 Feb 2024 15:41:00 +0000 Received: from VE1PR04MB6382.eurprd04.prod.outlook.com ([fe80::d4b1:cea8:7085:ec50]) by VE1PR04MB6382.eurprd04.prod.outlook.com ([fe80::d4b1:cea8:7085:ec50%4]) with mapi id 15.20.7249.035; Thu, 8 Feb 2024 15:41:00 +0000 From: Farouk Bouabid Date: Thu, 08 Feb 2024 16:39:55 +0100 Subject: [PATCH v6 1/2] arm64: dts: rockchip: rk3399-puma-haikou: add rs485 support on uart2 Message-Id: <20240208-dev-rx-enable-v6-1-39e68e17a339@theobroma-systems.com> References: <20240208-dev-rx-enable-v6-0-39e68e17a339@theobroma-systems.com> In-Reply-To: <20240208-dev-rx-enable-v6-0-39e68e17a339@theobroma-systems.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, quentin.schulz@theobroma-systems.com, Farouk Bouabid X-Mailer: b4 0.12.3 X-ClientProxiedBy: VI1PR06CA0208.eurprd06.prod.outlook.com (2603:10a6:802:2c::29) To VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6382:EE_|AS8PR04MB7621:EE_ X-MS-Office365-Filtering-Correlation-Id: a9a1b9a0-9922-47cf-2fce-08dc28bc591b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ofeklTURX/27lXqLCh+J/1raBQw2srg87Rtn3QrNWZGbr8HSZILt+H6lhyeo5QVIzW2U9qAFBXlGfHbP7lRKVFJDdflTc3CtNRVeoMSvvAwIdufHhZOaDj8KF42DRlat2fS1VtaSeZnU7zCZOHhtjOGIiOuS4T0FCtuXpMkTi1LGWpcvwDXIHbxsrAEET2TWIVoVXX9DwC+YHyndTeJxA7hEO2L3u+A9IEyRFeBwOcYdx9rc4EoXb5D19D+IikMv3HPl8AlWjAqK110EkmlRrfBtjXt2eYzYJpOUAyjucC3hdvHtZqUCUkQtQNEhunUmuYoqjoQWLmTYQxvtQOFDRA6Uzvyp9cW5Ru2WypPqRRd7W6JMpH938ZzjL1rXOtsiNPi1hYVz6NqCYIsdttaCmztvfnZaiMF25a8a8xYuIBPjYtCc8IdrjNkQ0yIKM766NVnReF7tLWt21MMMErklVaXD439L3DF+M26FY855gSRu4hB3bvA6MichE+oEpt1ieyVJLayw/NnHRI+4i5YxuNWfEN4xFsmD7S5Bb9QJMjOz+jY0+c/lLbYOdCq9Iprm3CO2Q9qimqrrJ5YDZpKiU1+t3aPtipE6+BxCUD+4Lnh5J3BTTt5/Fet4bKknro4a X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6382.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(346002)(136003)(39850400004)(396003)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(107886003)(86362001)(2616005)(26005)(6486002)(44832011)(478600001)(5660300002)(2906002)(38350700005)(110136005)(66476007)(66556008)(316002)(66946007)(8936002)(4326008)(36756003)(6512007)(8676002)(6666004)(6506007)(52116002)(38100700002)(41300700001)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?2YRGipNQi/K9qv2lWP/eTPJQSv3C?= =?utf-8?q?fpjTpQXe08loBomXJIGSyWbQWt6XCRQ2F4LJ+thEPWoQIBVhi7dmaJ1RzuHXEZpPR?= =?utf-8?q?Iat+48uvrKz+lnoWlqVR+FScnU0KmEhPGrC7CJ23+c5XtfPgLzC0R2ZJtT8sYP4UY?= =?utf-8?q?M/adlzSDohvjqmf2jtUudPUVOUyn6n18qbqe5cNqeowPOIDIdW/9Bj8m3KWfxM4nW?= =?utf-8?q?qWxWTYRNeoAgB9ArrlfcxO5T9eyCWPG6k3wJajfX32yTz9E5M8xBMtK4f9P9RBn8r?= =?utf-8?q?VPB0tpLRbKTL7efuTAixji28g6p34+We3SHbHfgzjOU4VHiEZe7s/ll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YCON7?= =?utf-8?q?Xrdq5yYVd4doMAQH73C6FBW/2QzZcrQOxaz9uCjxNrIWnOA9+dTgEVsx3trtOzTZl?= =?utf-8?q?NWT0EreIjixzvxSMxEO4KU8OrEJLGLqCGIZcIT7nN3sBo0/KXi+L54HWBz8Fl2Esd?= =?utf-8?q?XDSR/ZV6RXj3YyqV/Xk1Xyl7HfzvUBXDSw17s1Hf0eZNDuvU8PWVdSgzz17PAbkiI?= =?utf-8?q?L1R3cuE81urVrKImNBoYkCxJQXmMsMSefqq27T1L6PQ5mtryW9Q+oI80Ht1BE611v?= =?utf-8?q?mlkP+QeHbIOE6d3g/VlDKpWaLVDU6nHURlu4JPWrZq3WNtxqkDvvBpJ6FzfojxyA5?= =?utf-8?q?icQRlauDhf0FtgwXCcwATENEzTGOLwbUoR58FPFVc+TPSw+XT6i+HFA=3D?= X-OriginatorOrg: theobroma-systems.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9a1b9a0-9922-47cf-2fce-08dc28bc591b X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6382.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2024 15:40:59.4801 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5e0e1b52-21b5-4e7b-83bb-514ec460677e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zGOBUwM7a+bInfRM7tQb3mRZjeWpy7ObxAV3kl0RYjGizA98qAYVwn/mC0GU3ibuqxYSVV3UcaIApM6a24v/jYhSNHn04EXhuXWfDNXs3dm4n4XrRHcdjuF10/txsSWT X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7621 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240208_074122_814089_87C50DF1 X-CRM114-Status: GOOD ( 12.13 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org A hardware switch can set the rs485 transceiver into half or full duplex mode. Switching to the half-duplex mode requires the user to enable em485 on uart5 using ioctl, DE/RE are both connected to GPIO2_C3 which is the RTS signal for uart0. Implement GPIO2_C3 as rts-gpios with RTS_ON_SEND option enabled (default) so that driver mode gets enabled while sending (RTS high) and receiver mode gets enabled while not sending (RTS low). In full-duplex mode (em485 is disabled), DE is connected to GPIO2_C3 and RE is grounded (enabled). Since GPIO2_C3 is implemented as rts-gpios, the driver mode gets enabled whenever we want to send something and RE is not affected (always enabled) in this case by the state of RTS. Signed-off-by: Farouk Bouabid --- arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts index 18a98c4648ea..2c3984a880af 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts @@ -273,11 +273,12 @@ &u2phy0_host { &uart0 { pinctrl-names = "default"; - pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + pinctrl-0 = <&uart0_xfer>; status = "okay"; }; &uart2 { + rts-gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_HIGH>; status = "okay"; }; From patchwork Thu Feb 8 15:39:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Farouk Bouabid X-Patchwork-Id: 13549971 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 710DEC4829C for ; Thu, 8 Feb 2024 15:41:36 +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:MIME-Version:Cc:To:In-Reply-To: References:Message-Id:Subject:Date:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=WCRwwmT3P+Fet15YYk9pMs9vTM+PUfeNPb+zIFsHgtQ=; b=FA59Ep5jGN02+t2Ttei3XR0jEY AXVo3QQKlZNZLcfa1u7Zi/bWbBxeGMERhBdEw1e5p6zZv5wUMW5FhbR7vgawZJAwiLKUu9R9W7bZA /UXzuAtNcWCYmMp0xByHAZ03UXbSpD8ylrsyuNNic56PSV02MuwVH6UKTPgOzrOhTeM3xN+Mhvl9y 4ROE594nobWI+MXRG/VCHWEWyb7/CXAJc6ZUUr0LWK0WFv+XpCxFwW65d+qqyXMVmIimwPW68bs4x B287UXPkmBcX2Wd06V+Znc2vZULZ/IkVqnEyFU1CpsOV1OBBRdk+tsF+TfGUdpIvwfYj5+sgkNELW z+6pBldQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rY6Wo-0000000EBs3-3Oo0; Thu, 08 Feb 2024 15:41:30 +0000 Received: from mail-he1eur04on20700.outbound.protection.outlook.com ([2a01:111:f403:260f::700] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rY6Wl-0000000EBl5-279Y; Thu, 08 Feb 2024 15:41:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=amdTxEO35Ol2fLY/v6EvxXiiOf8iEJFnf+X0S8Pkczq4Bihf48kPEmtuss+p9aWKBnVFdBsra0XnMm0cvei4jgpzbWf57M6KsiEypEYw+gjHxHgkq5aV4vA5FiT26QxiRiKr7qHckt9xvulpC2iLrzwoz8SARlK4eqK+7GW/uF3q8LVlrs7EhO524otTFn7WGTD7Ry8KK4IF84uKojoHLPRSXXjiAgUtdRXsfqfHJ4Aj5JVPoEpLySAuNfK8hZBmylgREGAX7OGC2J8OpG7k1XNsu9ek+Mk8ZhOh09e+iHTxslghtYwFw3wvYb02HCLYln07Mg0UhVdKOY95CObjYw== 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=9E73qvcYPt+w1rq3AgHdWgp3ZIRu84aG3pPkfSbiArU=; b=l5rBnmIJx+o4n/qyIlxzX95xp8G0tT0vwio39JNJxEvRp90rBxtR0qjJnVdtGigndV82vNRSd177E9lSafb06egYcQBc+wqLYveYiqlcEF7FwnB+MdcpyqJxpa7dfdUWDSkxnwbYzqRyf0uc6ZYQbOas/L28KMLcncRNxzX6lQRgCKfvWWUK0aEpZip0udAe+0Ga+ojFoLGk6QY1FWRZESN98HxuI1HKTbfZL0Jw1catmLDhalZlZpLjEnGN/wZJ0sPP/1ZZfCwNld0hyXW3OjRHf9wEJ+Y+ugDlEv7r6IOxeoihnAKLbvgWZ8GrX/+Tpi/IofLFIh3xVzfUWq7GPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=theobroma-systems.com; dmarc=pass action=none header.from=theobroma-systems.com; dkim=pass header.d=theobroma-systems.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=theobroma-systems.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9E73qvcYPt+w1rq3AgHdWgp3ZIRu84aG3pPkfSbiArU=; b=g/HBttYryVByc8G1QirxumJu6NUZNEURJGfSEcPNA+nAiFkZDn6NUFzbcW5KXYmc3C0WShoooTs0M1vQo0KwzThGJVdX775shOPp1oSkSj8+ZfRwWW0JdNBjuUj6vxdDfM9BDuweaaTJRuMRIGyoOul26cVjc3T7hQcSN8XZ7m38JKPYGigJOSKRMs243oys0ItLvIq27cxI3WiI6pd14jd/xe9pooMtoS1VyT780M2yBK6PVRj79oKdWTUFwlKM6M7rfq9zToHe/XDBzzvVRPTlKW/OlLm8+0GkloDIg8PmEscw8WJRLNASp1XnkkGmPXne429S1AjyxQPWg09s1g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=theobroma-systems.com; Received: from VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) by AS8PR04MB7621.eurprd04.prod.outlook.com (2603:10a6:20b:299::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.39; Thu, 8 Feb 2024 15:41:00 +0000 Received: from VE1PR04MB6382.eurprd04.prod.outlook.com ([fe80::d4b1:cea8:7085:ec50]) by VE1PR04MB6382.eurprd04.prod.outlook.com ([fe80::d4b1:cea8:7085:ec50%4]) with mapi id 15.20.7249.035; Thu, 8 Feb 2024 15:41:00 +0000 From: Farouk Bouabid Date: Thu, 08 Feb 2024 16:39:56 +0100 Subject: [PATCH v6 2/2] arm64: dts: rockchip: px30-ringneck-haikou: add rs485 support on uart5 Message-Id: <20240208-dev-rx-enable-v6-2-39e68e17a339@theobroma-systems.com> References: <20240208-dev-rx-enable-v6-0-39e68e17a339@theobroma-systems.com> In-Reply-To: <20240208-dev-rx-enable-v6-0-39e68e17a339@theobroma-systems.com> To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, quentin.schulz@theobroma-systems.com, Farouk Bouabid X-Mailer: b4 0.12.3 X-ClientProxiedBy: VI1PR06CA0208.eurprd06.prod.outlook.com (2603:10a6:802:2c::29) To VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6382:EE_|AS8PR04MB7621:EE_ X-MS-Office365-Filtering-Correlation-Id: 5b44e0cb-4831-4156-a47b-08dc28bc593b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nDKLzK92bQqkAbydubnS1Pue1Mjw3JNk+m7qg4b0KSVFzvZLEk28SZsVg0AtoSkMonkEkpo+NaK/kVGgHGc4BTWXWzGG4wdl1GlrzwOPVo8lhherQ1QOjg6mu/rEITe1gTYEz/g8zLqdIisRoqTQ/kyKs+oEwQNflqFDCuF9XYms1o1RcR/fl6RKnbuEPZPpx4/TDvQ6gCMfbw5+IPAk+8DV0/4MR6d5xRUf9GQ+UKED970v2XIJk0W2v5roqWzjFraDTyG9SADHJ+0UmBL1t0Ax693drHumOI2RZUIYcjDAKJC25HD9UWtQq9heZ2lJCxHHt2QNc2LBoKWXGJoqqpZM0a/YakouF6UNx2N+oEbHxkQDHQuP9TOMlizLW9MVhY7lezCFvpVpKePZ05PaoaAIbs478oFN/UJb13OU0aamHxDJXRP8cHS8Dx8toz+SZTyAKgjEalJqT9zABBQ89BDsEIcFkJf9/CC/OmPzKZweD5E3ttbM4qEhinICnqYJ7TrEgE7kRY5FnhuYLzQWfpA0EexcaTENlPMq/tOOTSRPiY5pqhLZv0ADACAwIJbNsMuUHEGNnrwlNnUOBcswZhZyUreRpsiXg90HtQqSH4Goj/CHqR4yo1e5XQm79Dyj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6382.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(366004)(346002)(136003)(39850400004)(396003)(230922051799003)(451199024)(64100799003)(186009)(1800799012)(107886003)(86362001)(2616005)(26005)(6486002)(44832011)(478600001)(5660300002)(2906002)(38350700005)(110136005)(66476007)(66556008)(316002)(66946007)(8936002)(4326008)(36756003)(6512007)(8676002)(6666004)(6506007)(52116002)(38100700002)(41300700001)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ms/j4bSiczuHWcr8MF6iJY0xJEje?= =?utf-8?q?xgLcD0omsbsvuD146R0sIjFd4RDviyX6C/V+P2wfL0lEgIeJel8V2i3AzU1izX+yi?= =?utf-8?q?H2awpJ6YiNs6aZAYDd9y3NhNjbl0k2aQMTRf5MbwDjHw6I2SwR1am7A3bmi6cdwML?= =?utf-8?q?qG58aw2Sjsm9hVQ9ThIFwKdsjfgUFRnKL5BSLbxxDz/3OIguqmv3bz2KRTVapg060?= =?utf-8?q?sQ+sh0YKMrw6XQaK1134wllihIZDaN4fdgcQZZzoMSjj5bGStPJwUKJlmJOIwbF6e?= =?utf-8?q?LAt1AuNUqrtSQ/2aMakYsOkq3j4ummCvicABVa9SxXgvXEQidYg6oFSSLtJ6Ls0Oc?= =?utf-8?q?PYvBdbM+Vf3bCr2/zjL0y1Y6143H7P9odHr/jRfR10nel2OoNmGTIA3In3N/G+K6t?= =?utf-8?q?10aeHyGBCzIzbRGFgCausywRWkz7rf8+P3m/agW8cKV38Nr3OoLgEZpNfKbts/2vw?= =?utf-8?q?aHMduiP96eRwMBFi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JeZOKetBj3kt3nRt5i2hxJlvhvP6wCKXfZIKXe0UyPk8iDLdG1IoBg9K?= =?utf-8?q?Ktt3HVRaoIH3rDQ8eyiZhBI4a2pcH3Gw30jeT/XQCyOHlVJewZeAmQ59r2lh19dlb?= =?utf-8?q?PvvRfyopYZOr3x4iu7RzOAG3jsgF0nTwucZesBhner/obM0iDGUapMmp7wIjd7CI3?= =?utf-8?q?jFRoxktD5/nRoVH3fxf81gpRLYqevYOCn4YTno1jS/I13++p8/J5MEc=3D?= X-OriginatorOrg: theobroma-systems.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5b44e0cb-4831-4156-a47b-08dc28bc593b X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6382.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2024 15:40:59.6590 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5e0e1b52-21b5-4e7b-83bb-514ec460677e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: PNthGxRdS4RFGHNByN5GvJdptv68quzWJQk3QImw9HfDttKAIT7lE/bhNt8JMXt/6jZdozJ9p9ai3uukSGgh9JdDDKYbRBT+Rll/jcUNtxvj1+l4oZyjw25+zb5EsJaS X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7621 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240208_074127_598887_FE497DF6 X-CRM114-Status: GOOD ( 11.02 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org A hardware switch can set the rs485 transceiver into half or full duplex mode. Switching to the half-duplex mode requires the user to enable em485 on uart5 using ioctl, DE/RE are both connected to GPIO0_B5 which is the RTS signal for uart0. Implement GPIO0_B5 as rts-gpios with RTS_ON_SEND option enabled (default) so that driver mode gets enabled while sending (RTS high) and receiver mode gets enabled while not sending (RTS low). In full-duplex mode (em485 is disabled), DE is connected to GPIO0_B5 and RE is grounded (enabled). Since GPIO0_B5 is implemented as rts-gpios, the driver mode gets enabled whenever we want to send something and RE is not affected (always enabled) in this case by the state of RTS. Signed-off-by: Farouk Bouabid --- arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts b/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts index 16798eb77077..ae398acdcf45 100644 --- a/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts +++ b/arch/arm64/boot/dts/rockchip/px30-ringneck-haikou.dts @@ -227,6 +227,7 @@ &uart0 { &uart5 { pinctrl-0 = <&uart5_xfer>; + rts-gpios = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>; status = "okay"; };