linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: lee.jones@linaro.org (Lee Jones)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/7] reset: Supply *_shared variant calls when using of_* API
Date: Mon,  6 Jun 2016 16:56:51 +0100	[thread overview]
Message-ID: <20160606155655.10860-4-lee.jones@linaro.org> (raw)
In-Reply-To: <20160606155655.10860-1-lee.jones@linaro.org>

Consumers need to be able to specify whether they are requesting an
'exclusive' or 'shared' reset line no matter which API (of_*, devm_*,
etc) they are using.  This change allows users of the of_* API in
particular to specify that their request is for a 'shared' line.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 include/linux/reset.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/include/linux/reset.h b/include/linux/reset.h
index 9cf4cf3..fd69240 100644
--- a/include/linux/reset.h
+++ b/include/linux/reset.h
@@ -158,6 +158,31 @@ static inline struct reset_control *of_reset_control_get_exclusive(
 }
 
 /**
+ * of_reset_control_get_shared - Lookup and obtain an shared reference
+ *                               to a reset controller.
+ * @node: device to be reset by the controller
+ * @id: reset line name
+ *
+ * When a reset-control is shared, the behavior of reset_control_assert /
+ * deassert is changed, the reset-core will keep track of a deassert_count
+ * and only (re-)assert the reset after reset_control_assert has been called
+ * as many times as reset_control_deassert was called. Also see the remark
+ * about shared reset-controls in the reset_control_assert docs.
+ *
+ * Calling reset_control_assert without first calling reset_control_deassert
+ * is not allowed on a shared reset control. Calling reset_control_reset is
+ * also not allowed on a shared reset control.
+ * Returns a struct reset_control or IS_ERR() condition containing errno.
+ *
+ * Use of id names is optional.
+ */
+static inline struct reset_control *of_reset_control_get_shared(
+				struct device_node *node, const char *id)
+{
+	return __of_reset_control_get(node, id, 0, 1);
+}
+
+/**
  * of_reset_control_get_exclusive_by_index - Lookup and obtain an exclusive
  *                                           reference to a reset controller
  *                                           by index.
@@ -175,6 +200,34 @@ static inline struct reset_control *of_reset_control_get_exclusive_by_index(
 }
 
 /**
+ * of_reset_control_get_shared_by_index - Lookup and obtain an shared
+ *                                        reference to a reset controller
+ *                                        by index.
+ * @node: device to be reset by the controller
+ * @index: index of the reset controller
+ *
+ * When a reset-control is shared, the behavior of reset_control_assert /
+ * deassert is changed, the reset-core will keep track of a deassert_count
+ * and only (re-)assert the reset after reset_control_assert has been called
+ * as many times as reset_control_deassert was called. Also see the remark
+ * about shared reset-controls in the reset_control_assert docs.
+ *
+ * Calling reset_control_assert without first calling reset_control_deassert
+ * is not allowed on a shared reset control. Calling reset_control_reset is
+ * also not allowed on a shared reset control.
+ * Returns a struct reset_control or IS_ERR() condition containing errno.
+ *
+ * This is to be used to perform a list of resets for a device or power domain
+ * in whatever order. Returns a struct reset_control or IS_ERR() condition
+ * containing errno.
+ */
+static inline struct reset_control *of_reset_control_get_shared_by_index(
+					struct device_node *node, int index)
+{
+	return __of_reset_control_get(node, NULL, index, 1);
+}
+
+/**
  * devm_reset_control_get_exclusive - resource managed
  *                                    reset_control_get_exclusive()
  * @dev: device to be reset by the controller
-- 
2.8.3

  parent reply	other threads:[~2016-06-06 15:56 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-06 15:56 [PATCH 0/7] reset: Consumers to explicitly request 'exclusive' or 'shared' lines Lee Jones
2016-06-06 15:56 ` [PATCH 1/7] reset: Reorder inline reset_control_get*() wrappers Lee Jones
2016-06-20 12:07   ` Philipp Zabel
2016-06-06 15:56 ` [PATCH 2/7] reset: Ensure drivers are explicit when requesting reset lines Lee Jones
2016-06-06 15:56 ` Lee Jones [this message]
2016-06-06 15:56 ` [PATCH 4/7] reset: Supply *_shared variant calls when using *_optional APIs Lee Jones
2016-06-28  8:56   ` Lee Jones
2016-06-29  7:48     ` Philipp Zabel
2016-06-29  8:06       ` Lee Jones
2016-06-29  9:23         ` Philipp Zabel
2016-06-29  9:37           ` Lee Jones
2016-06-29 21:57             ` Philipp Zabel
2016-06-06 15:56 ` [PATCH 5/7] reset: TRIVIAL: Add line break at same place for similar APIs Lee Jones
2016-06-06 15:56 ` [PATCH 6/7] phy: miphy28lp: Inform the reset framework that our reset line may be shared Lee Jones
2016-06-07  8:37   ` [STLinux Kernel] " Peter Griffin
2016-06-07  8:59   ` Kishon Vijay Abraham I
2016-06-28  7:55     ` Lee Jones
2016-06-06 15:56 ` [PATCH 7/7] usb: dwc3: st: " Lee Jones
2016-06-06 17:08   ` [PATCH 8/10] phy: phy-stih407-usb: " Lee Jones
2016-06-06 17:08     ` [PATCH 9/10] usb: host: ehci-st: " Lee Jones
2016-06-06 17:44       ` Alan Stern
2016-06-28  7:58         ` Lee Jones
2016-06-28  8:01           ` Lee Jones
2016-06-07  8:36       ` [STLinux Kernel] " Peter Griffin
2016-06-06 17:08     ` [PATCH 10/10] usb: host: ohci-st: " Lee Jones
2016-06-07  8:36     ` [STLinux Kernel] [PATCH 8/10] phy: phy-stih407-usb: " Peter Griffin
2016-06-07  9:00     ` Kishon Vijay Abraham I
2016-06-07  8:36   ` [STLinux Kernel] [PATCH 7/7] usb: dwc3: st: " Peter Griffin
2016-06-16  9:03   ` Philipp Zabel
2016-06-28  9:27   ` [PATCH 1/1] " Lee Jones
2016-06-29  6:33     ` Felipe Balbi
2016-06-07  8:42 ` [STLinux Kernel] [PATCH 0/7] reset: Consumers to explicitly request 'exclusive' or 'shared' lines Peter Griffin
2016-06-07  9:15   ` Lee Jones
2016-06-07  9:24     ` Lee Jones
2016-06-16  9:03       ` Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160606155655.10860-4-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).