Re: [PATCH v2] dmaengine: add CSR SiRFprimaII DMAC driver
From: Barry Song
Date: Sat Sep 17 2011 - 11:34:06 EST
2011/9/17 Russell King - ARM Linux <linux@xxxxxxxxxxxxxxxx>:
> On Fri, Sep 16, 2011 at 02:56:00AM -0700, Barry Song wrote:
>> +static int sirfsoc_dma_slave_config(struct sirfsoc_dma_chan *schan,
>> + Â Â struct dma_slave_config *config)
>> +{
>> + Â Â u32 addr, direction;
>> + Â Â unsigned long flags;
>> +
>> + Â Â switch (config->direction) {
>
> config->direction is deprecated, please don't use it.
ok.
>
>> + Â Â case DMA_FROM_DEVICE:
>> + Â Â Â Â Â Â direction = 0;
>> + Â Â Â Â Â Â addr = config->dst_addr;
>> + Â Â Â Â Â Â break;
>> +
>> + Â Â case DMA_TO_DEVICE:
>> + Â Â Â Â Â Â direction = 1;
>> + Â Â Â Â Â Â addr = config->src_addr;
>> + Â Â Â Â Â Â break;
>> +
>> + Â Â default:
>> + Â Â Â Â Â Â return -EINVAL;
>> + Â Â }
>> +
>> + Â Â if ((config->src_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES) ||
>> + Â Â Â Â Â Â (config->dst_addr_width != DMA_SLAVE_BUSWIDTH_4_BYTES))
>> + Â Â Â Â Â Â return -EINVAL;
>> +
>> + Â Â spin_lock_irqsave(&schan->lock, flags);
>> + Â Â schan->addr = addr;
>> + Â Â schan->direction = direction;
>> + Â Â schan->mode = (config->src_maxburst == 4 ? 1 : 0);
>
> Please store the source address, destination address, and mode separately
> for each direction. ÂYou should then select from that at prepare time.
the dmac has fixed route. every channel has fixed function. one
channel is for one device and one direction. for example, spi0 can
have two fixed channel: spi0-tx, spi0-rx.
then for every schan, device address is always fixed and we don't care
it at all. we only need to write the memory address to dmac address
register.
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/