2.5. pl08x_enable_dmac_chan

/*
 * Enable the DMA channel
 * ASSUMES All other configuration bits have been set
 *         as desired before this code is called
 */
void pl08x_enable_dmac_chan(unsigned int cnum)
{
	void __iomem *cbase = pd.base + PL08X_OS_CHAN_BASE +
					(cnum * PL08X_OS_CHAN);

	unsigned int r = 0;
	/*
	 * Do not access config register until channel shows as disabled
	 */
	while ((readl(pd.base + PL08X_OS_ENCHNS)1 & (1 << cnum))
			& PL08X_MASK_ENCHNS);

	/*
	 * Do not access config register until channel shows as inactive
	 */
	r = readl(cbase + PL08X_OS_CCFG);
	while ((r & PL08X_MASK_ACTIVE)2 || (r & PL08X_MASK_CEN))
		r = readl(cbase + PL08X_OS_CCFG);

	writel(r | PL08X_MASK_CEN, cbase + PL08X_OS_CCFG);
	mb();
}
        

1

等到对应channel是disable状态了,再接下来去enable它,会更安全

2

等到对应channel是inactive状态了,再接下来去enable它,会更安全