All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Alexey Charkov <alchark@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Tudor Ambarus <tudor.ambarus@linaro.org>,
	Pratyush Yadav <pratyush@kernel.org>,
	Michael Walle <mwalle@kernel.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-spi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Alexey Charkov <alchark@gmail.com>
Subject: Re: [PATCH 2/3] mtd: spi-nor: Add a driver for the VIA/WonderMedia serial flash controller
Date: Sun, 11 May 2025 20:16:20 +0800	[thread overview]
Message-ID: <202505112028.FOL7oTti-lkp@intel.com> (raw)
In-Reply-To: <20250510-wmt-sflash-v1-2-02a1ac6adf12@gmail.com>

Hi Alexey,

kernel test robot noticed the following build warnings:

[auto build test WARNING on ed61cb3d78d585209ec775933078e268544fe9a4]

url:    https://github.com/intel-lab-lkp/linux/commits/Alexey-Charkov/dt-bindings-spi-Add-VIA-WonderMedia-serial-flash-controller/20250511-034459
base:   ed61cb3d78d585209ec775933078e268544fe9a4
patch link:    https://lore.kernel.org/r/20250510-wmt-sflash-v1-2-02a1ac6adf12%40gmail.com
patch subject: [PATCH 2/3] mtd: spi-nor: Add a driver for the VIA/WonderMedia serial flash controller
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20250511/202505112028.FOL7oTti-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250511/202505112028.FOL7oTti-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505112028.FOL7oTti-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/mtd/mtd.h:13,
                    from drivers/mtd/spi-nor/controllers/wmt-sflash.c:14:
   drivers/mtd/spi-nor/controllers/wmt-sflash.c: In function 'wmt_sflash_read_reg':
>> drivers/mtd/spi-nor/controllers/wmt-sflash.c:154:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     154 |                 "Cannot read %d bytes from registers\n", len);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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:154:56: note: in expansion of macro 'dev_fmt'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:153:17: note: in expansion of macro 'dev_err'
     153 |                 dev_err(host->dev,
         |                 ^~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:154:31: note: format string is defined here
     154 |                 "Cannot read %d bytes from registers\n", len);
         |                              ~^
         |                               |
         |                               int
         |                              %ld
   drivers/mtd/spi-nor/controllers/wmt-sflash.c: In function 'wmt_sflash_write_reg':
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:187:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     187 |                 "Cannot write %d bytes to registers\n", len);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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:154:56: note: in expansion of macro 'dev_fmt'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:186:17: note: in expansion of macro 'dev_err'
     186 |                 dev_err(host->dev,
         |                 ^~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:187:32: note: format string is defined here
     187 |                 "Cannot write %d bytes to registers\n", len);
         |                               ~^
         |                                |
         |                                int
         |                               %ld
   drivers/mtd/spi-nor/controllers/wmt-sflash.c: In function 'wmt_sflash_register':
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:365:47: error: passing argument 3 of 'of_property_read_u32' from incompatible pointer type [-Wincompatible-pointer-types]
     365 |         ret = of_property_read_u32(np, "reg", &priv->cs);
         |                                               ^~~~~~~~~
         |                                               |
         |                                               size_t * {aka long unsigned int *}
   In file included from include/linux/mtd/mtd.h:14:
   include/linux/of.h:1419:45: note: expected 'u32 *' {aka 'unsigned int *'} but argument is of type 'size_t *' {aka 'long unsigned int *'}
    1419 |                                        u32 *out_value)
         |                                        ~~~~~^~~~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:373:52: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     373 |                                      "Chip select %d is out of bounds\n",
         |                                                   ~^
         |                                                    |
         |                                                    int
         |                                                   %ld
     374 |                                      priv->cs);
         |                                      ~~~~~~~~       
         |                                          |
         |                                          size_t {aka long unsigned int}
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:394:46: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     394 |                         "Failed to map chip %d at address 0x%x size 0x%llx\n",
         |                                             ~^
         |                                              |
         |                                              int
         |                                             %ld
     395 |                         priv->cs, priv->mmap_phys, mtd->size);
         |                         ~~~~~~~~              
         |                             |
         |                             size_t {aka long unsigned int}
>> drivers/mtd/spi-nor/controllers/wmt-sflash.c:394:62: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
     394 |                         "Failed to map chip %d at address 0x%x size 0x%llx\n",
         |                                                             ~^
         |                                                              |
         |                                                              unsigned int
         |                                                             %llx
     395 |                         priv->cs, priv->mmap_phys, mtd->size);
         |                                   ~~~~~~~~~~~~~~~             
         |                                       |
         |                                       resource_size_t {aka long long unsigned int}


vim +154 drivers/mtd/spi-nor/controllers/wmt-sflash.c

  > 14	#include <linux/mtd/mtd.h>
    15	#include <linux/mtd/spi-nor.h>
    16	#include <linux/of.h>
    17	#include <linux/platform_device.h>
    18	#include <linux/slab.h>
    19	
    20	#define SF_CHIP_SEL_0_CFG	0x000		/* chip select 0 config */
    21	#define SF_CHIP_SEL_1_CFG	0x008		/* chip select 0 config */
    22	#define SF_CHIP_SEL_CFG(x)	(8 * (x))
    23	#define SF_CHIP_SEL_ADDR	GENMASK(31, 16) /* 64kb aligned address */
    24	#define SF_CHIP_SEL_SIZE	GENMASK(11, 8)	/* log2(size/32kb) */
    25	
    26	#define SF_SPI_INTF_CFG		0x040	/* SPI interface config */
    27	#define SF_ADDR_WIDTH_32	BIT(0)	/* 0: 24 bit, 1: 32 bit addr */
    28	#define SF_USR_RD_CMD_MOD	BIT(4)	/* 0: normal, 1: user cmd read */
    29	#define SF_USR_WR_CMD_MOD	BIT(5)	/* 0: normal, 1: user cmd write */
    30	#define SF_PROG_CMD_MOD		BIT(6)	/* 0: normal, 1: prog cmd */
    31	#define SF_CS_DELAY		GENMASK(18, 16)	/* chip select delay */
    32	#define SF_RES_DELAY		GENMASK(27, 24) /* reset delay */
    33	#define SF_PDWN_DELAY		GENMASK(31, 28) /* power down delay */
    34	
    35	#define SF_SPI_RD_WR_CTR	0x050	/* read/write control */
    36	#define SF_RD_FAST		BIT(0)	/* 0: normal read, 1: fast read */
    37	#define SF_RD_ID		BIT(4)	/* 0: read status, 1: read ID */
    38	
    39	#define SF_SPI_WR_EN_CTR	0x060	/* write enable control */
    40	#define SF_CS0_WR_EN		BIT(0)
    41	#define SF_CS1_WR_EN		BIT(1)
    42	#define SF_CS_WR_EN(x)		BIT(x)
    43	
    44	#define SF_SPI_ER_CTR		0x070	/* erase control */
    45	#define SF_CHIP_ERASE		BIT(0)	/* full chip erase */
    46	#define SF_SEC_ERASE		BIT(15)	/* sector erase */
    47	
    48	#define SF_SPI_ER_START_ADDR	0x074	/* erase start address */
    49	#define SF_CHIP_ER_CS0		BIT(0)	/* erase chip 0 */
    50	#define SF_CHIP_ER_CS1		BIT(1)	/* erase chip 1 */
    51	#define SF_CHIP_ER_CS(x)	BIT(x)
    52	#define SF_ER_START_ADDR	GENMASK(31, 16)
    53	
    54	#define SF_SPI_ERROR_STATUS	0x080
    55	#define SF_MASLOCK_ERR		BIT(0)	/* master lock */
    56	#define SF_PCMD_ACC_ERR		BIT(1)	/* programmable cmd access */
    57	#define SF_PCMD_OP_ERR		BIT(2)	/* programmable cmd opcode */
    58	#define SF_PWR_DWN_ACC_ERR	BIT(3)	/* power down access */
    59	#define SF_MEM_REGION_ERR	BIT(4)	/* memory region */
    60	#define SF_WR_PROT_ERR		BIT(5)	/* write protection */
    61	#define SF_SPI_ERROR_CLEARALL	(SF_MASLOCK_ERR | \
    62					 SF_PCMD_ACC_ERR | \
    63					 SF_PCMD_OP_ERR | \
    64					 SF_PWR_DWN_ACC_ERR | \
    65					 SF_MEM_REGION_ERR | \
    66					 SF_WR_PROT_ERR)
    67	
    68	#define SF_SPI_MEM_0_SR_ACC	0x100	/* status read from chip 0 */
    69	#define SF_SPI_MEM_1_SR_ACC	0x110	/* status read from chip 1 */
    70	#define SF_SPI_MEM_SR_ACC(x)	(0x100 + 0x10 * (x))
    71	
    72	#define SF_SPI_PDWN_CTR_0	0x180	/* power down chip 0 */
    73	#define SF_SPI_PDWN_CTR_1	0x190	/* power down chip 1 */
    74	#define SF_SPI_PDWN_CTR_(x)	(0x180 + 0x10 * (x))
    75	#define SF_PWR_DOWN		BIT(0)
    76	
    77	#define SF_SPI_PROG_CMD_CTR	0x200	/* programmable cmd control */
    78	#define SF_PROG_CMD_EN		BIT(0)	/* enable programmable cmd */
    79	#define SF_PROG_CMD_CS		GENMASK(1, 1)	/* chip select for cmd */
    80	#define SF_RX_DATA_SIZE		GENMASK(22, 16)	/* receive data size */
    81	#define SF_TX_DATA_SIZE		GENMASK(30, 24)	/* transmit data size */
    82	
    83	#define SF_SPI_USER_CMD_VAL	0x210
    84	#define SF_USR_RD_CMD		GENMASK(7, 0)	/* user read command */
    85	#define SF_USR_WR_CMD		GENMASK(23, 16)	/* user write command */
    86	
    87	#define SF_SPI_PROG_CMD_WBF	0x300	/* 64 bytes pcmd write buffer */
    88	#define SF_SPI_PROG_CMD_RBF	0x380	/* 64 bytes pcmd read buffer */
    89	
    90	#define SF_WAIT_TIMEOUT		1000000
    91	
    92	struct wmt_sflash_priv {
    93		size_t			cs;
    94		struct wmt_sflash_host	*host;
    95		void __iomem		*mmap_base;
    96		resource_size_t		mmap_phys;
    97	};
    98	
    99	#define SF_MAX_CHIP_NUM		2
   100	struct wmt_sflash_host {
   101		struct device		*dev;
   102		struct clk		*clk;
   103	
   104		void __iomem		*regbase;
   105		struct resource		*mmap_res[SF_MAX_CHIP_NUM];
   106	
   107		struct spi_nor		*nor[SF_MAX_CHIP_NUM];
   108		size_t			num_chips;
   109	};
   110	
   111	static int wmt_sflash_prep(struct spi_nor *nor)
   112	{
   113		struct wmt_sflash_priv *priv = nor->priv;
   114		struct wmt_sflash_host *host = priv->host;
   115	
   116		return clk_prepare_enable(host->clk);
   117	}
   118	
   119	static void wmt_sflash_unprep(struct spi_nor *nor)
   120	{
   121		struct wmt_sflash_priv *priv = nor->priv;
   122		struct wmt_sflash_host *host = priv->host;
   123	
   124		clk_disable_unprepare(host->clk);
   125	}
   126	
   127	static void wmt_sflash_pcmd_mode(struct wmt_sflash_host *host, bool enable)
   128	{
   129		u32 reg = readl(host->regbase + SF_SPI_INTF_CFG);
   130	
   131		reg &= ~SF_PROG_CMD_MOD;
   132		reg |= FIELD_PREP(SF_PROG_CMD_MOD, enable);
   133		writel(reg, host->regbase + SF_SPI_INTF_CFG);
   134	}
   135	
   136	static inline int wmt_sflash_wait_pcmd(struct wmt_sflash_host *host)
   137	{
   138		u32 reg;
   139	
   140		return readl_poll_timeout(host->regbase + SF_SPI_PROG_CMD_CTR, reg,
   141			!(reg & SF_PROG_CMD_EN), 1, SF_WAIT_TIMEOUT);
   142	}
   143	
   144	static int wmt_sflash_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf,
   145				       size_t len)
   146	{
   147		struct wmt_sflash_priv *priv = nor->priv;
   148		struct wmt_sflash_host *host = priv->host;
   149		int ret;
   150		u32 reg;
   151	
   152		if (len > 64) {
   153			dev_err(host->dev,
 > 154			"Cannot read %d bytes from registers\n", len);
   155			return -EINVAL;
   156		}
   157	
   158		wmt_sflash_pcmd_mode(host, true);
   159		writeb(opcode, host->regbase + SF_SPI_PROG_CMD_WBF);
   160	
   161		reg = SF_PROG_CMD_EN |
   162		      FIELD_PREP(SF_PROG_CMD_CS, priv->cs) |
   163		      FIELD_PREP(SF_TX_DATA_SIZE, 1) |
   164		      FIELD_PREP(SF_RX_DATA_SIZE, len);
   165		writel(reg, host->regbase + SF_SPI_PROG_CMD_CTR);
   166	
   167		ret = wmt_sflash_wait_pcmd(host);
   168	
   169		if (len)
   170			memcpy_fromio(buf, host->regbase + SF_SPI_PROG_CMD_RBF, len);
   171	
   172		wmt_sflash_pcmd_mode(host, false);
   173	
   174		return ret;
   175	}
   176	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Alexey Charkov <alchark@gmail.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Tudor Ambarus <tudor.ambarus@linaro.org>,
	Pratyush Yadav <pratyush@kernel.org>,
	Michael Walle <mwalle@kernel.org>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-spi@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	Alexey Charkov <alchark@gmail.com>
Subject: Re: [PATCH 2/3] mtd: spi-nor: Add a driver for the VIA/WonderMedia serial flash controller
Date: Sun, 11 May 2025 20:16:20 +0800	[thread overview]
Message-ID: <202505112028.FOL7oTti-lkp@intel.com> (raw)
In-Reply-To: <20250510-wmt-sflash-v1-2-02a1ac6adf12@gmail.com>

Hi Alexey,

kernel test robot noticed the following build warnings:

[auto build test WARNING on ed61cb3d78d585209ec775933078e268544fe9a4]

url:    https://github.com/intel-lab-lkp/linux/commits/Alexey-Charkov/dt-bindings-spi-Add-VIA-WonderMedia-serial-flash-controller/20250511-034459
base:   ed61cb3d78d585209ec775933078e268544fe9a4
patch link:    https://lore.kernel.org/r/20250510-wmt-sflash-v1-2-02a1ac6adf12%40gmail.com
patch subject: [PATCH 2/3] mtd: spi-nor: Add a driver for the VIA/WonderMedia serial flash controller
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20250511/202505112028.FOL7oTti-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250511/202505112028.FOL7oTti-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505112028.FOL7oTti-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/mtd/mtd.h:13,
                    from drivers/mtd/spi-nor/controllers/wmt-sflash.c:14:
   drivers/mtd/spi-nor/controllers/wmt-sflash.c: In function 'wmt_sflash_read_reg':
>> drivers/mtd/spi-nor/controllers/wmt-sflash.c:154:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     154 |                 "Cannot read %d bytes from registers\n", len);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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:154:56: note: in expansion of macro 'dev_fmt'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:153:17: note: in expansion of macro 'dev_err'
     153 |                 dev_err(host->dev,
         |                 ^~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:154:31: note: format string is defined here
     154 |                 "Cannot read %d bytes from registers\n", len);
         |                              ~^
         |                               |
         |                               int
         |                              %ld
   drivers/mtd/spi-nor/controllers/wmt-sflash.c: In function 'wmt_sflash_write_reg':
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:187:17: warning: format '%d' expects argument of type 'int', but argument 3 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     187 |                 "Cannot write %d bytes to registers\n", len);
         |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   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:154:56: note: in expansion of macro 'dev_fmt'
     154 |         dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                        ^~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:186:17: note: in expansion of macro 'dev_err'
     186 |                 dev_err(host->dev,
         |                 ^~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:187:32: note: format string is defined here
     187 |                 "Cannot write %d bytes to registers\n", len);
         |                               ~^
         |                                |
         |                                int
         |                               %ld
   drivers/mtd/spi-nor/controllers/wmt-sflash.c: In function 'wmt_sflash_register':
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:365:47: error: passing argument 3 of 'of_property_read_u32' from incompatible pointer type [-Wincompatible-pointer-types]
     365 |         ret = of_property_read_u32(np, "reg", &priv->cs);
         |                                               ^~~~~~~~~
         |                                               |
         |                                               size_t * {aka long unsigned int *}
   In file included from include/linux/mtd/mtd.h:14:
   include/linux/of.h:1419:45: note: expected 'u32 *' {aka 'unsigned int *'} but argument is of type 'size_t *' {aka 'long unsigned int *'}
    1419 |                                        u32 *out_value)
         |                                        ~~~~~^~~~~~~~~
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:373:52: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     373 |                                      "Chip select %d is out of bounds\n",
         |                                                   ~^
         |                                                    |
         |                                                    int
         |                                                   %ld
     374 |                                      priv->cs);
         |                                      ~~~~~~~~       
         |                                          |
         |                                          size_t {aka long unsigned int}
   drivers/mtd/spi-nor/controllers/wmt-sflash.c:394:46: warning: format '%d' expects argument of type 'int', but argument 4 has type 'size_t' {aka 'long unsigned int'} [-Wformat=]
     394 |                         "Failed to map chip %d at address 0x%x size 0x%llx\n",
         |                                             ~^
         |                                              |
         |                                              int
         |                                             %ld
     395 |                         priv->cs, priv->mmap_phys, mtd->size);
         |                         ~~~~~~~~              
         |                             |
         |                             size_t {aka long unsigned int}
>> drivers/mtd/spi-nor/controllers/wmt-sflash.c:394:62: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'resource_size_t' {aka 'long long unsigned int'} [-Wformat=]
     394 |                         "Failed to map chip %d at address 0x%x size 0x%llx\n",
         |                                                             ~^
         |                                                              |
         |                                                              unsigned int
         |                                                             %llx
     395 |                         priv->cs, priv->mmap_phys, mtd->size);
         |                                   ~~~~~~~~~~~~~~~             
         |                                       |
         |                                       resource_size_t {aka long long unsigned int}


vim +154 drivers/mtd/spi-nor/controllers/wmt-sflash.c

  > 14	#include <linux/mtd/mtd.h>
    15	#include <linux/mtd/spi-nor.h>
    16	#include <linux/of.h>
    17	#include <linux/platform_device.h>
    18	#include <linux/slab.h>
    19	
    20	#define SF_CHIP_SEL_0_CFG	0x000		/* chip select 0 config */
    21	#define SF_CHIP_SEL_1_CFG	0x008		/* chip select 0 config */
    22	#define SF_CHIP_SEL_CFG(x)	(8 * (x))
    23	#define SF_CHIP_SEL_ADDR	GENMASK(31, 16) /* 64kb aligned address */
    24	#define SF_CHIP_SEL_SIZE	GENMASK(11, 8)	/* log2(size/32kb) */
    25	
    26	#define SF_SPI_INTF_CFG		0x040	/* SPI interface config */
    27	#define SF_ADDR_WIDTH_32	BIT(0)	/* 0: 24 bit, 1: 32 bit addr */
    28	#define SF_USR_RD_CMD_MOD	BIT(4)	/* 0: normal, 1: user cmd read */
    29	#define SF_USR_WR_CMD_MOD	BIT(5)	/* 0: normal, 1: user cmd write */
    30	#define SF_PROG_CMD_MOD		BIT(6)	/* 0: normal, 1: prog cmd */
    31	#define SF_CS_DELAY		GENMASK(18, 16)	/* chip select delay */
    32	#define SF_RES_DELAY		GENMASK(27, 24) /* reset delay */
    33	#define SF_PDWN_DELAY		GENMASK(31, 28) /* power down delay */
    34	
    35	#define SF_SPI_RD_WR_CTR	0x050	/* read/write control */
    36	#define SF_RD_FAST		BIT(0)	/* 0: normal read, 1: fast read */
    37	#define SF_RD_ID		BIT(4)	/* 0: read status, 1: read ID */
    38	
    39	#define SF_SPI_WR_EN_CTR	0x060	/* write enable control */
    40	#define SF_CS0_WR_EN		BIT(0)
    41	#define SF_CS1_WR_EN		BIT(1)
    42	#define SF_CS_WR_EN(x)		BIT(x)
    43	
    44	#define SF_SPI_ER_CTR		0x070	/* erase control */
    45	#define SF_CHIP_ERASE		BIT(0)	/* full chip erase */
    46	#define SF_SEC_ERASE		BIT(15)	/* sector erase */
    47	
    48	#define SF_SPI_ER_START_ADDR	0x074	/* erase start address */
    49	#define SF_CHIP_ER_CS0		BIT(0)	/* erase chip 0 */
    50	#define SF_CHIP_ER_CS1		BIT(1)	/* erase chip 1 */
    51	#define SF_CHIP_ER_CS(x)	BIT(x)
    52	#define SF_ER_START_ADDR	GENMASK(31, 16)
    53	
    54	#define SF_SPI_ERROR_STATUS	0x080
    55	#define SF_MASLOCK_ERR		BIT(0)	/* master lock */
    56	#define SF_PCMD_ACC_ERR		BIT(1)	/* programmable cmd access */
    57	#define SF_PCMD_OP_ERR		BIT(2)	/* programmable cmd opcode */
    58	#define SF_PWR_DWN_ACC_ERR	BIT(3)	/* power down access */
    59	#define SF_MEM_REGION_ERR	BIT(4)	/* memory region */
    60	#define SF_WR_PROT_ERR		BIT(5)	/* write protection */
    61	#define SF_SPI_ERROR_CLEARALL	(SF_MASLOCK_ERR | \
    62					 SF_PCMD_ACC_ERR | \
    63					 SF_PCMD_OP_ERR | \
    64					 SF_PWR_DWN_ACC_ERR | \
    65					 SF_MEM_REGION_ERR | \
    66					 SF_WR_PROT_ERR)
    67	
    68	#define SF_SPI_MEM_0_SR_ACC	0x100	/* status read from chip 0 */
    69	#define SF_SPI_MEM_1_SR_ACC	0x110	/* status read from chip 1 */
    70	#define SF_SPI_MEM_SR_ACC(x)	(0x100 + 0x10 * (x))
    71	
    72	#define SF_SPI_PDWN_CTR_0	0x180	/* power down chip 0 */
    73	#define SF_SPI_PDWN_CTR_1	0x190	/* power down chip 1 */
    74	#define SF_SPI_PDWN_CTR_(x)	(0x180 + 0x10 * (x))
    75	#define SF_PWR_DOWN		BIT(0)
    76	
    77	#define SF_SPI_PROG_CMD_CTR	0x200	/* programmable cmd control */
    78	#define SF_PROG_CMD_EN		BIT(0)	/* enable programmable cmd */
    79	#define SF_PROG_CMD_CS		GENMASK(1, 1)	/* chip select for cmd */
    80	#define SF_RX_DATA_SIZE		GENMASK(22, 16)	/* receive data size */
    81	#define SF_TX_DATA_SIZE		GENMASK(30, 24)	/* transmit data size */
    82	
    83	#define SF_SPI_USER_CMD_VAL	0x210
    84	#define SF_USR_RD_CMD		GENMASK(7, 0)	/* user read command */
    85	#define SF_USR_WR_CMD		GENMASK(23, 16)	/* user write command */
    86	
    87	#define SF_SPI_PROG_CMD_WBF	0x300	/* 64 bytes pcmd write buffer */
    88	#define SF_SPI_PROG_CMD_RBF	0x380	/* 64 bytes pcmd read buffer */
    89	
    90	#define SF_WAIT_TIMEOUT		1000000
    91	
    92	struct wmt_sflash_priv {
    93		size_t			cs;
    94		struct wmt_sflash_host	*host;
    95		void __iomem		*mmap_base;
    96		resource_size_t		mmap_phys;
    97	};
    98	
    99	#define SF_MAX_CHIP_NUM		2
   100	struct wmt_sflash_host {
   101		struct device		*dev;
   102		struct clk		*clk;
   103	
   104		void __iomem		*regbase;
   105		struct resource		*mmap_res[SF_MAX_CHIP_NUM];
   106	
   107		struct spi_nor		*nor[SF_MAX_CHIP_NUM];
   108		size_t			num_chips;
   109	};
   110	
   111	static int wmt_sflash_prep(struct spi_nor *nor)
   112	{
   113		struct wmt_sflash_priv *priv = nor->priv;
   114		struct wmt_sflash_host *host = priv->host;
   115	
   116		return clk_prepare_enable(host->clk);
   117	}
   118	
   119	static void wmt_sflash_unprep(struct spi_nor *nor)
   120	{
   121		struct wmt_sflash_priv *priv = nor->priv;
   122		struct wmt_sflash_host *host = priv->host;
   123	
   124		clk_disable_unprepare(host->clk);
   125	}
   126	
   127	static void wmt_sflash_pcmd_mode(struct wmt_sflash_host *host, bool enable)
   128	{
   129		u32 reg = readl(host->regbase + SF_SPI_INTF_CFG);
   130	
   131		reg &= ~SF_PROG_CMD_MOD;
   132		reg |= FIELD_PREP(SF_PROG_CMD_MOD, enable);
   133		writel(reg, host->regbase + SF_SPI_INTF_CFG);
   134	}
   135	
   136	static inline int wmt_sflash_wait_pcmd(struct wmt_sflash_host *host)
   137	{
   138		u32 reg;
   139	
   140		return readl_poll_timeout(host->regbase + SF_SPI_PROG_CMD_CTR, reg,
   141			!(reg & SF_PROG_CMD_EN), 1, SF_WAIT_TIMEOUT);
   142	}
   143	
   144	static int wmt_sflash_read_reg(struct spi_nor *nor, u8 opcode, u8 *buf,
   145				       size_t len)
   146	{
   147		struct wmt_sflash_priv *priv = nor->priv;
   148		struct wmt_sflash_host *host = priv->host;
   149		int ret;
   150		u32 reg;
   151	
   152		if (len > 64) {
   153			dev_err(host->dev,
 > 154			"Cannot read %d bytes from registers\n", len);
   155			return -EINVAL;
   156		}
   157	
   158		wmt_sflash_pcmd_mode(host, true);
   159		writeb(opcode, host->regbase + SF_SPI_PROG_CMD_WBF);
   160	
   161		reg = SF_PROG_CMD_EN |
   162		      FIELD_PREP(SF_PROG_CMD_CS, priv->cs) |
   163		      FIELD_PREP(SF_TX_DATA_SIZE, 1) |
   164		      FIELD_PREP(SF_RX_DATA_SIZE, len);
   165		writel(reg, host->regbase + SF_SPI_PROG_CMD_CTR);
   166	
   167		ret = wmt_sflash_wait_pcmd(host);
   168	
   169		if (len)
   170			memcpy_fromio(buf, host->regbase + SF_SPI_PROG_CMD_RBF, len);
   171	
   172		wmt_sflash_pcmd_mode(host, false);
   173	
   174		return ret;
   175	}
   176	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2025-05-11 12:18 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-10 19:42 [PATCH 0/3] mtd: spi-nor: Add VIA/WonderMedia serial flash controller driver Alexey Charkov
2025-05-10 19:42 ` Alexey Charkov
2025-05-10 19:42 ` [PATCH 1/3] dt-bindings: spi: Add VIA/WonderMedia serial flash controller Alexey Charkov
2025-05-10 19:42   ` Alexey Charkov
2025-05-14 20:41   ` Rob Herring
2025-05-14 20:41     ` Rob Herring
2025-05-15 19:50     ` Alexey Charkov
2025-05-15 19:50       ` Alexey Charkov
2025-06-06  8:29       ` Krzysztof Kozlowski
2025-06-06  8:29         ` Krzysztof Kozlowski
2025-06-06  9:06         ` Alexey Charkov
2025-06-06  9:06           ` Alexey Charkov
2025-06-09  9:07           ` Miquel Raynal
2025-06-09  9:07             ` Miquel Raynal
2025-06-09  9:15             ` Alexey Charkov
2025-06-09  9:15               ` Alexey Charkov
2025-05-10 19:42 ` [PATCH 2/3] mtd: spi-nor: Add a driver for the " Alexey Charkov
2025-05-10 19:42   ` Alexey Charkov
2025-05-11 11:13   ` kernel test robot
2025-05-11 11:13     ` kernel test robot
2025-05-11 12:16   ` kernel test robot [this message]
2025-05-11 12:16     ` kernel test robot
2025-05-12  9:20   ` Pratyush Yadav
2025-05-12  9:20     ` Pratyush Yadav
2025-05-12 17:50     ` Alexey Charkov
2025-05-12 17:50       ` Alexey Charkov
2025-07-24 13:51       ` Pratyush Yadav
2025-07-24 13:51         ` Pratyush Yadav
2025-07-28  7:09         ` Mika Westerberg
2025-07-28  7:09           ` Mika Westerberg
2025-05-10 19:42 ` [PATCH 3/3] ARM: dts: vt8500: Add serial flash controller and its clock Alexey Charkov
2025-05-10 19:42   ` Alexey Charkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202505112028.FOL7oTti-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=alchark@gmail.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mwalle@kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=robh@kernel.org \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.