mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCHv2] reset: add socfpga_reset_status
@ 2014-11-03 22:33 dinguyen
  2014-11-04 11:40 ` Philipp Zabel
  0 siblings, 1 reply; 2+ messages in thread
From: dinguyen @ 2014-11-03 22:33 UTC (permalink / raw)
  To: p.zabel; +Cc: dinh.linux, linux-kernel, Dinh Nguyen, Alan Tull

From: Dinh Nguyen <dinguyen@opensource.altera.com>

Populate the reset_status callback for SOCFPGA.

Signed-off-by: Alan Tull <atull@opensource.altera.com>
Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
---
v2: Remove spin_lock around readl
---
 drivers/reset/reset-socfpga.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index 79c32ca..39da5cb 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -76,9 +76,25 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
 	return 0;
 }
 
+static int socfpga_reset_status(struct reset_controller_dev *rcdev,
+				unsigned long id)
+{
+	struct socfpga_reset_data *data = container_of(rcdev,
+						struct socfpga_reset_data, rcdev);
+	int bank = id / BITS_PER_LONG;
+	int offset = id % BITS_PER_LONG;
+	unsigned long flags;
+	u32 reg;
+
+	reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
+
+	return !(reg & BIT(offset));
+}
+
 static struct reset_control_ops socfpga_reset_ops = {
 	.assert		= socfpga_reset_assert,
 	.deassert	= socfpga_reset_deassert,
+	.status		= socfpga_reset_status,
 };
 
 static int socfpga_reset_probe(struct platform_device *pdev)
-- 
2.0.3


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

* Re: [PATCHv2] reset: add socfpga_reset_status
  2014-11-03 22:33 [PATCHv2] reset: add socfpga_reset_status dinguyen
@ 2014-11-04 11:40 ` Philipp Zabel
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Zabel @ 2014-11-04 11:40 UTC (permalink / raw)
  To: dinguyen; +Cc: dinh.linux, linux-kernel, Alan Tull

Hi Dinh,

Am Montag, den 03.11.2014, 16:33 -0600 schrieb
dinguyen@opensource.altera.com:
> From: Dinh Nguyen <dinguyen@opensource.altera.com>
> 
> Populate the reset_status callback for SOCFPGA.
> 
> Signed-off-by: Alan Tull <atull@opensource.altera.com>
> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> ---
> v2: Remove spin_lock around readl
> ---
>  drivers/reset/reset-socfpga.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
> index 79c32ca..39da5cb 100644
> --- a/drivers/reset/reset-socfpga.c
> +++ b/drivers/reset/reset-socfpga.c
> @@ -76,9 +76,25 @@ static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
>  	return 0;
>  }
>  
> +static int socfpga_reset_status(struct reset_controller_dev *rcdev,
> +				unsigned long id)
> +{
> +	struct socfpga_reset_data *data = container_of(rcdev,
> +						struct socfpga_reset_data, rcdev);
> +	int bank = id / BITS_PER_LONG;
> +	int offset = id % BITS_PER_LONG;
> +	unsigned long flags;

Now the flags variable is unused.
I'll fix it up and apply it, no need to resend.

> +	u32 reg;
> +
> +	reg = readl(data->membase + OFFSET_MODRST + (bank * NR_BANKS));
> +
> +	return !(reg & BIT(offset));
> +}
> +
>  static struct reset_control_ops socfpga_reset_ops = {
>  	.assert		= socfpga_reset_assert,
>  	.deassert	= socfpga_reset_deassert,
> +	.status		= socfpga_reset_status,
>  };
>  
>  static int socfpga_reset_probe(struct platform_device *pdev)

thanks
Philipp


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

end of thread, other threads:[~2014-11-04 11:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-03 22:33 [PATCHv2] reset: add socfpga_reset_status dinguyen
2014-11-04 11:40 ` Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®