From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Brezillon Date: Thu, 16 Aug 2018 17:53:28 +0200 Subject: [U-Boot] [PATCH v6 24/31] cmd: mtdparts: accept spi-nand devices In-Reply-To: <20180816153029.15521-25-miquel.raynal@bootlin.com> References: <20180816153029.15521-1-miquel.raynal@bootlin.com> <20180816153029.15521-25-miquel.raynal@bootlin.com> Message-ID: <20180816175328.4bf2abaf@bbrezillon> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Thu, 16 Aug 2018 17:30:22 +0200 Miquel Raynal wrote: > 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 > Acked-by: Jagan Teki Reviewed-by: Boris Brezillon > --- > 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 756fc6018f..2e547894c6 100644 > --- a/cmd/mtdparts.c > +++ b/cmd/mtdparts.c > @@ -37,7 +37,7 @@ > * mtdids=[,,...] > * > * := = > - * := 'nand'|'nor'|'onenand' > + * := 'nand'|'nor'|'onenand'|'spi-nand' > * := mtd device number, 0... > * := unique device tag used by linux kernel to find mtd device (mtd->name) > * > @@ -339,7 +339,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; > @@ -1030,7 +1030,7 @@ static struct mtdids* id_find_by_mtd_id(const char *mtd_id, unsigned int mtd_id_ > } > > /** > - * Parse device id string := 'nand'|'nor'|'onenand', > + * Parse device id string := 'nand'|'nor'|'onenand'|'spi-nand', > * return device type and number. > * > * @param id string describing device id > @@ -1054,6 +1054,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; > @@ -1636,7 +1639,7 @@ static int parse_mtdids(const char *const ids) > while(p && (*p != '\0')) { > > ret = 1; > - /* parse 'nor'|'nand'|'onenand' */ > + /* parse 'nor'|'nand'|'onenand'|'spi-nand' */ > if (mtd_id_parse(p, &p, &type, &num) != 0) > break; > > @@ -2112,7 +2115,7 @@ static char mtdparts_help_text[] = > "'mtdids' - linux kernel mtd device id <-> u-boot device id mapping\n\n" > "mtdids=[,,...]\n\n" > " := =\n" > - " := 'nand'|'nor'|'onenand'\n" > + " := 'nand'|'nor'|'onenand'|'spi-nand'\n" > " := mtd device number, 0...\n" > " := 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;