All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3] reset: add reset_control_status helper function
@ 2014-10-10 15:21 dinguyen
  2014-10-23 15:01 ` Dinh Nguyen
  0 siblings, 1 reply; 4+ messages in thread
From: dinguyen @ 2014-10-10 15:21 UTC (permalink / raw)
  To: p.zabel; +Cc: dinh.linux, atull, linux-kernel, Dinh Nguyen

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

There are cases where a system will want to read a reset status bit before
doing any other toggling. Add a reset_control_status helper function to the
reset controller API.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
---
v3: Remove last unsigned int and update comment
v2: reset_control_status should be returning an int, and add a comment about
    status in reset-controller.h
---
 drivers/reset/core.c             | 15 +++++++++++++++
 include/linux/reset-controller.h |  2 ++
 include/linux/reset.h            |  7 +++++++
 3 files changed, 24 insertions(+)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index baeaf82..7955e00 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -126,6 +126,21 @@ int reset_control_deassert(struct reset_control *rstc)
 EXPORT_SYMBOL_GPL(reset_control_deassert);
 
 /**
+ * reset_control_status - returns a negative errno if not supported, a
+ * positive value if the reset line is asserted, or zero if the reset
+ * line is not asserted.
+ * @rstc: reset controller
+ */
+int reset_control_status(struct reset_control *rstc)
+{
+	if (rstc->rcdev->ops->status)
+		return rstc->rcdev->ops->status(rstc->rcdev, rstc->id);
+
+	return -ENOSYS;
+}
+EXPORT_SYMBOL_GPL(reset_control_status);
+
+/**
  * of_reset_control_get - Lookup and obtain a reference to a reset controller.
  * @node: device to be reset by the controller
  * @id: reset line name
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
index 41a4695..ce6b962 100644
--- a/include/linux/reset-controller.h
+++ b/include/linux/reset-controller.h
@@ -12,11 +12,13 @@ struct reset_controller_dev;
  *         things to reset the device
  * @assert: manually assert the reset line, if supported
  * @deassert: manually deassert the reset line, if supported
+ * @status: return the status of the reset line, if supported
  */
 struct reset_control_ops {
 	int (*reset)(struct reset_controller_dev *rcdev, unsigned long id);
 	int (*assert)(struct reset_controller_dev *rcdev, unsigned long id);
 	int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id);
+	int (*status)(struct reset_controller_dev *rcdev, unsigned long id);
 };
 
 struct module;
diff --git a/include/linux/reset.h b/include/linux/reset.h
index 349f150..da5602b 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -10,6 +10,7 @@ struct reset_control;
 int reset_control_reset(struct reset_control *rstc);
 int reset_control_assert(struct reset_control *rstc);
 int reset_control_deassert(struct reset_control *rstc);
+int reset_control_status(struct reset_control *rstc);
 
 struct reset_control *reset_control_get(struct device *dev, const char *id);
 void reset_control_put(struct reset_control *rstc);
@@ -57,6 +58,12 @@ static inline int reset_control_deassert(struct reset_control *rstc)
 	return 0;
 }
 
+static inline int reset_control_status(struct reset_control *rstc)
+{
+	WARN_ON(1);
+	return 0;
+}
+
 static inline void reset_control_put(struct reset_control *rstc)
 {
 	WARN_ON(1);
-- 
2.0.3


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

* Re: [PATCHv3] reset: add reset_control_status helper function
  2014-10-10 15:21 [PATCHv3] reset: add reset_control_status helper function dinguyen
@ 2014-10-23 15:01 ` Dinh Nguyen
  2014-10-24 12:07   ` Philipp Zabel
  0 siblings, 1 reply; 4+ messages in thread
From: Dinh Nguyen @ 2014-10-23 15:01 UTC (permalink / raw)
  To: p.zabel; +Cc: dinh.linux, atull, linux-kernel

Hi Philipp,

On 10/10/2014 10:21 AM, dinguyen@opensource.altera.com wrote:
> From: Dinh Nguyen <dinguyen@opensource.altera.com>
> 
> There are cases where a system will want to read a reset status bit before
> doing any other toggling. Add a reset_control_status helper function to the
> reset controller API.
> 
> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> ---
> v3: Remove last unsigned int and update comment
> v2: reset_control_status should be returning an int, and add a comment about
>     status in reset-controller.h
> ---
>  drivers/reset/core.c             | 15 +++++++++++++++
>  include/linux/reset-controller.h |  2 ++
>  include/linux/reset.h            |  7 +++++++
>  3 files changed, 24 insertions(+)
> 
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index baeaf82..7955e00 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -126,6 +126,21 @@ int reset_control_deassert(struct reset_control *rstc)
>  EXPORT_SYMBOL_GPL(reset_control_deassert);
>  
>  /**
> + * reset_control_status - returns a negative errno if not supported, a
> + * positive value if the reset line is asserted, or zero if the reset
> + * line is not asserted.
> + * @rstc: reset controller
> + */
> +int reset_control_status(struct reset_control *rstc)
> +{
> +	if (rstc->rcdev->ops->status)
> +		return rstc->rcdev->ops->status(rstc->rcdev, rstc->id);
> +
> +	return -ENOSYS;
> +}
> +EXPORT_SYMBOL_GPL(reset_control_status);
> +
> +/**
>   * of_reset_control_get - Lookup and obtain a reference to a reset controller.
>   * @node: device to be reset by the controller
>   * @id: reset line name
> diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
> index 41a4695..ce6b962 100644
> --- a/include/linux/reset-controller.h
> +++ b/include/linux/reset-controller.h
> @@ -12,11 +12,13 @@ struct reset_controller_dev;
>   *         things to reset the device
>   * @assert: manually assert the reset line, if supported
>   * @deassert: manually deassert the reset line, if supported
> + * @status: return the status of the reset line, if supported
>   */
>  struct reset_control_ops {
>  	int (*reset)(struct reset_controller_dev *rcdev, unsigned long id);
>  	int (*assert)(struct reset_controller_dev *rcdev, unsigned long id);
>  	int (*deassert)(struct reset_controller_dev *rcdev, unsigned long id);
> +	int (*status)(struct reset_controller_dev *rcdev, unsigned long id);
>  };
>  
>  struct module;
> diff --git a/include/linux/reset.h b/include/linux/reset.h
> index 349f150..da5602b 100644
> --- a/include/linux/reset.h
> +++ b/include/linux/reset.h
> @@ -10,6 +10,7 @@ struct reset_control;
>  int reset_control_reset(struct reset_control *rstc);
>  int reset_control_assert(struct reset_control *rstc);
>  int reset_control_deassert(struct reset_control *rstc);
> +int reset_control_status(struct reset_control *rstc);
>  
>  struct reset_control *reset_control_get(struct device *dev, const char *id);
>  void reset_control_put(struct reset_control *rstc);
> @@ -57,6 +58,12 @@ static inline int reset_control_deassert(struct reset_control *rstc)
>  	return 0;
>  }
>  
> +static inline int reset_control_status(struct reset_control *rstc)
> +{
> +	WARN_ON(1);
> +	return 0;
> +}
> +
>  static inline void reset_control_put(struct reset_control *rstc)
>  {
>  	WARN_ON(1);
> 

Do you have any further comments on this version of that patch? If not,
can I get an Ack-by?

Thanks,
Dinh

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

* Re: [PATCHv3] reset: add reset_control_status helper function
  2014-10-23 15:01 ` Dinh Nguyen
@ 2014-10-24 12:07   ` Philipp Zabel
  2014-10-24 15:43     ` Dinh Nguyen
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Zabel @ 2014-10-24 12:07 UTC (permalink / raw)
  To: Dinh Nguyen; +Cc: p.zabel, dinh.linux, atull, linux-kernel

Hi Dinh,

On Thu, Oct 23, 2014 at 10:01:45AM -0500, Dinh Nguyen wrote:
> Hi Philipp,
> 
> On 10/10/2014 10:21 AM, dinguyen@opensource.altera.com wrote:
> > From: Dinh Nguyen <dinguyen@opensource.altera.com>
> > 
> > There are cases where a system will want to read a reset status bit before
> > doing any other toggling. Add a reset_control_status helper function to the
> > reset controller API.
> > 
> > Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> > ---
[...]
> Do you have any further comments on this version of that patch? If not,
> can I get an Ack-by?

I have applied it here:
git://git.pengutronix.de/git/pza/linux.git reset-for-3.19

Sorry about the delayed feedback. I was waiting for the Meson reset patches
before pushing the branch, but that might still take a while.

regards
Philipp

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

* Re: [PATCHv3] reset: add reset_control_status helper function
  2014-10-24 12:07   ` Philipp Zabel
@ 2014-10-24 15:43     ` Dinh Nguyen
  0 siblings, 0 replies; 4+ messages in thread
From: Dinh Nguyen @ 2014-10-24 15:43 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: p.zabel, dinh.linux, atull, linux-kernel

On 10/24/2014 07:07 AM, Philipp Zabel wrote:
> Hi Dinh,
> 
> On Thu, Oct 23, 2014 at 10:01:45AM -0500, Dinh Nguyen wrote:
>> Hi Philipp,
>>
>> On 10/10/2014 10:21 AM, dinguyen@opensource.altera.com wrote:
>>> From: Dinh Nguyen <dinguyen@opensource.altera.com>
>>>
>>> There are cases where a system will want to read a reset status bit before
>>> doing any other toggling. Add a reset_control_status helper function to the
>>> reset controller API.
>>>
>>> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
>>> ---
> [...]
>> Do you have any further comments on this version of that patch? If not,
>> can I get an Ack-by?
> 
> I have applied it here:
> git://git.pengutronix.de/git/pza/linux.git reset-for-3.19
> 
> Sorry about the delayed feedback. I was waiting for the Meson reset patches
> before pushing the branch, but that might still take a while.
> 
Ah thanks. I can send up a patch that populates status for SOCFPGA then.

Dinh


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

end of thread, other threads:[~2014-10-24 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-10 15:21 [PATCHv3] reset: add reset_control_status helper function dinguyen
2014-10-23 15:01 ` Dinh Nguyen
2014-10-24 12:07   ` Philipp Zabel
2014-10-24 15:43     ` Dinh Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.