1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2021, MediaTek Inc.
4 * Copyright (c) 2021-2022, Intel Corporation.
18 #include <linux/acpi.h>
19 #include <linux/bits.h>
20 #include <linux/bitfield.h>
21 #include <linux/device.h>
22 #include <linux/delay.h>
23 #include <linux/gfp.h>
25 #include <linux/irqreturn.h>
26 #include <linux/kthread.h>
27 #include <linux/skbuff.h>
28 #include <linux/spinlock.h>
29 #include <linux/string.h>
30 #include <linux/types.h>
31 #include <linux/wait.h>
32 #include <linux/workqueue.h>
34 #include "t7xx_cldma.h"
35 #include "t7xx_hif_cldma.h"
36 #include "t7xx_mhccif.h"
37 #include "t7xx_modem_ops.h"
38 #include "t7xx_netdev.h"
40 #include "t7xx_pcie_mac.h"
41 #include "t7xx_port.h"
42 #include "t7xx_port_proxy.h"
44 #include "t7xx_state_monitor.h"
46 #define RT_ID_MD_PORT_ENUM 0
47 /* Modem feature query identification code - "ICCC" */
48 #define MD_FEATURE_QUERY_ID 0x49434343
50 #define FEATURE_VER GENMASK(7, 4)
51 #define FEATURE_MSK GENMASK(3, 0)
53 #define RGU_RESET_DELAY_MS 10
54 #define PORT_RESET_DELAY_MS 2000
55 #define EX_HS_TIMEOUT_MS 5000
56 #define EX_HS_POLL_DELAY_MS 10
58 enum mtk_feature_support_type {
59 MTK_FEATURE_DOES_NOT_EXIST,
60 MTK_FEATURE_NOT_SUPPORTED,
61 MTK_FEATURE_MUST_BE_SUPPORTED,
64 static unsigned int t7xx_get_interrupt_status(struct t7xx_pci_dev *t7xx_dev)
66 return t7xx_mhccif_read_sw_int_sts(t7xx_dev) & D2H_SW_INT_MASK;
70 * t7xx_pci_mhccif_isr() - Process MHCCIF interrupts.
71 * @t7xx_dev: MTK device.
73 * Check the interrupt status and queue commands accordingly.
77 ** -EINVAL - Failure to get FSM control.
79 int t7xx_pci_mhccif_isr(struct t7xx_pci_dev *t7xx_dev)
81 struct t7xx_modem *md = t7xx_dev->md;
82 struct t7xx_fsm_ctl *ctl;
89 dev_err_ratelimited(&t7xx_dev->pdev->dev,
90 "MHCCIF interrupt received before initializing MD monitor\n");
94 spin_lock_bh(&md->exp_lock);
95 int_sta = t7xx_get_interrupt_status(t7xx_dev);
96 md->exp_id |= int_sta;
97 if (md->exp_id & D2H_INT_EXCEPTION_INIT) {
98 if (ctl->md_state == MD_STATE_INVALID ||
99 ctl->md_state == MD_STATE_WAITING_FOR_HS1 ||
100 ctl->md_state == MD_STATE_WAITING_FOR_HS2 ||
101 ctl->md_state == MD_STATE_READY) {
102 md->exp_id &= ~D2H_INT_EXCEPTION_INIT;
103 ret = t7xx_fsm_recv_md_intr(ctl, MD_IRQ_CCIF_EX);
105 } else if (md->exp_id & D2H_INT_PORT_ENUM) {
106 md->exp_id &= ~D2H_INT_PORT_ENUM;
108 if (ctl->curr_state == FSM_STATE_INIT || ctl->curr_state == FSM_STATE_PRE_START ||
109 ctl->curr_state == FSM_STATE_STOPPED)
110 ret = t7xx_fsm_recv_md_intr(ctl, MD_IRQ_PORT_ENUM);
111 } else if (ctl->md_state == MD_STATE_WAITING_FOR_HS1) {
112 mask = t7xx_mhccif_mask_get(t7xx_dev);
113 if ((md->exp_id & D2H_INT_ASYNC_MD_HK) && !(mask & D2H_INT_ASYNC_MD_HK)) {
114 md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
115 queue_work(md->handshake_wq, &md->handshake_work);
118 spin_unlock_bh(&md->exp_lock);
123 static void t7xx_clr_device_irq_via_pcie(struct t7xx_pci_dev *t7xx_dev)
125 struct t7xx_addr_base *pbase_addr = &t7xx_dev->base_addr;
126 void __iomem *reset_pcie_reg;
129 reset_pcie_reg = pbase_addr->pcie_ext_reg_base + TOPRGU_CH_PCIE_IRQ_STA -
130 pbase_addr->pcie_dev_reg_trsl_addr;
131 val = ioread32(reset_pcie_reg);
132 iowrite32(val, reset_pcie_reg);
135 void t7xx_clear_rgu_irq(struct t7xx_pci_dev *t7xx_dev)
138 t7xx_clr_device_irq_via_pcie(t7xx_dev);
140 t7xx_pcie_mac_clear_int_status(t7xx_dev, SAP_RGU_INT);
143 static int t7xx_acpi_reset(struct t7xx_pci_dev *t7xx_dev, char *fn_name)
146 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
147 struct device *dev = &t7xx_dev->pdev->dev;
148 acpi_status acpi_ret;
151 handle = ACPI_HANDLE(dev);
153 dev_err(dev, "ACPI handle not found\n");
157 if (!acpi_has_method(handle, fn_name)) {
158 dev_err(dev, "%s method not found\n", fn_name);
162 acpi_ret = acpi_evaluate_object(handle, fn_name, NULL, &buffer);
163 if (ACPI_FAILURE(acpi_ret)) {
164 dev_err(dev, "%s method fail: %s\n", fn_name, acpi_format_exception(acpi_ret));
168 kfree(buffer.pointer);
174 int t7xx_acpi_fldr_func(struct t7xx_pci_dev *t7xx_dev)
176 return t7xx_acpi_reset(t7xx_dev, "_RST");
179 static void t7xx_reset_device_via_pmic(struct t7xx_pci_dev *t7xx_dev)
183 val = ioread32(IREG_BASE(t7xx_dev) + T7XX_PCIE_MISC_DEV_STATUS);
184 if (val & MISC_RESET_TYPE_PLDR)
185 t7xx_acpi_reset(t7xx_dev, "MRST._RST");
186 else if (val & MISC_RESET_TYPE_FLDR)
187 t7xx_acpi_fldr_func(t7xx_dev);
190 static irqreturn_t t7xx_rgu_isr_thread(int irq, void *data)
192 struct t7xx_pci_dev *t7xx_dev = data;
194 msleep(RGU_RESET_DELAY_MS);
195 t7xx_reset_device_via_pmic(t7xx_dev);
199 static irqreturn_t t7xx_rgu_isr_handler(int irq, void *data)
201 struct t7xx_pci_dev *t7xx_dev = data;
202 struct t7xx_modem *modem;
204 t7xx_clear_rgu_irq(t7xx_dev);
205 if (!t7xx_dev->rgu_pci_irq_en)
208 modem = t7xx_dev->md;
209 modem->rgu_irq_asserted = true;
210 t7xx_pcie_mac_clear_int(t7xx_dev, SAP_RGU_INT);
211 return IRQ_WAKE_THREAD;
214 static void t7xx_pcie_register_rgu_isr(struct t7xx_pci_dev *t7xx_dev)
216 /* Registers RGU callback ISR with PCIe driver */
217 t7xx_pcie_mac_clear_int(t7xx_dev, SAP_RGU_INT);
218 t7xx_pcie_mac_clear_int_status(t7xx_dev, SAP_RGU_INT);
220 t7xx_dev->intr_handler[SAP_RGU_INT] = t7xx_rgu_isr_handler;
221 t7xx_dev->intr_thread[SAP_RGU_INT] = t7xx_rgu_isr_thread;
222 t7xx_dev->callback_param[SAP_RGU_INT] = t7xx_dev;
223 t7xx_pcie_mac_set_int(t7xx_dev, SAP_RGU_INT);
227 * t7xx_cldma_exception() - CLDMA exception handler.
228 * @md_ctrl: modem control struct.
229 * @stage: exception stage.
231 * Part of the modem exception recovery.
232 * Stages are one after the other as describe below:
233 * HIF_EX_INIT: Disable and clear TXQ.
234 * HIF_EX_CLEARQ_DONE: Disable RX, flush TX/RX workqueues and clear RX.
235 * HIF_EX_ALLQ_RESET: HW is back in safe mode for re-initialization and restart.
238 /* Modem Exception Handshake Flow
240 * Modem HW Exception interrupt received
243 * +---------v--------+
244 * | HIF_EX_INIT | : Disable and clear TXQ
245 * +------------------+
247 * +---------v--------+
248 * | HIF_EX_INIT_DONE | : Wait for the init to be done
249 * +------------------+
251 * +---------v--------+
252 * |HIF_EX_CLEARQ_DONE| : Disable and clear RXQ
253 * +------------------+ : Flush TX/RX workqueues
255 * +---------v--------+
256 * |HIF_EX_ALLQ_RESET | : Restart HW and CLDMA
257 * +------------------+
259 static void t7xx_cldma_exception(struct cldma_ctrl *md_ctrl, enum hif_ex_stage stage)
263 t7xx_cldma_stop_all_qs(md_ctrl, MTK_TX);
264 t7xx_cldma_clear_all_qs(md_ctrl, MTK_TX);
267 case HIF_EX_CLEARQ_DONE:
268 /* We do not want to get CLDMA IRQ when MD is
269 * resetting CLDMA after it got clearq_ack.
271 t7xx_cldma_stop_all_qs(md_ctrl, MTK_RX);
272 t7xx_cldma_stop(md_ctrl);
274 if (md_ctrl->hif_id == CLDMA_ID_MD)
275 t7xx_cldma_hw_reset(md_ctrl->t7xx_dev->base_addr.infracfg_ao_base);
277 t7xx_cldma_clear_all_qs(md_ctrl, MTK_RX);
280 case HIF_EX_ALLQ_RESET:
281 t7xx_cldma_hw_init(&md_ctrl->hw_info);
282 t7xx_cldma_start(md_ctrl);
290 static void t7xx_md_exception(struct t7xx_modem *md, enum hif_ex_stage stage)
292 struct t7xx_pci_dev *t7xx_dev = md->t7xx_dev;
294 if (stage == HIF_EX_CLEARQ_DONE) {
295 /* Give DHL time to flush data */
296 msleep(PORT_RESET_DELAY_MS);
297 t7xx_port_proxy_reset(md->port_prox);
300 t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_MD], stage);
302 if (stage == HIF_EX_INIT)
303 t7xx_mhccif_h2d_swint_trigger(t7xx_dev, H2D_CH_EXCEPTION_ACK);
304 else if (stage == HIF_EX_CLEARQ_DONE)
305 t7xx_mhccif_h2d_swint_trigger(t7xx_dev, H2D_CH_EXCEPTION_CLEARQ_ACK);
308 static int t7xx_wait_hif_ex_hk_event(struct t7xx_modem *md, int event_id)
310 unsigned int waited_time_ms = 0;
313 if (md->exp_id & event_id)
316 waited_time_ms += EX_HS_POLL_DELAY_MS;
317 msleep(EX_HS_POLL_DELAY_MS);
318 } while (waited_time_ms < EX_HS_TIMEOUT_MS);
323 static void t7xx_md_sys_sw_init(struct t7xx_pci_dev *t7xx_dev)
325 /* Register the MHCCIF ISR for MD exception, port enum and
326 * async handshake notifications.
328 t7xx_mhccif_mask_set(t7xx_dev, D2H_SW_INT_MASK);
329 t7xx_mhccif_mask_clr(t7xx_dev, D2H_INT_PORT_ENUM);
331 /* Register RGU IRQ handler for sAP exception notification */
332 t7xx_dev->rgu_pci_irq_en = true;
333 t7xx_pcie_register_rgu_isr(t7xx_dev);
336 struct feature_query {
338 u8 feature_set[FEATURE_COUNT];
342 static void t7xx_prepare_host_rt_data_query(struct t7xx_sys_info *core)
344 struct feature_query *ft_query;
347 skb = t7xx_ctrl_alloc_skb(sizeof(*ft_query));
351 ft_query = skb_put(skb, sizeof(*ft_query));
352 ft_query->head_pattern = cpu_to_le32(MD_FEATURE_QUERY_ID);
353 memcpy(ft_query->feature_set, core->feature_set, FEATURE_COUNT);
354 ft_query->tail_pattern = cpu_to_le32(MD_FEATURE_QUERY_ID);
356 /* Send HS1 message to device */
357 t7xx_port_send_ctl_skb(core->ctl_port, skb, CTL_ID_HS1_MSG, 0);
360 static int t7xx_prepare_device_rt_data(struct t7xx_sys_info *core, struct device *dev,
363 struct feature_query *md_feature = data;
364 struct mtk_runtime_feature *rt_feature;
365 unsigned int i, rt_data_len = 0;
368 /* Parse MD runtime data query */
369 if (le32_to_cpu(md_feature->head_pattern) != MD_FEATURE_QUERY_ID ||
370 le32_to_cpu(md_feature->tail_pattern) != MD_FEATURE_QUERY_ID) {
371 dev_err(dev, "Invalid feature pattern: head 0x%x, tail 0x%x\n",
372 le32_to_cpu(md_feature->head_pattern),
373 le32_to_cpu(md_feature->tail_pattern));
377 for (i = 0; i < FEATURE_COUNT; i++) {
378 if (FIELD_GET(FEATURE_MSK, md_feature->feature_set[i]) !=
379 MTK_FEATURE_MUST_BE_SUPPORTED)
380 rt_data_len += sizeof(*rt_feature);
383 skb = t7xx_ctrl_alloc_skb(rt_data_len);
387 rt_feature = skb_put(skb, rt_data_len);
388 memset(rt_feature, 0, rt_data_len);
390 /* Fill runtime feature */
391 for (i = 0; i < FEATURE_COUNT; i++) {
392 u8 md_feature_mask = FIELD_GET(FEATURE_MSK, md_feature->feature_set[i]);
394 if (md_feature_mask == MTK_FEATURE_MUST_BE_SUPPORTED)
397 rt_feature->feature_id = i;
398 if (md_feature_mask == MTK_FEATURE_DOES_NOT_EXIST)
399 rt_feature->support_info = md_feature->feature_set[i];
404 /* Send HS3 message to device */
405 t7xx_port_send_ctl_skb(core->ctl_port, skb, CTL_ID_HS3_MSG, 0);
409 static int t7xx_parse_host_rt_data(struct t7xx_fsm_ctl *ctl, struct t7xx_sys_info *core,
410 struct device *dev, void *data, int data_length)
412 enum mtk_feature_support_type ft_spt_st, ft_spt_cfg;
413 struct mtk_runtime_feature *rt_feature;
416 offset = sizeof(struct feature_query);
417 for (i = 0; i < FEATURE_COUNT && offset < data_length; i++) {
418 rt_feature = data + offset;
419 offset += sizeof(*rt_feature) + le32_to_cpu(rt_feature->data_len);
421 ft_spt_cfg = FIELD_GET(FEATURE_MSK, core->feature_set[i]);
422 if (ft_spt_cfg != MTK_FEATURE_MUST_BE_SUPPORTED)
425 ft_spt_st = FIELD_GET(FEATURE_MSK, rt_feature->support_info);
426 if (ft_spt_st != MTK_FEATURE_MUST_BE_SUPPORTED)
429 if (i == RT_ID_MD_PORT_ENUM)
430 t7xx_port_enum_msg_handler(ctl->md, rt_feature->data);
436 static int t7xx_core_reset(struct t7xx_modem *md)
438 struct device *dev = &md->t7xx_dev->pdev->dev;
439 struct t7xx_fsm_ctl *ctl = md->fsm_ctl;
441 md->core_md.ready = false;
444 dev_err(dev, "FSM is not initialized\n");
448 if (md->core_md.handshake_ongoing) {
449 int ret = t7xx_fsm_append_event(ctl, FSM_EVENT_MD_HS2_EXIT, NULL, 0);
455 md->core_md.handshake_ongoing = false;
459 static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl,
460 enum t7xx_fsm_event_state event_id,
461 enum t7xx_fsm_event_state err_detect)
463 struct t7xx_fsm_event *event = NULL, *event_next;
464 struct t7xx_sys_info *core_info = &md->core_md;
465 struct device *dev = &md->t7xx_dev->pdev->dev;
469 t7xx_prepare_host_rt_data_query(core_info);
471 while (!kthread_should_stop()) {
472 bool event_received = false;
474 spin_lock_irqsave(&ctl->event_lock, flags);
475 list_for_each_entry_safe(event, event_next, &ctl->event_queue, entry) {
476 if (event->event_id == err_detect) {
477 list_del(&event->entry);
478 spin_unlock_irqrestore(&ctl->event_lock, flags);
479 dev_err(dev, "Core handshake error event received\n");
481 } else if (event->event_id == event_id) {
482 list_del(&event->entry);
483 event_received = true;
487 spin_unlock_irqrestore(&ctl->event_lock, flags);
492 wait_event_interruptible(ctl->event_wq, !list_empty(&ctl->event_queue) ||
493 kthread_should_stop());
494 if (kthread_should_stop())
498 if (!event || ctl->exp_flg)
501 ret = t7xx_parse_host_rt_data(ctl, core_info, dev, event->data, event->length);
503 dev_err(dev, "Host failure parsing runtime data: %d\n", ret);
510 ret = t7xx_prepare_device_rt_data(core_info, dev, event->data);
512 dev_err(dev, "Device failure parsing runtime data: %d", ret);
516 core_info->ready = true;
517 core_info->handshake_ongoing = false;
518 wake_up(&ctl->async_hk_wq);
523 static void t7xx_md_hk_wq(struct work_struct *work)
525 struct t7xx_modem *md = container_of(work, struct t7xx_modem, handshake_work);
526 struct t7xx_fsm_ctl *ctl = md->fsm_ctl;
528 /* Clear the HS2 EXIT event appended in core_reset() */
529 t7xx_fsm_clr_event(ctl, FSM_EVENT_MD_HS2_EXIT);
530 t7xx_cldma_switch_cfg(md->md_ctrl[CLDMA_ID_MD]);
531 t7xx_cldma_start(md->md_ctrl[CLDMA_ID_MD]);
532 t7xx_fsm_broadcast_state(ctl, MD_STATE_WAITING_FOR_HS2);
533 md->core_md.handshake_ongoing = true;
534 t7xx_core_hk_handler(md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT);
537 void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id)
539 struct t7xx_fsm_ctl *ctl = md->fsm_ctl;
540 void __iomem *mhccif_base;
541 unsigned int int_sta;
546 t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM);
550 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_PORT_ENUM);
552 spin_lock_irqsave(&md->exp_lock, flags);
553 int_sta = t7xx_get_interrupt_status(md->t7xx_dev);
554 md->exp_id |= int_sta;
555 if (md->exp_id & D2H_INT_EXCEPTION_INIT) {
557 md->exp_id &= ~D2H_INT_EXCEPTION_INIT;
558 md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
559 } else if (ctl->exp_flg) {
560 md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
561 } else if (md->exp_id & D2H_INT_ASYNC_MD_HK) {
562 queue_work(md->handshake_wq, &md->handshake_work);
563 md->exp_id &= ~D2H_INT_ASYNC_MD_HK;
564 mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base;
565 iowrite32(D2H_INT_ASYNC_MD_HK, mhccif_base + REG_EP2RC_SW_INT_ACK);
566 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
568 t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
570 spin_unlock_irqrestore(&md->exp_lock, flags);
572 t7xx_mhccif_mask_clr(md->t7xx_dev,
573 D2H_INT_EXCEPTION_INIT |
574 D2H_INT_EXCEPTION_INIT_DONE |
575 D2H_INT_EXCEPTION_CLEARQ_DONE |
576 D2H_INT_EXCEPTION_ALLQ_RESET);
580 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK);
588 void t7xx_md_exception_handshake(struct t7xx_modem *md)
590 struct device *dev = &md->t7xx_dev->pdev->dev;
593 t7xx_md_exception(md, HIF_EX_INIT);
594 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_INIT_DONE);
596 dev_err(dev, "EX CCIF HS timeout, RCH 0x%lx\n", D2H_INT_EXCEPTION_INIT_DONE);
598 t7xx_md_exception(md, HIF_EX_INIT_DONE);
599 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_CLEARQ_DONE);
601 dev_err(dev, "EX CCIF HS timeout, RCH 0x%lx\n", D2H_INT_EXCEPTION_CLEARQ_DONE);
603 t7xx_md_exception(md, HIF_EX_CLEARQ_DONE);
604 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_ALLQ_RESET);
606 dev_err(dev, "EX CCIF HS timeout, RCH 0x%lx\n", D2H_INT_EXCEPTION_ALLQ_RESET);
608 t7xx_md_exception(md, HIF_EX_ALLQ_RESET);
611 static struct t7xx_modem *t7xx_md_alloc(struct t7xx_pci_dev *t7xx_dev)
613 struct device *dev = &t7xx_dev->pdev->dev;
614 struct t7xx_modem *md;
616 md = devm_kzalloc(dev, sizeof(*md), GFP_KERNEL);
620 md->t7xx_dev = t7xx_dev;
622 spin_lock_init(&md->exp_lock);
623 md->handshake_wq = alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_HIGHPRI,
625 if (!md->handshake_wq)
628 INIT_WORK(&md->handshake_work, t7xx_md_hk_wq);
629 md->core_md.feature_set[RT_ID_MD_PORT_ENUM] &= ~FEATURE_MSK;
630 md->core_md.feature_set[RT_ID_MD_PORT_ENUM] |=
631 FIELD_PREP(FEATURE_MSK, MTK_FEATURE_MUST_BE_SUPPORTED);
635 int t7xx_md_reset(struct t7xx_pci_dev *t7xx_dev)
637 struct t7xx_modem *md = t7xx_dev->md;
639 md->md_init_finish = false;
642 t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_MD]);
643 t7xx_port_proxy_reset(md->port_prox);
644 md->md_init_finish = true;
645 return t7xx_core_reset(md);
649 * t7xx_md_init() - Initialize modem.
650 * @t7xx_dev: MTK device.
652 * Allocate and initialize MD control block, and initialize data path.
653 * Register MHCCIF ISR and RGU ISR, and start the state machine.
657 ** -ENOMEM - Allocation failure.
659 int t7xx_md_init(struct t7xx_pci_dev *t7xx_dev)
661 struct t7xx_modem *md;
664 md = t7xx_md_alloc(t7xx_dev);
668 ret = t7xx_cldma_alloc(CLDMA_ID_MD, t7xx_dev);
670 goto err_destroy_hswq;
672 ret = t7xx_fsm_init(md);
674 goto err_destroy_hswq;
676 ret = t7xx_ccmni_init(t7xx_dev);
680 ret = t7xx_cldma_init(md->md_ctrl[CLDMA_ID_MD]);
682 goto err_uninit_ccmni;
684 ret = t7xx_port_proxy_init(md);
686 goto err_uninit_md_cldma;
688 ret = t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_START, 0);
689 if (ret) /* fsm_uninit flushes cmd queue */
690 goto err_uninit_proxy;
692 t7xx_md_sys_sw_init(t7xx_dev);
693 md->md_init_finish = true;
697 t7xx_port_proxy_uninit(md->port_prox);
700 t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]);
703 t7xx_ccmni_exit(t7xx_dev);
709 destroy_workqueue(md->handshake_wq);
710 dev_err(&t7xx_dev->pdev->dev, "Modem init failed\n");
714 void t7xx_md_exit(struct t7xx_pci_dev *t7xx_dev)
716 struct t7xx_modem *md = t7xx_dev->md;
718 t7xx_pcie_mac_clear_int(t7xx_dev, SAP_RGU_INT);
720 if (!md->md_init_finish)
723 t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_PRE_STOP, FSM_CMD_FLAG_WAIT_FOR_COMPLETION);
724 t7xx_port_proxy_uninit(md->port_prox);
725 t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]);
726 t7xx_ccmni_exit(t7xx_dev);
728 destroy_workqueue(md->handshake_wq);