Re: [PATCH 1/2] mtd: mtk-quadspi: add support for DMA reading

From: Chuanhong Guo
Date: Thu Nov 14 2019 - 03:19:33 EST


Hi all!

On Tue, Nov 12, 2019 at 3:29 PM kbuild test robot <lkp@xxxxxxxxx> wrote:
> [...]
> All warnings (new ones prefixed by >>):
>
> drivers/mtd/spi-nor/mtk-quadspi.c: In function 'mtk_nor_read_dma_bounce':
> >> drivers/mtd/spi-nor/mtk-quadspi.c:349:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> mem_unaligned_len = (u32)buf % MTK_NOR_DMA_ALIGN;
> ^
> drivers/mtd/spi-nor/mtk-quadspi.c: In function 'mtk_nor_read':
> drivers/mtd/spi-nor/mtk-quadspi.c:369:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
> (u32)buffer % MTK_NOR_DMA_ALIGN || from % MTK_NOR_DMA_ALIGN)
> ^
>

DMA mode on this controller requires that source address, destination
address and reading
length should all be 16-byte aligned. And because of this, I didn't
use the bounce buffer
provided by spi-nor framework and allocate its own one.
Should I just cast all these pointers to ulong or are there better
ways to check for address
alignments and/or obtain an aligned buffer?

Regards,
Chuanhong Guo