From patchwork Tue Jan 23 06:16:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13526871 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 6960AC47258 for ; Tue, 23 Jan 2024 06:17:55 +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: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=lLDSkd3OJ0EBsy1KTpy/e4uCv+0NuTJxRK1xwDxB2y8=; b=450BeJlkq+DmSE QSYnw/4ms2VYyannmL2TK4UpIaF8M2zR4QZgR8kjwTs8Xgg5B1tqHWTnBPDGu3mWyoT1a3cTlJZ1O muhU0A06Zm4ixNdh/TfLGbPykain5oPsUOOIzBAT/cKS4R9y9Bejn1zC48pYT9GqxlpVpcybYnAgW FFhfjGUrMmvJw5XTu5nzdxcU8NJeRNniy9S+X68RwVN1wexPggtURu0a4ZtMd1wVMZI83Apu+ujIt 1rAFQUNGJw5vFTQf1XS5wRMSmD71BV8xe1Dk6DcAQcxvFhkxJKNmk/nsjmVqoEcgwWga0Oo6Qn8+A 9MjRocDKLP5r1JX6WK4g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSA6F-00FEaN-0A; Tue, 23 Jan 2024 06:17:31 +0000 Received: from mail-mw2nam12on20601.outbound.protection.outlook.com ([2a01:111:f403:200a::601] helo=NAM12-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSA6C-00FEZA-1A for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 06:17:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fujXB1RxhQfGsFrhmrQSpf0N0+IWgs8xzUVy140VcZGtBZH0EZjyY2WefjeW0pfvJnV9VZSAuwk+IoTDdzZL1BccDO2MSMKnqcAXehvXbeJ+ZcZv+05jp7uu/Qg1i0viko9G55OKEUbeKVc6LWH0OZWXMzd9LK5W4McwaYx6xyCREcqr3wwpQ3AnoWQdnMqIrLDv/upeKl23l8n3ebnP2170dLgrOIsU4pfkZf0K5GZR68AEMMnXLNudPzUH+ovkTbRAoUmCmwin54tSJPkPzNWXEYbA6XvLcDZ3V3RMFpnuip8oDUdATFKSPlkw+RI4sbS2jHnAhQnjkl2BJKtFDA== 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=grl+RZ1TCvyv4uTGolZ1MGMAaAU9UAqV7wITS4zYe6o=; b=m9Eo3FPn69uo++S0BIAJrXOfoX1R2xCM0S/NZ/W02+Zgy0xaKtsyU0fvcILRUnzK79FjFoT17riJAjgIsDkhKpiNzRuP9J+M54MQ6QnzZK5DFaVTgyiltqCX7d/nelCHEYCBwE81ktZe9l0R6XyyzUbvRIg2fvkdT0T1fqsnbSBYrUBrWRMc0dFPb/y6OxNkESwW71dJrypRXi+aUCl+apZk+EXHs5WS2bmch5O9FUAhPQ2vtZHTVF6ArkxQh9OLo1DJKYtIjc7+15eh05JJNvMdt4TZ6qfPtYulJ4m1TT9ZyBjiVI3AusxJMWW+jtXuNlHOsc2NggCtGKa5YWeK8A== 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=grl+RZ1TCvyv4uTGolZ1MGMAaAU9UAqV7wITS4zYe6o=; b=AM7EJzSDXbKy/aKPp5r2eMKXW51XTnf0QDf1vrWSRxkdF7T9S00I4L55kpZSGYpHoEkM+Oi02QjDSHjqS4+rkyF+jlLQvhleqWifiS/aYFcb27Mii4NcSaxJ5lgKKZCh28KkMTMFZ6ydhQ7pkb/RD9lpqS8GtAZCjDcv/bo/xIM= Received: from PH0P220CA0026.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:d3::7) by SN7PR12MB7203.namprd12.prod.outlook.com (2603:10b6:806:2aa::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37; Tue, 23 Jan 2024 06:17:19 +0000 Received: from SN1PEPF0002529D.namprd05.prod.outlook.com (2603:10b6:510:d3:cafe::d5) by PH0P220CA0026.outlook.office365.com (2603:10b6:510:d3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.38 via Frontend Transport; Tue, 23 Jan 2024 06:17:19 +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 SN1PEPF0002529D.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Tue, 23 Jan 2024 06:17:19 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Tue, 23 Jan 2024 00:17:19 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 23 Jan 2024 00:17:18 -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; Tue, 23 Jan 2024 00:17:14 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli , Conor Dooley Subject: [PATCH V10 1/3] dt-bindings: Add reference to rs485.yaml Date: Tue, 23 Jan 2024 11:46:53 +0530 Message-ID: <20240123061655.2150946-2-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240123061655.2150946-1-manikanta.guntupalli@amd.com> References: <20240123061655.2150946-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529D:EE_|SN7PR12MB7203:EE_ X-MS-Office365-Filtering-Correlation-Id: c81b5f29-cd21-4c81-747f-08dc1bdaf44b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kxz2t1BFAMwiUxaQz+Jodd+mCj2EVpJQKwGuqtB1BDtvL/h06YQlxC0ve1Jr4h3LZvPN6pkYlAxAjooGbEEg1ZRS3Ztj/2ORHd5JOEZ+1RPuHmpPbhquzbsNtgCNreGkugAYcdkywr7Va7TZL20X/bWkcgKkzUzoEFR/qWp1GdQxZJTJ++po6QoadLwUIcjfdNKY8eX4Q4kemtfpJJ6gIps72jvKRWxCW5ZR8LOTnRhnRCQqnLbxeErOYNrZHmWGyOspUjBw6GOhcWjk2tpNJMmMXHYk6a7g8s9tTqg4ccbYJFrl6/Ol0Jm9jIAbWUcjHDhbHx+cYS1BcyIMcOhZgDHRJai+KFZvorXHX0WmdfyqNYq+cA4DPrCEeF4JNyNoXhKEr+ClmOHWJFw5w/nPuTEGKzxWO6ww2n6B/shueJH1hxC+ZQRSgo09nXOOt+evxTL+Y94zpDkn8bww++JPX6Lqv0UJTWpO1fSATSvmLRvCrbcBI9A2ee3Eh13KZUsVRQDkmGQdEnZSA6EjLv0w6mchcfbukPgRfnJ/hYghVM9cMNCqb6p3glZuHT8Vx09k0+CJO057hOCbeWAopvNcKxBECiOzpeVw7blE81reteWi9z56PFaAkr3dXMjMX3Fa1azx8YjhSgDskrmx3u950ZP6qOd2ZkUjjPPVXXvVnuVt859sw07Lk5MIZDPvA8nkFMRa+defX+2lOvjQx2iSW/KNBOpx6o4xD1wxiDML0vL/9xKZ68stIQim7LfTK44s4wkBtSMT6dDuJX9WeGmYfYtcklq/hGkFR7P308x5qE4= 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)(39860400002)(396003)(136003)(346002)(376002)(230922051799003)(186009)(64100799003)(82310400011)(451199024)(1800799012)(40470700004)(46966006)(36840700001)(40460700003)(40480700001)(86362001)(921011)(70586007)(36756003)(2616005)(426003)(83380400001)(81166007)(336012)(47076005)(1076003)(26005)(2906002)(7416002)(316002)(5660300002)(110136005)(54906003)(6666004)(478600001)(70206006)(4326008)(44832011)(82740400003)(36860700001)(356005)(41300700001)(8676002)(8936002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 06:17:19.4548 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c81b5f29-cd21-4c81-747f-08dc1bdaf44b 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: SN1PEPF0002529D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7203 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240122_221728_421701_7E2D3BC0 X-CRM114-Status: GOOD ( 10.91 ) 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 Xilinx/AMD Kria SOM KD240 board has a rs485 compatible peripheral. Update the binding to have rs485 support. Acked-by: Conor Dooley Signed-off-by: Manikanta Guntupalli --- Changes for V2: Modify optional gpio name to xlnx,phy-ctrl-gpios. Update commit description. Changes for V3: Modify optional gpio name to rts-gpios. Update commit description. Changes for V4: Update rts-gpios description. Changes for V5: Remove rts-gpios description. Update commit message and description. Changes for V6: Update commit description. Changes for V7: Update commit description. Changes for V8: None. Changes for V9: None. Changes for V10: None. --- Documentation/devicetree/bindings/serial/cdns,uart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/serial/cdns,uart.yaml b/Documentation/devicetree/bindings/serial/cdns,uart.yaml index e35ad1109efc..2129247d7c81 100644 --- a/Documentation/devicetree/bindings/serial/cdns,uart.yaml +++ b/Documentation/devicetree/bindings/serial/cdns,uart.yaml @@ -55,6 +55,7 @@ required: allOf: - $ref: serial.yaml# + - $ref: rs485.yaml# - if: properties: compatible: From patchwork Tue Jan 23 06:16:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13526873 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 D4A64C47DDB for ; Tue, 23 Jan 2024 06:18:05 +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: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=nVFxTWKzaOIIMtXagNCZhXm0a6MqFSSnilfAqnn1TSI=; b=OZMdpppzAFRzB3 UMn7FjZke4f1R2webOCxR/JLy/Lnc/brbBvRjUwOX8FeTDl+x5O7aHhqBOQhF0QbwMOWPu+WZ+7nD OT9r7vwQolZztxxLSOBzEoemQF0a48wpqt9iJBdk9YDNu82FAgTdW7Poi1H5/imZFGpSCuqbOOf+X khsTkEor4UOU8TKwxe808mFEXBQ9hUXmDW4FFCV19VLG8QW5wdDnH/KkOGw1ZntLfDuwCa8I7L0S8 EZN7kAa8UX+jiCI0LCZ/l98Z5OQ8xiQNlb00Y1tBAK1jPzdUTF/dAa0u3ws1WIbozy+RPVxMVoyXn g/HFysmLLeE9jQoRrnZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSA6P-00FEeO-1g; Tue, 23 Jan 2024 06:17:41 +0000 Received: from mail-dm6nam10on20621.outbound.protection.outlook.com ([2a01:111:f400:7e88::621] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSA6I-00FEb5-00 for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 06:17:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gi4Qqq38yCASxk0JA1EmwUu7SYsJL7fcuE+Op4Dk4BzVnB3i7vo0QzPofGgLTe1l/vDWPHDhAGUOgDmmHwdgFgQMYpDxIcGJeYzT+6LUgIA2DgbWqhheAV1qr0Gw7EOK6A2/LHR8BP7DdH5wgwBSu7GZXo6PKQWD7s0iXQgV5qQ9FKcYuB31gNCY87BAeu8zPFB2vxJmNTtGZCTeJwJJ8cJjSf7Lr6BGRlwlN+1Sq7mDk2Vmsd8dsR9SqKOBqwWEmm8ddKhoGlyDAbFVGoesS6To2WKYTVHd4dnR6NAkfRWhA5L626Cd+JBupBHu/LRenc+RQOy/QCHFjmOmoglwgA== 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=VGU38bnXCgfXXub3Tv0N7b/JbzNTdynfBOMq95PvQiA=; b=HHrvPcHMY1MWxD7rJOmhkLi9Tk8xapxyvpQvcUKLEkorqQqmBNgxRAF2y1G5IuQx4iA/b0bzvVk6HNLfbxLz9pHLXDNnfoEK9bj5ibTnVCWIx41Hkg3Z+Ctzf+/31U9Aq2Smo2pXOC/ElfMsSi9FCKh98WUIoLeMRcIdCWORWR6+eM6+21uyMQINkLZcj+52QgAGBXwzMU1A/bG163LJFaGW6LhwUsJCNelBxsYyrotyFP9+ZEgAmKhtG8hKqt3hzRSkBCP4C6wg/sCAbNsldPOAh10AgukuOP5bq4Bl/3NzpUwLjnSWOED6ZJOLka8S5GdejEguW5oFDtvZspCsQg== 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=VGU38bnXCgfXXub3Tv0N7b/JbzNTdynfBOMq95PvQiA=; b=0BKmP9Ez29np/mcmFCXMVTTEpHcKRRhN28hpCwNdCft5dpP8rQC7aCXP8FrPSU/TnEufZDkUfDR16UYy6ecrCZZLcMHjwFcRb6ATvNn70Wh8FlaG4E0yTSLB0L6hmS1cmrnT7eTlXd923EjR+FMoGAXjqVnGVyuaYfPBrw3vyT0= Received: from MN2PR01CA0045.prod.exchangelabs.com (2603:10b6:208:23f::14) by MN2PR12MB4048.namprd12.prod.outlook.com (2603:10b6:208:1d5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37; Tue, 23 Jan 2024 06:17:25 +0000 Received: from BL6PEPF0001AB57.namprd02.prod.outlook.com (2603:10b6:208:23f:cafe::18) by MN2PR01CA0045.outlook.office365.com (2603:10b6:208:23f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37 via Frontend Transport; Tue, 23 Jan 2024 06:17:25 +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 BL6PEPF0001AB57.mail.protection.outlook.com (10.167.241.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Tue, 23 Jan 2024 06:17:25 +0000 Received: from SATLEXMB05.amd.com (10.181.40.146) 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; Tue, 23 Jan 2024 00:17:25 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB05.amd.com (10.181.40.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Tue, 23 Jan 2024 00:17:24 -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; Tue, 23 Jan 2024 00:17:20 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V10 2/3] tty: serial: uartps: Relocate cdns_uart_tx_empty to facilitate rs485 Date: Tue, 23 Jan 2024 11:46:54 +0530 Message-ID: <20240123061655.2150946-3-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240123061655.2150946-1-manikanta.guntupalli@amd.com> References: <20240123061655.2150946-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB57:EE_|MN2PR12MB4048:EE_ X-MS-Office365-Filtering-Correlation-Id: a192fd4e-db17-4451-58a4-08dc1bdaf7f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vWS0Ax4GxFx8hfI4Q5a195b4xYsWIvL2TCYIj5AlDfKrcuu6P84buE6Ns+Ml8jv7Ff+5doP0QHJmcF+Wqwz+rSPq8Gss8rErKZV1RumUFSVwB2LO8P5t3pRMPD16WU6dy69/rA2kZgNy9nqAT3et5qvYT6vcQmT1CplyI8L4XFzw8ZMxXuFfBCwrXvEWwgg0QTgFiWwYfjbNEvq+UO6813bJAgfo2gZfIImczxUfBEq/MAs6xTdDATBEqU01OF+W433LWfv4mDbyxSNyoeF/SnIR6D6r7rm5EwpRJAPmNLQxUPaCDoPh/W4Kb0mcQgRJy3hTG9PIv/vsFhE4t97On7BeINSwqEannPrYRSFyO3iSYDVhPrv32xrs/eGljoBVOGM2lQcij14MzgHsCAM1PTPzTXaY7gj8oKOuz55YvipGfXQ5EU+zOUaxhFCNuzfyzRbCCndAyZFT7zDSYr4v6ZQw7bSSHJLgQ3cmWaT15NEeQ6iAJ40pgnTRYInxPhNmxubqT8X2IOmbU3KG/sm9j8ypV7CfCXMxO95LV+oAvsYTwlcw/AVNPEr30x39MzNpigRyBoIZytay+p/kazsHWQdF7dwOi/GsFQ+GmpFeUGCcpjCC39SL4vEiei5Ejpb3b72XuOHt7/kUQtgpdGXjDNE4jgqYPcqto6gOnTnsRO/TEb2oJvZvHXYGhzZPoLiT9Zb8QV3MTCgz65t389/pV5MpTPjA/0ZLjDYOo7wZaT2zZr5XP0wF/BkNSusL3Yjt1F+ae+BYNu7ivG6Rh9pFMPdbNyn/xur9axGFRVe5xfU= 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)(376002)(136003)(396003)(346002)(39860400002)(230922051799003)(451199024)(186009)(64100799003)(82310400011)(1800799012)(46966006)(40470700004)(36840700001)(478600001)(921011)(40480700001)(40460700003)(6666004)(426003)(83380400001)(336012)(1076003)(82740400003)(5660300002)(44832011)(4326008)(8676002)(8936002)(47076005)(7416002)(2906002)(26005)(36860700001)(86362001)(41300700001)(36756003)(316002)(2616005)(81166007)(70586007)(54906003)(70206006)(356005)(110136005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 06:17:25.5908 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a192fd4e-db17-4451-58a4-08dc1bdaf7f1 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: BL6PEPF0001AB57.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4048 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240122_221734_040274_B3E7A031 X-CRM114-Status: GOOD ( 15.51 ) 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 Relocate cdns_uart_tx_empty function to avoid prototype statement in rs485 changes. Update return check with uart_tx_stopped() in cdns_uart_handle_tx(). Signed-off-by: Manikanta Guntupalli --- Changes since V4: This patch introduced in V4. Changes for V5: None. Changes for V6: None. Changes for V7: None. Changes for V8: None. Changes for V9: Update return check with uart_tx_stopped() in cdns_uart_handle_tx(). Update description of cdns_uart_handle_tx() and add clear TX Empty interrupt comment cdns_uart_start_tx(). Changes for V10: Add disable the TX Empty interrupt comment in cdns_uart_handle_tx(). --- drivers/tty/serial/xilinx_uartps.c | 36 ++++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 920762d7b4a4..765a6e174052 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -306,7 +306,22 @@ static void cdns_uart_handle_rx(void *dev_id, unsigned int isrstatus) } /** - * cdns_uart_handle_tx - Handle the bytes to be Txed. + * cdns_uart_tx_empty - Check whether TX is empty + * @port: Handle to the uart port structure + * + * Return: TIOCSER_TEMT on success, 0 otherwise + */ +static unsigned int cdns_uart_tx_empty(struct uart_port *port) +{ + unsigned int status; + + status = readl(port->membase + CDNS_UART_SR); + status &= (CDNS_UART_SR_TXEMPTY | CDNS_UART_SR_TACTIVE); + return (status == CDNS_UART_SR_TXEMPTY) ? TIOCSER_TEMT : 0; +} + +/** + * cdns_uart_handle_tx - Handle the bytes to be transmitted. * @dev_id: Id of the UART port * Return: None */ @@ -316,7 +331,8 @@ static void cdns_uart_handle_tx(void *dev_id) struct circ_buf *xmit = &port->state->xmit; unsigned int numbytes; - if (uart_circ_empty(xmit)) { + if (uart_circ_empty(xmit) || uart_tx_stopped(port)) { + /* Disable the TX Empty interrupt */ writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IDR); return; } @@ -587,6 +603,7 @@ static void cdns_uart_start_tx(struct uart_port *port) if (uart_circ_empty(&port->state->xmit)) return; + /* Clear the TX Empty interrupt */ writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR); cdns_uart_handle_tx(port); @@ -626,21 +643,6 @@ static void cdns_uart_stop_rx(struct uart_port *port) writel(regval, port->membase + CDNS_UART_CR); } -/** - * cdns_uart_tx_empty - Check whether TX is empty - * @port: Handle to the uart port structure - * - * Return: TIOCSER_TEMT on success, 0 otherwise - */ -static unsigned int cdns_uart_tx_empty(struct uart_port *port) -{ - unsigned int status; - - status = readl(port->membase + CDNS_UART_SR) & - (CDNS_UART_SR_TXEMPTY | CDNS_UART_SR_TACTIVE); - return (status == CDNS_UART_SR_TXEMPTY) ? TIOCSER_TEMT : 0; -} - /** * cdns_uart_break_ctl - Based on the input ctl we have to start or stop * transmitting char breaks From patchwork Tue Jan 23 06:16:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13526874 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 6F769C48260 for ; Tue, 23 Jan 2024 06:18:22 +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: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=iqRVpdRXfbZcf4ZqNG3Qd0kpt+haQst9M7fPWBR35Qk=; b=o9xNDls+AvseKF 8p3/l80CHl7lO3IEz/jPHZLfocGTrGCjswrL72ElBV6+JI0e5v3F9mmE2F+nQAft5wrXMBtrY2enE KQCI3hZaL5l1Ev8u2xpWz/jp3HVOhwIK4gkS5maRfuvRzK30NXx/2HCjC+a1pwQd2X2MNvylZchZq k9h9nWIGKoG7s5ESRfQMBoo0RbxXHgUuoT7jSVs8lyffffp7oV7IZYL4cIODLCWwom2OODnTodl9c DWTDEkb4M0cnCKLkmoFaQBuCbWsO8rpmYr3RABtmoH83nQsh+XMh+UIYZ9pNEnyaKVOkBBoqM2cwV ByjSoA4NttY9dObH0PrA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSA6e-00FElf-0U; Tue, 23 Jan 2024 06:17:56 +0000 Received: from mail-sn1nam02on20618.outbound.protection.outlook.com ([2a01:111:f400:7ea9::618] helo=NAM02-SN1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSA6Z-00FEhI-1s for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 06:17:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oSWtskojJHRA4aMARKvuRivkl1o+mVsixhAME0Gi/+jriE3uGxOj+EmHEMCiK+v0OcY5ssQmV4LOWUhNEALfuhCRF97O3HuVBowCZDm/j9v7W9yTmquhrdLUsybQEr6MvPaB7Ik0obkOd+0lT3d2mknmu6cFYGxBUn/UamU7u3kcQmkv40K9m7ZMl6CxmZgatMxJELPklEqQGNLxE3O5yClOwTpIxYnYonUbmj71wBD1oi9/2eESCPOKp1V7yTvs1VYeVs5k5CbIbAEYElqbKcgIsgFf0wqenhjIlLh+nxdssRWkUhSp88pK24Ou8EYjersBaSAWlJXj67VrlGqQmA== 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=eC+x9Uk66SEaJHdc7BpxV6ux9AJfrEFkC6iOAG6YEZk=; b=i3Of/DEgyfYHckYrs0G+TyFPVkVA4fn6xOR9DLDZuND162aU8gPS2UX9p2kK5iMElWEBQ0yblxDiwIPdMSA3Q2NZMEw1BUvFlSpApoO7OtXDRFF8zix+K3Ys18/3H6dNiXy7pfS6k6ZPYAj5OcDqeSIclr9ocdLQQlZlm0o0Ec1L1aFySTPWyU8xgs9bOSQbmFZkW6xaIRvb9CFRL5+6zM69t956NJVs9hoTRycpVmQxGgbBaNbPQ+CjlfSJJ0o83/WihRX9OvlrZQArUDFilZhRNlsBrNMZvQIzdMhQ8ow7yAYFlcOPUecoLZ59hDuS9shPEdt3eMiShalEYVi2vQ== 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=eC+x9Uk66SEaJHdc7BpxV6ux9AJfrEFkC6iOAG6YEZk=; b=uxKdiY74JzthWkFhHUre6fgNsUjaktm/WDZ5zTL3GQXUE0EAN+mXGiHBXWn1ZGU4m3B/Xv2E+aMNIKOiiDeAMQ769Q9eu6UhSPN08YUhZcdw6Q14x67Wq5cPVXbI5ENonyLA19/AlzpAKwxq3Qsc1Mq9ZsMLYP6Ek+BpSBIKdVU= Received: from BL0PR1501CA0023.namprd15.prod.outlook.com (2603:10b6:207:17::36) by CYXPR12MB9338.namprd12.prod.outlook.com (2603:10b6:930:e5::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.37; Tue, 23 Jan 2024 06:17:32 +0000 Received: from BL6PEPF0001AB58.namprd02.prod.outlook.com (2603:10b6:207:17:cafe::b4) by BL0PR1501CA0023.outlook.office365.com (2603:10b6:207:17::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32 via Frontend Transport; Tue, 23 Jan 2024 06:17:32 +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 BL6PEPF0001AB58.mail.protection.outlook.com (10.167.241.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.14 via Frontend Transport; Tue, 23 Jan 2024 06:17:31 +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; Tue, 23 Jan 2024 00:17:31 -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; Tue, 23 Jan 2024 00:17:27 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V10 3/3] tty: serial: uartps: Add rs485 support to uartps driver Date: Tue, 23 Jan 2024 11:46:55 +0530 Message-ID: <20240123061655.2150946-4-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240123061655.2150946-1-manikanta.guntupalli@amd.com> References: <20240123061655.2150946-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB58:EE_|CYXPR12MB9338:EE_ X-MS-Office365-Filtering-Correlation-Id: aa6273f4-da07-44cc-0a4f-08dc1bdafbb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TveVJ/jgk+wJJA2cJcbzDGE5/satlE8iaJa8rxII4B1pR0xgvzCkk7d1EQ5SirVOR6wFRFwvQc3D5JhPTMHOyQMiIpkVqgjUiEEW/NeidXnUtyE5l3kzOG+32kbDwUa2vSRIE2gqxwh2AsFQefLOjfER+NrK8Tu0oMTGDfP2vd5+PA7avPOpulSEeAeyj5k+0sI5Z+j7huCOdguBwLWmHM6MsuW8sggc7ZUkT76jzNYSoxH/5jkgHwo2FKVYNGG3pjq5sB0Fn1C+qFzq4mhG9A9X08Fu4SNwyzw5pxm9WQ9x+Y2tCPDYwLtH4qFsjnOZ58oQMBU/kfR6fNOHZ7dMbOfk30+xbAcoq1J5RUIdarjIe/NN94PGPpA/BeenRVFb9zyPv+wasqtjskqOzu5LETcMsrjhWTfNK1gQn3vQ+UWg3W3ZscM70f//yjpeNwimTfpcb3VoCezU3Tv6fvxE1s5cEAt5CctprRHfYcigMQFMbaYWF7adKL9PeFhBxrfN+47UmF9qkwZ6bETIngiCdwdrP7A197cyd4qeancNrvBYxPsrRD5zB8EK4JywMxONT5H/a3QzlY/allq2aTKRbYSsEJbq5oy57jgpkp8eW/OntC41G7nAIwJBvj2aDy3pwR0fTj32ASkvcM5OXZS3K4u5pFmYva/4/6BrRpqudzNk6nnu8dZZRfMvLQ79A7HyItfbvcHriovEXtUC0Ca0YztQCNj4vi//zMLj4KG4VEXyvax5R8aDOMH7tIJpOh9AJHxvdPyXofCOvrQM0ZoKey0YFdICXGFd4J+Jk8dujwU= 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)(39860400002)(396003)(376002)(136003)(346002)(230922051799003)(186009)(82310400011)(64100799003)(451199024)(1800799012)(46966006)(36840700001)(40470700004)(40480700001)(40460700003)(83380400001)(921011)(36756003)(86362001)(356005)(81166007)(82740400003)(41300700001)(47076005)(2616005)(1076003)(426003)(336012)(26005)(30864003)(2906002)(36860700001)(478600001)(70206006)(110136005)(316002)(70586007)(54906003)(6666004)(44832011)(4326008)(7416002)(5660300002)(8936002)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2024 06:17:31.9196 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aa6273f4-da07-44cc-0a4f-08dc1bdafbb7 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: BL6PEPF0001AB58.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYXPR12MB9338 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240122_221751_666507_82DCB831 X-CRM114-Status: GOOD ( 24.79 ) 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 rs485 support to uartps driver. Use either rts-gpios or RTS to control RS485 phy as driver or a receiver. Signed-off-by: Manikanta Guntupalli --- 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: 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: None. Changes for V6: 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: None. 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(). Changes for V9: Remove stop tx timer. Remove hrtimer_cancel() call from cdns_uart_start_tx(). Handle gpio case separately in cdns_uart_set_mctrl(). Move hrtimer_cancel() call from below to above in cdns_uart_shutdown(). Changes for V10: None. --- drivers/tty/serial/xilinx_uartps.c | 200 ++++++++++++++++++++++++++++- 1 file changed, 196 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 765a6e174052..5f48ec37cb25 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -22,7 +22,9 @@ #include #include #include -#include +#include +#include +#include #define CDNS_UART_TTY_NAME "ttyPS" #define CDNS_UART_NAME "xuartps" @@ -193,6 +195,9 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255"); * @clk_rate_change_nb: Notifier block for clock changes * @quirks: Flags for RXBS support. * @cts_override: Modem control state override + * @gpiod_rts: Pointer to the gpio descriptor + * @rs485_tx_started: RS485 tx state + * @tx_timer: Timer for tx */ struct cdns_uart { struct uart_port *port; @@ -203,10 +208,21 @@ struct cdns_uart { struct notifier_block clk_rate_change_nb; u32 quirks; bool cts_override; + struct gpio_desc *gpiod_rts; + bool rs485_tx_started; + struct hrtimer tx_timer; }; struct cdns_platform_data { u32 quirks; }; + +struct serial_rs485 cdns_rs485_supported = { + .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | + SER_RS485_RTS_AFTER_SEND, + .delay_rts_before_send = 1, + .delay_rts_after_send = 1, +}; + #define to_cdns_uart(_nb) container_of(_nb, struct cdns_uart, \ clk_rate_change_nb) @@ -305,6 +321,55 @@ static void cdns_uart_handle_rx(void *dev_id, unsigned int isrstatus) tty_flip_buffer_push(&port->state->port); } +/** + * cdns_rts_gpio_enable - Configure RTS/GPIO to high/low + * @cdns_uart: Handle to the cdns_uart + * @enable: Value to be set to RTS/GPIO + */ +static void cdns_rts_gpio_enable(struct cdns_uart *cdns_uart, bool enable) +{ + u32 val; + + if (cdns_uart->gpiod_rts) { + gpiod_set_value(cdns_uart->gpiod_rts, enable); + } else { + val = readl(cdns_uart->port->membase + CDNS_UART_MODEMCR); + if (enable) + val |= CDNS_UART_MODEMCR_RTS; + else + val &= ~CDNS_UART_MODEMCR_RTS; + writel(val, cdns_uart->port->membase + CDNS_UART_MODEMCR); + } +} + +/** + * cdns_rs485_tx_setup - Tx setup specific to rs485 + * @cdns_uart: Handle to the cdns_uart + */ +static void cdns_rs485_tx_setup(struct cdns_uart *cdns_uart) +{ + bool enable; + + enable = cdns_uart->port->rs485.flags & SER_RS485_RTS_ON_SEND; + cdns_rts_gpio_enable(cdns_uart, enable); + + cdns_uart->rs485_tx_started = true; +} + +/** + * cdns_rs485_rx_setup - Rx setup specific to rs485 + * @cdns_uart: Handle to the cdns_uart + */ +static void cdns_rs485_rx_setup(struct cdns_uart *cdns_uart) +{ + bool enable; + + enable = cdns_uart->port->rs485.flags & SER_RS485_RTS_AFTER_SEND; + cdns_rts_gpio_enable(cdns_uart, enable); + + cdns_uart->rs485_tx_started = false; +} + /** * cdns_uart_tx_empty - Check whether TX is empty * @port: Handle to the uart port structure @@ -320,6 +385,37 @@ static unsigned int cdns_uart_tx_empty(struct uart_port *port) return (status == CDNS_UART_SR_TXEMPTY) ? TIOCSER_TEMT : 0; } +/** + * cdns_rs485_rx_callback - Timer rx callback handler for rs485. + * @t: Handle to the hrtimer structure + */ +static enum hrtimer_restart cdns_rs485_rx_callback(struct hrtimer *t) +{ + struct cdns_uart *cdns_uart = container_of(t, struct cdns_uart, tx_timer); + + /* + * Default Rx should be setup, because Rx signaling path + * need to enable to receive data. + */ + cdns_rs485_rx_setup(cdns_uart); + + return HRTIMER_NORESTART; +} + +/** + * cdns_calc_after_tx_delay - calculate delay required for after tx. + * @cdns_uart: Handle to the cdns_uart + */ +static u64 cdns_calc_after_tx_delay(struct cdns_uart *cdns_uart) +{ + /* + * Frame time + stop bit time + rs485.delay_rts_after_send + */ + return cdns_uart->port->frame_time + + DIV_ROUND_UP(cdns_uart->port->frame_time, 7) + + (u64)cdns_uart->port->rs485.delay_rts_after_send * NSEC_PER_MSEC; +} + /** * cdns_uart_handle_tx - Handle the bytes to be transmitted. * @dev_id: Id of the UART port @@ -328,6 +424,7 @@ static unsigned int cdns_uart_tx_empty(struct uart_port *port) static void cdns_uart_handle_tx(void *dev_id) { struct uart_port *port = (struct uart_port *)dev_id; + struct cdns_uart *cdns_uart = port->private_data; struct circ_buf *xmit = &port->state->xmit; unsigned int numbytes; @@ -348,6 +445,16 @@ static void cdns_uart_handle_tx(void *dev_id) if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) uart_write_wakeup(port); + + /* Enable the TX Empty interrupt */ + writel(CDNS_UART_IXR_TXEMPTY, cdns_uart->port->membase + CDNS_UART_IER); + + if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED && + (uart_circ_empty(xmit) || uart_tx_stopped(port))) { + cdns_uart->tx_timer.function = &cdns_rs485_rx_callback; + hrtimer_start(&cdns_uart->tx_timer, + ns_to_ktime(cdns_calc_after_tx_delay(cdns_uart)), HRTIMER_MODE_REL); + } } /** @@ -580,6 +687,21 @@ static int cdns_uart_clk_notifier_cb(struct notifier_block *nb, } #endif +/** + * cdns_rs485_tx_callback - Timer tx callback handler for rs485. + * @t: Handle to the hrtimer structure + */ +static enum hrtimer_restart cdns_rs485_tx_callback(struct hrtimer *t) +{ + struct cdns_uart *cdns_uart = container_of(t, struct cdns_uart, tx_timer); + + uart_port_lock(cdns_uart->port); + cdns_uart_handle_tx(cdns_uart->port); + uart_port_unlock(cdns_uart->port); + + return HRTIMER_NORESTART; +} + /** * cdns_uart_start_tx - Start transmitting bytes * @port: Handle to the uart port structure @@ -587,6 +709,7 @@ static int cdns_uart_clk_notifier_cb(struct notifier_block *nb, static void cdns_uart_start_tx(struct uart_port *port) { unsigned int status; + struct cdns_uart *cdns_uart = port->private_data; if (uart_tx_stopped(port)) return; @@ -606,10 +729,16 @@ static void cdns_uart_start_tx(struct uart_port *port) /* Clear the TX Empty interrupt */ writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR); + if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED) { + if (!cdns_uart->rs485_tx_started) { + cdns_uart->tx_timer.function = &cdns_rs485_tx_callback; + cdns_rs485_tx_setup(cdns_uart); + return hrtimer_start(&cdns_uart->tx_timer, + ms_to_ktime(port->rs485.delay_rts_before_send), + HRTIMER_MODE_REL); + } + } cdns_uart_handle_tx(port); - - /* Enable the TX Empty interrupt */ - writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IER); } /** @@ -619,6 +748,10 @@ static void cdns_uart_start_tx(struct uart_port *port) static void cdns_uart_stop_tx(struct uart_port *port) { unsigned int regval; + struct cdns_uart *cdns_uart = port->private_data; + + if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED) + cdns_rs485_rx_setup(cdns_uart); regval = readl(port->membase + CDNS_UART_CR); regval |= CDNS_UART_CR_TX_DIS; @@ -831,6 +964,9 @@ static int cdns_uart_startup(struct uart_port *port) (CDNS_UART_CR_TXRST | CDNS_UART_CR_RXRST)) cpu_relax(); + if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED) + cdns_rs485_rx_setup(cdns_uart); + /* * Clear the RX disable bit and then set the RX enable bit to enable * the receiver. @@ -890,6 +1026,10 @@ static void cdns_uart_shutdown(struct uart_port *port) { int status; unsigned long flags; + struct cdns_uart *cdns_uart = port->private_data; + + if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED) + hrtimer_cancel(&cdns_uart->tx_timer); uart_port_lock_irqsave(port, &flags); @@ -1035,6 +1175,8 @@ static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) if (mctrl & TIOCM_RTS) val |= CDNS_UART_MODEMCR_RTS; + if (cdns_uart_data->gpiod_rts) + gpiod_set_value(cdns_uart_data->gpiod_rts, !(mctrl & TIOCM_RTS)); if (mctrl & TIOCM_DTR) val |= CDNS_UART_MODEMCR_DTR; if (mctrl & TIOCM_LOOP) @@ -1457,6 +1599,39 @@ MODULE_DEVICE_TABLE(of, cdns_uart_of_match); /* Temporary variable for storing number of instances */ static int instances; +/** + * cdns_rs485_config - Called when an application calls TIOCSRS485 ioctl. + * @port: Pointer to the uart_port structure + * @termios: Pointer to the ktermios structure + * @rs485: Pointer to the serial_rs485 structure + * + * Return: 0 + */ +static int cdns_rs485_config(struct uart_port *port, struct ktermios *termios, + struct serial_rs485 *rs485) +{ + u32 val; + struct cdns_uart *cdns_uart = port->private_data; + + if (rs485->flags & SER_RS485_ENABLED) { + dev_dbg(port->dev, "Setting UART to RS485\n"); + /* Make sure auto RTS is disabled */ + val = readl(port->membase + CDNS_UART_MODEMCR); + val &= ~CDNS_UART_MODEMCR_FCM; + writel(val, port->membase + CDNS_UART_MODEMCR); + + /* Timer setup */ + hrtimer_init(&cdns_uart->tx_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); + cdns_uart->tx_timer.function = &cdns_rs485_tx_callback; + + /* Disable transmitter and make Rx setup*/ + cdns_uart_stop_tx(port); + } else { + hrtimer_cancel(&cdns_uart->tx_timer); + } + return 0; +} + /** * cdns_uart_probe - Platform driver probe * @pdev: Pointer to the platform device structure @@ -1599,9 +1774,23 @@ static int cdns_uart_probe(struct platform_device *pdev) port->private_data = cdns_uart_data; port->read_status_mask = CDNS_UART_IXR_TXEMPTY | CDNS_UART_IXR_RXTRIG | CDNS_UART_IXR_OVERRUN | CDNS_UART_IXR_TOUT; + port->rs485_config = cdns_rs485_config; + port->rs485_supported = cdns_rs485_supported; cdns_uart_data->port = port; platform_set_drvdata(pdev, port); + rc = uart_get_rs485_mode(port); + if (rc) + goto err_out_clk_notifier; + + cdns_uart_data->gpiod_rts = devm_gpiod_get_optional(&pdev->dev, "rts", + GPIOD_OUT_LOW); + if (IS_ERR(cdns_uart_data->gpiod_rts)) { + rc = PTR_ERR(cdns_uart_data->gpiod_rts); + dev_err(port->dev, "xuartps: devm_gpiod_get_optional failed\n"); + goto err_out_clk_notifier; + } + pm_runtime_use_autosuspend(&pdev->dev); pm_runtime_set_autosuspend_delay(&pdev->dev, UART_AUTOSUSPEND_TIMEOUT); pm_runtime_set_active(&pdev->dev); @@ -1620,6 +1809,8 @@ static int cdns_uart_probe(struct platform_device *pdev) console_port = port; } #endif + if (cdns_uart_data->port->rs485.flags & SER_RS485_ENABLED) + cdns_rs485_rx_setup(cdns_uart_data); rc = uart_add_one_port(&cdns_uart_uart_driver, port); if (rc) { @@ -1648,6 +1839,7 @@ static int cdns_uart_probe(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); pm_runtime_set_suspended(&pdev->dev); pm_runtime_dont_use_autosuspend(&pdev->dev); +err_out_clk_notifier: #ifdef CONFIG_COMMON_CLK clk_notifier_unregister(cdns_uart_data->uartclk, &cdns_uart_data->clk_rate_change_nb);