From patchwork Wed Dec 13 13:00:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13490978 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 9201BC4167D for ; Wed, 13 Dec 2023 13:01:21 +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=Cv4eyVNsnsShNYwk2D/aSx8AmkluWO3Tx4nwr+Q8fV4=; b=pFjQqeRCSUDvyf wW2QLyl0nlbaLmYW40wka1nTxXVuWyW9wxJAswRiF9om96qBvozUdeGBejXIwSq155tYt3CAFXQKN jNRf7s6hLoBCWdXn5bG40L8P39id5FyXeBymUNle3ORcfE91z7R4Xowdd59odo4jWckh5La3Wp9g5 pIQobigsy3wl8wUv7ZS/3IW4YfiM1fACcBOiWnlgDw40iQFISzQhcJ1m24SvTo8YCLA0a+DO3GZLp iteYyKbrvwQopwboNc2xHxe4Mucx0Wf6MQ/khCrb3/jO7Yn9j2XjsBPsrDCcDqxv7ZypyLlH1SGQ7 MCyUBRflF6a1xaysqKwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDOr2-00EiQq-34; Wed, 13 Dec 2023 13:00:48 +0000 Received: from mail-bn8nam12on2060e.outbound.protection.outlook.com ([2a01:111:f400:fe5b::60e] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDOqx-00EiOa-0M for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2023 13:00:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fwdhcR/yW20/Av0XSgSvi0p8h5Hxq3gRyeaQE9OD5G4cAb0MpAzT/3UggRpFhoQl/OggIceHe4fMzDKq2KeKWf+nCyMeInOQNYqhmbRUHUanvk5PrOB262AF0TfHN4sTAU8C/Wzb2cnUv7p/haMebLnWayqy1FJj9gS79yyb/AtXYoK83TLFoPXIoZfXClHpC+ntPA1yW9mi1dylBIxRTS5ZdRLCh1kz0zhJ16RZhFnOi4jGn5aF4yXwi0W6d9i5s1MmFRNq70VSWz+Q62xjKIulkNOt+tPZ8i3mmg/zibIqW1FBWpYfaHVmmCgWdSaIY/zKK9IF5GB1Gn3mjYdp1Q== 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=35jqh8vE1almpzWeYtvjRI5IHuT/PnpdFJaNEJh40Oo=; b=k1nlHx7ZPvr//ab5t3N5C1U8aVXVNT8v0ZwTu78uqD3x/2X3YfU6Sg8FDV8n0ihkVNCaPe2bC9oPo0NWsHU2gL+8SNmJxnh3rrWY21IuUQC9lq1suOGDQxbwBzeT8/paD/f0lptoctwgkrBP6MCWuktDCvriXhUiAJrdalJBgoAIitD4vgtXqeicLFuk8UoUoTMnpiAAxG1m9eTOyxc1z+QCt4Fs8Sg4R5mPPiva5k7z/oVTwskYvNytpk43M/0lZHRcJ9kJABfH++xrsrDFCPKMcvbkKt8j6ty96f7DgokOCJMmJXrBYfF1wdutqXM6pcxLhuoODvTzl5tWPS+Qqg== 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=35jqh8vE1almpzWeYtvjRI5IHuT/PnpdFJaNEJh40Oo=; b=hnMFG6BHyRvF8RtbUJm+1ksjShBAGbLSAVvpVIBPyj0ieif/ge78BJ5bcLYLoDSpq8WjAt1e/jHx+JFNnz4s6MqfUKLrh4OedJEbOvxNBOa6GIZepwri21j7WzffsIaRRPSdxjSqAqn6BKdeg9XpFSCC4MLpYE3sScUgEvz0y44= Received: from MW4PR03CA0009.namprd03.prod.outlook.com (2603:10b6:303:8f::14) by CH0PR12MB5347.namprd12.prod.outlook.com (2603:10b6:610:d6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Wed, 13 Dec 2023 13:00:37 +0000 Received: from CO1PEPF000044F5.namprd05.prod.outlook.com (2603:10b6:303:8f:cafe::96) by MW4PR03CA0009.outlook.office365.com (2603:10b6:303:8f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 13:00:37 +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 CO1PEPF000044F5.mail.protection.outlook.com (10.167.241.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 13:00:36 +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; Wed, 13 Dec 2023 07:00:35 -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; Wed, 13 Dec 2023 07:00:35 -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; Wed, 13 Dec 2023 07:00:31 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V5 1/3] dt-bindings: Add reference to rs485.yaml Date: Wed, 13 Dec 2023 18:30:21 +0530 Message-ID: <20231213130023.606486-2-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231213130023.606486-1-manikanta.guntupalli@amd.com> References: <20231213130023.606486-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F5:EE_|CH0PR12MB5347:EE_ X-MS-Office365-Filtering-Correlation-Id: 003624ba-8a9a-4049-f5d9-08dbfbdb8037 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JntX/WxlC2zxLIWwVkDS78GvYixWDu6rpijdQfGw+4c7aGik1V6WSAIBgSMo+5wMuYaxJhcNos3tS/R9iWdFdFxWihu3fQYfrRl9d9zfy+TpUWeMN9RZiIZxqQScudZjL8d/mTlRE6xoSPrD8zuwzp7LZiUC4m5bgS4EdJePb0U5nDAVjqlGPovwTQtsE7xBqlgNKkDIWMebFy4J4l7rh9MC1XDigRyWBtbsWS++Pmc+7tWy6IskyIoDflcWekNbZPkntsHFLMSQxv9kqBxNdTdTUmpLyVhk7EEQdWEr4fQHBTaVKmx2FpC8dh84o7oUCSNY7wCpSIQxAOF9/UGEke+Zwp48xtmQUFDbSg/+tqYibFIPB7hY4yT+NbXCdwVeEoUJPPF9HQfhWDcjqrW9f2wYGVd4S7LXuYf+he4c0lpC202DgU2Bye+uLniH9/gxF4fxTQXS2+kKrNLHj2vKEGCTYBPJivffzoP5z2gbQZElGaZTfg6DAzUGqJqelVxR2l+HJyQaM3hhDPNWC0nCZcQc/F6QG6Tg5l3t6ExG4HxYnK6qGxlJdf6ggL5lrG6TMBqkT5xuekzJdmc1l/dWNoZ/FVxR3MxuaIaOdPz4zLt5BU4ILqbgaYM4BqIxmR8ZgxP7VGsEKAAaEVfcRLVt/xcfbdr3EcK5ZMFYhrCVhYfkJESzJPsy9PuV031b7NitcwzApJ+8FvH02d151LgUeF6PJWBIZf3F9frTsdMcoUVwZyQ+D7iD8+aQy9c/85OjRemEFkKinLP4MiPI0iM8H9ELpPQJm9ZNOWKHt+9UNQU= 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)(346002)(136003)(376002)(39860400002)(396003)(230922051799003)(186009)(82310400011)(1800799012)(451199024)(64100799003)(46966006)(40470700004)(36840700001)(921008)(40480700001)(40460700003)(110136005)(70586007)(70206006)(356005)(82740400003)(81166007)(36756003)(86362001)(47076005)(36860700001)(426003)(26005)(336012)(83380400001)(1076003)(2616005)(2906002)(4744005)(7416002)(54906003)(316002)(478600001)(6666004)(5660300002)(8936002)(8676002)(4326008)(44832011)(41300700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 13:00:36.8274 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 003624ba-8a9a-4049-f5d9-08dbfbdb8037 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: CO1PEPF000044F5.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5347 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_050043_157639_252163AA X-CRM114-Status: GOOD ( 10.03 ) 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 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. --- 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 Wed Dec 13 13:00:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13490977 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 83877C4332F for ; Wed, 13 Dec 2023 13:01:20 +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=dER/AFl4BbOTj+cNnVebwS2i7+GglVkeU4lum4u89aA=; b=IuIHDFD+OASarO m+M/Mi7fJ9yWFO6walMhfS7T0zxq7bs78oTSgi2RCaTzMQ1lFd8yKb/TnXfkgFCp9ym3WXsaRUbgO qkKs1J7WfmFd1+Ov2Q6+zKn3ykC8GvfNteqQEOO6yaNc0+hFnXoi+plKfVABzklZrQ4qZmne4qps/ qEK/UvS0jELepE1iheyDAJx5hJaWrlNbQ44x7xgFlHlzMZicfKZgH+yroi5poxxA+4ZMLaedB0PpJ VvMPBpYZtC+9VU618O7j7AQ2VRr6dwucktsG6CWwA2GmE79KB7VBzSqMj1Dy/IjT4WzdzoKA4AI62 otwBsNw4lmNWJA9yUw+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDOr9-00EiTn-1J; Wed, 13 Dec 2023 13:00:55 +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 1rDOr6-00EiQO-0R for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2023 13:00:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HW3UNcJqMIds5RaynhI1QJrhH5bVed+hlPVfkG7U/GX6Ztq4dUU/LP0/xIFtmqmyGcTd/gHLSluln1vF5kH36iHqPu13AA4IMdpFEFmgUuL77JIwIiPr8GD+SG31PSK1dzthx9kmtvPbuf9TJZyzooW/q0xSxyyWm/j0r0Q0seJanDR98DA6vr0O0nlFzuid88RT+w1c9HB6NE33ZVkkyN7SSqzenrZfjFmrGA/GHDcxolHyvSwyuZYSF/mX1k+QfDMyCGV8uX/l8AzoXLQoYn6J0nVT29RpTGG4lzSOenRRFczn/xnfv6DnzLPusYIJ18OOWO5RZTst6ipaEYXeTg== 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=0JvHfbXpkN5D+JpsL3NdBblQK/7zQGW+RUOvBT5szgE=; b=aZLJ9OucOxqioTH2mWnNSHGwxjF/v8wUtSVyUOYcuI4zgU3ClAQ+37JY/r3QLJlZJ9GzAe/Y93v33S5JlvmiNCK3IHwXL1tRudJcppfI/PL7JV6rWwiy6F8fHqNct/LQpKvVBFqAThxWf/0PckFNoLBhlOZah/+Kd1YDnAtC4er1SRawdKoqQfKzVpnfo2PDg+Ls2xBQ5kY1SMoDiCD2WL6AoApNTxykKlgVcj25/OGcRpUpqnv8cN1ZfqW2iPcQcS6CdNHutqDT05Odur2Uv3pIqBYcnwHoHYVrf16EALYxpoxHhY5tC0PDVnFy6p4EsFg/4sgMMGxOMF5rp4cumg== 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=0JvHfbXpkN5D+JpsL3NdBblQK/7zQGW+RUOvBT5szgE=; b=IPtTA5j9qmL5S+gIosxtIg3rUvobHnZZwAPdeUGvDqxDtvNhbE/n5OpHzn9l+rGhohiwlfkrlQLzOKlfyMth/PPPnGK0eUWTrYl9tCXwymdKotHwNAhLNUP1w0OIQKGJJRlLZPp0VigOeYbvcEq+4lMe8fLIQDFo95nLYdQMAKU= Received: from MW2PR16CA0058.namprd16.prod.outlook.com (2603:10b6:907:1::35) by PH7PR12MB8038.namprd12.prod.outlook.com (2603:10b6:510:27c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.32; Wed, 13 Dec 2023 13:00:43 +0000 Received: from CO1PEPF000044F0.namprd05.prod.outlook.com (2603:10b6:907:1:cafe::b8) by MW2PR16CA0058.outlook.office365.com (2603:10b6:907:1::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 13:00:43 +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 CO1PEPF000044F0.mail.protection.outlook.com (10.167.241.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 13:00:42 +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; Wed, 13 Dec 2023 07:00:41 -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; Wed, 13 Dec 2023 07:00:37 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V5 2/3] tty: serial: uartps: Relocate cdns_uart_tx_empty to facilitate rs485 Date: Wed, 13 Dec 2023 18:30:22 +0530 Message-ID: <20231213130023.606486-3-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231213130023.606486-1-manikanta.guntupalli@amd.com> References: <20231213130023.606486-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F0:EE_|PH7PR12MB8038:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b6d640a-6fba-457c-441e-08dbfbdb83c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sp3V3PpfyBNviPXCU9+Zg+fpIjAidXFe/RVuVsZjg/FLU6VQio3o7QHEmPnOGH2prvimvlZb+mcf3ExQgalLv2dz3giq9vNKE5BcuHDYiQQCbF11kcg5yep6BmfW/cr2bRs5pRVCWsMXqZ+cFrrWiD7a8UO2pElROs5SQ4f0Yi6j35R7m52LH34S6i1v5JC9ewBHH0CaodXZZyc/ezCJD4YO7RnvnIcYi/SOkybU6OeCBMKpAa9Seu2tbkH6d6vL2C0tNC0JIPIRJET/bfkhH8g7sjy30qXRF5fnuL+dErJyvNGAtZ9E5yxr9Zpfkiu15TxOZ1pXNs89QqplJFkCZMS2ohfxqg1l3lUfWnn+NgWr3EDibbE0pEB9k1AjC5TuvB3Q/EhWUyu5DRgHAXb/Csncg7fMuFylFGOOD//o+qe3MfKq6Pqgk+za7HSVjK3TkvUQZkpIHFYNVsSKIquaBU3FlJpdwBbPHfTK6+g77ky6rhQ1d2DoI8f34fmPZRPDeNy5TjfzBS+G0aWhVgZ+pwJgCIINTcHt8/1SxTPRA5Thde12yLfYH67csSKGerPxqsAUKztXB5kAZwugJt/qeU8raBzM9S1Fb6APd9cmXuHq1+De1/T2ZNjQxzYhhXc8S9YwoAlUmC2HvL6E5XdZ3NL+kEVWrnwqvx+tqyKPvxGBEZqV+uenHUCC5Z1/wiNkIQm6B0d0VvpbqTBlfGXkUTe7lxJgzXkCt1TkiGcSbR5nl3JqIl1DxydebHdJU8UzPaoYBRkISHdX7VuEQWGaAE3tDsyAnkBQknOzhcV6e1E= 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)(376002)(39860400002)(396003)(136003)(346002)(230922051799003)(451199024)(82310400011)(64100799003)(1800799012)(186009)(40470700004)(46966006)(36840700001)(40460700003)(426003)(336012)(1076003)(2616005)(26005)(6666004)(36860700001)(5660300002)(70586007)(44832011)(4326008)(478600001)(2906002)(41300700001)(54906003)(8936002)(110136005)(70206006)(316002)(8676002)(83380400001)(47076005)(356005)(82740400003)(81166007)(36756003)(7416002)(86362001)(921008)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 13:00:42.8647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b6d640a-6fba-457c-441e-08dbfbdb83c5 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: CO1PEPF000044F0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8038 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_050052_179019_37F74724 X-CRM114-Status: GOOD ( 12.75 ) 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. Signed-off-by: Manikanta Guntupalli --- Changes since V4: This patch introduced in V4. Changes for V5: None. --- drivers/tty/serial/xilinx_uartps.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 920762d7b4a4..aafcc2179e0e 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -305,6 +305,21 @@ static void cdns_uart_handle_rx(void *dev_id, unsigned int isrstatus) tty_flip_buffer_push(&port->state->port); } +/** + * 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 Txed. * @dev_id: Id of the UART port @@ -626,21 +641,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 Wed Dec 13 13:00:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13490979 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 3818FC4332F for ; Wed, 13 Dec 2023 13:01:34 +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=yXZ/V1isvCWF7T/rP+DeP/rQ977BNj3hpwztPktrrdk=; b=G2lIUEdFylpaLG CSM9H8Q/R+/g0mIc2pbB+7dvvMM5Bqua8ejKDbCGJcCol8VOkkNhyz0C003pbQHTaR08y0qk8TUIo B61V4E+m1beIEOOwtU/xQo4BXr5Ao2kg3vAHYC/oBviZa4TvR2lqMdy/BA/Qi0tW2gK7b0sSxSWO9 WURnScLbZjvuKCdbYdOnkZZTaRP8TqVqaIhj0Xzvz2FeBMRXTxws+kLEdrqmKd1jpioMuuTEtYn5v pBJL4W7hcgQn/6Rhy79eFyHo/DULepwhOgzsf/qJrPHcgaFHorHce3gMs+ubYxF/5NxGJ7HgV074p ZDkhjxjC0/rfxTr3714Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rDOrF-00EiWZ-0e; Wed, 13 Dec 2023 13:01:01 +0000 Received: from mail-dm6nam12on20621.outbound.protection.outlook.com ([2a01:111:f400:fe59::621] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rDOrA-00EiTV-0O for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2023 13:00:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SmNRtL+dBEh9ZTtnmZEGMvXJt5qrP/wttLS97izRe5pd1cSGNOjDdsWTxDzhqJv4JfdonaM3DGdO/isTrwNJLiillAdVRkNdE7yCO5Zm2To+xXQCVv8b6k3dCQAsCMlfRR3v6N5GpbmFcvfiz0JcmndkevaLGaQMemjLJeiBkXVj4Agul7X451UVO+8Jzkruuax98d2QyaIUrNRU3eqiYqgvwlnINM+PP34TNiQdXp/QxQuJSsMcTRKvIzoBtC6HSEh8+GUnjgf0veDhyGSCneAPy1AniUSsXVeeGys86d6JrAHTcDyrdMfe82cfBDLDceKcsPxN3fC8eIPzZtZDdg== 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=jfipSkX2ShXVH2nLxMrS4KxI3KEEX1macjPlZrRk+rs=; b=JGb41g+44l8wukCFQj0m9kQW7EgXq6ZznBDmaZUNtt7OOXW+fEzqkko3u57MP3yt2dx4N+dQVsxuKqvyUra24Ow/pz+jTPMyWQYP6XcqnJjL28auQ34JE57SQhwyhhV2G4OYqGxx+QyVuwdSVrtBxAeWDJjOfJRZ4qvShfu9sp5Als4fO7YipY+rBcc0jHZ4MqEKPkHKk6D2ClP0nOEoL70gp066tWlyv+0Q1DnrP6R6Ods34XBq0VfErAz8jhXF36OuSn0L5/T2QFPJgB56SfWusaN1MfcaPnZ3pIV5F3oLrRo8SgyDDiNT5T7R68H+EkAPBOx5t8Mxvfm+e76ZlA== 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=jfipSkX2ShXVH2nLxMrS4KxI3KEEX1macjPlZrRk+rs=; b=4/4JaJIv4lJtUF3sJaUlsfJCQVFyrAxAX4ljI0ebxZwxgMbKZikYTNuoLuAq+zsPTXp4yLdWUIaJLdcY3MhRN/GUKfDITVOrhJUUzNq0UppqpXIPm/ozKsFDD4ZzCHYGnDJjD1CQM44XXi4/xhTpLTc5DjDfK/V+1DYzmvx+McU= Received: from CY5PR15CA0225.namprd15.prod.outlook.com (2603:10b6:930:88::26) by SA1PR12MB8162.namprd12.prod.outlook.com (2603:10b6:806:33a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.33; Wed, 13 Dec 2023 13:00:48 +0000 Received: from CY4PEPF0000E9D4.namprd03.prod.outlook.com (2603:10b6:930:88:cafe::ea) by CY5PR15CA0225.outlook.office365.com (2603:10b6:930:88::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 13:00:48 +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 CY4PEPF0000E9D4.mail.protection.outlook.com (10.167.241.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7091.26 via Frontend Transport; Wed, 13 Dec 2023 13:00:47 +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; Wed, 13 Dec 2023 07:00:46 -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; Wed, 13 Dec 2023 07:00:42 -0600 From: Manikanta Guntupalli To: , , , , , , , , , , CC: , , , , Manikanta Guntupalli Subject: [PATCH V5 3/3] tty: serial: uartps: Add rs485 support to uartps driver Date: Wed, 13 Dec 2023 18:30:23 +0530 Message-ID: <20231213130023.606486-4-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231213130023.606486-1-manikanta.guntupalli@amd.com> References: <20231213130023.606486-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D4:EE_|SA1PR12MB8162:EE_ X-MS-Office365-Filtering-Correlation-Id: a530651e-1f2d-4e48-00fa-08dbfbdb86b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3w/iD92pMfky6vAsH3lIslIajPFsDarxMlO5EB9ujseVcYZo9Wi7E8dDBpUe7ckqgf0irgRvQ/lRIB6Nyw1u7SF5RPN6kPmxj2R+0nBi3BT9Zwz+s86e7KkoxijPek4ofnHuuyqTme5N47/pAnZClM4qKH4RNg0lukOUOM+5kpB/jB6OF2t0iiwhkpamijK4k7JIla2xEj8nYyrPMx3B3xdKqIUFGIFAerZBrJQmQ4m4pfEf4tPdzm5x4MxA+RGAYDyb+LJZxG649ZomGr44GUMOojMN+pmze1YoNIm+u3FY7EiPwPmOf9tYRcGRaFNS2G5B+N1a3cBmoa36aqpn0/z9gDuUsqCrJ98FmkEFhzNRwDBUpGz0i2L242byVTG3jn5Krvg8GwmzI5u/GSbV9yGVEuh/u9Az+M6gpVsQF3EcNaHSuN3nIfR4ib7ftihq/gAObc+16x6R37apyC+k5hAmL7ijMHUbw9qQ1Nw7A//xGJVUFhdrbeB5u1MATYMPFo3nu5pOxv2aaf7GQtJa+6amfBDedO5i1zg3CLUUh6/zChC4UxNQFBLxB5eP/bu5ePq7EO3g0Kk2phjqgX55DVGxIRhW2C04/wF4RplR4pIpJgZtcqfnuuEWE8gfXwoLAQ1OeJmob2Gq+FppLcdMoOrmNkwYXXo/wMdsYUMwpNAXD1URuSLmbBkwTyV1scz9mDtHzEa6pio4iGEpcmF5B0K9/4q52HNt32RPcz/eRwpOhyKaKtmRR28Yq5UzYVmhAlAoyh4SmZu978bqJgXAadRBZ4c6OJSdXTY4t8VarWs= 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)(451199024)(1800799012)(82310400011)(64100799003)(186009)(40470700004)(36840700001)(46966006)(426003)(40460700003)(336012)(83380400001)(26005)(1076003)(2616005)(36860700001)(44832011)(47076005)(8936002)(5660300002)(4326008)(41300700001)(7416002)(2906002)(8676002)(6666004)(316002)(30864003)(478600001)(54906003)(70206006)(110136005)(70586007)(36756003)(86362001)(356005)(81166007)(921008)(82740400003)(40480700001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2023 13:00:47.8513 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a530651e-1f2d-4e48-00fa-08dbfbdb86b7 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: CY4PEPF0000E9D4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8162 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231213_050056_206900_1F089435 X-CRM114-Status: GOOD ( 23.04 ) 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. --- drivers/tty/serial/xilinx_uartps.c | 214 +++++++++++++++++++++++++++-- 1 file changed, 205 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index aafcc2179e0e..3e1045896812 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,10 @@ 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 + * @timer: Timer for tx and rx + * @stop_tx_timer: Timer for stop tx */ struct cdns_uart { struct uart_port *port; @@ -203,10 +209,22 @@ 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 timer_list timer; + struct timer_list stop_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 +323,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) +{ + if (cdns_uart->port->rs485.flags & SER_RS485_RTS_ON_SEND) + cdns_rts_gpio_enable(cdns_uart, 1); + else + cdns_rts_gpio_enable(cdns_uart, 0); + + 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) +{ + if (cdns_uart->port->rs485.flags & SER_RS485_RTS_AFTER_SEND) + cdns_rts_gpio_enable(cdns_uart, 1); + else + cdns_rts_gpio_enable(cdns_uart, 0); + + cdns_uart->rs485_tx_started = false; +} + /** * cdns_uart_tx_empty - Check whether TX is empty * @port: Handle to the uart port structure @@ -579,6 +646,42 @@ static int cdns_uart_clk_notifier_cb(struct notifier_block *nb, } #endif +/** + * cdns_rs485_rx_callback - Timer rx callback handler for rs485. + * @t: Handle to the timer list structure + */ +static void cdns_rs485_rx_callback(struct timer_list *t) +{ + struct cdns_uart *cdns_uart = from_timer(cdns_uart, t, timer); + + /* + * Default Rx should be setup, because Rx signaling path + * need to enable to receive data. + */ + cdns_rs485_rx_setup(cdns_uart); +} + +/** + * cdns_rs485_tx_callback - Timer tx callback handler for rs485. + * @t: Handle to the timer list structure + */ +static void cdns_rs485_tx_callback(struct timer_list *t) +{ + struct cdns_uart *cdns_uart = from_timer(cdns_uart, t, timer); + + cdns_uart_handle_tx(cdns_uart->port); + + /* Enable the TX Empty interrupt */ + writel(CDNS_UART_IXR_TXEMPTY, cdns_uart->port->membase + CDNS_UART_IER); + + if (uart_circ_empty(&cdns_uart->port->state->xmit) || + uart_tx_stopped(cdns_uart->port)) { + timer_setup(&cdns_uart->timer, cdns_rs485_rx_callback, 0); + mod_timer(&cdns_uart->timer, jiffies + + msecs_to_jiffies(cdns_uart->port->rs485.delay_rts_after_send)); + } +} + /** * cdns_uart_start_tx - Start transmitting bytes * @port: Handle to the uart port structure @@ -586,6 +689,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; @@ -604,10 +708,40 @@ static void cdns_uart_start_tx(struct uart_port *port) writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_ISR); - cdns_uart_handle_tx(port); + if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED) { + if (!cdns_uart->rs485_tx_started) { + timer_setup(&cdns_uart->timer, + cdns_rs485_tx_callback, 0); + cdns_rs485_tx_setup(cdns_uart); + mod_timer(&cdns_uart->timer, jiffies + + msecs_to_jiffies(port->rs485.delay_rts_before_send)); + } else { + if (!timer_pending(&cdns_uart->timer)) + mod_timer(&cdns_uart->timer, jiffies); + } + } else { + cdns_uart_handle_tx(port); - /* Enable the TX Empty interrupt */ - writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IER); + /* Enable the TX Empty interrupt */ + writel(CDNS_UART_IXR_TXEMPTY, port->membase + CDNS_UART_IER); + } +} + +/** + * cdns_rs485_stop_tx_callback - Timer stop tx callback handler for rs485. + * @t: Handle to the timer list structure + */ +static void cdns_rs485_stop_tx_callback(struct timer_list *t) +{ + unsigned int regval; + struct cdns_uart *cdns_uart = from_timer(cdns_uart, t, stop_tx_timer); + + cdns_rs485_rx_setup(cdns_uart); + + regval = readl(cdns_uart->port->membase + CDNS_UART_CR); + regval |= CDNS_UART_CR_TX_DIS; + /* Disable the transmitter */ + writel(regval, cdns_uart->port->membase + CDNS_UART_CR); } /** @@ -617,11 +751,19 @@ 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; - regval = readl(port->membase + CDNS_UART_CR); - regval |= CDNS_UART_CR_TX_DIS; - /* Disable the transmitter */ - writel(regval, port->membase + CDNS_UART_CR); + if ((cdns_uart->port->rs485.flags & SER_RS485_ENABLED) && + !timer_pending(&cdns_uart->stop_tx_timer) && + cdns_uart->rs485_tx_started) { + mod_timer(&cdns_uart->stop_tx_timer, jiffies + + msecs_to_jiffies(cdns_uart->port->rs485.delay_rts_after_send)); + } else { + regval = readl(port->membase + CDNS_UART_CR); + regval |= CDNS_UART_CR_TX_DIS; + /* Disable the transmitter */ + writel(regval, port->membase + CDNS_UART_CR); + } } /** @@ -829,6 +971,12 @@ 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) { + timer_setup(&cdns_uart->stop_tx_timer, + cdns_rs485_stop_tx_callback, 0); + cdns_rs485_rx_setup(cdns_uart); + } + /* * Clear the RX disable bit and then set the RX enable bit to enable * the receiver. @@ -888,6 +1036,7 @@ static void cdns_uart_shutdown(struct uart_port *port) { int status; unsigned long flags; + struct cdns_uart *cdns_uart = port->private_data; uart_port_lock_irqsave(port, &flags); @@ -903,6 +1052,11 @@ static void cdns_uart_shutdown(struct uart_port *port) uart_port_unlock_irqrestore(port, flags); free_irq(port->irq, port); + + if (cdns_uart->port->rs485.flags & SER_RS485_ENABLED) { + del_timer_sync(&cdns_uart->timer); + del_timer_sync(&cdns_uart->stop_tx_timer); + } } /** @@ -1032,7 +1186,7 @@ static void cdns_uart_set_mctrl(struct uart_port *port, unsigned int mctrl) mode_reg &= ~CDNS_UART_MR_CHMODE_MASK; if (mctrl & TIOCM_RTS) - val |= CDNS_UART_MODEMCR_RTS; + cdns_rts_gpio_enable(cdns_uart_data, 1); if (mctrl & TIOCM_DTR) val |= CDNS_UART_MODEMCR_DTR; if (mctrl & TIOCM_LOOP) @@ -1455,6 +1609,31 @@ 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; + + 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); + /* Disable transmitter and make Rx setup*/ + cdns_uart_stop_tx(port); + } + return 0; +} + /** * cdns_uart_probe - Platform driver probe * @pdev: Pointer to the platform device structure @@ -1597,9 +1776,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); @@ -1618,6 +1811,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) { @@ -1646,6 +1841,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);