Remove already upstreamed patches, add another one from mailing-list.
Signed-off-by: Michael Heimpold <mhei@heimpold.de>
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/linux/kernel/git/cjb/mmc-utils.git
-PKG_SOURCE_DATE:=2019-08-08
-PKG_SOURCE_VERSION:=d40ec535b9d4e4c974e8c2fbfb422cd0348cc5e8
-PKG_MIRROR_HASH:=06bc3a82e173dc0b6823c04645b30db74e2686dc15559bb4e2d4805c43e30b51
+PKG_SOURCE_DATE:=2019-10-10
+PKG_SOURCE_VERSION:=73d6c59af8d1bcedf5de4aa1f5d5b7f765f545f5
+PKG_MIRROR_HASH:=6ff0b32136c7bc64a099f1185a3ca063b5d644056476456a23029e9f6dfa789a
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=
+++ /dev/null
-From bf96e1b2f48eab26c4a0c2a0903d9d7b9a311a1d Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <michael.heimpold@i2se.com>
-Date: Tue, 18 Dec 2018 14:47:16 +0100
-Subject: [PATCH 1/9] Check calloc's return value before using the pointer
-
-If calloc fails, bail out immediately instead of trying to
-use the NULL pointer.
-
-Signed-off-by: Michael Heimpold <michael.heimpold@i2se.com>
-Cc: Michael Heimpold <mhei@heimpold.de>
----
- lsmmc.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/lsmmc.c b/lsmmc.c
-index 9737b37..e514c83 100644
---- a/lsmmc.c
-+++ b/lsmmc.c
-@@ -374,6 +374,8 @@ char *to_binstr(char *hexstr)
- char *binstr;
-
- binstr = calloc(strlen(hexstr) * 4 + 1, sizeof(char));
-+ if (!binstr)
-+ return NULL;
-
- while (hexstr && *hexstr != '\0') {
- if (!isxdigit(*hexstr))
---
-2.17.1
-
+++ /dev/null
-From 9214f2a4002bafef73c9593464ab3841ba7bac12 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <michael.heimpold@i2se.com>
-Date: Tue, 18 Dec 2018 14:49:37 +0100
-Subject: [PATCH 2/9] Cleanup memory in error case
-
-In case that we leave due to malformed string,
-free the allocated memory before returning.
-
-Signed-off-by: Michael Heimpold <michael.heimpold@i2se.com>
-Cc: Michael Heimpold <mhei@heimpold.de>
----
- lsmmc.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/lsmmc.c b/lsmmc.c
-index e514c83..a53bc57 100644
---- a/lsmmc.c
-+++ b/lsmmc.c
-@@ -378,8 +378,10 @@ char *to_binstr(char *hexstr)
- return NULL;
-
- while (hexstr && *hexstr != '\0') {
-- if (!isxdigit(*hexstr))
-+ if (!isxdigit(*hexstr)) {
-+ free(binstr);
- return NULL;
-+ }
-
- if (isdigit(*hexstr))
- strcat(binstr, bindigits[*hexstr - '0']);
---
-2.17.1
-
+++ /dev/null
-From a59d98003c0b2364929ee23ed331d610029c6dcf Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <michael.heimpold@i2se.com>
-Date: Tue, 18 Dec 2018 14:52:12 +0100
-Subject: [PATCH 3/9] Fix parsing of character in to_binstr()
-
-When a hex-digit > 'a' or 'A' is read, we have to add an offset of 10
-to access the valid symbol in our mapping table.
-
-Signed-off-by: Michael Heimpold <michael.heimpold@i2se.com>
-Cc: Michael Heimpold <mhei@heimpold.de>
----
- lsmmc.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/lsmmc.c b/lsmmc.c
-index a53bc57..e64117c 100644
---- a/lsmmc.c
-+++ b/lsmmc.c
-@@ -386,9 +386,9 @@ char *to_binstr(char *hexstr)
- if (isdigit(*hexstr))
- strcat(binstr, bindigits[*hexstr - '0']);
- else if (islower(*hexstr))
-- strcat(binstr, bindigits[*hexstr - 'a']);
-+ strcat(binstr, bindigits[*hexstr - 'a' + 10]);
- else
-- strcat(binstr, bindigits[*hexstr - 'A']);
-+ strcat(binstr, bindigits[*hexstr - 'A' + 10]);
-
- hexstr++;
- }
---
-2.17.1
-
+++ /dev/null
-From f1fc04d7609ab074647aa00e96d4c66d5135b155 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <michael.heimpold@i2se.com>
-Date: Tue, 18 Dec 2018 15:02:25 +0100
-Subject: [PATCH 4/9] Optimize to_binstr() function
-
-Appending multiple times to same string is slow since strcat() needs
-to determine the end during each run. So manually maintain a pointer
-to the end to speed-up things.
-
-Signed-off-by: Michael Heimpold <michael.heimpold@i2se.com>
-Cc: Michael Heimpold <mhei@heimpold.de>
----
- lsmmc.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/lsmmc.c b/lsmmc.c
-index e64117c..86713f7 100644
---- a/lsmmc.c
-+++ b/lsmmc.c
-@@ -371,12 +371,14 @@ char *to_binstr(char *hexstr)
- "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111",
- "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111",
- };
-- char *binstr;
-+ char *binstr, *tail;
-
- binstr = calloc(strlen(hexstr) * 4 + 1, sizeof(char));
- if (!binstr)
- return NULL;
-
-+ tail = binstr;
-+
- while (hexstr && *hexstr != '\0') {
- if (!isxdigit(*hexstr)) {
- free(binstr);
-@@ -384,13 +386,14 @@ char *to_binstr(char *hexstr)
- }
-
- if (isdigit(*hexstr))
-- strcat(binstr, bindigits[*hexstr - '0']);
-+ strcat(tail, bindigits[*hexstr - '0']);
- else if (islower(*hexstr))
-- strcat(binstr, bindigits[*hexstr - 'a' + 10]);
-+ strcat(tail, bindigits[*hexstr - 'a' + 10]);
- else
-- strcat(binstr, bindigits[*hexstr - 'A' + 10]);
-+ strcat(tail, bindigits[*hexstr - 'A' + 10]);
-
- hexstr++;
-+ tail += 4;
- }
-
- return binstr;
---
-2.17.1
-
+++ /dev/null
-From c0375ecea6f3731c0f65ff6abd2c194b90153b26 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <michael.heimpold@i2se.com>
-Date: Tue, 18 Dec 2018 15:09:42 +0100
-Subject: [PATCH 5/9] Add eMMC vendor Micron to table
-
-Signed-off-by: Michael Heimpold <michael.heimpold@i2se.com>
-Cc: Michael Heimpold <mhei@heimpold.de>
----
- lsmmc.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/lsmmc.c b/lsmmc.c
-index 86713f7..4f687ac 100644
---- a/lsmmc.c
-+++ b/lsmmc.c
-@@ -194,6 +194,11 @@ struct ids_database database[] = {
- .id = 0x11,
- .manufacturer = "Toshiba",
- },
-+ {
-+ .type = "mmc",
-+ .id = 0x13,
-+ .manufacturer = "Micron",
-+ },
- {
- .type = "mmc",
- .id = 0x15,
---
-2.17.1
-
-From 6bcf573f9056c6a4fb2ace5aece08a53dc5dceca Mon Sep 17 00:00:00 2001
+From 1307f0efca4acdff036b5b3a60847f7528cd7b6f Mon Sep 17 00:00:00 2001
From: Stephane Fillod <f8cfe@free.fr>
Date: Mon, 14 Jan 2019 17:50:50 +0100
-Subject: [PATCH 6/9] Fix parsing of Product Revision and Serial Number
+Subject: [PATCH] Fix parsing of Product Revision and Serial Number
According to MMC Standard (similar to SDCard Standard).
-From c9c90f4f74ee5318ee9a2f581b665d474f6f90c5 Mon Sep 17 00:00:00 2001
+From a2985ca233641f596926314762b5f1085aeaa723 Mon Sep 17 00:00:00 2001
From: Stephane Fillod <f8cfe@free.fr>
Date: Tue, 15 Jan 2019 14:56:15 +0100
-Subject: [PATCH 7/9] Add various SD/eMMC vendors to table
+Subject: [PATCH] Add various SD/eMMC vendors to table
Part if this list update comes from a compilation of this web site[1].
-From 6ace4329870d9d7b2a2c3603af316b3f1a75e9f2 Mon Sep 17 00:00:00 2001
+From dacd9d2950f5f6559cde1ceec3035ab77e9698ad Mon Sep 17 00:00:00 2001
From: Stephane Fillod <f8cfe@free.fr>
Date: Tue, 15 Jan 2019 15:06:03 +0100
-Subject: [PATCH 8/9] Various fixes
+Subject: [PATCH] Various fixes
These warnings were mainly found using cppcheck.
}
}
diff --git a/mmc_cmds.c b/mmc_cmds.c
-index 19a9da1..9402112 100644
+index fb37189..8f4a476 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -252,6 +252,7 @@ int do_writeprotect_boot_get(int nargs, char **argv)
}
reg = ext_csd[EXT_CSD_WR_REL_PARAM];
-@@ -1805,6 +1813,7 @@ int do_sanitize(int nargs, char **argv)
+@@ -1837,6 +1845,7 @@ int do_sanitize(int nargs, char **argv)
exit(1);
}
return ret;
}
-@@ -2390,6 +2399,7 @@ int do_cache_ctrl(int value, int nargs, char **argv)
+@@ -2422,6 +2431,7 @@ int do_cache_ctrl(int value, int nargs, char **argv)
exit(1);
}
-From 5425e4e96559b29b36459080190e8bcc1c92f7c2 Mon Sep 17 00:00:00 2001
+From f54f401085e011e6f9c7b120aa1794b19c32b493 Mon Sep 17 00:00:00 2001
From: "Shivamurthy Shastri (sshivamurthy)" <sshivamurthy@micron.com>
Date: Wed, 10 Apr 2019 13:38:08 +0000
-Subject: [PATCH 9/9] mmc-utils: let FFU mode use CMD23 and CMD25
+Subject: [PATCH] mmc-utils: let FFU mode use CMD23 and CMD25
As per specification, the host can use either CMD24 or CMD25 in
closed-ended or open-ended way.
2 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/mmc.h b/mmc.h
-index 285c1f1..a4cbba4 100644
+index 648fb26..d648f68 100644
--- a/mmc.h
+++ b/mmc.h
@@ -25,10 +25,12 @@
#define MMC_WRITE_MULTIPLE_BLOCK 25 /* adtc R1 */
#define MMC_SET_WRITE_PROT 28 /* ac [31:0] data addr R1b */
diff --git a/mmc_cmds.c b/mmc_cmds.c
-index 9402112..0a3788a 100644
+index 8f4a476..c006ef2 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
-@@ -2424,12 +2424,13 @@ int do_ffu(int nargs, char **argv)
+@@ -2456,12 +2456,13 @@ int do_ffu(int nargs, char **argv)
int sect_done = 0, retry = 3, ret = -EINVAL;
unsigned int sect_size;
__u8 ext_csd[512];
if (nargs != 3) {
fprintf(stderr, "Usage: ffu <image name> </path/to/mmcblkX> \n");
-@@ -2449,14 +2450,6 @@ int do_ffu(int nargs, char **argv)
+@@ -2481,14 +2482,6 @@ int do_ffu(int nargs, char **argv)
exit(1);
}
ret = read_extcsd(dev_fd, ext_csd);
if (ret) {
fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
-@@ -2481,9 +2474,17 @@ int do_ffu(int nargs, char **argv)
+@@ -2513,9 +2506,17 @@ int do_ffu(int nargs, char **argv)
}
fw_size = lseek(img_fd, 0, SEEK_END);
goto out;
}
-@@ -2493,14 +2494,19 @@ int do_ffu(int nargs, char **argv)
+@@ -2525,14 +2526,19 @@ int do_ffu(int nargs, char **argv)
goto out;
}
/* put device into ffu mode */
multi_cmd->cmds[0].opcode = MMC_SWITCH;
-@@ -2511,37 +2517,42 @@ int do_ffu(int nargs, char **argv)
+@@ -2543,37 +2549,42 @@ int do_ffu(int nargs, char **argv)
multi_cmd->cmds[0].flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
multi_cmd->cmds[0].write_flag = 1;
goto out;
}
-@@ -2568,9 +2579,6 @@ do_retry:
+@@ -2600,9 +2611,6 @@ do_retry:
} else {
fprintf(stderr, "Programmed %d/%jd bytes\r", sect_done * sect_size, (intmax_t)fw_size);
}
}
if ((sect_done * sect_size) == fw_size) {
-@@ -2607,7 +2615,7 @@ do_retry:
+@@ -2639,7 +2647,7 @@ do_retry:
if (ret) {
perror("Multi-cmd ioctl failed setting install mode");
/* In case multi-cmd ioctl failed before exiting from ffu mode */
--- /dev/null
+From 3539243dcab7b84bb8a45e2c2da80e162284bffc Mon Sep 17 00:00:00 2001
+From: Michael Heimpold <mhei@heimpold.de>
+Date: Sat, 8 Dec 2018 10:43:01 +0100
+Subject: [PATCH] One further optimization of trimming routine
+
+The last change to the trimming routine made it more efficient,
+however, we can even get rid of the memmove() as we leave the
+function with strdup() anyway.
+
+Signed-off-by: Michael Heimpold <mhei@heimpold.de>
+Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+---
+ lsmmc.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/lsmmc.c b/lsmmc.c
+index 06cc0b8..05d59e8 100644
+--- a/lsmmc.c
++++ b/lsmmc.c
+@@ -393,10 +393,9 @@ char *read_file(char *name)
+ start++;
+ len--;
+ }
+- memmove(line, start, len);
+- line[len] = '\0';
+
+- return strdup(line);
++ start[len] = '\0';
++ return strdup(start);
+ }
+
+ /* Hexadecimal string parsing functions */
+--
+2.17.1
+