• Home
  • Raw
  • Download

Lines Matching refs:mbox

41 void omap_mbox_init_seq(struct omap_mbox *mbox)  in omap_mbox_init_seq()  argument
43 mbox_seq_init(mbox); in omap_mbox_init_seq()
50 static int __mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void *arg) in __mbox_msg_send() argument
54 while (mbox_fifo_full(mbox)) { in __mbox_msg_send()
55 if (mbox->ops->type == OMAP_MBOX_TYPE2) in __mbox_msg_send()
62 if (arg && mbox->txq->callback) { in __mbox_msg_send()
63 ret = mbox->txq->callback(arg); in __mbox_msg_send()
68 mbox_seq_toggle(mbox, &msg); in __mbox_msg_send()
69 mbox_fifo_write(mbox, msg); in __mbox_msg_send()
74 int omap_mbox_msg_send(struct omap_mbox *mbox, mbox_msg_t msg, void* arg) in omap_mbox_msg_send() argument
77 struct request_queue *q = mbox->txq->queue; in omap_mbox_msg_send()
89 schedule_work(&mbox->txq->work); in omap_mbox_msg_send()
101 struct omap_mbox *mbox = mq->queue->queuedata; in mbox_tx_work() local
102 struct request_queue *q = mbox->txq->queue; in mbox_tx_work()
112 ret = __mbox_msg_send(mbox, (mbox_msg_t) rq->data, rq->special); in mbox_tx_work()
114 enable_mbox_irq(mbox, IRQ_TX); in mbox_tx_work()
132 struct omap_mbox *mbox = mq->queue->queuedata; in mbox_rx_work() local
133 struct request_queue *q = mbox->rxq->queue; in mbox_rx_work()
138 if (mbox->rxq->callback == NULL) { in mbox_rx_work()
139 sysfs_notify(&mbox->dev.kobj, NULL, "mbox"); in mbox_rx_work()
155 mbox->rxq->callback((void *)msg); in mbox_rx_work()
170 static void __mbox_tx_interrupt(struct omap_mbox *mbox) in __mbox_tx_interrupt() argument
172 disable_mbox_irq(mbox, IRQ_TX); in __mbox_tx_interrupt()
173 ack_mbox_irq(mbox, IRQ_TX); in __mbox_tx_interrupt()
174 schedule_work(&mbox->txq->work); in __mbox_tx_interrupt()
177 static void __mbox_rx_interrupt(struct omap_mbox *mbox) in __mbox_rx_interrupt() argument
181 struct request_queue *q = mbox->rxq->queue; in __mbox_rx_interrupt()
183 disable_mbox_irq(mbox, IRQ_RX); in __mbox_rx_interrupt()
185 while (!mbox_fifo_empty(mbox)) { in __mbox_rx_interrupt()
190 msg = mbox_fifo_read(mbox); in __mbox_rx_interrupt()
193 if (unlikely(mbox_seq_test(mbox, msg))) { in __mbox_rx_interrupt()
195 if (mbox->err_notify) in __mbox_rx_interrupt()
196 mbox->err_notify(); in __mbox_rx_interrupt()
200 if (mbox->ops->type == OMAP_MBOX_TYPE1) in __mbox_rx_interrupt()
205 ack_mbox_irq(mbox, IRQ_RX); in __mbox_rx_interrupt()
206 enable_mbox_irq(mbox, IRQ_RX); in __mbox_rx_interrupt()
208 schedule_work(&mbox->rxq->work); in __mbox_rx_interrupt()
213 struct omap_mbox *mbox = p; in mbox_interrupt() local
215 if (is_mbox_irq(mbox, IRQ_TX)) in mbox_interrupt()
216 __mbox_tx_interrupt(mbox); in mbox_interrupt()
218 if (is_mbox_irq(mbox, IRQ_RX)) in mbox_interrupt()
219 __mbox_rx_interrupt(mbox); in mbox_interrupt()
233 struct omap_mbox *mbox = dev_get_drvdata(dev); in omap_mbox_write() local
236 ret = omap_mbox_msg_send(mbox, be32_to_cpu(*p), NULL); in omap_mbox_write()
251 struct omap_mbox *mbox = dev_get_drvdata(dev); in omap_mbox_read() local
252 struct request_queue *q = mbox->rxq->queue; in omap_mbox_read()
267 if (unlikely(mbox_seq_test(mbox, *p))) { in omap_mbox_read()
279 static DEVICE_ATTR(mbox, S_IRUGO | S_IWUSR, omap_mbox_read, omap_mbox_write);
286 static CLASS_ATTR(mbox, S_IRUGO, mbox_show, NULL);
292 static struct omap_mbox_queue *mbox_queue_alloc(struct omap_mbox *mbox, in mbox_queue_alloc() argument
308 q->queuedata = mbox; in mbox_queue_alloc()
325 static int omap_mbox_init(struct omap_mbox *mbox) in omap_mbox_init() argument
330 if (likely(mbox->ops->startup)) { in omap_mbox_init()
331 ret = mbox->ops->startup(mbox); in omap_mbox_init()
336 mbox->dev.class = &omap_mbox_class; in omap_mbox_init()
337 dev_set_name(&mbox->dev, "%s", mbox->name); in omap_mbox_init()
338 dev_set_drvdata(&mbox->dev, mbox); in omap_mbox_init()
340 ret = device_register(&mbox->dev); in omap_mbox_init()
344 ret = device_create_file(&mbox->dev, &dev_attr_mbox); in omap_mbox_init()
351 ret = request_irq(mbox->irq, mbox_interrupt, IRQF_DISABLED, in omap_mbox_init()
352 mbox->name, mbox); in omap_mbox_init()
359 mq = mbox_queue_alloc(mbox, mbox_txq_fn, mbox_tx_work); in omap_mbox_init()
364 mbox->txq = mq; in omap_mbox_init()
366 mq = mbox_queue_alloc(mbox, mbox_rxq_fn, mbox_rx_work); in omap_mbox_init()
371 mbox->rxq = mq; in omap_mbox_init()
376 mbox_queue_free(mbox->txq); in omap_mbox_init()
378 free_irq(mbox->irq, mbox); in omap_mbox_init()
380 device_remove_file(&mbox->dev, &dev_attr_mbox); in omap_mbox_init()
382 device_unregister(&mbox->dev); in omap_mbox_init()
384 if (unlikely(mbox->ops->shutdown)) in omap_mbox_init()
385 mbox->ops->shutdown(mbox); in omap_mbox_init()
390 static void omap_mbox_fini(struct omap_mbox *mbox) in omap_mbox_fini() argument
392 mbox_queue_free(mbox->txq); in omap_mbox_fini()
393 mbox_queue_free(mbox->rxq); in omap_mbox_fini()
395 free_irq(mbox->irq, mbox); in omap_mbox_fini()
396 device_remove_file(&mbox->dev, &dev_attr_mbox); in omap_mbox_fini()
399 if (unlikely(mbox->ops->shutdown)) in omap_mbox_fini()
400 mbox->ops->shutdown(mbox); in omap_mbox_fini()
417 struct omap_mbox *mbox; in omap_mbox_get() local
421 mbox = *(find_mboxes(name)); in omap_mbox_get()
422 if (mbox == NULL) { in omap_mbox_get()
429 ret = omap_mbox_init(mbox); in omap_mbox_get()
433 return mbox; in omap_mbox_get()
437 void omap_mbox_put(struct omap_mbox *mbox) in omap_mbox_put() argument
439 omap_mbox_fini(mbox); in omap_mbox_put()
443 int omap_mbox_register(struct omap_mbox *mbox) in omap_mbox_register() argument
448 if (!mbox) in omap_mbox_register()
450 if (mbox->next) in omap_mbox_register()
454 tmp = find_mboxes(mbox->name); in omap_mbox_register()
458 *tmp = mbox; in omap_mbox_register()
465 int omap_mbox_unregister(struct omap_mbox *mbox) in omap_mbox_unregister() argument
472 if (mbox == *tmp) { in omap_mbox_unregister()
473 *tmp = mbox->next; in omap_mbox_unregister()
474 mbox->next = NULL; in omap_mbox_unregister()