Lines Matching refs:cohc

1260 #define COHC_2_DEV(cohc) (&cohc->chan.dev->device)  argument
1316 static void coh901318_list_print(struct coh901318_chan *cohc, in coh901318_list_print() argument
1323 dev_vdbg(COHC_2_DEV(cohc), "i %d, lli %p, ctrl 0x%x, src %pad" in coh901318_list_print()
1409 cohc_chan_param(struct coh901318_chan *cohc) in cohc_chan_param() argument
1411 return &chan_config[cohc->id].param; in cohc_chan_param()
1415 cohc_chan_conf(struct coh901318_chan *cohc) in cohc_chan_conf() argument
1417 return &chan_config[cohc->id]; in cohc_chan_conf()
1420 static void enable_powersave(struct coh901318_chan *cohc) in enable_powersave() argument
1423 struct powersave *pm = &cohc->base->pm; in enable_powersave()
1427 pm->started_channels &= ~(1ULL << cohc->id); in enable_powersave()
1431 static void disable_powersave(struct coh901318_chan *cohc) in disable_powersave() argument
1434 struct powersave *pm = &cohc->base->pm; in disable_powersave()
1438 pm->started_channels |= (1ULL << cohc->id); in disable_powersave()
1443 static inline int coh901318_set_ctrl(struct coh901318_chan *cohc, u32 control) in coh901318_set_ctrl() argument
1445 int channel = cohc->id; in coh901318_set_ctrl()
1446 void __iomem *virtbase = cohc->base->virtbase; in coh901318_set_ctrl()
1454 static inline int coh901318_set_conf(struct coh901318_chan *cohc, u32 conf) in coh901318_set_conf() argument
1456 int channel = cohc->id; in coh901318_set_conf()
1457 void __iomem *virtbase = cohc->base->virtbase; in coh901318_set_conf()
1466 static int coh901318_start(struct coh901318_chan *cohc) in coh901318_start() argument
1469 int channel = cohc->id; in coh901318_start()
1470 void __iomem *virtbase = cohc->base->virtbase; in coh901318_start()
1472 disable_powersave(cohc); in coh901318_start()
1485 static int coh901318_prep_linked_list(struct coh901318_chan *cohc, in coh901318_prep_linked_list() argument
1488 int channel = cohc->id; in coh901318_prep_linked_list()
1489 void __iomem *virtbase = cohc->base->virtbase; in coh901318_prep_linked_list()
1513 coh901318_desc_get(struct coh901318_chan *cohc) in coh901318_desc_get() argument
1517 if (list_empty(&cohc->free)) { in coh901318_desc_get()
1526 dma_async_tx_descriptor_init(&desc->desc, &cohc->chan); in coh901318_desc_get()
1529 desc = list_first_entry(&cohc->free, in coh901318_desc_get()
1545 coh901318_desc_free(struct coh901318_chan *cohc, struct coh901318_desc *cohd) in coh901318_desc_free() argument
1547 list_add_tail(&cohd->node, &cohc->free); in coh901318_desc_free()
1552 coh901318_desc_submit(struct coh901318_chan *cohc, struct coh901318_desc *desc) in coh901318_desc_submit() argument
1554 list_add_tail(&desc->node, &cohc->active); in coh901318_desc_submit()
1558 coh901318_first_active_get(struct coh901318_chan *cohc) in coh901318_first_active_get() argument
1560 return list_first_entry_or_null(&cohc->active, struct coh901318_desc, in coh901318_first_active_get()
1571 coh901318_desc_queue(struct coh901318_chan *cohc, struct coh901318_desc *desc) in coh901318_desc_queue() argument
1573 list_add_tail(&desc->node, &cohc->queue); in coh901318_desc_queue()
1577 coh901318_first_queued(struct coh901318_chan *cohc) in coh901318_first_queued() argument
1579 return list_first_entry_or_null(&cohc->queue, struct coh901318_desc, in coh901318_first_queued()
1603 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_get_bytes_left() local
1610 spin_lock_irqsave(&cohc->lock, flags); in coh901318_get_bytes_left()
1617 list_for_each(pos, &cohc->active) { in coh901318_get_bytes_left()
1631 left = readl(cohc->base->virtbase + in coh901318_get_bytes_left()
1633 COH901318_CX_CTRL_SPACING * cohc->id) & in coh901318_get_bytes_left()
1637 ladd = readl(cohc->base->virtbase + in coh901318_get_bytes_left()
1640 cohc->id) & in coh901318_get_bytes_left()
1669 list_for_each(pos, &cohc->queue) { in coh901318_get_bytes_left()
1674 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_get_bytes_left()
1687 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_pause() local
1688 int channel = cohc->id; in coh901318_pause()
1689 void __iomem *virtbase = cohc->base->virtbase; in coh901318_pause()
1691 spin_lock_irqsave(&cohc->lock, flags); in coh901318_pause()
1700 cohc->stopped = 1; in coh901318_pause()
1718 cohc->stopped = 1; in coh901318_pause()
1720 enable_powersave(cohc); in coh901318_pause()
1722 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_pause()
1733 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_resume() local
1734 int channel = cohc->id; in coh901318_resume()
1736 spin_lock_irqsave(&cohc->lock, flags); in coh901318_resume()
1738 disable_powersave(cohc); in coh901318_resume()
1740 if (cohc->stopped) { in coh901318_resume()
1742 val = readl(cohc->base->virtbase + COH901318_CX_CFG + in coh901318_resume()
1747 writel(val, cohc->base->virtbase + COH901318_CX_CFG + in coh901318_resume()
1750 cohc->stopped = 0; in coh901318_resume()
1753 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_resume()
1800 static int coh901318_config(struct coh901318_chan *cohc, in coh901318_config() argument
1804 int channel = cohc->id; in coh901318_config()
1805 void __iomem *virtbase = cohc->base->virtbase; in coh901318_config()
1810 p = cohc_chan_param(cohc); in coh901318_config()
1823 coh901318_set_conf(cohc, p->config); in coh901318_config()
1824 coh901318_set_ctrl(cohc, p->ctrl_lli_last); in coh901318_config()
1836 static struct coh901318_desc *coh901318_queue_start(struct coh901318_chan *cohc) in coh901318_queue_start() argument
1844 cohd = coh901318_first_queued(cohc); in coh901318_queue_start()
1850 cohc->busy = 1; in coh901318_queue_start()
1852 coh901318_desc_submit(cohc, cohd); in coh901318_queue_start()
1855 coh901318_set_conf(cohc, cohd->head_config); in coh901318_queue_start()
1856 coh901318_set_ctrl(cohc, cohd->head_ctrl); in coh901318_queue_start()
1857 coh901318_prep_linked_list(cohc, cohd->lli); in coh901318_queue_start()
1860 coh901318_start(cohc); in coh901318_queue_start()
1873 struct coh901318_chan *cohc = from_tasklet(cohc, t, tasklet); in dma_tasklet() local
1878 dev_vdbg(COHC_2_DEV(cohc), "[%s] chan_id %d" in dma_tasklet()
1880 cohc->id, cohc->nbr_active_done); in dma_tasklet()
1882 spin_lock_irqsave(&cohc->lock, flags); in dma_tasklet()
1885 cohd_fin = coh901318_first_active_get(cohc); in dma_tasklet()
1897 coh901318_lli_free(&cohc->base->pool, &cohd_fin->lli); in dma_tasklet()
1901 coh901318_desc_free(cohc, cohd_fin); in dma_tasklet()
1903 spin_unlock_irqrestore(&cohc->lock, flags); in dma_tasklet()
1908 spin_lock_irqsave(&cohc->lock, flags); in dma_tasklet()
1917 cohc->nbr_active_done--; in dma_tasklet()
1918 if (cohc->nbr_active_done) { in dma_tasklet()
1919 dev_dbg(COHC_2_DEV(cohc), "scheduling tasklet again, new IRQs " in dma_tasklet()
1921 if (cohc_chan_conf(cohc)->priority_high) in dma_tasklet()
1922 tasklet_hi_schedule(&cohc->tasklet); in dma_tasklet()
1924 tasklet_schedule(&cohc->tasklet); in dma_tasklet()
1927 spin_unlock_irqrestore(&cohc->lock, flags); in dma_tasklet()
1932 spin_unlock_irqrestore(&cohc->lock, flags); in dma_tasklet()
1933 dev_err(COHC_2_DEV(cohc), "[%s] No active dma desc\n", __func__); in dma_tasklet()
1938 static void dma_tc_handle(struct coh901318_chan *cohc) in dma_tc_handle() argument
1944 if (!cohc->allocated) { in dma_tc_handle()
1945 dev_err(COHC_2_DEV(cohc), "spurious interrupt from " in dma_tc_handle()
1959 BUG_ON(list_empty(&cohc->active)); in dma_tc_handle()
1961 cohc->nbr_active_done++; in dma_tc_handle()
1967 if (coh901318_queue_start(cohc) == NULL) in dma_tc_handle()
1968 cohc->busy = 0; in dma_tc_handle()
1974 if (cohc_chan_conf(cohc)->priority_high) in dma_tc_handle()
1975 tasklet_hi_schedule(&cohc->tasklet); in dma_tc_handle()
1977 tasklet_schedule(&cohc->tasklet); in dma_tc_handle()
1988 struct coh901318_chan *cohc; in dma_irq_handler() local
2008 cohc = &base->chans[ch]; in dma_irq_handler()
2009 spin_lock(&cohc->lock); in dma_irq_handler()
2015 dev_crit(COHC_2_DEV(cohc), in dma_irq_handler()
2024 dev_warn(COHC_2_DEV(cohc), in dma_irq_handler()
2034 enable_powersave(cohc); in dma_irq_handler()
2043 dma_tc_handle(cohc); in dma_irq_handler()
2046 spin_unlock(&cohc->lock); in dma_irq_handler()
2054 cohc = &base->chans[ch]; in dma_irq_handler()
2055 spin_lock(&cohc->lock); in dma_irq_handler()
2061 dev_crit(COHC_2_DEV(cohc), in dma_irq_handler()
2070 dev_warn(COHC_2_DEV(cohc), in dma_irq_handler()
2080 enable_powersave(cohc); in dma_irq_handler()
2088 dma_tc_handle(cohc); in dma_irq_handler()
2091 spin_unlock(&cohc->lock); in dma_irq_handler()
2100 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_terminate_all() local
2102 void __iomem *virtbase = cohc->base->virtbase; in coh901318_terminate_all()
2106 spin_lock_irqsave(&cohc->lock, flags); in coh901318_terminate_all()
2109 if (cohc->id < 32) { in coh901318_terminate_all()
2110 writel(1 << cohc->id, virtbase + COH901318_BE_INT_CLEAR1); in coh901318_terminate_all()
2111 writel(1 << cohc->id, virtbase + COH901318_TC_INT_CLEAR1); in coh901318_terminate_all()
2113 writel(1 << (cohc->id - 32), virtbase + in coh901318_terminate_all()
2115 writel(1 << (cohc->id - 32), virtbase + in coh901318_terminate_all()
2119 enable_powersave(cohc); in coh901318_terminate_all()
2121 while ((cohd = coh901318_first_active_get(cohc))) { in coh901318_terminate_all()
2123 coh901318_lli_free(&cohc->base->pool, &cohd->lli); in coh901318_terminate_all()
2127 coh901318_desc_free(cohc, cohd); in coh901318_terminate_all()
2130 while ((cohd = coh901318_first_queued(cohc))) { in coh901318_terminate_all()
2132 coh901318_lli_free(&cohc->base->pool, &cohd->lli); in coh901318_terminate_all()
2136 coh901318_desc_free(cohc, cohd); in coh901318_terminate_all()
2140 cohc->nbr_active_done = 0; in coh901318_terminate_all()
2141 cohc->busy = 0; in coh901318_terminate_all()
2143 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_terminate_all()
2150 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_alloc_chan_resources() local
2153 dev_vdbg(COHC_2_DEV(cohc), "[%s] DMA channel %d\n", in coh901318_alloc_chan_resources()
2154 __func__, cohc->id); in coh901318_alloc_chan_resources()
2159 spin_lock_irqsave(&cohc->lock, flags); in coh901318_alloc_chan_resources()
2161 coh901318_config(cohc, NULL); in coh901318_alloc_chan_resources()
2163 cohc->allocated = 1; in coh901318_alloc_chan_resources()
2166 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_alloc_chan_resources()
2174 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_free_chan_resources() local
2175 int channel = cohc->id; in coh901318_free_chan_resources()
2178 spin_lock_irqsave(&cohc->lock, flags); in coh901318_free_chan_resources()
2181 writel(0x00000000U, cohc->base->virtbase + COH901318_CX_CFG + in coh901318_free_chan_resources()
2183 writel(0x00000000U, cohc->base->virtbase + COH901318_CX_CTRL + in coh901318_free_chan_resources()
2186 cohc->allocated = 0; in coh901318_free_chan_resources()
2188 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_free_chan_resources()
2199 struct coh901318_chan *cohc = to_coh901318_chan(tx->chan); in coh901318_tx_submit() local
2203 spin_lock_irqsave(&cohc->lock, flags); in coh901318_tx_submit()
2206 coh901318_desc_queue(cohc, cohd); in coh901318_tx_submit()
2208 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_tx_submit()
2220 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_prep_memcpy() local
2222 u32 ctrl_last = cohc_chan_param(cohc)->ctrl_lli_last; in coh901318_prep_memcpy()
2225 spin_lock_irqsave(&cohc->lock, flg); in coh901318_prep_memcpy()
2227 dev_vdbg(COHC_2_DEV(cohc), in coh901318_prep_memcpy()
2229 __func__, cohc->id, &src, &dest, size); in coh901318_prep_memcpy()
2239 lli = coh901318_lli_alloc(&cohc->base->pool, lli_len); in coh901318_prep_memcpy()
2245 &cohc->base->pool, lli, src, size, dest, in coh901318_prep_memcpy()
2246 cohc_chan_param(cohc)->ctrl_lli_chained, in coh901318_prep_memcpy()
2251 COH_DBG(coh901318_list_print(cohc, lli)); in coh901318_prep_memcpy()
2254 cohd = coh901318_desc_get(cohc); in coh901318_prep_memcpy()
2259 spin_unlock_irqrestore(&cohc->lock, flg); in coh901318_prep_memcpy()
2263 spin_unlock_irqrestore(&cohc->lock, flg); in coh901318_prep_memcpy()
2272 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_prep_slave_sg() local
2280 u32 ctrl_chained = cohc_chan_param(cohc)->ctrl_lli_chained; in coh901318_prep_slave_sg()
2281 u32 ctrl = cohc_chan_param(cohc)->ctrl_lli; in coh901318_prep_slave_sg()
2282 u32 ctrl_last = cohc_chan_param(cohc)->ctrl_lli_last; in coh901318_prep_slave_sg()
2292 spin_lock_irqsave(&cohc->lock, flg); in coh901318_prep_slave_sg()
2294 dev_vdbg(COHC_2_DEV(cohc), "[%s] sg_len %d dir %d\n", in coh901318_prep_slave_sg()
2301 params = cohc_chan_param(cohc); in coh901318_prep_slave_sg()
2308 ctrl_chained |= cohc->ctrl; in coh901318_prep_slave_sg()
2309 ctrl_last |= cohc->ctrl; in coh901318_prep_slave_sg()
2310 ctrl |= cohc->ctrl; in coh901318_prep_slave_sg()
2352 lli = coh901318_lli_alloc(&cohc->base->pool, len); in coh901318_prep_slave_sg()
2357 coh901318_dma_set_runtimeconfig(chan, &cohc->config, direction); in coh901318_prep_slave_sg()
2360 ret = coh901318_lli_fill_sg(&cohc->base->pool, lli, sgl, sg_len, in coh901318_prep_slave_sg()
2361 cohc->addr, in coh901318_prep_slave_sg()
2370 COH_DBG(coh901318_list_print(cohc, lli)); in coh901318_prep_slave_sg()
2373 cohd = coh901318_desc_get(cohc); in coh901318_prep_slave_sg()
2386 spin_unlock_irqrestore(&cohc->lock, flg); in coh901318_prep_slave_sg()
2392 spin_unlock_irqrestore(&cohc->lock, flg); in coh901318_prep_slave_sg()
2401 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_tx_status() local
2410 if (ret == DMA_IN_PROGRESS && cohc->stopped) in coh901318_tx_status()
2419 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_issue_pending() local
2422 spin_lock_irqsave(&cohc->lock, flags); in coh901318_issue_pending()
2430 if (!cohc->busy) in coh901318_issue_pending()
2431 coh901318_queue_start(cohc); in coh901318_issue_pending()
2433 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_issue_pending()
2501 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_dma_set_runtimeconfig() local
2518 dev_err(COHC_2_DEV(cohc), "illegal channel mode\n"); in coh901318_dma_set_runtimeconfig()
2522 dev_dbg(COHC_2_DEV(cohc), "configure channel for %d byte transfers\n", in coh901318_dma_set_runtimeconfig()
2563 dev_err(COHC_2_DEV(cohc), in coh901318_dma_set_runtimeconfig()
2569 dev_dbg(COHC_2_DEV(cohc), in coh901318_dma_set_runtimeconfig()
2573 cohc->addr = addr; in coh901318_dma_set_runtimeconfig()
2574 cohc->ctrl = ctrl; in coh901318_dma_set_runtimeconfig()
2582 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_dma_slave_config() local
2584 memcpy(&cohc->config, config, sizeof(*config)); in coh901318_dma_slave_config()
2594 struct coh901318_chan *cohc; in coh901318_base_init() local
2600 cohc = &base->chans[i]; in coh901318_base_init()
2602 cohc->base = base; in coh901318_base_init()
2603 cohc->chan.device = dma; in coh901318_base_init()
2604 cohc->id = i; in coh901318_base_init()
2610 spin_lock_init(&cohc->lock); in coh901318_base_init()
2612 cohc->nbr_active_done = 0; in coh901318_base_init()
2613 cohc->busy = 0; in coh901318_base_init()
2614 INIT_LIST_HEAD(&cohc->free); in coh901318_base_init()
2615 INIT_LIST_HEAD(&cohc->active); in coh901318_base_init()
2616 INIT_LIST_HEAD(&cohc->queue); in coh901318_base_init()
2618 tasklet_setup(&cohc->tasklet, dma_tasklet); in coh901318_base_init()
2620 list_add_tail(&cohc->chan.device_node, in coh901318_base_init()
2754 struct coh901318_chan *cohc; in coh901318_base_remove() local
2758 cohc = &base->chans[i]; in coh901318_base_remove()
2760 tasklet_kill(&cohc->tasklet); in coh901318_base_remove()