Lines Matching refs:sc_ipc

27 	struct imx_sc_ipc *sc_ipc;  member
106 struct imx_sc_ipc *sc_ipc = sc_chan->sc_ipc; in imx_scu_rx_callback() local
112 sc_ipc->rx_size = hdr->size; in imx_scu_rx_callback()
113 dev_dbg(sc_ipc->dev, "msg rx size %u\n", sc_ipc->rx_size); in imx_scu_rx_callback()
114 if (sc_ipc->rx_size > 4) in imx_scu_rx_callback()
115 dev_warn(sc_ipc->dev, "RPC does not support receiving over 4 words: %u\n", in imx_scu_rx_callback()
116 sc_ipc->rx_size); in imx_scu_rx_callback()
119 sc_ipc->msg[sc_chan->idx] = *data; in imx_scu_rx_callback()
120 sc_ipc->count++; in imx_scu_rx_callback()
122 dev_dbg(sc_ipc->dev, "mu %u msg %u 0x%x\n", sc_chan->idx, in imx_scu_rx_callback()
123 sc_ipc->count, *data); in imx_scu_rx_callback()
125 if ((sc_ipc->rx_size != 0) && (sc_ipc->count == sc_ipc->rx_size)) in imx_scu_rx_callback()
126 complete(&sc_ipc->done); in imx_scu_rx_callback()
129 static int imx_scu_ipc_write(struct imx_sc_ipc *sc_ipc, void *msg) in imx_scu_ipc_write() argument
141 dev_dbg(sc_ipc->dev, "RPC SVC %u FUNC %u SIZE %u\n", hdr->svc, in imx_scu_ipc_write()
145 sc_chan = &sc_ipc->chans[i % 4]; in imx_scu_ipc_write()
157 int imx_scu_call_rpc(struct imx_sc_ipc *sc_ipc, void *msg, bool have_resp) in imx_scu_call_rpc() argument
162 if (WARN_ON(!sc_ipc || !msg)) in imx_scu_call_rpc()
165 mutex_lock(&sc_ipc->lock); in imx_scu_call_rpc()
166 reinit_completion(&sc_ipc->done); in imx_scu_call_rpc()
168 sc_ipc->msg = msg; in imx_scu_call_rpc()
169 sc_ipc->count = 0; in imx_scu_call_rpc()
170 ret = imx_scu_ipc_write(sc_ipc, msg); in imx_scu_call_rpc()
172 dev_err(sc_ipc->dev, "RPC send msg failed: %d\n", ret); in imx_scu_call_rpc()
177 if (!wait_for_completion_timeout(&sc_ipc->done, in imx_scu_call_rpc()
179 dev_err(sc_ipc->dev, "RPC send msg timeout\n"); in imx_scu_call_rpc()
180 mutex_unlock(&sc_ipc->lock); in imx_scu_call_rpc()
190 mutex_unlock(&sc_ipc->lock); in imx_scu_call_rpc()
192 dev_dbg(sc_ipc->dev, "RPC SVC done\n"); in imx_scu_call_rpc()
201 struct imx_sc_ipc *sc_ipc; in imx_scu_probe() local
208 sc_ipc = devm_kzalloc(dev, sizeof(*sc_ipc), GFP_KERNEL); in imx_scu_probe()
209 if (!sc_ipc) in imx_scu_probe()
221 sc_chan = &sc_ipc->chans[i]; in imx_scu_probe()
228 sc_chan->sc_ipc = sc_ipc; in imx_scu_probe()
244 sc_ipc->dev = dev; in imx_scu_probe()
245 mutex_init(&sc_ipc->lock); in imx_scu_probe()
246 init_completion(&sc_ipc->done); in imx_scu_probe()
248 imx_sc_ipc_handle = sc_ipc; in imx_scu_probe()