Re: [PATCH] Fixes for dw_dmac and atmel-mci for AP700x

Hein Tibosch
2012-08-21T06:55:16Z

Hi Viresh,

On 8/21/2012 12:42 PM, viresh kumar wrote:
> I have added linux-kernel list in cc as there might be other users of
> this patch.
> Also, please try to keep spear-devel list in cc for dw_dmac as we are using this
> driver for SPEAr.

Yes sure, I didn't want to bother the lists with the first preparations of this patch.

> On Sun, Aug 19, 2012 at 9:36 PM, Hein Tibosch <hein_tibosch@yahoo.es> wrote:
>> dw_dmac:
>> - After 2.6.39, the registers were accessed using readl/writel
>> in stead of the __raw_readl and __raw_writel causing a 16-bit
>> swap of all values (little endian access)
> Ahhhh!! Firstly we can't use __raw* for architectures >= ARMv6. It is not
> only for endianess but for memory barriers. Why are they getting swapped
> for your case? Does your processor and dw_dmac have different endianess?

If I'm not wrong: the __raw_* functions will access the i/o memory in native endianess.
As far as I know, all AVR32 drivers are currently using the __raw* functions. I never
encountered a problem with that.

> And if i am not wrong, we should always try not to use __raw* variants just
> due to endianess things... instead use either readl/writel OR
> readl_/writel_ relaxed.
> I am not sure if relaxed versions are available for architectures
> other than ARM.

Would you agree to have this depend on CONFIG_AVR ?

>> - Access to memory was sometimes done in chunks of 64-bits,
>> which gives an undefined value of 0x03 for SRC/DST_TR_WIDTH
>> field in the CTLxL register
> Looks fine. But there should be a separate patch for this.
>
>> - The SMS field in the CTLxL register received the wrong value:
>> 0 in stead of 1
> I believe it is not for dw_dmac?

That's correct, I'll put it in a separate Atmel patch (at32ap700x.c)

So for the AP700x fixes for the MCI/DMA driver I'm thinking of this
series of patches:

To you, cc spear-devel & linux-kernel
- include/linux/dw_dmac.h:
adding field max_mem_width to limit SRC/DST_TR_WIDTH
- dw_dmac.c:
check max_mem_width before setting SRC/DST_TR_WIDTH
- dw_dmac_regs.h:
use __raw* functions for AVR32, readl/writel for all others

To Ludovic Desroches, linux-mmc:
- atmel-mci.c:
avoid using peripheral DMA controller (PDC) in case of AVR32
- atmel-mci.c:
only use the ATMCI_DMA register if supported by arch

To Hans-Christian, linux-kernel cc Andrew:
- at32ap700x.c:
set src_master=1 to get SMS (Source Master Select) correct
set max_mem_width=2 to get SRC/DST_TR_WIDTH correct

Ok?

Thanks, Hein