mailbox: add tx_prepare client callback
authorSudeep Holla <sudeep.holla@arm.com>
Tue, 11 Nov 2014 18:33:01 +0000 (18:33 +0000)
committerJassi Brar <jaswinder.singh@linaro.org>
Thu, 27 Nov 2014 07:20:59 +0000 (12:50 +0530)
If the mailbox controller expects the payload is in place before
initiating the transmit, then it's impossible to reuse the list
maintained by core mailbox code currently. Maintaining another list
for sending the message in the controller seems totally unnecessary
as core mailbox library already provides that feature.

This patch introduces tx_prepare callback in mbox_client which
can be used by the core mailbox library before initiating the
transaction through mbox->ops->send_data. The client driver can
implement this callback to ensure the payload is copied to the
shared memory.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/mailbox.c
include/linux/mailbox_client.h

index c281e5562876bfea42414d5b5454e13e70dfea5c..58789b02770845456abe8f883edde96e98502fcf 100644 (file)
@@ -78,6 +78,8 @@ static void msg_submit(struct mbox_chan *chan)
 
        data = chan->msg_data[idx];
 
+       if (chan->cl->tx_prepare)
+               chan->cl->tx_prepare(chan->cl, data);
        /* Try to submit a message to the MBOX controller */
        err = chan->mbox->ops->send_data(chan, data);
        if (!err) {
index 307d9cab2026071c98a296611b4e3a52c65f6fc8..1726ccbd8009a814564dd717000288733c759ff5 100644 (file)
@@ -25,6 +25,8 @@ struct mbox_chan;
  *                     if the client receives some ACK packet for transmission.
  *                     Unused if the controller already has TX_Done/RTR IRQ.
  * @rx_callback:       Atomic callback to provide client the data received
+ * @tx_prepare:        Atomic callback to ask client to prepare the payload
+ *                     before initiating the transmission if required.
  * @tx_done:           Atomic callback to tell client of data transmission
  */
 struct mbox_client {
@@ -34,6 +36,7 @@ struct mbox_client {
        bool knows_txdone;
 
        void (*rx_callback)(struct mbox_client *cl, void *mssg);
+       void (*tx_prepare)(struct mbox_client *cl, void *mssg);
        void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
 };
 
This page took 0.044473 seconds and 5 git commands to generate.