Lines Matching +full:g +full:- +full:link

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
15 * struct do_cleanup_msg - The data structure for an SSR do_cleanup message
16 * @version: The G-Link SSR protocol version
17 * @command: The G-Link SSR command - do_cleanup
20 * @name: G-Link edge name of the subsystem being restarted
31 * struct cleanup_done_msg - The data structure for an SSR cleanup_done message
32 * @version: The G-Link SSR protocol version
33 * @response: The G-Link SSR response to a do_cleanup command, cleanup_done
43 * G-Link SSR protocol commands
62 * qcom_glink_ssr_notify() - notify GLINK SSR about stopped remoteproc
75 struct glink_ssr *ssr = dev_get_drvdata(&rpdev->dev); in qcom_glink_ssr_callback()
78 dev_err(ssr->dev, "message too short\n"); in qcom_glink_ssr_callback()
79 return -EINVAL; in qcom_glink_ssr_callback()
82 if (le32_to_cpu(msg->version) != 0) in qcom_glink_ssr_callback()
83 return -EINVAL; in qcom_glink_ssr_callback()
85 if (le32_to_cpu(msg->response) != GLINK_SSR_CLEANUP_DONE) in qcom_glink_ssr_callback()
88 if (le32_to_cpu(msg->seq_num) != ssr->seq_num) { in qcom_glink_ssr_callback()
89 dev_err(ssr->dev, "invalid sequence number of response\n"); in qcom_glink_ssr_callback()
90 return -EINVAL; in qcom_glink_ssr_callback()
93 complete(&ssr->completion); in qcom_glink_ssr_callback()
107 ssr->seq_num++; in qcom_glink_ssr_notifier_call()
108 reinit_completion(&ssr->completion); in qcom_glink_ssr_notifier_call()
112 msg.seq_num = cpu_to_le32(ssr->seq_num); in qcom_glink_ssr_notifier_call()
116 ret = rpmsg_send(ssr->ept, &msg, sizeof(msg)); in qcom_glink_ssr_notifier_call()
118 dev_err(ssr->dev, "failed to send cleanup message\n"); in qcom_glink_ssr_notifier_call()
120 ret = wait_for_completion_timeout(&ssr->completion, HZ); in qcom_glink_ssr_notifier_call()
122 dev_err(ssr->dev, "timeout waiting for cleanup done message\n"); in qcom_glink_ssr_notifier_call()
131 ssr = devm_kzalloc(&rpdev->dev, sizeof(*ssr), GFP_KERNEL); in qcom_glink_ssr_probe()
133 return -ENOMEM; in qcom_glink_ssr_probe()
135 init_completion(&ssr->completion); in qcom_glink_ssr_probe()
137 ssr->dev = &rpdev->dev; in qcom_glink_ssr_probe()
138 ssr->ept = rpdev->ept; in qcom_glink_ssr_probe()
139 ssr->nb.notifier_call = qcom_glink_ssr_notifier_call; in qcom_glink_ssr_probe()
141 dev_set_drvdata(&rpdev->dev, ssr); in qcom_glink_ssr_probe()
143 return blocking_notifier_chain_register(&ssr_notifiers, &ssr->nb); in qcom_glink_ssr_probe()
148 struct glink_ssr *ssr = dev_get_drvdata(&rpdev->dev); in qcom_glink_ssr_remove()
150 blocking_notifier_chain_unregister(&ssr_notifiers, &ssr->nb); in qcom_glink_ssr_remove()