Re: [PATCH 2/2] spi: spi-mtk-nor: support 36bit dma addressing to mediatek spi-nor

From: kernel test robot
Date: Fri Sep 11 2020 - 07:40:18 EST


Hi Ikjoon,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on spi/for-next]
[also build test WARNING on next-20200910]
[cannot apply to robh/for-next v5.9-rc4]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Ikjoon-Jang/Add-36bit-dma-support-to-mediatek-spi-nor-controller/20200910-121600
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
config: arm-randconfig-r035-20200909 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 0a5dc7effb191eff740e0e7ae7bd8e1f6bdb3ad9)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/spi/spi-mtk-nor.c:286:19: warning: shift count >= width of type [-Wshift-count-overflow]
writel(dma_addr >> 32, sp->base + MTK_NOR_REG_DMA_DADR_HB);
^ ~~
arch/arm/include/asm/io.h:307:51: note: expanded from macro 'writel'
#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
^
arch/arm/include/asm/io.h:299:68: note: expanded from macro 'writel_relaxed'
#define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
^
include/uapi/linux/byteorder/little_endian.h:33:51: note: expanded from macro '__cpu_to_le32'
#define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
^
drivers/spi/spi-mtk-nor.c:287:30: warning: shift count >= width of type [-Wshift-count-overflow]
writel((dma_addr + length) >> 32, sp->base + MTK_NOR_REG_DMA_END_DADR_HB);
^ ~~
arch/arm/include/asm/io.h:307:51: note: expanded from macro 'writel'
#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
^
arch/arm/include/asm/io.h:299:68: note: expanded from macro 'writel_relaxed'
#define writel_relaxed(v,c) __raw_writel((__force u32) cpu_to_le32(v),c)
^
include/uapi/linux/byteorder/little_endian.h:33:51: note: expanded from macro '__cpu_to_le32'
#define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
^
2 warnings generated.

# https://github.com/0day-ci/linux/commit/d6ccdab2988e8bf7aa66cc57daeac5e1a7e399cc
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Ikjoon-Jang/Add-36bit-dma-support-to-mediatek-spi-nor-controller/20200910-121600
git checkout d6ccdab2988e8bf7aa66cc57daeac5e1a7e399cc
vim +286 drivers/spi/spi-mtk-nor.c

266
267 static int mtk_nor_read_dma(struct mtk_nor *sp, u32 from, unsigned int length,
268 u8 *buffer)
269 {
270 int ret = 0;
271 ulong delay;
272 u32 reg;
273 dma_addr_t dma_addr;
274
275 dma_addr = dma_map_single(sp->dev, buffer, length, DMA_FROM_DEVICE);
276 if (dma_mapping_error(sp->dev, dma_addr)) {
277 dev_err(sp->dev, "failed to map dma buffer.\n");
278 return -EINVAL;
279 }
280
281 writel(from, sp->base + MTK_NOR_REG_DMA_FADR);
282 writel(dma_addr, sp->base + MTK_NOR_REG_DMA_DADR);
283 writel(dma_addr + length, sp->base + MTK_NOR_REG_DMA_END_DADR);
284
285 if (sp->high_dma) {
> 286 writel(dma_addr >> 32, sp->base + MTK_NOR_REG_DMA_DADR_HB);
287 writel((dma_addr + length) >> 32, sp->base + MTK_NOR_REG_DMA_END_DADR_HB);
288 }
289
290 if (sp->has_irq) {
291 reinit_completion(&sp->op_done);
292 mtk_nor_rmw(sp, MTK_NOR_REG_IRQ_EN, MTK_NOR_IRQ_DMA, 0);
293 }
294
295 mtk_nor_rmw(sp, MTK_NOR_REG_DMA_CTL, MTK_NOR_DMA_START, 0);
296
297 delay = CLK_TO_US(sp, (length + 5) * BITS_PER_BYTE);
298
299 if (sp->has_irq) {
300 if (!wait_for_completion_timeout(&sp->op_done,
301 (delay + 1) * 100))
302 ret = -ETIMEDOUT;
303 } else {
304 ret = readl_poll_timeout(sp->base + MTK_NOR_REG_DMA_CTL, reg,
305 !(reg & MTK_NOR_DMA_START), delay / 3,
306 (delay + 1) * 100);
307 }
308
309 dma_unmap_single(sp->dev, dma_addr, length, DMA_FROM_DEVICE);
310 if (ret < 0)
311 dev_err(sp->dev, "dma read timeout.\n");
312
313 return ret;
314 }
315

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip