From: Akhil P Oommen <quic_akhilpo@quicinc.com>
To: freedreno <freedreno@lists.freedesktop.org>,
<dri-devel@lists.freedesktop.org>,
<linux-arm-msm@vger.kernel.org>, Rob Clark <robdclark@gmail.com>,
Bjorn Andersson <andersson@kernel.org>,
Stephen Boyd <swboyd@chromium.org>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: Douglas Anderson <dianders@chromium.org>,
<krzysztof.kozlowski@linaro.org>,
Akhil P Oommen <quic_akhilpo@quicinc.com>,
Andy Gross <agross@kernel.org>,
Konrad Dybcio <konrad.dybcio@somainline.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, <linux-clk@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH v7 2/6] clk: qcom: Allow custom reset ops
Date: Wed, 5 Oct 2022 14:37:00 +0530 [thread overview]
Message-ID: <20221005143618.v7.2.I75baff799a363bbb960376539e3a0f737377c3f1@changeid> (raw)
In-Reply-To: <1664960824-20951-1-git-send-email-quic_akhilpo@quicinc.com>
Allow soc specific clk drivers to specify a custom reset operation. We
will use this in an upcoming patch to allow gpucc driver to specify a
differet reset operation for cx_gdsc.
Signed-off-by: Akhil P Oommen <quic_akhilpo@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
(no changes since v3)
Changes in v3:
- Use pointer to const for "struct qcom_reset_ops" in qcom_reset_map (Krzysztof)
Changes in v2:
- Return error when a particular custom reset op is not implemented. (Dmitry)
drivers/clk/qcom/reset.c | 27 ++++++++++++++++++++++++++-
drivers/clk/qcom/reset.h | 8 ++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/qcom/reset.c b/drivers/clk/qcom/reset.c
index 2a16adb..10ef71b 100644
--- a/drivers/clk/qcom/reset.c
+++ b/drivers/clk/qcom/reset.c
@@ -13,7 +13,20 @@
static int qcom_reset(struct reset_controller_dev *rcdev, unsigned long id)
{
- struct qcom_reset_controller *rst = to_qcom_reset_controller(rcdev);
+ struct qcom_reset_controller *rst;
+ const struct qcom_reset_map *map;
+
+ rst = to_qcom_reset_controller(rcdev);
+ map = &rst->reset_map[id];
+
+ if (map->ops && map->ops->reset)
+ return map->ops->reset(map->priv);
+ /*
+ * If custom ops is implemented but just not this callback, return
+ * error
+ */
+ else if (map->ops)
+ return -EOPNOTSUPP;
rcdev->ops->assert(rcdev, id);
udelay(rst->reset_map[id].udelay ?: 1); /* use 1 us as default */
@@ -30,6 +43,12 @@ qcom_reset_assert(struct reset_controller_dev *rcdev, unsigned long id)
rst = to_qcom_reset_controller(rcdev);
map = &rst->reset_map[id];
+
+ if (map->ops && map->ops->assert)
+ return map->ops->assert(map->priv);
+ else if (map->ops)
+ return -EOPNOTSUPP;
+
mask = BIT(map->bit);
return regmap_update_bits(rst->regmap, map->reg, mask, mask);
@@ -44,6 +63,12 @@ qcom_reset_deassert(struct reset_controller_dev *rcdev, unsigned long id)
rst = to_qcom_reset_controller(rcdev);
map = &rst->reset_map[id];
+
+ if (map->ops && map->ops->deassert)
+ return map->ops->deassert(map->priv);
+ else if (map->ops)
+ return -EOPNOTSUPP;
+
mask = BIT(map->bit);
return regmap_update_bits(rst->regmap, map->reg, mask, 0);
diff --git a/drivers/clk/qcom/reset.h b/drivers/clk/qcom/reset.h
index b8c1135..a4d767b 100644
--- a/drivers/clk/qcom/reset.h
+++ b/drivers/clk/qcom/reset.h
@@ -8,10 +8,18 @@
#include <linux/reset-controller.h>
+struct qcom_reset_ops {
+ int (*reset)(void *priv);
+ int (*assert)(void *priv);
+ int (*deassert)(void *priv);
+};
+
struct qcom_reset_map {
unsigned int reg;
u8 bit;
u8 udelay;
+ const struct qcom_reset_ops *ops;
+ void *priv;
};
struct regmap;
--
2.7.4
next prev parent reply other threads:[~2022-10-05 9:08 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-05 9:06 [PATCH v7 0/6] clk/qcom: Support gdsc collapse polling using 'reset' interface Akhil P Oommen
2022-10-05 9:06 ` [PATCH v7 1/6] dt-bindings: clk: qcom: Support gpu cx gdsc reset Akhil P Oommen
2022-10-05 9:07 ` Akhil P Oommen [this message]
2022-10-05 9:07 ` [PATCH v7 3/6] clk: qcom: gdsc: Add a reset op to poll gdsc collapse Akhil P Oommen
2022-12-07 15:45 ` Ulf Hansson
2022-12-08 15:02 ` Akhil P Oommen
2022-12-08 15:30 ` [Freedreno] " Akhil P Oommen
2022-10-05 9:07 ` [PATCH v7 4/6] clk: qcom: gpucc-sc7280: Add cx collapse reset support Akhil P Oommen
2022-12-07 15:46 ` Ulf Hansson
2022-12-08 15:24 ` Akhil P Oommen
2022-12-08 21:09 ` Bjorn Andersson
2022-12-12 17:49 ` Akhil P Oommen
2022-10-05 9:07 ` [PATCH v7 5/6] dt-bindings: drm/msm/gpu: Add optional resets Akhil P Oommen
2022-10-05 9:07 ` [PATCH v7 6/6] arm64: dts: qcom: sc7280: Add Reset support for gpu Akhil P Oommen
2022-11-07 16:54 ` [PATCH v7 0/6] clk/qcom: Support gdsc collapse polling using 'reset' interface Akhil P Oommen
2022-12-01 22:57 ` Bjorn Andersson
2022-12-02 7:00 ` [Freedreno] " Akhil P Oommen
2022-12-06 19:58 ` Akhil P Oommen
2022-12-07 16:00 ` Ulf Hansson
2022-12-07 16:54 ` Bjorn Andersson
2022-12-08 13:40 ` Ulf Hansson
2022-12-08 14:45 ` Akhil P Oommen
2022-12-08 21:06 ` Bjorn Andersson
2022-12-09 17:36 ` Ulf Hansson
2022-12-12 15:39 ` Ulf Hansson
2022-12-12 17:43 ` Akhil P Oommen
2022-12-27 18:24 ` Bjorn Andersson
2022-12-28 9:23 ` Akhil P Oommen
2022-12-08 15:31 ` Akhil P Oommen
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=20221005143618.v7.2.I75baff799a363bbb960376539e3a0f737377c3f1@changeid \
--to=quic_akhilpo@quicinc.com \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=dianders@chromium.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=konrad.dybcio@somainline.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=robdclark@gmail.com \
--cc=sboyd@kernel.org \
--cc=swboyd@chromium.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).