From patchwork Wed Jan 10 11:11:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13516014 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 4176BC47258 for ; Wed, 10 Jan 2024 11:26:58 +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=oO145cXOl+L6Taux/J4Ag3SErOhnl5g7Dbbs6KkbhUA=; b=bnmW7uTzSSaAeW 04aKpTL8/6x2GPGr/tT199UEJUPXhiuqhHvxbFa2MzQHE3+dqoiq5hZwXmq7LBvhTjafKJsBha4s4 vm2I9REeLhxSO2k/wGi6AC925vonsutkOcgQRFbzTICw0ukiXRiNVth3NmyTuO9bDRcZuSbgXBfco FDUorHO//tXKfdF+gFsgOhwMaoKt/p5rVp/AYSAj8AzgKizCFrhawEpZqTJ0ScpEBHWSM/lx9wdxO NvUmp6CabT7PU4moKKUiAVXzy40CylVdnywmFa+9B+H0nBZvzQZvoRJp0YyL4af3jA6YQFX9lspI1 9VUcTqoo/B5SHDmKAEVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rNWj7-00BHNT-25; Wed, 10 Jan 2024 11:26:29 +0000 Received: from mail-bn8nam12on20625.outbound.protection.outlook.com ([2a01:111:f400:fe5b::625] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rNWj4-00BHIb-04 for linux-arm-kernel@lists.infradead.org; Wed, 10 Jan 2024 11:26:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YG5p/mqxzOyeU1bCWqf8fEcygmAwpjzX4u6cDtqa6dk2u+V6HHypjjjaf/v3Rwe7g3an0FewZ5jxs1wqRsoiSv0z4cvSOy5ePb+/Eo8+yiXKlIcWZnzNqUkm53BhmGn6xuDHN0qqPN/UnHDTXvg3SoFbCQv2XDsD38H5+SXLxOqFSiPWXuo1AHo9vs8dC9q/c89vHnH8ypk5RMLvOa+ypofEfe+yARR6E+0hrbhS7CyUVAYvT4LAZfeKcj4o5uN5gSjnn6A9Yw8fKFyZBI0gS7KQBZtkH2a6SoLT7xA3D2gPjcjgAlDKtAdi7KoPoJB5jv81Td5fRIDPjuE/34nJJQ== 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=JtkApiJQ7VPIz+Veqy5BeL0QJwsccGWIlv493zV/cfA=; b=oYmkRVV0TI17K4LB4Hq5PvR+b2wbc5yf5DcvJI2P1GcWWbLC1f9o8nYdldoLs3oHeXn2QEkeEQgQU0AHwnnffle2/xUJ/QbIlEqU3sK+b3B7fFd3+wJJzI1SIWVv33DQCulTIgXOT+J32yRJuUxp3H+sV22rRAZ+HP0MXs5HfWnxXzNp+p/pbAuWbhoZ9WLpqsroKiLZu1Gnkupiu4vGL0ez394Uc5UBl1qDiGLSE3cG5mTehMQfe//Gy4BpfM5uWLk+mDnTcrP6mR/0S2TDRcEJE86X+yuZvNG6bqjscK5cd85guzml6azgcUTxRu0D90xkDzr8WmqIjEwyqeF3iw== 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=JtkApiJQ7VPIz+Veqy5BeL0QJwsccGWIlv493zV/cfA=; b=it8f+H4q3wUyJc79cHaQb7ceefgIoip/qncV9U6LiN0BoekCJxesVVYzvvKm8RP75IOXyEMXRv+WSlROcIFJN7+sAqeSCf7Gno708W+HMyV5T8MueVEZa9T3qt49SGc04CDhQYijkuRUM0FeE7SXkJ5+hqbP/p9EnpMe3ABhTBY= Received: from CY5PR13CA0020.namprd13.prod.outlook.com (2603:10b6:930::28) by MW4PR12MB5666.namprd12.prod.outlook.com (2603:10b6:303:188::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Wed, 10 Jan 2024 11:11:40 +0000 Received: from CY4PEPF0000FCBF.namprd03.prod.outlook.com (2603:10b6:930:0:cafe::3d) by CY5PR13CA0020.outlook.office365.com (2603:10b6:930::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.18 via Frontend Transport; Wed, 10 Jan 2024 11:11:39 +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=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by CY4PEPF0000FCBF.mail.protection.outlook.com (10.167.242.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Wed, 10 Jan 2024 11:11:39 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Wed, 10 Jan 2024 05:11:38 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB08.amd.com (10.181.40.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.32; Wed, 10 Jan 2024 03:11:15 -0800 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; Wed, 10 Jan 2024 05:11:12 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V8 0/3] Add rs485 support to uartps driver Date: Wed, 10 Jan 2024 16:41:04 +0530 Message-ID: <20240110111107.3645284-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: CY4PEPF0000FCBF:EE_|MW4PR12MB5666:EE_ X-MS-Office365-Filtering-Correlation-Id: 74652069-a780-4561-f571-08dc11cceb35 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BqHmhnJGFn4medeMtKkq5AiYBoS5lr70QKRYXPBgmUUtbM74sWNleUTlSJPXJMWzT6ZKM1j5tIkmRFOV6L1hfA+d9AtWkqyiXO+NSkM3Us8qv5qI6Zh02Ri+fQ/LpRqMJJmhQDKqmRy7M46RyotFOLaKwCV2ZUBKAOLvCe4JSt++SzB3O5uWjlZyQ7OFV2gt7DR+bugbiEoOtIiXkpWS0OGgkG7tL7xs+9Re0eYdIahozEOm/e5OMjY2OG79o+iCpSgHnRc+3Gt642EShngsMJnyUEPfxsIsApnUx0+w/5nVU3vc4bfw6YNt1KcT/srn/tG7qmK1w/ZVGjA3nhsS5JTdQzzW5tdirTQuHx9WSwSJm6Qtp7Seg9KXayN6paO4lgnSqGQykRwOsv0XR2zn1LidxOVesxNEHhayth5WkEpYEPZGqV8d86Ht2GMitj2PoLuyv5NCoaZzbDLy6/Yd+9bZOv/n4FVth4tuhLnrRNCqPv/+qodg0/lF5GRb4s0ia0LUskzgkrW+oOQ+iFzQEcoGNnLajiYKIciflACxdW2LiGMZ/8bMTbPgv9xqkP9xBOJj4dOU/Q70QG0DDr+UuvMgQtnXYEYProGY9heOhzCruLULnbWiHZQjSA6L6/JK8eqt1ZL/RPkU2vQQvzOL/eeUV7qY75XzoFcnI1QoTTozs6oQ0QPiuOczRmtR1abKKcnvoPqzDxwnPncbnlCbxPm542th7hfkfCIVKj/BnJvhp1MGdHKqPEJgVrTja7nQOzfINWuUfJ+NB1jpAxPK3otPiViLASLH68rISNktEus= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(346002)(376002)(39860400002)(396003)(230922051799003)(186009)(451199024)(82310400011)(64100799003)(1800799012)(46966006)(36840700001)(40470700004)(83380400001)(921011)(336012)(316002)(2616005)(426003)(26005)(1076003)(82740400003)(36860700001)(47076005)(4326008)(8936002)(8676002)(7416002)(44832011)(5660300002)(54906003)(110136005)(2906002)(6666004)(478600001)(41300700001)(70586007)(70206006)(81166007)(356005)(36756003)(86362001)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 11:11:39.5856 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 74652069-a780-4561-f571-08dc11cceb35 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000FCBF.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB5666 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240110_032626_082743_4B613BC9 X-CRM114-Status: GOOD ( 12.61 ) 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 reference to rs485.yaml. 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. Changes for V5: Remove rts-gpios description. Update commit message and description. Changes for V6: Update commit description. Disable the TX and RX in cdns_rs485_config() when rs485 disabled. Hold lock for cdns_uart_handle_tx() in cdns_rs485_tx_callback(). Changes for V7: Update commit description. Changes for V8: Use hrtimer instead of timer list. Simplify cdns_rs485_tx_setup() and cdns_rs485_rx_setup(). Update argument of cdns_rts_gpio_enable() in cdns_uart_set_mctrl(). Add cdns_calc_after_tx_delay() to calculate required delay after tx. Add hrtimer setup in cdns_rs485_config(). Move enable TX Empty interrupt and rs485 rx callback scheduling part to cdns_uart_handle_tx(). Manikanta Guntupalli (3): dt-bindings: Add reference to rs485.yaml 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 | 1 + drivers/tty/serial/xilinx_uartps.c | 271 ++++++++++++++++-- 2 files changed, 249 insertions(+), 23 deletions(-)