mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 14:42:08 +02:00
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@ti.com> Tested-by: Judith Mendez <jm@ti.com> Reviewed-by: Andrew Davis <afd@ti.com> Link: https://lore.kernel.org/r/20250513054510.3439842-22-b-padhi@ti.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
This commit is contained in:
parent
23e16e210b
commit
67de5d0e6d
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
@ -347,15 +361,8 @@ static void k3_m4_release_tsp(void *data)
|
|||
static int k3_m4_rproc_start(struct rproc *rproc)
|
||||
{
|
||||
struct k3_rproc *kproc = rproc->priv;
|
||||
int ret;
|
||||
|
||||
ret = k3_m4_rproc_ping_mbox(kproc);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = k3_rproc_release(kproc);
|
||||
|
||||
return ret;
|
||||
return k3_rproc_release(kproc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -380,13 +387,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;
|
||||
}
|
||||
|
||||
|
|
@ -493,15 +493,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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user