summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/parsers
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2020-05-03 17:53:40 +0200
committerMiquel Raynal <miquel.raynal@bootlin.com>2020-05-11 09:51:42 +0200
commit568d841b6837fc2bb5c45d6f3e56b65ffb5ecac2 (patch)
treee304c42d0b935f0df7840d9898d9b676f47a93bb /drivers/mtd/parsers
parentmtd: partitions: ofpart: Parse the slc-mode property (diff)
downloadlinux-568d841b6837fc2bb5c45d6f3e56b65ffb5ecac2.tar.xz
linux-568d841b6837fc2bb5c45d6f3e56b65ffb5ecac2.zip
mtd: cmdlinepart: Add an slc option to use SLC mode on a part
Add a new option to set the MTD_SLC_ON_MLC_EMULATION flag. Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20200503155341.16712-8-miquel.raynal@bootlin.com
Diffstat (limited to 'drivers/mtd/parsers')
-rw-r--r--drivers/mtd/parsers/cmdlinepart.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/mtd/parsers/cmdlinepart.c b/drivers/mtd/parsers/cmdlinepart.c
index c86f2db8c882..af712f1519c5 100644
--- a/drivers/mtd/parsers/cmdlinepart.c
+++ b/drivers/mtd/parsers/cmdlinepart.c
@@ -9,7 +9,7 @@
*
* mtdparts=<mtddef>[;<mtddef]
* <mtddef> := <mtd-id>:<partdef>[,<partdef>]
- * <partdef> := <size>[@<offset>][<name>][ro][lk]
+ * <partdef> := <size>[@<offset>][<name>][ro][lk][slc]
* <mtd-id> := unique name used in mapping driver/device (mtd->name)
* <size> := standard linux memsize OR "-" to denote all remaining space
* size is automatically truncated at end of device
@@ -92,7 +92,7 @@ static struct mtd_partition * newpart(char *s,
int name_len;
unsigned char *extra_mem;
char delim;
- unsigned int mask_flags;
+ unsigned int mask_flags, add_flags;
/* fetch the partition size */
if (*s == '-') {
@@ -109,6 +109,7 @@ static struct mtd_partition * newpart(char *s,
/* fetch partition name and flags */
mask_flags = 0; /* this is going to be a regular partition */
+ add_flags = 0;
delim = 0;
/* check for offset */
@@ -152,6 +153,12 @@ static struct mtd_partition * newpart(char *s,
s += 2;
}
+ /* if slc is found use emulated SLC mode on this partition*/
+ if (!strncmp(s, "slc", 3)) {
+ add_flags |= MTD_SLC_ON_MLC_EMULATION;
+ s += 3;
+ }
+
/* test if more partitions are following */
if (*s == ',') {
if (size == SIZE_REMAINING) {
@@ -184,6 +191,7 @@ static struct mtd_partition * newpart(char *s,
parts[this_part].size = size;
parts[this_part].offset = offset;
parts[this_part].mask_flags = mask_flags;
+ parts[this_part].add_flags = add_flags;
if (name)
strlcpy(extra_mem, name, name_len + 1);
else