aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSuman Anna <s-anna@ti.com>2014-06-24 20:43:39 -0400
committerTony Lindgren <tony@atomide.com>2014-07-29 04:57:25 -0400
commitfe714a46a423f1b8802a1700b1b5956184738225 (patch)
tree6d34df0a4aec8f6d0d831eb330b93d022ab0ff7c /drivers
parent79859094e5bcc869f3fb7239b86a7f6b111f156a (diff)
mailbox/omap: remove omap_mbox_type_t from mailbox ops
The type definition omap_mbox_type_t used for distinguishing OMAP1 from OMAP2+ mailboxes is no longer needed after the removal of OMAP1 mailbox driver, and has therefore been cleaned up. This cleanup also eliminates the need for the polling logic used for checking the transmit readiness. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mailbox/mailbox-omap2.c1
-rw-r--r--drivers/mailbox/omap-mailbox.c22
-rw-r--r--drivers/mailbox/omap-mbox.h5
3 files changed, 2 insertions, 26 deletions
diff --git a/drivers/mailbox/mailbox-omap2.c b/drivers/mailbox/mailbox-omap2.c
index 75fbc9072d01..b44e3bcff62a 100644
--- a/drivers/mailbox/mailbox-omap2.c
+++ b/drivers/mailbox/mailbox-omap2.c
@@ -205,7 +205,6 @@ static void omap2_mbox_restore_ctx(struct omap_mbox *mbox)
205} 205}
206 206
207static struct omap_mbox_ops omap2_mbox_ops = { 207static struct omap_mbox_ops omap2_mbox_ops = {
208 .type = OMAP_MBOX_TYPE2,
209 .startup = omap2_mbox_startup, 208 .startup = omap2_mbox_startup,
210 .shutdown = omap2_mbox_shutdown, 209 .shutdown = omap2_mbox_shutdown,
211 .fifo_read = omap2_mbox_fifo_read, 210 .fifo_read = omap2_mbox_fifo_read,
diff --git a/drivers/mailbox/omap-mailbox.c b/drivers/mailbox/omap-mailbox.c
index d79a646b9042..eab72276ffab 100644
--- a/drivers/mailbox/omap-mailbox.c
+++ b/drivers/mailbox/omap-mailbox.c
@@ -24,7 +24,6 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/spinlock.h> 25#include <linux/spinlock.h>
26#include <linux/mutex.h> 26#include <linux/mutex.h>
27#include <linux/delay.h>
28#include <linux/slab.h> 27#include <linux/slab.h>
29#include <linux/kfifo.h> 28#include <linux/kfifo.h>
30#include <linux/err.h> 29#include <linux/err.h>
@@ -74,20 +73,6 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
74/* 73/*
75 * message sender 74 * message sender
76 */ 75 */
77static int __mbox_poll_for_space(struct omap_mbox *mbox)
78{
79 int ret = 0, i = 1000;
80
81 while (mbox_fifo_full(mbox)) {
82 if (mbox->ops->type == OMAP_MBOX_TYPE2)
83 return -1;
84 if (--i == 0)
85 return -1;
86 udelay(1);
87 }
88 return ret;
89}
90
91int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg) 76int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
92{ 77{
93 struct omap_mbox_queue *mq = mbox->txq; 78 struct omap_mbox_queue *mq = mbox->txq;
@@ -100,7 +85,7 @@ int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
100 goto out; 85 goto out;
101 } 86 }
102 87
103 if (kfifo_is_empty(&mq->fifo) && !__mbox_poll_for_space(mbox)) { 88 if (kfifo_is_empty(&mq->fifo) && !mbox_fifo_full(mbox)) {
104 mbox_fifo_write(mbox, msg); 89 mbox_fifo_write(mbox, msg);
105 goto out; 90 goto out;
106 } 91 }
@@ -158,7 +143,7 @@ static void mbox_tx_tasklet(unsigned long tx_data)
158 int ret; 143 int ret;
159 144
160 while (kfifo_len(&mq->fifo)) { 145 while (kfifo_len(&mq->fifo)) {
161 if (__mbox_poll_for_space(mbox)) { 146 if (mbox_fifo_full(mbox)) {
162 omap_mbox_enable_irq(mbox, IRQ_TX); 147 omap_mbox_enable_irq(mbox, IRQ_TX);
163 break; 148 break;
164 } 149 }
@@ -223,9 +208,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox)
223 208
224 len = kfifo_in(&mq->fifo, (unsigned char *)&msg, sizeof(msg)); 209 len = kfifo_in(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
225 WARN_ON(len != sizeof(msg)); 210 WARN_ON(len != sizeof(msg));
226
227 if (mbox->ops->type == OMAP_MBOX_TYPE1)
228 break;
229 } 211 }
230 212
231 /* no more messages in the fifo. clear IRQ source. */ 213 /* no more messages in the fifo. clear IRQ source. */
diff --git a/drivers/mailbox/omap-mbox.h b/drivers/mailbox/omap-mbox.h
index 86d7518cd13b..fae215195590 100644
--- a/drivers/mailbox/omap-mbox.h
+++ b/drivers/mailbox/omap-mbox.h
@@ -16,12 +16,7 @@
16#include <linux/workqueue.h> 16#include <linux/workqueue.h>
17#include <linux/omap-mailbox.h> 17#include <linux/omap-mailbox.h>
18 18
19typedef int __bitwise omap_mbox_type_t;
20#define OMAP_MBOX_TYPE1 ((__force omap_mbox_type_t) 1)
21#define OMAP_MBOX_TYPE2 ((__force omap_mbox_type_t) 2)
22
23struct omap_mbox_ops { 19struct omap_mbox_ops {
24 omap_mbox_type_t type;
25 int (*startup)(struct omap_mbox *mbox); 20 int (*startup)(struct omap_mbox *mbox);
26 void (*shutdown)(struct omap_mbox *mbox); 21 void (*shutdown)(struct omap_mbox *mbox);
27 /* fifo */ 22 /* fifo */