From patchwork Mon Mar 15 10:46:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 400946 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B1C1C433E0 for ; Mon, 15 Mar 2021 10:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E6F3564E76 for ; Mon, 15 Mar 2021 10:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbhCOKrl (ORCPT ); Mon, 15 Mar 2021 06:47:41 -0400 Received: from mail-dm6nam11on2086.outbound.protection.outlook.com ([40.107.223.86]:34809 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230002AbhCOKrY (ORCPT ); Mon, 15 Mar 2021 06:47:24 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SiQp7IWMwYRclMVAVRSismVFFX+ajLLz/pTVnwX9ukzHMdfP+A6nMifov3thuv1KVFB1RdDAXUXwKKP9Z8MteIAciwy9BUzWg2INFvze5spGmCNl57IGKWlKBhk0rd42IYSY5PaUHHBocCEHNMDLWFlJzsWsuO0ftXRjPR4W9ADpZLbOi/tnCP8c0152vcz9kjEO5wGETpyUbBMQRXDmZCrp/1TNOxHdcdgorjyi9FfucQtbMYsOnMbwubqz2GUn+rejn0JMhc4cRZHc/LhNJMOrWa6xkJHayr+K3XlJ916ZPWyAXx1HmUafdGLjCzSwqff3r0uic0PNFazoi6R/HA== 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-SenderADCheck; bh=+St41h16lx3eOLcbriBkxDc2LwEYg1dz45xs2HifVWc=; b=cFbgAqXboFGdtuAW3E0PiEmAMktT6xeXFQzlud6jt/qLrBe+Lzwtk9qnEo65g9gWx7usljkXLoPLlEzxFEVKExXy8WfUqdOpcolKGU7iIy2j1qsl5X0qSSh0EHWGDyHY6/yzNHcHU6puiPyc4DIR0hefl6A02z8omMQT2AdqnAc8463Ks40hO9/BnYjmKxHbrlK8UyyM0GQAQVqg2WBsH1rTo/duT0uSjNZdxl3f6i2lMY6lkRamHeMV4rhNebaGE2/OVbmWsuPHHs0CIE4EdtqhFQ/zoywRlRIecsqCfexPK4LqtiCpaqGXiYGLYhNru3ubIAtGdXI8CxT4lkinSA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=roeck-us.net smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+St41h16lx3eOLcbriBkxDc2LwEYg1dz45xs2HifVWc=; b=hV3Fnwg7TXcaXsyJguh94CRKoMY6RzEjtmhNT7wjV4/sPU3CSMFQVME13T15WwPJ8d+HF2xqOSwiBwdp1LxGAvCcRg7hQ44isb+jmLMcPxfC6CCJcpNFlOsRTDaj6s56BqS3cm3mQaPpBm9Bh8AR6nlQZARkm/J2F7aTztyrrm0= Received: from CY4PR14CA0035.namprd14.prod.outlook.com (2603:10b6:903:101::21) by BYAPR02MB4583.namprd02.prod.outlook.com (2603:10b6:a03:12::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Mon, 15 Mar 2021 10:47:22 +0000 Received: from CY1NAM02FT027.eop-nam02.prod.protection.outlook.com (2603:10b6:903:101:cafe::9f) by CY4PR14CA0035.outlook.office365.com (2603:10b6:903:101::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31 via Frontend Transport; Mon, 15 Mar 2021 10:47:22 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; roeck-us.net; dkim=none (message not signed) header.d=none; roeck-us.net; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT027.mail.protection.outlook.com (10.152.75.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3933.32 via Frontend Transport; Mon, 15 Mar 2021 10:47:21 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 03:47:15 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2106.2 via Frontend Transport; Mon, 15 Mar 2021 03:47:15 -0700 Envelope-to: git@xilinx.com, linux@roeck-us.net, wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Received: from [10.140.6.40] (port=50876 helo=xhdsivadur40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lLkkk-00055N-Ih; Mon, 15 Mar 2021 03:47:15 -0700 From: Srinivas Neeli To: , , , CC: , , , , , Srinivas Goud , Srinivas Neeli Subject: [PATCH 1/9] watchdog: of_xilinx_wdt: Add comment to spinlock Date: Mon, 15 Mar 2021 16:16:46 +0530 Message-ID: <1615805214-24857-2-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> References: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67ec6a80-a737-4599-cdd8-08d8e79fb662 X-MS-TrafficTypeDiagnostic: BYAPR02MB4583: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2733; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ROconV9d2zhrhUnpNE+ppEfeytlT9uLBxuLyAa83nHf/HZUWVFUEleKRyaCOlYEfcJn+gh3oiKHC1Nmbk21h56Y8qzNjYeXb77wzfDLfYsLnu850YJX4HJDdX+MqcCBUBLKpJsDh5zFn9aYPluM1q7XZA6KXlbnwaGFKF+myWZmK1qJ9XRL56IxO3rga03ELxMe4PDpq6/+MbFksYLWNWPxHirmSOKg/h8GHuUCEU3+n5iSP7SsIm+0Tk6uee61bLiZlBUbpL+oP6uV4/kDEhoBQpVXq7egbMgNQjhMMDonzlrpcEmTFbXM2dPHHQz6Q6UOqzAwGu22j5AsVOhy8XqQjpPJFN6O+8barHMdscOPvdCKiH1GQdgZ/5tgXSLnR0cgB9Ysj4037hD3FuVkIF8wnOSdrdhET93SrqDcud3iJI8Y0bz8e0YYezbv43Uh8sRL0WQjimIfetOYD/sjZD52pWPDZe/rQUjuMOV6oIq9f5OGvpOOGasmGLRNbnVw/ZMT48q9cdl1CqAnd1SoqDfLVfmge3OoTkS/RHJSANDeEznh6BA07ZYbHF7EhM3LkWTnok3ULyF8GfqFjog3EqxHGIpByZghe6UmZHABH10maG38zZJbNjGI9T0rkMn2H6quzNMbIOXZR1xZmC+DY78HINwygvlsiyjFoT3Mw1XnNIhiNIMOmTMYFZcS+D3EW X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(39860400002)(136003)(346002)(376002)(396003)(36840700001)(46966006)(110136005)(82310400003)(54906003)(186003)(36756003)(70586007)(70206006)(82740400003)(9786002)(4744005)(47076005)(2616005)(107886003)(2906002)(44832011)(316002)(36906005)(36860700001)(356005)(7696005)(5660300002)(426003)(83380400001)(4326008)(26005)(8676002)(8936002)(6636002)(336012)(6666004)(478600001)(7636003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2021 10:47:21.8020 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67ec6a80-a737-4599-cdd8-08d8e79fb662 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT027.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB4583 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Srinivas Goud Based on checkpatch every spinlock should be documented. The patch is fixing this issue: ./scripts/checkpatch.pl --strict -f drivers/watchdog/of_xilinx_wdt.c CHECK: spinlock_t definition without comment + spinlock_t spinlock; Signed-off-by: Srinivas Goud Signed-off-by: Michal Simek Signed-off-by: Srinivas Neeli Reviewed-by: Guenter Roeck --- drivers/watchdog/of_xilinx_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index 7fe4f7c3f7ce..00549164b3d7 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -40,7 +40,7 @@ struct xwdt_device { void __iomem *base; u32 wdt_interval; - spinlock_t spinlock; + spinlock_t spinlock; /* spinlock for register handling */ struct watchdog_device xilinx_wdt_wdd; struct clk *clk; }; From patchwork Mon Mar 15 10:46:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 400945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00BC3C433E6 for ; Mon, 15 Mar 2021 10:48:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C625A64EBD for ; Mon, 15 Mar 2021 10:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbhCOKrm (ORCPT ); Mon, 15 Mar 2021 06:47:42 -0400 Received: from mail-dm6nam11on2077.outbound.protection.outlook.com ([40.107.223.77]:57569 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229732AbhCOKr2 (ORCPT ); Mon, 15 Mar 2021 06:47:28 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JZ1L8fADi9umN2eVt0Zm9ZiWsUO2PG68pcnbjVu882nuFPpgcTW5YO9Ovn4kZxta1Ag6+1aaV18plZk9CvRO91UPZ1HrOxRCzXJSCF8WCsPcm/8uFytGiDMfwXO8yYg3xN3WW564Dr9tjL8P6vcGPDvdPXm93/MWKWvV9n3NF7ltTzpjSxXhquCokK07U1Ot2VoWPMY2c/HOENT2ka9KSsZ4QYH/M5zmOEUsw7+at8fvMHcX9RTGd4yitSKO3YDIEU7v0b5W7cJ6+5oJk7cz3XPXyJPpMmJ16gsANod/+caKBbfzWuW/+Fvx5VESkwDdCKIFC0c6pJOmfmmOooARFg== 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-SenderADCheck; bh=uyhwFbQA81kAFJXqZWwZcUJbGIKTfkzIYsByU7MYtDE=; b=fRs64mhJ9jImJciOHgA3QOjR273PiWudW8zmbXHQpMaawJLUv3o514vsl+T64U445yJLTHqxJq8ZArwT/VTBZeJ8diLrSFQtu9UFq+dwaK3yjv6CwQserVOzwAxRrGvM5QkCQSODHArqqkjyo4QKioMR6GEpNOedMigxj/GPZOeYF2OKceqbB0+HdZlExafwVkK1nnwJqIDN+O1cSzwI2E76Z0xQRhbPwMrjeBXwwvJs9ZjNX8shGyOPvkS+ThcKgclKnAfjsoOztUS5Y1QC/4BkIYQiqfDmaAzHdMIRad30dfEW+I5qr8cGhlcprFHaE/pFPutmCEDGt63PC3nWJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=roeck-us.net smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uyhwFbQA81kAFJXqZWwZcUJbGIKTfkzIYsByU7MYtDE=; b=Qhu/JYbwmFqwOym/S58dizYtQnpxZ5B9a2bz41ZO8ikvWgb36OALG57xzpbgnN3uEuBRs4D4YZA2cLjDDsamWMmKJdIcM2TsuMvXkFhfl7KerJ+KCGxMKpJd2zGZwaCRBmArU+yJjE0SUtI3gKxu2jQUFlkSHGpBsw7wAF9gkVw= Received: from DM6PR08CA0033.namprd08.prod.outlook.com (2603:10b6:5:80::46) by SN6PR02MB5613.namprd02.prod.outlook.com (2603:10b6:805:e5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Mon, 15 Mar 2021 10:47:24 +0000 Received: from CY1NAM02FT006.eop-nam02.prod.protection.outlook.com (2603:10b6:5:80:cafe::b4) by DM6PR08CA0033.outlook.office365.com (2603:10b6:5:80::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31 via Frontend Transport; Mon, 15 Mar 2021 10:47:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; roeck-us.net; dkim=none (message not signed) header.d=none; roeck-us.net; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT006.mail.protection.outlook.com (10.152.74.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3933.32 via Frontend Transport; Mon, 15 Mar 2021 10:47:24 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 03:47:22 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2106.2 via Frontend Transport; Mon, 15 Mar 2021 03:47:22 -0700 Envelope-to: git@xilinx.com, linux@roeck-us.net, wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Received: from [10.140.6.40] (port=50876 helo=xhdsivadur40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lLkkq-00055N-T5; Mon, 15 Mar 2021 03:47:21 -0700 From: Srinivas Neeli To: , , , CC: , , , , , Srinivas Goud , Srinivas Neeli Subject: [PATCH 3/9] watchdog: of_xilinx_wdt: Used dev_dbg() Date: Mon, 15 Mar 2021 16:16:48 +0530 Message-ID: <1615805214-24857-4-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> References: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3293cdb2-7cf2-4b75-588f-08d8e79fb7fc X-MS-TrafficTypeDiagnostic: SN6PR02MB5613: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: umTXFQAGf+dK0tyv1uX/dYVAK8sEG9tUWuhNCA3SPH4hJYFEYQaOrtCLB2S3cAqPAQktDro7ocC7WUSQu1N+7WzD3meJbeuKALdBIm4sTdWZHmFZ0SGSXDdStyvPiuHm4rFPTjTHxfJxzUgZy10VDsglCEkDcOQfSY05uT2FZQ7ABHsJzfG137pIA9reWKsL8vSopKKmdXHRijdAua6W1BnFEDH1irMux5lFho20syUOVrtYBMcmRkUoTxtDFP6Zj/GBtY6/HskIH+tbeEXe8ogKN9tQvOlXtfDbQgv+VeElrQFj9yinGMZFJekILJp9CjaL/Jz1QA0RmbQf1QOHgqR9+boOrlmFRCT58pKf+n9HgFbqdEVX+tsyZJ5gZt2XSro1MNxu4smOBHefPs9Y4ixPLkeJoYwSN67Bhj6dSmfPx9rLFuly9/3YU5zQnKr+Y2hdyy5db6Ui2RKjNu340fPlXNjJkgHY96gdkHRMy+rn8xSO7P3s1D83/JEy8MsW3zgJgwDDYcqmGEDDib6yskLhw9uO1G+FHBm2SDjhujrKfx9p/s6Kw/D2t6BvZb7AgwX4G1SzWdo3b+davGp5QUAjsqurZNGjWLkzBuzmEjPgSxZ2QDUIuZqmbHBMk18p2YwxgzfvFk0GkyCkWlRd4v3+NbruJ+RSYHSXnzxx9XlWXMlwkzJvxORXQQJ8qY8H X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(346002)(376002)(136003)(396003)(39860400002)(36840700001)(46966006)(110136005)(426003)(8936002)(8676002)(7636003)(82310400003)(36906005)(316002)(54906003)(356005)(5660300002)(107886003)(44832011)(26005)(47076005)(9786002)(2616005)(82740400003)(186003)(83380400001)(70586007)(478600001)(2906002)(4326008)(70206006)(6636002)(6666004)(36860700001)(7696005)(336012)(36756003)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2021 10:47:24.4880 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3293cdb2-7cf2-4b75-588f-08d8e79fb7fc X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT006.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB5613 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Srinivas Goud This patch removes pr_info in stop function and adds dev_dbg() in start/stop function to display device specific debug info. Signed-off-by: Srinivas Goud Signed-off-by: Michal Simek Signed-off-by: Srinivas Neeli --- drivers/watchdog/of_xilinx_wdt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index 0d7df2370db7..9e67b598907e 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -50,6 +50,7 @@ static int xilinx_wdt_start(struct watchdog_device *wdd) int ret; u32 control_status_reg; struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; ret = clk_enable(xdev->clk); if (ret) { @@ -70,6 +71,8 @@ static int xilinx_wdt_start(struct watchdog_device *wdd) spin_unlock(&xdev->spinlock); + dev_dbg(xilinx_wdt_wdd->parent, "Watchdog Started!\n"); + return 0; } @@ -77,6 +80,7 @@ static int xilinx_wdt_stop(struct watchdog_device *wdd) { u32 control_status_reg; struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; spin_lock(&xdev->spinlock); @@ -91,7 +95,7 @@ static int xilinx_wdt_stop(struct watchdog_device *wdd) clk_disable(xdev->clk); - pr_info("Stopped!\n"); + dev_dbg(xilinx_wdt_wdd->parent, "Watchdog Stopped!\n"); return 0; } From patchwork Mon Mar 15 10:46:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 400944 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFFA5C43381 for ; Mon, 15 Mar 2021 10:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE7B664EE2 for ; Mon, 15 Mar 2021 10:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230021AbhCOKrn (ORCPT ); Mon, 15 Mar 2021 06:47:43 -0400 Received: from mail-mw2nam12on2073.outbound.protection.outlook.com ([40.107.244.73]:50144 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230020AbhCOKr3 (ORCPT ); Mon, 15 Mar 2021 06:47:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hqbsnUMTGRY0y5/oHjVJK47YtGBbV961h9TxZH6rDycdZnvdpYYBmdXbsPaB5nAHse7YvD9CdrZROkzXC5ob3xhGPyofUWL77eG08xJuccM+6w6JHA54zUvDawy90Y52JgwT3SHjnUOkr40OMSC41bPa0ENboEwIjVBGAsj8El316d2b0dDOJ+ZCEVyqNZtyNrs4dp4rOGED3pZujglLItFaw9Aj6i2BbWeIVM6PWWxLHsHBwsreG+IKPwoiSZ0Fjd6OI5IYqB8KJwoXueDAvTEeATzPVkJUYbbQTVbPID3rQQMW5VAF8WSY2Q7nsZREIRkE/uCQ7//CnUSBJxaiOw== 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-SenderADCheck; bh=JLSX4lqAHRVVZ7wS8+l5IRJMy0gApdNzhJ68ZMJIFSU=; b=kvJ8GJlx2VhGvwOyz9/xsQnHl26CdsZqpGuR/yn2c49KgLpfcOaLJbrok20NBCkBAJZOfm4U1EbTo5en07fIzBv+2irOHthgk2tZ4yqEjdkOI9C2HRL2X5Ma05aZxm6ZRwXTx7U+oeKmKGgYZWa+jDz+aW1ezU+iaYE0ZWg5d0xqO+bm/qh1rxfHsLN9GaWPIy4fLFyO9UKds3RERdoSS7Ji11ll0RoM4kl7hvS2UAvnKy1KfwnCC458e7UlD2/FpxE90xOgh/YkzDrqnDOhChMIDf6/Wf6KH4kEWIMJD+Pe9tUGFyOqLSL3Es/faC9GIpt8a0NrFYDXDF1NqtmRTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=roeck-us.net smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JLSX4lqAHRVVZ7wS8+l5IRJMy0gApdNzhJ68ZMJIFSU=; b=lWSvHBJOHnI3jT2ljW79KsV4b61cv43eoJLm3HDQlERJqMgraLtEvUbA0v0QiyYI/+LrffrnPxxLkLHcjMPcXmhYVbyWw8q4J/sG9+p1bYxX5QryiJmBKIL7KWcblwSNu1CLG6JnKhWWyvIAa8t9RN4dciicZMgO9JC4QuDp860= Received: from CY4PR22CA0044.namprd22.prod.outlook.com (2603:10b6:903:ed::30) by BL0PR02MB6497.namprd02.prod.outlook.com (2603:10b6:208:1c2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Mon, 15 Mar 2021 10:47:27 +0000 Received: from CY1NAM02FT023.eop-nam02.prod.protection.outlook.com (2603:10b6:903:ed:cafe::7c) by CY4PR22CA0044.outlook.office365.com (2603:10b6:903:ed::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31 via Frontend Transport; Mon, 15 Mar 2021 10:47:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; roeck-us.net; dkim=none (message not signed) header.d=none; roeck-us.net; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT023.mail.protection.outlook.com (10.152.74.237) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3933.32 via Frontend Transport; Mon, 15 Mar 2021 10:47:27 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 03:47:25 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2106.2 via Frontend Transport; Mon, 15 Mar 2021 03:47:25 -0700 Envelope-to: git@xilinx.com, linux@roeck-us.net, wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Received: from [10.140.6.40] (port=50876 helo=xhdsivadur40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lLkku-00055N-1x; Mon, 15 Mar 2021 03:47:24 -0700 From: Srinivas Neeli To: , , , CC: , , , , , Srinivas Neeli , Srinivas Goud Subject: [PATCH 4/9] watchdog: of_xilinx_wdt: Initialize watchdog via data structure Date: Mon, 15 Mar 2021 16:16:49 +0530 Message-ID: <1615805214-24857-5-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> References: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 443f8470-4c83-4d3c-9af9-08d8e79fb9a1 X-MS-TrafficTypeDiagnostic: BL0PR02MB6497: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bNlJ6VWjR3kD5CHPsaCE9K6OxPNlGqyGPR5joMM1U668llN6KeFKoV7Xkxgg4Nt91R/jKRvFafbMNxKIDRNl0gp12M8XMHDrPyRgF3ec39//hvB6xj9dkOVQi3sK2hqNFkRBLy0HPOux/tyypAk3dh5gUvxAz1NAFrg9PxEqWvXtz+RHLDMuNS5lqGu9rde/h4LpfLj7dy3Ok2mIgMKD+80fr5Fl4ajEpAwJOf+eBu+JaMHaiDyq2VFG/f9BXT9avsQ4WUs+2cNnhkdOcMNReAVK/JsGEcIZeJ+Q3Kftw1BaY4kmS5MRyO7fT3I+3uIa8XM/2HV62jheQiVqKdCxacqOk5tWAd+xWYxbEMAY2ElXQ81T9kgTpYcwtSTro7fkGc6+E724TB3NlR6GObDmppxVfmkBNIi94N5r44eNHShjP/mgr1oHzeTUfTdybatt4qiuFvRxI+IvmAHOFCG9RNROh9hBzoWq5qjQRrBeYXwH6YsekovGhLvu7t2n7kDE7T0aEPhPyAoq3cUVw20bDoWMyG82l2KyLtBg0FoY7/VZod+NpNfyDvgnR2ahwWMY6SKsZbX3uAMchlwF+EjM3rNTuSFSjx8xJicbhYjLqs5b50icTQaVxn1HRxitpeUioSygW7m5Sks9gJQG6a2Gu5yE0J9pImQqSxbppG2bxTs0+NUj0m/YwmEFyzVVnSz4 X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(346002)(376002)(396003)(39860400002)(36840700001)(46966006)(316002)(7636003)(110136005)(54906003)(426003)(478600001)(82310400003)(186003)(356005)(8676002)(36906005)(36756003)(6666004)(9786002)(4326008)(82740400003)(36860700001)(70206006)(83380400001)(2616005)(336012)(8936002)(5660300002)(70586007)(47076005)(44832011)(6636002)(7696005)(107886003)(2906002)(26005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2021 10:47:27.2487 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 443f8470-4c83-4d3c-9af9-08d8e79fb9a1 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT023.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB6497 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org This patch is preparation for adding new watchdog based on this driver. of_id->data is storing link xwdt_devtype_data which stores watchdog info and ops pointers to structures. Signed-off-by: Srinivas Goud Signed-off-by: Michal Simek Signed-off-by: Srinivas Neeli --- drivers/watchdog/of_xilinx_wdt.c | 50 +++++++++++++++++++++++++++++----------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index 9e67b598907e..b2ce1b90237e 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -37,6 +37,11 @@ #define WATCHDOG_NAME "Xilinx Watchdog" +struct xwdt_devtype_data { + const struct watchdog_ops *xwdt_ops; + const struct watchdog_info *xwdt_info; +}; + struct xwdt_device { void __iomem *base; u32 wdt_interval; @@ -160,6 +165,20 @@ static void xwdt_clk_disable_unprepare(void *data) clk_disable_unprepare(data); } +static const struct xwdt_devtype_data xwdt_wdt_data = { + .xwdt_info = &xilinx_wdt_ident, + .xwdt_ops = &xilinx_wdt_ops, +}; + +static const struct of_device_id xwdt_of_match[] = { + { .compatible = "xlnx,xps-timebase-wdt-1.00.a", + .data = &xwdt_wdt_data }, + { .compatible = "xlnx,xps-timebase-wdt-1.01.a", + .data = &xwdt_wdt_data }, + {}, +}; +MODULE_DEVICE_TABLE(of, xwdt_of_match); + static int xwdt_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -167,14 +186,23 @@ static int xwdt_probe(struct platform_device *pdev) u32 pfreq = 0, enable_once = 0; struct xwdt_device *xdev; struct watchdog_device *xilinx_wdt_wdd; + const struct of_device_id *of_id; + const struct xwdt_devtype_data *devtype; xdev = devm_kzalloc(dev, sizeof(*xdev), GFP_KERNEL); if (!xdev) return -ENOMEM; xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; - xilinx_wdt_wdd->info = &xilinx_wdt_ident; - xilinx_wdt_wdd->ops = &xilinx_wdt_ops; + + of_id = of_match_device(xwdt_of_match, &pdev->dev); + if (!of_id) + return -EINVAL; + + devtype = of_id->data; + + xilinx_wdt_wdd->info = devtype->xwdt_info; + xilinx_wdt_wdd->ops = devtype->xwdt_ops; xilinx_wdt_wdd->parent = dev; xdev->base = devm_platform_ioremap_resource(pdev, 0); @@ -264,9 +292,10 @@ static int xwdt_probe(struct platform_device *pdev) static int __maybe_unused xwdt_suspend(struct device *dev) { struct xwdt_device *xdev = dev_get_drvdata(dev); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; - if (watchdog_active(&xdev->xilinx_wdt_wdd)) - xilinx_wdt_stop(&xdev->xilinx_wdt_wdd); + if (watchdog_active(xilinx_wdt_wdd)) + xilinx_wdt_wdd->ops->stop(xilinx_wdt_wdd); return 0; } @@ -280,24 +309,17 @@ static int __maybe_unused xwdt_suspend(struct device *dev) static int __maybe_unused xwdt_resume(struct device *dev) { struct xwdt_device *xdev = dev_get_drvdata(dev); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; int ret = 0; - if (watchdog_active(&xdev->xilinx_wdt_wdd)) - ret = xilinx_wdt_start(&xdev->xilinx_wdt_wdd); + if (watchdog_active(xilinx_wdt_wdd)) + ret = xilinx_wdt_wdd->ops->start(xilinx_wdt_wdd); return ret; } static SIMPLE_DEV_PM_OPS(xwdt_pm_ops, xwdt_suspend, xwdt_resume); -/* Match table for of_platform binding */ -static const struct of_device_id xwdt_of_match[] = { - { .compatible = "xlnx,xps-timebase-wdt-1.00.a", }, - { .compatible = "xlnx,xps-timebase-wdt-1.01.a", }, - {}, -}; -MODULE_DEVICE_TABLE(of, xwdt_of_match); - static struct platform_driver xwdt_driver = { .probe = xwdt_probe, .driver = { From patchwork Mon Mar 15 10:46:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 400943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DECB4C43331 for ; Mon, 15 Mar 2021 10:48:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9076A64ED2 for ; Mon, 15 Mar 2021 10:48:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbhCOKrn (ORCPT ); Mon, 15 Mar 2021 06:47:43 -0400 Received: from mail-co1nam11on2087.outbound.protection.outlook.com ([40.107.220.87]:45856 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229905AbhCOKrf (ORCPT ); Mon, 15 Mar 2021 06:47:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bezgp0FxcG44DglPNnYaaD6KIzyNl3Jf6WF/S+1MKeo0iar6mXrQTRyUxxi5btaKeZioBBZnePTblm/xpc71GemGqwcIDFfIduGWLqlezqSa/+0IygcZT4U6FvLaso0j5oDIwdzxT0foFTxoSkkvtY4NkMtHzMxX8TCo9my9lkc6i2FHUTQjY8dkkB4zTwmDfgR7QnDDkgPdS0cHJc6jo8tXscfXh1s+CZHKa/ailAoWDOku9hXtP4K5efPDdHOLZ8vBKt6iVLOf132EeoguqCumlqQ9OPcM8Js+4LNPmrF9n+mlMppuG45/W7cIecHX8eNg4p6UJRZ7xmVdF2eH6g== 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-SenderADCheck; bh=HOp3IYe7EGQb8A3JI35dveDYqbkTKZs9bHvKTu25EWk=; b=P2Ka2QdWhn/1JigyEDzcAKzhTLEWLDYmEbnjIQk9vjBKjbCCLiK4JPBJ0bG0wcV6Ob5aFP9xnC5Sf+AytzgoMdIATZPqyX3ETcaSHjAK0JLyadwGT765voYxmy5r5xSF5oO+mfd2j61NN5ydoGZ67t5zILzxeLEfeb5RtgBn8tYcdbGSJn6VWyP2TcECljRrlAro9aw9K1euyT5PxMOwWrmSaRN6RtPFN3JPGRwlKSg00i60QDTFeGt9rI7EGBi6TVDxV8EJ1bYLYvuw0T24ypDI2+T8+Nc7ocW6vONcndSXz02kzI8343KRcg1GnYR4i0N2EOoUgZr7Ip/oAbk/ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=roeck-us.net smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HOp3IYe7EGQb8A3JI35dveDYqbkTKZs9bHvKTu25EWk=; b=FuSwvgEZcVMz6/hiTQ2H6PmFqqC/gF2E/qt4xXnigB9o7Zq9chCnMiexhBnd2scKTOMKjUx+5zKWdbUk3vWubhua0NYFk4CtHTe6sHcZgy/7P687VE1cZeCBAtAMo/fKplV1Jki6Zi/jqXMge0QuRisvkLQziZIp4INnh3W3OKc= Received: from CY4PR22CA0066.namprd22.prod.outlook.com (2603:10b6:903:ae::28) by MN2PR02MB6192.namprd02.prod.outlook.com (2603:10b6:208:181::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Mon, 15 Mar 2021 10:47:31 +0000 Received: from CY1NAM02FT050.eop-nam02.prod.protection.outlook.com (2603:10b6:903:ae:cafe::cd) by CY4PR22CA0066.outlook.office365.com (2603:10b6:903:ae::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31 via Frontend Transport; Mon, 15 Mar 2021 10:47:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; roeck-us.net; dkim=none (message not signed) header.d=none; roeck-us.net; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch01.xlnx.xilinx.com; Received: from xsj-pvapexch01.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT050.mail.protection.outlook.com (10.152.75.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3933.32 via Frontend Transport; Mon, 15 Mar 2021 10:47:30 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch01.xlnx.xilinx.com (172.19.86.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 03:47:28 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2106.2 via Frontend Transport; Mon, 15 Mar 2021 03:47:28 -0700 Envelope-to: git@xilinx.com, linux@roeck-us.net, wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Received: from [10.140.6.40] (port=50876 helo=xhdsivadur40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lLkkx-00055N-7E; Mon, 15 Mar 2021 03:47:27 -0700 From: Srinivas Neeli To: , , , CC: , , , , , Srinivas Neeli , Srinivas Goud Subject: [PATCH 5/9] watchdog: of_xilinx_wdt: Introduce wdttype enum for identification Date: Mon, 15 Mar 2021 16:16:50 +0530 Message-ID: <1615805214-24857-6-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> References: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 16523573-06ed-4d5b-7124-08d8e79fbbe1 X-MS-TrafficTypeDiagnostic: MN2PR02MB6192: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uGzm5B/UptU+Gc6pPftHP1i5DVLZfVZhx6CBCIMF5pkengNrSyDGl3rdl20z0SdANVH92A3959KDPqfK7RIuZWmjY62XuNF28rjK5HhtAuU3JRv3krdsgczk1/U3OAT10ZDXVupE+87XiJIO0odFxdOz4+I/oxRpM42kDjnDMtGHBxQ4Fw9iF57dSsXyKvtb/bCtA+zt2pWdPDaALF+H8K2vvRxkaqaEaMUNwq1izgPMuC11ufuF+mtkkE8yQGDoc6v3DDFGtSEEn4enTZj1wExTHwbbUFNWt1IKw7F8HxCxPropwNzcMfnJgsa/jKCRFuLB8BQT45Tmc4QmxioW/EL3o9yOMDsKtWo0Al3G8KUyRXKvfdZpXhRNhU9uUBVrfSYCnbiAUGmwN3n1zfFhyJHrPzaUNRN/Wq9nFl6FeSahP5puK2rf3lks9SAV09xBJZVp9UrS1WSHP7d/KxuF2oMsbZMitLnh57Bo/EaZLZ4fO2O3PUuDp5RErsTc53HEllQEF8Pje/0FgUiPrBaIiuUkYAGnZdPJ/kp5J23HH93wJK/WSGtogEG3tV3AbLG2+cu14ouN95o27ZhtyrW3FSvSufeh4K10Z/Bfw4RkFHLT9T7HJg5x4Gb5T17zDUneh1P4nQC2/URHDsoC8PbLU7I5T4vSh95IMggJgXuTJRhNHp0rNoGi/IIpQ6AmSSfl X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch01.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(376002)(396003)(39860400002)(346002)(136003)(36840700001)(46966006)(478600001)(426003)(4326008)(2616005)(336012)(54906003)(107886003)(186003)(36756003)(316002)(44832011)(83380400001)(26005)(7636003)(356005)(82310400003)(82740400003)(36906005)(47076005)(6636002)(6666004)(8936002)(2906002)(9786002)(70586007)(7696005)(8676002)(5660300002)(36860700001)(70206006)(110136005)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2021 10:47:30.7716 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16523573-06ed-4d5b-7124-08d8e79fbbe1 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch01.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT050.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR02MB6192 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org There is a need to identify watchdog type that's why new enum was was introduced to cover it. Move functionality valid only for this watchdog type if statement. Signed-off-by: Srinivas Goud Signed-off-by: Michal Simek Signed-off-by: Srinivas Neeli --- drivers/watchdog/of_xilinx_wdt.c | 64 +++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index b2ce1b90237e..3b93b60f1a00 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -37,7 +37,17 @@ #define WATCHDOG_NAME "Xilinx Watchdog" +/** + * enum xwdt_ip_type - WDT IP type. + * + * @XWDT_WDT: Soft wdt ip. + */ +enum xwdt_ip_type { + XWDT_WDT = 0, +}; + struct xwdt_devtype_data { + enum xwdt_ip_type wdttype; const struct watchdog_ops *xwdt_ops; const struct watchdog_info *xwdt_info; }; @@ -166,6 +176,7 @@ static void xwdt_clk_disable_unprepare(void *data) } static const struct xwdt_devtype_data xwdt_wdt_data = { + .wdttype = XWDT_WDT, .xwdt_info = &xilinx_wdt_ident, .xwdt_ops = &xilinx_wdt_ops, }; @@ -188,6 +199,7 @@ static int xwdt_probe(struct platform_device *pdev) struct watchdog_device *xilinx_wdt_wdd; const struct of_device_id *of_id; const struct xwdt_devtype_data *devtype; + enum xwdt_ip_type wdttype; xdev = devm_kzalloc(dev, sizeof(*xdev), GFP_KERNEL); if (!xdev) @@ -201,6 +213,8 @@ static int xwdt_probe(struct platform_device *pdev) devtype = of_id->data; + wdttype = devtype->wdttype; + xilinx_wdt_wdd->info = devtype->xwdt_info; xilinx_wdt_wdd->ops = devtype->xwdt_ops; xilinx_wdt_wdd->parent = dev; @@ -209,18 +223,20 @@ static int xwdt_probe(struct platform_device *pdev) if (IS_ERR(xdev->base)) return PTR_ERR(xdev->base); - rc = of_property_read_u32(dev->of_node, "xlnx,wdt-interval", - &xdev->wdt_interval); - if (rc) - dev_warn(dev, "Parameter \"xlnx,wdt-interval\" not found\n"); + if (wdttype == XWDT_WDT) { + rc = of_property_read_u32(dev->of_node, "xlnx,wdt-interval", + &xdev->wdt_interval); + if (rc) + dev_warn(dev, "Parameter \"xlnx,wdt-interval\" not found\n"); - rc = of_property_read_u32(dev->of_node, "xlnx,wdt-enable-once", - &enable_once); - if (rc) - dev_warn(dev, - "Parameter \"xlnx,wdt-enable-once\" not found\n"); + rc = of_property_read_u32(dev->of_node, "xlnx,wdt-enable-once", + &enable_once); + if (rc) + dev_warn(dev, + "Parameter \"xlnx,wdt-enable-once\" not found\n"); - watchdog_set_nowayout(xilinx_wdt_wdd, enable_once); + watchdog_set_nowayout(xilinx_wdt_wdd, enable_once); + } xdev->clk = devm_clk_get(dev, NULL); if (IS_ERR(xdev->clk)) { @@ -242,13 +258,17 @@ static int xwdt_probe(struct platform_device *pdev) pfreq = clk_get_rate(xdev->clk); } - /* - * Twice of the 2^wdt_interval / freq because the first wdt overflow is - * ignored (interrupt), reset is only generated at second wdt overflow - */ - if (pfreq && xdev->wdt_interval) - xilinx_wdt_wdd->timeout = 2 * ((1 << xdev->wdt_interval) / - pfreq); + if (wdttype == XWDT_WDT) { + /* + * Twice of the 2^wdt_interval / freq because + * the first wdt overflow is ignored (interrupt), + * reset is only generated at second wdt overflow + */ + if (pfreq && xdev->wdt_interval) + xilinx_wdt_wdd->timeout = + 2 * ((1 << xdev->wdt_interval) / + pfreq); + } spin_lock_init(&xdev->spinlock); watchdog_set_drvdata(xilinx_wdt_wdd, xdev); @@ -263,10 +283,12 @@ static int xwdt_probe(struct platform_device *pdev) if (rc) return rc; - rc = xwdt_selftest(xdev); - if (rc == XWT_TIMER_FAILED) { - dev_err(dev, "SelfTest routine error\n"); - return rc; + if (wdttype == XWDT_WDT) { + rc = xwdt_selftest(xdev); + if (rc == XWT_TIMER_FAILED) { + dev_err(dev, "SelfTest routine error\n"); + return rc; + } } rc = devm_watchdog_register_device(dev, xilinx_wdt_wdd); From patchwork Mon Mar 15 10:46:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 400942 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A74AFC433E0 for ; Mon, 15 Mar 2021 10:48:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 72ACB64EC4 for ; Mon, 15 Mar 2021 10:48:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbhCOKsN (ORCPT ); Mon, 15 Mar 2021 06:48:13 -0400 Received: from mail-dm6nam10on2085.outbound.protection.outlook.com ([40.107.93.85]:3104 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229879AbhCOKrl (ORCPT ); Mon, 15 Mar 2021 06:47:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WXU4eOhKjEEkN+eMqZNUV08x2NO5EW93T49qUXMmRLzbbcf4pP06aIw8VmHIQ7YW8Yim2kULfHmahl2riVZeu3IROuZBW0feWPJEuB07sduqxP0i+YWXGAOJOxmuGeIfZWzuGfV8vloW2cfyecxvn9Iwz5wYweMnYMMY1CfvbVfh6ExL8/CLK4Y48PQkRAtReOzENMcQTBuVX1kFLFCwN6bDE9gFUyAV2kKaYiwu+pXVJgzoTxn6EK+nmfAVaiR/NPPDFC4STk0wwI3rOnpRCJPRjHg9wy6VuZc+2ISmCN0mnDX+WJFtHUUsWxTBg0/x3ZgyGaSBAcCx4udTvoXF6g== 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-SenderADCheck; bh=6rWlee/N981L8R/FIkHzNkMapvUxZLYDnv+/PWstzpg=; b=KVYx2wck2SJ68hkxIota/Vumr+XXirD3w9nlC4jDhnYNW0MRM2/wSf/pkHnsyMfpWnhol0LiA3E6xAjIAqkXu94fmgurafV66ok858rbTjFU1LcFasQNeAIsCmLmQ90ki4J5B3QsJhqe2tI/CmQaEYvrKArg/sdVCMIhcwAwC196BBcW5UF+O5eU5z1MZWAuHVs+0HL5rtkL9+jKKdgW99IzCrJA7poBKeOVpJ9TniBbsH/jCnD5eGWS0DGv70PXso6qvLeMqufpGJpqoNQIXREJosxl2r5+bitY54DtXsJU+RM32b8qx5rbo0IKL+Vm3/hodrun00Z6rWMe2PqNiQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.62.198) smtp.rcpttodomain=roeck-us.net smtp.mailfrom=xilinx.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=xilinx.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector2-xilinx-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6rWlee/N981L8R/FIkHzNkMapvUxZLYDnv+/PWstzpg=; b=BR056tDl5XgSuj7lf6T8n38wz44U9CXXozcR/ugnWbXaxBycpB4B7juJ9VmtTdvi3KbbpHv8/C27R1TnN0+D0S10D8wnPInshTi+fzG0O/M8H9wpYbIu5CjSgnNuiw7e1TOJ9/f1AqTHcDrdRaqnTl6uV4FwP24xIfOUioWnWBg= Received: from CY4PR2201CA0011.namprd22.prod.outlook.com (2603:10b6:910:5f::21) by BN7PR02MB4145.namprd02.prod.outlook.com (2603:10b6:406:fd::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.31; Mon, 15 Mar 2021 10:47:39 +0000 Received: from CY1NAM02FT021.eop-nam02.prod.protection.outlook.com (2603:10b6:910:5f:cafe::13) by CY4PR2201CA0011.outlook.office365.com (2603:10b6:910:5f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32 via Frontend Transport; Mon, 15 Mar 2021 10:47:39 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 149.199.62.198) smtp.mailfrom=xilinx.com; roeck-us.net; dkim=none (message not signed) header.d=none; roeck-us.net; dmarc=pass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.62.198 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.62.198; helo=xsj-pvapexch02.xlnx.xilinx.com; Received: from xsj-pvapexch02.xlnx.xilinx.com (149.199.62.198) by CY1NAM02FT021.mail.protection.outlook.com (10.152.75.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3933.32 via Frontend Transport; Mon, 15 Mar 2021 10:47:38 +0000 Received: from xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 03:47:37 -0700 Received: from smtp.xilinx.com (172.19.127.96) by xsj-pvapexch02.xlnx.xilinx.com (172.19.86.41) with Microsoft SMTP Server id 15.1.2106.2 via Frontend Transport; Mon, 15 Mar 2021 03:47:37 -0700 Envelope-to: git@xilinx.com, linux@roeck-us.net, wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Received: from [10.140.6.40] (port=50876 helo=xhdsivadur40.xilinx.com) by smtp.xilinx.com with esmtp (Exim 4.90) (envelope-from ) id 1lLkl6-00055N-49; Mon, 15 Mar 2021 03:47:36 -0700 From: Srinivas Neeli To: , , , CC: , , , , , Srinivas Neeli Subject: [PATCH 7/9] watchdog: of_xilinx_wdt: Add Versal Window watchdog support Date: Mon, 15 Mar 2021 16:16:52 +0530 Message-ID: <1615805214-24857-8-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> References: <1615805214-24857-1-git-send-email-srinivas.neeli@xilinx.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 68ed7fe9-5eee-4dfb-0cec-08d8e79fc08e X-MS-TrafficTypeDiagnostic: BN7PR02MB4145: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zhwvBiNhPXhZRkR0QmjJ1MtMh7tVSPlrczUDoqZO6Ljbn5ArDA15raCL+kYhkF+5F5xAM9jD/qPaf4+44a8CIgiVAzCjViuZjJFFIdc2cbMSiqrfAGIbpyWdLd6lVsQIbW4Bv4O4zBiym/RlVZmWO7rzqP91Hp39TDCy3R0pbWoLBa2+QvWfSfOkCTZ9oZwXo0+bYNaIQiJdJzMFb6a6AmcnC1jEl9Sz0ToCYLE1yB8TJu9AhH+rbi1MeKdeA9aZGvGs/Ap1xUUVxr1KfP7omotdxI+jAKBZD9LjBZuUk2HPhUFHSBR2UudsVm2ZKsEwOxCUS7yVzRfEF2ZQhW5lorMjKs98WgS2ek4RTHaqdySxJ7xG8o4zJo8P3Y++a0yHRYcA79tiIKmwlWGzPq/SYjbMkO6e9wBohF1UY+8bs11zTbPnVy8VlhoIJ2AlbrXDM/ScMq8fHDkCg+XokqBhnjrwuJSOxCgoHcxUeXU6wWW6THx0g1hU1hNidP8SrYTeV1M3g7dNjq0XT3nfzA7SNcPbbG9439RpN6gEDk02B6tYpZvoG2u++KYLMGTyWZ7QHYnhyzKausLm/ZOQv/6vYDhEWvg9OZ4nQNqUyHnUdhdQfSdHHUi/kpXxmnGr4PHRm3uTDgugQvmQDQqBvCTaWWR3cM9pWRc+yQzG3D2UoyMYNE3eUaPozWs/vWvEHvFe X-Forefront-Antispam-Report: CIP:149.199.62.198; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:xsj-pvapexch02.xlnx.xilinx.com; PTR:unknown-62-198.xilinx.com; CAT:NONE; SFS:(4636009)(136003)(376002)(39850400004)(396003)(346002)(46966006)(36840700001)(7636003)(70206006)(44832011)(5660300002)(47076005)(70586007)(316002)(356005)(478600001)(8936002)(4326008)(336012)(110136005)(6666004)(82310400003)(7696005)(36756003)(54906003)(426003)(6636002)(82740400003)(2616005)(186003)(8676002)(107886003)(36906005)(2906002)(26005)(36860700001)(30864003)(83380400001)(9786002)(102446001); DIR:OUT; SFP:1101; X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Mar 2021 10:47:38.8646 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68ed7fe9-5eee-4dfb-0cec-08d8e79fc08e X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.62.198]; Helo=[xsj-pvapexch02.xlnx.xilinx.com] X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT021.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR02MB4145 Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org Versal watchdog driver uses Window watchdog mode. Window watchdog timer(WWDT) contains closed(first) and open(second) window with 32 bit width. WWDT will generate an interrupt after the first window timeout and reset signal after the second window timeout. Timeout and Pre-timeout configuration, Stop and Refresh trigger only in open window. Signed-off-by: Srinivas Neeli --- drivers/watchdog/of_xilinx_wdt.c | 285 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 283 insertions(+), 2 deletions(-) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index 3b93b60f1a00..3656e716b4f7 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -2,10 +2,11 @@ /* * Watchdog Device Driver for Xilinx axi/xps_timebase_wdt * - * (C) Copyright 2013 - 2014 Xilinx, Inc. + * (C) Copyright 2013 - 2021 Xilinx, Inc. * (C) Copyright 2011 (Alejandro Cabrera ) */ +#include #include #include #include @@ -17,6 +18,11 @@ #include #include #include +#include + +#define XWT_WWDT_DEFAULT_TIMEOUT 10 +#define XWT_WWDT_MIN_TIMEOUT 1 +#define XWT_WWDT_MAX_TIMEOUT 42 /* Register offsets for the Wdt device */ #define XWT_TWCSR0_OFFSET 0x0 /* Control/Status Register0 */ @@ -35,15 +41,44 @@ #define XWT_MAX_SELFTEST_LOOP_COUNT 0x00010000 #define XWT_TIMER_FAILED 0xFFFFFFFF +/* Register offsets for the WWdt device */ +#define XWT_WWDT_MWR_OFFSET 0x00 +#define XWT_WWDT_ESR_OFFSET 0x04 +#define XWT_WWDT_FCR_OFFSET 0x08 +#define XWT_WWDT_FWR_OFFSET 0x0c +#define XWT_WWDT_SWR_OFFSET 0x10 + +/* Master Write Control Register Masks */ +#define XWT_WWDT_MWR_MASK BIT(0) + +/* Enable and Status Register Masks */ +#define XWT_WWDT_ESR_WINT_MASK BIT(16) +#define XWT_WWDT_ESR_WSW_MASK BIT(8) +#define XWT_WWDT_ESR_WEN_MASK BIT(0) + +/* Function control Register Masks */ +#define XWT_WWDT_SBC_MASK 0xFF00 +#define XWT_WWDT_SBC_SHIFT 16 +#define XWT_WWDT_BSS_MASK 0xC0 + #define WATCHDOG_NAME "Xilinx Watchdog" +static int wdt_timeout; + +module_param(wdt_timeout, int, 0644); +MODULE_PARM_DESC(wdt_timeout, + "Watchdog time in seconds. (default=" + __MODULE_STRING(XWT_WWDT_DEFAULT_TIMEOUT) ")"); + /** * enum xwdt_ip_type - WDT IP type. * * @XWDT_WDT: Soft wdt ip. + * @XWDT_WWDT: Window wdt ip. */ enum xwdt_ip_type { XWDT_WDT = 0, + XWDT_WWDT = 1, }; struct xwdt_devtype_data { @@ -58,6 +93,7 @@ struct xwdt_device { spinlock_t spinlock; /* spinlock for register handling */ struct watchdog_device xilinx_wdt_wdd; struct clk *clk; + int irq; }; static int xilinx_wdt_start(struct watchdog_device *wdd) @@ -145,6 +181,220 @@ static const struct watchdog_ops xilinx_wdt_ops = { .ping = xilinx_wdt_keepalive, }; +static int is_wwdt_in_closed_window(struct watchdog_device *wdd) +{ + u32 control_status_reg; + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + + control_status_reg = ioread32(xdev->base + XWT_WWDT_ESR_OFFSET); + if (control_status_reg & XWT_WWDT_ESR_WEN_MASK) + if (!(control_status_reg & XWT_WWDT_ESR_WSW_MASK)) + return 0; + + return 1; +} + +static int xilinx_wwdt_start(struct watchdog_device *wdd) +{ + int ret; + u32 control_status_reg, fcr; + u64 time_out, pre_timeout, count; + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; + + count = clk_get_rate(xdev->clk); + if (!count) + return -EINVAL; + + /* Calculate timeout count */ + pre_timeout = count * wdd->pretimeout; + time_out = count * wdd->timeout; + if (!watchdog_active(xilinx_wdt_wdd)) { + ret = clk_enable(xdev->clk); + if (ret) { + dev_err(wdd->parent, "Failed to enable clock\n"); + return ret; + } + } + + spin_lock(&xdev->spinlock); + iowrite32(XWT_WWDT_MWR_MASK, xdev->base + XWT_WWDT_MWR_OFFSET); + iowrite32(~(u32)XWT_WWDT_ESR_WEN_MASK, + xdev->base + XWT_WWDT_ESR_OFFSET); + + if (pre_timeout) { + iowrite32((u32)(time_out - pre_timeout), + xdev->base + XWT_WWDT_FWR_OFFSET); + iowrite32((u32)pre_timeout, xdev->base + XWT_WWDT_SWR_OFFSET); + fcr = ioread32(xdev->base + XWT_WWDT_SWR_OFFSET); + fcr = (fcr >> XWT_WWDT_SBC_SHIFT) & XWT_WWDT_SBC_MASK; + fcr = fcr | XWT_WWDT_BSS_MASK; + iowrite32(fcr, xdev->base + XWT_WWDT_FCR_OFFSET); + } else { + iowrite32((u32)pre_timeout, + xdev->base + XWT_WWDT_FWR_OFFSET); + iowrite32((u32)time_out, xdev->base + XWT_WWDT_SWR_OFFSET); + iowrite32(0x0, xdev->base + XWT_WWDT_FCR_OFFSET); + } + + /* Enable the window watchdog timer */ + control_status_reg = ioread32(xdev->base + XWT_WWDT_ESR_OFFSET); + control_status_reg |= XWT_WWDT_ESR_WEN_MASK; + iowrite32(control_status_reg, xdev->base + XWT_WWDT_ESR_OFFSET); + + spin_unlock(&xdev->spinlock); + + dev_dbg(xilinx_wdt_wdd->parent, "Watchdog Started!\n"); + + return 0; +} + +static int xilinx_wwdt_stop(struct watchdog_device *wdd) +{ + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; + + if (!is_wwdt_in_closed_window(wdd)) { + dev_warn(xilinx_wdt_wdd->parent, "timer in closed window"); + return -EINVAL; + } + + spin_lock(&xdev->spinlock); + + iowrite32(XWT_WWDT_MWR_MASK, xdev->base + XWT_WWDT_MWR_OFFSET); + /* Disable the Window watchdog timer */ + iowrite32(~(u32)XWT_WWDT_ESR_WEN_MASK, + xdev->base + XWT_WWDT_ESR_OFFSET); + + spin_unlock(&xdev->spinlock); + + if (watchdog_active(xilinx_wdt_wdd)) + clk_disable(xdev->clk); + + dev_dbg(xilinx_wdt_wdd->parent, "Watchdog Stopped!\n"); + + return 0; +} + +static int xilinx_wwdt_keepalive(struct watchdog_device *wdd) +{ + u32 control_status_reg; + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + + /* Refresh in open window is ignored */ + if (!is_wwdt_in_closed_window(wdd)) + return 0; + + spin_lock(&xdev->spinlock); + + iowrite32(XWT_WWDT_MWR_MASK, xdev->base + XWT_WWDT_MWR_OFFSET); + control_status_reg = ioread32(xdev->base + XWT_WWDT_ESR_OFFSET); + control_status_reg |= XWT_WWDT_ESR_WINT_MASK; + control_status_reg &= ~XWT_WWDT_ESR_WSW_MASK; + iowrite32(control_status_reg, xdev->base + XWT_WWDT_ESR_OFFSET); + control_status_reg = ioread32(xdev->base + XWT_WWDT_ESR_OFFSET); + control_status_reg |= XWT_WWDT_ESR_WSW_MASK; + iowrite32(control_status_reg, xdev->base + XWT_WWDT_ESR_OFFSET); + + spin_unlock(&xdev->spinlock); + + return 0; +} + +static int xilinx_wwdt_set_timeout(struct watchdog_device *wdd, + unsigned int new_time) +{ + u32 ret = 0; + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; + + if (!is_wwdt_in_closed_window(wdd)) { + dev_warn(xilinx_wdt_wdd->parent, "timer in closed window"); + return -EINVAL; + } + + if (new_time < XWT_WWDT_MIN_TIMEOUT || + new_time > XWT_WWDT_MAX_TIMEOUT) { + dev_warn(xilinx_wdt_wdd->parent, + "timeout value must be %d<=x<=%d, using %d\n", + XWT_WWDT_MIN_TIMEOUT, + XWT_WWDT_MAX_TIMEOUT, new_time); + return -EINVAL; + } + + wdd->timeout = new_time; + wdd->pretimeout = 0; + + if (watchdog_active(xilinx_wdt_wdd)) { + ret = xilinx_wwdt_start(wdd); + if (ret) + dev_dbg(xilinx_wdt_wdd->parent, "timer start failed"); + } + + return 0; +} + +static int xilinx_wwdt_set_pretimeout(struct watchdog_device *wdd, + u32 new_pretimeout) +{ + u32 ret = 0; + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; + + if (!is_wwdt_in_closed_window(wdd)) { + dev_warn(xilinx_wdt_wdd->parent, "timer in closed window"); + return -EINVAL; + } + + if (new_pretimeout < wdd->min_timeout || + new_pretimeout >= wdd->timeout) + return -EINVAL; + + wdd->pretimeout = new_pretimeout; + + if (watchdog_active(xilinx_wdt_wdd)) { + ret = xilinx_wwdt_start(wdd); + if (ret) + dev_dbg(xilinx_wdt_wdd->parent, "timer start failed"); + } + + return 0; +} + +static irqreturn_t xilinx_wwdt_isr(int irq, void *wdog_arg) +{ + struct xwdt_device *xdev = wdog_arg; + + watchdog_notify_pretimeout(&xdev->xilinx_wdt_wdd); + return IRQ_HANDLED; +} + +static const struct watchdog_info xilinx_wwdt_ident = { + .options = WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_SETTIMEOUT, + .firmware_version = 1, + .identity = "xlnx_wwdt watchdog", +}; + +static const struct watchdog_info xilinx_wwdt_pretimeout_ident = { + .options = WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_PRETIMEOUT | + WDIOF_SETTIMEOUT, + .firmware_version = 1, + .identity = "xlnx_wwdt watchdog", +}; + +static const struct watchdog_ops xilinx_wwdt_ops = { + .owner = THIS_MODULE, + .start = xilinx_wwdt_start, + .stop = xilinx_wwdt_stop, + .ping = xilinx_wwdt_keepalive, + .set_timeout = xilinx_wwdt_set_timeout, + .set_pretimeout = xilinx_wwdt_set_pretimeout, +}; + static u32 xwdt_selftest(struct xwdt_device *xdev) { int i; @@ -181,11 +431,19 @@ static const struct xwdt_devtype_data xwdt_wdt_data = { .xwdt_ops = &xilinx_wdt_ops, }; +static const struct xwdt_devtype_data xwdt_wwdt_data = { + .wdttype = XWDT_WWDT, + .xwdt_info = &xilinx_wwdt_ident, + .xwdt_ops = &xilinx_wwdt_ops, +}; + static const struct of_device_id xwdt_of_match[] = { { .compatible = "xlnx,xps-timebase-wdt-1.00.a", .data = &xwdt_wdt_data }, { .compatible = "xlnx,xps-timebase-wdt-1.01.a", .data = &xwdt_wdt_data }, + { .compatible = "xlnx,versal-wwdt-1.0", + .data = &xwdt_wwdt_data }, {}, }; MODULE_DEVICE_TABLE(of, xwdt_of_match); @@ -194,7 +452,7 @@ static int xwdt_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; int rc; - u32 pfreq = 0, enable_once = 0; + u32 pfreq = 0, enable_once = 0, pre_timeout = 0; struct xwdt_device *xdev; struct watchdog_device *xilinx_wdt_wdd; const struct of_device_id *of_id; @@ -236,6 +494,12 @@ static int xwdt_probe(struct platform_device *pdev) "Parameter \"xlnx,wdt-enable-once\" not found\n"); watchdog_set_nowayout(xilinx_wdt_wdd, enable_once); + } else { + rc = of_property_read_u32(dev->of_node, "pretimeout-sec", + &pre_timeout); + if (rc) + dev_dbg(dev, + "Parameter \"pretimeout-sec\" not found\n"); } xdev->clk = devm_clk_get(dev, NULL); @@ -268,6 +532,23 @@ static int xwdt_probe(struct platform_device *pdev) xilinx_wdt_wdd->timeout = 2 * ((1 << xdev->wdt_interval) / pfreq); + } else { + xilinx_wdt_wdd->pretimeout = pre_timeout; + xilinx_wdt_wdd->timeout = XWT_WWDT_DEFAULT_TIMEOUT; + xilinx_wdt_wdd->min_timeout = XWT_WWDT_MIN_TIMEOUT; + xilinx_wdt_wdd->max_timeout = XWT_WWDT_MAX_TIMEOUT; + xdev->irq = platform_get_irq_byname(pdev, "wdt"); + if (xdev->irq > 0) { + if (!devm_request_irq(dev, xdev->irq, xilinx_wwdt_isr, + 0, dev_name(dev), xdev)) { + xilinx_wdt_wdd->info = + &xilinx_wwdt_pretimeout_ident; + } + } + rc = watchdog_init_timeout(xilinx_wdt_wdd, + wdt_timeout, &pdev->dev); + if (rc) + dev_warn(&pdev->dev, "unable to set timeout value\n"); } spin_lock_init(&xdev->spinlock);