diff options
author | Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | 2009-03-23 21:07:26 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-03-23 21:07:26 -0400 |
commit | 9ae0ee0076d51d9017e89004643825a67d852910 (patch) | |
tree | 7a51c4f51beb00999ffd68e2f8682a0d73f98509 /arch/arm/plat-omap | |
parent | c75ee7520b4ad48a6948f51ca43b2e46ebd3696a (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/plat-omap')
-rw-r--r-- | arch/arm/plat-omap/mailbox.c | 86 | ||||
-rw-r--r-- | arch/arm/plat-omap/mailbox.h | 100 |
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 | ||
36 | static struct omap_mbox *mboxes; | 35 | static struct omap_mbox *mboxes; |
37 | static DEFINE_RWLOCK(mboxes_lock); | 36 | static 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. */ | ||
51 | static 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 | |||
57 | static 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 | |||
65 | static 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 | ||
74 | static inline void mbox_seq_init(struct omap_mbox *mbox) | ||
75 | { | ||
76 | } | ||
77 | static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg) | ||
78 | { | ||
79 | } | ||
80 | static 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 */ | ||
87 | static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) | ||
88 | { | ||
89 | return mbox->ops->fifo_read(mbox); | ||
90 | } | ||
91 | static inline void mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg) | ||
92 | { | ||
93 | mbox->ops->fifo_write(mbox, msg); | ||
94 | } | ||
95 | static inline int mbox_fifo_empty(struct omap_mbox *mbox) | ||
96 | { | ||
97 | return mbox->ops->fifo_empty(mbox); | ||
98 | } | ||
99 | static inline int mbox_fifo_full(struct omap_mbox *mbox) | ||
100 | { | ||
101 | return mbox->ops->fifo_full(mbox); | ||
102 | } | ||
103 | |||
104 | /* Mailbox IRQ handle functions */ | ||
105 | static inline void enable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq) | ||
106 | { | ||
107 | mbox->ops->enable_irq(mbox, irq); | ||
108 | } | ||
109 | static inline void disable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq) | ||
110 | { | ||
111 | mbox->ops->disable_irq(mbox, irq); | ||
112 | } | ||
113 | static 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 | } | ||
118 | static 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 */ |
40 | void omap_mbox_init_seq(struct omap_mbox *mbox) | 124 | void 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. */ | ||
28 | static 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 | |||
34 | static 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 | |||
42 | static 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 | ||
51 | static inline void mbox_seq_init(struct omap_mbox *mbox) | ||
52 | { | ||
53 | } | ||
54 | static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg) | ||
55 | { | ||
56 | } | ||
57 | static 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 */ | ||
64 | static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) | ||
65 | { | ||
66 | return mbox->ops->fifo_read(mbox); | ||
67 | } | ||
68 | static inline void mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg) | ||
69 | { | ||
70 | mbox->ops->fifo_write(mbox, msg); | ||
71 | } | ||
72 | static inline int mbox_fifo_empty(struct omap_mbox *mbox) | ||
73 | { | ||
74 | return mbox->ops->fifo_empty(mbox); | ||
75 | } | ||
76 | static inline int mbox_fifo_full(struct omap_mbox *mbox) | ||
77 | { | ||
78 | return mbox->ops->fifo_full(mbox); | ||
79 | } | ||
80 | |||
81 | /* Mailbox IRQ handle functions */ | ||
82 | static inline void enable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq) | ||
83 | { | ||
84 | mbox->ops->enable_irq(mbox, irq); | ||
85 | } | ||
86 | static inline void disable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq) | ||
87 | { | ||
88 | mbox->ops->disable_irq(mbox, irq); | ||
89 | } | ||
90 | static 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 | } | ||
95 | static 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 */ | ||