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

kernel test robot lkp at intel.com
Thu Sep 10 05:52:19 EDT 2020


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-20200909]
[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: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 9.3.0
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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sh 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   In file included from include/linux/scatterlist.h:9,
                    from include/linux/dma-mapping.h:11,
                    from drivers/spi/spi-mtk-nor.c:10:
   drivers/spi/spi-mtk-nor.c: In function 'mtk_nor_read_dma':
>> drivers/spi/spi-mtk-nor.c:286:19: warning: right shift count >= width of type [-Wshift-count-overflow]
     286 |   writel(dma_addr >> 32, sp->base + MTK_NOR_REG_DMA_DADR_HB);
         |                   ^~
   arch/sh/include/asm/io.h:31:77: note: in definition of macro '__raw_writel'
      31 | #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
         |                                                                             ^
   arch/sh/include/asm/io.h:46:62: note: in expansion of macro 'ioswabl'
      46 | #define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
         |                                                              ^~~~~~~
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
      56 | #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
         |                                ^~~~~~~~~~~~~~
   drivers/spi/spi-mtk-nor.c:286:3: note: in expansion of macro 'writel'
     286 |   writel(dma_addr >> 32, sp->base + MTK_NOR_REG_DMA_DADR_HB);
         |   ^~~~~~
   drivers/spi/spi-mtk-nor.c:287:30: warning: right shift count >= width of type [-Wshift-count-overflow]
     287 |   writel((dma_addr + length) >> 32, sp->base + MTK_NOR_REG_DMA_END_DADR_HB);
         |                              ^~
   arch/sh/include/asm/io.h:31:77: note: in definition of macro '__raw_writel'
      31 | #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile u32 __force *)(a) = (v))
         |                                                                             ^
   arch/sh/include/asm/io.h:46:62: note: in expansion of macro 'ioswabl'
      46 | #define writel_relaxed(v,c) ((void)__raw_writel((__force u32)ioswabl(v),c))
         |                                                              ^~~~~~~
   arch/sh/include/asm/io.h:56:32: note: in expansion of macro 'writel_relaxed'
      56 | #define writel(v,a)  ({ wmb(); writel_relaxed((v),(a)); })
         |                                ^~~~~~~~~~~~~~
   drivers/spi/spi-mtk-nor.c:287:3: note: in expansion of macro 'writel'
     287 |   writel((dma_addr + length) >> 32, sp->base + MTK_NOR_REG_DMA_END_DADR_HB);
         |   ^~~~~~

# 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@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 52712 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20200910/5ce83aa5/attachment-0001.gz>


More information about the linux-arm-kernel mailing list