[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250417182001.3903905-19-b-padhi@ti.com>
Date: Thu, 17 Apr 2025 23:49:46 +0530
From: Beleswar Padhi <b-padhi@...com>
To: <andersson@...nel.org>, <mathieu.poirier@...aro.org>
CC: <afd@...com>, <hnagalla@...com>, <u-kumar1@...com>, <jm@...com>,
<jan.kiszka@...mens.com>, <christophe.jaillet@...adoo.fr>,
<jkangas@...hat.com>, <eballetbo@...hat.com>, <b-padhi@...com>,
<linux-remoteproc@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v10 18/33] remoteproc: k3-m4: Ping the mbox while acquiring the channel
The TI K3 M4 remoteproc driver acquires the mailbox channel in probe but
sends a message through the acquired channel later in .attach()/.start()
callbacks.
Put both the things together in the form of 'k3_m4_rproc_request_mbox()'
function and invoke that in the probe routine. This is done to align the
rproc_request_mbox() implementation with R5 and DSP drivers which can be
factored out at a later stage.
Signed-off-by: Beleswar Padhi <b-padhi@...com>
---
v10: Changelog:
1. Split [v9 14/26] into [v10 18/33] and [v10 19/33] patches.
Link to v9:
https://lore.kernel.org/all/20250317120622.1746415-15-b-padhi@ti.com/
drivers/remoteproc/ti_k3_m4_remoteproc.c | 39 +++++++++++-------------
1 file changed, 18 insertions(+), 21 deletions(-)
diff --git a/drivers/remoteproc/ti_k3_m4_remoteproc.c b/drivers/remoteproc/ti_k3_m4_remoteproc.c
index a8a5211bf0c7f..a59fa835d8de6 100644
--- a/drivers/remoteproc/ti_k3_m4_remoteproc.c
+++ b/drivers/remoteproc/ti_k3_m4_remoteproc.c
@@ -21,11 +21,24 @@
#include "ti_sci_proc.h"
#include "ti_k3_common.h"
-static int k3_m4_rproc_ping_mbox(struct k3_rproc *kproc)
+static int k3_m4_rproc_request_mbox(struct rproc *rproc)
{
+ struct k3_rproc *kproc = rproc->priv;
+ struct mbox_client *client = &kproc->client;
struct device *dev = kproc->dev;
int ret;
+ client->dev = dev;
+ client->tx_done = NULL;
+ client->rx_callback = k3_rproc_mbox_callback;
+ client->tx_block = false;
+ client->knows_txdone = false;
+
+ kproc->mbox = mbox_request_channel(client, 0);
+ if (IS_ERR(kproc->mbox))
+ return dev_err_probe(dev, PTR_ERR(kproc->mbox),
+ "mbox_request_channel failed\n");
+
/*
* Ping the remote processor, this is only for sanity-sake for now;
* there is no functional effect whatsoever.
@@ -36,6 +49,7 @@ static int k3_m4_rproc_ping_mbox(struct k3_rproc *kproc)
ret = mbox_send_message(kproc->mbox, (void *)RP_MBOX_ECHO_REQUEST);
if (ret < 0) {
dev_err(dev, "mbox_send_message failed: %d\n", ret);
+ mbox_free_channel(kproc->mbox);
return ret;
}
@@ -350,10 +364,6 @@ static int k3_m4_rproc_start(struct rproc *rproc)
struct device *dev = kproc->dev;
int ret;
- ret = k3_m4_rproc_ping_mbox(kproc);
- if (ret)
- return ret;
-
ret = k3_rproc_release(kproc);
if (ret)
dev_err(dev, "local-reset deassert failed, ret = %d\n", ret);
@@ -383,13 +393,6 @@ static int k3_m4_rproc_stop(struct rproc *rproc)
*/
static int k3_m4_rproc_attach(struct rproc *rproc)
{
- struct k3_rproc *kproc = rproc->priv;
- int ret;
-
- ret = k3_m4_rproc_ping_mbox(kproc);
- if (ret)
- return ret;
-
return 0;
}
@@ -496,15 +499,9 @@ static int k3_m4_rproc_probe(struct platform_device *pdev)
dev_info(dev, "configured M4F for remoteproc mode\n");
}
- kproc->client.dev = dev;
- kproc->client.tx_done = NULL;
- kproc->client.rx_callback = k3_rproc_mbox_callback;
- kproc->client.tx_block = false;
- kproc->client.knows_txdone = false;
- kproc->mbox = mbox_request_channel(&kproc->client, 0);
- if (IS_ERR(kproc->mbox))
- return dev_err_probe(dev, PTR_ERR(kproc->mbox),
- "mbox_request_channel failed\n");
+ ret = k3_m4_rproc_request_mbox(rproc);
+ if (ret)
+ return ret;
ret = devm_rproc_add(dev, rproc);
if (ret)
--
2.34.1
Powered by blists - more mailing lists