Lines Matching full:mbox

73 static bool mpfs_mbox_busy(struct mpfs_mbox *mbox)  in mpfs_mbox_busy()  argument
77 status = readl_relaxed(mbox->ctrl_base + SERVICES_SR_OFFSET); in mpfs_mbox_busy()
84 struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv; in mpfs_mbox_send_data() local
90 mbox->response = msg->response; in mpfs_mbox_send_data()
91 mbox->resp_offset = msg->resp_offset; in mpfs_mbox_send_data()
93 if (mpfs_mbox_busy(mbox)) in mpfs_mbox_send_data()
103 mbox->mbox_base + msg->mbox_offset + index * 0x4); in mpfs_mbox_send_data()
109 val = readl_relaxed(mbox->mbox_base + msg->mbox_offset + index * 0x4); in mpfs_mbox_send_data()
116 writel_relaxed(val, mbox->mbox_base + msg->mbox_offset + index * 0x4); in mpfs_mbox_send_data()
123 writel_relaxed(tx_trigger, mbox->ctrl_base + SERVICES_CR_OFFSET); in mpfs_mbox_send_data()
130 struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv; in mpfs_mbox_rx_data() local
131 struct mpfs_mss_response *response = mbox->response; in mpfs_mbox_rx_data()
136 dev_err(mbox->dev, "failed to assign memory for response %d\n", -ENOMEM); in mpfs_mbox_rx_data()
140 if (!mpfs_mbox_busy(mbox)) { in mpfs_mbox_rx_data()
143 readl_relaxed(mbox->mbox_base in mpfs_mbox_rx_data()
144 + mbox->resp_offset + i * 0x4); in mpfs_mbox_rx_data()
154 struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv; in mpfs_mbox_inbox_isr() local
156 writel_relaxed(0, mbox->int_reg); in mpfs_mbox_inbox_isr()
166 struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv; in mpfs_mbox_startup() local
169 if (!mbox) in mpfs_mbox_startup()
172 ret = devm_request_irq(mbox->dev, mbox->irq, mpfs_mbox_inbox_isr, 0, "mpfs-mailbox", chan); in mpfs_mbox_startup()
174 dev_err(mbox->dev, "failed to register mailbox interrupt:%d\n", ret); in mpfs_mbox_startup()
181 struct mpfs_mbox *mbox = (struct mpfs_mbox *)chan->con_priv; in mpfs_mbox_shutdown() local
183 devm_free_irq(mbox->dev, mbox->irq, chan); in mpfs_mbox_shutdown()
194 struct mpfs_mbox *mbox; in mpfs_mbox_probe() local
198 mbox = devm_kzalloc(&pdev->dev, sizeof(*mbox), GFP_KERNEL); in mpfs_mbox_probe()
199 if (!mbox) in mpfs_mbox_probe()
202 mbox->ctrl_base = devm_platform_get_and_ioremap_resource(pdev, 0, &regs); in mpfs_mbox_probe()
203 if (IS_ERR(mbox->ctrl_base)) in mpfs_mbox_probe()
204 return PTR_ERR(mbox->ctrl_base); in mpfs_mbox_probe()
206 mbox->int_reg = devm_platform_get_and_ioremap_resource(pdev, 1, &regs); in mpfs_mbox_probe()
207 if (IS_ERR(mbox->int_reg)) in mpfs_mbox_probe()
208 return PTR_ERR(mbox->int_reg); in mpfs_mbox_probe()
210 mbox->mbox_base = devm_platform_get_and_ioremap_resource(pdev, 2, &regs); in mpfs_mbox_probe()
211 if (IS_ERR(mbox->mbox_base)) // account for the old dt-binding w/ 2 regs in mpfs_mbox_probe()
212 mbox->mbox_base = mbox->ctrl_base + MAILBOX_REG_OFFSET; in mpfs_mbox_probe()
214 mbox->irq = platform_get_irq(pdev, 0); in mpfs_mbox_probe()
215 if (mbox->irq < 0) in mpfs_mbox_probe()
216 return mbox->irq; in mpfs_mbox_probe()
218 mbox->dev = &pdev->dev; in mpfs_mbox_probe()
220 mbox->chans[0].con_priv = mbox; in mpfs_mbox_probe()
221 mbox->controller.dev = mbox->dev; in mpfs_mbox_probe()
222 mbox->controller.num_chans = 1; in mpfs_mbox_probe()
223 mbox->controller.chans = mbox->chans; in mpfs_mbox_probe()
224 mbox->controller.ops = &mpfs_mbox_ops; in mpfs_mbox_probe()
225 mbox->controller.txdone_irq = true; in mpfs_mbox_probe()
227 ret = devm_mbox_controller_register(&pdev->dev, &mbox->controller); in mpfs_mbox_probe()