From patchwork Thu Jan 16 13:26:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 215169 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 ED798C33CB1 for ; Thu, 16 Jan 2020 13:27:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B77982077C for ; Thu, 16 Jan 2020 13:27:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="FWdb8OyD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726362AbgAPN1W (ORCPT ); Thu, 16 Jan 2020 08:27:22 -0500 Received: from mail-dm6nam10on2067.outbound.protection.outlook.com ([40.107.93.67]:13366 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726329AbgAPN1W (ORCPT ); Thu, 16 Jan 2020 08:27:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=liFzYMe39aQ428JHsfeR79hE50VP4CmHY31EMPNbaWUlPH1+b1oCZkfyXrV/Wq3ovuz1djndpIwnFeZXjDx36b/CjtjwRQjxHcfx71qQAaywJq1/3/B85LwSxx6IilytmGur7bF5tSH1+DDMy05LEIbPylLxt7xRmK5m/qCu7jq42aGIHGz3moiIIQK6V1fWRPvq4DWOFURAJD1gyyscCEOtvPvs1ygJnQWW0PSxpUt8pEnlkwEdkus78EhPANYXQiz6aeHnme0VOuS6E9F+KZj4xj4yvf1Of7zamIvd2QkIdr+jJ6pSKB0xzo/RpicRxKrDjW+1LEfsNHyjx1g7rg== 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=aNPqEFkMSI7zbLxHQRO2idHizwtQ/8djBsSNlbSvwOw=; b=ELeMtTgyIJ9nvAEJ9FronIUlOAFL5WRFu8ktf66LNSdqUNd5iSFDs+S6zr7iU3Ez5m2Yn+d21wdtMIHcDI50OCRz8I9fnqH1yXwxmLVxqAX9pYm42fST4HaV2VrwOWVbQeORqUb5IR+YMGJK1KyBOvPFzZyAvqQEPd/McXQJ1qrQQ51qxbdaiL+LA1MZCOlUf4i8D5CiACcm6i6y6PyA4xm7pYyprpwKeSuzMHmxV4aqK14LK+e58gjHKlK8W0maVw+jj8/smIPJADrgLf8SAhizIvYYZ9bzq1iE0QUJWxMAxkCmjvvYrf/tzTbIWCTHAjsY3cWqNUjDnxOuvzOq5Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass 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=aNPqEFkMSI7zbLxHQRO2idHizwtQ/8djBsSNlbSvwOw=; b=FWdb8OyDfvIwUGnU7ODYIlJtZ+t8gyEx7K+FIfb5RWymmIGXpVqbzoYd7WS7ziMwWoS3cNtDrptQFeQizpAq0wulvtMiOm8OW7Ke5IdEArCyyWoVaBWJKWE7DvLywUAp1KVO3E3h8SVt1U0otyptcFS3cNce7VL479N2zqs8xII= Received: from SN4PR0201CA0066.namprd02.prod.outlook.com (2603:10b6:803:20::28) by BY5PR02MB6019.namprd02.prod.outlook.com (2603:10b6:a03:1b0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18; Thu, 16 Jan 2020 13:27:19 +0000 Received: from CY1NAM02FT062.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::201) by SN4PR0201CA0066.outlook.office365.com (2603:10b6:803:20::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.21 via Frontend Transport; Thu, 16 Jan 2020 13:27:19 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT062.mail.protection.outlook.com (10.152.75.60) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2644.19 via Frontend Transport; Thu, 16 Jan 2020 13:27:18 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1is5B8-0005vB-3E; Thu, 16 Jan 2020 05:27:18 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1is5B2-0001BU-Va; Thu, 16 Jan 2020 05:27:13 -0800 Received: from xsj-pvapsmtp01 (mail.xilinx.com [149.199.38.66] (may be forged)) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 00GDR629015657; Thu, 16 Jan 2020 05:27:06 -0800 Received: from [10.140.6.6] (helo=xhdappanad40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1is5Aw-00018J-8V; Thu, 16 Jan 2020 05:27:06 -0800 From: Srinivas Neeli To: linux@roeck-us.net, michal.simek@xilinx.com, shubhrajyoti.datta@xilinx.com, sgoud@xilinx.com Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, git@xilinx.com Subject: [PATCH 2/9] watchdog: of_xilinx_wdt: Used BIT macro Date: Thu, 16 Jan 2020 18:56:50 +0530 Message-Id: <1579181217-31127-3-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> References: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(376002)(346002)(136003)(39860400002)(396003)(199004)(189003)(316002)(8676002)(8936002)(478600001)(81166006)(44832011)(26005)(6666004)(186003)(7696005)(36756003)(81156014)(356004)(70586007)(336012)(5660300002)(6636002)(70206006)(107886003)(9786002)(2906002)(4326008)(2616005)(426003)(42866002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY5PR02MB6019; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; A:1; MX:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6200dfeb-fe37-4b0d-5b90-08d79a87cf5f X-MS-TrafficTypeDiagnostic: BY5PR02MB6019: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:324; X-Forefront-PRVS: 02843AA9E0 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mPbaHs4EqTAR9Hu3516MTYOeMgyY/jPNlzDddD11Xh82N1qnVQrwvP8TLPR3qm/R3YVWYVjLW8kD4SzBHzVkct/0hjF8XRujb31v13o4CjoxndJDIOBh5HZb1adegnDc5e8Z55YGSY9qiIXzYpUKgZQnVaoUN+/J8i3ozgI+08MqhjnHPqmrkW8Npj7ylSFX1jRNAdMqPlc878gkNr9VfBTag5mpuMQCZmfqwZNOtkUbzu64O79L3h5/Si/R6jSWfEtLJY0hsB3xq72cN4Hz3sFR9HalgUpXkbYH3OwhGwqbjQ0vFef7zUqa7GNHIs7CMF44P6jLBRiYbt9J/BOwxTiaKn1qEpeqnUjpWzKNyN6xFqKfQznnsGO1pgzpAngwYREgp0j2aGMccKI2PukMPSKU1044bOJAyphJx0w1cGEaWxUepKybcMmQTMPbkAmuq6fMT1QGNoa2Y4h72hqmMYhVruJRcqWz41i+DzU2rJA= X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2020 13:27:18.5329 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6200dfeb-fe37-4b0d-5b90-08d79a87cf5f X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR02MB6019 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Srinivas Goud Used BIT macro instead of mask value. Signed-off-by: Srinivas Goud Signed-off-by: Michal Simek --- drivers/watchdog/of_xilinx_wdt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index 00549164b3d7..0d7df2370db7 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -24,12 +24,12 @@ #define XWT_TBR_OFFSET 0x8 /* Timebase Register Offset */ /* Control/Status Register Masks */ -#define XWT_CSR0_WRS_MASK 0x00000008 /* Reset status */ -#define XWT_CSR0_WDS_MASK 0x00000004 /* Timer state */ -#define XWT_CSR0_EWDT1_MASK 0x00000002 /* Enable bit 1 */ +#define XWT_CSR0_WRS_MASK BIT(3) /* Reset status */ +#define XWT_CSR0_WDS_MASK BIT(2) /* Timer state */ +#define XWT_CSR0_EWDT1_MASK BIT(1) /* Enable bit 1 */ /* Control/Status Register 0/1 bits */ -#define XWT_CSRX_EWDT2_MASK 0x00000001 /* Enable bit 2 */ +#define XWT_CSRX_EWDT2_MASK BIT(0) /* Enable bit 2 */ /* SelfTest constants */ #define XWT_MAX_SELFTEST_LOOP_COUNT 0x00010000 From patchwork Thu Jan 16 13:26:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 215165 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 7E987C33CB6 for ; Thu, 16 Jan 2020 13:28:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51BC42075B for ; Thu, 16 Jan 2020 13:28:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="ViSilz0A" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbgAPN2M (ORCPT ); Thu, 16 Jan 2020 08:28:12 -0500 Received: from mail-mw2nam12on2068.outbound.protection.outlook.com ([40.107.244.68]:14497 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726329AbgAPN1Y (ORCPT ); Thu, 16 Jan 2020 08:27:24 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lrTbiTct6/6PHpGI45SCEBRiHlHm1TzMr/LyxaYWW3VmY2SFNc9PMuB/8W0mhiTYC2SVDu3TB0nHrQUXQX1ugcNdbLvV1C69r/Fkpq7ZGW5XvxZq8q3e29zFjgj5ZXKySXcy9LXPUoMX3JG/hqtL+WqvKverGjiO5wKzVCHbfyOJnyStOS0dh69sGsZi0pMdUwFq4OHpGX9J44SlkA6U5SnJvvfAXaNj61gLEHLUMv583UTyblUYDbXElvUdwtn69LgMGlD9FAb6LOqlIGUGpEv0KRlaFnqIk7OXFASwFEseRt0xB+OCfeyparJj5DRkI/Y33AwSz7cVuV5XVz7AWg== 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=slKBieQ9aPV2MJEcnHqXqVgvCBZc1VjQ4z265Kb+CCk=; b=a0ESf7wvx/D5p65tRQ7l9KUpcpX1D+NGH8hQ4xkUy6yZvliM8o5AISTVEXxzzQXRYsqdTJ0Pg2J2DQoKHdes+dp5Exm8VPhRwZn7MFeG1/5iaDzRcDDC8bPoJMnl5rhDGoRghQZtCy0jjTL2Ln7v/WzAdx2b041FIyOkjBRxrYAC1/q3tLpgZzVCM5iEHlAuYw9WvGnrIseI6TPfQIaWjdyBSeq3bsOWCZMu3IFjnjvlGx9mArNqg3VcECH8yvtOASWaxBm3tESAoVXSQkKb7hQkQpLof6Qlqw/AbRpfif1d1CIp3coZ8LE3lrcaYu/J1JqWAgszlMxMgej7SUNagg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass 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=slKBieQ9aPV2MJEcnHqXqVgvCBZc1VjQ4z265Kb+CCk=; b=ViSilz0AQ1QMNQwG5X7ZqGnsNapI9wV39OaPXTLbt/SqHYLJTnLl51/3Kox7QaTnHiK4EPNSpms7H5xivPbDlJ4dnddzNwej+f1RufTf0/N+XsNXhPwTbRGdHS0OlT6cVl8SRSwe4BKhH0LjV8GAQbdJSkP0u6+EtjVVA3+uWKo= Received: from MWHPR02CA0019.namprd02.prod.outlook.com (2603:10b6:300:4b::29) by BL0PR02MB4818.namprd02.prod.outlook.com (2603:10b6:208:28::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Thu, 16 Jan 2020 13:27:21 +0000 Received: from CY1NAM02FT006.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::200) by MWHPR02CA0019.outlook.office365.com (2603:10b6:300:4b::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.18 via Frontend Transport; Thu, 16 Jan 2020 13:27:20 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by CY1NAM02FT006.mail.protection.outlook.com (10.152.74.104) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2623.9 via Frontend Transport; Thu, 16 Jan 2020 13:27:19 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1is5B8-0005vC-Gr; Thu, 16 Jan 2020 05:27:18 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1is5B3-0001BU-3w; Thu, 16 Jan 2020 05:27:13 -0800 Received: from xsj-pvapsmtp01 (smtp2.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 00GDR9fZ016366; Thu, 16 Jan 2020 05:27:09 -0800 Received: from [10.140.6.6] (helo=xhdappanad40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1is5Az-00018J-2r; Thu, 16 Jan 2020 05:27:09 -0800 From: Srinivas Neeli To: linux@roeck-us.net, michal.simek@xilinx.com, shubhrajyoti.datta@xilinx.com, sgoud@xilinx.com Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, git@xilinx.com Subject: [PATCH 3/9] watchdog: of_xilinx_wdt: Used dev_dbg() Date: Thu, 16 Jan 2020 18:56:51 +0530 Message-Id: <1579181217-31127-4-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> References: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(396003)(136003)(346002)(376002)(189003)(199004)(8676002)(44832011)(8936002)(6666004)(81156014)(316002)(9786002)(4326008)(81166006)(6636002)(186003)(2906002)(5660300002)(7696005)(107886003)(70206006)(478600001)(36756003)(336012)(26005)(70586007)(426003)(356004)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:BL0PR02MB4818; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; MX:1; A:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 327ccf6c-12d3-41f6-6448-08d79a87cfea X-MS-TrafficTypeDiagnostic: BL0PR02MB4818: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:1284; X-Forefront-PRVS: 02843AA9E0 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KCx7cKHv5kNZBeX9PCudkkaNcbVCfsWssYX99hjcb/tRlA+V8vyyecAiMpEoyb6GaD8jC22mD933RGm0CQdp+I0LfJiU3IoI6fgqocjQ4yrIau/ONbFt1MhdiAAvowtJEAueE/wH65sQaqvRENdtpBmBtoRXvoLcg6cVSmBkFuQhv8tlHijtdLEld+9EXTvLKXBrO1zkKbxuVLx476XKCP4Y/jczR1BdOp5qHscYQyNHq5zgUeBYUvWxnByFwFSlf9jh0Rtw1ZF/umcx3f+PBDvTaaRWWZxP4ECh9n05IqP/UtuaafQ6Ak7wITh4OZlPvAcsqRmFi7EFaFfvf+WRLNzqpAuohj8pEcrOmSiql+k+GY88ITuBrdtOuD9jkAUQe1VNPiPHvs4PZEbDw3aKWf+H5MfEv3x8DxjE+6iphSsKgFBhntH3ByCN4VxPLTla X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2020 13:27:19.4410 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 327ccf6c-12d3-41f6-6448-08d79a87cfea X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR02MB4818 Sender: linux-watchdog-owner@vger.kernel.org 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 --- 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 Thu Jan 16 13:26:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 215168 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 D8939C33CB1 for ; Thu, 16 Jan 2020 13:27:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 90171207FF for ; Thu, 16 Jan 2020 13:27:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="ioNLtmyt" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728249AbgAPN1e (ORCPT ); Thu, 16 Jan 2020 08:27:34 -0500 Received: from mail-bn7nam10on2050.outbound.protection.outlook.com ([40.107.92.50]:6117 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727032AbgAPN1c (ORCPT ); Thu, 16 Jan 2020 08:27:32 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ype1loshTZIv+h3aZ9MXKbXBs/neJywdL14T3Q+B/U0TCsmxc5c3V5cJU/BWEDMSjY63/XNBDRaJcg6geql+8nEdMc6zk4qdtqag9cl6JIa6+2/b8yrHPsb7s1ocHH/+iTxLi21ZUOG5XmxQ+7Sn4/f7m/6gLS37GcA6Ri5FMU83ZOYAuIQhi0nypIsvgHSLk/HQVc1bY0O9uzwjXTQfx+qlg/80evX/daXRVTvu3yH510Ul9LbVJ/enUUj6xJRe5XLQxxUv9JXr1km0gLZboy2Bc83ZApjOHIjoI1GOppYoospHpvbv6P/vGG9d/1V5J7ctXroEYvftwF3CgNzu5w== 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=RJ+tO+0+jA3VU1HAkjBhxDH3ylXN12xX8xcn21L2fEAYwn4uUKlHTvnmh5JRkaZBNqqSCq9A39NkIS0dazfcvq+o7TuNCml7WIkjEE2oMcCu6P6Yuc3Ac2mzFBZpeDM1FrDfhLv6hx4JoY1MvzLX2yyvfirtD47dt/Lq3+QMNBQAjnw+mr7fHdYeziAPvptl0d4rNAK9HYxz77LjHo/pR2qgSI3lO9BReQ8CwDzLZAsj/JqU5fnHLMFZrGu8ApycCHmObkjJzY7/6PfXoh0S7wWBLrmymyvc/niM6DVeQKoq1AONH7bQgQaWFLd16mL048vrhtJMDjEppQdud21mlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass 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=ioNLtmytN4Fw+qzsqNLlkhwOBVrT+6M4pLpLSJtwNy6hSQo5CrzMlkNr9jIhOk6z9EkfqhJJVJ4+pmXJX8znvsR2DvomWrUVA8meJtWL0bTh6cluRPlLejFAvbwMl/XdJBfJjDENL0/pva1nS3gEPJdc89mFk+3IRb9XKlFkkUI= Received: from BN7PR02CA0009.namprd02.prod.outlook.com (2603:10b6:408:20::22) by DM6PR02MB4666.namprd02.prod.outlook.com (2603:10b6:5:ff::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.14; Thu, 16 Jan 2020 13:27:29 +0000 Received: from SN1NAM02FT063.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::207) by BN7PR02CA0009.outlook.office365.com (2603:10b6:408:20::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2644.19 via Frontend Transport; Thu, 16 Jan 2020 13:27:29 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT063.mail.protection.outlook.com (10.152.72.213) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2644.19 via Frontend Transport; Thu, 16 Jan 2020 13:27:28 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1is5BI-0005vl-CZ; Thu, 16 Jan 2020 05:27:28 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1is5BD-0001Df-8u; Thu, 16 Jan 2020 05:27:23 -0800 Received: from xsj-pvapsmtp01 (smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 00GDRCHi016370; Thu, 16 Jan 2020 05:27:12 -0800 Received: from [10.140.6.6] (helo=xhdappanad40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1is5B1-00018J-S8; Thu, 16 Jan 2020 05:27:12 -0800 From: Srinivas Neeli To: linux@roeck-us.net, michal.simek@xilinx.com, shubhrajyoti.datta@xilinx.com, sgoud@xilinx.com Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, git@xilinx.com Subject: [PATCH 4/9] watchdog: of_xilinx_wdt: Initialize watchdog via data structure Date: Thu, 16 Jan 2020 18:56:52 +0530 Message-Id: <1579181217-31127-5-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> References: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(396003)(346002)(376002)(39860400002)(189003)(199004)(36756003)(81156014)(5660300002)(8936002)(8676002)(81166006)(7696005)(316002)(4326008)(356004)(6666004)(44832011)(2906002)(70206006)(6636002)(26005)(426003)(336012)(9786002)(186003)(2616005)(107886003)(70586007)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR02MB4666; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; MX:1; A:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9f8016dd-e2a8-4007-1dd4-08d79a87d581 X-MS-TrafficTypeDiagnostic: DM6PR02MB4666: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2043; X-Forefront-PRVS: 02843AA9E0 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZXZeCNs6Yps6vvHKRwWKxKglbm5+v1yegorHNj3F7rAFTBzh++YLiI52f5Mm669+4UWV5srn65p2AgljwpPB8IkLhZgjMi7Gh0SI/vumhVIJ21S2/jEqgBGWNzya7JypC/wQsx5v3x5XRbu2l6CJr4fk2/y6/7nD+5vO4AyymNVdJV4elk2CbzRyKsMsyDSo+Q6b2WEUvu9Gc3ieDhkzzxaYhsT5kXd0cV1tjzqOx9pEd9WRTWtz/vrBRAcAsZbpTHuSAAOqOccd9midI31D2KBbfWNiIEkfiDNeJPr6mWW9ORtTd+1S0GHIatT+e/fMGElCOjqDybs0Jpe6nSCip/uo3l7L1R5EP2J0mo4dAq/qSL9JKmKlFZn8HOXwaTCBg32xxJBDHrurMuYd8HGWJ9VORiKTN8Dw0hxOJqNUipQyDlVVMcrxQsui1t0Izvul X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2020 13:27:28.8014 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f8016dd-e2a8-4007-1dd4-08d79a87d581 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR02MB4666 Sender: linux-watchdog-owner@vger.kernel.org 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 Thu Jan 16 13:26:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 215167 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=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, 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 E1548C33CB1 for ; Thu, 16 Jan 2020 13:27:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AB43E21D7D for ; Thu, 16 Jan 2020 13:27:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="ign8iS51" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727040AbgAPN1p (ORCPT ); Thu, 16 Jan 2020 08:27:45 -0500 Received: from mail-dm6nam11on2051.outbound.protection.outlook.com ([40.107.223.51]:32096 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729005AbgAPN1o (ORCPT ); Thu, 16 Jan 2020 08:27:44 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Slzr86z6jmf8GeVCVPUkWCLMviP9k/VDOtDn9JqaCiOmRUo+f6J2KNxrsAAqirug2W6KEf+2kL94oIW0hkXTMjNDNwMSmEdqudHYRa2vqtt0YLH7iegqKkaxx6a9C8uuWEMWY50xaFZRYwbSvb8H5dR2ajOY/aK50L44YBH3YfThdNlfAQjuiXP3pdRSq+vq8EzWG9gm5XPes246R3S54eqO702fYrD6eYtsk7214dq4a0D5xzhKLzZKBI8EM6/q4688T4IpAAjp2L45yWny2WvxoyOvnNFZ2PA0dH8Cbc/qSJbRevCjAaunuZK7vTt3e7MIO+vBULImq+Bsloa+dw== 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=CrM3hFaA94ZGR0dieQwlPgTi+iGbq0J/YGjqs8/a0Zc=; b=QAXo1ENKpCNMWJMYRpLwQUL9ofyUrxzWwNDM8qDNG6NCS/WIBzm6qGMOztDiI5zDolBsRs+vkX3FiD47zakC2NI+GPGI6iGAdC2RpbPmbvfOjA9xOmax6E5GqYYmDrm+XrzrLlIcIzfYA2bhqR5q72Qb+Ch64FrExB+4d16nro6knMNkpLy7gLSLnM7+3lsyzUkltVwmY3Ybrswms6z1IQ0zXwHtZp60stfuH+iX4KHKWKR3yuhc5zbXVWSzAFSR/iL+55NJQiVwuIiBD0Umez8POh8lZNBFYMd3ztUlgOvLwCCGFHVGsVsqbj/yCsBMnTc4MK2B3pygVteKhvNprw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass 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=CrM3hFaA94ZGR0dieQwlPgTi+iGbq0J/YGjqs8/a0Zc=; b=ign8iS51m+hIIkMlEcTvlMSMo6fW+cpm7GQUG++0ATM2Jge0OeQLP2kgYE5cGHJj7S4E0RNwtq38izntDXaK7Fl845yJ0SJIb1l0HnQWNLUazt/wknr7d1kmrrACS5vVhTcGjnCMuvmbbV5TWOl40/Qxzi/HKpNl+2duGhP2NOQ= Received: from BYAPR02CA0058.namprd02.prod.outlook.com (2603:10b6:a03:54::35) by BN7PR02MB4179.namprd02.prod.outlook.com (2603:10b6:406:f5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.10; Thu, 16 Jan 2020 13:27:40 +0000 Received: from SN1NAM02FT048.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::201) by BYAPR02CA0058.outlook.office365.com (2603:10b6:a03:54::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2602.15 via Frontend Transport; Thu, 16 Jan 2020 13:27:40 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT048.mail.protection.outlook.com (10.152.72.202) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2644.19 via Frontend Transport; Thu, 16 Jan 2020 13:27:39 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1is5BT-0005wN-07; Thu, 16 Jan 2020 05:27:39 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1is5BN-0001FY-SJ; Thu, 16 Jan 2020 05:27:33 -0800 Received: from xsj-pvapsmtp01 (xsj-smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 00GDRKRR016392; Thu, 16 Jan 2020 05:27:21 -0800 Received: from [10.140.6.6] (helo=xhdappanad40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1is5BA-00018J-Bu; Thu, 16 Jan 2020 05:27:20 -0800 From: Srinivas Neeli To: linux@roeck-us.net, michal.simek@xilinx.com, shubhrajyoti.datta@xilinx.com, sgoud@xilinx.com Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, git@xilinx.com Subject: [PATCH 7/9] watchdog: of_xilinx_wdt: Add Versal support Date: Thu, 16 Jan 2020 18:56:55 +0530 Message-Id: <1579181217-31127-8-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> References: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(376002)(396003)(39860400002)(346002)(189003)(199004)(81156014)(44832011)(6666004)(8676002)(356004)(5660300002)(4326008)(336012)(478600001)(70206006)(2906002)(107886003)(9786002)(36756003)(6636002)(316002)(70586007)(186003)(426003)(26005)(8936002)(81166006)(2616005)(7696005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN7PR02MB4179; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; MX:1; A:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b2b73de-f8f3-4092-edc3-08d79a87dbd0 X-MS-TrafficTypeDiagnostic: BN7PR02MB4179: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-Forefront-PRVS: 02843AA9E0 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XLjpS9YlsIgO3o2Kw4R1CQZXUADZ/zTy03vdAgu2vkQqOgLcopQSg4mQuPMVGjYuyzNSkVwhVtft1eJTFbX32zGSqzy1evz2/Lvvh2xFovx+tC39MTgVxgKsT41W8p8LgYt+CjDXkICBF/tfrhkqXGVirJs3//F//uVyPDZkLp6RwKJOLD4zVuhCPGicoJFdlOMRCYUg3GMVxli3jqtEOfzBriwLiRhsSSm2HJqZVg3+U7dtP0mcuDV3vKZKrQEvosaAJhMz4kFdgT/0uy9sWYFdvVmUdhpgyXV891OEU5UT1CT+ulgKxPcCBuKDG5CkKLWwDUf8vccS/wjWYIrzoaI+xET83Z2Kk0CE7UuK9mnNq+3rNbD4Gqr8PpCt+TuG3yvlC+SaKYoJo7UWO82fAg6LwH1mQTQlPWK3yX80I3t/9EkONMgCdMS4oJhHLJc3 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2020 13:27:39.3898 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b2b73de-f8f3-4092-edc3-08d79a87dbd0 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR02MB4179 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Srinivas Goud Versal watchdog driver uses generic watchdog mode. Generic watchdog contains closed and open window of equal timeout. Generic watchdog will generate reset signal if it is not explicitly refreshed in second window. Signed-off-by: Srinivas Goud Signed-off-by: Michal Simek Signed-off-by: Srinivas Neeli --- drivers/watchdog/of_xilinx_wdt.c | 150 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 149 insertions(+), 1 deletion(-) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index 3b93b60f1a00..d2c389d9eaa7 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -2,7 +2,7 @@ /* * Watchdog Device Driver for Xilinx axi/xps_timebase_wdt * - * (C) Copyright 2013 - 2014 Xilinx, Inc. + * (C) Copyright 2013 - 2020 Xilinx, Inc. * (C) Copyright 2011 (Alejandro Cabrera ) */ @@ -18,10 +18,19 @@ #include #include +#define XWT_WWDT_MIN_TIMEOUT 1 +#define XWT_WWDT_MAX_TIMEOUT 80 + /* Register offsets for the Wdt device */ #define XWT_TWCSR0_OFFSET 0x0 /* Control/Status Register0 */ #define XWT_TWCSR1_OFFSET 0x4 /* Control/Status Register1 */ #define XWT_TBR_OFFSET 0x8 /* Timebase Register Offset */ +#define XWT_WWREF_OFFSET 0x1000 /* Refresh Register */ +#define XWT_WWCSR_OFFSET 0x2000 /* Control/Status Register */ +#define XWT_WWOFF_OFFSET 0x2008 /* Offset Register */ +#define XWT_WWCMP0_OFFSET 0x2010 /* Compare Value Register0 */ +#define XWT_WWCMP1_OFFSET 0x2014 /* Compare Value Register1 */ +#define XWT_WWWRST_OFFSET 0x2FD0 /* Warm Reset Register */ /* Control/Status Register Masks */ #define XWT_CSR0_WRS_MASK BIT(3) /* Reset status */ @@ -31,6 +40,15 @@ /* Control/Status Register 0/1 bits */ #define XWT_CSRX_EWDT2_MASK BIT(0) /* Enable bit 2 */ +/* Refresh Register Masks */ +#define XWT_WWREF_GWRR_MASK BIT(0) /* Refresh and start new period */ + +/* Generic Control/Status Register Masks */ +#define XWT_WWCSR_GWEN_MASK BIT(0) /* Enable Bit */ + +/* Warm Reset Register Masks */ +#define XWT_WWRST_GWWRR_MASK BIT(0) /* Warm Reset Register */ + /* SelfTest constants */ #define XWT_MAX_SELFTEST_LOOP_COUNT 0x00010000 #define XWT_TIMER_FAILED 0xFFFFFFFF @@ -41,9 +59,11 @@ * 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, }; struct xwdt_devtype_data { @@ -145,6 +165,126 @@ static const struct watchdog_ops xilinx_wdt_ops = { .ping = xilinx_wdt_keepalive, }; +static int xilinx_wwdt_start(struct watchdog_device *wdd) +{ + int ret; + u32 control_status_reg; + u64 count; + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; + + unsigned long clock_f = clk_get_rate(xdev->clk); + + /* Calculate timeout count */ + count = wdd->timeout * clock_f; + ret = clk_enable(xdev->clk); + if (ret) { + dev_err(wdd->parent, "Failed to enable clock\n"); + return ret; + } + + spin_lock(&xdev->spinlock); + + /* + * Timeout count is half as there are two windows + * first window overflow is ignored (interrupt), + * reset is only generated at second window overflow + */ + count = count >> 1; + + /* Disable the generic watchdog timer */ + control_status_reg = ioread32(xdev->base + XWT_WWCSR_OFFSET); + control_status_reg &= ~(XWT_WWCSR_GWEN_MASK); + iowrite32(control_status_reg, xdev->base + XWT_WWCSR_OFFSET); + + /* Set compare and offset registers for generic watchdog timeout */ + iowrite32((u32)count, xdev->base + XWT_WWCMP0_OFFSET); + iowrite32((u32)0, xdev->base + XWT_WWCMP1_OFFSET); + iowrite32((u32)count, xdev->base + XWT_WWOFF_OFFSET); + + /* Enable the generic watchdog timer */ + control_status_reg = ioread32(xdev->base + XWT_WWCSR_OFFSET); + control_status_reg |= (XWT_WWCSR_GWEN_MASK); + iowrite32(control_status_reg, xdev->base + XWT_WWCSR_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) +{ + 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); + + /* Disable the generic watchdog timer */ + control_status_reg = ioread32(xdev->base + XWT_WWCSR_OFFSET); + control_status_reg &= ~(XWT_WWCSR_GWEN_MASK); + iowrite32(control_status_reg, xdev->base + XWT_WWCSR_OFFSET); + + spin_unlock(&xdev->spinlock); + + clk_disable(xdev->clk); + + dev_dbg(xilinx_wdt_wdd->parent, "Watchdog Stopped!\n"); + + return 0; +} + +static int xilinx_wwdt_keepalive(struct watchdog_device *wdd) +{ + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + + spin_lock(&xdev->spinlock); + + iowrite32(XWT_WWREF_GWRR_MASK, xdev->base + XWT_WWREF_OFFSET); + + spin_unlock(&xdev->spinlock); + + return 0; +} + +static int xilinx_wwdt_set_timeout(struct watchdog_device *wdd, + unsigned int new_time) +{ + struct xwdt_device *xdev = watchdog_get_drvdata(wdd); + struct watchdog_device *xilinx_wdt_wdd = &xdev->xilinx_wdt_wdd; + + 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; + + return xilinx_wwdt_start(wdd); +} + +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_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, +}; + static u32 xwdt_selftest(struct xwdt_device *xdev) { int i; @@ -181,11 +321,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); From patchwork Thu Jan 16 13:26:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Neeli X-Patchwork-Id: 215166 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 0A43FC33CB1 for ; Thu, 16 Jan 2020 13:28:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA23D2077C for ; Thu, 16 Jan 2020 13:28:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="VUyQY6zP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726899AbgAPN2F (ORCPT ); Thu, 16 Jan 2020 08:28:05 -0500 Received: from mail-eopbgr700073.outbound.protection.outlook.com ([40.107.70.73]:40833 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727008AbgAPN1m (ORCPT ); Thu, 16 Jan 2020 08:27:42 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HIExJKqCtgrnrzXaxNfVOJO/SSDbaDtozE+m9/C4rO2O4RiHMqiDqFsqk2DafadF8C2NgcgUAZmwyJynbb2hGwcVmgSeIh6xvQvw/9OTaWloV44+BIxhF6e4gDvrHBQxgEXsVJ7t1LuTI0MKKTSaT596WHcBR4sWz6oJe/x2rZOzMRHBQkXnYUvzuxaOkKTenZouz2k+gSICX6+wIxwfPBito39KQpS0Mnm1tlrfKr4lFqzjyJix7dB+jE/dMIcgzdJv6D81eKQN6eEwFJe8vQz2vgLcN5RTb79ubiE2guCMeQZMzdA+wYCBJ3DYGOcw2n0U4VR2/rTg7aOc/D80Yg== 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=zren9AmI5kwSedMoJZmzUtpomiwcxSJIc7hV5rHKd9U=; b=HbRhNCsWgDR6CSya5KH98Kh+3qH1CQbH+NR4GK7LIIPsnBaBCG1nB5pT3J1+RsbRs3bCQ0P1LjoxOrHhYLpRz24ZpVk2Ibe6M/4Mg2aQg9p0b/jhJ3p7tgy698oqt+3CR325SsOhJcqcRYScsW0gHrIGgw6JAjRq/aGIJGlh6u06n1pT1LxbhRryQiEI46kh3cDVnIVB72SejXjoZI93blh68Qr7cCiXh4SsT3G+FeYKWuTuJ7m6285RcLqAsBeTd2I8+//uUG/abCZvj7JFpYruiKmhTeWa/stIUuBySicfbZHNt9jaaaCiM9hQSVn+0qCEdCRxdXEC/qKDPhCzRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 149.199.60.83) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=xilinx.com; dmarc=bestguesspass 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=zren9AmI5kwSedMoJZmzUtpomiwcxSJIc7hV5rHKd9U=; b=VUyQY6zPnGhTTRakkgFWrxVOIwaq9ZOSMhOny6uR+7R4u9qJfdp/Y2kTBpfJwwjT3dJDtCszfQlV8YkatNsXvhTOVROyKOYqE9dKYQRoAPRW1jJ8n8dYjiGrqu2ncjzZfIVWl5wiDpWcPMFaQHCoZ53yBmvPCkKMA+SD876RYiE= Received: from BYAPR02CA0026.namprd02.prod.outlook.com (2603:10b6:a02:ee::39) by SN6PR02MB4893.namprd02.prod.outlook.com (2603:10b6:805:98::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.9; Thu, 16 Jan 2020 13:27:40 +0000 Received: from SN1NAM02FT015.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::200) by BYAPR02CA0026.outlook.office365.com (2603:10b6:a02:ee::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2623.8 via Frontend Transport; Thu, 16 Jan 2020 13:27:39 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT015.mail.protection.outlook.com (10.152.72.109) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.2644.19 via Frontend Transport; Thu, 16 Jan 2020 13:27:39 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1is5BS-0005wL-Pm; Thu, 16 Jan 2020 05:27:38 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1is5BN-0001FY-M4; Thu, 16 Jan 2020 05:27:33 -0800 Received: from xsj-pvapsmtp01 (xsj-smtp1.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id 00GDRNQ1016410; Thu, 16 Jan 2020 05:27:23 -0800 Received: from [10.140.6.6] (helo=xhdappanad40.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1is5BD-00018J-4w; Thu, 16 Jan 2020 05:27:23 -0800 From: Srinivas Neeli To: linux@roeck-us.net, michal.simek@xilinx.com, shubhrajyoti.datta@xilinx.com, sgoud@xilinx.com Cc: wim@linux-watchdog.org, linux-watchdog@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, git@xilinx.com Subject: [PATCH 8/9] watchdog: of_xilinx_wdt: Wire setting up timeout via module parameter/DT Date: Thu, 16 Jan 2020 18:56:56 +0530 Message-Id: <1579181217-31127-9-git-send-email-srinivas.neeli@xilinx.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> References: <1579181217-31127-1-git-send-email-srinivas.neeli@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(39860400002)(396003)(376002)(346002)(189003)(199004)(26005)(5660300002)(186003)(426003)(336012)(2616005)(8936002)(70586007)(7696005)(4326008)(70206006)(9786002)(107886003)(81156014)(6636002)(8676002)(44832011)(356004)(6666004)(36756003)(316002)(2906002)(81166006)(478600001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN6PR02MB4893; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; LANG:en; PTR:unknown-60-83.xilinx.com; MX:1; A:1; MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8cbbf6a6-44b7-44b9-898c-08d79a87dbae X-MS-TrafficTypeDiagnostic: SN6PR02MB4893: X-Microsoft-Antispam-PRVS: X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-MS-Oob-TLC-OOBClassifiers: OLM:2201; X-Forefront-PRVS: 02843AA9E0 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0OCqkjbZa5mx8lc+1JGsfnvO31KQ4X7B/6wjSWZWd/+XAkhsRoLY6BCaJlI8zIp0USIyl2Vg/9Atfmebbt7XIXAErsDIRYJeuhvRKUKOaT1vul6BErp4NfFkXi0yy0rdhFoUSS1i3khxWeubMS75lJmUBydPtSMM+dRYra12INqvZZ0r1mBo7dv6S4L5Bq2afYBUsienquKRbkZZ2HEjPE+Eh0XCkZUCiX2D2m4NhnTAJ7F7BNp/LkndX4m1o8d+Gwy4egfY45uOkiZjADKg3k+Pk+MZ9dsNqlnnek+sgt4PuhDaF7rS4nU9ig609p3JLryQ+ulMTpLRbe/X/AmmKpQ8bUZfeaD3gjN7/xJsbvSRkoqMFIl0rvbtvtUNT9PinclSqJX36EgbhdeGl5cG118K0a2CU7s7y8HWe6/QTI+L7Ev4/QGRnKPeYElCieXH X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2020 13:27:39.1994 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8cbbf6a6-44b7-44b9-898c-08d79a87dbae X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR02MB4893 Sender: linux-watchdog-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-watchdog@vger.kernel.org From: Srinivas Goud Add support for setting up timeout via kernel module parameter or read timeout-sec via device tree. Signed-off-by: Srinivas Goud Signed-off-by: Michal Simek --- drivers/watchdog/of_xilinx_wdt.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/watchdog/of_xilinx_wdt.c b/drivers/watchdog/of_xilinx_wdt.c index d2c389d9eaa7..375289e3bed2 100644 --- a/drivers/watchdog/of_xilinx_wdt.c +++ b/drivers/watchdog/of_xilinx_wdt.c @@ -18,6 +18,7 @@ #include #include +#define XWT_WWDT_DEFAULT_TIMEOUT 10 #define XWT_WWDT_MIN_TIMEOUT 1 #define XWT_WWDT_MAX_TIMEOUT 80 @@ -55,6 +56,13 @@ #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. * @@ -416,6 +424,15 @@ static int xwdt_probe(struct platform_device *pdev) xilinx_wdt_wdd->timeout = 2 * ((1 << xdev->wdt_interval) / pfreq); + } else { + 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; + + 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);