Lines Matching refs:plchan
333 static int pl08x_request_mux(struct pl08x_dma_chan *plchan) in pl08x_request_mux() argument
335 const struct pl08x_platform_data *pd = plchan->host->pd; in pl08x_request_mux()
338 if (plchan->mux_use++ == 0 && pd->get_xfer_signal) { in pl08x_request_mux()
339 ret = pd->get_xfer_signal(plchan->cd); in pl08x_request_mux()
341 plchan->mux_use = 0; in pl08x_request_mux()
345 plchan->signal = ret; in pl08x_request_mux()
350 static void pl08x_release_mux(struct pl08x_dma_chan *plchan) in pl08x_release_mux() argument
352 const struct pl08x_platform_data *pd = plchan->host->pd; in pl08x_release_mux()
354 if (plchan->signal >= 0) { in pl08x_release_mux()
355 WARN_ON(plchan->mux_use == 0); in pl08x_release_mux()
357 if (--plchan->mux_use == 0 && pd->put_xfer_signal) { in pl08x_release_mux()
358 pd->put_xfer_signal(plchan->cd, plchan->signal); in pl08x_release_mux()
359 plchan->signal = -1; in pl08x_release_mux()
527 static void pl08x_start_next_txd(struct pl08x_dma_chan *plchan) in pl08x_start_next_txd() argument
529 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_start_next_txd()
530 struct pl08x_phy_chan *phychan = plchan->phychan; in pl08x_start_next_txd()
531 struct virt_dma_desc *vd = vchan_next_desc(&plchan->vc); in pl08x_start_next_txd()
537 plchan->at = txd; in pl08x_start_next_txd()
753 static u32 pl08x_getbytes_chan(struct pl08x_dma_chan *plchan) in pl08x_getbytes_chan() argument
755 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_getbytes_chan()
764 ch = plchan->phychan; in pl08x_getbytes_chan()
765 txd = plchan->at; in pl08x_getbytes_chan()
859 static void pl08x_phy_alloc_and_start(struct pl08x_dma_chan *plchan) in pl08x_phy_alloc_and_start() argument
861 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_phy_alloc_and_start()
864 ch = pl08x_get_phy_channel(pl08x, plchan); in pl08x_phy_alloc_and_start()
866 dev_dbg(&pl08x->adev->dev, "no physical channel available for xfer on %s\n", plchan->name); in pl08x_phy_alloc_and_start()
867 plchan->state = PL08X_CHAN_WAITING; in pl08x_phy_alloc_and_start()
868 plchan->waiting_at = jiffies; in pl08x_phy_alloc_and_start()
873 ch->id, plchan->name); in pl08x_phy_alloc_and_start()
875 plchan->phychan = ch; in pl08x_phy_alloc_and_start()
876 plchan->state = PL08X_CHAN_RUNNING; in pl08x_phy_alloc_and_start()
877 pl08x_start_next_txd(plchan); in pl08x_phy_alloc_and_start()
881 struct pl08x_dma_chan *plchan) in pl08x_phy_reassign_start() argument
883 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_phy_reassign_start()
886 ch->id, plchan->name); in pl08x_phy_reassign_start()
893 ch->serving = plchan; in pl08x_phy_reassign_start()
894 plchan->phychan = ch; in pl08x_phy_reassign_start()
895 plchan->state = PL08X_CHAN_RUNNING; in pl08x_phy_reassign_start()
896 pl08x_start_next_txd(plchan); in pl08x_phy_reassign_start()
903 static void pl08x_phy_free(struct pl08x_dma_chan *plchan) in pl08x_phy_free() argument
905 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_phy_free()
934 pl08x_terminate_phy_chan(pl08x, plchan->phychan); in pl08x_phy_free()
947 pl08x_phy_reassign_start(plchan->phychan, next); in pl08x_phy_free()
955 pl08x_put_phy_channel(pl08x, plchan->phychan); in pl08x_phy_free()
958 plchan->phychan = NULL; in pl08x_phy_free()
959 plchan->state = PL08X_CHAN_IDLE; in pl08x_phy_free()
1511 struct pl08x_dma_chan *plchan = to_pl08x_chan(vd->tx.chan); in pl08x_desc_free() local
1515 pl08x_release_mux(plchan); in pl08x_desc_free()
1517 pl08x_free_txd(plchan->host, txd); in pl08x_desc_free()
1521 struct pl08x_dma_chan *plchan) in pl08x_free_txd_list() argument
1525 vchan_get_all_descriptors(&plchan->vc, &head); in pl08x_free_txd_list()
1526 vchan_dma_desc_free_list(&plchan->vc, &head); in pl08x_free_txd_list()
1554 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_dma_tx_status() local
1569 if (plchan->state == PL08X_CHAN_PAUSED) in pl08x_dma_tx_status()
1574 spin_lock_irqsave(&plchan->vc.lock, flags); in pl08x_dma_tx_status()
1577 vd = vchan_find_desc(&plchan->vc, cookie); in pl08x_dma_tx_status()
1586 bytes = pl08x_getbytes_chan(plchan); in pl08x_dma_tx_status()
1589 spin_unlock_irqrestore(&plchan->vc.lock, flags); in pl08x_dma_tx_status()
1597 if (plchan->state == PL08X_CHAN_PAUSED && ret == DMA_IN_PROGRESS) in pl08x_dma_tx_status()
1708 static u32 pl08x_get_cctl(struct pl08x_dma_chan *plchan, in pl08x_get_cctl() argument
1725 if (plchan->cd->single) in pl08x_get_cctl()
1741 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_issue_pending() local
1744 spin_lock_irqsave(&plchan->vc.lock, flags); in pl08x_issue_pending()
1745 if (vchan_issue_pending(&plchan->vc)) { in pl08x_issue_pending()
1746 if (!plchan->phychan && plchan->state != PL08X_CHAN_WAITING) in pl08x_issue_pending()
1747 pl08x_phy_alloc_and_start(plchan); in pl08x_issue_pending()
1749 spin_unlock_irqrestore(&plchan->vc.lock, flags); in pl08x_issue_pending()
1752 static struct pl08x_txd *pl08x_get_txd(struct pl08x_dma_chan *plchan) in pl08x_get_txd() argument
1893 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_prep_dma_memcpy() local
1894 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_prep_dma_memcpy()
1899 txd = pl08x_get_txd(plchan); in pl08x_prep_dma_memcpy()
1927 ret = pl08x_fill_llis_for_desc(plchan->host, txd); in pl08x_prep_dma_memcpy()
1933 return vchan_tx_prep(&plchan->vc, &txd->vd, flags); in pl08x_prep_dma_memcpy()
1941 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_init_txd() local
1942 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_init_txd()
1949 txd = pl08x_get_txd(plchan); in pl08x_init_txd()
1962 *slave_addr = plchan->cfg.dst_addr; in pl08x_init_txd()
1963 addr_width = plchan->cfg.dst_addr_width; in pl08x_init_txd()
1964 maxburst = plchan->cfg.dst_maxburst; in pl08x_init_txd()
1966 dst_buses = plchan->cd->periph_buses; in pl08x_init_txd()
1969 *slave_addr = plchan->cfg.src_addr; in pl08x_init_txd()
1970 addr_width = plchan->cfg.src_addr_width; in pl08x_init_txd()
1971 maxburst = plchan->cfg.src_maxburst; in pl08x_init_txd()
1972 src_buses = plchan->cd->periph_buses; in pl08x_init_txd()
1981 cctl |= pl08x_get_cctl(plchan, addr_width, maxburst); in pl08x_init_txd()
1991 if (plchan->cfg.device_fc) in pl08x_init_txd()
2002 ret = pl08x_request_mux(plchan); in pl08x_init_txd()
2007 plchan->name); in pl08x_init_txd()
2012 plchan->signal, plchan->name); in pl08x_init_txd()
2016 txd->ccfg |= plchan->signal << PL080_CONFIG_DST_SEL_SHIFT; in pl08x_init_txd()
2018 txd->ccfg |= plchan->signal << PL080_CONFIG_SRC_SEL_SHIFT; in pl08x_init_txd()
2054 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_prep_slave_sg() local
2055 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_prep_slave_sg()
2062 __func__, sg_dma_len(sgl), plchan->name); in pl08x_prep_slave_sg()
2073 pl08x_release_mux(plchan); in pl08x_prep_slave_sg()
2081 ret = pl08x_fill_llis_for_desc(plchan->host, txd); in pl08x_prep_slave_sg()
2083 pl08x_release_mux(plchan); in pl08x_prep_slave_sg()
2088 return vchan_tx_prep(&plchan->vc, &txd->vd, flags); in pl08x_prep_slave_sg()
2096 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_prep_dma_cyclic() local
2097 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_prep_dma_cyclic()
2106 plchan->name); in pl08x_prep_dma_cyclic()
2118 pl08x_release_mux(plchan); in pl08x_prep_dma_cyclic()
2124 ret = pl08x_fill_llis_for_desc(plchan->host, txd); in pl08x_prep_dma_cyclic()
2126 pl08x_release_mux(plchan); in pl08x_prep_dma_cyclic()
2131 return vchan_tx_prep(&plchan->vc, &txd->vd, flags); in pl08x_prep_dma_cyclic()
2137 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_config() local
2138 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_config()
2140 if (!plchan->slave) in pl08x_config()
2155 plchan->cfg = *config; in pl08x_config()
2162 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_terminate_all() local
2163 struct pl08x_driver_data *pl08x = plchan->host; in pl08x_terminate_all()
2166 spin_lock_irqsave(&plchan->vc.lock, flags); in pl08x_terminate_all()
2167 if (!plchan->phychan && !plchan->at) { in pl08x_terminate_all()
2168 spin_unlock_irqrestore(&plchan->vc.lock, flags); in pl08x_terminate_all()
2172 plchan->state = PL08X_CHAN_IDLE; in pl08x_terminate_all()
2174 if (plchan->phychan) { in pl08x_terminate_all()
2179 pl08x_phy_free(plchan); in pl08x_terminate_all()
2182 if (plchan->at) { in pl08x_terminate_all()
2183 vchan_terminate_vdesc(&plchan->at->vd); in pl08x_terminate_all()
2184 plchan->at = NULL; in pl08x_terminate_all()
2187 pl08x_free_txd_list(pl08x, plchan); in pl08x_terminate_all()
2189 spin_unlock_irqrestore(&plchan->vc.lock, flags); in pl08x_terminate_all()
2196 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_synchronize() local
2198 vchan_synchronize(&plchan->vc); in pl08x_synchronize()
2203 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_pause() local
2210 spin_lock_irqsave(&plchan->vc.lock, flags); in pl08x_pause()
2211 if (!plchan->phychan && !plchan->at) { in pl08x_pause()
2212 spin_unlock_irqrestore(&plchan->vc.lock, flags); in pl08x_pause()
2216 pl08x_pause_phy_chan(plchan->phychan); in pl08x_pause()
2217 plchan->state = PL08X_CHAN_PAUSED; in pl08x_pause()
2219 spin_unlock_irqrestore(&plchan->vc.lock, flags); in pl08x_pause()
2226 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_resume() local
2233 spin_lock_irqsave(&plchan->vc.lock, flags); in pl08x_resume()
2234 if (!plchan->phychan && !plchan->at) { in pl08x_resume()
2235 spin_unlock_irqrestore(&plchan->vc.lock, flags); in pl08x_resume()
2239 pl08x_resume_phy_chan(plchan->phychan); in pl08x_resume()
2240 plchan->state = PL08X_CHAN_RUNNING; in pl08x_resume()
2242 spin_unlock_irqrestore(&plchan->vc.lock, flags); in pl08x_resume()
2249 struct pl08x_dma_chan *plchan; in pl08x_filter_id() local
2256 plchan = to_pl08x_chan(chan); in pl08x_filter_id()
2259 if (!strcmp(plchan->name, name)) in pl08x_filter_id()
2268 struct pl08x_dma_chan *plchan = to_pl08x_chan(chan); in pl08x_filter_fn() local
2270 return plchan->cd == chan_id; in pl08x_filter_fn()
2315 struct pl08x_dma_chan *plchan = phychan->serving; in pl08x_irq() local
2318 if (!plchan) { in pl08x_irq()
2325 spin_lock(&plchan->vc.lock); in pl08x_irq()
2326 tx = plchan->at; in pl08x_irq()
2330 plchan->at = NULL; in pl08x_irq()
2335 pl08x_release_mux(plchan); in pl08x_irq()
2343 if (vchan_next_desc(&plchan->vc)) in pl08x_irq()
2344 pl08x_start_next_txd(plchan); in pl08x_irq()
2346 pl08x_phy_free(plchan); in pl08x_irq()
2348 spin_unlock(&plchan->vc.lock); in pl08x_irq()
2544 struct pl08x_dma_chan *plchan; in pl08x_of_xlate() local
2562 plchan = to_pl08x_chan(dma_chan); in pl08x_of_xlate()
2568 plchan->cd->periph_buses = dma_spec->args[1]; in pl08x_of_xlate()