All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 22/27] cmd: mtdparts: accept spi-nand devices
Date: Mon, 30 Jul 2018 17:46:52 +0200	[thread overview]
Message-ID: <20180730154657.20738-23-miquel.raynal@bootlin.com> (raw)
In-Reply-To: <20180730154657.20738-1-miquel.raynal@bootlin.com>

Let spi-nand devices be recognized by mtdparts. This is superfluous
but a full mtdparts rework would be very time-consuming.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Jagan Teki <jagan@openedev.com>
---
 cmd/mtdparts.c              | 13 ++++++++-----
 include/jffs2/load_kernel.h |  7 +++++--
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 0da3afd75f..f26a761c99 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -37,7 +37,7 @@
  * mtdids=<idmap>[,<idmap>,...]
  *
  * <idmap>    := <dev-id>=<mtd-id>
- * <dev-id>   := 'nand'|'nor'|'onenand'<dev-num>
+ * <dev-id>   := 'nand'|'nor'|'onenand'|'spi-nand'<dev-num>
  * <dev-num>  := mtd device number, 0...
  * <mtd-id>   := unique device tag used by linux kernel to find mtd device (mtd->name)
  *
@@ -336,7 +336,7 @@ static int part_validate_eraseblock(struct mtdids *id, struct part_info *part)
 
 	if (!mtd->numeraseregions) {
 		/*
-		 * Only one eraseregion (NAND, OneNAND or uniform NOR),
+		 * Only one eraseregion (NAND, SPI-NAND, OneNAND or uniform NOR),
 		 * checking for alignment is easy here
 		 */
 		offset = part->offset;
@@ -1027,7 +1027,7 @@ static struct mtdids* id_find_by_mtd_id(const char *mtd_id, unsigned int mtd_id_
 }
 
 /**
- * Parse device id string <dev-id> := 'nand'|'nor'|'onenand'<dev-num>,
+ * Parse device id string <dev-id> := 'nand'|'nor'|'onenand'|'spi-nand'<dev-num>,
  * return device type and number.
  *
  * @param id string describing device id
@@ -1051,6 +1051,9 @@ int mtd_id_parse(const char *id, const char **ret_id, u8 *dev_type,
 	} else if (strncmp(p, "onenand", 7) == 0) {
 		*dev_type = MTD_DEV_TYPE_ONENAND;
 		p += 7;
+	} else if (strncmp(p, "spi-nand", 8) == 0) {
+		*dev_type = MTD_DEV_TYPE_SPINAND;
+		p += 8;
 	} else {
 		printf("incorrect device type in %s\n", id);
 		return 1;
@@ -1633,7 +1636,7 @@ static int parse_mtdids(const char *const ids)
 	while(p && (*p != '\0')) {
 
 		ret = 1;
-		/* parse 'nor'|'nand'|'onenand'<dev-num> */
+		/* parse 'nor'|'nand'|'onenand'|'spi-nand'<dev-num> */
 		if (mtd_id_parse(p, &p, &type, &num) != 0)
 			break;
 
@@ -2109,7 +2112,7 @@ static char mtdparts_help_text[] =
 	"'mtdids' - linux kernel mtd device id <-> u-boot device id mapping\n\n"
 	"mtdids=<idmap>[,<idmap>,...]\n\n"
 	"<idmap>    := <dev-id>=<mtd-id>\n"
-	"<dev-id>   := 'nand'|'nor'|'onenand'<dev-num>\n"
+	"<dev-id>   := 'nand'|'nor'|'onenand'|'spi-nand'<dev-num>\n"
 	"<dev-num>  := mtd device number, 0...\n"
 	"<mtd-id>   := unique device tag used by linux kernel to find mtd device (mtd->name)\n\n"
 	"'mtdparts' - partition list\n\n"
diff --git a/include/jffs2/load_kernel.h b/include/jffs2/load_kernel.h
index 1ddff062ad..9346d7ee9f 100644
--- a/include/jffs2/load_kernel.h
+++ b/include/jffs2/load_kernel.h
@@ -15,9 +15,12 @@
 #define MTD_DEV_TYPE_NOR	0x0001
 #define MTD_DEV_TYPE_NAND	0x0002
 #define MTD_DEV_TYPE_ONENAND	0x0004
+#define MTD_DEV_TYPE_SPINAND	0x0008
 
-#define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" :	\
-			(type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor")
+#define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" :	\
+			    (type == MTD_DEV_TYPE_NOR ? "nor" :		\
+			     (type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
+			      "spi-nand")))				\
 
 struct mtd_device {
 	struct list_head link;
-- 
2.14.1

  parent reply	other threads:[~2018-07-30 15:46 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30 15:46 [U-Boot] [PATCH v5 00/27] SPI-NAND support Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 01/27] mtd: Fallback to ->_read/write_oob() when ->_read/write() is missing Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 02/27] mtd: Uninline mtd_write_oob and move it to mtdcore.c Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 03/27] mtd: Add sanity checks in mtd_write/read_oob() Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 04/27] mtd: Fallback to ->_read/write() when ->_read/write_oob() is missing Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 05/27] mtd: add get/set of_node/flash_node helpers Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 06/27] mtd: fix build issue with includes Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 07/27] mtd: move definitions to enlarge their range Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 08/27] mtd: move all flash categories inside MTD submenu Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 09/27] mtd: move NAND files into a raw/ subdirectory Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 10/27] mtd: rename nand into rawnand in Kconfig prompt Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 11/27] mtd: nand: Add core infrastructure to deal with NAND devices Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 12/27] mtd: nand: Pass mode information to nand_page_io_req Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 13/27] spi: Extend the core to ease integration of SPI memory controllers Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 14/27] mtd: nand: Add core infrastructure to support SPI NANDs Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 15/27] mtd: spinand: Add initial support for Micron MT29F2G01ABAGD Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 16/27] mtd: spinand: Add initial support for Winbond W25M02GV Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 17/27] mtd: spinand: Add initial support for the MX35LF1GE4AB chip Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 18/27] mtd: spinand: Add initial support for the MX35LF2GE4AB chip Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 19/27] dt-bindings: Add bindings for SPI NAND devices Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 20/27] mtd: declare MTD_PARTITIONS symbol in Kconfig Miquel Raynal
2018-07-31  7:24   ` Jagan Teki
2018-07-30 15:46 ` [U-Boot] [PATCH v5 21/27] cmd: ubi: delete useless and misleading definitions Miquel Raynal
2018-07-31  7:25   ` Jagan Teki
2018-07-30 15:46 ` Miquel Raynal [this message]
2018-07-30 15:46 ` [U-Boot] [PATCH v5 23/27] cmd: mtdparts: add a generic 'mtdparts' parser Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 24/27] cmd: mtdparts: remove useless 'mtdparts=' prefix Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 25/27] mtd: uclass: add probe function Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 26/27] cmd: mtd: add 'mtd' command Miquel Raynal
2018-07-30 15:46 ` [U-Boot] [PATCH v5 27/27] cmd: mtdparts: try to probe the MTD devices as a fallback Miquel Raynal
2018-07-31  7:29 ` [U-Boot] [PATCH v5 00/27] SPI-NAND support Jagan Teki
2018-07-31 14:33   ` Jagan Teki
2018-07-31 19:25     ` Boris Brezillon
2018-07-31 19:48       ` Boris Brezillon
2018-08-01  6:25       ` Jagan Teki
2018-08-01  8:14         ` Miquel Raynal

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=20180730154657.20738-23-miquel.raynal@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=u-boot@lists.denx.de \
    /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.