/* * This function returns the channel configuration. */ int ppc4xx_get_channel_config(unsigned int dmanr, ppc_dma_ch_t * p_dma_ch) { unsigned int polarity; unsigned int control; if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) { printk("ppc4xx_get_channel_config: bad channel %d\n", dmanr); return DMA_STATUS_BAD_CHANNEL; } memcpy(p_dma_ch, &dma_channels[dmanr], sizeof (ppc_dma_ch_t)); #if DCRN_POL > 0 polarity = mfdcr(DCRN_POL); #else polarity = 0; #endif p_dma_ch->polarity = polarity & GET_DMA_POLARITY(dmanr); control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8)); p_dma_ch->cp = GET_DMA_PRIORITY(control); p_dma_ch->pwidth = GET_DMA_PW(control); p_dma_ch->psc = GET_DMA_PSC(control); p_dma_ch->pwc = GET_DMA_PWC(control); p_dma_ch->phc = GET_DMA_PHC(control); p_dma_ch->ce = GET_DMA_CE_ENABLE(control); p_dma_ch->int_enable = GET_DMA_CIE_ENABLE(control); p_dma_ch->shift = GET_DMA_PW(control); #ifdef CONFIG_PPC4xx_EDMA p_dma_ch->pf = GET_DMA_PREFETCH(control); #else p_dma_ch->ch_enable = GET_DMA_CH(control); p_dma_ch->ece_enable = GET_DMA_ECE(control); p_dma_ch->tcd_disable = GET_DMA_TCD(control); #endif return DMA_STATUS_GOOD; }
/* * Returns the width of the peripheral attached to this channel. This assumes * that someone who knows the hardware configuration, boot code or some other * init code, already set the width. * * The return value is one of: * PW_8 * PW_16 * PW_32 * PW_64 * * The function returns 0 on error. */ unsigned int ppc4xx_get_peripheral_width(unsigned int dmanr) { unsigned int control; if (dmanr >= MAX_PPC4xx_DMA_CHANNELS) { printk("ppc4xx_get_peripheral_width: bad channel %d\n", dmanr); return DMA_STATUS_BAD_CHANNEL; } control = mfdcr(DCRN_DMACR0 + (dmanr * 0x8)); return (GET_DMA_PW(control)); }