From c40d7d4e05dba3fdcaae93dad91475302551c361 Mon Sep 17 00:00:00 2001 From: Suman Anna Date: Fri, 22 Feb 2019 17:37:49 -0600 Subject: [PATCH] remoteproc/pru: use macros and types from omap mailbox The actual payload size for OMAP Mailboxes is 32-bits, and the type to use with the OMAP Mailbox driver is mbox_msg_t. This type can vary in size (32-bits or 64-bits) depending on the platform the driver is being built for. Update the PRU remoteproc driver to use the types and macros provided by the OMAP Mailbox driver to always convert safely between the mailbox payload size and the pointers the data is exchanged between the OMAP Mailbox implementation driver and its client drivers. Signed-off-by: Suman Anna --- drivers/remoteproc/pru_rproc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/pru_rproc.c b/drivers/remoteproc/pru_rproc.c index 8d1bb5151f0f..0d5dfda6c8dd 100644 --- a/drivers/remoteproc/pru_rproc.c +++ b/drivers/remoteproc/pru_rproc.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -602,7 +603,7 @@ static void pru_rproc_mbox_callback(struct mbox_client *client, void *data) { struct pru_rproc *pru = container_of(client, struct pru_rproc, client); struct device *dev = &pru->rproc->dev; - u32 msg = (u32)data; + u32 msg = to_omap_mbox_msg(data); dev_dbg(dev, "mbox msg: 0x%x\n", msg); @@ -642,6 +643,7 @@ static void pru_rproc_kick(struct rproc *rproc, int vq_id) struct device *dev = &rproc->dev; struct pru_rproc *pru = rproc->priv; int ret; + mbox_msg_t msg = (mbox_msg_t)vq_id; dev_dbg(dev, "kicking vqid %d on PRU%d\n", vq_id, pru->id); @@ -654,7 +656,7 @@ static void pru_rproc_kick(struct rproc *rproc, int vq_id) * send the index of the triggered virtqueue in the mailbox * payload */ - ret = mbox_send_message(pru->mbox, (void *)vq_id); + ret = mbox_send_message(pru->mbox, (void *)msg); if (ret < 0) dev_err(dev, "mbox_send_message failed: %d\n", ret); } -- 2.39.2