Lines Matching full:mbox
42 struct mbox_controller mbox; member
60 mhu_db_mbox_to_channel(struct mbox_controller *mbox, unsigned int pchan, in mhu_db_mbox_to_channel() argument
66 for (i = 0; i < mbox->num_chans; i++) { in mhu_db_mbox_to_channel()
67 chan_info = mbox->chans[i].con_priv; in mhu_db_mbox_to_channel()
70 return &mbox->chans[i]; in mhu_db_mbox_to_channel()
100 struct mbox_controller *mbox = &mhu->mbox; in mhu_db_mbox_irq_to_channel() local
113 chan = mhu_db_mbox_to_channel(mbox, pchan, doorbell); in mhu_db_mbox_irq_to_channel()
116 dev_err(mbox->dev, in mhu_db_mbox_irq_to_channel()
169 struct mbox_controller *mbox = &chan_info->mhu->mbox; in mhu_db_shutdown() local
172 for (i = 0; i < mbox->num_chans; i++) in mhu_db_shutdown()
173 if (chan == &mbox->chans[i]) in mhu_db_shutdown()
176 if (mbox->num_chans == i) { in mhu_db_shutdown()
177 dev_warn(mbox->dev, "Request to free non-existent channel\n"); in mhu_db_shutdown()
183 devm_kfree(mbox->dev, chan->con_priv); in mhu_db_shutdown()
187 static struct mbox_chan *mhu_db_mbox_xlate(struct mbox_controller *mbox, in mhu_db_mbox_xlate() argument
190 struct arm_mhu *mhu = dev_get_drvdata(mbox->dev); in mhu_db_mbox_xlate()
199 dev_err(mbox->dev, in mhu_db_mbox_xlate()
206 chan = mhu_db_mbox_to_channel(mbox, pchan, doorbell); in mhu_db_mbox_xlate()
208 dev_err(mbox->dev, "Channel in use: pchan: %d doorbell: %d\n", in mhu_db_mbox_xlate()
214 for (i = 0; i < mbox->num_chans; i++) in mhu_db_mbox_xlate()
215 if (!mbox->chans[i].con_priv) in mhu_db_mbox_xlate()
218 if (mbox->num_chans == i) { in mhu_db_mbox_xlate()
219 dev_err(mbox->dev, "No free channels left\n"); in mhu_db_mbox_xlate()
223 chan = &mbox->chans[i]; in mhu_db_mbox_xlate()
225 chan_info = devm_kzalloc(mbox->dev, sizeof(*chan_info), GFP_KERNEL); in mhu_db_mbox_xlate()
235 dev_dbg(mbox->dev, "mbox: created channel phys: %d doorbell: %d\n", in mhu_db_mbox_xlate()
263 err = of_property_read_u32(np, "#mbox-cells", &cell_count); in mhu_db_probe()
265 dev_err(dev, "failed to read #mbox-cells in '%pOF'\n", np); in mhu_db_probe()
272 dev_err(dev, "incorrect value of #mbox-cells in '%pOF'\n", np); in mhu_db_probe()
289 mhu->mbox.dev = dev; in mhu_db_probe()
290 mhu->mbox.chans = chans; in mhu_db_probe()
291 mhu->mbox.num_chans = max_chans; in mhu_db_probe()
292 mhu->mbox.txdone_irq = false; in mhu_db_probe()
293 mhu->mbox.txdone_poll = true; in mhu_db_probe()
294 mhu->mbox.txpoll_period = 1; in mhu_db_probe()
296 mhu->mbox.of_xlate = mhu_db_mbox_xlate; in mhu_db_probe()
299 mhu->mbox.ops = &mhu_db_ops; in mhu_db_probe()
301 err = devm_mbox_controller_register(dev, &mhu->mbox); in mhu_db_probe()
323 mbox_controller_unregister(&mhu->mbox); in mhu_db_probe()