diff options
author | Hiroshi DOYU <Hiroshi.DOYU@nokia.com> | 2009-03-23 21:07:31 -0400 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-03-23 21:07:31 -0400 |
commit | 7a781afde63adf5d75042be8ada509c913a94afe (patch) | |
tree | a107104752527b0dbf23817307d71af71cf16fab | |
parent | 9ae0ee0076d51d9017e89004643825a67d852910 (diff) |
omap mailbox: convert sequence bit checking to module paramter
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
-rw-r--r-- | arch/arm/plat-omap/mailbox.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index fcac60dedc8a..10f240558d90 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
@@ -32,30 +32,34 @@ | |||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | #include <mach/mailbox.h> | 33 | #include <mach/mailbox.h> |
34 | 34 | ||
35 | static int enable_seq_bit; | ||
36 | module_param(enable_seq_bit, bool, 0); | ||
37 | MODULE_PARM_DESC(enable_seq_bit, "Enable sequence bit checking."); | ||
38 | |||
35 | static struct omap_mbox *mboxes; | 39 | static struct omap_mbox *mboxes; |
36 | static DEFINE_RWLOCK(mboxes_lock); | 40 | static DEFINE_RWLOCK(mboxes_lock); |
37 | 41 | ||
38 | /* | 42 | /* |
39 | * Mailbox sequence bit API | 43 | * Mailbox sequence bit API |
40 | */ | 44 | */ |
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 | 45 | ||
47 | #ifdef MBOX_USE_SEQ_BIT | ||
48 | /* seq_rcv should be initialized with any value other than | 46 | /* seq_rcv should be initialized with any value other than |
49 | * 0 and 1 << 31, to allow either value for the first | 47 | * 0 and 1 << 31, to allow either value for the first |
50 | * message. */ | 48 | * message. */ |
51 | static inline void mbox_seq_init(struct omap_mbox *mbox) | 49 | static inline void mbox_seq_init(struct omap_mbox *mbox) |
52 | { | 50 | { |
51 | if (!enable_seq_bit) | ||
52 | return; | ||
53 | |||
53 | /* any value other than 0 and 1 << 31 */ | 54 | /* any value other than 0 and 1 << 31 */ |
54 | mbox->seq_rcv = 0xffffffff; | 55 | mbox->seq_rcv = 0xffffffff; |
55 | } | 56 | } |
56 | 57 | ||
57 | static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg) | 58 | static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg) |
58 | { | 59 | { |
60 | if (!enable_seq_bit) | ||
61 | return; | ||
62 | |||
59 | /* add seq_snd to msg */ | 63 | /* add seq_snd to msg */ |
60 | *msg = (*msg & 0x7fffffff) | mbox->seq_snd; | 64 | *msg = (*msg & 0x7fffffff) | mbox->seq_snd; |
61 | /* flip seq_snd */ | 65 | /* flip seq_snd */ |
@@ -64,24 +68,17 @@ static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg) | |||
64 | 68 | ||
65 | static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg) | 69 | static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg) |
66 | { | 70 | { |
67 | mbox_msg_t seq = msg & (1 << 31); | 71 | mbox_msg_t seq; |
72 | |||
73 | if (!enable_seq_bit) | ||
74 | return 0; | ||
75 | |||
76 | seq = msg & (1 << 31); | ||
68 | if (seq == mbox->seq_rcv) | 77 | if (seq == mbox->seq_rcv) |
69 | return -1; | 78 | return -1; |
70 | mbox->seq_rcv = seq; | 79 | mbox->seq_rcv = seq; |
71 | return 0; | 80 | return 0; |
72 | } | 81 | } |
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 | 82 | ||
86 | /* Mailbox FIFO handle functions */ | 83 | /* Mailbox FIFO handle functions */ |
87 | static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) | 84 | static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) |