e1000: Add device IDs of blade version of the 82571 quad port
[pv_ops_mirror.git] / arch / arm / plat-omap / mailbox.h
blob67c6740b8ad5833b07875391f6af154f9e760dcb
1 /*
2 * Mailbox internal functions
4 * Copyright (C) 2006 Nokia Corporation
5 * Written by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
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.
12 #ifndef __ARCH_ARM_PLAT_MAILBOX_H
13 #define __ARCH_ARM_PLAT_MAILBOX_H
16 * Mailbox sequence bit API
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
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)
30 /* any value other than 0 and 1 << 31 */
31 mbox->seq_rcv = 0xffffffff;
34 static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)
36 /* add seq_snd to msg */
37 *msg = (*msg & 0x7fffffff) | mbox->seq_snd;
38 /* flip seq_snd */
39 mbox->seq_snd ^= 1 << 31;
42 static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg)
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;
50 #else
51 static inline void mbox_seq_init(struct omap_mbox *mbox)
54 static inline void mbox_seq_toggle(struct omap_mbox *mbox, mbox_msg_t * msg)
57 static inline int mbox_seq_test(struct omap_mbox *mbox, mbox_msg_t msg)
59 return 0;
61 #endif
63 /* Mailbox FIFO handle functions */
64 static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox)
66 return mbox->ops->fifo_read(mbox);
68 static inline void mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
70 mbox->ops->fifo_write(mbox, msg);
72 static inline int mbox_fifo_empty(struct omap_mbox *mbox)
74 return mbox->ops->fifo_empty(mbox);
76 static inline int mbox_fifo_full(struct omap_mbox *mbox)
78 return mbox->ops->fifo_full(mbox);
81 /* Mailbox IRQ handle functions */
82 static inline void enable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
84 mbox->ops->enable_irq(mbox, irq);
86 static inline void disable_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
88 mbox->ops->disable_irq(mbox, irq);
90 static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
92 if (mbox->ops->ack_irq)
93 mbox->ops->ack_irq(mbox, irq);
95 static inline int is_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
97 return mbox->ops->is_irq(mbox, irq);
100 #endif /* __ARCH_ARM_PLAT_MAILBOX_H */