Lines Matching full:md
81 struct t7xx_modem *md = t7xx_dev->md; in t7xx_pci_mhccif_isr() local
87 ctl = md->fsm_ctl; in t7xx_pci_mhccif_isr()
90 "MHCCIF interrupt received before initializing MD monitor\n"); in t7xx_pci_mhccif_isr()
94 spin_lock_bh(&md->exp_lock); in t7xx_pci_mhccif_isr()
96 md->exp_id |= int_sta; in t7xx_pci_mhccif_isr()
97 if (md->exp_id & D2H_INT_EXCEPTION_INIT) { in t7xx_pci_mhccif_isr()
102 md->exp_id &= ~D2H_INT_EXCEPTION_INIT; in t7xx_pci_mhccif_isr()
105 } else if (md->exp_id & D2H_INT_PORT_ENUM) { in t7xx_pci_mhccif_isr()
106 md->exp_id &= ~D2H_INT_PORT_ENUM; in t7xx_pci_mhccif_isr()
113 if ((md->exp_id & D2H_INT_ASYNC_MD_HK) && !(mask & D2H_INT_ASYNC_MD_HK)) { in t7xx_pci_mhccif_isr()
114 md->exp_id &= ~D2H_INT_ASYNC_MD_HK; in t7xx_pci_mhccif_isr()
115 queue_work(md->handshake_wq, &md->handshake_work); in t7xx_pci_mhccif_isr()
118 spin_unlock_bh(&md->exp_lock); in t7xx_pci_mhccif_isr()
208 modem = t7xx_dev->md; in t7xx_rgu_isr_handler()
268 /* We do not want to get CLDMA IRQ when MD is in t7xx_cldma_exception()
290 static void t7xx_md_exception(struct t7xx_modem *md, enum hif_ex_stage stage) in t7xx_md_exception() argument
292 struct t7xx_pci_dev *t7xx_dev = md->t7xx_dev; in t7xx_md_exception()
297 t7xx_port_proxy_reset(md->port_prox); in t7xx_md_exception()
300 t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_MD], stage); in t7xx_md_exception()
308 static int t7xx_wait_hif_ex_hk_event(struct t7xx_modem *md, int event_id) in t7xx_wait_hif_ex_hk_event() argument
313 if (md->exp_id & event_id) in t7xx_wait_hif_ex_hk_event()
325 /* Register the MHCCIF ISR for MD exception, port enum and in t7xx_md_sys_sw_init()
368 /* Parse MD runtime data query */ in t7xx_prepare_device_rt_data()
430 t7xx_port_enum_msg_handler(ctl->md, rt_feature->data); in t7xx_parse_host_rt_data()
436 static int t7xx_core_reset(struct t7xx_modem *md) in t7xx_core_reset() argument
438 struct device *dev = &md->t7xx_dev->pdev->dev; in t7xx_core_reset()
439 struct t7xx_fsm_ctl *ctl = md->fsm_ctl; in t7xx_core_reset()
441 md->core_md.ready = false; in t7xx_core_reset()
448 if (md->core_md.handshake_ongoing) { in t7xx_core_reset()
455 md->core_md.handshake_ongoing = false; in t7xx_core_reset()
459 static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_fsm_ctl *ctl, in t7xx_core_hk_handler() argument
464 struct t7xx_sys_info *core_info = &md->core_md; in t7xx_core_hk_handler()
465 struct device *dev = &md->t7xx_dev->pdev->dev; in t7xx_core_hk_handler()
525 struct t7xx_modem *md = container_of(work, struct t7xx_modem, handshake_work); in t7xx_md_hk_wq() local
526 struct t7xx_fsm_ctl *ctl = md->fsm_ctl; in t7xx_md_hk_wq()
530 t7xx_cldma_switch_cfg(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_hk_wq()
531 t7xx_cldma_start(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_hk_wq()
533 md->core_md.handshake_ongoing = true; in t7xx_md_hk_wq()
534 t7xx_core_hk_handler(md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT); in t7xx_md_hk_wq()
537 void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id) in t7xx_md_event_notify() argument
539 struct t7xx_fsm_ctl *ctl = md->fsm_ctl; in t7xx_md_event_notify()
546 t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM); in t7xx_md_event_notify()
550 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_PORT_ENUM); in t7xx_md_event_notify()
552 spin_lock_irqsave(&md->exp_lock, flags); in t7xx_md_event_notify()
553 int_sta = t7xx_get_interrupt_status(md->t7xx_dev); in t7xx_md_event_notify()
554 md->exp_id |= int_sta; in t7xx_md_event_notify()
555 if (md->exp_id & D2H_INT_EXCEPTION_INIT) { in t7xx_md_event_notify()
557 md->exp_id &= ~D2H_INT_EXCEPTION_INIT; in t7xx_md_event_notify()
558 md->exp_id &= ~D2H_INT_ASYNC_MD_HK; in t7xx_md_event_notify()
560 md->exp_id &= ~D2H_INT_ASYNC_MD_HK; in t7xx_md_event_notify()
561 } else if (md->exp_id & D2H_INT_ASYNC_MD_HK) { in t7xx_md_event_notify()
562 queue_work(md->handshake_wq, &md->handshake_work); in t7xx_md_event_notify()
563 md->exp_id &= ~D2H_INT_ASYNC_MD_HK; in t7xx_md_event_notify()
564 mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base; in t7xx_md_event_notify()
566 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); in t7xx_md_event_notify()
568 t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); in t7xx_md_event_notify()
570 spin_unlock_irqrestore(&md->exp_lock, flags); in t7xx_md_event_notify()
572 t7xx_mhccif_mask_clr(md->t7xx_dev, in t7xx_md_event_notify()
580 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); in t7xx_md_event_notify()
588 void t7xx_md_exception_handshake(struct t7xx_modem *md) in t7xx_md_exception_handshake() argument
590 struct device *dev = &md->t7xx_dev->pdev->dev; in t7xx_md_exception_handshake()
593 t7xx_md_exception(md, HIF_EX_INIT); in t7xx_md_exception_handshake()
594 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_INIT_DONE); in t7xx_md_exception_handshake()
598 t7xx_md_exception(md, HIF_EX_INIT_DONE); in t7xx_md_exception_handshake()
599 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_CLEARQ_DONE); in t7xx_md_exception_handshake()
603 t7xx_md_exception(md, HIF_EX_CLEARQ_DONE); in t7xx_md_exception_handshake()
604 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_ALLQ_RESET); in t7xx_md_exception_handshake()
608 t7xx_md_exception(md, HIF_EX_ALLQ_RESET); in t7xx_md_exception_handshake()
614 struct t7xx_modem *md; in t7xx_md_alloc() local
616 md = devm_kzalloc(dev, sizeof(*md), GFP_KERNEL); in t7xx_md_alloc()
617 if (!md) in t7xx_md_alloc()
620 md->t7xx_dev = t7xx_dev; in t7xx_md_alloc()
621 t7xx_dev->md = md; in t7xx_md_alloc()
622 spin_lock_init(&md->exp_lock); in t7xx_md_alloc()
623 md->handshake_wq = alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_HIGHPRI, in t7xx_md_alloc()
625 if (!md->handshake_wq) in t7xx_md_alloc()
628 INIT_WORK(&md->handshake_work, t7xx_md_hk_wq); in t7xx_md_alloc()
629 md->core_md.feature_set[RT_ID_MD_PORT_ENUM] &= ~FEATURE_MSK; in t7xx_md_alloc()
630 md->core_md.feature_set[RT_ID_MD_PORT_ENUM] |= in t7xx_md_alloc()
632 return md; in t7xx_md_alloc()
637 struct t7xx_modem *md = t7xx_dev->md; in t7xx_md_reset() local
639 md->md_init_finish = false; in t7xx_md_reset()
640 md->exp_id = 0; in t7xx_md_reset()
641 t7xx_fsm_reset(md); in t7xx_md_reset()
642 t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_reset()
643 t7xx_port_proxy_reset(md->port_prox); in t7xx_md_reset()
644 md->md_init_finish = true; in t7xx_md_reset()
645 return t7xx_core_reset(md); in t7xx_md_reset()
652 * Allocate and initialize MD control block, and initialize data path.
661 struct t7xx_modem *md; in t7xx_md_init() local
664 md = t7xx_md_alloc(t7xx_dev); in t7xx_md_init()
665 if (!md) in t7xx_md_init()
672 ret = t7xx_fsm_init(md); in t7xx_md_init()
680 ret = t7xx_cldma_init(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_init()
684 ret = t7xx_port_proxy_init(md); in t7xx_md_init()
688 ret = t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_START, 0); in t7xx_md_init()
693 md->md_init_finish = true; in t7xx_md_init()
697 t7xx_port_proxy_uninit(md->port_prox); in t7xx_md_init()
700 t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_init()
706 t7xx_fsm_uninit(md); in t7xx_md_init()
709 destroy_workqueue(md->handshake_wq); in t7xx_md_init()
716 struct t7xx_modem *md = t7xx_dev->md; in t7xx_md_exit() local
720 if (!md->md_init_finish) in t7xx_md_exit()
723 t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_PRE_STOP, FSM_CMD_FLAG_WAIT_FOR_COMPLETION); in t7xx_md_exit()
724 t7xx_port_proxy_uninit(md->port_prox); in t7xx_md_exit()
725 t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_exit()
727 t7xx_fsm_uninit(md); in t7xx_md_exit()
728 destroy_workqueue(md->handshake_wq); in t7xx_md_exit()