Lines Matching refs:cohc
1260 #define COHC_2_DEV(cohc) (&cohc->chan.dev->device) argument
1314 static void coh901318_list_print(struct coh901318_chan *cohc, in coh901318_list_print() argument
1321 dev_vdbg(COHC_2_DEV(cohc), "i %d, lli %p, ctrl 0x%x, src 0x%x" in coh901318_list_print()
1405 cohc_chan_param(struct coh901318_chan *cohc) in cohc_chan_param() argument
1407 return &chan_config[cohc->id].param; in cohc_chan_param()
1411 cohc_chan_conf(struct coh901318_chan *cohc) in cohc_chan_conf() argument
1413 return &chan_config[cohc->id]; in cohc_chan_conf()
1416 static void enable_powersave(struct coh901318_chan *cohc) in enable_powersave() argument
1419 struct powersave *pm = &cohc->base->pm; in enable_powersave()
1423 pm->started_channels &= ~(1ULL << cohc->id); in enable_powersave()
1427 static void disable_powersave(struct coh901318_chan *cohc) in disable_powersave() argument
1430 struct powersave *pm = &cohc->base->pm; in disable_powersave()
1434 pm->started_channels |= (1ULL << cohc->id); in disable_powersave()
1439 static inline int coh901318_set_ctrl(struct coh901318_chan *cohc, u32 control) in coh901318_set_ctrl() argument
1441 int channel = cohc->id; in coh901318_set_ctrl()
1442 void __iomem *virtbase = cohc->base->virtbase; in coh901318_set_ctrl()
1450 static inline int coh901318_set_conf(struct coh901318_chan *cohc, u32 conf) in coh901318_set_conf() argument
1452 int channel = cohc->id; in coh901318_set_conf()
1453 void __iomem *virtbase = cohc->base->virtbase; in coh901318_set_conf()
1462 static int coh901318_start(struct coh901318_chan *cohc) in coh901318_start() argument
1465 int channel = cohc->id; in coh901318_start()
1466 void __iomem *virtbase = cohc->base->virtbase; in coh901318_start()
1468 disable_powersave(cohc); in coh901318_start()
1481 static int coh901318_prep_linked_list(struct coh901318_chan *cohc, in coh901318_prep_linked_list() argument
1484 int channel = cohc->id; in coh901318_prep_linked_list()
1485 void __iomem *virtbase = cohc->base->virtbase; in coh901318_prep_linked_list()
1509 coh901318_desc_get(struct coh901318_chan *cohc) in coh901318_desc_get() argument
1513 if (list_empty(&cohc->free)) { in coh901318_desc_get()
1522 dma_async_tx_descriptor_init(&desc->desc, &cohc->chan); in coh901318_desc_get()
1525 desc = list_first_entry(&cohc->free, in coh901318_desc_get()
1541 coh901318_desc_free(struct coh901318_chan *cohc, struct coh901318_desc *cohd) in coh901318_desc_free() argument
1543 list_add_tail(&cohd->node, &cohc->free); in coh901318_desc_free()
1548 coh901318_desc_submit(struct coh901318_chan *cohc, struct coh901318_desc *desc) in coh901318_desc_submit() argument
1550 list_add_tail(&desc->node, &cohc->active); in coh901318_desc_submit()
1554 coh901318_first_active_get(struct coh901318_chan *cohc) in coh901318_first_active_get() argument
1558 if (list_empty(&cohc->active)) in coh901318_first_active_get()
1561 d = list_first_entry(&cohc->active, in coh901318_first_active_get()
1574 coh901318_desc_queue(struct coh901318_chan *cohc, struct coh901318_desc *desc) in coh901318_desc_queue() argument
1576 list_add_tail(&desc->node, &cohc->queue); in coh901318_desc_queue()
1580 coh901318_first_queued(struct coh901318_chan *cohc) in coh901318_first_queued() argument
1584 if (list_empty(&cohc->queue)) in coh901318_first_queued()
1587 d = list_first_entry(&cohc->queue, in coh901318_first_queued()
1613 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_get_bytes_left() local
1620 spin_lock_irqsave(&cohc->lock, flags); in coh901318_get_bytes_left()
1627 list_for_each(pos, &cohc->active) { in coh901318_get_bytes_left()
1641 left = readl(cohc->base->virtbase + in coh901318_get_bytes_left()
1643 COH901318_CX_CTRL_SPACING * cohc->id) & in coh901318_get_bytes_left()
1647 ladd = readl(cohc->base->virtbase + in coh901318_get_bytes_left()
1650 cohc->id) & in coh901318_get_bytes_left()
1679 list_for_each(pos, &cohc->queue) { in coh901318_get_bytes_left()
1684 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_get_bytes_left()
1697 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_pause() local
1698 int channel = cohc->id; in coh901318_pause()
1699 void __iomem *virtbase = cohc->base->virtbase; in coh901318_pause()
1701 spin_lock_irqsave(&cohc->lock, flags); in coh901318_pause()
1710 cohc->stopped = 1; in coh901318_pause()
1728 cohc->stopped = 1; in coh901318_pause()
1730 enable_powersave(cohc); in coh901318_pause()
1732 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_pause()
1743 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_resume() local
1744 int channel = cohc->id; in coh901318_resume()
1746 spin_lock_irqsave(&cohc->lock, flags); in coh901318_resume()
1748 disable_powersave(cohc); in coh901318_resume()
1750 if (cohc->stopped) { in coh901318_resume()
1752 val = readl(cohc->base->virtbase + COH901318_CX_CFG + in coh901318_resume()
1757 writel(val, cohc->base->virtbase + COH901318_CX_CFG + in coh901318_resume()
1760 cohc->stopped = 0; in coh901318_resume()
1763 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_resume()
1810 static int coh901318_config(struct coh901318_chan *cohc, in coh901318_config() argument
1815 int channel = cohc->id; in coh901318_config()
1816 void __iomem *virtbase = cohc->base->virtbase; in coh901318_config()
1818 spin_lock_irqsave(&cohc->lock, flags); in coh901318_config()
1823 p = cohc_chan_param(cohc); in coh901318_config()
1836 coh901318_set_conf(cohc, p->config); in coh901318_config()
1837 coh901318_set_ctrl(cohc, p->ctrl_lli_last); in coh901318_config()
1839 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_config()
1851 static struct coh901318_desc *coh901318_queue_start(struct coh901318_chan *cohc) in coh901318_queue_start() argument
1859 cohd = coh901318_first_queued(cohc); in coh901318_queue_start()
1865 cohc->busy = 1; in coh901318_queue_start()
1867 coh901318_desc_submit(cohc, cohd); in coh901318_queue_start()
1870 coh901318_set_conf(cohc, cohd->head_config); in coh901318_queue_start()
1871 coh901318_set_ctrl(cohc, cohd->head_ctrl); in coh901318_queue_start()
1872 coh901318_prep_linked_list(cohc, cohd->lli); in coh901318_queue_start()
1875 coh901318_start(cohc); in coh901318_queue_start()
1888 struct coh901318_chan *cohc = (struct coh901318_chan *) data; in dma_tasklet() local
1894 dev_vdbg(COHC_2_DEV(cohc), "[%s] chan_id %d" in dma_tasklet()
1896 cohc->id, cohc->nbr_active_done); in dma_tasklet()
1898 spin_lock_irqsave(&cohc->lock, flags); in dma_tasklet()
1901 cohd_fin = coh901318_first_active_get(cohc); in dma_tasklet()
1914 coh901318_lli_free(&cohc->base->pool, &cohd_fin->lli); in dma_tasklet()
1918 coh901318_desc_free(cohc, cohd_fin); in dma_tasklet()
1920 spin_unlock_irqrestore(&cohc->lock, flags); in dma_tasklet()
1926 spin_lock_irqsave(&cohc->lock, flags); in dma_tasklet()
1935 cohc->nbr_active_done--; in dma_tasklet()
1936 if (cohc->nbr_active_done) { in dma_tasklet()
1937 dev_dbg(COHC_2_DEV(cohc), "scheduling tasklet again, new IRQs " in dma_tasklet()
1939 if (cohc_chan_conf(cohc)->priority_high) in dma_tasklet()
1940 tasklet_hi_schedule(&cohc->tasklet); in dma_tasklet()
1942 tasklet_schedule(&cohc->tasklet); in dma_tasklet()
1945 spin_unlock_irqrestore(&cohc->lock, flags); in dma_tasklet()
1950 spin_unlock_irqrestore(&cohc->lock, flags); in dma_tasklet()
1951 dev_err(COHC_2_DEV(cohc), "[%s] No active dma desc\n", __func__); in dma_tasklet()
1956 static void dma_tc_handle(struct coh901318_chan *cohc) in dma_tc_handle() argument
1962 if (!cohc->allocated) { in dma_tc_handle()
1963 dev_err(COHC_2_DEV(cohc), "spurious interrupt from " in dma_tc_handle()
1968 spin_lock(&cohc->lock); in dma_tc_handle()
1979 BUG_ON(list_empty(&cohc->active)); in dma_tc_handle()
1981 cohc->nbr_active_done++; in dma_tc_handle()
1987 if (coh901318_queue_start(cohc) == NULL) in dma_tc_handle()
1988 cohc->busy = 0; in dma_tc_handle()
1990 spin_unlock(&cohc->lock); in dma_tc_handle()
1996 if (cohc_chan_conf(cohc)->priority_high) in dma_tc_handle()
1997 tasklet_hi_schedule(&cohc->tasklet); in dma_tc_handle()
1999 tasklet_schedule(&cohc->tasklet); in dma_tc_handle()
2010 struct coh901318_chan *cohc; in dma_irq_handler() local
2030 cohc = &base->chans[ch]; in dma_irq_handler()
2031 spin_lock(&cohc->lock); in dma_irq_handler()
2037 dev_crit(COHC_2_DEV(cohc), in dma_irq_handler()
2046 dev_warn(COHC_2_DEV(cohc), in dma_irq_handler()
2056 enable_powersave(cohc); in dma_irq_handler()
2065 dma_tc_handle(cohc); in dma_irq_handler()
2068 spin_unlock(&cohc->lock); in dma_irq_handler()
2076 cohc = &base->chans[ch]; in dma_irq_handler()
2077 spin_lock(&cohc->lock); in dma_irq_handler()
2083 dev_crit(COHC_2_DEV(cohc), in dma_irq_handler()
2092 dev_warn(COHC_2_DEV(cohc), in dma_irq_handler()
2102 enable_powersave(cohc); in dma_irq_handler()
2110 dma_tc_handle(cohc); in dma_irq_handler()
2113 spin_unlock(&cohc->lock); in dma_irq_handler()
2122 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_terminate_all() local
2124 void __iomem *virtbase = cohc->base->virtbase; in coh901318_terminate_all()
2128 spin_lock_irqsave(&cohc->lock, flags); in coh901318_terminate_all()
2131 if (cohc->id < 32) { in coh901318_terminate_all()
2132 writel(1 << cohc->id, virtbase + COH901318_BE_INT_CLEAR1); in coh901318_terminate_all()
2133 writel(1 << cohc->id, virtbase + COH901318_TC_INT_CLEAR1); in coh901318_terminate_all()
2135 writel(1 << (cohc->id - 32), virtbase + in coh901318_terminate_all()
2137 writel(1 << (cohc->id - 32), virtbase + in coh901318_terminate_all()
2141 enable_powersave(cohc); in coh901318_terminate_all()
2143 while ((cohd = coh901318_first_active_get(cohc))) { in coh901318_terminate_all()
2145 coh901318_lli_free(&cohc->base->pool, &cohd->lli); in coh901318_terminate_all()
2149 coh901318_desc_free(cohc, cohd); in coh901318_terminate_all()
2152 while ((cohd = coh901318_first_queued(cohc))) { in coh901318_terminate_all()
2154 coh901318_lli_free(&cohc->base->pool, &cohd->lli); in coh901318_terminate_all()
2158 coh901318_desc_free(cohc, cohd); in coh901318_terminate_all()
2162 cohc->nbr_active_done = 0; in coh901318_terminate_all()
2163 cohc->busy = 0; in coh901318_terminate_all()
2165 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_terminate_all()
2172 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_alloc_chan_resources() local
2175 dev_vdbg(COHC_2_DEV(cohc), "[%s] DMA channel %d\n", in coh901318_alloc_chan_resources()
2176 __func__, cohc->id); in coh901318_alloc_chan_resources()
2181 spin_lock_irqsave(&cohc->lock, flags); in coh901318_alloc_chan_resources()
2183 coh901318_config(cohc, NULL); in coh901318_alloc_chan_resources()
2185 cohc->allocated = 1; in coh901318_alloc_chan_resources()
2188 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_alloc_chan_resources()
2196 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_free_chan_resources() local
2197 int channel = cohc->id; in coh901318_free_chan_resources()
2200 spin_lock_irqsave(&cohc->lock, flags); in coh901318_free_chan_resources()
2203 writel(0x00000000U, cohc->base->virtbase + COH901318_CX_CFG + in coh901318_free_chan_resources()
2205 writel(0x00000000U, cohc->base->virtbase + COH901318_CX_CTRL + in coh901318_free_chan_resources()
2208 cohc->allocated = 0; in coh901318_free_chan_resources()
2210 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_free_chan_resources()
2221 struct coh901318_chan *cohc = to_coh901318_chan(tx->chan); in coh901318_tx_submit() local
2225 spin_lock_irqsave(&cohc->lock, flags); in coh901318_tx_submit()
2228 coh901318_desc_queue(cohc, cohd); in coh901318_tx_submit()
2230 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_tx_submit()
2242 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_prep_memcpy() local
2244 u32 ctrl_last = cohc_chan_param(cohc)->ctrl_lli_last; in coh901318_prep_memcpy()
2247 spin_lock_irqsave(&cohc->lock, flg); in coh901318_prep_memcpy()
2249 dev_vdbg(COHC_2_DEV(cohc), in coh901318_prep_memcpy()
2251 __func__, cohc->id, src, dest, size); in coh901318_prep_memcpy()
2261 lli = coh901318_lli_alloc(&cohc->base->pool, lli_len); in coh901318_prep_memcpy()
2267 &cohc->base->pool, lli, src, size, dest, in coh901318_prep_memcpy()
2268 cohc_chan_param(cohc)->ctrl_lli_chained, in coh901318_prep_memcpy()
2273 COH_DBG(coh901318_list_print(cohc, lli)); in coh901318_prep_memcpy()
2276 cohd = coh901318_desc_get(cohc); in coh901318_prep_memcpy()
2281 spin_unlock_irqrestore(&cohc->lock, flg); in coh901318_prep_memcpy()
2285 spin_unlock_irqrestore(&cohc->lock, flg); in coh901318_prep_memcpy()
2294 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_prep_slave_sg() local
2302 u32 ctrl_chained = cohc_chan_param(cohc)->ctrl_lli_chained; in coh901318_prep_slave_sg()
2303 u32 ctrl = cohc_chan_param(cohc)->ctrl_lli; in coh901318_prep_slave_sg()
2304 u32 ctrl_last = cohc_chan_param(cohc)->ctrl_lli_last; in coh901318_prep_slave_sg()
2314 spin_lock_irqsave(&cohc->lock, flg); in coh901318_prep_slave_sg()
2316 dev_vdbg(COHC_2_DEV(cohc), "[%s] sg_len %d dir %d\n", in coh901318_prep_slave_sg()
2323 params = cohc_chan_param(cohc); in coh901318_prep_slave_sg()
2330 ctrl_chained |= cohc->ctrl; in coh901318_prep_slave_sg()
2331 ctrl_last |= cohc->ctrl; in coh901318_prep_slave_sg()
2332 ctrl |= cohc->ctrl; in coh901318_prep_slave_sg()
2374 lli = coh901318_lli_alloc(&cohc->base->pool, len); in coh901318_prep_slave_sg()
2380 ret = coh901318_lli_fill_sg(&cohc->base->pool, lli, sgl, sg_len, in coh901318_prep_slave_sg()
2381 cohc->addr, in coh901318_prep_slave_sg()
2390 COH_DBG(coh901318_list_print(cohc, lli)); in coh901318_prep_slave_sg()
2393 cohd = coh901318_desc_get(cohc); in coh901318_prep_slave_sg()
2406 spin_unlock_irqrestore(&cohc->lock, flg); in coh901318_prep_slave_sg()
2412 spin_unlock_irqrestore(&cohc->lock, flg); in coh901318_prep_slave_sg()
2421 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_tx_status() local
2430 if (ret == DMA_IN_PROGRESS && cohc->stopped) in coh901318_tx_status()
2439 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_issue_pending() local
2442 spin_lock_irqsave(&cohc->lock, flags); in coh901318_issue_pending()
2450 if (!cohc->busy) in coh901318_issue_pending()
2451 coh901318_queue_start(cohc); in coh901318_issue_pending()
2453 spin_unlock_irqrestore(&cohc->lock, flags); in coh901318_issue_pending()
2520 struct coh901318_chan *cohc = to_coh901318_chan(chan); in coh901318_dma_set_runtimeconfig() local
2537 dev_err(COHC_2_DEV(cohc), "illegal channel mode\n"); in coh901318_dma_set_runtimeconfig()
2541 dev_dbg(COHC_2_DEV(cohc), "configure channel for %d byte transfers\n", in coh901318_dma_set_runtimeconfig()
2582 dev_err(COHC_2_DEV(cohc), in coh901318_dma_set_runtimeconfig()
2588 dev_dbg(COHC_2_DEV(cohc), in coh901318_dma_set_runtimeconfig()
2592 cohc->addr = addr; in coh901318_dma_set_runtimeconfig()
2593 cohc->ctrl = ctrl; in coh901318_dma_set_runtimeconfig()
2603 struct coh901318_chan *cohc; in coh901318_base_init() local
2609 cohc = &base->chans[i]; in coh901318_base_init()
2611 cohc->base = base; in coh901318_base_init()
2612 cohc->chan.device = dma; in coh901318_base_init()
2613 cohc->id = i; in coh901318_base_init()
2619 spin_lock_init(&cohc->lock); in coh901318_base_init()
2621 cohc->nbr_active_done = 0; in coh901318_base_init()
2622 cohc->busy = 0; in coh901318_base_init()
2623 INIT_LIST_HEAD(&cohc->free); in coh901318_base_init()
2624 INIT_LIST_HEAD(&cohc->active); in coh901318_base_init()
2625 INIT_LIST_HEAD(&cohc->queue); in coh901318_base_init()
2627 tasklet_init(&cohc->tasklet, dma_tasklet, in coh901318_base_init()
2628 (unsigned long) cohc); in coh901318_base_init()
2630 list_add_tail(&cohc->chan.device_node, in coh901318_base_init()