arch/arm/mach-omap1/omap-dma.c

Source file repositories/reference/linux-study-clean/arch/arm/mach-omap1/omap-dma.c

File Facts

System
Linux kernel
Corpus path
arch/arm/mach-omap1/omap-dma.c
Extension
.c
Size
20535 bytes
Lines
870
Domain
Architecture Layer
Bucket
arch/arm
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

switch (dst_port) {
		case OMAP_DMA_PORT_OCP_T1:	/* FFFECC00 */
			reg = OMAP_TC_OCPT1_PRIOR;
			break;
		case OMAP_DMA_PORT_OCP_T2:	/* FFFECCD0 */
			reg = OMAP_TC_OCPT2_PRIOR;
			break;
		case OMAP_DMA_PORT_EMIFF:	/* FFFECC08 */
			reg = OMAP_TC_EMIFF_PRIOR;
			break;
		case OMAP_DMA_PORT_EMIFS:	/* FFFECC04 */
			reg = OMAP_TC_EMIFS_PRIOR;
			break;
		default:
			BUG();
			return;
		}
		l = omap_readl(reg);
		l &= ~(0xf << 8);
		l |= (priority & 0xf) << 8;
		omap_writel(l, reg);
	}
}
EXPORT_SYMBOL(omap_set_dma_priority);
#endif

#if IS_ENABLED(CONFIG_USB_OMAP)
#ifdef CONFIG_ARCH_OMAP15XX
/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */
static int omap_dma_in_1510_mode(void)
{
	return enable_1510_mode;
}
#else
#define omap_dma_in_1510_mode()		0
#endif

void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
				  int frame_count, int sync_mode,
				  int dma_trigger, int src_or_dst_synch)
{
	u32 l;
	u16 ccr;

	l = p->dma_read(CSDP, lch);
	l &= ~0x03;
	l |= data_type;
	p->dma_write(l, CSDP, lch);

	ccr = p->dma_read(CCR, lch);
	ccr &= ~(1 << 5);
	if (sync_mode == OMAP_DMA_SYNC_FRAME)
		ccr |= 1 << 5;
	p->dma_write(ccr, CCR, lch);

	ccr = p->dma_read(CCR2, lch);
	ccr &= ~(1 << 2);
	if (sync_mode == OMAP_DMA_SYNC_BLOCK)
		ccr |= 1 << 2;
	p->dma_write(ccr, CCR2, lch);
	p->dma_write(elem_count, CEN, lch);
	p->dma_write(frame_count, CFN, lch);
}
EXPORT_SYMBOL(omap_set_dma_transfer_params);

void omap_set_dma_channel_mode(int lch, enum omap_dma_channel_mode mode)
{
	if (!dma_omap15xx()) {
		u32 l;

		l = p->dma_read(LCH_CTRL, lch);
		l &= ~0x7;
		l |= mode;
		p->dma_write(l, LCH_CTRL, lch);
	}
}
EXPORT_SYMBOL(omap_set_dma_channel_mode);

/* Note that src_port is only for omap1 */
void omap_set_dma_src_params(int lch, int src_port, int src_amode,
			     unsigned long src_start,
			     int src_ei, int src_fi)
{
	u32 l;
	u16 w;

	w = p->dma_read(CSDP, lch);
	w &= ~(0x1f << 2);
	w |= src_port << 2;
	p->dma_write(w, CSDP, lch);

Annotation

Implementation Notes