Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3183051pxf; Mon, 15 Mar 2021 03:49:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFmz95ShSG0baNZ7q6v7iRok1tohEafFkclWrxFD73tOUl5uZ0b2uT4QqZfmOXK+DhugeX X-Received: by 2002:a17:906:8308:: with SMTP id j8mr22144837ejx.339.1615805347095; Mon, 15 Mar 2021 03:49:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1615805347; cv=pass; d=google.com; s=arc-20160816; b=IysmGD5+rAeANGyADcRi+zlZufY0lVSOuiZ5HcYaKiDKpNuI6g2ZCU6edR08x0MIJX wnbbAMf178yXAJUQsc92r4l7L7DxOGzgu3YR2hCIM7NDmUiDYrKOwmw9Wgjh7XGx8x0F TbnbmRdQo4Svj1PSn4Wn5cHCxGSzl31ea8iL71iNENO8Ox3WbLBS+/qQZBDqT7++IOGR fOe1iaiu5aGDDP2HYJJtqvnWG82TiM7pU5qw3B+SzpzCTQyf0KCuaSw2Y5/bJctUGmTE CQu3wMkjQoGWusWnZySSEV8uMF0wEXYGJaMKhYYiLoB/7Hc++qmlx9Ar2eEs+lUtswXq UOtA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:envelope-to:dkim-signature; bh=HOp3IYe7EGQb8A3JI35dveDYqbkTKZs9bHvKTu25EWk=; b=VPkBMYFvgwS3YQGUQFeijTa4qqU82ZrrSnH7o7dd7oMxEPPM6aPh82VqTfSo2iFru3 okxOg+UDBd/UGWcYWJ3fERIo72/NHq7DV5jenaS2TuDRfZcyPJpTbAeTknXp7RryU6gf CG3OSAteqGHhACww1zm27FEfZ8AO+zW3WiXKIjR1+dpmWlKTkostxTYyJrh62GDjKXLK l3uiHDpWu3fMF7YHREPwBr/+GCIvsUO/LPAsLWxPt9IsMqbHegWQdXc0+C5lVMyHNsiF hmC4SCPLWD6856yCi+puVWCqVfMh0RPKVGFPqNuXyGSvNbGepViMXLXm4TyfZNhoqj9c dSQg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=FuSwvgEZ; arc=pass (i=1 spf=pass spfdomain=xilinx.com dmarc=pass fromdomain=xilinx.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si10588886ejz.607.2021.03.15.03.48.44; Mon, 15 Mar 2021 03:49:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@xilinx.onmicrosoft.com header.s=selector2-xilinx-onmicrosoft-com header.b=FuSwvgEZ; arc=pass (i=1 spf=pass spfdomain=xilinx.com dmarc=pass fromdomain=xilinx.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xilinx.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230107AbhCOKrr (ORCPT + 99 others); Mon, 15 Mar 2021 06:47:47 -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 Content-Type: text/plain 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-kernel@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); -- 2.7.4