All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dong Aisheng <aisheng.dong@nxp.com>
To: linux-clk@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, linux-imx@nxp.com,
	sudipm.mukherjee@gmail.com, sboyd@kernel.org,
	shawnguo@kernel.org, linux-pm@vger.kernel.org,
	dongas86@gmail.com, Dong Aisheng <aisheng.dong@nxp.com>
Subject: [PATCH 2/3] firmware: imx: scu-pd: export SCU PD register status
Date: Tue, 24 Nov 2020 18:08:01 +0800	[thread overview]
Message-ID: <20201124100802.22775-3-aisheng.dong@nxp.com> (raw)
In-Reply-To: <20201124100802.22775-1-aisheng.dong@nxp.com>

SCU clock-controller (SCU clock protocol) does not have a power domain
property in DT, but the sub clocks registered requires power domain to
be ready first. Export an API for SCU clk driver to query the status in
order to support -EPROBE_DEFER properly.

Link: https://lore.kernel.org/patchwork/patch/1334670/
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/firmware/imx/scu-pd.c    | 20 +++++++++++++++++++-
 include/linux/firmware/imx/sci.h |  6 ++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/imx/scu-pd.c b/drivers/firmware/imx/scu-pd.c
index 946eea292b52..53b49ef20014 100644
--- a/drivers/firmware/imx/scu-pd.c
+++ b/drivers/firmware/imx/scu-pd.c
@@ -86,6 +86,20 @@ struct imx_sc_pd_soc {
 	u8 num_ranges;
 };
 
+bool imx_scu_pd_initialized;
+
+/*
+ * SCU clock-controller (SCU clock protocol) does not have a power domain
+ * property in DT, but the sub clocks registered requires power domain to
+ * be ready first. Export an API for SCU clk driver to query the status in
+ * order to support -EPROBE_DEFER properly.
+ */
+bool imx_scu_pd_is_initialized(void)
+{
+	return imx_scu_pd_initialized;
+}
+EXPORT_SYMBOL_GPL(imx_scu_pd_is_initialized);
+
 static const struct imx_sc_pd_range imx8qxp_scu_pd_ranges[] = {
 	/* LSIO SS */
 	{ "pwm", IMX_SC_R_PWM_0, 8, true, 0 },
@@ -351,7 +365,11 @@ static int imx_sc_pd_probe(struct platform_device *pdev)
 	if (!pd_soc)
 		return -ENODEV;
 
-	return imx_scu_init_pm_domains(&pdev->dev, pd_soc);
+	ret = imx_scu_init_pm_domains(&pdev->dev, pd_soc);
+	if (!ret)
+		imx_scu_pd_initialized = true;
+
+	return ret;
 }
 
 static const struct of_device_id imx_sc_pd_match[] = {
diff --git a/include/linux/firmware/imx/sci.h b/include/linux/firmware/imx/sci.h
index 5cc63fe7e84d..0eaf00ad6305 100644
--- a/include/linux/firmware/imx/sci.h
+++ b/include/linux/firmware/imx/sci.h
@@ -22,6 +22,7 @@ int imx_scu_irq_register_notifier(struct notifier_block *nb);
 int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
 int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
 int imx_scu_soc_init(struct device *dev);
+bool imx_scu_pd_is_initialized(void);
 #else
 static inline int imx_scu_soc_init(struct device *dev)
 {
@@ -47,5 +48,10 @@ static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
 {
 	return -ENOTSUPP;
 }
+
+static inline bool imx_scu_pd_is_initialized(void)
+{
+	return false;
+}
 #endif
 #endif /* _SC_SCI_H */
-- 
2.23.0


WARNING: multiple messages have this Message-ID (diff)
From: Dong Aisheng <aisheng.dong@nxp.com>
To: linux-clk@vger.kernel.org
Cc: Dong Aisheng <aisheng.dong@nxp.com>,
	dongas86@gmail.com, linux-pm@vger.kernel.org, sboyd@kernel.org,
	linux-imx@nxp.com, shawnguo@kernel.org,
	sudipm.mukherjee@gmail.com, linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] firmware: imx: scu-pd: export SCU PD register status
Date: Tue, 24 Nov 2020 18:08:01 +0800	[thread overview]
Message-ID: <20201124100802.22775-3-aisheng.dong@nxp.com> (raw)
In-Reply-To: <20201124100802.22775-1-aisheng.dong@nxp.com>

SCU clock-controller (SCU clock protocol) does not have a power domain
property in DT, but the sub clocks registered requires power domain to
be ready first. Export an API for SCU clk driver to query the status in
order to support -EPROBE_DEFER properly.

Link: https://lore.kernel.org/patchwork/patch/1334670/
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
---
 drivers/firmware/imx/scu-pd.c    | 20 +++++++++++++++++++-
 include/linux/firmware/imx/sci.h |  6 ++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/imx/scu-pd.c b/drivers/firmware/imx/scu-pd.c
index 946eea292b52..53b49ef20014 100644
--- a/drivers/firmware/imx/scu-pd.c
+++ b/drivers/firmware/imx/scu-pd.c
@@ -86,6 +86,20 @@ struct imx_sc_pd_soc {
 	u8 num_ranges;
 };
 
+bool imx_scu_pd_initialized;
+
+/*
+ * SCU clock-controller (SCU clock protocol) does not have a power domain
+ * property in DT, but the sub clocks registered requires power domain to
+ * be ready first. Export an API for SCU clk driver to query the status in
+ * order to support -EPROBE_DEFER properly.
+ */
+bool imx_scu_pd_is_initialized(void)
+{
+	return imx_scu_pd_initialized;
+}
+EXPORT_SYMBOL_GPL(imx_scu_pd_is_initialized);
+
 static const struct imx_sc_pd_range imx8qxp_scu_pd_ranges[] = {
 	/* LSIO SS */
 	{ "pwm", IMX_SC_R_PWM_0, 8, true, 0 },
@@ -351,7 +365,11 @@ static int imx_sc_pd_probe(struct platform_device *pdev)
 	if (!pd_soc)
 		return -ENODEV;
 
-	return imx_scu_init_pm_domains(&pdev->dev, pd_soc);
+	ret = imx_scu_init_pm_domains(&pdev->dev, pd_soc);
+	if (!ret)
+		imx_scu_pd_initialized = true;
+
+	return ret;
 }
 
 static const struct of_device_id imx_sc_pd_match[] = {
diff --git a/include/linux/firmware/imx/sci.h b/include/linux/firmware/imx/sci.h
index 5cc63fe7e84d..0eaf00ad6305 100644
--- a/include/linux/firmware/imx/sci.h
+++ b/include/linux/firmware/imx/sci.h
@@ -22,6 +22,7 @@ int imx_scu_irq_register_notifier(struct notifier_block *nb);
 int imx_scu_irq_unregister_notifier(struct notifier_block *nb);
 int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable);
 int imx_scu_soc_init(struct device *dev);
+bool imx_scu_pd_is_initialized(void);
 #else
 static inline int imx_scu_soc_init(struct device *dev)
 {
@@ -47,5 +48,10 @@ static inline int imx_scu_irq_group_enable(u8 group, u32 mask, u8 enable)
 {
 	return -ENOTSUPP;
 }
+
+static inline bool imx_scu_pd_is_initialized(void)
+{
+	return false;
+}
 #endif
 #endif /* _SC_SCI_H */
-- 
2.23.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-11-24 10:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 10:07 [PATCH 0/3] clk: imx: scu: support defer probe properly Dong Aisheng
2020-11-24 10:07 ` Dong Aisheng
2020-11-24 10:08 ` [PATCH 1/3] clk: imx: scu: make scu clk driver depend on scu pd Dong Aisheng
2020-11-24 10:08   ` Dong Aisheng
2020-11-24 10:08 ` Dong Aisheng [this message]
2020-11-24 10:08   ` [PATCH 2/3] firmware: imx: scu-pd: export SCU PD register status Dong Aisheng
2020-11-24 10:08 ` [PATCH 3/3] clk: imx: scu: defer probe if scu pd is still not ready Dong Aisheng
2020-11-24 10:08   ` Dong Aisheng

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=20201124100802.22775-3-aisheng.dong@nxp.com \
    --to=aisheng.dong@nxp.com \
    --cc=dongas86@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=sboyd@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=sudipm.mukherjee@gmail.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 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.