diff options
author | C A Subramaniam <subramaniam.ca@ti.com> | 2009-11-22 13:11:22 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2009-11-22 13:24:33 -0500 |
commit | 5f00ec64a38563f1e5d8a852f2279047edecd0b8 (patch) | |
tree | b3b336c5e6c91bbc81f4d78e04329629e4b338e2 /arch/arm/plat-omap/mailbox.c | |
parent | eb18858ebda7f4ef3d7de33e1b9bf11ac4cc137b (diff) |
omap: mailbox: Adds code changes to support OMAP4 mailbox
This patch adds code changes in the mailbox driver module to
add support for OMAP4 mailbox.
Signed-off-by: Hari Kanigeri <h-kanigeri2@ti.com>
Signed-off-by: C A Subramaniam <subramaniam.ca@ti.com>
Signed-off-by: Ramesh Gupta G <grgupta@ti.com>
Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/plat-omap/mailbox.c')
-rw-r--r-- | arch/arm/plat-omap/mailbox.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index e6b31159f08b..2210c45a52f1 100644 --- a/arch/arm/plat-omap/mailbox.c +++ b/arch/arm/plat-omap/mailbox.c | |||
@@ -31,6 +31,8 @@ | |||
31 | static struct omap_mbox *mboxes; | 31 | static struct omap_mbox *mboxes; |
32 | static DEFINE_RWLOCK(mboxes_lock); | 32 | static DEFINE_RWLOCK(mboxes_lock); |
33 | 33 | ||
34 | static int mbox_configured; | ||
35 | |||
34 | /* Mailbox FIFO handle functions */ | 36 | /* Mailbox FIFO handle functions */ |
35 | static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) | 37 | static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox) |
36 | { | 38 | { |
@@ -266,13 +268,20 @@ static void mbox_queue_free(struct omap_mbox_queue *q) | |||
266 | 268 | ||
267 | static int omap_mbox_startup(struct omap_mbox *mbox) | 269 | static int omap_mbox_startup(struct omap_mbox *mbox) |
268 | { | 270 | { |
269 | int ret; | 271 | int ret = 0; |
270 | struct omap_mbox_queue *mq; | 272 | struct omap_mbox_queue *mq; |
271 | 273 | ||
272 | if (likely(mbox->ops->startup)) { | 274 | if (likely(mbox->ops->startup)) { |
273 | ret = mbox->ops->startup(mbox); | 275 | write_lock(&mboxes_lock); |
274 | if (unlikely(ret)) | 276 | if (!mbox_configured) |
277 | ret = mbox->ops->startup(mbox); | ||
278 | |||
279 | if (unlikely(ret)) { | ||
280 | write_unlock(&mboxes_lock); | ||
275 | return ret; | 281 | return ret; |
282 | } | ||
283 | mbox_configured++; | ||
284 | write_unlock(&mboxes_lock); | ||
276 | } | 285 | } |
277 | 286 | ||
278 | ret = request_irq(mbox->irq, mbox_interrupt, IRQF_DISABLED, | 287 | ret = request_irq(mbox->irq, mbox_interrupt, IRQF_DISABLED, |
@@ -317,8 +326,14 @@ static void omap_mbox_fini(struct omap_mbox *mbox) | |||
317 | 326 | ||
318 | free_irq(mbox->irq, mbox); | 327 | free_irq(mbox->irq, mbox); |
319 | 328 | ||
320 | if (unlikely(mbox->ops->shutdown)) | 329 | if (unlikely(mbox->ops->shutdown)) { |
321 | mbox->ops->shutdown(mbox); | 330 | write_lock(&mboxes_lock); |
331 | if (mbox_configured > 0) | ||
332 | mbox_configured--; | ||
333 | if (!mbox_configured) | ||
334 | mbox->ops->shutdown(mbox); | ||
335 | write_unlock(&mboxes_lock); | ||
336 | } | ||
322 | } | 337 | } |
323 | 338 | ||
324 | static struct omap_mbox **find_mboxes(const char *name) | 339 | static struct omap_mbox **find_mboxes(const char *name) |