linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Crystal Guo <crystal.guo@mediatek.com>
To: <p.zabel@pengutronix.de>, <robh+dt@kernel.org>, <matthias.bgg@gmail.com>
Cc: <srv_heupstream@mediatek.com>,
	<linux-mediatek@lists.infradead.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <seiya.wang@mediatek.com>,
	<stanley.chu@mediatek.com>, <yingjoe.chen@mediatek.com>,
	<fan.chen@mediatek.com>, <yong.liang@mediatek.com>,
	Crystal Guo <crystal.guo@mediatek.com>
Subject: [v2,4/6] reset-controller: ti: introduce a new reset handler
Date: Mon, 3 Aug 2020 14:15:09 +0800	[thread overview]
Message-ID: <20200803061511.29555-5-crystal.guo@mediatek.com> (raw)
In-Reply-To: <20200803061511.29555-1-crystal.guo@mediatek.com>

Add ti_syscon_reset() to integrate assert and deassert together.
If some modules need do serialized assert and deassert operations
to reset itself, reset_control_reset can be called for convenience.

Change-Id: I9046992b115a46f3594de57fa89c6a2de9957d49
---
 drivers/reset/reset-ti-syscon.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/reset/reset-ti-syscon.c b/drivers/reset/reset-ti-syscon.c
index a2635c21db7f..1c74bcb9a6c3 100644
--- a/drivers/reset/reset-ti-syscon.c
+++ b/drivers/reset/reset-ti-syscon.c
@@ -56,6 +56,7 @@ struct ti_syscon_reset_data {
 	struct regmap *regmap;
 	struct ti_syscon_reset_control *controls;
 	unsigned int nr_controls;
+	bool assert_deassert_together;
 };
 
 #define to_ti_syscon_reset_data(rcdev)	\
@@ -158,10 +159,24 @@ static int ti_syscon_reset_status(struct reset_controller_dev *rcdev,
 		!(control->flags & STATUS_SET);
 }
 
+static int ti_syscon_reset(struct reset_controller_dev *rcdev,
+			  unsigned long id)
+{
+	struct ti_syscon_reset_data *data = to_ti_syscon_reset_data(rcdev);
+
+	if (data->assert_deassert_together) {
+		ti_syscon_reset_assert(rcdev, id);
+		return ti_syscon_reset_deassert(rcdev, id);
+	} else {
+		return -ENOTSUPP;
+	}
+}
+
 static const struct reset_control_ops ti_syscon_reset_ops = {
 	.assert		= ti_syscon_reset_assert,
 	.deassert	= ti_syscon_reset_deassert,
 	.status		= ti_syscon_reset_status,
+	.reset		= ti_syscon_reset,
 };
 
 static int ti_syscon_reset_probe(struct platform_device *pdev)
@@ -204,6 +219,11 @@ static int ti_syscon_reset_probe(struct platform_device *pdev)
 		controls[i].flags = be32_to_cpup(list++);
 	}
 
+	if (of_property_read_bool(np, "assert-deassert-together"))
+		data->assert_deassert_together = true;
+	else
+		data->assert_deassert_together = false;
+
 	data->rcdev.ops = &ti_syscon_reset_ops;
 	data->rcdev.owner = THIS_MODULE;
 	data->rcdev.of_node = np;
-- 
2.18.0

  parent reply	other threads:[~2020-08-03  6:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03  6:15 [v2,0/6] introduce TI reset controller for MT8192 SoC Crystal Guo
2020-08-03  6:15 ` [v2,1/6] dt-binding: reset-controller: ti: add assert-deassert-together property Crystal Guo
2020-08-03  6:15 ` [v2,2/6] dt-binding: reset-controller: ti: add update-force property Crystal Guo
2020-08-03  6:15 ` [v2,3/6] dt-binding: reset-controller: ti: add generic-reset to compatible Crystal Guo
2020-08-04  8:15   ` Philipp Zabel
2020-08-05  3:08     ` Yingjoe Chen
2020-08-03  6:15 ` Crystal Guo [this message]
2020-08-04  5:10   ` [v2,4/6] reset-controller: ti: introduce a new reset handler Stanley Chu
2020-08-04  7:16   ` Philipp Zabel
2020-08-03  6:15 ` [v2,5/6] reset-controller: ti: Introduce force-update method Crystal Guo
2020-08-04  4:15   ` Stanley Chu
2020-08-04  7:03   ` Philipp Zabel
2020-08-10  6:57     ` Crystal Guo
2020-09-02 23:05       ` Suman Anna
2020-08-05  3:14   ` Yingjoe Chen
2020-08-03  6:15 ` [v2,6/6] arm64: dts: mt8192: add infracfg_rst node Crystal Guo

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=20200803061511.29555-5-crystal.guo@mediatek.com \
    --to=crystal.guo@mediatek.com \
    --cc=fan.chen@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=seiya.wang@mediatek.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=stanley.chu@mediatek.com \
    --cc=yingjoe.chen@mediatek.com \
    --cc=yong.liang@mediatek.com \
    /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).