aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorHiroshi DOYU <Hiroshi.DOYU@nokia.com>2009-03-23 21:07:26 -0400
committerTony Lindgren <tony@atomide.com>2009-03-23 21:07:26 -0400
commit9ae0ee0076d51d9017e89004643825a67d852910 (patch)
tree7a51c4f51beb00999ffd68e2f8682a0d73f98509 /arch/arm
parentc75ee7520b4ad48a6948f51ca43b2e46ebd3696a (diff)
omap mailbox: move mailbox.h into mailbox.c
no need to keep mailbox.h separately. Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/plat-omap/mailbox.c86
-rw-r--r--arch/arm/plat-omap/mailbox.h100
2 files changed, 85 insertions, 101 deletions
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index 75ede474d844..fcac60dedc8a 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -31,11 +31,95 @@
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <mach/mailbox.h> 33#include <mach/mailbox.h>
34#include "mailbox.h"
35 34
36static struct omap_mbox *mboxes; 35static struct omap_mbox *mboxes;
37static DEFINE_RWLOCK(mboxes_lock); 36static DEFINE_RWLOCK(mboxes_lock);
38 37
38/*
39 * Mailbox sequence bit API
40 */
41#if defined(CONFIG_ARCH_OMAP1)
42# define MBOX_USE_SEQ_BIT
43#elif defined(CONFIG_ARCH_OMAP2)
44# define MBOX_USE_SEQ_BIT
45#endif
46
47#ifdef MBOX_USE_SEQ_BIT
48/* seq_rcv should be initialized with any value other than
49 * 0 and 1 << 31, to allow either value for the first
50 * message. */
51static inline void mbox_seq_init(struct omap_mbox *mbox)
52{
53 /* any value other than 0 and 1 << 31 */
54 mbox->seq_rcv = 0xffffffff;
55}
56
57static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)
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
65static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg)
66{
67 mbox_msg_t seq = msg & (1 << 31);
68 if (seq == mbox->seq_rcv)
69 return -1;
70 mbox->seq_rcv = seq;
71 return 0;
72}
73#else
74static inline void mbox_seq_init(struct omap_mbox *mbox)
75{
76}
77static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)
78{
79}
80static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg)
81{
82 return 0;
83}
84#endif
85
86/* Mailbox FIFO handle functions */
87static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox)
88{
89 return mbox->ops->fifo_read(mbox);
90}
91static inline void mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
92{
93 mbox->ops->fifo_write(mbox, msg);
94}
95static inline int mbox_fifo_empty(struct omap_mbox *mbox)
96{
97 return mbox->ops->fifo_empty(mbox);
98}
99static inline int mbox_fifo_full(struct omap_mbox *mbox)
100{
101 return mbox->ops->fifo_full(mbox);
102}
103
104/* Mailbox IRQ handle functions */
105static inline void enable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
106{
107 mbox->ops->enable_irq(mbox, irq);
108}
109static inline void disable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
110{
111 mbox->ops->disable_irq(mbox, irq);
112}
113static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
114{
115 if (mbox->ops->ack_irq)
116 mbox->ops->ack_irq(mbox, irq);
117}
118static inline int is_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
119{
120 return mbox->ops->is_irq(mbox, irq);
121}
122
39/* Mailbox Sequence Bit function */ 123/* Mailbox Sequence Bit function */
40void omap_mbox_init_seq(struct omap_mbox *mbox) 124void omap_mbox_init_seq(struct omap_mbox *mbox)
41{ 125{
diff --git a/arch/arm/plat-omap/mailbox.h b/arch/arm/plat-omap/mailbox.h
deleted file mode 100644
index 67c6740b8ad5..000000000000
--- a/arch/arm/plat-omap/mailbox.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * Mailbox internal functions
3 *
4 * Copyright (C) 2006 Nokia Corporation
5 * Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#ifndef __ARCH_ARM_PLAT_MAILBOX_H
13#define __ARCH_ARM_PLAT_MAILBOX_H
14
15/*
16 * Mailbox sequence bit API
17 */
18#if defined(CONFIG_ARCH_OMAP1)
19# define MBOX_USE_SEQ_BIT
20#elif defined(CONFIG_ARCH_OMAP2)
21# define MBOX_USE_SEQ_BIT
22#endif
23
24#ifdef MBOX_USE_SEQ_BIT
25/* seq_rcv should be initialized with any value other than
26 * 0 and 1 << 31, to allow either value for the first
27 * message. */
28static inline void mbox_seq_init(struct omap_mbox *mbox)
29{
30 /* any value other than 0 and 1 << 31 */
31 mbox->seq_rcv = 0xffffffff;
32}
33
34static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)
35{
36 /* add seq_snd to msg */
37 *msg = (*msg & 0x7fffffff) | mbox->seq_snd;
38 /* flip seq_snd */
39 mbox->seq_snd ^= 1 << 31;
40}
41
42static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg)
43{
44 mbox_msg_t seq = msg & (1 << 31);
45 if (seq == mbox->seq_rcv)
46 return -1;
47 mbox->seq_rcv = seq;
48 return 0;
49}
50#else
51static inline void mbox_seq_init(struct omap_mbox *mbox)
52{
53}
54static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)
55{
56}
57static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg)
58{
59 return 0;
60}
61#endif
62
63/* Mailbox FIFO handle functions */
64static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox)
65{
66 return mbox->ops->fifo_read(mbox);
67}
68static inline void mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
69{
70 mbox->ops->fifo_write(mbox, msg);
71}
72static inline int mbox_fifo_empty(struct omap_mbox *mbox)
73{
74 return mbox->ops->fifo_empty(mbox);
75}
76static inline int mbox_fifo_full(struct omap_mbox *mbox)
77{
78 return mbox->ops->fifo_full(mbox);
79}
80
81/* Mailbox IRQ handle functions */
82static inline void enable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
83{
84 mbox->ops->enable_irq(mbox, irq);
85}
86static inline void disable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
87{
88 mbox->ops->disable_irq(mbox, irq);
89}
90static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
91{
92 if (mbox->ops->ack_irq)
93 mbox->ops->ack_irq(mbox, irq);
94}
95static inline int is_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
96{
97 return mbox->ops->is_irq(mbox, irq);
98}
99
100#endif /* __ARCH_ARM_PLAT_MAILBOX_H */