]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commitdiff
remoteproc/pru: use macros and types from omap mailbox
authorSuman Anna <s-anna@ti.com>
Fri, 22 Feb 2019 23:37:49 +0000 (17:37 -0600)
committerSuman Anna <s-anna@ti.com>
Mon, 25 Feb 2019 19:15:11 +0000 (13:15 -0600)
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 <s-anna@ti.com>
drivers/remoteproc/pru_rproc.c

index 8d1bb5151f0f8ef97a09c0f40ed4067c512b9339..0d5dfda6c8dd0fa6d9b9cd065b00ad21b2ba5c2d 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/mailbox_client.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/omap-mailbox.h>
 #include <linux/pruss.h>
 #include <linux/pruss_driver.h>
 #include <linux/remoteproc.h>
@@ -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);
        }