cmd: mtdparts: accept spi-nand devices
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> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
b87b0d8d79
commit
00ac922db4
@ -37,7 +37,7 @@
|
|||||||
* mtdids=<idmap>[,<idmap>,...]
|
* mtdids=<idmap>[,<idmap>,...]
|
||||||
*
|
*
|
||||||
* <idmap> := <dev-id>=<mtd-id>
|
* <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...
|
* <dev-num> := mtd device number, 0...
|
||||||
* <mtd-id> := unique device tag used by linux kernel to find mtd device (mtd->name)
|
* <mtd-id> := 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) {
|
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
|
* checking for alignment is easy here
|
||||||
*/
|
*/
|
||||||
offset = part->offset;
|
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 <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.
|
* return device type and number.
|
||||||
*
|
*
|
||||||
* @param id string describing device id
|
* @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) {
|
} else if (strncmp(p, "onenand", 7) == 0) {
|
||||||
*dev_type = MTD_DEV_TYPE_ONENAND;
|
*dev_type = MTD_DEV_TYPE_ONENAND;
|
||||||
p += 7;
|
p += 7;
|
||||||
|
} else if (strncmp(p, "spi-nand", 8) == 0) {
|
||||||
|
*dev_type = MTD_DEV_TYPE_SPINAND;
|
||||||
|
p += 8;
|
||||||
} else {
|
} else {
|
||||||
printf("incorrect device type in %s\n", id);
|
printf("incorrect device type in %s\n", id);
|
||||||
return 1;
|
return 1;
|
||||||
@ -1636,7 +1639,7 @@ static int parse_mtdids(const char *const ids)
|
|||||||
while(p && (*p != '\0')) {
|
while(p && (*p != '\0')) {
|
||||||
|
|
||||||
ret = 1;
|
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)
|
if (mtd_id_parse(p, &p, &type, &num) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2112,7 +2115,7 @@ static char mtdparts_help_text[] =
|
|||||||
"'mtdids' - linux kernel mtd device id <-> u-boot device id mapping\n\n"
|
"'mtdids' - linux kernel mtd device id <-> u-boot device id mapping\n\n"
|
||||||
"mtdids=<idmap>[,<idmap>,...]\n\n"
|
"mtdids=<idmap>[,<idmap>,...]\n\n"
|
||||||
"<idmap> := <dev-id>=<mtd-id>\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"
|
"<dev-num> := mtd device number, 0...\n"
|
||||||
"<mtd-id> := unique device tag used by linux kernel to find mtd device (mtd->name)\n\n"
|
"<mtd-id> := unique device tag used by linux kernel to find mtd device (mtd->name)\n\n"
|
||||||
"'mtdparts' - partition list\n\n"
|
"'mtdparts' - partition list\n\n"
|
||||||
|
@ -15,9 +15,12 @@
|
|||||||
#define MTD_DEV_TYPE_NOR 0x0001
|
#define MTD_DEV_TYPE_NOR 0x0001
|
||||||
#define MTD_DEV_TYPE_NAND 0x0002
|
#define MTD_DEV_TYPE_NAND 0x0002
|
||||||
#define MTD_DEV_TYPE_ONENAND 0x0004
|
#define MTD_DEV_TYPE_ONENAND 0x0004
|
||||||
|
#define MTD_DEV_TYPE_SPINAND 0x0008
|
||||||
|
|
||||||
#define MTD_DEV_TYPE(type) ((type == MTD_DEV_TYPE_NAND) ? "nand" : \
|
#define MTD_DEV_TYPE(type) (type == MTD_DEV_TYPE_NAND ? "nand" : \
|
||||||
(type == MTD_DEV_TYPE_ONENAND) ? "onenand" : "nor")
|
(type == MTD_DEV_TYPE_NOR ? "nor" : \
|
||||||
|
(type == MTD_DEV_TYPE_ONENAND ? "onenand" : \
|
||||||
|
"spi-nand"))) \
|
||||||
|
|
||||||
struct mtd_device {
|
struct mtd_device {
|
||||||
struct list_head link;
|
struct list_head link;
|
||||||
|
Loading…
Reference in New Issue
Block a user