blob: 48e161c642a56cab8b77429ad1a529f97047f090 [file] [log] [blame]
Hiroshi DOYU340a6142006-12-07 15:43:59 -08001/*
2 * OMAP mailbox driver
3 *
Hiroshi DOYUf48cca82009-03-23 18:07:24 -07004 * Copyright (C) 2006-2009 Nokia Corporation. All rights reserved.
Hiroshi DOYU340a6142006-12-07 15:43:59 -08005 *
Hiroshi DOYUf48cca82009-03-23 18:07:24 -07006 * Contact: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Hiroshi DOYU340a6142006-12-07 15:43:59 -08007 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
Hiroshi DOYU340a6142006-12-07 15:43:59 -080024#include <linux/interrupt.h>
Felipe Contrerasb3e69142010-06-11 15:51:49 +000025#include <linux/spinlock.h>
26#include <linux/mutex.h>
Hiroshi DOYU340a6142006-12-07 15:43:59 -080027#include <linux/delay.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090028#include <linux/slab.h>
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +000029#include <linux/kfifo.h>
30#include <linux/err.h>
Hiroshi DOYU8dff0fa2009-03-23 18:07:32 -070031
Tony Lindgrence491cf2009-10-20 09:40:47 -070032#include <plat/mailbox.h>
Hiroshi DOYU340a6142006-12-07 15:43:59 -080033
Rob Clark8250a5c2010-01-04 19:22:03 +053034static struct workqueue_struct *mboxd;
Felipe Contreras9c80c8c2010-06-11 15:51:46 +000035static struct omap_mbox **mboxes;
Hiroshi DOYU340a6142006-12-07 15:43:59 -080036
C A Subramaniam5f00ec62009-11-22 10:11:22 -080037static int mbox_configured;
Hiroshi DOYU72b917e2010-02-18 00:48:55 -060038static DEFINE_MUTEX(mbox_configured_lock);
C A Subramaniam5f00ec62009-11-22 10:11:22 -080039
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +000040static unsigned int mbox_kfifo_size = CONFIG_OMAP_MBOX_KFIFO_SIZE;
41module_param(mbox_kfifo_size, uint, S_IRUGO);
42MODULE_PARM_DESC(mbox_kfifo_size, "Size of omap's mailbox kfifo (bytes)");
43
Hiroshi DOYU9ae0ee02009-03-23 18:07:26 -070044/* Mailbox FIFO handle functions */
45static inline mbox_msg_t mbox_fifo_read(struct omap_mbox *mbox)
46{
47 return mbox->ops->fifo_read(mbox);
48}
49static inline void mbox_fifo_write(struct omap_mbox *mbox, mbox_msg_t msg)
50{
51 mbox->ops->fifo_write(mbox, msg);
52}
53static inline int mbox_fifo_empty(struct omap_mbox *mbox)
54{
55 return mbox->ops->fifo_empty(mbox);
56}
57static inline int mbox_fifo_full(struct omap_mbox *mbox)
58{
59 return mbox->ops->fifo_full(mbox);
60}
61
62/* Mailbox IRQ handle functions */
Hiroshi DOYU9ae0ee02009-03-23 18:07:26 -070063static inline void ack_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
64{
65 if (mbox->ops->ack_irq)
66 mbox->ops->ack_irq(mbox, irq);
67}
68static inline int is_mbox_irq(struct omap_mbox *mbox, omap_mbox_irq_t irq)
69{
70 return mbox->ops->is_irq(mbox, irq);
71}
72
Hiroshi DOYU340a6142006-12-07 15:43:59 -080073/*
74 * message sender
75 */
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +000076static int __mbox_poll_for_space(struct omap_mbox *mbox)
Hiroshi DOYU340a6142006-12-07 15:43:59 -080077{
78 int ret = 0, i = 1000;
79
80 while (mbox_fifo_full(mbox)) {
81 if (mbox->ops->type == OMAP_MBOX_TYPE2)
82 return -1;
83 if (--i == 0)
84 return -1;
85 udelay(1);
86 }
Hiroshi DOYU340a6142006-12-07 15:43:59 -080087 return ret;
88}
89
C A Subramaniamb2b63622009-11-22 10:11:20 -080090int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg)
Hiroshi DOYU340a6142006-12-07 15:43:59 -080091{
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +000092 struct omap_mbox_queue *mq = mbox->txq;
93 int ret = 0, len;
C A Subramaniam5ed8d322009-11-22 10:11:24 -080094
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +000095 spin_lock(&mq->lock);
Tejun Heoec247512009-04-23 11:05:20 +090096
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +000097 if (kfifo_avail(&mq->fifo) < sizeof(msg)) {
98 ret = -ENOMEM;
99 goto out;
100 }
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800101
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000102 len = kfifo_in(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
103 WARN_ON(len != sizeof(msg));
104
C A Subramaniam5ed8d322009-11-22 10:11:24 -0800105 tasklet_schedule(&mbox->txq->tasklet);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800106
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000107out:
108 spin_unlock(&mq->lock);
109 return ret;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800110}
111EXPORT_SYMBOL(omap_mbox_msg_send);
112
C A Subramaniam5ed8d322009-11-22 10:11:24 -0800113static void mbox_tx_tasklet(unsigned long tx_data)
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800114{
C A Subramaniam5ed8d322009-11-22 10:11:24 -0800115 struct omap_mbox *mbox = (struct omap_mbox *)tx_data;
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000116 struct omap_mbox_queue *mq = mbox->txq;
117 mbox_msg_t msg;
118 int ret;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800119
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000120 while (kfifo_len(&mq->fifo)) {
121 if (__mbox_poll_for_space(mbox)) {
Hiroshi DOYUeb188582009-11-22 10:11:22 -0800122 omap_mbox_enable_irq(mbox, IRQ_TX);
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000123 break;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800124 }
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000125
126 ret = kfifo_out(&mq->fifo, (unsigned char *)&msg,
127 sizeof(msg));
128 WARN_ON(ret != sizeof(msg));
129
130 mbox_fifo_write(mbox, msg);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800131 }
132}
133
134/*
135 * Message receiver(workqueue)
136 */
137static void mbox_rx_work(struct work_struct *work)
138{
139 struct omap_mbox_queue *mq =
140 container_of(work, struct omap_mbox_queue, work);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800141 mbox_msg_t msg;
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000142 int len;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800143
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000144 while (kfifo_len(&mq->fifo) >= sizeof(msg)) {
145 len = kfifo_out(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
146 WARN_ON(len != sizeof(msg));
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800147
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000148 if (mq->callback)
149 mq->callback((void *)msg);
Fernando Guzman Lugod2295042010-11-29 20:24:11 +0000150 spin_lock_irq(&mq->lock);
151 if (mq->full) {
152 mq->full = false;
153 omap_mbox_enable_irq(mq->mbox, IRQ_RX);
154 }
155 spin_unlock_irq(&mq->lock);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800156 }
157}
158
159/*
160 * Mailbox interrupt handler
161 */
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800162static void __mbox_tx_interrupt(struct omap_mbox *mbox)
163{
Hiroshi DOYUeb188582009-11-22 10:11:22 -0800164 omap_mbox_disable_irq(mbox, IRQ_TX);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800165 ack_mbox_irq(mbox, IRQ_TX);
C A Subramaniam5ed8d322009-11-22 10:11:24 -0800166 tasklet_schedule(&mbox->txq->tasklet);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800167}
168
169static void __mbox_rx_interrupt(struct omap_mbox *mbox)
170{
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000171 struct omap_mbox_queue *mq = mbox->rxq;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800172 mbox_msg_t msg;
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000173 int len;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800174
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800175 while (!mbox_fifo_empty(mbox)) {
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000176 if (unlikely(kfifo_avail(&mq->fifo) < sizeof(msg))) {
Fernando Guzman Lugo1ea5d6d2010-02-08 13:35:40 -0600177 omap_mbox_disable_irq(mbox, IRQ_RX);
Fernando Guzman Lugod2295042010-11-29 20:24:11 +0000178 mq->full = true;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800179 goto nomem;
Fernando Guzman Lugo1ea5d6d2010-02-08 13:35:40 -0600180 }
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800181
182 msg = mbox_fifo_read(mbox);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800183
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000184 len = kfifo_in(&mq->fifo, (unsigned char *)&msg, sizeof(msg));
185 WARN_ON(len != sizeof(msg));
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800186
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800187 if (mbox->ops->type == OMAP_MBOX_TYPE1)
188 break;
189 }
190
191 /* no more messages in the fifo. clear IRQ source. */
192 ack_mbox_irq(mbox, IRQ_RX);
Hiroshi DOYUf48cca82009-03-23 18:07:24 -0700193nomem:
Rob Clark8250a5c2010-01-04 19:22:03 +0530194 queue_work(mboxd, &mbox->rxq->work);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800195}
196
197static irqreturn_t mbox_interrupt(int irq, void *p)
198{
Jeff Garzik2a7057e2007-10-26 05:40:22 -0400199 struct omap_mbox *mbox = p;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800200
201 if (is_mbox_irq(mbox, IRQ_TX))
202 __mbox_tx_interrupt(mbox);
203
204 if (is_mbox_irq(mbox, IRQ_RX))
205 __mbox_rx_interrupt(mbox);
206
207 return IRQ_HANDLED;
208}
209
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800210static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox,
C A Subramaniam5ed8d322009-11-22 10:11:24 -0800211 void (*work) (struct work_struct *),
212 void (*tasklet)(unsigned long))
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800213{
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800214 struct omap_mbox_queue *mq;
215
216 mq = kzalloc(sizeof(struct omap_mbox_queue), GFP_KERNEL);
217 if (!mq)
218 return NULL;
219
220 spin_lock_init(&mq->lock);
221
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000222 if (kfifo_alloc(&mq->fifo, mbox_kfifo_size, GFP_KERNEL))
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800223 goto error;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800224
C A Subramaniam5ed8d322009-11-22 10:11:24 -0800225 if (work)
226 INIT_WORK(&mq->work, work);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800227
C A Subramaniam5ed8d322009-11-22 10:11:24 -0800228 if (tasklet)
229 tasklet_init(&mq->tasklet, tasklet, (unsigned long)mbox);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800230 return mq;
231error:
232 kfree(mq);
233 return NULL;
234}
235
236static void mbox_queue_free(struct omap_mbox_queue *q)
237{
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000238 kfifo_free(&q->fifo);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800239 kfree(q);
240}
241
Hiroshi DOYUc7c158e2009-11-22 10:11:19 -0800242static int omap_mbox_startup(struct omap_mbox *mbox)
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800243{
C A Subramaniam5f00ec62009-11-22 10:11:22 -0800244 int ret = 0;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800245 struct omap_mbox_queue *mq;
246
Ohad Ben-Cohen01072d82010-05-05 15:33:08 +0000247 if (mbox->ops->startup) {
Hiroshi DOYU72b917e2010-02-18 00:48:55 -0600248 mutex_lock(&mbox_configured_lock);
C A Subramaniam5f00ec62009-11-22 10:11:22 -0800249 if (!mbox_configured)
250 ret = mbox->ops->startup(mbox);
251
Ohad Ben-Cohen01072d82010-05-05 15:33:08 +0000252 if (ret) {
Hiroshi DOYU72b917e2010-02-18 00:48:55 -0600253 mutex_unlock(&mbox_configured_lock);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800254 return ret;
C A Subramaniam5f00ec62009-11-22 10:11:22 -0800255 }
256 mbox_configured++;
Hiroshi DOYU72b917e2010-02-18 00:48:55 -0600257 mutex_unlock(&mbox_configured_lock);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800258 }
259
C A Subramaniam5e683822009-11-22 10:11:23 -0800260 ret = request_irq(mbox->irq, mbox_interrupt, IRQF_SHARED,
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800261 mbox->name, mbox);
Ohad Ben-Cohen01072d82010-05-05 15:33:08 +0000262 if (ret) {
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800263 printk(KERN_ERR
264 "failed to register mailbox interrupt:%d\n", ret);
265 goto fail_request_irq;
266 }
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800267
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000268 mq = mbox_queue_alloc(mbox, NULL, mbox_tx_tasklet);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800269 if (!mq) {
270 ret = -ENOMEM;
271 goto fail_alloc_txq;
272 }
273 mbox->txq = mq;
274
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000275 mq = mbox_queue_alloc(mbox, mbox_rx_work, NULL);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800276 if (!mq) {
277 ret = -ENOMEM;
278 goto fail_alloc_rxq;
279 }
280 mbox->rxq = mq;
281
282 return 0;
283
284 fail_alloc_rxq:
285 mbox_queue_free(mbox->txq);
286 fail_alloc_txq:
287 free_irq(mbox->irq, mbox);
288 fail_request_irq:
Ohad Ben-Cohen01072d82010-05-05 15:33:08 +0000289 if (mbox->ops->shutdown)
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800290 mbox->ops->shutdown(mbox);
291
292 return ret;
293}
294
295static void omap_mbox_fini(struct omap_mbox *mbox)
296{
Fernando Guzman Lugoad6d9622010-02-12 19:02:32 -0600297 free_irq(mbox->irq, mbox);
Fernando Guzman Lugo0e828e82010-02-12 19:07:14 -0600298 tasklet_kill(&mbox->txq->tasklet);
299 flush_work(&mbox->rxq->work);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800300 mbox_queue_free(mbox->txq);
301 mbox_queue_free(mbox->rxq);
302
Ohad Ben-Cohen01072d82010-05-05 15:33:08 +0000303 if (mbox->ops->shutdown) {
Hiroshi DOYU72b917e2010-02-18 00:48:55 -0600304 mutex_lock(&mbox_configured_lock);
C A Subramaniam5f00ec62009-11-22 10:11:22 -0800305 if (mbox_configured > 0)
306 mbox_configured--;
307 if (!mbox_configured)
308 mbox->ops->shutdown(mbox);
Hiroshi DOYU72b917e2010-02-18 00:48:55 -0600309 mutex_unlock(&mbox_configured_lock);
C A Subramaniam5f00ec62009-11-22 10:11:22 -0800310 }
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800311}
312
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800313struct omap_mbox *omap_mbox_get(const char *name)
314{
315 struct omap_mbox *mbox;
316 int ret;
317
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000318 if (!mboxes)
319 return ERR_PTR(-EINVAL);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800320
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000321 for (mbox = *mboxes; mbox; mbox++)
322 if (!strcmp(mbox->name, name))
323 break;
324
325 if (!mbox)
326 return ERR_PTR(-ENOENT);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800327
Hiroshi DOYUc7c158e2009-11-22 10:11:19 -0800328 ret = omap_mbox_startup(mbox);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800329 if (ret)
330 return ERR_PTR(-ENODEV);
331
332 return mbox;
333}
334EXPORT_SYMBOL(omap_mbox_get);
335
336void omap_mbox_put(struct omap_mbox *mbox)
337{
338 omap_mbox_fini(mbox);
339}
340EXPORT_SYMBOL(omap_mbox_put);
341
Hiroshi DOYU6b233982010-05-18 16:15:32 +0300342static struct class omap_mbox_class = { .name = "mbox", };
343
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000344int omap_mbox_register(struct device *parent, struct omap_mbox **list)
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800345{
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000346 int ret;
347 int i;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800348
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000349 mboxes = list;
350 if (!mboxes)
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800351 return -EINVAL;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800352
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000353 for (i = 0; mboxes[i]; i++) {
354 struct omap_mbox *mbox = mboxes[i];
355 mbox->dev = device_create(&omap_mbox_class,
356 parent, 0, mbox, "%s", mbox->name);
357 if (IS_ERR(mbox->dev)) {
358 ret = PTR_ERR(mbox->dev);
359 goto err_out;
360 }
Hiroshi DOYUf48cca82009-03-23 18:07:24 -0700361 }
Hiroshi DOYUf48cca82009-03-23 18:07:24 -0700362 return 0;
363
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000364err_out:
365 while (i--)
366 device_unregister(mboxes[i]->dev);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800367 return ret;
368}
369EXPORT_SYMBOL(omap_mbox_register);
370
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000371int omap_mbox_unregister(void)
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800372{
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000373 int i;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800374
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000375 if (!mboxes)
376 return -EINVAL;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800377
Felipe Contreras9c80c8c2010-06-11 15:51:46 +0000378 for (i = 0; mboxes[i]; i++)
379 device_unregister(mboxes[i]->dev);
380 mboxes = NULL;
381 return 0;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800382}
383EXPORT_SYMBOL(omap_mbox_unregister);
384
Hiroshi DOYUc7c158e2009-11-22 10:11:19 -0800385static int __init omap_mbox_init(void)
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800386{
Hiroshi DOYU6b233982010-05-18 16:15:32 +0300387 int err;
388
389 err = class_register(&omap_mbox_class);
390 if (err)
391 return err;
392
Rob Clark8250a5c2010-01-04 19:22:03 +0530393 mboxd = create_workqueue("mboxd");
394 if (!mboxd)
395 return -ENOMEM;
396
Ohad Ben-Cohenb5bebe42010-05-05 15:33:09 +0000397 /* kfifo size sanity check: alignment and minimal size */
398 mbox_kfifo_size = ALIGN(mbox_kfifo_size, sizeof(mbox_msg_t));
399 mbox_kfifo_size = max_t(unsigned int, mbox_kfifo_size, sizeof(mbox_msg_t));
400
Hiroshi DOYUc7c158e2009-11-22 10:11:19 -0800401 return 0;
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800402}
Hiroshi DOYU6b233982010-05-18 16:15:32 +0300403subsys_initcall(omap_mbox_init);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800404
Hiroshi DOYUc7c158e2009-11-22 10:11:19 -0800405static void __exit omap_mbox_exit(void)
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800406{
Rob Clark8250a5c2010-01-04 19:22:03 +0530407 destroy_workqueue(mboxd);
Hiroshi DOYU6b233982010-05-18 16:15:32 +0300408 class_unregister(&omap_mbox_class);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800409}
Hiroshi DOYUc7c158e2009-11-22 10:11:19 -0800410module_exit(omap_mbox_exit);
Hiroshi DOYU340a6142006-12-07 15:43:59 -0800411
Hiroshi DOYUf48cca82009-03-23 18:07:24 -0700412MODULE_LICENSE("GPL v2");
413MODULE_DESCRIPTION("omap mailbox: interrupt driven messaging");
Ohad Ben-Cohenf3753252010-05-05 15:33:07 +0000414MODULE_AUTHOR("Toshihiro Kobayashi");
415MODULE_AUTHOR("Hiroshi DOYU");