linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
diff for duplicates of <202205132220.uRTFaqNA-lkp@intel.com>

diff --git a/a/1.txt b/N1/1.txt
index dff0937..cee3fb5 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -1,71 +1,114 @@
-Hi Michael,
+> Our SFDP is parsing is everything we need to support all basic operations of
+> a flash device. If the flash isn't found in our in-kernel flash database,
+> gracefully fall back to a driver described solely by its SFDP tables.
+> 
+> It is still recommended to add the flash to the in-kernel database.
+> First, we get a proper partname and secondly, for all features not described
+> by the SFDP like OTP we need the entry anyway.
+> 
+> Signed-off-by: Michael Walle <michael@walle.cc>
+> ---
+>  drivers/mtd/spi-nor/core.c | 13 +++++++++++++  drivers/mtd/spi-nor/core.h |
+> 1 +  drivers/mtd/spi-nor/sfdp.c | 27 +++++++++++++++++++++++++++
+>  3 files changed, 41 insertions(+)
+> 
+> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index
+> 65cd8e668579..ee193a61310a 100644
+> --- a/drivers/mtd/spi-nor/core.c
+> +++ b/drivers/mtd/spi-nor/core.c
+> @@ -1632,6 +1632,11 @@ static const struct spi_nor_manufacturer
+> *manufacturers[] = {
+>  	&spi_nor_xmc,
+>  };
+> 
+> +static const struct flash_info spi_nor_generic_flash = {
+> +	.name = "spi-nor-generic",
+> +	.parse_sfdp = true,
+> +};
+> +
+>  static const struct flash_info *spi_nor_match_id(struct spi_nor *nor,
+>  						 const u8 *id)
+>  {
+> @@ -1670,6 +1675,14 @@ static const struct flash_info *spi_nor_detect(struct
+> spi_nor *nor)
+>  		return ERR_PTR(-ENOMEM);
+> 
+>  	info = spi_nor_match_id(nor, id);
+> +
+> +	/* Fallback to a generic flash described only by its SFDP data. */
+> +	if (!info) {
+> +		ret = spi_nor_check_sfdp_signature(nor);
+> +		if (!ret)
+> +			info = &spi_nor_generic_flash;
+> +	}
 
-I love your patch! Perhaps something to improve:
+May be this can be combined as
 
-[auto build test WARNING on mtd/spi-nor/next]
-[also build test WARNING on next-20220513]
-[cannot apply to linux/master linus/master v5.18-rc6]
-[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]
+ 	if (!info && (!spi_nor_check_sfdp_signature(nor)))
+		info = &spi_nor_generic_flash;
 
-url:    https://github.com/intel-lab-lkp/linux/commits/Michael-Walle/mtd-spi-nor-generic-flash-driver/20220513-214238
-base:   https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git spi-nor/next
-config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220513/202205132220.uRTFaqNA-lkp@intel.com/config)
-compiler: m68k-linux-gcc (GCC) 11.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
-        # https://github.com/intel-lab-lkp/linux/commit/d38c0ac1528d85bea65fc5a9e7f61a10dbc051fb
-        git remote add linux-review https://github.com/intel-lab-lkp/linux
-        git fetch --no-tags linux-review Michael-Walle/mtd-spi-nor-generic-flash-driver/20220513-214238
-        git checkout d38c0ac1528d85bea65fc5a9e7f61a10dbc051fb
-        # save the config file
-        mkdir build_dir && cp config build_dir/.config
-        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/mtd/spi-nor/
+Cheers,
+Biju
 
-If you fix the issue, kindly add following tag as appropriate
-Reported-by: kernel test robot <lkp@intel.com>
+>  	if (!info) {
+>  		dev_err(nor->dev, "unrecognized JEDEC id bytes: %*ph\n",
+>  			SPI_NOR_MAX_ID_LEN, id);
+> diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index
+> 153cb4b174ee..b084cb6db401 100644
+> --- a/drivers/mtd/spi-nor/core.h
+> +++ b/drivers/mtd/spi-nor/core.h
+> @@ -703,6 +703,7 @@ int spi_nor_controller_ops_read_reg(struct spi_nor *nor,
+> u8 opcode,  int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8
+> opcode,
+>  				     const u8 *buf, size_t len);
+> 
+> +int spi_nor_check_sfdp_signature(struct spi_nor *nor);
+>  int spi_nor_parse_sfdp(struct spi_nor *nor);
+> 
+>  static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd) diff --
+> git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index
+> a5211543d30d..9bdb3d5dc7e8 100644
+> --- a/drivers/mtd/spi-nor/sfdp.c
+> +++ b/drivers/mtd/spi-nor/sfdp.c
+> @@ -1247,6 +1247,33 @@ static void spi_nor_post_sfdp_fixups(struct spi_nor
+> *nor)
+>  		nor->info->fixups->post_sfdp(nor);
+>  }
+> 
+> +/**
+> + * spi_nor_check_sfdp_header() - check for a valid SFDP header
+> + * @nor:		pointer to a 'struct spi_nor'
+> + *
+> + * Used to detect if the flash supports the RDSFDP command as well as
+> +the
+> + * presence of a valid SFDP table.
+> + *
+> + * Return: 0 on success, -errno otherwise.
+> + */
+> +int spi_nor_check_sfdp_signature(struct spi_nor *nor) {
+> +	u32 signature;
+> +	int err;
+> +
+> +	/* Get the SFDP header. */
+> +	err = spi_nor_read_sfdp_dma_unsafe(nor, 0, sizeof(signature),
+> +					   &signature);
+> +	if (err < 0)
+> +		return err;
+> +
+> +	/* Check the SFDP signature. */
+> +	if (le32_to_cpu(signature) != SFDP_SIGNATURE)
+> +		return -EINVAL;
+> +
+> +	return 0;
+> +}
+> +
+>  /**
+>   * spi_nor_parse_sfdp() - parse the Serial Flash Discoverable Parameters.
+>   * @nor:		pointer to a 'struct spi_nor'
+> --
+> 2.25.1
 
-All warnings (new ones prefixed by >>):
 
->> drivers/mtd/spi-nor/sfdp.c:1260: warning: expecting prototype for spi_nor_check_sfdp_header(). Prototype was for spi_nor_check_sfdp_signature() instead
-
-
-vim +1260 drivers/mtd/spi-nor/sfdp.c
-
-  1249	
-  1250	/**
-  1251	 * spi_nor_check_sfdp_header() - check for a valid SFDP header
-  1252	 * @nor:		pointer to a 'struct spi_nor'
-  1253	 *
-  1254	 * Used to detect if the flash supports the RDSFDP command as well as the
-  1255	 * presence of a valid SFDP table.
-  1256	 *
-  1257	 * Return: 0 on success, -errno otherwise.
-  1258	 */
-  1259	int spi_nor_check_sfdp_signature(struct spi_nor *nor)
-> 1260	{
-  1261		u32 signature;
-  1262		int err;
-  1263	
-  1264		/* Get the SFDP header. */
-  1265		err = spi_nor_read_sfdp_dma_unsafe(nor, 0, sizeof(signature),
-  1266						   &signature);
-  1267		if (err < 0)
-  1268			return err;
-  1269	
-  1270		/* Check the SFDP signature. */
-  1271		if (le32_to_cpu(signature) != SFDP_SIGNATURE)
-  1272			return -EINVAL;
-  1273	
-  1274		return 0;
-  1275	}
-  1276	
-
--- 
-0-DAY CI Kernel Test Service
-https://01.org/lkp
 
 ______________________________________________________
 Linux MTD discussion mailing list
diff --git a/a/content_digest b/N1/content_digest
index 9103f4a..c6ef93a 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -2,26 +2,25 @@
   "ref\00020220513133520.3945820-6-michael\@walle.cc\0"
 ]
 [
-  "From\0kernel test robot <lkp\@intel.com>\0"
+  "From\0Biju Das <biju.das.jz\@bp.renesas.com>\0"
 ]
 [
   "Subject\0Re: [PATCH 5/6] mtd: spi-nor: add generic flash driver\0"
 ]
 [
-  "Date\0Fri, 13 May 2022 22:47:10 +0800\0"
+  "Date\0Thu, 21 Jul 2022 10:32:16 +0100\0"
 ]
 [
-  "To\0Michael Walle <michael\@walle.cc>",
-  " Tudor Ambarus <tudor.ambarus\@microchip.com>",
-  " Pratyush Yadav <p.yadav\@ti.com>",
-  " Miquel Raynal <miquel.raynal\@bootlin.com>",
-  " Richard Weinberger <richard\@nod.at>",
-  " Vignesh Raghavendra <vigneshr\@ti.com>\0"
+  "To\0michael\@walle.cc\0"
 ]
 [
-  "Cc\0kbuild-all\@lists.01.org",
-  " linux-kernel\@vger.kernel.org",
-  " linux-mtd\@lists.infradead.org\0"
+  "Cc\0linux-kernel\@vger.kernel.org",
+  " linux-mtd\@lists.infradead.org",
+  " miquel.raynal\@bootlin.com",
+  " p.yadav\@ti.com",
+  " richard\@nod.at",
+  " tudor.ambarus\@microchip.com",
+  " vigneshr\@ti.com\0"
 ]
 [
   "\0000:1\0"
@@ -30,78 +29,121 @@
   "b\0"
 ]
 [
-  "Hi Michael,\n",
+  "> Our SFDP is parsing is everything we need to support all basic operations of\n",
+  "> a flash device. If the flash isn't found in our in-kernel flash database,\n",
+  "> gracefully fall back to a driver described solely by its SFDP tables.\n",
+  "> \n",
+  "> It is still recommended to add the flash to the in-kernel database.\n",
+  "> First, we get a proper partname and secondly, for all features not described\n",
+  "> by the SFDP like OTP we need the entry anyway.\n",
+  "> \n",
+  "> Signed-off-by: Michael Walle <michael\@walle.cc>\n",
+  "> ---\n",
+  ">  drivers/mtd/spi-nor/core.c | 13 +++++++++++++  drivers/mtd/spi-nor/core.h |\n",
+  "> 1 +  drivers/mtd/spi-nor/sfdp.c | 27 +++++++++++++++++++++++++++\n",
+  ">  3 files changed, 41 insertions(+)\n",
+  "> \n",
+  "> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index\n",
+  "> 65cd8e668579..ee193a61310a 100644\n",
+  "> --- a/drivers/mtd/spi-nor/core.c\n",
+  "> +++ b/drivers/mtd/spi-nor/core.c\n",
+  "> \@\@ -1632,6 +1632,11 \@\@ static const struct spi_nor_manufacturer\n",
+  "> *manufacturers[] = {\n",
+  ">  \t&spi_nor_xmc,\n",
+  ">  };\n",
+  "> \n",
+  "> +static const struct flash_info spi_nor_generic_flash = {\n",
+  "> +\t.name = \"spi-nor-generic\",\n",
+  "> +\t.parse_sfdp = true,\n",
+  "> +};\n",
+  "> +\n",
+  ">  static const struct flash_info *spi_nor_match_id(struct spi_nor *nor,\n",
+  ">  \t\t\t\t\t\t const u8 *id)\n",
+  ">  {\n",
+  "> \@\@ -1670,6 +1675,14 \@\@ static const struct flash_info *spi_nor_detect(struct\n",
+  "> spi_nor *nor)\n",
+  ">  \t\treturn ERR_PTR(-ENOMEM);\n",
+  "> \n",
+  ">  \tinfo = spi_nor_match_id(nor, id);\n",
+  "> +\n",
+  "> +\t/* Fallback to a generic flash described only by its SFDP data. */\n",
+  "> +\tif (!info) {\n",
+  "> +\t\tret = spi_nor_check_sfdp_signature(nor);\n",
+  "> +\t\tif (!ret)\n",
+  "> +\t\t\tinfo = &spi_nor_generic_flash;\n",
+  "> +\t}\n",
   "\n",
-  "I love your patch! Perhaps something to improve:\n",
+  "May be this can be combined as\n",
   "\n",
-  "[auto build test WARNING on mtd/spi-nor/next]\n",
-  "[also build test WARNING on next-20220513]\n",
-  "[cannot apply to linux/master linus/master v5.18-rc6]\n",
-  "[If your patch is applied to the wrong git tree, kindly drop us a note.\n",
-  "And when submitting patch, we suggest to use '--base' as documented in\n",
-  "https://git-scm.com/docs/git-format-patch]\n",
+  " \tif (!info && (!spi_nor_check_sfdp_signature(nor)))\n",
+  "\t\tinfo = &spi_nor_generic_flash;\n",
   "\n",
-  "url:    https://github.com/intel-lab-lkp/linux/commits/Michael-Walle/mtd-spi-nor-generic-flash-driver/20220513-214238\n",
-  "base:   https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git spi-nor/next\n",
-  "config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20220513/202205132220.uRTFaqNA-lkp\@intel.com/config)\n",
-  "compiler: m68k-linux-gcc (GCC) 11.3.0\n",
-  "reproduce (this is a W=1 build):\n",
-  "        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross\n",
-  "        chmod +x ~/bin/make.cross\n",
-  "        # https://github.com/intel-lab-lkp/linux/commit/d38c0ac1528d85bea65fc5a9e7f61a10dbc051fb\n",
-  "        git remote add linux-review https://github.com/intel-lab-lkp/linux\n",
-  "        git fetch --no-tags linux-review Michael-Walle/mtd-spi-nor-generic-flash-driver/20220513-214238\n",
-  "        git checkout d38c0ac1528d85bea65fc5a9e7f61a10dbc051fb\n",
-  "        # save the config file\n",
-  "        mkdir build_dir && cp config build_dir/.config\n",
-  "        COMPILER_INSTALL_PATH=\$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/mtd/spi-nor/\n",
+  "Cheers,\n",
+  "Biju\n",
   "\n",
-  "If you fix the issue, kindly add following tag as appropriate\n",
-  "Reported-by: kernel test robot <lkp\@intel.com>\n",
+  ">  \tif (!info) {\n",
+  ">  \t\tdev_err(nor->dev, \"unrecognized JEDEC id bytes: %*ph\\n\",\n",
+  ">  \t\t\tSPI_NOR_MAX_ID_LEN, id);\n",
+  "> diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index\n",
+  "> 153cb4b174ee..b084cb6db401 100644\n",
+  "> --- a/drivers/mtd/spi-nor/core.h\n",
+  "> +++ b/drivers/mtd/spi-nor/core.h\n",
+  "> \@\@ -703,6 +703,7 \@\@ int spi_nor_controller_ops_read_reg(struct spi_nor *nor,\n",
+  "> u8 opcode,  int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8\n",
+  "> opcode,\n",
+  ">  \t\t\t\t     const u8 *buf, size_t len);\n",
+  "> \n",
+  "> +int spi_nor_check_sfdp_signature(struct spi_nor *nor);\n",
+  ">  int spi_nor_parse_sfdp(struct spi_nor *nor);\n",
+  "> \n",
+  ">  static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd) diff --\n",
+  "> git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c index\n",
+  "> a5211543d30d..9bdb3d5dc7e8 100644\n",
+  "> --- a/drivers/mtd/spi-nor/sfdp.c\n",
+  "> +++ b/drivers/mtd/spi-nor/sfdp.c\n",
+  "> \@\@ -1247,6 +1247,33 \@\@ static void spi_nor_post_sfdp_fixups(struct spi_nor\n",
+  "> *nor)\n",
+  ">  \t\tnor->info->fixups->post_sfdp(nor);\n",
+  ">  }\n",
+  "> \n",
+  "> +/**\n",
+  "> + * spi_nor_check_sfdp_header() - check for a valid SFDP header\n",
+  "> + * \@nor:\t\tpointer to a 'struct spi_nor'\n",
+  "> + *\n",
+  "> + * Used to detect if the flash supports the RDSFDP command as well as\n",
+  "> +the\n",
+  "> + * presence of a valid SFDP table.\n",
+  "> + *\n",
+  "> + * Return: 0 on success, -errno otherwise.\n",
+  "> + */\n",
+  "> +int spi_nor_check_sfdp_signature(struct spi_nor *nor) {\n",
+  "> +\tu32 signature;\n",
+  "> +\tint err;\n",
+  "> +\n",
+  "> +\t/* Get the SFDP header. */\n",
+  "> +\terr = spi_nor_read_sfdp_dma_unsafe(nor, 0, sizeof(signature),\n",
+  "> +\t\t\t\t\t   &signature);\n",
+  "> +\tif (err < 0)\n",
+  "> +\t\treturn err;\n",
+  "> +\n",
+  "> +\t/* Check the SFDP signature. */\n",
+  "> +\tif (le32_to_cpu(signature) != SFDP_SIGNATURE)\n",
+  "> +\t\treturn -EINVAL;\n",
+  "> +\n",
+  "> +\treturn 0;\n",
+  "> +}\n",
+  "> +\n",
+  ">  /**\n",
+  ">   * spi_nor_parse_sfdp() - parse the Serial Flash Discoverable Parameters.\n",
+  ">   * \@nor:\t\tpointer to a 'struct spi_nor'\n",
+  "> --\n",
+  "> 2.25.1\n",
   "\n",
-  "All warnings (new ones prefixed by >>):\n",
   "\n",
-  ">> drivers/mtd/spi-nor/sfdp.c:1260: warning: expecting prototype for spi_nor_check_sfdp_header(). Prototype was for spi_nor_check_sfdp_signature() instead\n",
-  "\n",
-  "\n",
-  "vim +1260 drivers/mtd/spi-nor/sfdp.c\n",
-  "\n",
-  "  1249\t\n",
-  "  1250\t/**\n",
-  "  1251\t * spi_nor_check_sfdp_header() - check for a valid SFDP header\n",
-  "  1252\t * \@nor:\t\tpointer to a 'struct spi_nor'\n",
-  "  1253\t *\n",
-  "  1254\t * Used to detect if the flash supports the RDSFDP command as well as the\n",
-  "  1255\t * presence of a valid SFDP table.\n",
-  "  1256\t *\n",
-  "  1257\t * Return: 0 on success, -errno otherwise.\n",
-  "  1258\t */\n",
-  "  1259\tint spi_nor_check_sfdp_signature(struct spi_nor *nor)\n",
-  "> 1260\t{\n",
-  "  1261\t\tu32 signature;\n",
-  "  1262\t\tint err;\n",
-  "  1263\t\n",
-  "  1264\t\t/* Get the SFDP header. */\n",
-  "  1265\t\terr = spi_nor_read_sfdp_dma_unsafe(nor, 0, sizeof(signature),\n",
-  "  1266\t\t\t\t\t\t   &signature);\n",
-  "  1267\t\tif (err < 0)\n",
-  "  1268\t\t\treturn err;\n",
-  "  1269\t\n",
-  "  1270\t\t/* Check the SFDP signature. */\n",
-  "  1271\t\tif (le32_to_cpu(signature) != SFDP_SIGNATURE)\n",
-  "  1272\t\t\treturn -EINVAL;\n",
-  "  1273\t\n",
-  "  1274\t\treturn 0;\n",
-  "  1275\t}\n",
-  "  1276\t\n",
-  "\n",
-  "-- \n",
-  "0-DAY CI Kernel Test Service\n",
-  "https://01.org/lkp\n",
   "\n",
   "______________________________________________________\n",
   "Linux MTD discussion mailing list\n",
   "http://lists.infradead.org/mailman/listinfo/linux-mtd/"
 ]
 
-c160decceddecb8d88f7259313f42a03c0093ca62d67f3b82a1a9954be6f3ff1
+6635ffce30e425932d9a7476f274c327d375a3c10416fa3d38dae29bd2987792

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).