From: Andrew Davis <afd@ti.com>
To: Bjorn Andersson <andersson@kernel.org>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Nishanth Menon <nm@ti.com>,
Vignesh Raghavendra <vigneshr@ti.com>,
Tero Kristo <kristo@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Hari Nagalla <hnagalla@ti.com>
Cc: <linux-remoteproc@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, Andrew Davis <afd@ti.com>
Subject: [PATCH v11 2/9] remoteproc: k3: Factor out TI-SCI processor control OF get function
Date: Fri, 2 Aug 2024 10:21:02 -0500 [thread overview]
Message-ID: <20240802152109.137243-3-afd@ti.com> (raw)
In-Reply-To: <20240802152109.137243-1-afd@ti.com>
Building the TSP structure is common for users of the TI-SCI processor
control interface. Factor out this function and put it with the rest
of the TI-SCI processor control functions.
Signed-off-by: Andrew Davis <afd@ti.com>
---
drivers/remoteproc/ti_k3_dsp_remoteproc.c | 28 +----------------------
drivers/remoteproc/ti_k3_r5_remoteproc.c | 28 +----------------------
drivers/remoteproc/ti_sci_proc.h | 26 +++++++++++++++++++++
3 files changed, 28 insertions(+), 54 deletions(-)
diff --git a/drivers/remoteproc/ti_k3_dsp_remoteproc.c b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
index a22d41689a7d2..1585769092924 100644
--- a/drivers/remoteproc/ti_k3_dsp_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_dsp_remoteproc.c
@@ -636,32 +636,6 @@ static void k3_dsp_release_tsp(void *data)
ti_sci_proc_release(tsp);
}
-static
-struct ti_sci_proc *k3_dsp_rproc_of_get_tsp(struct device *dev,
- const struct ti_sci_handle *sci)
-{
- struct ti_sci_proc *tsp;
- u32 temp[2];
- int ret;
-
- ret = of_property_read_u32_array(dev->of_node, "ti,sci-proc-ids",
- temp, 2);
- if (ret < 0)
- return ERR_PTR(ret);
-
- tsp = devm_kzalloc(dev, sizeof(*tsp), GFP_KERNEL);
- if (!tsp)
- return ERR_PTR(-ENOMEM);
-
- tsp->dev = dev;
- tsp->sci = sci;
- tsp->ops = &sci->ops.proc_ops;
- tsp->proc_id = temp[0];
- tsp->host_id = temp[1];
-
- return tsp;
-}
-
static int k3_dsp_rproc_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -711,7 +685,7 @@ static int k3_dsp_rproc_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(kproc->reset),
"failed to get reset\n");
- kproc->tsp = k3_dsp_rproc_of_get_tsp(dev, kproc->ti_sci);
+ kproc->tsp = ti_sci_proc_of_get_tsp(dev, kproc->ti_sci);
if (IS_ERR(kproc->tsp))
return dev_err_probe(dev, PTR_ERR(kproc->tsp),
"failed to construct ti-sci proc control\n");
diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/ti_k3_r5_remoteproc.c
index 39a47540c5900..dd6294ab81e2e 100644
--- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
@@ -1533,32 +1533,6 @@ static int k3_r5_core_of_get_sram_memories(struct platform_device *pdev,
return 0;
}
-static
-struct ti_sci_proc *k3_r5_core_of_get_tsp(struct device *dev,
- const struct ti_sci_handle *sci)
-{
- struct ti_sci_proc *tsp;
- u32 temp[2];
- int ret;
-
- ret = of_property_read_u32_array(dev_of_node(dev), "ti,sci-proc-ids",
- temp, 2);
- if (ret < 0)
- return ERR_PTR(ret);
-
- tsp = devm_kzalloc(dev, sizeof(*tsp), GFP_KERNEL);
- if (!tsp)
- return ERR_PTR(-ENOMEM);
-
- tsp->dev = dev;
- tsp->sci = sci;
- tsp->ops = &sci->ops.proc_ops;
- tsp->proc_id = temp[0];
- tsp->host_id = temp[1];
-
- return tsp;
-}
-
static int k3_r5_core_of_init(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -1633,7 +1607,7 @@ static int k3_r5_core_of_init(struct platform_device *pdev)
goto err;
}
- core->tsp = k3_r5_core_of_get_tsp(dev, core->ti_sci);
+ core->tsp = ti_sci_proc_of_get_tsp(dev, core->ti_sci);
if (IS_ERR(core->tsp)) {
ret = PTR_ERR(core->tsp);
dev_err(dev, "failed to construct ti-sci proc control, ret = %d\n",
diff --git a/drivers/remoteproc/ti_sci_proc.h b/drivers/remoteproc/ti_sci_proc.h
index 778558abcdcc5..f3911ce75252e 100644
--- a/drivers/remoteproc/ti_sci_proc.h
+++ b/drivers/remoteproc/ti_sci_proc.h
@@ -28,6 +28,32 @@ struct ti_sci_proc {
u8 host_id;
};
+static inline
+struct ti_sci_proc *ti_sci_proc_of_get_tsp(struct device *dev,
+ const struct ti_sci_handle *sci)
+{
+ struct ti_sci_proc *tsp;
+ u32 temp[2];
+ int ret;
+
+ ret = of_property_read_u32_array(dev_of_node(dev), "ti,sci-proc-ids",
+ temp, 2);
+ if (ret < 0)
+ return ERR_PTR(ret);
+
+ tsp = devm_kzalloc(dev, sizeof(*tsp), GFP_KERNEL);
+ if (!tsp)
+ return ERR_PTR(-ENOMEM);
+
+ tsp->dev = dev;
+ tsp->sci = sci;
+ tsp->ops = &sci->ops.proc_ops;
+ tsp->proc_id = temp[0];
+ tsp->host_id = temp[1];
+
+ return tsp;
+}
+
static inline int ti_sci_proc_request(struct ti_sci_proc *tsp)
{
int ret;
--
2.39.2
next prev parent reply other threads:[~2024-08-02 15:21 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 15:21 [PATCH v11 0/9] TI K3 M4F support on AM62 and AM64 SoCs Andrew Davis
2024-08-02 15:21 ` [PATCH v11 1/9] dt-bindings: remoteproc: k3-m4f: Add K3 AM64x SoCs Andrew Davis
2024-08-02 15:21 ` Andrew Davis [this message]
2024-08-19 8:49 ` [PATCH v11 2/9] remoteproc: k3: Factor out TI-SCI processor control OF get function Wadim Egorov
2024-08-02 15:21 ` [PATCH v11 3/9] remoteproc: k3-m4: Add a remoteproc driver for M4F subsystem Andrew Davis
2024-08-15 16:46 ` Mathieu Poirier
2024-08-16 14:36 ` Mathieu Poirier
2024-08-19 8:32 ` Vignesh Raghavendra
2024-08-19 15:32 ` Mathieu Poirier
2024-08-19 15:39 ` Krzysztof Kozlowski
2024-08-19 15:54 ` Andrew Davis
2024-08-21 17:12 ` Mathieu Poirier
2024-08-19 8:47 ` Wadim Egorov
2024-08-02 15:21 ` [PATCH v11 4/9] arm64: dts: ti: k3-am62: Add M4F remoteproc node Andrew Davis
2024-08-19 8:48 ` Wadim Egorov
2024-08-02 15:21 ` [PATCH v11 5/9] arm64: dts: ti: k3-am625-sk: " Andrew Davis
2024-08-02 15:21 ` [PATCH v11 6/9] arm64: dts: ti: k3-am64: " Andrew Davis
2024-08-02 15:21 ` [PATCH v11 7/9] arm64: dts: ti: k3-am642-sk: " Andrew Davis
2024-08-02 15:21 ` [PATCH v11 8/9] arm64: dts: ti: k3-am642-evm: " Andrew Davis
2024-08-02 15:21 ` [PATCH v11 9/9] arm64: defconfig: Enable TI K3 M4 remoteproc driver Andrew Davis
2025-01-08 7:31 ` Daniel Schultz
2024-08-19 8:33 ` [PATCH v11 0/9] TI K3 M4F support on AM62 and AM64 SoCs Wadim Egorov
2025-01-08 15:49 ` (subset) " Nishanth Menon
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=20240802152109.137243-3-afd@ti.com \
--to=afd@ti.com \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=hnagalla@ti.com \
--cc=kristo@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=nm@ti.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=vigneshr@ti.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.