Message ID | 20240220-hisi-wdt-v2-1-63edc4965b4c@outlook.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-71801-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1455145dyc; Mon, 19 Feb 2024 10:15:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUKEaixI19dipaen6NEOmlHP6sjw2KLLx6By/+KJcJaD7PXQRdqJXQOt0J4eJf6m3rM1oIFDN4l8KLTByyNYtMt54qYWw== X-Google-Smtp-Source: AGHT+IHdfxJX2zgHXZXl5EHTDvJrjotpW98oiGeTIAEm/Ce5R/U9zJS0rYbYJhsi89eogb/pEM/K X-Received: by 2002:a05:620a:1217:b0:785:d378:10a4 with SMTP id u23-20020a05620a121700b00785d37810a4mr13710506qkj.43.1708366535833; Mon, 19 Feb 2024 10:15:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708366535; cv=pass; d=google.com; s=arc-20160816; b=G9Z1xHqDf2iZl+QQ5/iTKMtLcnvDmsqHEbnk5TEJqzkIObBCtJh95bVQ8NY5NcjnMe lAHNWuTtnyBnUEGq1ipi6tYqq/tDTfCm4/SoqaEnRVifH2AH9jV54ZrUNwSUvWZCnyR5 JM6RSo0y8YwTlSEhtGPNMpwnuQhKciZ830n66Sg0YsxE3fmn19385WqB3CHnJpVdD3/a FxSNyvi8SNB1ptOu1FM1FOmZ+Asco6vTjZy7eJxpdkQlAc3zBMw2IfLRN6KdBQFpSv1/ Dswabb7W1hlzsd0EvxDxQkQBnVWL9+yYohxGt7LuuR3io/8skQZkp1IEl5fd38ALcyXZ MBNw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=reply-to:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:subject:date:from:dkim-signature; bh=4FUzOuycCAyrE7zarsHAFO8nM2tU0nD+XsFyeQx2g28=; fh=gkGIeoKe5X+P2i87mcwuwbofefU8C2UOgmWurLgHJEQ=; b=uL2WhbeM5l1shdsONFJqpx/PiMLbLzAgLvaIhOWTRtP9oL1TawoNBoGMvD6pmdRMyt bGDaQljjRM+RT5A5W1HGZB2m1z28yBTOUb/t9/bdOV4yQSPiHrDepkgsJg+XZfYdApgH P4k/ZAKXZzucRKUKZraAgrUrUuseYTfiDtU/jgDD4pTfUNXjO7bNGFWA7yTYKS+5BB53 kAQjCSYTlpH0mgRBfSU07hf1p35OLfhg+lHjHC4eo4z/7b3PZBulskvYaHPquKIWHz9I wRwyRox+ckTl9qXnx2OYzrVfFsOLvAwpxBYcdXaVL5v3EmBhzAFU6Ma8nTAFMDErsk6i C81Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bcjaxj6y; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71801-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71801-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p21-20020a05620a113500b0078718996b95si6634452qkk.82.2024.02.19.10.15.35 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 10:15:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71801-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Bcjaxj6y; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-71801-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71801-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C33F01C21AC8 for <ouuuleilei@gmail.com>; Mon, 19 Feb 2024 18:15:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AC37D487A8; Mon, 19 Feb 2024 18:14:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Bcjaxj6y" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF7FE481A7; Mon, 19 Feb 2024 18:14:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708366466; cv=none; b=WGAwwxzjgHJeuDch9/c0lZdKxr+GDOW2HrUbLaqv8jA53Avnsjt/5f9xMXJoyg8JyzRAidfCbS3Hw4X5nb9CVmTjFDaxdSAf9Lm1hSCWFdLizbf2BZCP9w64TNpTYlv5nyK781q2fnYLfhuHbhBEpmnwrnd+SrUZwjohZbOh6I8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708366466; c=relaxed/simple; bh=O+gac3yrsv2rOFibZ4kRZ9MSQo41/MsQ6GdSbvpMomU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o2oRxUjcO3Ea6gTrDruuF5247FhZD2dfj3yC/SIhOXZzhxVuzvCmnGg788N8CNf4Z8W5gS6N6EYGec77GumBl8o4t+BnQSiRbJ8iihUjAxpJwXwL/Ld28cDP32yYGxDtClWt/qTLuK838ryCGl5YxLnH0NlKybbphCC5kdgtt+o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Bcjaxj6y; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPS id 8046CC433F1; Mon, 19 Feb 2024 18:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708366465; bh=O+gac3yrsv2rOFibZ4kRZ9MSQo41/MsQ6GdSbvpMomU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Bcjaxj6yVSWWJOJ0LtIaQaOZ7YpN8xGtKUyxWMNm4zTcPmXCo3BAGT5AvyzkTg4+D HT4Yvtkk6avc8b0pxs2HJP5S2Xp4HbFMuGcue98V8wjYjAjQyv9IyljiVhwf4SAXYP N/Ok02GGIil4daiaLLTKwzjNJlUTStnzbYXYNJkJ9YJopahgT0MlgUQg7YIn1yhinW oarClhBrymCbf/bXpOeBXp/7JsW51cbn4EzQdh0txvXdnnexJiWrrfgqxFN7YQvTKM eOgyN/dRR/3FKv1DBJfCV0KLzMZ3UGS+YmYJoO42fbKt0OTNyaWiOukC46Dq1xK95c QLjY3ODEoZGIQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E174C54764; Mon, 19 Feb 2024 18:14:25 +0000 (UTC) From: Yang Xiwen via B4 Relay <devnull+forbidden405.outlook.com@kernel.org> Date: Tue, 20 Feb 2024 02:14:25 +0800 Subject: [PATCH v2 1/2] watchdog: sp805_wdt: deassert the reset if available Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240220-hisi-wdt-v2-1-63edc4965b4c@outlook.com> References: <20240220-hisi-wdt-v2-0-63edc4965b4c@outlook.com> In-Reply-To: <20240220-hisi-wdt-v2-0-63edc4965b4c@outlook.com> To: Wim Van Sebroeck <wim@linux-watchdog.org>, Guenter Roeck <linux@roeck-us.net>, Philipp Zabel <p.zabel@pengutronix.de>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Viresh Kumar <vireshk@kernel.org> Cc: linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Yang Xiwen <forbidden405@outlook.com> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1708366465; l=1680; i=forbidden405@outlook.com; s=20230724; h=from:subject:message-id; bh=Ni3PL21dVfacX58NyroZjoZbD5lmIJt2JGNnhuDX6xI=; b=PrBA7WqGLAiZ5soLMgAGUcPHe80L3qvrMa1YCgw+lIjiZRPgunPC/QJ1gC7Uhjf+LEotU467B PvLM+7GxjLJBrZn9tW4NIuMFS0RPOBYdCLLihFM3kfBALus2ZLCjFfr X-Developer-Key: i=forbidden405@outlook.com; a=ed25519; pk=qOD5jhp891/Xzc+H/PZ8LWVSWE3O/XCQnAg+5vdU2IU= X-Endpoint-Received: by B4 Relay for forbidden405@outlook.com/20230724 with auth_id=67 X-Original-From: Yang Xiwen <forbidden405@outlook.com> Reply-To: <forbidden405@outlook.com> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791352148743024021 X-GMAIL-MSGID: 1791352148743024021 |
Series |
watchdog: sp805: add reset control support
|
|
Commit Message
Yang Xiwen via B4 Relay
Feb. 19, 2024, 6:14 p.m. UTC
From: Yang Xiwen <forbidden405@outlook.com> According to the datasheet, the core has an WDOGRESn input signal that needs to be deasserted before being operational. Implement it in the driver. Signed-off-by: Yang Xiwen <forbidden405@outlook.com> --- drivers/watchdog/sp805_wdt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Comments
Le 19/02/2024 à 19:14, Yang Xiwen via B4 Relay a écrit : > From: Yang Xiwen <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org> > > According to the datasheet, the core has an WDOGRESn input signal that > needs to be deasserted before being operational. Implement it in the > driver. > > Signed-off-by: Yang Xiwen <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org> > --- > drivers/watchdog/sp805_wdt.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c > index 2756ed54ca3d..b4bcfdeb39e6 100644 > --- a/drivers/watchdog/sp805_wdt.c > +++ b/drivers/watchdog/sp805_wdt.c > @@ -25,6 +25,7 @@ > #include <linux/moduleparam.h> > #include <linux/pm.h> > #include <linux/property.h> > +#include <linux/reset.h> > #include <linux/slab.h> > #include <linux/spinlock.h> > #include <linux/types.h> > @@ -59,6 +60,7 @@ > * @lock: spin lock protecting dev structure and io access > * @base: base address of wdt > * @clk: (optional) clock structure of wdt > + * @rst: (optional) reset control signal of wdt > * @rate: (optional) clock rate when provided via properties > * @adev: amba device structure of wdt > * @status: current status of wdt > @@ -69,6 +71,7 @@ struct sp805_wdt { > spinlock_t lock; > void __iomem *base; > struct clk *clk; > + struct reset_control *rst; > u64 rate; > struct amba_device *adev; > unsigned int load_val; > @@ -264,6 +267,12 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) > return -ENODEV; > } > > + wdt->rst = devm_reset_control_get_optional(&adev->dev, NULL); > + if (IS_ERR(wdt->rst)) > + return dev_err_probe(&adev->dev, PTR_ERR(wdt->rst), "Can not get reset\n"); > + > + reset_control_deassert(wdt->rst); > + Hi, Is a corresponding reset_control_assert() needed in the remove function? CJ > wdt->adev = adev; > wdt->wdd.info = &wdt_info; > wdt->wdd.ops = &wdt_ops; >
On 2/20/2024 2:22 AM, Christophe JAILLET wrote: > Le 19/02/2024 à 19:14, Yang Xiwen via B4 Relay a écrit : >> From: Yang Xiwen <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org> >> >> According to the datasheet, the core has an WDOGRESn input signal that >> needs to be deasserted before being operational. Implement it in the >> driver. >> >> Signed-off-by: Yang Xiwen >> <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org> >> --- >> drivers/watchdog/sp805_wdt.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c >> index 2756ed54ca3d..b4bcfdeb39e6 100644 >> --- a/drivers/watchdog/sp805_wdt.c >> +++ b/drivers/watchdog/sp805_wdt.c >> @@ -25,6 +25,7 @@ >> #include <linux/moduleparam.h> >> #include <linux/pm.h> >> #include <linux/property.h> >> +#include <linux/reset.h> >> #include <linux/slab.h> >> #include <linux/spinlock.h> >> #include <linux/types.h> >> @@ -59,6 +60,7 @@ >> * @lock: spin lock protecting dev structure and io access >> * @base: base address of wdt >> * @clk: (optional) clock structure of wdt >> + * @rst: (optional) reset control signal of wdt >> * @rate: (optional) clock rate when provided via properties >> * @adev: amba device structure of wdt >> * @status: current status of wdt >> @@ -69,6 +71,7 @@ struct sp805_wdt { >> spinlock_t lock; >> void __iomem *base; >> struct clk *clk; >> + struct reset_control *rst; >> u64 rate; >> struct amba_device *adev; >> unsigned int load_val; >> @@ -264,6 +267,12 @@ sp805_wdt_probe(struct amba_device *adev, const >> struct amba_id *id) >> return -ENODEV; >> } >> + wdt->rst = devm_reset_control_get_optional(&adev->dev, NULL); >> + if (IS_ERR(wdt->rst)) >> + return dev_err_probe(&adev->dev, PTR_ERR(wdt->rst), "Can not >> get reset\n"); >> + >> + reset_control_deassert(wdt->rst); >> + > > Hi, > > Is a corresponding reset_control_assert() needed in the remove function? I'll add it in next version. Though it's not very critical I think. It's already disabled from the control register. > > CJ > >> wdt->adev = adev; >> wdt->wdd.info = &wdt_info; >> wdt->wdd.ops = &wdt_ops; >> >
On 2/20/2024 2:22 AM, Christophe JAILLET wrote: > Le 19/02/2024 à 19:14, Yang Xiwen via B4 Relay a écrit : >> From: Yang Xiwen <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org> >> >> According to the datasheet, the core has an WDOGRESn input signal that >> needs to be deasserted before being operational. Implement it in the >> driver. >> >> Signed-off-by: Yang Xiwen >> <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org> >> --- >> drivers/watchdog/sp805_wdt.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c >> index 2756ed54ca3d..b4bcfdeb39e6 100644 >> --- a/drivers/watchdog/sp805_wdt.c >> +++ b/drivers/watchdog/sp805_wdt.c >> @@ -25,6 +25,7 @@ >> #include <linux/moduleparam.h> >> #include <linux/pm.h> >> #include <linux/property.h> >> +#include <linux/reset.h> >> #include <linux/slab.h> >> #include <linux/spinlock.h> >> #include <linux/types.h> >> @@ -59,6 +60,7 @@ >> * @lock: spin lock protecting dev structure and io access >> * @base: base address of wdt >> * @clk: (optional) clock structure of wdt >> + * @rst: (optional) reset control signal of wdt >> * @rate: (optional) clock rate when provided via properties >> * @adev: amba device structure of wdt >> * @status: current status of wdt >> @@ -69,6 +71,7 @@ struct sp805_wdt { >> spinlock_t lock; >> void __iomem *base; >> struct clk *clk; >> + struct reset_control *rst; >> u64 rate; >> struct amba_device *adev; >> unsigned int load_val; >> @@ -264,6 +267,12 @@ sp805_wdt_probe(struct amba_device *adev, const >> struct amba_id *id) >> return -ENODEV; >> } >> + wdt->rst = devm_reset_control_get_optional(&adev->dev, NULL); >> + if (IS_ERR(wdt->rst)) >> + return dev_err_probe(&adev->dev, PTR_ERR(wdt->rst), "Can not >> get reset\n"); >> + >> + reset_control_deassert(wdt->rst); >> + > > Hi, > > Is a corresponding reset_control_assert() needed in the remove function? I don't think it makes much sense. Many drivers in kernel does not reassert the resets in their driver's remove callback too. Maybe it can save some power. But since it's already disabled in control register. Can't say it's too much. > > CJ > >> wdt->adev = adev; >> wdt->wdd.info = &wdt_info; >> wdt->wdd.ops = &wdt_ops; >> >
On Di, 2024-02-20 at 02:14 +0800, Yang Xiwen via B4 Relay wrote: > From: Yang Xiwen <forbidden405@outlook.com> > > According to the datasheet, the core has an WDOGRESn input signal that > needs to be deasserted before being operational. Implement it in the > driver. > > Signed-off-by: Yang Xiwen <forbidden405@outlook.com> > --- > drivers/watchdog/sp805_wdt.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c > index 2756ed54ca3d..b4bcfdeb39e6 100644 > --- a/drivers/watchdog/sp805_wdt.c > +++ b/drivers/watchdog/sp805_wdt.c > @@ -25,6 +25,7 @@ > #include <linux/moduleparam.h> > #include <linux/pm.h> > #include <linux/property.h> > +#include <linux/reset.h> > #include <linux/slab.h> > #include <linux/spinlock.h> > #include <linux/types.h> > @@ -59,6 +60,7 @@ > * @lock: spin lock protecting dev structure and io access > * @base: base address of wdt > * @clk: (optional) clock structure of wdt > + * @rst: (optional) reset control signal of wdt > * @rate: (optional) clock rate when provided via properties > * @adev: amba device structure of wdt > * @status: current status of wdt > @@ -69,6 +71,7 @@ struct sp805_wdt { > spinlock_t lock; > void __iomem *base; > struct clk *clk; > + struct reset_control *rst; This can be a local variable in sp805_wdt_probe(). > u64 rate; > struct amba_device *adev; > unsigned int load_val; > @@ -264,6 +267,12 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) > return -ENODEV; > } > > + wdt->rst = devm_reset_control_get_optional(&adev->dev, NULL); Please use devm_reset_control_get_optional_exclusive() directly. > + if (IS_ERR(wdt->rst)) > + return dev_err_probe(&adev->dev, PTR_ERR(wdt->rst), "Can not get reset\n"); > + > + reset_control_deassert(wdt->rst); > + > wdt->adev = adev; > wdt->wdd.info = &wdt_info; > wdt->wdd.ops = &wdt_ops; regards Philipp
On Di, 2024-02-20 at 03:00 +0800, Yang Xiwen wrote: > On 2/20/2024 2:22 AM, Christophe JAILLET wrote: > > Le 19/02/2024 à 19:14, Yang Xiwen via B4 Relay a écrit : > > > From: Yang Xiwen <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org> > > > > > > According to the datasheet, the core has an WDOGRESn input signal that > > > needs to be deasserted before being operational. Implement it in the > > > driver. > > > > > > Signed-off-by: Yang Xiwen > > > <forbidden405-1ViLX0X+lBJBDgjK7y7TUQ@public.gmane.org> > > > --- > > > drivers/watchdog/sp805_wdt.c | 9 +++++++++ > > > 1 file changed, 9 insertions(+) > > > > > > diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c > > > index 2756ed54ca3d..b4bcfdeb39e6 100644 > > > --- a/drivers/watchdog/sp805_wdt.c > > > +++ b/drivers/watchdog/sp805_wdt.c > > > @@ -25,6 +25,7 @@ > > > #include <linux/moduleparam.h> > > > #include <linux/pm.h> > > > #include <linux/property.h> > > > +#include <linux/reset.h> > > > #include <linux/slab.h> > > > #include <linux/spinlock.h> > > > #include <linux/types.h> > > > @@ -59,6 +60,7 @@ > > > * @lock: spin lock protecting dev structure and io access > > > * @base: base address of wdt > > > * @clk: (optional) clock structure of wdt > > > + * @rst: (optional) reset control signal of wdt > > > * @rate: (optional) clock rate when provided via properties > > > * @adev: amba device structure of wdt > > > * @status: current status of wdt > > > @@ -69,6 +71,7 @@ struct sp805_wdt { > > > spinlock_t lock; > > > void __iomem *base; > > > struct clk *clk; > > > + struct reset_control *rst; > > > u64 rate; > > > struct amba_device *adev; > > > unsigned int load_val; > > > @@ -264,6 +267,12 @@ sp805_wdt_probe(struct amba_device *adev, const > > > struct amba_id *id) > > > return -ENODEV; > > > } > > > + wdt->rst = devm_reset_control_get_optional(&adev->dev, NULL); > > > + if (IS_ERR(wdt->rst)) > > > + return dev_err_probe(&adev->dev, PTR_ERR(wdt->rst), "Can not > > > get reset\n"); > > > + > > > + reset_control_deassert(wdt->rst); > > > + > > > > Hi, > > > > Is a corresponding reset_control_assert() needed in the remove function? > > I don't think it makes much sense. Many drivers in kernel does not > reassert the resets in their driver's remove callback too. In general, balancing deassert/assert is only required for shared reset controls. For exclusive reset controls, it depends on whether the driver has any expectations that the reset was asserted at some point before deassert is called, possibly to reset registers or some internal state. E.g., if this driver is unbound and then bound again, the deassert during second probe is a no-op. regards Philipp
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index 2756ed54ca3d..b4bcfdeb39e6 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -25,6 +25,7 @@ #include <linux/moduleparam.h> #include <linux/pm.h> #include <linux/property.h> +#include <linux/reset.h> #include <linux/slab.h> #include <linux/spinlock.h> #include <linux/types.h> @@ -59,6 +60,7 @@ * @lock: spin lock protecting dev structure and io access * @base: base address of wdt * @clk: (optional) clock structure of wdt + * @rst: (optional) reset control signal of wdt * @rate: (optional) clock rate when provided via properties * @adev: amba device structure of wdt * @status: current status of wdt @@ -69,6 +71,7 @@ struct sp805_wdt { spinlock_t lock; void __iomem *base; struct clk *clk; + struct reset_control *rst; u64 rate; struct amba_device *adev; unsigned int load_val; @@ -264,6 +267,12 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id) return -ENODEV; } + wdt->rst = devm_reset_control_get_optional(&adev->dev, NULL); + if (IS_ERR(wdt->rst)) + return dev_err_probe(&adev->dev, PTR_ERR(wdt->rst), "Can not get reset\n"); + + reset_control_deassert(wdt->rst); + wdt->adev = adev; wdt->wdd.info = &wdt_info; wdt->wdd.ops = &wdt_ops;