tdmac             134 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan		*tdmac[TDMA_CHANNEL_NUM];
tdmac             143 drivers/dma/mmp_tdma.c static void mmp_tdma_chan_set_desc(struct mmp_tdma_chan *tdmac, dma_addr_t phys)
tdmac             145 drivers/dma/mmp_tdma.c 	writel(phys, tdmac->reg_base + TDNDPR);
tdmac             146 drivers/dma/mmp_tdma.c 	writel(readl(tdmac->reg_base + TDCR) | TDCR_FETCHND,
tdmac             147 drivers/dma/mmp_tdma.c 					tdmac->reg_base + TDCR);
tdmac             150 drivers/dma/mmp_tdma.c static void mmp_tdma_enable_irq(struct mmp_tdma_chan *tdmac, bool enable)
tdmac             153 drivers/dma/mmp_tdma.c 		writel(TDIMR_COMP, tdmac->reg_base + TDIMR);
tdmac             155 drivers/dma/mmp_tdma.c 		writel(0, tdmac->reg_base + TDIMR);
tdmac             158 drivers/dma/mmp_tdma.c static void mmp_tdma_enable_chan(struct mmp_tdma_chan *tdmac)
tdmac             161 drivers/dma/mmp_tdma.c 	writel(readl(tdmac->reg_base + TDCR) | TDCR_CHANEN,
tdmac             162 drivers/dma/mmp_tdma.c 					tdmac->reg_base + TDCR);
tdmac             163 drivers/dma/mmp_tdma.c 	tdmac->status = DMA_IN_PROGRESS;
tdmac             168 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             171 drivers/dma/mmp_tdma.c 	tdcr = readl(tdmac->reg_base + TDCR);
tdmac             174 drivers/dma/mmp_tdma.c 	writel(tdcr, tdmac->reg_base + TDCR);
tdmac             176 drivers/dma/mmp_tdma.c 	tdmac->status = DMA_COMPLETE;
tdmac             183 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             185 drivers/dma/mmp_tdma.c 	writel(readl(tdmac->reg_base + TDCR) | TDCR_CHANEN,
tdmac             186 drivers/dma/mmp_tdma.c 					tdmac->reg_base + TDCR);
tdmac             187 drivers/dma/mmp_tdma.c 	tdmac->status = DMA_IN_PROGRESS;
tdmac             194 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             196 drivers/dma/mmp_tdma.c 	writel(readl(tdmac->reg_base + TDCR) & ~TDCR_CHANEN,
tdmac             197 drivers/dma/mmp_tdma.c 					tdmac->reg_base + TDCR);
tdmac             198 drivers/dma/mmp_tdma.c 	tdmac->status = DMA_PAUSED;
tdmac             205 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             210 drivers/dma/mmp_tdma.c 	if (tdmac->dir == DMA_MEM_TO_DEV)
tdmac             212 drivers/dma/mmp_tdma.c 	else if (tdmac->dir == DMA_DEV_TO_MEM)
tdmac             215 drivers/dma/mmp_tdma.c 	if (tdmac->type == MMP_AUD_TDMA) {
tdmac             218 drivers/dma/mmp_tdma.c 		switch (tdmac->burst_sz) {
tdmac             238 drivers/dma/mmp_tdma.c 			dev_err(tdmac->dev, "mmp_tdma: unknown burst size.\n");
tdmac             242 drivers/dma/mmp_tdma.c 		switch (tdmac->buswidth) {
tdmac             253 drivers/dma/mmp_tdma.c 			dev_err(tdmac->dev, "mmp_tdma: unknown bus size.\n");
tdmac             256 drivers/dma/mmp_tdma.c 	} else if (tdmac->type == PXA910_SQU) {
tdmac             259 drivers/dma/mmp_tdma.c 		switch (tdmac->burst_sz) {
tdmac             279 drivers/dma/mmp_tdma.c 			dev_err(tdmac->dev, "mmp_tdma: unknown burst size.\n");
tdmac             284 drivers/dma/mmp_tdma.c 	writel(tdcr, tdmac->reg_base + TDCR);
tdmac             288 drivers/dma/mmp_tdma.c static int mmp_tdma_clear_chan_irq(struct mmp_tdma_chan *tdmac)
tdmac             290 drivers/dma/mmp_tdma.c 	u32 reg = readl(tdmac->reg_base + TDISR);
tdmac             295 drivers/dma/mmp_tdma.c 		writel(reg, tdmac->reg_base + TDISR);
tdmac             302 drivers/dma/mmp_tdma.c static size_t mmp_tdma_get_pos(struct mmp_tdma_chan *tdmac)
tdmac             306 drivers/dma/mmp_tdma.c 	if (tdmac->idx == 0) {
tdmac             307 drivers/dma/mmp_tdma.c 		reg = __raw_readl(tdmac->reg_base + TDSAR);
tdmac             308 drivers/dma/mmp_tdma.c 		reg -= tdmac->desc_arr[0].src_addr;
tdmac             309 drivers/dma/mmp_tdma.c 	} else if (tdmac->idx == 1) {
tdmac             310 drivers/dma/mmp_tdma.c 		reg = __raw_readl(tdmac->reg_base + TDDAR);
tdmac             311 drivers/dma/mmp_tdma.c 		reg -= tdmac->desc_arr[0].dst_addr;
tdmac             320 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = dev_id;
tdmac             322 drivers/dma/mmp_tdma.c 	if (mmp_tdma_clear_chan_irq(tdmac) == 0) {
tdmac             323 drivers/dma/mmp_tdma.c 		tasklet_schedule(&tdmac->tasklet);
tdmac             336 drivers/dma/mmp_tdma.c 		struct mmp_tdma_chan *tdmac = tdev->tdmac[i];
tdmac             338 drivers/dma/mmp_tdma.c 		ret = mmp_tdma_chan_handler(irq, tdmac);
tdmac             351 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = (struct mmp_tdma_chan *)data;
tdmac             353 drivers/dma/mmp_tdma.c 	dmaengine_desc_get_callback_invoke(&tdmac->desc, NULL);
tdmac             356 drivers/dma/mmp_tdma.c static void mmp_tdma_free_descriptor(struct mmp_tdma_chan *tdmac)
tdmac             359 drivers/dma/mmp_tdma.c 	int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc);
tdmac             361 drivers/dma/mmp_tdma.c 	gpool = tdmac->pool;
tdmac             362 drivers/dma/mmp_tdma.c 	if (gpool && tdmac->desc_arr)
tdmac             363 drivers/dma/mmp_tdma.c 		gen_pool_free(gpool, (unsigned long)tdmac->desc_arr,
tdmac             365 drivers/dma/mmp_tdma.c 	tdmac->desc_arr = NULL;
tdmac             366 drivers/dma/mmp_tdma.c 	if (tdmac->status == DMA_ERROR)
tdmac             367 drivers/dma/mmp_tdma.c 		tdmac->status = DMA_COMPLETE;
tdmac             374 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(tx->chan);
tdmac             376 drivers/dma/mmp_tdma.c 	mmp_tdma_chan_set_desc(tdmac, tdmac->desc_arr_phys);
tdmac             383 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             386 drivers/dma/mmp_tdma.c 	dma_async_tx_descriptor_init(&tdmac->desc, chan);
tdmac             387 drivers/dma/mmp_tdma.c 	tdmac->desc.tx_submit = mmp_tdma_tx_submit;
tdmac             389 drivers/dma/mmp_tdma.c 	if (tdmac->irq) {
tdmac             390 drivers/dma/mmp_tdma.c 		ret = devm_request_irq(tdmac->dev, tdmac->irq,
tdmac             391 drivers/dma/mmp_tdma.c 			mmp_tdma_chan_handler, 0, "tdma", tdmac);
tdmac             400 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             402 drivers/dma/mmp_tdma.c 	if (tdmac->irq)
tdmac             403 drivers/dma/mmp_tdma.c 		devm_free_irq(tdmac->dev, tdmac->irq, tdmac);
tdmac             404 drivers/dma/mmp_tdma.c 	mmp_tdma_free_descriptor(tdmac);
tdmac             408 drivers/dma/mmp_tdma.c static struct mmp_tdma_desc *mmp_tdma_alloc_descriptor(struct mmp_tdma_chan *tdmac)
tdmac             411 drivers/dma/mmp_tdma.c 	int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc);
tdmac             413 drivers/dma/mmp_tdma.c 	gpool = tdmac->pool;
tdmac             417 drivers/dma/mmp_tdma.c 	tdmac->desc_arr = gen_pool_dma_alloc(gpool, size, &tdmac->desc_arr_phys);
tdmac             419 drivers/dma/mmp_tdma.c 	return tdmac->desc_arr;
tdmac             427 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             432 drivers/dma/mmp_tdma.c 	if (tdmac->status != DMA_COMPLETE)
tdmac             436 drivers/dma/mmp_tdma.c 		dev_err(tdmac->dev,
tdmac             442 drivers/dma/mmp_tdma.c 	tdmac->status = DMA_IN_PROGRESS;
tdmac             443 drivers/dma/mmp_tdma.c 	tdmac->desc_num = num_periods;
tdmac             444 drivers/dma/mmp_tdma.c 	desc = mmp_tdma_alloc_descriptor(tdmac);
tdmac             448 drivers/dma/mmp_tdma.c 	if (mmp_tdma_config_write(chan, direction, &tdmac->slave_config))
tdmac             452 drivers/dma/mmp_tdma.c 		desc = &tdmac->desc_arr[i];
tdmac             455 drivers/dma/mmp_tdma.c 			desc->nxt_desc = tdmac->desc_arr_phys;
tdmac             457 drivers/dma/mmp_tdma.c 			desc->nxt_desc = tdmac->desc_arr_phys +
tdmac             462 drivers/dma/mmp_tdma.c 			desc->dst_addr = tdmac->dev_addr;
tdmac             464 drivers/dma/mmp_tdma.c 			desc->src_addr = tdmac->dev_addr;
tdmac             475 drivers/dma/mmp_tdma.c 		mmp_tdma_enable_irq(tdmac, true);
tdmac             477 drivers/dma/mmp_tdma.c 	tdmac->buf_len = buf_len;
tdmac             478 drivers/dma/mmp_tdma.c 	tdmac->period_len = period_len;
tdmac             479 drivers/dma/mmp_tdma.c 	tdmac->pos = 0;
tdmac             481 drivers/dma/mmp_tdma.c 	return &tdmac->desc;
tdmac             484 drivers/dma/mmp_tdma.c 	tdmac->status = DMA_ERROR;
tdmac             490 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             494 drivers/dma/mmp_tdma.c 	mmp_tdma_enable_irq(tdmac, false);
tdmac             502 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             504 drivers/dma/mmp_tdma.c 	memcpy(&tdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
tdmac             513 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             516 drivers/dma/mmp_tdma.c 		tdmac->dev_addr = dmaengine_cfg->src_addr;
tdmac             517 drivers/dma/mmp_tdma.c 		tdmac->burst_sz = dmaengine_cfg->src_maxburst;
tdmac             518 drivers/dma/mmp_tdma.c 		tdmac->buswidth = dmaengine_cfg->src_addr_width;
tdmac             520 drivers/dma/mmp_tdma.c 		tdmac->dev_addr = dmaengine_cfg->dst_addr;
tdmac             521 drivers/dma/mmp_tdma.c 		tdmac->burst_sz = dmaengine_cfg->dst_maxburst;
tdmac             522 drivers/dma/mmp_tdma.c 		tdmac->buswidth = dmaengine_cfg->dst_addr_width;
tdmac             524 drivers/dma/mmp_tdma.c 	tdmac->dir = dir;
tdmac             532 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             534 drivers/dma/mmp_tdma.c 	tdmac->pos = mmp_tdma_get_pos(tdmac);
tdmac             536 drivers/dma/mmp_tdma.c 			 tdmac->buf_len - tdmac->pos);
tdmac             538 drivers/dma/mmp_tdma.c 	return tdmac->status;
tdmac             543 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac = to_mmp_tdma_chan(chan);
tdmac             545 drivers/dma/mmp_tdma.c 	mmp_tdma_enable_chan(tdmac);
tdmac             557 drivers/dma/mmp_tdma.c 	struct mmp_tdma_chan *tdmac;
tdmac             565 drivers/dma/mmp_tdma.c 	tdmac = devm_kzalloc(tdev->dev, sizeof(*tdmac), GFP_KERNEL);
tdmac             566 drivers/dma/mmp_tdma.c 	if (!tdmac)
tdmac             570 drivers/dma/mmp_tdma.c 		tdmac->irq = irq;
tdmac             571 drivers/dma/mmp_tdma.c 	tdmac->dev	   = tdev->dev;
tdmac             572 drivers/dma/mmp_tdma.c 	tdmac->chan.device = &tdev->device;
tdmac             573 drivers/dma/mmp_tdma.c 	tdmac->idx	   = idx;
tdmac             574 drivers/dma/mmp_tdma.c 	tdmac->type	   = type;
tdmac             575 drivers/dma/mmp_tdma.c 	tdmac->reg_base	   = tdev->base + idx * 4;
tdmac             576 drivers/dma/mmp_tdma.c 	tdmac->pool	   = pool;
tdmac             577 drivers/dma/mmp_tdma.c 	tdmac->status = DMA_COMPLETE;
tdmac             578 drivers/dma/mmp_tdma.c 	tdev->tdmac[tdmac->idx] = tdmac;
tdmac             579 drivers/dma/mmp_tdma.c 	tasklet_init(&tdmac->tasklet, dma_do_tasklet, (unsigned long)tdmac);
tdmac             582 drivers/dma/mmp_tdma.c 	list_add_tail(&tdmac->chan.device_node,