[PATCH resend 2/4] spi: add driver for MTK SPI NAND Flash Interface

kernel test robot lkp at intel.com
Sun Apr 3 10:22:09 PDT 2022


Hi Chuanhong,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20220401]
[cannot apply to mtd/nand/next broonie-spi/for-next robh/for-next v5.17 v5.17-rc8 v5.17-rc7 v5.17]
[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/intel-lab-lkp/linux/commits/Chuanhong-Guo/spi-add-support-for-Mediatek-SPI-NAND-controller/20220403-211703
base:    e5071887cd2296a7704dbcd10c1cedf0f11cdbd5
config: mips-allmodconfig (https://download.01.org/0day-ci/archive/20220404/202204040143.fnOgLTp5-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 11.2.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
        # https://github.com/intel-lab-lkp/linux/commit/42beed649ed9c6674bdb176691f10365f093a82d
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Chuanhong-Guo/spi-add-support-for-Mediatek-SPI-NAND-controller/20220403-211703
        git checkout 42beed649ed9c6674bdb176691f10365f093a82d
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=mips SHELL=/bin/bash

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

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/printk.h:555,
                    from include/linux/kernel.h:29,
                    from drivers/spi/spi-mtk-snfi.c:70:
   drivers/spi/spi-mtk-snfi.c: In function 'mtk_snand_mac_io':
>> drivers/spi/spi-mtk-snfi.c:499:27: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     499 |         dev_dbg(snf->dev, "SNF TX: %lu RX: %lu", reg_offs, rx_len);
         |                           ^~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dynamic_func_call'
     134 |                 func(&id, ##__VA_ARGS__);               \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynamic_func_call'
     166 |         _dynamic_func_call(fmt,__dynamic_dev_dbg,               \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                              ^~~~~~~
   drivers/spi/spi-mtk-snfi.c:499:9: note: in expansion of macro 'dev_dbg'
     499 |         dev_dbg(snf->dev, "SNF TX: %lu RX: %lu", reg_offs, rx_len);
         |         ^~~~~~~
   drivers/spi/spi-mtk-snfi.c:499:38: note: format string is defined here
     499 |         dev_dbg(snf->dev, "SNF TX: %lu RX: %lu", reg_offs, rx_len);
         |                                    ~~^
         |                                      |
         |                                      long unsigned int
         |                                    %u
   In file included from include/linux/printk.h:555,
                    from include/linux/kernel.h:29,
                    from drivers/spi/spi-mtk-snfi.c:70:
   drivers/spi/spi-mtk-snfi.c:499:27: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     499 |         dev_dbg(snf->dev, "SNF TX: %lu RX: %lu", reg_offs, rx_len);
         |                           ^~~~~~~~~~~~~~~~~~~~~
   include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dynamic_func_call'
     134 |                 func(&id, ##__VA_ARGS__);               \
         |                             ^~~~~~~~~~~
   include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynamic_func_call'
     166 |         _dynamic_func_call(fmt,__dynamic_dev_dbg,               \
         |         ^~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |         ^~~~~~~~~~~~~~~
   include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
     155 |         dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                              ^~~~~~~
   drivers/spi/spi-mtk-snfi.c:499:9: note: in expansion of macro 'dev_dbg'
     499 |         dev_dbg(snf->dev, "SNF TX: %lu RX: %lu", reg_offs, rx_len);
         |         ^~~~~~~
   drivers/spi/spi-mtk-snfi.c:499:46: note: format string is defined here
     499 |         dev_dbg(snf->dev, "SNF TX: %lu RX: %lu", reg_offs, rx_len);
         |                                            ~~^
         |                                              |
         |                                              long unsigned int
         |                                            %u
   In file included from include/linux/device.h:15,
                    from drivers/spi/spi-mtk-snfi.c:73:
   drivers/spi/spi-mtk-snfi.c: In function 'mtk_snand_setup_pagefmt':
   drivers/spi/spi-mtk-snfi.c:619:27: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     619 |         dev_err(snf->dev, "page size %lu+%lu is not supported\n", page_size,
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ^~~
   include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
     144 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   drivers/spi/spi-mtk-snfi.c:619:9: note: in expansion of macro 'dev_err'
     619 |         dev_err(snf->dev, "page size %lu+%lu is not supported\n", page_size,
         |         ^~~~~~~
   drivers/spi/spi-mtk-snfi.c:619:40: note: format string is defined here
     619 |         dev_err(snf->dev, "page size %lu+%lu is not supported\n", page_size,
         |                                      ~~^
         |                                        |
         |                                        long unsigned int
         |                                      %u
   In file included from include/linux/device.h:15,
                    from drivers/spi/spi-mtk-snfi.c:73:
   drivers/spi/spi-mtk-snfi.c:619:27: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=]
     619 |         dev_err(snf->dev, "page size %lu+%lu is not supported\n", page_size,
         |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ^~~
   include/linux/dev_printk.h:144:56: note: in expansion of macro 'dev_fmt'
     144 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   drivers/spi/spi-mtk-snfi.c:619:9: note: in expansion of macro 'dev_err'
     619 |         dev_err(snf->dev, "page size %lu+%lu is not supported\n", page_size,
         |         ^~~~~~~
   drivers/spi/spi-mtk-snfi.c:619:44: note: format string is defined here
     619 |         dev_err(snf->dev, "page size %lu+%lu is not supported\n", page_size,
         |                                          ~~^
         |                                            |
         |                                            long unsigned int
         |                                          %u
--
>> drivers/spi/spi-mtk-snfi.c:728: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * swap [pagesize] byte on nand with the first fdm byte in the last sector.
   drivers/spi/spi-mtk-snfi.c:748: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * swap the first fdm byte in the first and the last sector.
   drivers/spi/spi-mtk-snfi.c:1048: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst
    * Check whether op can be executed with read_from_cache or program_load
--
   mips-linux-ld: drivers/mtd/nand/ecc-mtk.o: in function `mtk_ecc_driver_exit':
>> ecc-mtk.c:(.exit.text+0x0): multiple definition of `cleanup_module'; drivers/mtd/nand/ecc-mxic.o:ecc-mxic.c:(.exit.text+0x0): first defined here
   mips-linux-ld: drivers/mtd/nand/ecc-mtk.o: in function `mtk_ecc_driver_init':
>> ecc-mtk.c:(.init.text+0x0): multiple definition of `init_module'; drivers/mtd/nand/ecc-mxic.o:ecc-mxic.c:(.init.text+0x0): first defined here


vim +499 drivers/spi/spi-mtk-snfi.c

   437	
   438	static int mtk_snand_mac_io(struct mtk_snand *snf, const struct spi_mem_op *op)
   439	{
   440		size_t rx_len = 0;
   441		size_t reg_offs = 0;
   442		u32 val = 0;
   443		const u8 *tx_buf = NULL;
   444		u8 *rx_buf = NULL;
   445		int i, ret;
   446		u8 b;
   447	
   448		if (op->data.dir == SPI_MEM_DATA_IN) {
   449			rx_len = op->data.nbytes;
   450			rx_buf = op->data.buf.in;
   451		} else {
   452			tx_buf = op->data.buf.out;
   453		}
   454	
   455		mtk_snand_mac_reset(snf);
   456	
   457		for (i = 0; i < op->cmd.nbytes; i++, reg_offs++) {
   458			b = (op->cmd.opcode >> ((op->cmd.nbytes - i - 1) * 8)) & 0xff;
   459			val |= b << (8 * (reg_offs % 4));
   460			if (reg_offs % 4 == 3) {
   461				nfi_write32(snf, SNF_GPRAM + reg_offs - 3, val);
   462				val = 0;
   463			}
   464		}
   465	
   466		for (i = 0; i < op->addr.nbytes; i++, reg_offs++) {
   467			b = (op->addr.val >> ((op->addr.nbytes - i - 1) * 8)) & 0xff;
   468			val |= b << (8 * (reg_offs % 4));
   469			if (reg_offs % 4 == 3) {
   470				nfi_write32(snf, SNF_GPRAM + reg_offs - 3, val);
   471				val = 0;
   472			}
   473		}
   474	
   475		for (i = 0; i < op->dummy.nbytes; i++, reg_offs++) {
   476			if (reg_offs % 4 == 3) {
   477				nfi_write32(snf, SNF_GPRAM + reg_offs - 3, val);
   478				val = 0;
   479			}
   480		}
   481	
   482		if (op->data.dir == SPI_MEM_DATA_OUT) {
   483			for (i = 0; i < op->data.nbytes; i++, reg_offs++) {
   484				val |= tx_buf[i] << (8 * (reg_offs % 4));
   485				if (reg_offs % 4 == 3) {
   486					nfi_write32(snf, SNF_GPRAM + reg_offs - 3, val);
   487					val = 0;
   488				}
   489			}
   490		}
   491	
   492		if (reg_offs % 4 != 3)
   493			nfi_write32(snf, SNF_GPRAM + (reg_offs & ~3), val);
   494	
   495		for (i = 0; i < reg_offs; i += 4)
   496			dev_dbg(snf->dev, "%d: %08X", i,
   497				nfi_read32(snf, SNF_GPRAM + i));
   498	
 > 499		dev_dbg(snf->dev, "SNF TX: %lu RX: %lu", reg_offs, rx_len);
   500	
   501		ret = mtk_snand_mac_trigger(snf, reg_offs, rx_len);
   502		if (ret)
   503			return ret;
   504	
   505		if (!rx_len)
   506			return 0;
   507	
   508		nfi_read_data(snf, SNF_GPRAM + reg_offs, rx_buf, rx_len);
   509		return 0;
   510	}
   511	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp



More information about the linux-mtd mailing list