Lines Matching refs:mhi_chan
277 struct mhi_chan *mhi_chan; in mhi_init_dev_ctxt() local
299 mhi_chan = mhi_cntrl->mhi_chan; in mhi_init_dev_ctxt()
301 for (i = 0; i < mhi_cntrl->max_chan; i++, chan_ctxt++, mhi_chan++) { in mhi_init_dev_ctxt()
303 if (mhi_chan->offload_ch) in mhi_init_dev_ctxt()
310 tmp |= FIELD_PREP(CHAN_CTX_BRSTMODE_MASK, mhi_chan->db_cfg.brstmode); in mhi_init_dev_ctxt()
312 tmp |= FIELD_PREP(CHAN_CTX_POLLCFG_MASK, mhi_chan->db_cfg.pollcfg); in mhi_init_dev_ctxt()
315 chan_ctxt->chtype = cpu_to_le32(mhi_chan->type); in mhi_init_dev_ctxt()
316 chan_ctxt->erindex = cpu_to_le32(mhi_chan->er_index); in mhi_init_dev_ctxt()
318 mhi_chan->ch_state = MHI_CH_STATE_DISABLED; in mhi_init_dev_ctxt()
319 mhi_chan->tre_ring.db_addr = (void __iomem *)&chan_ctxt->wp; in mhi_init_dev_ctxt()
443 struct mhi_chan *mhi_chan; in mhi_init_mmio() local
524 mhi_chan = mhi_cntrl->mhi_chan; in mhi_init_mmio()
525 for (i = 0; i < mhi_cntrl->max_chan; i++, val += 8, mhi_chan++) in mhi_init_mmio()
526 mhi_chan->tre_ring.db_addr = base + val; in mhi_init_mmio()
570 struct mhi_chan *mhi_chan) in mhi_deinit_chan_ctxt() argument
577 buf_ring = &mhi_chan->buf_ring; in mhi_deinit_chan_ctxt()
578 tre_ring = &mhi_chan->tre_ring; in mhi_deinit_chan_ctxt()
579 chan_ctxt = &mhi_cntrl->mhi_ctxt->chan_ctxt[mhi_chan->chan]; in mhi_deinit_chan_ctxt()
605 struct mhi_chan *mhi_chan) in mhi_init_chan_ctxt() argument
613 buf_ring = &mhi_chan->buf_ring; in mhi_init_chan_ctxt()
614 tre_ring = &mhi_chan->tre_ring; in mhi_init_chan_ctxt()
617 chan_ctxt = &mhi_cntrl->mhi_ctxt->chan_ctxt[mhi_chan->chan]; in mhi_init_chan_ctxt()
644 mhi_chan->db_cfg.db_mode = 1; in mhi_init_chan_ctxt()
686 mhi_event->mhi_chan = in parse_ev_cfg()
687 &mhi_cntrl->mhi_chan[mhi_event->chan]; in parse_ev_cfg()
750 mhi_cntrl->mhi_chan = vzalloc(mhi_cntrl->max_chan * in parse_ch_cfg()
751 sizeof(*mhi_cntrl->mhi_chan)); in parse_ch_cfg()
752 if (!mhi_cntrl->mhi_chan) in parse_ch_cfg()
759 struct mhi_chan *mhi_chan; in parse_ch_cfg() local
769 mhi_chan = &mhi_cntrl->mhi_chan[chan]; in parse_ch_cfg()
770 mhi_chan->name = ch_cfg->name; in parse_ch_cfg()
771 mhi_chan->chan = chan; in parse_ch_cfg()
773 mhi_chan->tre_ring.elements = ch_cfg->num_elements; in parse_ch_cfg()
774 if (!mhi_chan->tre_ring.elements) in parse_ch_cfg()
784 mhi_chan->buf_ring.elements = ch_cfg->local_elements; in parse_ch_cfg()
785 if (!mhi_chan->buf_ring.elements) in parse_ch_cfg()
786 mhi_chan->buf_ring.elements = mhi_chan->tre_ring.elements; in parse_ch_cfg()
787 mhi_chan->er_index = ch_cfg->event_ring; in parse_ch_cfg()
788 mhi_chan->dir = ch_cfg->dir; in parse_ch_cfg()
795 mhi_chan->type = ch_cfg->type; in parse_ch_cfg()
796 if (!mhi_chan->type) in parse_ch_cfg()
797 mhi_chan->type = (enum mhi_ch_type)mhi_chan->dir; in parse_ch_cfg()
799 mhi_chan->ee_mask = ch_cfg->ee_mask; in parse_ch_cfg()
800 mhi_chan->db_cfg.pollcfg = ch_cfg->pollcfg; in parse_ch_cfg()
801 mhi_chan->lpm_notify = ch_cfg->lpm_notify; in parse_ch_cfg()
802 mhi_chan->offload_ch = ch_cfg->offload_channel; in parse_ch_cfg()
803 mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch; in parse_ch_cfg()
804 mhi_chan->pre_alloc = ch_cfg->auto_queue; in parse_ch_cfg()
805 mhi_chan->wake_capable = ch_cfg->wake_capable; in parse_ch_cfg()
811 if (mhi_chan->pre_alloc && mhi_chan->dir != DMA_FROM_DEVICE) { in parse_ch_cfg()
820 if ((mhi_chan->dir == DMA_BIDIRECTIONAL || in parse_ch_cfg()
821 mhi_chan->dir == DMA_NONE) && !mhi_chan->offload_ch) { in parse_ch_cfg()
826 if (!mhi_chan->offload_ch) { in parse_ch_cfg()
827 mhi_chan->db_cfg.brstmode = ch_cfg->doorbell; in parse_ch_cfg()
828 if (MHI_INVALID_BRSTMODE(mhi_chan->db_cfg.brstmode)) { in parse_ch_cfg()
834 if (mhi_chan->db_cfg.brstmode == MHI_DB_BRST_ENABLE) in parse_ch_cfg()
835 mhi_chan->db_cfg.process_db = mhi_db_brstmode; in parse_ch_cfg()
837 mhi_chan->db_cfg.process_db = mhi_db_brstmode_disable; in parse_ch_cfg()
839 mhi_chan->configured = true; in parse_ch_cfg()
841 if (mhi_chan->lpm_notify) in parse_ch_cfg()
842 list_add_tail(&mhi_chan->node, &mhi_cntrl->lpm_chans); in parse_ch_cfg()
848 vfree(mhi_cntrl->mhi_chan); in parse_ch_cfg()
885 vfree(mhi_cntrl->mhi_chan); in parse_config()
894 struct mhi_chan *mhi_chan; in mhi_register_controller() local
953 mhi_chan = mhi_cntrl->mhi_chan; in mhi_register_controller()
954 for (i = 0; i < mhi_cntrl->max_chan; i++, mhi_chan++) { in mhi_register_controller()
955 mutex_init(&mhi_chan->mutex); in mhi_register_controller()
956 init_completion(&mhi_chan->completion); in mhi_register_controller()
957 rwlock_init(&mhi_chan->lock); in mhi_register_controller()
960 mhi_event = &mhi_cntrl->mhi_event[mhi_chan->er_index]; in mhi_register_controller()
961 mhi_chan->intmod = mhi_event->intmod; in mhi_register_controller()
1031 vfree(mhi_cntrl->mhi_chan); in mhi_register_controller()
1040 struct mhi_chan *mhi_chan = mhi_cntrl->mhi_chan; in mhi_unregister_controller() local
1051 for (i = 0; i < mhi_cntrl->max_chan; i++, mhi_chan++) { in mhi_unregister_controller()
1052 if (!mhi_chan->mhi_dev) in mhi_unregister_controller()
1055 put_device(&mhi_chan->mhi_dev->dev); in mhi_unregister_controller()
1057 vfree(mhi_cntrl->mhi_chan); in mhi_unregister_controller()
1237 struct mhi_chan *ul_chan = mhi_dev->ul_chan; in mhi_driver_probe()
1238 struct mhi_chan *dl_chan = mhi_dev->dl_chan; in mhi_driver_probe()
1311 struct mhi_chan *mhi_chan; in mhi_driver_remove() local
1324 mhi_chan = dir ? mhi_dev->ul_chan : mhi_dev->dl_chan; in mhi_driver_remove()
1326 if (!mhi_chan) in mhi_driver_remove()
1330 write_lock_irq(&mhi_chan->lock); in mhi_driver_remove()
1331 mhi_chan->ccs = MHI_EV_CC_INVALID; in mhi_driver_remove()
1332 complete_all(&mhi_chan->completion); in mhi_driver_remove()
1333 write_unlock_irq(&mhi_chan->lock); in mhi_driver_remove()
1336 mutex_lock(&mhi_chan->mutex); in mhi_driver_remove()
1337 write_lock_irq(&mhi_chan->lock); in mhi_driver_remove()
1338 ch_state[dir] = mhi_chan->ch_state; in mhi_driver_remove()
1339 mhi_chan->ch_state = MHI_CH_STATE_SUSPENDED; in mhi_driver_remove()
1340 write_unlock_irq(&mhi_chan->lock); in mhi_driver_remove()
1343 if (!mhi_chan->offload_ch) in mhi_driver_remove()
1344 mhi_reset_chan(mhi_cntrl, mhi_chan); in mhi_driver_remove()
1346 mutex_unlock(&mhi_chan->mutex); in mhi_driver_remove()
1353 mhi_chan = dir ? mhi_dev->ul_chan : mhi_dev->dl_chan; in mhi_driver_remove()
1355 if (!mhi_chan) in mhi_driver_remove()
1358 mutex_lock(&mhi_chan->mutex); in mhi_driver_remove()
1362 !mhi_chan->offload_ch) in mhi_driver_remove()
1363 mhi_deinit_chan_ctxt(mhi_cntrl, mhi_chan); in mhi_driver_remove()
1365 mhi_chan->ch_state = MHI_CH_STATE_DISABLED; in mhi_driver_remove()
1367 mutex_unlock(&mhi_chan->mutex); in mhi_driver_remove()