index 69ddc9f76c13ebcdcad6b97b109e374f0b2960c4..4ebacb2739adbea564a3620eb524c15bae0164fc 100644 (file)
#include <linux/kfifo.h>
#include <linux/err.h>
#include <linux/notifier.h>
+#include <linux/module.h>
#include <plat/mailbox.h>
{
return mbox->ops->fifo_full(mbox);
}
+static inline int mbox_fifo_needs_flush(struct omap_mbox *mbox)
+{
+ return mbox->ops->fifo_needs_flush(mbox);
+}
+static inline mbox_msg_t mbox_fifo_readback(struct omap_mbox *mbox)
+{
+ return mbox->ops->fifo_readback(mbox);
+}
/* Mailbox IRQ handle functions */
static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
}
EXPORT_SYMBOL(omap_mbox_msg_send);
+/*
+ * Flush the Rx FIFO by reading back the messages
+ * Since the normal expectation is that the Rx will do the
+ * reading, add a debug message to indicate if we really flush
+ * returns the no. of messages read back
+ */
+int omap_mbox_msg_rx_flush(struct omap_mbox *mbox)
+{
+ int ret = 0;
+ mbox_msg_t msg;
+
+ while (!mbox_fifo_needs_flush(mbox)) {
+ ret++;
+ msg = mbox_fifo_readback(mbox);
+ }
+ if (!ret)
+ pr_info("Flushed %s Rx FIFO by reading back\n", mbox->name);
+
+ return ret;
+}
+EXPORT_SYMBOL(omap_mbox_msg_rx_flush);
+
static void mbox_tx_tasklet(unsigned long tx_data)
{
struct omap_mbox *mbox = (struct omap_mbox *)tx_data;