From patchwork Fri Jan 26 17:27:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Farouk Bouabid X-Patchwork-Id: 766788 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2072.outbound.protection.outlook.com [40.107.7.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D575620DD7; Fri, 26 Jan 2024 17:28:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.7.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706290129; cv=fail; b=Y83FwdEAoHKsZeIl3WP/74e1mez+cqBTXdknPGjnNDlWyXdxrf0LbJGOeRZ3lZ0sNTo6kh5jmaj4EDj5BLUfc1FWg0SSzjzlrZ/covKzTNjRZXNBdRiISPavyid2wrbegsakeuL5DAGmieiljqy3GheK2iaia+77BI++lIrVEWg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706290129; c=relaxed/simple; bh=SlcPbM60WlKzEnTHdZgAM18nuAzy5MTJKsX4lGwwL0Y=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=SxAkrStz9oRbl3xU5MQ7X5j6Dx/WE4hlHmhBcYq0928jUIwj8v3C5QJfXBm9ldPHt6QZ4W6sIojcttlO78ZoaW/iErK9vZobKg/IZYubMnSZTlNqHpsVkAPhVS3MKc+pczI2X9tsg2RDm8DPmf3c+smpCQLpjf+MhVgtSGH21Dg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=theobroma-systems.com; spf=pass smtp.mailfrom=theobroma-systems.com; dkim=pass (2048-bit key) header.d=theobroma-systems.com header.i=@theobroma-systems.com header.b=KZu1LqGh; arc=fail smtp.client-ip=40.107.7.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=theobroma-systems.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=theobroma-systems.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=theobroma-systems.com header.i=@theobroma-systems.com header.b="KZu1LqGh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c4PJfOL8syYwVaOOtf90ddGCyWx06lP0du2T2BtffzeQLJFqFv1ElEOkyd1BTlSVkrt9VTrNRKYOZDn0H4s/0g+VHHgQsn0+C2wxTASvEapm/2CuXG1OCAc2lOWyJHTU5Y42DWhL2JelPq+JY6jdQsywUSuTwV1x2S4pH0Vl2i9i9CgExe6JYhFG5eqAt3tHQlwa+UQYpA6K1f975oFa0ItxlW1NepevFl89xPOxm8VxB4E/X8q65AlwlPPjEPcR7loIpF9mUGQ6/9/fuzzYXE1LmOej518YQOdTVbhvojsSwQAuADeNkMTIw9efoNEwLdFi8mWZT+Y1RFH8t2kP8g== 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=dh9xD3qkAnT4zDfH45UENOftyY6lM3S9XnELbSMrfDE=; b=lxyP8SMaStnFyGAMjsn8ADQP6VQeo5gbYeYXYVcEX1umtLnqU7CRHOmlxvA4q9/ZPPGlN8xQTHGzgDtNSvp7Lfucf2o6PIWkOG6ZpY+qcR74fZJcmWnRBgge+hR33bgp52sY+qVoY4O+UBzlGSIbExYgb1/Q4FJEfHizj6g8uSbSrIecu5Dh7V7c5JSfT1tqRsFazzjeRHzABossXd8GEfhkASLsLzFbY8iuAsG9TZ45gO2xmexDopNeU/XvQaIpgDCmyKc35XHH5sAndlIiqcWuNuj/nm/5Mv4SjOfO0tWU/KCiu6AGPPHsIm+s4nVZH/OUwYXMh6bTxeBGsLgTzA== 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=dh9xD3qkAnT4zDfH45UENOftyY6lM3S9XnELbSMrfDE=; b=KZu1LqGh8+qInNNL81pOkUxVMksZ9nX09qMBDPyQXQ8p3/YYhuovCNEtNiCe7hXdleNtq3DGoYgK0BsFXG0JwxLOqoCdQ/XKBfDgpNeQZqRw66QvB0NAQtWtBkwBYaBCunoOgz4KI99hSaxAazzY37n2O6521Jk6S+1adANEp8Fra6P+/WHod+iaNh9+Gn83KybYwI3//jzuP3FsqUwHsDDafuEkQ0+rtxaLYhzf/ERYeCzSfe27AsPwFXOTPDPAGvJmJL6hFL/JmaswQLIS8bsN0DsqtWkdKvKaop2IFEzIDIz23gKtGF43kjNMrHCbaw45GYXGGc52MzIM0F+fhw== 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 DB9PR04MB9820.eurprd04.prod.outlook.com (2603:10a6:10:4c3::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.26; Fri, 26 Jan 2024 17:28:37 +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.7228.027; Fri, 26 Jan 2024 17:28:37 +0000 From: Farouk Bouabid Date: Fri, 26 Jan 2024 18:27:46 +0100 Subject: [PATCH v5 5/6] arm64: dts: rockchip: rk3399-puma-haikou: add rs485 support on uart2 Message-Id: <20240126-dev-rx-enable-v5-5-5d934eda05ca@theobroma-systems.com> References: <20240126-dev-rx-enable-v5-0-5d934eda05ca@theobroma-systems.com> In-Reply-To: <20240126-dev-rx-enable-v5-0-5d934eda05ca@theobroma-systems.com> To: Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner Cc: Rob Herring , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, quentin.schulz@theobroma-systems.com, Farouk Bouabid X-Mailer: b4 0.12.3 X-ClientProxiedBy: VE1PR03CA0003.eurprd03.prod.outlook.com (2603:10a6:802:a0::15) To VE1PR04MB6382.eurprd04.prod.outlook.com (2603:10a6:803:122::31) Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6382:EE_|DB9PR04MB9820:EE_ X-MS-Office365-Filtering-Correlation-Id: 35e969dc-7779-449f-0453-08dc1e943a75 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yhiJ4mEDdHH0FL1sWUhWScgkQtBBT3jR/OCLENTIPV8ofMEk7arVnUeVnulNkLjMPNsV5rB3f/mEV4Vu5I9+MdXa/mPscQJpd6eC/XsiSuQJoQx6tTcmqnud3QASjfq35SgVcFbrlZYSFQv/uVxiQ1RzrZSGgq8G4yu9AVDg2CSABcUi5+uNtyBsYsvluxE7dUGt76S/5W07xzhqeIDWMQwWZJw1stjqbBEhWtF1nzEzAIsN5Ut2svHExnLzFS6vWW90XkkDNLmwl8BDQfJaVIgT72OcmwTLIOi/tYd3OlbxEYzb1/5VkreONFg1khSEhL8Y+Y23lRso+oEXgHL1AEIRlbzjkFmNrxMp868ZjBQi+VovCBM5zdg2AK7oJLJQY/l+tgGLNRRWKmjKEJN9BdjrUOcYZW90pIT/TMAny1WXSTOsfbzQd5TrVr9ovzVVTILf07pHn2nzuFjW0CqVXFHcDliFVhPyIvRQeqv7YiRUpo7W01rM+MNIR6cn6XgK+w1CPA6NH95myzFnrC2GUEJVOOYZx+8YbSSUozfPF1p5an7vFNs1Gpw1H/x6PRHKHyfazMZC5pILMC9EfFSga+tCoLeHc5Xfkw6B+M1Y9BU= 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)(346002)(39850400004)(136003)(376002)(366004)(396003)(230922051799003)(64100799003)(186009)(1800799012)(451199024)(36756003)(478600001)(8676002)(4326008)(7416002)(8936002)(66556008)(54906003)(5660300002)(6486002)(44832011)(66476007)(316002)(2906002)(110136005)(66946007)(86362001)(6666004)(38350700005)(52116002)(6512007)(38100700002)(83380400001)(6506007)(2616005)(41300700001)(26005)(107886003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?+iea5wYjl13hsEWp71Xq8ShTAiNB?= =?utf-8?q?0thooXwGqyzx9se00lp5ocfJnnb9ql5qdeNH6I2C220HXZgLfk6g+hH+u6ASIECHL?= =?utf-8?q?MonqsMBStrkDit4pWH+FroUz14E858ATNSU44wRllr/y/eiB4Q31D53TnE48Jpb5i?= =?utf-8?q?xf8hLAk5xNUPYyPOqau5e7vNOZUBmi751aWPI+k1TDJouEMDCBFgM27usFCqTJv3+?= =?utf-8?q?Xh8AIosFi06gMTBTToVHvo2mh0A0JIBRd5Z223C3McfKZlRkkppiSOO+8k2dvmJBf?= =?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2eZzLktpbomX2liUYqmOc9aWQWBGbcYzzi4txw/tUerGYbGhGzPs3pDJyp?= =?utf-8?q?/VMVe29WFLsWwD06o9saK8rCxioNynQWnRqIy7t1ab7jhTmWppszoVOBwvu5CGVOl?= =?utf-8?q?y/kn+Ev/ys5WMJC0Cmyg5Qm9Z4OwrlaIj/akXgQvc9HN17SRg2CSRDjRLcHd5Iml5?= =?utf-8?q?GLjj6J5AdyBixTHrZ+jVFOmDQJ0KcApVybBy5Ckul1Kaj6G2m7PKnxP2x+QXUqgJV?= =?utf-8?q?O+GZTm1g1G2WxVBCEILMsD58CBvmpJcUq/lvJm5tEfikJmeRTiEHj3qBTl5HsplY/?= =?utf-8?q?x8PaI63Z5ABLKq0CzFgIE/olC0h9vjZoH/8INxbrDJ0JqgYdKjEZXloFe1oA+aNGp?= =?utf-8?q?abEnCZDJR4Uv24Zzxe4UxX8zUKOCUL+cwU0jgurXmqBhszYm56NHJ3M=3D?= X-OriginatorOrg: theobroma-systems.com X-MS-Exchange-CrossTenant-Network-Message-Id: 35e969dc-7779-449f-0453-08dc1e943a75 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6382.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 17:28:36.5372 (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: G/UjRLORkzuuOoS9afUVC8Pwrv4yTWeJhyppC/9XsqRYFs3hwy1pG+H3JiGWrYOVCI+yGxQbyWPxIR2kV1cRjZlzEpW9zM61p/dTWE5Iy8NSvVOGkPLkQnS0FTMQckPw X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB9820 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 uart2 using ioctl, DE/RE are both connected to GPIO2_C3 which is the RTS signal for uart0. Which means GPIO2_C3 is implemented as rs485 rx-enable gpio. In full-duplex mode (em485 is disabled), DE is connected to GPIO2_C3 and RE is grounded (enabled). This requires rx-enable gpio to be inactive to enable DE as well. Signed-off-by: Farouk Bouabid --- arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts | 4 +++- 1 file changed, 3 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..576024c745ed 100644 --- a/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts +++ b/arch/arm64/boot/dts/rockchip/rk3399-puma-haikou.dts @@ -273,11 +273,13 @@ &u2phy0_host { &uart0 { pinctrl-names = "default"; - pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; + pinctrl-0 = <&uart0_xfer>; status = "okay"; }; &uart2 { + rs485-rx-enable-gpios = <&gpio2 RK_PC3 GPIO_ACTIVE_LOW>; + rs485-rx-enable-inactive-when-rs485-disabled; status = "okay"; };