Lines Matching refs:sc_ipc

27 	struct imx_sc_ipc *sc_ipc;  member
116 struct imx_sc_ipc *sc_ipc = sc_chan->sc_ipc; in imx_scu_rx_callback() local
121 if (!sc_ipc->msg) { in imx_scu_rx_callback()
122 dev_warn(sc_ipc->dev, "unexpected rx idx %d 0x%08x, ignore!\n", in imx_scu_rx_callback()
127 if (sc_ipc->fast_ipc) { in imx_scu_rx_callback()
129 sc_ipc->rx_size = hdr->size; in imx_scu_rx_callback()
130 sc_ipc->msg[0] = *data++; in imx_scu_rx_callback()
132 for (i = 1; i < sc_ipc->rx_size; i++) in imx_scu_rx_callback()
133 sc_ipc->msg[i] = *data++; in imx_scu_rx_callback()
135 complete(&sc_ipc->done); in imx_scu_rx_callback()
142 sc_ipc->rx_size = hdr->size; in imx_scu_rx_callback()
143 dev_dbg(sc_ipc->dev, "msg rx size %u\n", sc_ipc->rx_size); in imx_scu_rx_callback()
144 if (sc_ipc->rx_size > 4) in imx_scu_rx_callback()
145 dev_warn(sc_ipc->dev, "RPC does not support receiving over 4 words: %u\n", in imx_scu_rx_callback()
146 sc_ipc->rx_size); in imx_scu_rx_callback()
149 sc_ipc->msg[sc_chan->idx] = *data; in imx_scu_rx_callback()
150 sc_ipc->count++; in imx_scu_rx_callback()
152 dev_dbg(sc_ipc->dev, "mu %u msg %u 0x%x\n", sc_chan->idx, in imx_scu_rx_callback()
153 sc_ipc->count, *data); in imx_scu_rx_callback()
155 if ((sc_ipc->rx_size != 0) && (sc_ipc->count == sc_ipc->rx_size)) in imx_scu_rx_callback()
156 complete(&sc_ipc->done); in imx_scu_rx_callback()
159 static int imx_scu_ipc_write(struct imx_sc_ipc *sc_ipc, void *msg) in imx_scu_ipc_write() argument
172 dev_dbg(sc_ipc->dev, "RPC SVC %u FUNC %u SIZE %u\n", hdr.svc, in imx_scu_ipc_write()
175 size = sc_ipc->fast_ipc ? 1 : hdr.size; in imx_scu_ipc_write()
177 sc_chan = &sc_ipc->chans[i % 4]; in imx_scu_ipc_write()
188 if (!sc_ipc->fast_ipc) { in imx_scu_ipc_write()
204 int imx_scu_call_rpc(struct imx_sc_ipc *sc_ipc, void *msg, bool have_resp) in imx_scu_call_rpc() argument
210 if (WARN_ON(!sc_ipc || !msg)) in imx_scu_call_rpc()
213 mutex_lock(&sc_ipc->lock); in imx_scu_call_rpc()
214 reinit_completion(&sc_ipc->done); in imx_scu_call_rpc()
217 sc_ipc->msg = msg; in imx_scu_call_rpc()
221 sc_ipc->count = 0; in imx_scu_call_rpc()
222 ret = imx_scu_ipc_write(sc_ipc, msg); in imx_scu_call_rpc()
224 dev_err(sc_ipc->dev, "RPC send msg failed: %d\n", ret); in imx_scu_call_rpc()
229 if (!wait_for_completion_timeout(&sc_ipc->done, in imx_scu_call_rpc()
231 dev_err(sc_ipc->dev, "RPC send msg timeout\n"); in imx_scu_call_rpc()
232 mutex_unlock(&sc_ipc->lock); in imx_scu_call_rpc()
252 sc_ipc->msg = NULL; in imx_scu_call_rpc()
253 mutex_unlock(&sc_ipc->lock); in imx_scu_call_rpc()
255 dev_dbg(sc_ipc->dev, "RPC SVC done\n"); in imx_scu_call_rpc()
264 struct imx_sc_ipc *sc_ipc; in imx_scu_probe() local
273 sc_ipc = devm_kzalloc(dev, sizeof(*sc_ipc), GFP_KERNEL); in imx_scu_probe()
274 if (!sc_ipc) in imx_scu_probe()
282 sc_ipc->fast_ipc = of_device_is_compatible(args.np, "fsl,imx8-mu-scu"); in imx_scu_probe()
284 num_channel = sc_ipc->fast_ipc ? 2 : SCU_MU_CHAN_NUM; in imx_scu_probe()
295 sc_chan = &sc_ipc->chans[i]; in imx_scu_probe()
302 if (!sc_ipc->fast_ipc) { in imx_scu_probe()
309 sc_chan->sc_ipc = sc_ipc; in imx_scu_probe()
325 sc_ipc->dev = dev; in imx_scu_probe()
326 mutex_init(&sc_ipc->lock); in imx_scu_probe()
327 init_completion(&sc_ipc->done); in imx_scu_probe()
329 imx_sc_ipc_handle = sc_ipc; in imx_scu_probe()