diff options
author | Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | 2009-11-22 13:11:18 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-11-22 13:24:33 -0500 |
commit | bfe1f6acb0df957e513b7c71c3f1a7ac56b32e4d (patch) | |
tree | ee1ec7befd3fc7a2ef855e51bf96be969b3dccf3 /arch/arm/plat-omap | |
parent | 454bf340c986b798cd4c2fd676caffa2c1e61482 (diff) |
omap: mailbox: remove sequence bit checking
Any protocol should be handled in the upper layer and mailbox driver
shouldn't care about the contents of messages.
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/mailbox.c | 70 |
1 files changed, 4 insertions, 66 deletions
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index 734bff332c82..f82810eeb3f4 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
@@ -28,54 +28,9 @@ | |||
28 | 28 | ||
29 | #include <plat/mailbox.h> | 29 | #include <plat/mailbox.h> |
30 | 30 | ||
31 | static int enable_seq_bit; | ||
32 | module_param(enable_seq_bit, bool, 0); | ||
33 | MODULE_PARM_DESC(enable_seq_bit, "Enable sequence bit checking."); | ||
34 | |||
35 | static struct omap_mbox *mboxes; | 31 | static struct omap_mbox *mboxes; |
36 | static DEFINE_RWLOCK(mboxes_lock); | 32 | static DEFINE_RWLOCK(mboxes_lock); |
37 | 33 | ||
38 | /* | ||
39 | * Mailbox sequence bit API | ||
40 | */ | ||
41 | |||
42 | /* seq_rcv should be initialized with any value other than | ||
43 | * 0 and 1 << 31, to allow either value for the first | ||
44 | * message. */ | ||
45 | static inline void mbox_seq_init(struct omap_mbox *mbox) | ||
46 | { | ||
47 | if (!enable_seq_bit) | ||
48 | return; | ||
49 | |||
50 | /* any value other than 0 and 1 << 31 */ | ||
51 | mbox->seq_rcv = 0xffffffff; | ||
52 | } | ||
53 | |||
54 | static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg) | ||
55 | { | ||
56 | if (!enable_seq_bit) | ||
57 | return; | ||
58 | |||
59 | /* add seq_snd to msg */ | ||
60 | *msg = (*msg & 0x7fffffff) | mbox->seq_snd; | ||
61 | /* flip seq_snd */ | ||
62 | mbox->seq_snd ^= 1 << 31; | ||
63 | } | ||
64 | |||
65 | static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg) | ||
66 | { | ||
67 | mbox_msg_t seq; | ||
68 | |||
69 | if (!enable_seq_bit) | ||
70 | return 0; | ||
71 | |||
72 | seq = msg & (1 << 31); | ||
73 | if (seq == mbox->seq_rcv) | ||
74 | return -1; | ||
75 | mbox->seq_rcv = seq; | ||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | /* Mailbox FIFO handle functions */ | 34 | /* Mailbox FIFO handle functions */ |
80 | static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) | 35 | static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) |
81 | { | 36 | { |
@@ -113,13 +68,6 @@ static inline int is_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq) | |||
113 | return mbox->ops->is_irq(mbox, irq); | 68 | return mbox->ops->is_irq(mbox, irq); |
114 | } | 69 | } |
115 | 70 | ||
116 | /* Mailbox Sequence Bit function */ | ||
117 | void omap_mbox_init_seq(struct omap_mbox *mbox) | ||
118 | { | ||
119 | mbox_seq_init(mbox); | ||
120 | } | ||
121 | EXPORT_SYMBOL(omap_mbox_init_seq); | ||
122 | |||
123 | /* | 71 | /* |
124 | * message sender | 72 | * message sender |
125 | */ | 73 | */ |
@@ -141,7 +89,6 @@ static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void *arg) | |||
141 | goto out; | 89 | goto out; |
142 | } | 90 | } |
143 | 91 | ||
144 | mbox_seq_toggle(mbox, &msg); | ||
145 | mbox_fifo_write(mbox, msg); | 92 | mbox_fifo_write(mbox, msg); |
146 | out: | 93 | out: |
147 | return ret; | 94 | return ret; |
@@ -254,11 +201,11 @@ static void mbox_rx_work(struct work_struct *work) | |||
254 | /* | 201 | /* |
255 | * Mailbox interrupt handler | 202 | * Mailbox interrupt handler |
256 | */ | 203 | */ |
257 | static void mbox_txq_fn(struct request_queue * q) | 204 | static void mbox_txq_fn(struct request_queue *q) |
258 | { | 205 | { |
259 | } | 206 | } |
260 | 207 | ||
261 | static void mbox_rxq_fn(struct request_queue * q) | 208 | static void mbox_rxq_fn(struct request_queue *q) |
262 | { | 209 | { |
263 | } | 210 | } |
264 | 211 | ||
@@ -284,11 +231,6 @@ static void __mbox_rx_interrupt(struct omap_mbox *mbox) | |||
284 | 231 | ||
285 | msg = mbox_fifo_read(mbox); | 232 | msg = mbox_fifo_read(mbox); |
286 | 233 | ||
287 | if (unlikely(mbox_seq_test(mbox, msg))) { | ||
288 | pr_info("mbox: Illegal seq bit!(%08x)\n", msg); | ||
289 | if (mbox->err_notify) | ||
290 | mbox->err_notify(); | ||
291 | } | ||
292 | 234 | ||
293 | blk_insert_request(q, rq, 0, (void *)msg); | 235 | blk_insert_request(q, rq, 0, (void *)msg); |
294 | if (mbox->ops->type == OMAP_MBOX_TYPE1) | 236 | if (mbox->ops->type == OMAP_MBOX_TYPE1) |
@@ -320,7 +262,7 @@ static irqreturn_t mbox_interrupt(int irq, void *p) | |||
320 | */ | 262 | */ |
321 | static ssize_t | 263 | static ssize_t |
322 | omap_mbox_write(struct device *dev, struct device_attribute *attr, | 264 | omap_mbox_write(struct device *dev, struct device_attribute *attr, |
323 | const char * buf, size_t count) | 265 | const char *buf, size_t count) |
324 | { | 266 | { |
325 | int ret; | 267 | int ret; |
326 | mbox_msg_t *p = (mbox_msg_t *)buf; | 268 | mbox_msg_t *p = (mbox_msg_t *)buf; |
@@ -357,10 +299,6 @@ omap_mbox_read(struct device *dev, struct device_attribute *attr, char *buf) | |||
357 | 299 | ||
358 | blk_end_request_all(rq, 0); | 300 | blk_end_request_all(rq, 0); |
359 | 301 | ||
360 | if (unlikely(mbox_seq_test(mbox, *p))) { | ||
361 | pr_info("mbox: Illegal seq bit!(%08x) ignored\n", *p); | ||
362 | continue; | ||
363 | } | ||
364 | p++; | 302 | p++; |
365 | } | 303 | } |
366 | 304 | ||
@@ -383,7 +321,7 @@ static struct class omap_mbox_class = { | |||
383 | }; | 321 | }; |
384 | 322 | ||
385 | static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox, | 323 | static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox, |
386 | request_fn_proc * proc, | 324 | request_fn_proc *proc, |
387 | void (*work) (struct work_struct *)) | 325 | void (*work) (struct work_struct *)) |
388 | { | 326 | { |
389 | struct request_queue *q; | 327 | struct request_queue *q; |