From patchwork Mon Jun 6 15:56:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 69426 Delivered-To: patch@linaro.org Received: by 10.140.106.246 with SMTP id e109csp1551778qgf; Mon, 6 Jun 2016 09:00:10 -0700 (PDT) X-Received: by 10.36.222.137 with SMTP id d131mr18006117itg.4.1465228809987; Mon, 06 Jun 2016 09:00:09 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id q27si29090799pfj.25.2016.06.06.09.00.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jun 2016 09:00:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1b9wvs-0008Ni-Da; Mon, 06 Jun 2016 15:59:16 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1b9wvS-000854-22 for linux-arm-kernel@lists.infradead.org; Mon, 06 Jun 2016 15:58:51 +0000 Received: by mail-wm0-x22a.google.com with SMTP id m124so78477877wme.1 for ; Mon, 06 Jun 2016 08:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=llI6ni7rSnJ6uRD7Dt5HqG8IhnR2dwjKtZ+6V1j7MCg=; b=T96Ffm3LYjdsz15frUv3oiHuu+HZ29IDR7awmP4PYW+NQQ+zJq1dgojPHNDPHhyyr7 Wq+84s68mqUkDX/bbOYdkt/ufFJniN6bEPJJDbWP7sMINpbS5T7Lh+teLPyzAfy+6b+R QcspcNIDW6/fL1MYKxfSpM7snchCyngVNYxCo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=llI6ni7rSnJ6uRD7Dt5HqG8IhnR2dwjKtZ+6V1j7MCg=; b=iXbk6zFrVdq8yWQLmTUest1Iff1Jk98EB45r5Sk2BjEKODdmnnLFk2ymXVskEs6seH eH6rk3mKQwbER52qtpvOnkpOh9+zBXxQ9SIsOkSNgFEtng79cBkVoAUFnESwHihV3rY4 ZVb6tQrIe4HwgZr21T5Rr/W3F5gxyj86ddLL4Y1l4ICRM9rxto4aT1WoPBMR6rVfcYUp c6ZHM/vaIVWBXccuuEkY1oZCa4/Y6e3AWe7jmGYbTGr6v8HUBDocPnVM7vxQciERFKKo 1a9CpuqPcrgRz6ZbTrUpYKqTSCwIQkuvSAEoQf3wNGR7DGL0NOTPTjDQ1+QKszdWRy8+ DW5g== X-Gm-Message-State: ALyK8tLkLX3HkVtGyVIimDrzp8/GBnFZk7H081SisDjmuUZGvPWCmP5qMWFWyrNCvJ8Nzwsw X-Received: by 10.28.87.17 with SMTP id l17mr4404111wmb.5.1465228708688; Mon, 06 Jun 2016 08:58:28 -0700 (PDT) Received: from localhost.localdomain (host81-129-171-215.range81-129.btcentralplus.com. [81.129.171.215]) by smtp.gmail.com with ESMTPSA id h2sm20926040wjv.15.2016.06.06.08.58.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Jun 2016 08:58:28 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] reset: Supply *_shared variant calls when using of_* API Date: Mon, 6 Jun 2016 16:56:51 +0100 Message-Id: <20160606155655.10860-4-lee.jones@linaro.org> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160606155655.10860-1-lee.jones@linaro.org> References: <20160606155655.10860-1-lee.jones@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160606_085850_344328_85EAAE27 X-CRM114-Status: GOOD ( 14.33 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:22a listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: balbi@kernel.org, kernel@stlinux.com, srinivas.kandagatla@gmail.com, linux-usb@vger.kernel.org, kishon@ti.com, p.zabel@pengutronix.de, gregkh@linuxfoundation.org, Lee Jones , maxime.coquelin@st.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.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 --- include/linux/reset.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) -- 2.8.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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