Lines Matching defs:cohc

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