Lines Matching refs:mb_chan
68 static void mb_chan_send_msg(struct slimpro_mbox_chan *mb_chan, u32 *msg) in mb_chan_send_msg() argument
70 writel(msg[1], mb_chan->reg + REG_DB_DOUT0); in mb_chan_send_msg()
71 writel(msg[2], mb_chan->reg + REG_DB_DOUT1); in mb_chan_send_msg()
72 writel(msg[0], mb_chan->reg + REG_DB_OUT); in mb_chan_send_msg()
75 static void mb_chan_recv_msg(struct slimpro_mbox_chan *mb_chan) in mb_chan_recv_msg() argument
77 mb_chan->rx_msg[1] = readl(mb_chan->reg + REG_DB_DIN0); in mb_chan_recv_msg()
78 mb_chan->rx_msg[2] = readl(mb_chan->reg + REG_DB_DIN1); in mb_chan_recv_msg()
79 mb_chan->rx_msg[0] = readl(mb_chan->reg + REG_DB_IN); in mb_chan_recv_msg()
82 static int mb_chan_status_ack(struct slimpro_mbox_chan *mb_chan) in mb_chan_status_ack() argument
84 u32 val = readl(mb_chan->reg + REG_DB_STAT); in mb_chan_status_ack()
87 writel(MBOX_STATUS_ACK_MASK, mb_chan->reg + REG_DB_STAT); in mb_chan_status_ack()
93 static int mb_chan_status_avail(struct slimpro_mbox_chan *mb_chan) in mb_chan_status_avail() argument
95 u32 val = readl(mb_chan->reg + REG_DB_STAT); in mb_chan_status_avail()
98 mb_chan_recv_msg(mb_chan); in mb_chan_status_avail()
99 writel(MBOX_STATUS_AVAIL_MASK, mb_chan->reg + REG_DB_STAT); in mb_chan_status_avail()
107 struct slimpro_mbox_chan *mb_chan = id; in slimpro_mbox_irq() local
109 if (mb_chan_status_ack(mb_chan)) in slimpro_mbox_irq()
110 mbox_chan_txdone(mb_chan->chan, 0); in slimpro_mbox_irq()
112 if (mb_chan_status_avail(mb_chan)) in slimpro_mbox_irq()
113 mbox_chan_received_data(mb_chan->chan, mb_chan->rx_msg); in slimpro_mbox_irq()
120 struct slimpro_mbox_chan *mb_chan = chan->con_priv; in slimpro_mbox_send_data() local
122 mb_chan_send_msg(mb_chan, msg); in slimpro_mbox_send_data()
128 struct slimpro_mbox_chan *mb_chan = chan->con_priv; in slimpro_mbox_startup() local
132 rc = devm_request_irq(mb_chan->dev, mb_chan->irq, slimpro_mbox_irq, 0, in slimpro_mbox_startup()
133 MBOX_CON_NAME, mb_chan); in slimpro_mbox_startup()
135 dev_err(mb_chan->dev, "failed to register mailbox interrupt %d\n", in slimpro_mbox_startup()
136 mb_chan->irq); in slimpro_mbox_startup()
142 mb_chan->reg + REG_DB_STAT); in slimpro_mbox_startup()
144 val = readl(mb_chan->reg + REG_DB_STATMASK); in slimpro_mbox_startup()
146 writel(val, mb_chan->reg + REG_DB_STATMASK); in slimpro_mbox_startup()
153 struct slimpro_mbox_chan *mb_chan = chan->con_priv; in slimpro_mbox_shutdown() local
157 val = readl(mb_chan->reg + REG_DB_STATMASK); in slimpro_mbox_shutdown()
159 writel(val, mb_chan->reg + REG_DB_STATMASK); in slimpro_mbox_shutdown()
161 devm_free_irq(mb_chan->dev, mb_chan->irq, mb_chan); in slimpro_mbox_shutdown()