Lines Matching full:md

82 	struct t7xx_modem *md = t7xx_dev->md;  in t7xx_pci_mhccif_isr()  local
88 ctl = md->fsm_ctl; in t7xx_pci_mhccif_isr()
91 "MHCCIF interrupt received before initializing MD monitor\n"); in t7xx_pci_mhccif_isr()
95 spin_lock_bh(&md->exp_lock); in t7xx_pci_mhccif_isr()
97 md->exp_id |= int_sta; in t7xx_pci_mhccif_isr()
98 if (md->exp_id & D2H_INT_EXCEPTION_INIT) { in t7xx_pci_mhccif_isr()
103 md->exp_id &= ~D2H_INT_EXCEPTION_INIT; in t7xx_pci_mhccif_isr()
106 } else if (md->exp_id & D2H_INT_PORT_ENUM) { in t7xx_pci_mhccif_isr()
107 md->exp_id &= ~D2H_INT_PORT_ENUM; in t7xx_pci_mhccif_isr()
114 if ((md->exp_id & D2H_INT_ASYNC_MD_HK) && !(mask & D2H_INT_ASYNC_MD_HK)) { in t7xx_pci_mhccif_isr()
115 md->exp_id &= ~D2H_INT_ASYNC_MD_HK; in t7xx_pci_mhccif_isr()
116 queue_work(md->handshake_wq, &md->handshake_work); in t7xx_pci_mhccif_isr()
119 spin_unlock_bh(&md->exp_lock); in t7xx_pci_mhccif_isr()
209 modem = t7xx_dev->md; in t7xx_rgu_isr_handler()
269 /* We do not want to get CLDMA IRQ when MD is in t7xx_cldma_exception()
291 static void t7xx_md_exception(struct t7xx_modem *md, enum hif_ex_stage stage) in t7xx_md_exception() argument
293 struct t7xx_pci_dev *t7xx_dev = md->t7xx_dev; in t7xx_md_exception()
298 t7xx_port_proxy_reset(md->port_prox); in t7xx_md_exception()
301 t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_MD], stage); in t7xx_md_exception()
302 t7xx_cldma_exception(md->md_ctrl[CLDMA_ID_AP], stage); in t7xx_md_exception()
310 static int t7xx_wait_hif_ex_hk_event(struct t7xx_modem *md, int event_id) in t7xx_wait_hif_ex_hk_event() argument
315 if (md->exp_id & event_id) in t7xx_wait_hif_ex_hk_event()
327 /* Register the MHCCIF ISR for MD exception, port enum and in t7xx_md_sys_sw_init()
370 /* Parse MD runtime data query */ in t7xx_prepare_device_rt_data()
432 t7xx_port_enum_msg_handler(ctl->md, rt_feature->data); in t7xx_parse_host_rt_data()
438 static int t7xx_core_reset(struct t7xx_modem *md) in t7xx_core_reset() argument
440 struct device *dev = &md->t7xx_dev->pdev->dev; in t7xx_core_reset()
441 struct t7xx_fsm_ctl *ctl = md->fsm_ctl; in t7xx_core_reset()
443 md->core_md.ready = false; in t7xx_core_reset()
450 if (md->core_md.handshake_ongoing) { in t7xx_core_reset()
457 md->core_md.handshake_ongoing = false; in t7xx_core_reset()
461 static void t7xx_core_hk_handler(struct t7xx_modem *md, struct t7xx_sys_info *core_info, in t7xx_core_hk_handler() argument
467 struct device *dev = &md->t7xx_dev->pdev->dev; in t7xx_core_hk_handler()
527 struct t7xx_modem *md = container_of(work, struct t7xx_modem, handshake_work); in t7xx_md_hk_wq() local
528 struct t7xx_fsm_ctl *ctl = md->fsm_ctl; in t7xx_md_hk_wq()
532 t7xx_cldma_switch_cfg(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_hk_wq()
533 t7xx_cldma_start(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_hk_wq()
535 md->core_md.handshake_ongoing = true; in t7xx_md_hk_wq()
536 t7xx_core_hk_handler(md, &md->core_md, ctl, FSM_EVENT_MD_HS2, FSM_EVENT_MD_HS2_EXIT); in t7xx_md_hk_wq()
541 struct t7xx_modem *md = container_of(work, struct t7xx_modem, ap_handshake_work); in t7xx_ap_hk_wq() local
542 struct t7xx_fsm_ctl *ctl = md->fsm_ctl; in t7xx_ap_hk_wq()
546 t7xx_cldma_stop(md->md_ctrl[CLDMA_ID_AP]); in t7xx_ap_hk_wq()
547 t7xx_cldma_switch_cfg(md->md_ctrl[CLDMA_ID_AP]); in t7xx_ap_hk_wq()
548 t7xx_cldma_start(md->md_ctrl[CLDMA_ID_AP]); in t7xx_ap_hk_wq()
549 md->core_ap.handshake_ongoing = true; in t7xx_ap_hk_wq()
550 t7xx_core_hk_handler(md, &md->core_ap, ctl, FSM_EVENT_AP_HS2, FSM_EVENT_AP_HS2_EXIT); in t7xx_ap_hk_wq()
553 void t7xx_md_event_notify(struct t7xx_modem *md, enum md_event_id evt_id) in t7xx_md_event_notify() argument
555 struct t7xx_fsm_ctl *ctl = md->fsm_ctl; in t7xx_md_event_notify()
561 t7xx_mhccif_mask_clr(md->t7xx_dev, D2H_INT_PORT_ENUM | D2H_INT_ASYNC_MD_HK | in t7xx_md_event_notify()
566 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_PORT_ENUM); in t7xx_md_event_notify()
568 spin_lock_irqsave(&md->exp_lock, flags); in t7xx_md_event_notify()
569 int_sta = t7xx_get_interrupt_status(md->t7xx_dev); in t7xx_md_event_notify()
570 md->exp_id |= int_sta; in t7xx_md_event_notify()
571 if (md->exp_id & D2H_INT_EXCEPTION_INIT) { in t7xx_md_event_notify()
573 md->exp_id &= ~D2H_INT_EXCEPTION_INIT; in t7xx_md_event_notify()
574 md->exp_id &= ~D2H_INT_ASYNC_MD_HK; in t7xx_md_event_notify()
575 md->exp_id &= ~D2H_INT_ASYNC_AP_HK; in t7xx_md_event_notify()
577 md->exp_id &= ~D2H_INT_ASYNC_MD_HK; in t7xx_md_event_notify()
578 md->exp_id &= ~D2H_INT_ASYNC_AP_HK; in t7xx_md_event_notify()
580 void __iomem *mhccif_base = md->t7xx_dev->base_addr.mhccif_rc_base; in t7xx_md_event_notify()
582 if (md->exp_id & D2H_INT_ASYNC_MD_HK) { in t7xx_md_event_notify()
583 queue_work(md->handshake_wq, &md->handshake_work); in t7xx_md_event_notify()
584 md->exp_id &= ~D2H_INT_ASYNC_MD_HK; in t7xx_md_event_notify()
586 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); in t7xx_md_event_notify()
589 if (md->exp_id & D2H_INT_ASYNC_AP_HK) { in t7xx_md_event_notify()
590 queue_work(md->handshake_wq, &md->ap_handshake_work); in t7xx_md_event_notify()
591 md->exp_id &= ~D2H_INT_ASYNC_AP_HK; in t7xx_md_event_notify()
593 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK); in t7xx_md_event_notify()
596 spin_unlock_irqrestore(&md->exp_lock, flags); in t7xx_md_event_notify()
598 t7xx_mhccif_mask_clr(md->t7xx_dev, in t7xx_md_event_notify()
606 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_MD_HK); in t7xx_md_event_notify()
607 t7xx_mhccif_mask_set(md->t7xx_dev, D2H_INT_ASYNC_AP_HK); in t7xx_md_event_notify()
615 void t7xx_md_exception_handshake(struct t7xx_modem *md) in t7xx_md_exception_handshake() argument
617 struct device *dev = &md->t7xx_dev->pdev->dev; in t7xx_md_exception_handshake()
620 t7xx_md_exception(md, HIF_EX_INIT); in t7xx_md_exception_handshake()
621 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_INIT_DONE); in t7xx_md_exception_handshake()
625 t7xx_md_exception(md, HIF_EX_INIT_DONE); in t7xx_md_exception_handshake()
626 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_CLEARQ_DONE); in t7xx_md_exception_handshake()
630 t7xx_md_exception(md, HIF_EX_CLEARQ_DONE); in t7xx_md_exception_handshake()
631 ret = t7xx_wait_hif_ex_hk_event(md, D2H_INT_EXCEPTION_ALLQ_RESET); in t7xx_md_exception_handshake()
635 t7xx_md_exception(md, HIF_EX_ALLQ_RESET); in t7xx_md_exception_handshake()
641 struct t7xx_modem *md; in t7xx_md_alloc() local
643 md = devm_kzalloc(dev, sizeof(*md), GFP_KERNEL); in t7xx_md_alloc()
644 if (!md) in t7xx_md_alloc()
647 md->t7xx_dev = t7xx_dev; in t7xx_md_alloc()
648 t7xx_dev->md = md; in t7xx_md_alloc()
649 spin_lock_init(&md->exp_lock); in t7xx_md_alloc()
650 md->handshake_wq = alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM | WQ_HIGHPRI, in t7xx_md_alloc()
652 if (!md->handshake_wq) in t7xx_md_alloc()
655 INIT_WORK(&md->handshake_work, t7xx_md_hk_wq); in t7xx_md_alloc()
656 md->core_md.feature_set[RT_ID_MD_PORT_ENUM] &= ~FEATURE_MSK; in t7xx_md_alloc()
657 md->core_md.feature_set[RT_ID_MD_PORT_ENUM] |= in t7xx_md_alloc()
660 INIT_WORK(&md->ap_handshake_work, t7xx_ap_hk_wq); in t7xx_md_alloc()
661 md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] &= ~FEATURE_MSK; in t7xx_md_alloc()
662 md->core_ap.feature_set[RT_ID_AP_PORT_ENUM] |= in t7xx_md_alloc()
665 return md; in t7xx_md_alloc()
670 struct t7xx_modem *md = t7xx_dev->md; in t7xx_md_reset() local
672 md->md_init_finish = false; in t7xx_md_reset()
673 md->exp_id = 0; in t7xx_md_reset()
674 t7xx_fsm_reset(md); in t7xx_md_reset()
675 t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_reset()
676 t7xx_cldma_reset(md->md_ctrl[CLDMA_ID_AP]); in t7xx_md_reset()
677 t7xx_port_proxy_reset(md->port_prox); in t7xx_md_reset()
678 md->md_init_finish = true; in t7xx_md_reset()
679 return t7xx_core_reset(md); in t7xx_md_reset()
686 * Allocate and initialize MD control block, and initialize data path.
695 struct t7xx_modem *md; in t7xx_md_init() local
698 md = t7xx_md_alloc(t7xx_dev); in t7xx_md_init()
699 if (!md) in t7xx_md_init()
710 ret = t7xx_fsm_init(md); in t7xx_md_init()
718 ret = t7xx_cldma_init(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_init()
722 ret = t7xx_cldma_init(md->md_ctrl[CLDMA_ID_AP]); in t7xx_md_init()
726 ret = t7xx_port_proxy_init(md); in t7xx_md_init()
730 ret = t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_START, 0); in t7xx_md_init()
735 md->md_init_finish = true; in t7xx_md_init()
739 t7xx_port_proxy_uninit(md->port_prox); in t7xx_md_init()
742 t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]); in t7xx_md_init()
745 t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_init()
751 t7xx_fsm_uninit(md); in t7xx_md_init()
754 destroy_workqueue(md->handshake_wq); in t7xx_md_init()
761 struct t7xx_modem *md = t7xx_dev->md; in t7xx_md_exit() local
765 if (!md->md_init_finish) in t7xx_md_exit()
768 t7xx_fsm_append_cmd(md->fsm_ctl, FSM_CMD_PRE_STOP, FSM_CMD_FLAG_WAIT_FOR_COMPLETION); in t7xx_md_exit()
769 t7xx_port_proxy_uninit(md->port_prox); in t7xx_md_exit()
770 t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_AP]); in t7xx_md_exit()
771 t7xx_cldma_exit(md->md_ctrl[CLDMA_ID_MD]); in t7xx_md_exit()
773 t7xx_fsm_uninit(md); in t7xx_md_exit()
774 destroy_workqueue(md->handshake_wq); in t7xx_md_exit()