From patchwork Thu Jan 18 07:40:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13522445 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 91DF6C47077 for ; Thu, 18 Jan 2024 07:42:19 +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=Hho3n2xtopI4xuqQwRJK0i6WvVW2SigoQGJUHWD/zxc=; b=nkaZ4yVzeT6KyN uOro2Depwsg2lqICmxXfRl7wNq/pnZAs6z8hdn3QZfOtIW0TtL5fYa6BXnnQtuHqKvTBCpmAf6DyC Nxzs9flpVXAXYqqv4QqdjZDWEgRtulpJwMNhASyLyhtBLRYqYjWi02fcQ7XK1twQKIDUjo2kgSF5a 2JIXTs+5QWQ0be5FxIu5ogL6OcvmC8opkmsgMH3Npef0w/JYDhbLPnXvIZ8lNHrXifNjSJPaEbWlB ZSjIxHYrxKZsAvjTMyeX4tOq8b/uEzWjtzSd9Q0/YpbD0lMaQJFsTQPdkfRXh/lgeXLmi0I9C779f b1/PmERyyNMVXotyTqcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQN2C-001xFe-0D; Thu, 18 Jan 2024 07:41:56 +0000 Received: from mail-dm6nam12on2053.outbound.protection.outlook.com ([40.107.243.53] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQN28-001xDM-2K for linux-arm-kernel@lists.infradead.org; Thu, 18 Jan 2024 07:41:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ejscTUSh8ochwCnbvfxp6w7Tm/f0cuXW/4lLpjccRuAKyRHDgZeRC3P8PLaoKjDBwy0023JL2ZtiIjwmERUkuCz3XaLUGEtXRmBQMB+cydta0tWjJbHejheNN9UUlqMSjXMhukWfDT+r2I5qpB4nuUvSZd1cY/9gzRDBhj0iwQLaf7ghv5ZimUh9I9W6OOdplxuog+XvRO0Jv1Al/U+8PqHg0ZdEnWI3sQNY3R52edbRy3Dev+wOUERG7P08afIWyKzHLc6Jf8Vs1SchadAMv+E707s98ZRC39pQwQFFJoY7tMjp9U+diN87Ozkp5e+eI3rPA3C3LMRC8cRQ7++R+Q== 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=zRKGuLs+835hff+TGPL7YUfDyZhAKGJZy4+ZhQVa8UE=; b=kWnRL8b87EyNSK/2JeY00AJ7ZjxSnLCVTK/6IXyXRoUXoKines10L+FwY9BgK744fdgUYGQYa50EONJNPb7giN/1FNDNYyVbQFy9krxFPfb4yG4S9KHKOKXxM6PYd2QNVDKCR0Xg7wuDroRN0qEVFBFH9fFKunWWn8lry5FgdncjslALlo5tNGJJPF2IJExObB3li+2Wp8wHqBqapAsBkSGm1djyRTViSM7PtPpSZHEDolYPs/uN1s7MY3HhItUQnHeTHauXm4eMHl24EmR9+u+vET9F4M7o2qnGWU3E6G1ochtGA33DIvad1nfNC8GDAXofBIPFDdHukXrOo27TlA== 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=zRKGuLs+835hff+TGPL7YUfDyZhAKGJZy4+ZhQVa8UE=; b=InfiefTFQ3ooPi8tWceTQey7Ml4ss8mcVxYZUuX/q53FZyfq9TSThCh+XSKJgDuH2ZYK21D3E1A7WIq9QtfK/As7b0boB0Kb9uBMptymrJYkCbv2/Yf3ZTsLkNzJCWJsZKJEd4XfaSEwkn0lvlrWF4XVF2kVHRaVnKwMxsw6MSA= Received: from SJ0PR13CA0048.namprd13.prod.outlook.com (2603:10b6:a03:2c2::23) by IA1PR12MB6555.namprd12.prod.outlook.com (2603:10b6:208:3a1::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.23; Thu, 18 Jan 2024 07:41:28 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:a03:2c2:cafe::cf) by SJ0PR13CA0048.outlook.office365.com (2603:10b6:a03:2c2::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.8 via Frontend Transport; Thu, 18 Jan 2024 07:41:27 +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 MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Thu, 18 Jan 2024 07:41:27 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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; Thu, 18 Jan 2024 01:40:59 -0600 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 18 Jan 2024 01:40:59 -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; Thu, 18 Jan 2024 01:40:55 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli , Conor Dooley Subject: [PATCH V9 1/3] dt-bindings: Add reference to rs485.yaml Date: Thu, 18 Jan 2024 13:10:01 +0530 Message-ID: <20240118074003.2334348-2-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240118074003.2334348-1-manikanta.guntupalli@amd.com> References: <20240118074003.2334348-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E6:EE_|IA1PR12MB6555:EE_ X-MS-Office365-Filtering-Correlation-Id: 931b4ecf-762c-40b3-6993-08dc17f8e122 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4cJrGXGpnq7HobY0QiCl9CEUj3WZ8Isdpm4Q6t/gRI+OlBEDeYm+CariMGKUsMbkQctfjWLZ0nh8LGK825TPM02bncqxhPqb4toX/CDiTQjE1aJGlyJaND+FpJ9AUieruxbdg7ik53VV/8zRRDoz4wadmyYTXsIiYxNZDLsegJRR8Tg+zO3Jt5l+jer5TFZ5PkgxwYoRsNI3qgbo8g8YBs0QKhR2uqrb4vjlZMWUWKSOcZrbM5RNasjKBDm3/NFHhozYOT03/E5nZQJbn4dhkxnXCA/Md2HA3AG1MEyTHjvvzYf3+pES8oq8JHYWP8YccnmHtUgCU6Gu7Z8TUdFrIP4Nw0NDrfEQadPECtpJfJ9yCJZZ7iSiroY7BkfnMrFyky+vQw6JAlKI+nPeUBH/kKPmzzAx1hDfZ3RW/oZaREJJhgWjejrQll/a9T3UgFsxBk3utCa0j+IhkdyCi7WxO5dbGWEsY0Nj8miTdyQGZ1VjMiz7y1ZEhCrqGto4z7FkMMjtyQd/DfgNl47A8NUw9SWY82m0D4dzrgEASexIAO5te/Ff78O8f+X2MP56rpTh2PDwHR0CmHSWGDEGmbiijgbRBComMYLyNTQQ9D241+fASYhqbvjOdulmc53NSbh10GMmMDBxjs6i3u2n0p7hkdqdnXGXiztCCmsPM1gn32gnYElBfmvd+60vKN+C+gGRL+SuFJPJs2AYUspPLF9bRaAlVo6trlRY0R6Y3ig/3U9U10mTxpzmqds6iEYAdrLyJzgkzhdfLQV3VH7pgRhgqL5TF/n6gQrvVHAsbe4xZ6A= 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)(39860400002)(396003)(376002)(230922051799003)(186009)(64100799003)(82310400011)(451199024)(1800799012)(36840700001)(46966006)(40470700004)(40480700001)(40460700003)(83380400001)(921011)(86362001)(36756003)(81166007)(356005)(36860700001)(82740400003)(8676002)(8936002)(4326008)(1076003)(47076005)(2616005)(26005)(426003)(336012)(6666004)(110136005)(70586007)(70206006)(54906003)(5660300002)(316002)(478600001)(44832011)(41300700001)(2906002)(7416002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2024 07:41:27.4818 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 931b4ecf-762c-40b3-6993-08dc17f8e122 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: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6555 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240117_234152_759767_7C224EE9 X-CRM114-Status: GOOD ( 10.77 ) 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. --- 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 Thu Jan 18 07:40:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13522444 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 6F682C47077 for ; Thu, 18 Jan 2024 07:42:10 +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=ex4ZqroM1qi1KjwtX7SaRg+fdncVPV355VWH5V8OYcM=; b=kfr6WbHrwozcjv BRDeUXISD7ex1kUrMg7EMlr06gHdTy+iNVbNQ/TpzIDfK/VarfQhen/UMeF8aVvmHs7/AqX0H+vw7 vDo2s1jn8+N+3ekjjf4dnmBnxLeoRMQlNRhWoULdTEggISG2yGh03VC/RU/Bhq/EaIcbT17NotrC4 QmQMvhZ/8fWJ7IvTmrI3ywNVXOi5TNLx5rs82dsGwkfgwJC8QvzYzQVEeg/oI4ZQG10txpjTEJjns O9gsvhQYVA4n19hSvDB00GiJVjBv3Ew+bmEC6ZLQZVS3hhEPnCYgoUs9Xzv4hCYKaCmmqds7XR55U lxO43tH3G/zAZSDGjrHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQN22-001xBW-1V; Thu, 18 Jan 2024 07:41:46 +0000 Received: from mail-mw2nam10on20601.outbound.protection.outlook.com ([2a01:111:f403:2412::601] helo=NAM10-MW2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQN1y-001x8z-0w for linux-arm-kernel@lists.infradead.org; Thu, 18 Jan 2024 07:41:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AskNJ7P2LVeEjJyKjrRYpdQw7Ov84RFOrlp8QBzQm3WNbVACCxjHmnV141XkSvKNX9QbZ2Ty4L+ceDkWlZ06sfRR6vstGT4LVfAYdXTWvBHGCD+gH3eCbpRd0vdu05FLHhstXHIpiQBq8eMmx52GGBmv1kmfE8aDGdMzYosUIH3t4gJYYY2BibT17KryCCL8GdVlD0MaTUhwagDKzomAjw/8SHPvfbWm/mGuezNiW4reuBWbLS/v9gu4Tg5LR82OdiRRJc+c2uWKVRBJ9RVVmuWQhYOqz/iRrdR0OMe+AV9Qf0HCo4pLEse9ictTKi+TvM2NsPNtzBcwpGf1PuuNfA== 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=ZhsPzBh3pi+yhDM1qCxOiNj//mN2kx6/5lR6T77hW5M=; b=hN4Mr0UojFEGuKqFagfpoIEtcfrn5QsoXUOgW9QDxyPBzSNIw3Mza1arfebs27QkdMoWPtG4ORRyCKuMBb1jHkyPbAfLM51XQhdHd5Y7exJMrFJN0f2WUlol4bX2eYbnhGBCWBV5SrFiJn1J3zxslntHktEES8sxDP/KYxrn517KelMN8ew0QNfNzXtzF/1xg+3Rb6xokfutXL2zGD+arTL0TvRVKSX8cTQHWZamTdgvVYD/Ei3bDAPTuDD+F/BerYhkp+FowussUx+rEvy68pcc0kehHgR6X/5mEz3Tms0UHVTTHas89EVBwcPvj61vP7B7ComGEQw8GnKATSVyUA== 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=ZhsPzBh3pi+yhDM1qCxOiNj//mN2kx6/5lR6T77hW5M=; b=t/SGTNGG9rPMDgAYZ/NvARbXiitkbfFLrL0/V1Jtb+A0ho7QIWKJTI0ENRfBPdSnPQoPZClCeS43RsLbs+nYRwCvWbcvPmVrIDnAXbcz+1FIBLfFqZ2MkLiV1rR+UIWjvqnBYPQI7c3yfwJIpsST92WRPhdvVjEMGP1vJFvOi4c= Received: from CH0PR03CA0237.namprd03.prod.outlook.com (2603:10b6:610:e7::32) by MN2PR12MB4501.namprd12.prod.outlook.com (2603:10b6:208:269::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Thu, 18 Jan 2024 07:41:34 +0000 Received: from DS3PEPF000099D8.namprd04.prod.outlook.com (2603:10b6:610:e7:cafe::a4) by CH0PR03CA0237.outlook.office365.com (2603:10b6:610:e7::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24 via Frontend Transport; Thu, 18 Jan 2024 07:41:33 +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 DS3PEPF000099D8.mail.protection.outlook.com (10.167.17.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Thu, 18 Jan 2024 07:41:33 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) 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; Thu, 18 Jan 2024 01:41:27 -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, 17 Jan 2024 23:41:07 -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; Thu, 18 Jan 2024 01:41:03 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V9 2/3] tty: serial: uartps: Relocate cdns_uart_tx_empty to facilitate rs485 Date: Thu, 18 Jan 2024 13:10:02 +0530 Message-ID: <20240118074003.2334348-3-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240118074003.2334348-1-manikanta.guntupalli@amd.com> References: <20240118074003.2334348-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099D8:EE_|MN2PR12MB4501:EE_ X-MS-Office365-Filtering-Correlation-Id: ff127777-244c-4dc0-5d9b-08dc17f8e4d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QOspj1Gbap2zxN38s/gpTk2yMIKO7Rzqg+PuTwRCyZjrGS6wTiH9HjW7rECtiMRs1LY0XDXTZQ7Wqryt+GsnitIroynKg73xiZ6NJ6+8ec5ICfj3ZA6R79EXXIjZAGMPPu09Q2u4f8Kb6cT4H3uXS8UGqE409HRk65GTIJMXDd/U7JE8FXdII4EEDy3wUf1eEPmcR3mQkiskM8g2o5nAE+G6C6YfMw4v+2dBhUVX2b/lIKqW8dyD3JIwLxV8wAu/Mvl2pJuaUwLteJRhBxvl65Zr7ke/8hyIOTFXSpqZBtX1YY0aBcuOzH1yoixRsilnUamEnMwX8YHf8CYh23cBMtWCpZdx19UnFBI1BM5X8PXWlReeVxQ0q2gOEa1Fp1RtozqSO7tIb9qcL8KBcCfhDPXhFhrw/OAB9eBZVIPmzhQaqMHl7+BKkAi+swLlPShi7wkHZNa87XYmV7jN1trvhFjFIELZWCqzlm5jn9liZV98d7vThhQ89dafzFlYa02KSFqyYwzPLFFK7/pX72rD2CIxHs/NwFbwqz8rIJCN9gCKWhtp9WiDFS7hxCIoZQ6fclhZf0vLbvAJqowczCnmU7llTXjwgOn3xdnAW00ohIUb8HABxOfFWrp9eyorkPWI7pXWqMtgRgndXUkPYOO6vq+/TSf4JjqmQ035m/K+X9bMcIRtrmOCQgvHWAEPcqjStk7eHA02/9kJVX86G1/QxxVcLl1rRZy5mg9jIal/BSxzwfS7oAGzMiIcTYNUOCzivSgCs/4cXo4S7Vr8BXAXhvPA9HwKpkTbd8AJkmPbE84= 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)(136003)(376002)(346002)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(82310400011)(40470700004)(46966006)(36840700001)(36756003)(26005)(86362001)(356005)(81166007)(478600001)(40460700003)(2616005)(316002)(41300700001)(336012)(426003)(40480700001)(2906002)(1076003)(70206006)(5660300002)(70586007)(54906003)(83380400001)(110136005)(82740400003)(921011)(47076005)(8676002)(4326008)(8936002)(36860700001)(7416002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2024 07:41:33.7241 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ff127777-244c-4dc0-5d9b-08dc17f8e4d1 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: DS3PEPF000099D8.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4501 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240117_234142_363390_4A52DDBA X-CRM114-Status: GOOD ( 15.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 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(). --- drivers/tty/serial/xilinx_uartps.c | 35 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 920762d7b4a4..787c7cbc6600 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,7 @@ 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)) { writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IDR); return; } @@ -587,6 +602,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 +642,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 Thu Jan 18 07:40:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13522443 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 BE2D5C4707B for ; Thu, 18 Jan 2024 07:42:08 +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=xX4LPITeuAUs3BmU4trbWsram1S2JvxMIorZSsdxCCM=; b=YtPZF3rNXI7W3G TXVcoS+44vbfP2Xe5LKj8txI7SPefKXqNDw+sts30RV8cfAyotNY6W8vYyMUsgBo0YnCacfszCx+y I8D//9kHxX1JcxgxQKb0YkbpCy6Dnd+peuBx1Onpe4ddIegLHO2H5ZlCG830zRRoqxDHo2JlgIIXO kF+VZ6oEHRhX3itaM7inU7gVzovT0AEuROXjYDkkqHEz4FEKw7zcFC/Rgt1xfyip4RgUAb4VqUjkg VOnCdVv32m/gGqkhvko2hh/cALXQfjzH8JmRIIv2HygJrbqxZ9fSV5bN8gGycaiRxlaQpDKkD8x/v H/qix/ZAkQMAoWzhmxQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQN1y-001x9f-1X; Thu, 18 Jan 2024 07:41:42 +0000 Received: from mail-dm6nam10on2066.outbound.protection.outlook.com ([40.107.93.66] helo=NAM10-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQN1u-001x8R-2Z for linux-arm-kernel@lists.infradead.org; Thu, 18 Jan 2024 07:41:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c5yMuH+WfWmmijOm+v0WOp1z7TGitYvjhCoBp/IPVu9dhMOhFQTFLpxQ+ry25odiXd1D625KsMdGAV6JJQFD5FdcBLbQEXqPaK43KUdpb9QmbhFA0GQyauA1vkNruGsOKftDYYPkfpLRcy0OgcarNs/6bN1puNoK3sjI41MhwhAe5knTX/Xa2ViJZgcx7brO2oaM/vKtTBj/Wk4S2jUVc3RFhD4gYADQT8YWFhBA2VYdiFqe7c9InQDutKlYQLWFQP6glweMlkHc+zgoE2rZA3xMubTmVhNY35ITw3GHRAWylgD6mgrS9tDNOZwS6Yx1L8xt/1uIDiOz1TcmFqtz0g== 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=k0R0b/68K3XuEVfQBiOCyt/q5AqIzJhnRyV8cytIM0A=; b=jjQvJAK8qjtfq+DGRJ9OZHjjhGlez5h62uW4xBHFHG+f6UODJ5DLsmRlA0+Bpf7MEma4vrAdo0sn2pOTKqpV7HBcQpk6VbXUELByTOQt4UO3CSTbmNMjx647YlSoE9/GarrYGEHIA4umJx3ZYRaSDZ6/oWSK4b/PNvm6ED3Fb4bb4Wc56j6hyzhQ7z8D8zE/J140/wpSRbUJwNv9wTf4H9Cq7A1pKkDVC0aOffeQqdNfLtE+pQBUsKwFC2Dduxi2XLa2LEUM7Og5wmUMF+J4fCS0uVqHfRvJrXWmgGdDGiYkF+j7ZWb44pcnFOORHtRrbPGrWvcjA62pHNGirghDwg== 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=k0R0b/68K3XuEVfQBiOCyt/q5AqIzJhnRyV8cytIM0A=; b=OLsaaRplKVpvbLaY/4SsRDPpbTcw2HT//V3ewJqTbPsnlRBsBGcPZRQRnkVm1D0Zxsu3qM/1QC6kuH/vGGlZpUCUaHETwKiZZybemXKW1DkWZl97PqHX/pPxwEWltkQ2QLrAAU7sGi/EBbNRw3pW1XIM731WCKbyjk7FUA4BjqE= Received: from SJ0PR13CA0032.namprd13.prod.outlook.com (2603:10b6:a03:2c2::7) by PH0PR12MB7790.namprd12.prod.outlook.com (2603:10b6:510:289::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.23; Thu, 18 Jan 2024 07:41:15 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:a03:2c2:cafe::9e) by SJ0PR13CA0032.outlook.office365.com (2603:10b6:a03:2c2::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.23 via Frontend Transport; Thu, 18 Jan 2024 07:41:15 +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 MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7202.16 via Frontend Transport; Thu, 18 Jan 2024 07:41:15 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Thu, 18 Jan 2024 01:41:14 -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; Thu, 18 Jan 2024 01:41:10 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V9 3/3] tty: serial: uartps: Add rs485 support to uartps driver Date: Thu, 18 Jan 2024 13:10:03 +0530 Message-ID: <20240118074003.2334348-4-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240118074003.2334348-1-manikanta.guntupalli@amd.com> References: <20240118074003.2334348-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000989E6:EE_|PH0PR12MB7790:EE_ X-MS-Office365-Filtering-Correlation-Id: 11ff1455-7ea0-49e0-aa57-08dc17f8d9ea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zJ4zpVnwhrNNBP4lSkDBO6KxfhSrnQjdrMm3wGKPhuqY9gBbLcKHwi+JElDEb6Xo7smOeP9mZFJsahJeTINpD2KC8g4x+kCcoXgOYwQR1klYVowVDC+fRsFN7pWSGcP+G1gVcqkNWaKuKgeMt7Y3O5SEzP3Tule2iGaBceY1oAnx7AoqOzM0ZmBLZWTdbUwVF0ez78G8bZI4Y+DuN9AfszhJQ5BfvuRS72V/JjSwQbbXtj2QdEtI4rzObWz74hEVKk0kKJKafAPEuXgRgcrKzGGApfYXxt3GzSmEsvXmlvstt/7jKoYc48Agoph0jT3wfhU221d9zUwPZMd1YPYsqTHWO0NWtMRYPrJNLrmA3EXoCP8X9qkj/HwnZjh3EU4iB8USNQkYTLhrVTcZbBHHYj/kKZbvizAP//IQIpEnhktOJVpj42KTY75UfFX+sdWv2j6s8oFkbzsCeMCs7PsrqWwgB+jzS1GMUK6AoHuyRIkV/qzRfj0Sn4MC+Y4qRaZxCwJWkzEHBLlgi92GYGlpq4RMjgsmHuTf1KEpmoOcRXtNGeXdds8dchOk/SoBXFO3Yn7XStGbiHRNLXPXR/RrDXwzgs3Y1565uMRsM5of6lxUervjg5K+pgsuY6HiXX2YTgDied7m9USGo4MqALQHqn+42bf/AsUl3yWWs2ZKfzpep8Zp21SuFSCMvDi94CqM2nV0dKMHFWPh9MeMAfzO6s4uQwqLU86OV3MgeeQu1UV+3rBe0xrx2I5RsZigNtzZcyia+sMPForBrNfyZwojVkGp91ZydE68OJBJ/FT5P7c= 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)(346002)(376002)(136003)(396003)(230922051799003)(186009)(451199024)(82310400011)(64100799003)(1800799012)(40470700004)(46966006)(36840700001)(82740400003)(30864003)(41300700001)(86362001)(36860700001)(356005)(5660300002)(2906002)(36756003)(7416002)(81166007)(316002)(2616005)(6666004)(70206006)(110136005)(70586007)(54906003)(478600001)(83380400001)(47076005)(44832011)(4326008)(426003)(8936002)(8676002)(336012)(1076003)(26005)(921011)(40480700001)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2024 07:41:15.3724 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11ff1455-7ea0-49e0-aa57-08dc17f8d9ea 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: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7790 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240117_234138_884516_E53138AB X-CRM114-Status: GOOD ( 24.69 ) 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(). --- 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 787c7cbc6600..c44c77b3e54f 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; @@ -347,6 +444,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); + } } /** @@ -579,6 +686,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 @@ -586,6 +708,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; @@ -605,10 +728,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); } /** @@ -618,6 +747,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; @@ -830,6 +963,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. @@ -889,6 +1025,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); @@ -1034,6 +1174,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) @@ -1456,6 +1598,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 @@ -1598,9 +1773,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); @@ -1619,6 +1808,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) { @@ -1647,6 +1838,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);