From patchwork Mon Dec 11 09:11:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13486871 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 9996FC10F09 for ; Mon, 11 Dec 2023 09:13:00 +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: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:In-Reply-To:References: List-Owner; bh=/znY7zEtMeWHQV5TIAikbkOaTIKiWJtUUAgbXWXMTUU=; b=UA6wCX4RDoFGki cY4BDfXyk0PKX25SjIm8yWyNlSNccJCCm97isk5o6G1fwsPBh5It0q9lIr4LlfqJPzYQeeBk0Q0QV V7C4BnRIGifN+YtGhUFLr89gifWjCZkwT73lfXVg2ERGTrvTWmmHGKBXwcmo90qcdTCwKR6WT4W/U CiR6Lo9ou3F0890t4AYCG4Chu2duArfAzFUKJBiFVpCNze2+tO7JQkK398AQZBCjadCH+G5i4aVn4 tG5MGKsHKWm5D1TB6tPrNN9kF8LErc/5CLLHv0xrDm40IirzxukSTeISJHON5Va8IUxb7mCDzKLHT ARJ8le8S8iRatfZZg7ZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rCcL0-004Qnn-0X; Mon, 11 Dec 2023 09:12:30 +0000 Received: from mail-mw2nam10on20605.outbound.protection.outlook.com ([2a01:111:f400:7e89::605] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rCcKu-004Qmc-1B for linux-arm-kernel@lists.infradead.org; Mon, 11 Dec 2023 09:12:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mvX47tTaRbSqBbHH11Wcp/4V/gIBTQei1M6nCEkcCuXf+CvQ5kGwFaYtzZhMJPvXMtC00VLH8HVfZdawx3p52BZ8LSqQGAAbkaSVkPLIfrIRqOzbEvzMAbkbmYdODJ6GTW1cim5U55x0doayVrksxMAhXL2eHwmuEdQ6W1/LJqTZLOUOr8J1W0xuTvKZdbLIG9hvgfOroSKL6Iad69G/sCn3WCEZTSfBk4xcCiw5/bNr8pFgCpq6omzcnpdFebJo14u0UV3gJ5QsouPsi1UftGTxu1ZckiKRA3d8SvGlbPsLFClrZBFB+WgKwJqHzne+X3uwceOHg6kPZTyVqVKT+g== 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=3+gKDeWgzW7wZ5y86lT4ZJtdyxIx3WO+aFyhdw+b7NM=; b=Uj7UiRV018ikyXZ4B15ilbyfKoHO7VYoH7zdQTtPA2B+Exb0hwnAS9EmDhWzJ9w/MBWBRo564k+8UuV2DZlYM4TJrjQLAa8IixIsRPXrGG5+HYoji+wfak9dJCInk8wa47sBPMykK66VYH3oxTHK7LTNp+9H0dNZ0adEw0lyN/rcYxt7NKb7ut92ENXfRa4W+8yeEDQjeh43snnOeXw+c3T5N7zOZQtS/4QGVhXm9N9iw4nOtBT56Gk3MN2fCEM1y37/9lFjZ4/Yu9JVZ7EN8syWphW75N/uNKAe1YxwVdLQkWuTG4DeDkP3AueLosAHcAOXEllRTZJdsdgZLtm5YQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linuxfoundation.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3+gKDeWgzW7wZ5y86lT4ZJtdyxIx3WO+aFyhdw+b7NM=; b=wLi5/vFknakoD7laVHoZ6F5hG4jJN3zCjtf1k4KqUBrGm8a41G7f0A9F+RsFK0FFjlfDO4qIIWRLcjZXJA+K3NT9Ii3DDGjHCoavyr//ENgmc4SlpWN5ihVO1L3lSYkRKJ6iOmFzvu9pInX0IKYs9WBK9BdsMYQSLEsYMtpgIdo= Received: from DM6PR13CA0071.namprd13.prod.outlook.com (2603:10b6:5:134::48) by DS0PR12MB8341.namprd12.prod.outlook.com (2603:10b6:8:f8::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Mon, 11 Dec 2023 09:12:18 +0000 Received: from DS3PEPF000099D3.namprd04.prod.outlook.com (2603:10b6:5:134:cafe::95) by DM6PR13CA0071.outlook.office365.com (2603:10b6:5:134::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.21 via Frontend Transport; Mon, 11 Dec 2023 09:12:18 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS3PEPF000099D3.mail.protection.outlook.com (10.167.17.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.18 via Frontend Transport; Mon, 11 Dec 2023 09:12:17 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Mon, 11 Dec 2023 03:12:11 -0600 Received: from xhdsgoud40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.34 via Frontend Transport; Mon, 11 Dec 2023 03:12:07 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V4 0/3] Add rs485 support to uartps driver Date: Mon, 11 Dec 2023 14:41:56 +0530 Message-ID: <20231211091159.58564-1-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D3:EE_|DS0PR12MB8341:EE_ X-MS-Office365-Filtering-Correlation-Id: a462d3ac-a0fb-49f5-fc8f-08dbfa294627 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qo7akERdEPHX7oOMHu4ap8j7T77DP0+/Y3fAee2SaXMFDMxAW2Cwv6q3ex8cJ3tSKhufEuGLTX94vxM41Kxdc2tiADPapshI7uRsVro4hKTaFyXGkUND+6l/kHhDmGq5VJtOw0U80DlsuIN8nEbnLXkboyiHQxt8RTs1ziAhqqIryJrEC05ed1DCd7/98iKdaejL81u0CzgSq9A4gXW4mv16TrWOl+ld3EogM9hlle/GpP68z6aW7G103pwJkey5SdwzevEdNOMU/FQngE+8D9fSe0VCn0+agdtmQLN3/pD33ptYb6NGQ7Lm4/TmP9EfdOEzArvMTeIbm7WoLIFgCkveg2OWfz7ZaIRwhe+tidALX14KyXvWj+W/k/IusyfR9DHgfjEhMdLDrS4DNRO9FJWGDdVh3RBVJU+vPQvMM5XPfoO4Fl6RdF23M9QrSFvnXrOGs7C52ZI98sKEkfyF5/lvcl+qn0s9VE1LqsXupD+gzABxwoKNKJ1SL44GHKJpc/bKagASQ/Kzb3H7yspozAx3dgCfz2Aees6ofApPc9cogYU8319SAkWeyzaQOpbwpA6POjTvBUjWoNsHnEAhwUONXM+Exqg5Bja+gXRE6hB8Jbb0HocHZGh2R9zEF0soSHfMFwoIeMKu8B8huvXsz7Pk+frogDAukv73DhL4GBb8uKR1TaqeB23YdUplGKDPmsBeNA9vYFTIX2c9zFhhGMWHpGydNam+9tqELUYjf0vHnvMfMiTbHFL0PLJsixmAPyFeaDsMN66M8Rf4HfmNMPUQUo6SD4mpUAmF5dp9aP4= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(346002)(376002)(136003)(396003)(39860400002)(230922051799003)(451199024)(1800799012)(82310400011)(186009)(64100799003)(40470700004)(36840700001)(46966006)(40460700003)(426003)(1076003)(26005)(2616005)(336012)(6666004)(36860700001)(83380400001)(47076005)(5660300002)(7416002)(44832011)(41300700001)(2906002)(4326008)(478600001)(8676002)(8936002)(70206006)(70586007)(110136005)(316002)(54906003)(82740400003)(81166007)(86362001)(356005)(36756003)(921008)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Dec 2023 09:12:17.9748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a462d3ac-a0fb-49f5-fc8f-08dbfa294627 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS3PEPF000099D3.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8341 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231211_011224_428418_B212DDF3 X-CRM114-Status: GOOD ( 10.11 ) 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 Add optional gpio property to uartps node to support rs485. Add rs485 support to uartps driver. --- Changes for V2: Modify optional gpio name to xlnx,phy-ctrl-gpios. Update commit description. Add support for RTS, delay_rts_before_send and delay_rts_after_send in RS485 mode. Changes for V3: Modify optional gpio name to rts-gpios. Update commit description. Move cdns_uart_tx_empty function to avoid prototype statement. Remove assignment of struct serial_rs485 to port->rs485 as serial core performs that. Switch to native RTS in non GPIO case. Handle rs485 during stop tx. Remove explicit calls to configure gpio direction and value, as devm_gpiod_get_optional performs that by using GPIOD_OUT_LOW argument. Update implementation to support configuration of GPIO/RTS value based on user configuration of SER_RS485_RTS_ON_SEND and SER_RS485_RTS_AFTER_SEND. Move implementation to start_tx from handle_tx. Changes for V4: Update rts-gpios description. Create separate patch for cdns_uart_tx_empty relocation. Call cdns_rs485_rx_setup() before uart_add_one_port() in probe. Update gpio descriptor name to gpiod_rts. Instead of cdns_rs485_config_gpio_rts_high() and cdns_rs485_config_gpio_rts_low() functions for RTS/GPIO value configuration implement cdns_rts_gpio_enable(). Disable auto rts and call cdns_uart_stop_tx() from cdns_rs485_config. Use timer instead of mdelay for delay_rts_before_send and delay_rts_after_send. Update cdns_uart_set_mctrl to support GPIO/RTS. Manikanta Guntupalli (3): dt-bindings: Add optional gpio property to uartps node to support rs485 tty: serial: uartps: Relocate cdns_uart_tx_empty to facilitate rs485 tty: serial: uartps: Add rs485 support to uartps driver .../devicetree/bindings/serial/cdns,uart.yaml | 5 + drivers/tty/serial/xilinx_uartps.c | 244 ++++++++++++++++-- 2 files changed, 225 insertions(+), 24 deletions(-)