LKML Archive on lore.kernel.org
 help / Atom feed
* [PATCH] ARC: HSDK: improve reset driver
@ 2018-08-27 14:38 Eugeniy Paltsev
  2018-09-11 15:25 ` Eugeniy Paltsev
  2018-09-14 10:38 ` Philipp Zabel
  0 siblings, 2 replies; 3+ messages in thread
From: Eugeniy Paltsev @ 2018-08-27 14:38 UTC (permalink / raw)
  To: Philipp Zabel
  Cc: linux-snps-arc, linux-kernel, Alexey Brodkin, Eugeniy Paltsev

As for today HSDK reset driver implements only
.reset() callback.

In case of driver which implements one of standard
reset controller usage pattern
(call *_deassert() in probe(), call *_assert() in remove())
that leads to inoperability of this reset driver.

Improve HSDK reset driver by calling .reset() callback inside of
.assert()/.deassert() callbacks to avoid each reset controller
user adaptation for work with both reset methods
(reset() and .assert()/.deassert() pair)

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
---
 drivers/reset/reset-hsdk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c
index 8bce391c6943..1fd91df91343 100644
--- a/drivers/reset/reset-hsdk.c
+++ b/drivers/reset/reset-hsdk.c
@@ -86,6 +86,8 @@ static int hsdk_reset_reset(struct reset_controller_dev *rcdev,
 
 static const struct reset_control_ops hsdk_reset_ops = {
 	.reset	= hsdk_reset_reset,
+	.assert = hsdk_reset_reset,
+	.deassert = hsdk_reset_reset,
 };
 
 static int hsdk_reset_probe(struct platform_device *pdev)
-- 
2.14.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARC: HSDK: improve reset driver
  2018-08-27 14:38 [PATCH] ARC: HSDK: improve reset driver Eugeniy Paltsev
@ 2018-09-11 15:25 ` Eugeniy Paltsev
  2018-09-14 10:38 ` Philipp Zabel
  1 sibling, 0 replies; 3+ messages in thread
From: Eugeniy Paltsev @ 2018-09-11 15:25 UTC (permalink / raw)
  To: p.zabel; +Cc: linux-kernel, Alexey Brodkin, linux-snps-arc

Hi Philipp,

Maybe you have any comments or remarks about this patch? And if you don't could you please apply it.
Thanks!

On Mon, 2018-08-27 at 17:38 +0300, Eugeniy Paltsev wrote:
> As for today HSDK reset driver implements only
> .reset() callback.
> 
> In case of driver which implements one of standard
> reset controller usage pattern
> (call *_deassert() in probe(), call *_assert() in remove())
> that leads to inoperability of this reset driver.
> 
> Improve HSDK reset driver by calling .reset() callback inside of
> .assert()/.deassert() callbacks to avoid each reset controller
> user adaptation for work with both reset methods
> (reset() and .assert()/.deassert() pair)
> 
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> ---
>  drivers/reset/reset-hsdk.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c
> index 8bce391c6943..1fd91df91343 100644
> --- a/drivers/reset/reset-hsdk.c
> +++ b/drivers/reset/reset-hsdk.c
> @@ -86,6 +86,8 @@ static int hsdk_reset_reset(struct reset_controller_dev *rcdev,
>  
>  static const struct reset_control_ops hsdk_reset_ops = {
>  	.reset	= hsdk_reset_reset,
> +	.assert = hsdk_reset_reset,
> +	.deassert = hsdk_reset_reset,
>  };
>  
>  static int hsdk_reset_probe(struct platform_device *pdev)
-- 
 Eugeniy Paltsev

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ARC: HSDK: improve reset driver
  2018-08-27 14:38 [PATCH] ARC: HSDK: improve reset driver Eugeniy Paltsev
  2018-09-11 15:25 ` Eugeniy Paltsev
@ 2018-09-14 10:38 ` Philipp Zabel
  1 sibling, 0 replies; 3+ messages in thread
From: Philipp Zabel @ 2018-09-14 10:38 UTC (permalink / raw)
  To: Eugeniy Paltsev; +Cc: linux-snps-arc, linux-kernel, Alexey Brodkin

Hi Eugeniy,

On Mon, 2018-08-27 at 17:38 +0300, Eugeniy Paltsev wrote:
> As for today HSDK reset driver implements only
> .reset() callback.
> 
> In case of driver which implements one of standard
> reset controller usage pattern
> (call *_deassert() in probe(), call *_assert() in remove())
> that leads to inoperability of this reset driver.
> 
> Improve HSDK reset driver by calling .reset() callback inside of
> .assert()/.deassert() callbacks to avoid each reset controller
> user adaptation for work with both reset methods
> (reset() and .assert()/.deassert() pair)
> 
> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
> ---
>  drivers/reset/reset-hsdk.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c
> index 8bce391c6943..1fd91df91343 100644
> --- a/drivers/reset/reset-hsdk.c
> +++ b/drivers/reset/reset-hsdk.c
> @@ -86,6 +86,8 @@ static int hsdk_reset_reset(struct reset_controller_dev *rcdev,
>  
>  static const struct reset_control_ops hsdk_reset_ops = {
>  	.reset	= hsdk_reset_reset,
> +	.assert = hsdk_reset_reset,

This is incorrect for exclusive reset controls.
It will cause reset_control_assert() to return success for exclusive
reset controls, even though the .assert op failed to leave the reset
line asserted after the function returns.

While calling hsdk_reset_reset from .assert for shared reset controls
would be fine, I don't see how this is necessary of useful.
If a consumer driver requires the reset to be asserted upon remove(), it
must not request a shared reset control anyway, because with shared
reset controls other drivers may keep the reset line deasserted
indefinitely.

> +	.deassert = hsdk_reset_reset,

This should be fine. I wonder from time to time whether this should be
implemented in the core, in reset_control_deassert().

regards
Philipp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-27 14:38 [PATCH] ARC: HSDK: improve reset driver Eugeniy Paltsev
2018-09-11 15:25 ` Eugeniy Paltsev
2018-09-14 10:38 ` Philipp Zabel

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org linux-kernel@archiver.kernel.org
	public-inbox-index lkml


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/ public-inbox