From patchwork Wed Apr 24 11:29:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manikanta Guntupalli X-Patchwork-Id: 13641755 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 5B210C4345F for ; Wed, 24 Apr 2024 11:30:43 +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=nEJFODGqzWxPKRt7bqNgz2pIqsNOhijICTWad3gD4hM=; b=MhVv2YPOQ+JOLW Rsdu9YkyGzqsQ3tgxFjnvzojNOV6Hwxq8NVPQTb0U9qpgjiT/0E/NoY6CmWkH8B2WxTNgBRTVRGnK 939jXR6csdyZz/gGuYy+NGn9e+2t8+PY8DUPhsYUENEUPnrdIiy7L2REQ44A7f3LxSriFN48ZRevi PuZ83FY4Xy9xi0517vxA24BCD2WGcu77Qdd2Ayn5JeYs0Ypy55hcKjxN2cWtVM1sGN3G0h8a4kY28 bjSEzllreY1DnH8UUJliF37RwC66Ci0sSTzonHZlrS+/hRfccqhPeJCGyDOYRB6ybfxiG3X/VrxU3 fktgvsrM548jLmBIugAA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzapa-00000003uhd-0PGx; Wed, 24 Apr 2024 11:30:30 +0000 Received: from mail-dm6nam12on20601.outbound.protection.outlook.com ([2a01:111:f403:2417::601] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzapO-00000003uaY-3uX6 for linux-arm-kernel@lists.infradead.org; Wed, 24 Apr 2024 11:30:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lieEsGdC0YMKO4ClhrHHuxJnEIbujFFqgmVYnltRv6wXFIr4nMO+srlE7/e4Nx3dr/yILchE4BtKMciIGAggHMvsgUMvBDQ+fDXZvHFjvhNxQ/8RHEYZHAB2jihm40HebiGa+D0vCs26xqfaie1klGXtPD5tfnHIOzehea4H0rqpAuCaGS4oiFNv/4fZVXBOcZ2J6oimcCTNXPrLFCNx8q33DaiB9tDL8o1c4MALzQjyh6ZOk97Kkx4oAT4rNqrEF5rmzyYb5JuKIvUdain5Di+QYL66MEfR0cb4a1f/YsyDfQpsOEJtLNpyOj/oVCPnVc2iaRaQZ+6JtHAAfpOp8Q== 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=41mm7Ynu02O+l4vOLQCaDhLiskSdxYA0WeiRpEEnxsw=; b=lMsCu+Zq3pLthbJgKEbLz95uRUAs2cART1X970PJroD3gUwyxTNyYEJ9JSTo7zTlM/BYBcFLz9BqTSeINWD8PKhOQppLJpWK4jOeSyamytiZmoaB13Bm2DpMPRvEeBMMDuYDZcAb3CmBglwcmwxiudKr/q77jtsTZ3N0DsbwTNUd9CVNyR+ph8ssR27Ci7XrH84hvM0G+5X8nVhe6oXUWpMMq+UG8AICotWSAc3vN9oLOcQTnGftTHdAA5ilufj9/uaT0SA4O9vwu7EHKMlkvv6HpUfwbDzieU6pufr9g9tbUNWjZY+L6HNS26zi4IAxd+SMU7ssQMelWvH3aqIBfw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.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=41mm7Ynu02O+l4vOLQCaDhLiskSdxYA0WeiRpEEnxsw=; b=FaHY5AETZnPemk6t1a4chco7e39OYs1dzG3j9kiRnOkJ6tmjmbwaSPvtlIqQljjt1a4s4q6C4wr1nFXZ2RMyaqKgRNe91cVY83zg8hZdtU3EELTDjJM9U2BBA4NRgtScNZDpJYaYgeIWtZUUD0Ze+PiyxPBAjXGmiFoR8EPjCLg= Received: from DM6PR06CA0010.namprd06.prod.outlook.com (2603:10b6:5:120::23) by DS7PR12MB5743.namprd12.prod.outlook.com (2603:10b6:8:72::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.22; Wed, 24 Apr 2024 11:30:12 +0000 Received: from DS3PEPF000099DA.namprd04.prod.outlook.com (2603:10b6:5:120:cafe::f4) by DM6PR06CA0010.outlook.office365.com (2603:10b6:5:120::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7495.34 via Frontend Transport; Wed, 24 Apr 2024 11:30:12 +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 DS3PEPF000099DA.mail.protection.outlook.com (10.167.17.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7519.19 via Frontend Transport; Wed, 24 Apr 2024 11:30:10 +0000 Received: from SATLEXMB08.amd.com (10.181.40.132) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 24 Apr 2024 06:30:08 -0500 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.35; Wed, 24 Apr 2024 04:30:07 -0700 Received: from xhdsneeli40.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 24 Apr 2024 06:30:02 -0500 From: Manikanta Guntupalli To: , , , , , , , , , , , , , , , , , , CC: , , , Manikanta Guntupalli Subject: [PATCH V2 3/3] tty: serial: uartps: Add support for uartps controller reset Date: Wed, 24 Apr 2024 16:59:33 +0530 Message-ID: <20240424112933.3528590-4-manikanta.guntupalli@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240424112933.3528590-1-manikanta.guntupalli@amd.com> References: <20240424112933.3528590-1-manikanta.guntupalli@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS3PEPF000099DA:EE_|DS7PR12MB5743:EE_ X-MS-Office365-Filtering-Correlation-Id: 8276e823-117a-4945-bbdc-08dc6451e6e3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|36860700004|376005|82310400014|1800799015|921011; X-Microsoft-Antispam-Message-Info: acIkmBbgM2OmqhAUMJv/QiEtfdb9l6heP5ehE+GKzzbpyoKecp1dqm8peivvCU2CXtsOT+SDJoFmIekGBXIAYc9IHC9WZbIDBCvvdYpYL/H7u53dermIzfOl01a3QL5T/2syzDg4zxvLHG3qPFW/I6bPJ95ffPuh0gqlF/xDHucW3Q4f3/TC72EmiLUM38LvF+00Xy7xOfAhTXCYAljIV1XxIQy2fogfozUIDc0bqEvy2d54KCLCvLL2cjmF+6jcFA83NZFGtm/vHEEI84uKnxbJNIjPSU5dY6Wp5U+gkUwEWFwaYY8eiEYmIZeMpS8+76M8mgJ14s7Mk3+59cyCcJ7/5TSQFKpOwPac3odtGYk2kMwCLKfqaXuNbh2jcTV+6zwEUmBGOTk8QWMYOjogvIsZCa3TLczBlVYF9EKiUEW5KJjLxoEjWf4M5wNZLUSPkTmd33yBfijVdAwHSm0uLe93nY09Kh9YaBP+Ghk3nDcvBJ8BbZzjxez4YJgcxBDWSp3/vrEhwael8gRo3FLQERjo4z9ydvLYydT3W8mXLffqzV6jZPLgyCVsQZzywMy6alcs/Z5LdplCMpCv+GNULgzY7KIHCKUxdxIUt7smRRJvY2esxQ2VQdbgbmQmYyAeuAnrygHGCxJK7KG2jI9zLZjr6/I3EFT05Jp/sEWk88qRpV6u3zcXjT/ytz8TO8TGp3v5QfrPQq3QJkeIjEscm+MZH7mXnIXzyGEbTwQgtpgvv/UTSb1rsx2fZtYEQZ5vpZluVETe7F1s7dRmg60F3wjpBiJQWujtaW/Lz2Oo6eOS1LifaF1nWP1US6y1DMQHjkMEq8566o6EMwkwzq//mL6ZTb2Rms/EMqQb/9i6fr5HBLi8mFRubQIWRHhUTKWrbEp61Fqu/9DMR0xDChmy/xGqUPxy/ZD4HOO+NWd2OpM4psSqrvsawpAPG46c1qqeYN8XolSDFw0a8C2efMeQJn9h0hOr6i+47MIi8vvW6p1sr9SyO1GAN8RntNtxo6P7WjfgZKFW4MRKBTMHmFqsZZBnooOQefW/1oe9XLG8TKejx8TfE6BqGdeT2teS2qs34JhZOM+aS64d1Fa8mVycRmLXCZNVaO4oLg2JADLb+8OfhrrcqyB9olf05f26+ch99xL4BMWhRPdEh0521tQh1TqXtsVEPhfQKk8dQSbuTHdi9nurMQr4EAws2zjvGxnU1jL6g+EUBMuS4gW6nwuXtF+JzyILo70pUyBD7ldyk9HgajJhXwWruAAPP3OLoMSc7I0EERD+ajBz6dHBN2/h4lsSI3vibrIpIEO3udCec0x/hLs9vbf4eKmkBSUUHZhRe8fPKjfNeWn/0JZ2s5L+CbbWxAuPYgOioNE76qTl3L4IlgZk98ChGn6MSiA76N0x 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:ErrorRetry;CAT:NONE;SFS:(13230031)(7416005)(36860700004)(376005)(82310400014)(1800799015)(921011);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2024 11:30:10.7799 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8276e823-117a-4945-bbdc-08dc6451e6e3 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: DS3PEPF000099DA.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5743 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240424_043020_618896_8679B363 X-CRM114-Status: GOOD ( 17.38 ) 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 support for an optional reset for the uartps controller using the reset driver. If the uartps node contains the "resets" property, then cdns_uart_startup performs uartps controller non-pulse out of reset and reset in exit path. Signed-off-by: Manikanta Guntupalli --- Changes for V2: Remove check for reset_control_deassert, as reset_control_deassert function internally has NULL check --- drivers/tty/serial/xilinx_uartps.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index de3487206bcb..2acfcea403ce 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c @@ -25,6 +25,7 @@ #include #include #include +#include #define CDNS_UART_TTY_NAME "ttyPS" #define CDNS_UART_NAME "xuartps" @@ -198,6 +199,7 @@ MODULE_PARM_DESC(rx_timeout, "Rx timeout, 1-255"); * @gpiod_rts: Pointer to the gpio descriptor * @rs485_tx_started: RS485 tx state * @tx_timer: Timer for tx + * @rstc: Pointer to the reset control */ struct cdns_uart { struct uart_port *port; @@ -211,6 +213,7 @@ struct cdns_uart { struct gpio_desc *gpiod_rts; bool rs485_tx_started; struct hrtimer tx_timer; + struct reset_control *rstc; }; struct cdns_platform_data { u32 quirks; @@ -948,6 +951,10 @@ static int cdns_uart_startup(struct uart_port *port) is_brk_support = cdns_uart->quirks & CDNS_UART_RXBS_SUPPORT; + ret = reset_control_deassert(cdns_uart->rstc); + if (ret) + return ret; + uart_port_lock_irqsave(port, &flags); /* Disable the TX and RX */ @@ -1721,6 +1728,13 @@ static int cdns_uart_probe(struct platform_device *pdev) dev_err(&pdev->dev, "clock name 'ref_clk' is deprecated.\n"); } + cdns_uart_data->rstc = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + if (IS_ERR(cdns_uart_data->rstc)) { + rc = PTR_ERR(cdns_uart_data->rstc); + dev_err_probe(&pdev->dev, rc, "Cannot get UART reset\n"); + goto err_out_unregister_driver; + } + rc = clk_prepare_enable(cdns_uart_data->pclk); if (rc) { dev_err(&pdev->dev, "Unable to enable pclk clock.\n"); @@ -1881,6 +1895,7 @@ static void cdns_uart_remove(struct platform_device *pdev) if (console_port == port) console_port = NULL; #endif + reset_control_assert(cdns_uart_data->rstc); if (!--instances) uart_unregister_driver(cdns_uart_data->cdns_uart_driver);