Lines Matching refs:mb

38 	struct rockchip_mbox *mb;  member
54 struct rockchip_mbox *mb = dev_get_drvdata(chan->mbox->dev); in rockchip_mbox_send_data() local
56 struct rockchip_mbox_chan *chans = mb->chans; in rockchip_mbox_send_data()
61 if (msg->rx_size > mb->buf_size) { in rockchip_mbox_send_data()
62 dev_err(mb->mbox.dev, "Transmit size over buf size(%d)\n", in rockchip_mbox_send_data()
63 mb->buf_size); in rockchip_mbox_send_data()
67 dev_dbg(mb->mbox.dev, "Chan[%d]: A2B message, cmd 0x%08x\n", in rockchip_mbox_send_data()
70 mb->chans[chans->idx].msg = msg; in rockchip_mbox_send_data()
72 writel_relaxed(msg->cmd, mb->mbox_base + MAILBOX_A2B_CMD(chans->idx)); in rockchip_mbox_send_data()
73 writel_relaxed(msg->rx_size, mb->mbox_base + in rockchip_mbox_send_data()
81 struct rockchip_mbox *mb = dev_get_drvdata(chan->mbox->dev); in rockchip_mbox_startup() local
84 writel_relaxed((1 << mb->mbox.num_chans) - 1, in rockchip_mbox_startup()
85 mb->mbox_base + MAILBOX_B2A_INTEN); in rockchip_mbox_startup()
92 struct rockchip_mbox *mb = dev_get_drvdata(chan->mbox->dev); in rockchip_mbox_shutdown() local
93 struct rockchip_mbox_chan *chans = mb->chans; in rockchip_mbox_shutdown()
96 writel_relaxed(0, mb->mbox_base + MAILBOX_B2A_INTEN); in rockchip_mbox_shutdown()
98 mb->chans[chans->idx].msg = NULL; in rockchip_mbox_shutdown()
110 struct rockchip_mbox *mb = (struct rockchip_mbox *)dev_id; in rockchip_mbox_irq() local
111 u32 status = readl_relaxed(mb->mbox_base + MAILBOX_B2A_STATUS); in rockchip_mbox_irq()
113 for (idx = 0; idx < mb->mbox.num_chans; idx++) { in rockchip_mbox_irq()
114 if ((status & (1 << idx)) && (irq == mb->chans[idx].irq)) { in rockchip_mbox_irq()
117 mb->mbox_base + MAILBOX_B2A_STATUS); in rockchip_mbox_irq()
129 struct rockchip_mbox *mb = (struct rockchip_mbox *)dev_id; in rockchip_mbox_isr() local
131 for (idx = 0; idx < mb->mbox.num_chans; idx++) { in rockchip_mbox_isr()
132 if (irq != mb->chans[idx].irq) in rockchip_mbox_isr()
135 msg = mb->chans[idx].msg; in rockchip_mbox_isr()
137 dev_err(mb->mbox.dev, in rockchip_mbox_isr()
142 mbox_chan_received_data(&mb->mbox.chans[idx], msg); in rockchip_mbox_isr()
143 mb->chans[idx].msg = NULL; in rockchip_mbox_isr()
145 dev_dbg(mb->mbox.dev, "Chan[%d]: B2A message, cmd 0x%08x\n", in rockchip_mbox_isr()
166 struct rockchip_mbox *mb; in rockchip_mbox_probe() local
178 mb = devm_kzalloc(&pdev->dev, sizeof(*mb), GFP_KERNEL); in rockchip_mbox_probe()
179 if (!mb) in rockchip_mbox_probe()
182 mb->chans = devm_kcalloc(&pdev->dev, drv_data->num_chans, in rockchip_mbox_probe()
183 sizeof(*mb->chans), GFP_KERNEL); in rockchip_mbox_probe()
184 if (!mb->chans) in rockchip_mbox_probe()
187 mb->mbox.chans = devm_kcalloc(&pdev->dev, drv_data->num_chans, in rockchip_mbox_probe()
188 sizeof(*mb->mbox.chans), GFP_KERNEL); in rockchip_mbox_probe()
189 if (!mb->mbox.chans) in rockchip_mbox_probe()
192 platform_set_drvdata(pdev, mb); in rockchip_mbox_probe()
194 mb->mbox.dev = &pdev->dev; in rockchip_mbox_probe()
195 mb->mbox.num_chans = drv_data->num_chans; in rockchip_mbox_probe()
196 mb->mbox.ops = &rockchip_mbox_chan_ops; in rockchip_mbox_probe()
197 mb->mbox.txdone_irq = true; in rockchip_mbox_probe()
203 mb->mbox_base = devm_ioremap_resource(&pdev->dev, res); in rockchip_mbox_probe()
204 if (IS_ERR(mb->mbox_base)) in rockchip_mbox_probe()
205 return PTR_ERR(mb->mbox_base); in rockchip_mbox_probe()
208 mb->buf_size = (size_t)resource_size(res) / (drv_data->num_chans * 2); in rockchip_mbox_probe()
210 mb->pclk = devm_clk_get(&pdev->dev, "pclk_mailbox"); in rockchip_mbox_probe()
211 if (IS_ERR(mb->pclk)) { in rockchip_mbox_probe()
212 ret = PTR_ERR(mb->pclk); in rockchip_mbox_probe()
218 ret = clk_prepare_enable(mb->pclk); in rockchip_mbox_probe()
224 for (i = 0; i < mb->mbox.num_chans; i++) { in rockchip_mbox_probe()
232 dev_name(&pdev->dev), mb); in rockchip_mbox_probe()
236 mb->chans[i].idx = i; in rockchip_mbox_probe()
237 mb->chans[i].irq = irq; in rockchip_mbox_probe()
238 mb->chans[i].mb = mb; in rockchip_mbox_probe()
239 mb->chans[i].msg = NULL; in rockchip_mbox_probe()
242 ret = devm_mbox_controller_register(&pdev->dev, &mb->mbox); in rockchip_mbox_probe()